Search in sources :

Example 1 with MergeCombiner

use of org.apache.commons.configuration2.tree.MergeCombiner in project sponge by softelnet.

the class DefaultConfigurationManager method createRootConfig.

protected CommonsConfiguration createRootConfig() {
    MergeCombiner combiner = new MergeCombiner();
    combiner.addListNode(PluginManagerConstants.CFG_PLUGIN);
    CombinedConfiguration cc = new CombinedConfiguration(combiner);
    // Try to add explicit configuration
    if (configurationFilename != null) {
        logger.info("Loading configuration file {}...", configurationFilename);
        Pair<XMLConfiguration, URL> configurationPair = createXmlConfiguration(configurationFilename);
        cc.addConfiguration(configurationPair.getLeft());
        configurationFileUrl = configurationPair.getRight();
    }
    // Add default configuration
    cc.addConfiguration(createXmlConfiguration(ConfigurationConstants.DEFAULT_CONFIG).getLeft());
    return new CommonsConfiguration(cc);
}
Also used : XMLConfiguration(org.apache.commons.configuration2.XMLConfiguration) MergeCombiner(org.apache.commons.configuration2.tree.MergeCombiner) CombinedConfiguration(org.apache.commons.configuration2.CombinedConfiguration) CommonsConfiguration(org.openksavi.sponge.core.config.CommonsConfiguration) URL(java.net.URL)

Aggregations

URL (java.net.URL)1 CombinedConfiguration (org.apache.commons.configuration2.CombinedConfiguration)1 XMLConfiguration (org.apache.commons.configuration2.XMLConfiguration)1 MergeCombiner (org.apache.commons.configuration2.tree.MergeCombiner)1 CommonsConfiguration (org.openksavi.sponge.core.config.CommonsConfiguration)1