*
* @return an implementation of {@link ConfigurationLoader}.
*/
public void initConfiguration(FilterConfig filterConfig) {
ConfigurationLoader configurationLoader = null;
LOG.debug("Initializing the configuration loader...");
if (StringUtils.isNotBlank(System.getProperty(ConfigurationLoader.DANDELION_CONFLOADER_CLASS))) {
Class<?> clazz;
try {
clazz = ClassUtils.getClass(System.getProperty(ConfigurationLoader.DANDELION_CONFLOADER_CLASS));
configurationLoader = (ConfigurationLoader) ClassUtils.getNewInstance(clazz);
}
catch (Exception e) {
LOG.warn(
"Unable to instantiate the configured {} due to a {} exception. Falling back to the default one.",
ConfigurationLoader.DANDELION_CONFLOADER_CLASS, e.getClass().getName(), e);
}
}
if (configurationLoader == null) {
configurationLoader = new StandardConfigurationLoader();
}
Properties userProperties = new Properties();
userProperties.putAll(configurationLoader.loadUserConfiguration());
configuration = new Configuration(filterConfig, userProperties);
}