Bootstrap loading
This feature is currently somehow in the incubator. It means that we are thinking about how to implement it or if we should implement at all.
The idea
The main idea is to have an XML file that defines which configurations should be loaded at startup and which handler and parser should be used for that.This is a draft how such an XML file would look like:
bootstrap.xml:
<?xml version="1.0"?>
<bootstrap>
<configuration name="base">
<url>http://configserver.mydomain.com/base_config.xml</url>
</configuration>
<configuration name="app">
<server>jconfig://configserver.domain.org/app
</configuration>
</bootstrap>
When the ConfigurationManager is instantiated then it will look for a file called bootstrap.xml in the classpath. If there is such a file the ConfigurationManager will process this file and load all defined configurations using the defined handler.
The user can define one or more configurations and define which parser and which handler will be used to read the configuration. One idea is to have a special tag for every handler like url or server. Another idea would be to define the handler with the full qualified name and add additional parameter. This would look like this:
<configuration name="base">
<handler class="org.jconfig.handler.XMLFileHandler">
<parameter name="file" value="/tmp/data/myconfig.xml"/>
</handler>
</configuration>
Why bootstrapping
This might be helpfull if you do not have all configuration files as xml file in your classpath. You do not have to do this kind of bootstrapping in your application when you for example use the configuration server or something else.In combination with the inheritance of configurations you can then load the base configuration from a configuration server or from an URL and only overwrite particular properties that are different in the current environment.
Current state
The bootstrapping is implemented and included in the ConfigurationManager. But it does not read a bootstrapping.xml. It rather acts like the old implementation which means that the DefaultBootstrapLoader will search fpr a file called config.xml and read it. That's it.Any kind of feedback is welcome. As mentioned before we are currently discussing this feature and everything might be changed or even dropped.