Search in sources :

Example 1 with NoOpTextEncryptor

use of org.craftercms.commons.crypto.impl.NoOpTextEncryptor 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<HierarchicalConfiguration> builder;
        if (textEncryptor instanceof NoOpTextEncryptor) {
            builder = new MultiResourceConfigurationBuilder(configPaths, resourceLoader);
        } else {
            builder = new MultiResourceConfigurationBuilder(configPaths, resourceLoader, textEncryptor);
        }
        HierarchicalConfiguration config = 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) ConfigurationException(org.apache.commons.configuration2.ex.ConfigurationException) MultiResourceConfigurationBuilder(org.craftercms.engine.util.config.impl.MultiResourceConfigurationBuilder) NoOpTextEncryptor(org.craftercms.commons.crypto.impl.NoOpTextEncryptor) HierarchicalConfiguration(org.apache.commons.configuration2.HierarchicalConfiguration)

Aggregations

HierarchicalConfiguration (org.apache.commons.configuration2.HierarchicalConfiguration)1 ConfigurationException (org.apache.commons.configuration2.ex.ConfigurationException)1 NoOpTextEncryptor (org.craftercms.commons.crypto.impl.NoOpTextEncryptor)1 SiteContextCreationException (org.craftercms.engine.exception.SiteContextCreationException)1 MultiResourceConfigurationBuilder (org.craftercms.engine.util.config.impl.MultiResourceConfigurationBuilder)1