use of org.craftercms.commons.config.ConfigurationException in project engine by craftercms.
the class SiteContextFactory method getProxyConfig.
protected HierarchicalConfiguration getProxyConfig(SiteContext siteContext, List<String> configPaths, ResourceLoader resourceLoader) {
String siteName = siteContext.getSiteName();
logger.info("-------------------------------------------------------");
logger.info("<Loading proxy configuration for site: " + siteName + ">");
logger.info("-------------------------------------------------------");
try {
ListIterator<String> iterator = configPaths.listIterator(configPaths.size());
while (iterator.hasPrevious()) {
Resource resource = resourceLoader.getResource(iterator.previous());
if (resource.exists()) {
return configurationReader.readXmlConfiguration(resource);
}
}
return null;
} catch (ConfigurationException e) {
throw new SiteContextCreationException("Unable to load proxy configuration for site '" + siteName + "'", e);
} finally {
logger.info("---------------------------------------------------------");
logger.info("</Loading proxy configuration for site: " + siteName + ">");
logger.info("---------------------------------------------------------");
}
}
use of org.craftercms.commons.config.ConfigurationException in project engine by craftercms.
the class SiteContextFactory method getConfig.
protected HierarchicalConfiguration getConfig(SiteContext siteContext, String[] configPaths, ResourceLoader resourceLoader) {
String siteName = siteContext.getSiteName();
logger.info("--------------------------------------------------");
logger.info("<Loading configuration for site: " + siteName + ">");
logger.info("--------------------------------------------------");
try {
for (int i = configPaths.length - 1; i >= 0; i--) {
Resource config = resourceLoader.getResource(configPaths[i]);
if (config.exists()) {
return configurationReader.readXmlConfiguration(config);
}
}
return null;
} catch (ConfigurationException e) {
throw new SiteContextCreationException("Unable to load configuration for site '" + siteName + "'", e);
} finally {
logger.info("--------------------------------------------------");
logger.info("</Loading configuration for site: " + siteName + ">");
logger.info("--------------------------------------------------");
}
}
Aggregations