Search in sources :

Example 1 with ConfigurationBuilder

use of org.apache.commons.configuration.ConfigurationBuilder in project engine by craftercms.

the class SiteContextFactory method getConfig.

protected HierarchicalConfiguration getConfig(SiteContext siteContext, String[] configPaths, ResourceLoader resourceLoader) {
    String siteName = siteContext.getSiteName();
    try {
        logger.info("--------------------------------------------------");
        logger.info("<Loading configuration for site: " + siteName + ">");
        logger.info("--------------------------------------------------");
        ConfigurationBuilder builder = new MultiConfigurationBuilder(configPaths, resourceLoader);
        HierarchicalConfiguration config = (HierarchicalConfiguration) builder.getConfiguration();
        logger.info("--------------------------------------------------");
        logger.info("</Loading configuration for site: " + siteName + ">");
        logger.info("--------------------------------------------------");
        return config;
    } catch (ConfigurationException e) {
        throw new SiteContextCreationException("Unable to load configuration for site '" + siteContext.getSiteName() + "'", e);
    }
}
Also used : SiteContextCreationException(org.craftercms.engine.exception.SiteContextCreationException) MultiConfigurationBuilder(org.craftercms.engine.util.config.impl.MultiConfigurationBuilder) ConfigurationBuilder(org.apache.commons.configuration.ConfigurationBuilder) ConfigurationException(org.apache.commons.configuration.ConfigurationException) MultiConfigurationBuilder(org.craftercms.engine.util.config.impl.MultiConfigurationBuilder) HierarchicalConfiguration(org.apache.commons.configuration.HierarchicalConfiguration)

Aggregations

ConfigurationBuilder (org.apache.commons.configuration.ConfigurationBuilder)1 ConfigurationException (org.apache.commons.configuration.ConfigurationException)1 HierarchicalConfiguration (org.apache.commons.configuration.HierarchicalConfiguration)1 SiteContextCreationException (org.craftercms.engine.exception.SiteContextCreationException)1 MultiConfigurationBuilder (org.craftercms.engine.util.config.impl.MultiConfigurationBuilder)1