config/*.ext and other wildcard stuff comes down to the issue with non-existing 
support for it in ClassLoaders. So you will only be able to get this running an 
a few JVMs and e.g. not on that many JavaEE servers.



LieGrue,
strub





> On Thursday, 12 February 2015, 16:45, Oliver B. Fischer 
> <[email protected]> wrote:
> > I felt this feature would be nice for the ConfigurationBuilder. I would 
> like to help our users to write things like
> 
> builder.addPropertySources("file://.../config/*.ext")
>             .build();
> 
> I know how to resolve "file:/.../config/*.ext"). But there is no 
> generic 
> way AFAIK to find the PropertySource handling ".ext".
> 
> Bye,
> 
> Oliver
> 
> 
> Am 12.02.15 um 10:41 schrieb Anatole Tresch:
>>  +1 for some sample snippets. Perhaps also look at the extensions module
>>  called 'formats'. This is still work in progress though (I am not 
> yet
>>  satisfied with the abstractions), though it might go in a direction you
>>  also are thinking, perhaps...?
>> 
>>  public class MyTestSinglePropertySourceProvider extends
>>  BaseSimpleFormatPropertySourceProvider{
>>       public MyTestSinglePropertySourceProvider() {
>>           super(new JSonFormat(),
>>  MyTestSinglePropertySourceProvider.class.getResource(
>>                   "META-INF/config/myConfig.ini"));
>>       }
>> 
>>       @Override
>>       protected PropertySource createPropertySource(String entryTypeName,
>>  Map<String, String> entries,
>>                                                     ConfigurationFormat
>>  formatUsed) {
>>           // assuming there is only one entryTypeName = default
>>           return new HirarchicalPropertySource(entries);
>>       }
>>  }
>> 
>>  and
>> 
>>  public class MyTestMultiPropertySourceProvider extends
>>  BasePathBasedMultiFormatPropertySourceProvider{
>>       public 
> MyTestMultiPropertySourceProvider(List<ConfigurationFormat>
>>  formats, String... paths) {
>>           super(Arrays.asList(new ConfigurationFormat[]{}
>>                   new JsonFormat(),
>>                   new PropertiesFormat(),
>>                   new IniConfigurationFormat()}
>>           ), "META-INF/config/tamaya-config.*");
>>       }
>> 
>>       @Override
>>       protected PropertySource getPropertySource(String entryTypeName,
>>  Map<String, String> entries,
>>                                                  ConfigurationFormat
>>  formatUsed) {
>>           // Convert items read into a corresponding PropertySource
>>           return null;
>>       }
>>  }
>> 
>>  Cheers,
>>  Anatole
>> 
>> 
>> 
>>  2015-02-12 8:38 GMT+01:00 Romain Manni-Bucau <[email protected]>:
>> 
>>>  Can you give a sample please? I dont get the point
>>>    Le 12 févr. 2015 08:25, "Oliver B. Fischer" 
> <[email protected]> a
>>>  écrit :
>>> 
>> 
>> 
> 
> -- 
> 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
>

Reply via email to