Example usage for org.apache.commons.configuration MapConfiguration append

List of usage examples for org.apache.commons.configuration MapConfiguration append

Introduction

In this page you can find the example usage for org.apache.commons.configuration MapConfiguration append.

Prototype

public void append(Configuration c) 

Source Link

Document

Appends the content of the specified configuration to this configuration.

Usage

From source file:org.seedstack.seed.core.internal.CorePlugin.java

private Configuration loadBootstrapConfiguration() {
    MapConfiguration globalConfiguration = new MapConfiguration(new HashMap<String, Object>());

    ClassLoader classLoader = SeedReflectionUtils.findMostCompleteClassLoader();
    if (classLoader == null) {
        throw SeedException.createNew(CoreErrorCode.UNABLE_TO_FIND_CLASSLOADER);
    }/*from  w  ww .j a v  a2  s . c o m*/

    try {
        Enumeration<URL> urls = classLoader.getResources(SEED_BOOTSTRAP_PATH);

        while (urls.hasMoreElements()) {
            URL url = urls.nextElement();
            globalConfiguration.append(new PropertiesConfiguration(url));
        }
    } catch (Exception e) {
        throw SeedException.wrap(e, CoreErrorCode.UNEXPECTED_EXCEPTION);
    }

    return new MapConfiguration(
            new ImmutableMap.Builder<String, Object>().putAll(globalConfiguration.getMap()).build());
}