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");
}
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");
}
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");
}
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");
// }
}
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;
}
Aggregations