{@code CompositeConfiguration} allows you to add multiple {@code Configuration}objects to an aggregated configuration. If you add Configuration1, and then Configuration2, any properties shared will mean that the value defined by Configuration1 will be returned. If Configuration1 doesn't have the property, then Configuration2 will be checked. You can add multiple different types or the same type of properties file.
When querying properties the order in which child configurations have been added is relevant. To deal with property updates, a so-called in-memory configuration is used. Per default, such a configuration is created automatically. All property writes target this special configuration. There are constructors which allow you to provide a specific in-memory configuration. If used that way, the in-memory configuration is always the last one in the list of child configurations. This means that for query operations all other configurations take precedence.
Alternatively it is possible to mark a child configuration as in-memory configuration when it is added. In this case the treatment of the in-memory configuration is slightly different: it remains in the list of child configurations at the position it was added, i.e. its priority for property queries can be defined by adding the child configurations in the correct order.
This configuration class uses a {@code Synchronizer} to control concurrentaccess. While all methods for reading and writing configuration properties make use of this {@code Synchronizer} per default, the methods for managingthe list of child configurations and the in-memory configuration ( {@code addConfiguration(), getNumberOfConfigurations(), removeConfiguration(),getConfiguration(), getInMemoryConfiguration()}) are guarded, too. Because most methods for accessing configuration data delegate to the list of child configurations, the thread-safety of a {@code CompositeConfiguration}object also depends on the {@code Synchronizer} objects used by thesechildren.
@author
Eric Pugh
@author
Henning P. Schmiedehausen
@version $Id: CompositeConfiguration.java 1624601 2014-09-12 18:04:36Z oheger $