Am 15.11.2011 14:37, schrieb Billy Newman:
I am trying to read in multiple files into a configuration. The file
names are dynamic so I cannot hard code to names in my config.xml
file.
File names might be something like:
Some-nodes.xml
More-nodes.xml
Is there a way I can specify *-nodes.xml in my config.xml file to load
all files that match?
This feature is not directly supported, but it could be implemented on
top of DefaultConfigurationBuilder.
The DefaultConfigurationBuilder class is the option of choice if
multiple configuration files are to be loaded. It extends
XMLConfiguration and thus can load an XML-based configuration definition
file with the configuration sources to be loaded.
It is also possible to use methods like addProperty() or setProperty()
to create or manipulate a configuration definition file dynamically. The
keys of the properties have to match the XML structures used by such a
document. The unit tests for this class [1] contain some examples how
this could look like.
After you are done with manipulating the definition, just call
getConfiguration(false) on the DefaultConfigurationBuilder instance. The
resulting combined configuration will then contain all the configuration
sources you have added.
HTH
Oliver
[1]
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestDefaultConfigurationBuilder.java?view=markup
Thanks
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org