Search in sources :

Example 6 with AbstractConfiguration

use of org.apache.commons.configuration.AbstractConfiguration in project zuul by Netflix.

the class StartServer method initZuul.

void initZuul() throws Exception, IllegalAccessException, InstantiationException {
    RequestContext.setContextClass(NFRequestContext.class);
    CounterFactory.initialize(new Counter());
    TracerFactory.initialize(new Tracer());
    LOG.info("Starting Groovy Filter file manager");
    final AbstractConfiguration config = ConfigurationManager.getConfigInstance();
    final String preFiltersPath = config.getString(ZUUL_FILTER_PRE_PATH);
    final String postFiltersPath = config.getString(ZUUL_FILTER_POST_PATH);
    final String routingFiltersPath = config.getString(ZUUL_FILTER_ROUTING_PATH);
    final String customPath = config.getString(ZUUL_FILTER_CUSTOM_PATH);
    FilterLoader.getInstance().setCompiler(new GroovyCompiler());
    FilterFileManager.setFilenameFilter(new GroovyFileFilter());
    if (customPath == null) {
        FilterFileManager.init(5, preFiltersPath, postFiltersPath, routingFiltersPath);
    } else {
        FilterFileManager.init(5, preFiltersPath, postFiltersPath, routingFiltersPath, customPath);
    }
    LOG.info("Groovy Filter file manager started");
}
Also used : AbstractConfiguration(org.apache.commons.configuration.AbstractConfiguration) GroovyCompiler(com.netflix.zuul.groovy.GroovyCompiler) Counter(com.netflix.zuul.plugins.Counter) GroovyFileFilter(com.netflix.zuul.groovy.GroovyFileFilter) Tracer(com.netflix.zuul.plugins.Tracer)

Example 7 with AbstractConfiguration

use of org.apache.commons.configuration.AbstractConfiguration in project java-chassis by ServiceComb.

the class TestSimpleTransactionControlFilter method beforeCls.

@BeforeClass
public static void beforeCls() {
    AbstractConfiguration configuration = new BaseConfiguration();
    configuration.addProperty("cse.loadbalance.test.flowsplitFilter.policy", "io.servicecomb.loadbalance.filter.SimpleFlowsplitFilter");
    configuration.addProperty("cse.loadbalance.test.flowsplitFilter.options.tag0", "value0");
}
Also used : AbstractConfiguration(org.apache.commons.configuration.AbstractConfiguration) BaseConfiguration(org.apache.commons.configuration.BaseConfiguration) BeforeClass(org.junit.BeforeClass)

Example 8 with AbstractConfiguration

use of org.apache.commons.configuration.AbstractConfiguration in project java-chassis by ServiceComb.

the class TestLoadbalanceHandler method beforeCls.

@BeforeClass
public static void beforeCls() {
    AbstractConfiguration configuration = new BaseConfiguration();
    DynamicPropertyFactory.initWithConfigurationSource(new ConfigurationBackedDynamicPropertySupportImpl(configuration));
    configuration.addProperty("cse.loadbalance.test.transactionControl.policy", "io.servicecomb.loadbalance.filter.SimpleTransactionControlFilter");
    configuration.addProperty("cse.loadbalance.test.transactionControl.options.tag0", "value0");
    configuration.addProperty("cse.loadbalance.test.isolation.enabled", "true");
}
Also used : AbstractConfiguration(org.apache.commons.configuration.AbstractConfiguration) BaseConfiguration(org.apache.commons.configuration.BaseConfiguration) ConfigurationBackedDynamicPropertySupportImpl(com.netflix.config.ConfigurationBackedDynamicPropertySupportImpl) BeforeClass(org.junit.BeforeClass)

Example 9 with AbstractConfiguration

use of org.apache.commons.configuration.AbstractConfiguration in project java-chassis by ServiceComb.

the class CseAutoConfiguration method configureArchaius.

