@Oliver Matches IMO perfectly a PropertySourceProvider, which 1) reads a system property (or whatever) that defines where your /super/folder/ is. 2) It can use the resources extension to extract all child files (or only some with special file endings), or do it itself. 3) You can take each URL and try to create a PropertySource internally (with whatever logic on mapping the file format in place to properties/priorities) 4) On success add each PropertySource to the internal list of property sources. 5) Handover all property sources to the Configuration Context once the getPropertySources() method is called.
All matches the current API ;) Why we need more? 2015-02-13 9:50 GMT+01:00 Romain Manni-Bucau <[email protected]>: > @Anatole caricaturally it is: > > File[] configs = new File("/super/folder/").listFiles(); > for (final File config : configs) { > addConfig(config); > } > > (but with URLs) > > issue is addConfig. > > > but actually you never do it, you have a provider filtering files it > can handle so finally all handlable files are read > > > > Romain Manni-Bucau > @rmannibucau > http://www.tomitribe.com > http://rmannibucau.wordpress.com > https://github.com/rmannibucau > > > 2015-02-13 9:41 GMT+01:00 Anatole Tresch <[email protected]>: > > I really dont see the use case, sorry. Can you prrhaps post your current > builder api, perhaps that helps to get light into the tunnel... > > > > - > > Anatole Tresch > > Glärnischweg 10 > > 8620 Wetzikon > > Tel +41 (43) 317 05 30 > > - > > Send from Mobile > > > >> Am 13.02.2015 um 09:18 schrieb Oliver B. Fischer < > [email protected]>: > >> > >> My problem is only that I am asking for a way to find a PropertySource > able to handle a given URL. And if a PropertySource is able handle the URL > it must be also able to parse. At least my PropertyProvider are able to do > it. But for the ConfigurationBuilder I need a generic ways to find a > PropertySource able to handle a URL. Ok, I can hardcode it but I think this > is not what I wan't. > >> > >> For now I will add an extension providing a SPI interface. We will see > how it works out. > >> > >> Oliver > >> > >>> Am 13.02.15 um 08:13 schrieb Romain Manni-Bucau: > >>> The point is API is not done to have auto reading of resources cause it > >>> makes no sense in most of cases: xml, json, yaml, txt...all these > formats > >>> need more than knowing the extension to be able to read it. It means > >>> PropertySource has to link path and format which is the role of the > >>> provider you have to write. > >>> > >>> Said otherwise each kind of file type you ll discover will need its > >>> provider otherwise if you do what you described you ll just manage to > not > >>> get the expected conf (in the best case) > >>> Le 13 févr. 2015 00:09, "Oliver B. Fischer" <[email protected]> > a > >>> écrit : > >>> > >>>> It helps me to locate resources, right? But if I understand it > correctly > >>>> it helps me to get a bunch of URLs. So I am at the same point as > before. > >>>> > >>>> Bye, > >>>> > >>>> Oliver > >>>> > >>>> > >>>> > >>>> Am 12.02.15 um 20:51 schrieb Anatole Tresch: > >>>> > >>>> -- > >>>> N Oliver B. Fischer > >>>> A Schönhauser Allee 64, 10437 Berlin, Deutschland/Germany > >>>> P +49 30 44793251 > >>>> M +49 178 7903538 > >>>> E [email protected] > >>>> S oliver.b.fischer > >>>> J [email protected] > >>>> X http://xing.to/obf > >> > >> -- > >> N Oliver B. Fischer > >> A Schönhauser Allee 64, 10437 Berlin, Deutschland/Germany > >> P +49 30 44793251 > >> M +49 178 7903538 > >> E [email protected] > >> S oliver.b.fischer > >> J [email protected] > >> X http://xing.to/obf > >> > -- *Anatole Tresch* Java Engineer & Architect, JSR Spec Lead Glärnischweg 10 CH - 8620 Wetzikon *Switzerland, Europe Zurich, GMT+1* *Twitter: @atsticks* *Blogs: **http://javaremarkables.blogspot.ch/ <http://javaremarkables.blogspot.ch/>* *Google: atsticksMobile +41-76 344 62 79*
