Thanks for your reply!  I'll look into your suggestions and see what I
can come up with. 

-----Original Message-----
From: Oliver Heger [mailto:[email protected]] 
Sent: Wednesday, May 13, 2009 3:56 PM
To: Commons Users List
Subject: Re: [configuration] MultiFile Configuration

Hart, Leo schrieb:
> I am trying to figure out if commons-configuration currently provides
a
> means to specify a folder and load all property files into
> configuration.  For example, I currently have the following:
> 
>       <?xml version="1.0" encoding="UTF-8"?>
>       <configuration>
>        <override>
>         <system />
>        
>         <properties fileName="/properties/propertyFile.properties"
>          throwExceptionOnMissing="false" config-name="override"
>          config-optional="true" />
>       ....
> 
> and would be interested in having something like:
>  
> 
>       <?xml version="1.0" encoding="UTF-8"?>
>       <configuration>
>        <override>
>         <system />
>        
>         <properties fileName="/properties/*.properties"
>          throwExceptionOnMissing="false" config-name="override"
>          config-optional="true" />
>       ....
> 
> Is there currently a way to do this?  If not, what class\classes would
> you recommend extending in order to provide this sort of
functionality?

Unfortunately, this is not supported so far. I had also thought about a 
feature like scanning a directory and collecting all configuration files

found. This would be a nice enhancement for [configuration].

For the implementation I would probably use DefaultConfigurationBuilder.

You can write a simple directory scanner class that adds all 
configuration files it detects to a DefaultConfigurationBuilder 
instance. Because DefaultConfigurationBuilder extends XMLConfiguration 
you can simulate the structure of a configuration definition file with 
corresponding addProperty() calls (I think the unit tests in 
TestDefaultConfigurationBuilder do similar things). After the 
DefaultConfigurationBuilder instance has been initialized you can obtain

a combined configuration object from it.

Oliver

>  
> Thanks!
> Leo
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to