use of org.apache.commons.configuration.DefaultConfigurationBuilder in project metron by apache.
the class ConfigurationManager method getConfiguration.
/**
* Common method to load content of all configuration resources defined in
* 'config-definition.xml'.
*
* @param configDefFilePath
* the config def file path
* @return Configuration
*/
public static Configuration getConfiguration(String configDefFilePath) {
if (configurationsCache.containsKey(configDefFilePath)) {
return configurationsCache.get(configDefFilePath);
}
CombinedConfiguration configuration = null;
synchronized (configurationsCache) {
if (configurationsCache.containsKey(configDefFilePath)) {
return configurationsCache.get(configDefFilePath);
}
DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
String filePath = getConfigDefFilePath(configDefFilePath);
LOGGER.info("loading from 'configDefFilePath' : {}", filePath);
builder.setFile(new File(filePath));
try {
configuration = builder.getConfiguration(true);
configurationsCache.put(filePath, configuration);
} catch (ConfigurationException | ConfigurationRuntimeException e) {
LOGGER.info("Exception in loading property files.", e);
}
}
return configuration;
}
Aggregations