protected void configureArchaius(ConfigurableEnvironmentConfiguration envConfig) {
    if (INITIALIZED.compareAndSet(false, true)) {
        String appName = this.env.getProperty("spring.application.name");
        if (appName == null) {
            appName = "application";
        //log.warn("No spring.application.name found, defaulting to 'application'");
        }
        System.setProperty(DeploymentContext.ContextKey.appId.getKey(), appName);
        ConcurrentCompositeConfiguration config = new ConcurrentCompositeConfiguration();
        // etc...)
        if (this.externalConfigurations != null) {
            for (AbstractConfiguration externalConfig : this.externalConfigurations) {
                config.addConfiguration(externalConfig);
            }
        }
        config.addConfiguration(envConfig, ConfigurableEnvironmentConfiguration.class.getSimpleName());
        // below come from ConfigurationManager.createDefaultConfigInstance()
        DynamicURLConfiguration defaultURLConfig = new DynamicURLConfiguration();
        try {
            config.addConfiguration(defaultURLConfig, URL_CONFIG_NAME);
        } catch (Throwable ex) {
        //log.error("Cannot create config from " + defaultURLConfig, ex);
        }
        // TODO: sys/env above urls?
        if (!Boolean.getBoolean(DISABLE_DEFAULT_SYS_CONFIG)) {
            SystemConfiguration sysConfig = new SystemConfiguration();
            config.addConfiguration(sysConfig, SYS_CONFIG_NAME);
        }
        if (!Boolean.getBoolean(DISABLE_DEFAULT_ENV_CONFIG)) {
            EnvironmentConfiguration environmentConfiguration = new EnvironmentConfiguration();
            config.addConfiguration(environmentConfiguration, ENV_CONFIG_NAME);
        }
        ConcurrentCompositeConfiguration appOverrideConfig = new ConcurrentCompositeConfiguration();
        config.addConfiguration(appOverrideConfig, APPLICATION_PROPERTIES);
        config.setContainerConfigurationIndex(config.getIndexOfConfiguration(appOverrideConfig));
        addArchaiusConfiguration(config);
    }
//        else {
//            // TODO: reinstall ConfigurationManager
//            //log.warn(
//            //       "Netflix ConfigurationManager has already been installed, unable to re-install");
//        }
}
Also used : AbstractConfiguration(org.apache.commons.configuration.AbstractConfiguration) EnvironmentConfiguration(org.apache.commons.configuration.EnvironmentConfiguration) DynamicURLConfiguration(com.netflix.config.DynamicURLConfiguration) SystemConfiguration(org.apache.commons.configuration.SystemConfiguration) ConcurrentCompositeConfiguration(com.netflix.config.ConcurrentCompositeConfiguration)

Example 10 with AbstractConfiguration

use of org.apache.commons.configuration.AbstractConfiguration in project java-chassis by ServiceComb.

the class CseEndpoint method invoke.

@Override
public Map<String, Object> invoke() {
    Map<String, Object> map = new LinkedHashMap<String, Object>();
    AbstractConfiguration config = ConfigurationManager.getConfigInstance();
    if (config instanceof ConcurrentCompositeConfiguration) {
        ConcurrentCompositeConfiguration composite = (ConcurrentCompositeConfiguration) config;
        for (Configuration item : composite.getConfigurations()) {
            append(map, item);
        }
    } else {
        append(map, config);
    }
    return map;
}
Also used : AbstractConfiguration(org.apache.commons.configuration.AbstractConfiguration) Configuration(org.apache.commons.configuration.Configuration) ConcurrentCompositeConfiguration(com.netflix.config.ConcurrentCompositeConfiguration) AbstractConfiguration(org.apache.commons.configuration.AbstractConfiguration) SystemConfiguration(org.apache.commons.configuration.SystemConfiguration) EnvironmentConfiguration(org.apache.commons.configuration.EnvironmentConfiguration) ConcurrentCompositeConfiguration(com.netflix.config.ConcurrentCompositeConfiguration) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

AbstractConfiguration (org.apache.commons.configuration.AbstractConfiguration)80 Test (org.junit.Test)29 ConcurrentCompositeConfiguration (com.netflix.config.ConcurrentCompositeConfiguration)18 BeforeClass (org.junit.BeforeClass)10 Configuration (org.apache.commons.configuration.Configuration)9 URI (java.net.URI)6 BaseConfiguration (org.apache.commons.configuration.BaseConfiguration)6 HttpRequest (com.netflix.client.http.HttpRequest)5 ArrayList (java.util.ArrayList)5 DynamicConfiguration (com.netflix.config.DynamicConfiguration)4 EnvironmentConfiguration (org.apache.commons.configuration.EnvironmentConfiguration)4 SystemConfiguration (org.apache.commons.configuration.SystemConfiguration)4 HttpResponse (com.netflix.client.http.HttpResponse)3 ConcurrentMapConfiguration (com.netflix.config.ConcurrentMapConfiguration)3 ExpandedConfigurationListenerAdapter (com.netflix.config.ExpandedConfigurationListenerAdapter)3 LinkedHashMap (java.util.LinkedHashMap)3 Properties (java.util.Properties)3 AggregatedConfiguration (com.netflix.config.AggregatedConfiguration)2 ConfigurationManager (com.netflix.config.ConfigurationManager)2 DynamicURLConfiguration (com.netflix.config.DynamicURLConfiguration)2