Search in sources :

Example 1 with AggregatedConfiguration

use of com.netflix.config.AggregatedConfiguration in project spring-cloud-netflix by spring-cloud.

the class ArchaiusAutoConfiguration method addArchaiusConfiguration.

private static 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);
    }
}
Also used : AbstractConfiguration(org.apache.commons.configuration.AbstractConfiguration) AggregatedConfiguration(com.netflix.config.AggregatedConfiguration) ConcurrentCompositeConfiguration(com.netflix.config.ConcurrentCompositeConfiguration)

Example 2 with AggregatedConfiguration

use of com.netflix.config.AggregatedConfiguration in project ribbon by Netflix.

the class ClientPropertiesProcessor method exportPropertiesToArchaius.

private void exportPropertiesToArchaius(String groupName, IClientConfig config, String configName) {
    Map<String, Object> map = config.getProperties();
    Configuration configuration = ConfigurationManager.getConfigInstance();
    if (configuration instanceof AggregatedConfiguration) {
        AggregatedConfiguration ac = (AggregatedConfiguration) configuration;
        configuration = ac.getConfiguration(configName);
        if (configuration == null) {
            configuration = new ConcurrentMapConfiguration();
            ac.addConfiguration((AbstractConfiguration) configuration, configName);
        }
    }
    for (Map.Entry<String, Object> entry : map.entrySet()) {
        configuration.setProperty(groupName + "." + config.getNameSpace() + "." + entry.getKey(), entry.getValue());
    }
}
Also used : Configuration(org.apache.commons.configuration.Configuration) ConcurrentMapConfiguration(com.netflix.config.ConcurrentMapConfiguration) AbstractConfiguration(org.apache.commons.configuration.AbstractConfiguration) AggregatedConfiguration(com.netflix.config.AggregatedConfiguration) ConcurrentMapConfiguration(com.netflix.config.ConcurrentMapConfiguration) AggregatedConfiguration(com.netflix.config.AggregatedConfiguration) Map(java.util.Map)

Aggregations

AggregatedConfiguration (com.netflix.config.AggregatedConfiguration)2 AbstractConfiguration (org.apache.commons.configuration.AbstractConfiguration)2 ConcurrentCompositeConfiguration (com.netflix.config.ConcurrentCompositeConfiguration)1 ConcurrentMapConfiguration (com.netflix.config.ConcurrentMapConfiguration)1 Map (java.util.Map)1 Configuration (org.apache.commons.configuration.Configuration)1