use of org.apache.commons.configuration.AbstractConfiguration in project zuul by Netflix.
the class RibbonConfig method setIfNotDefined.
private static void setIfNotDefined(String key, String value) {
final AbstractConfiguration config = ConfigurationManager.getConfigInstance();
if (config.getString(key) == null) {
LOG.info("Setting default NIWS Property " + key + "=" + value);
config.setProperty(key, value);
}
}
use of org.apache.commons.configuration.AbstractConfiguration in project java-chassis by ServiceComb.
the class CseAutoConfiguration method addArchaiusConfiguration.
private void addArchaiusConfiguration(ConcurrentCompositeConfiguration config) {
if (ConfigurationManager.isConfigurationInstalled()) {
AbstractConfiguration installedConfiguration = ConfigurationManager.getConfigInstance();
if (installedConfiguration instanceof ConcurrentCompositeConfiguration) {
ConcurrentCompositeConfiguration configInstance = (ConcurrentCompositeConfiguration) installedConfiguration;
configInstance.addConfiguration(config);
} else {
installedConfiguration.append(config);
// if (!(installedConfiguration instanceof AggregatedConfiguration)) {
// //log.warn(
// // "Appending a configuration to an existing non-aggregated
// //installed configuration will have no effect");
// }
}
} else {
ConfigurationManager.install(config);
}
}
use of org.apache.commons.configuration.AbstractConfiguration in project java-chassis by ServiceComb.
the class CseDelegatingProxyUtils method addApplicationContext.
public static void addApplicationContext(ConfigurableApplicationContext context) {
AbstractConfiguration config = ConfigurationManager.getConfigInstance();
config.clearProperty(APPLICATION_CONTEXT);
config.setProperty(APPLICATION_CONTEXT, context);
}
use of org.apache.commons.configuration.AbstractConfiguration in project engine by craftercms.
the class MultiConfigurationBuilder method getConfiguration.
@Override
public Configuration getConfiguration() throws ConfigurationException {
List<Configuration> configs = new ArrayList<>();
// Last configurations should be loaded and added first so that they have greater priority.
logger.info("Loading XML configurations in the order in which the properties will be resolved");
for (int i = configPaths.length - 1; i >= 0; i--) {
try {
Resource resource = resourceLoader.getResource(configPaths[i]);
if (resource.exists()) {
XMLConfiguration config = new XMLConfiguration();
config.load(resource.getInputStream());
logger.info("XML configuration loaded from " + resource);
configs.add(config);
}
} catch (Exception e) {
throw new ConfigurationException("Unable to load configuration at " + configPaths[i], e);
}
}
if (configs.size() > 1) {
CombinedConfiguration combinedConfig = new CombinedConfiguration(new OverrideCombiner());
for (Configuration config : configs) {
combinedConfig.addConfiguration((AbstractConfiguration) config);
}
return combinedConfig;
} else if (configs.size() == 1) {
return configs.get(0);
} else {
return null;
}
}
use of org.apache.commons.configuration.AbstractConfiguration in project incubator-servicecomb-java-chassis by apache.
the class TestConfigUtil method testConvertEnvVariable.
@Test
public void testConvertEnvVariable() {
String someProperty = "cse_service_registry_address";
AbstractConfiguration config = new DynamicConfiguration();
config.addProperty(someProperty, "testing");
AbstractConfiguration result = ConfigUtil.convertEnvVariable(config);
assertThat(result.getString("cse.service.registry.address"), equalTo("testing"));
assertThat(result.getString("cse_service_registry_address"), equalTo("testing"));
}
Aggregations