com.netflix.config.ConcurrentCompositeConfiguration Java Examples
The following examples show how to use
com.netflix.config.ConcurrentCompositeConfiguration.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConfigUtil.java From servicecomb-java-chassis with Apache License 2.0 | 6 votes |
public static ConcurrentCompositeConfiguration createLocalConfig(List<ConfigModel> configModelList) { ConcurrentCompositeConfiguration config = new ConcurrentCompositeConfiguration(); duplicateCseConfigToServicecomb(config, new ConcurrentMapConfiguration(new SystemConfiguration()), "configFromSystem"); duplicateCseConfigToServicecomb(config, convertEnvVariable(new ConcurrentMapConfiguration(new EnvironmentConfiguration())), "configFromEnvironment"); // If there is extra configurations, add it into config. EXTRA_CONFIG_MAP.entrySet() .stream() .filter(mapEntry -> !mapEntry.getValue().isEmpty()) .forEachOrdered(configMapEntry -> duplicateCseConfigToServicecomb(config, new ConcurrentMapConfiguration(configMapEntry.getValue()), configMapEntry.getKey())); // we have already copy the cse config to the serviceComb config when we load the config from local yaml files // hence, we do not need duplicate copy it. config.addConfiguration(new DynamicConfiguration( new MicroserviceConfigurationSource(configModelList), new NeverStartPollingScheduler()), "configFromYamlFile"); duplicateCseConfigToServicecombAtFront(config, new ConcurrentMapConfiguration(ConfigMapping.getConvertedMap(config)), "configFromMapping"); return config; }
Example #2
Source File: DynamicZookeeperConfigurationSourceTest.java From chassis with Apache License 2.0 | 6 votes |
@Before public void beforeClass() throws Exception { zookeeper = new TestingServer(SocketUtils.findAvailableTcpPort()); curatorFramework = CuratorFrameworkFactory.newClient(zookeeper.getConnectString(), new RetryOneTime(1000)); curatorFramework.start(); curatorFramework.create().forPath(CONFIG_BASE_PATH); Map<String, Object> defaults = new HashMap<>(); defaults.put(DEF_KEY1, DEF_VAL1); defaults.put(DEF_KEY2, DEF_VAL2); defaultConfiguration = new MapConfiguration(defaults); node = UUID.randomUUID().toString(); config = new ConcurrentCompositeConfiguration(); }
Example #3
Source File: ConfigUtil.java From servicecomb-java-chassis with Apache License 2.0 | 6 votes |
public static ConcurrentCompositeConfiguration createLocalConfig() { MicroserviceConfigLoader loader = new MicroserviceConfigLoader(); loader.loadAndSort(); if (localConfig.size() > 0) { ConfigModel model = new ConfigModel(); model.setConfig(localConfig); loader.getConfigModels().add(model); } LOGGER.info("create local config:"); boolean isPrintUrl = DynamicPropertyFactory.getInstance() .getBooleanProperty(IS_PRINT_URL, true).get(); if (isPrintUrl) { LOGGER.info(" {}.", StringUtils.join(loader.getConfigModels(), ",")); } ConcurrentCompositeConfiguration config = ConfigUtil.createLocalConfig(loader.getConfigModels()); ConfigUtil.setMicroserviceConfigLoader(config, loader); return config; }
Example #4
Source File: ConfigUtil.java From servicecomb-java-chassis with Apache License 2.0 | 6 votes |
public static void installDynamicConfig() { if (ConfigurationManager.isConfigurationInstalled()) { LOGGER.warn("Configuration installed by others, will ignore this configuration."); return; } ConcurrentCompositeConfiguration compositeConfig = ConfigUtil.createLocalConfig(); ConfigCenterConfigurationSource configCenterConfigurationSource = createConfigCenterConfigurationSource(compositeConfig); if (configCenterConfigurationSource != null) { createDynamicWatchedConfiguration(compositeConfig, configCenterConfigurationSource); } ConfigurationManager.install(compositeConfig); if (configCenterConfigurationSource != null) { configCenterConfigurationSource.init(compositeConfig); } }
Example #5
Source File: CuratorFrameworkBuilder.java From chassis with Apache License 2.0 | 6 votes |
public CuratorFramework build() { if (this.exhibitors == null && this.zookeeperConnectionString == null) { throw new BootstrapException("Cannot build a CuratorFramework instance because no Zookeeper or Exhibitor connection information was provided."); } ConcurrentCompositeConfiguration configuration = buildConfiguration(); CuratorFramework curatorFramework = null; if (zookeeperConnectionString != null) { curatorFramework = buildCuratorWithZookeeperDirectly(configuration); } else { curatorFramework = buildCuratorWithExhibitor(configuration); } if (startOnBuild) { try { curatorFramework.start(); } catch (Exception e) { BootstrapException.zookeeperInitializationFailed(this.zookeeperConnectionString, this.exhibitors, e); } } return curatorFramework; }
Example #6
Source File: ITBootListener.java From servicecomb-java-chassis with Apache License 2.0 | 6 votes |
protected void selectPort(String cfgKey) { String endpoint = DynamicPropertyFactory.getInstance().getStringProperty(cfgKey, null).get(); if (endpoint == null) { return; } URI uri = URI.create("http://" + endpoint); if (uri.getPort() == 0) { int port = getRandomPort(); try { ConcurrentCompositeConfiguration config = (ConcurrentCompositeConfiguration) DynamicPropertyFactory .getBackingConfigurationSource(); endpoint = new URIBuilder("http://" + endpoint).setPort(port).build().toString().substring(7); config.getConfiguration(0).setProperty(cfgKey, endpoint); LOGGER.info("change {} to {}.", cfgKey, endpoint); } catch (URISyntaxException e) { throw new IllegalStateException("Failed to build endpoint.", e); } } }
Example #7
Source File: SSLOption.java From servicecomb-java-chassis with Apache License 2.0 | 6 votes |
public static String getStringProperty(ConcurrentCompositeConfiguration configSource, String defaultValue, String... keys) { String property = null; for (String key : keys) { if (configSource != null) { Object v = configSource.getProperty(key); if (List.class.isInstance(v)) { property = listToString(((List<?>) v).toArray()); } else { property = (String) configSource.getProperty(key); } } else { property = DynamicPropertyFactory.getInstance().getStringProperty(key, null).get(); } if (property != null) { break; } } if (property != null) { return property; } else { return defaultValue; } }
Example #8
Source File: SSLOption.java From servicecomb-java-chassis with Apache License 2.0 | 6 votes |
private static boolean getBooleanProperty(ConcurrentCompositeConfiguration configSource, boolean defaultValue, String... keys) { String property = null; for (String key : keys) { if (configSource != null) { if (configSource.getProperty(key) != null) { return configSource.getBoolean(key); } } else { property = DynamicPropertyFactory.getInstance().getStringProperty(key, null).get(); } if (property != null) { break; } } if (property != null) { return Boolean.parseBoolean(property); } else { return defaultValue; } }
Example #9
Source File: TestYAMLConfigurationSource.java From servicecomb-java-chassis with Apache License 2.0 | 6 votes |
@Test public void testFullOperation() { // configuration from system properties ConcurrentMapConfiguration configFromSystemProperties = new ConcurrentMapConfiguration(new SystemConfiguration()); // configuration from yaml file DynamicConfiguration configFromYamlFile = new DynamicConfiguration(yamlConfigSource(), new NeverStartPollingScheduler()); // create a hierarchy of configuration that makes // 1) dynamic configuration source override system properties ConcurrentCompositeConfiguration finalConfig = new ConcurrentCompositeConfiguration(); finalConfig.addConfiguration(configFromYamlFile, "yamlConfig"); finalConfig.addConfiguration(configFromSystemProperties, "systemEnvConfig"); Assert.assertEquals(0.5, finalConfig.getDouble("trace.handler.sampler.percent"), 0.5); Object o = finalConfig.getProperty("zq"); @SuppressWarnings("unchecked") List<Map<String, Object>> listO = (List<Map<String, Object>>) o; Assert.assertEquals(3, listO.size()); }
Example #10
Source File: TestConfigUtil.java From servicecomb-java-chassis with Apache License 2.0 | 6 votes |
@Test public void testCreateLocalConfigWithExtraConfig() { Map<String, Object> extraConfig = new ConcurrentHashMapEx<>(1); String extraConfigKey = "extraConfigKey"; String extraConfigValue = "value"; String overriddenConfigKey = "servicecomb.cse.servicecomb.file"; extraConfig.put(extraConfigKey, extraConfigValue); final String propertyHigherPriority = "higher_priority"; String mapedKey1 = "servicecomb.service.mapping.address"; String mapedKey2 = "servicecomb.service1.mapping.address"; extraConfig.put(overriddenConfigKey, propertyHigherPriority); ConfigUtil.addExtraConfig("testExtraConfig", extraConfig); ConcurrentCompositeConfiguration localConfiguration = ConfigUtil.createLocalConfig(); Assert.assertEquals(extraConfigValue, localConfiguration.getProperty(extraConfigKey)); Assert.assertEquals(propertyHigherPriority, localConfiguration.getString(overriddenConfigKey)); // Test mapping key/value from self mappfing.xml Assert.assertEquals("https://myhost:8888", localConfiguration.getString(mapedKey1)); Assert.assertEquals("https://myhost:8888", localConfiguration.getString(mapedKey2)); }
Example #11
Source File: TestConfigUtil.java From servicecomb-java-chassis with Apache License 2.0 | 6 votes |
@Test public void testCreateDynamicConfigNoConfigCenterSPI() { new Expectations(SPIServiceUtils.class) { { SPIServiceUtils.getTargetService(ConfigCenterConfigurationSource.class); result = null; } }; AbstractConfiguration dynamicConfig = ConfigUtil.createDynamicConfig(); MicroserviceConfigLoader loader = ConfigUtil.getMicroserviceConfigLoader(dynamicConfig); List<ConfigModel> list = loader.getConfigModels(); Assert.assertEquals(loader, ConfigUtil.getMicroserviceConfigLoader(dynamicConfig)); Assert.assertEquals(1, list.size()); Assert.assertNotEquals(DynamicWatchedConfiguration.class, ((ConcurrentCompositeConfiguration) dynamicConfig).getConfiguration(0).getClass()); }
Example #12
Source File: TestConfiguration.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
/** * The property key of timerIntervalInMilis changed from <code>servicecomb.loadbalance.stats.timerIntervalInMilis</code> * to <code>servicecomb.loadbalance.stats.timerIntervalInMillis</code>, check the compatibility */ @Test public void testGetTimerIntervalInMillis() { System.setProperty(Configuration.TIMER_INTERVAL_IN_MILLIS, "100"); ConcurrentCompositeConfiguration localConfiguration = ConfigUtil.createLocalConfig(); assertEquals("100", localConfiguration.getProperty(Configuration.TIMER_INTERVAL_IN_MILLIS)); System.clearProperty(Configuration.TIMER_INTERVAL_IN_MILLIS); localConfiguration = ConfigUtil.createLocalConfig(); assertNull(localConfiguration.getProperty(Configuration.TIMER_INTERVAL_IN_MILLIS)); System.setProperty("servicecomb.loadbalance.stats.timerIntervalInMilis", "100"); localConfiguration = ConfigUtil.createLocalConfig(); assertEquals("100", localConfiguration.getProperty(Configuration.TIMER_INTERVAL_IN_MILLIS)); }
Example #13
Source File: ConfigUtil.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
private static void duplicateCseConfigToServicecombAtFront(ConcurrentCompositeConfiguration compositeConfiguration, AbstractConfiguration source, String sourceName) { duplicateCseConfigToServicecomb(source); compositeConfiguration.addConfigurationAtFront(source, sourceName); }
Example #14
Source File: ConfigUtil.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
private static void createDynamicWatchedConfiguration( ConcurrentCompositeConfiguration localConfiguration, ConfigCenterConfigurationSource configCenterConfigurationSource) { ConcurrentMapConfiguration injectConfig = new ConcurrentMapConfiguration(); localConfiguration.addConfigurationAtFront(injectConfig, "extraInjectConfig"); configCenterConfigurationSource.addUpdateListener(new ServiceCombPropertyUpdateListener(injectConfig)); DynamicWatchedConfiguration configFromConfigCenter = new DynamicWatchedConfiguration(configCenterConfigurationSource); duplicateCseConfigToServicecomb(configFromConfigCenter); localConfiguration.addConfigurationAtFront(configFromConfigCenter, "configCenterConfig"); }
Example #15
Source File: ConfigUtil.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
public static AbstractConfiguration createDynamicConfig() { ConcurrentCompositeConfiguration compositeConfig = ConfigUtil.createLocalConfig(); ConfigCenterConfigurationSource configCenterConfigurationSource = createConfigCenterConfigurationSource(compositeConfig); if (configCenterConfigurationSource != null) { createDynamicWatchedConfiguration(compositeConfig, configCenterConfigurationSource); } return compositeConfig; }
Example #16
Source File: TestPriorityProperty.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
@Test public void globalRefresh() { PriorityProperty<String> property = priorityPropertyManager.createPriorityProperty(String.class, null, null, keys); Assert.assertNull(property.getValue()); ConcurrentCompositeConfiguration config = (ConcurrentCompositeConfiguration) DynamicPropertyFactory .getBackingConfigurationSource(); config.addConfiguration(new MapConfiguration(Collections.singletonMap(high, "high-value"))); Assert.assertEquals("high-value", property.getValue()); }
Example #17
Source File: AccessController.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
private void loadConfigurations(ConcurrentCompositeConfiguration config, String prefix) { Map<String, ConfigurationItem> configurations = new HashMap<>(); Iterator<String> configsItems = config.getKeys(prefix); while (configsItems.hasNext()) { String pathKey = configsItems.next(); if (pathKey.endsWith(KEY_RULE_POSTFIX)) { ConfigurationItem configurationItem = new ConfigurationItem(); String rule = DynamicPropertyFactory.getInstance() .getStringProperty(pathKey, null).get(); if (StringUtils.isEmpty(rule)) { continue; } configurationItem.rule = rule; String pathKeyItem = pathKey .substring(prefix.length() + 1, pathKey.length() - KEY_RULE_POSTFIX.length()); configurationItem.propertyName = DynamicPropertyFactory.getInstance() .getStringProperty(String.format(KEY_PROPERTY_NAME, prefix, pathKeyItem), null).get(); if (StringUtils.isEmpty(configurationItem.propertyName)) { continue; } configurationItem.category = DynamicPropertyFactory.getInstance() .getStringProperty(String.format(KEY_CATEGORY, prefix, pathKeyItem), null).get(); if (StringUtils.isEmpty(configurationItem.category)) { continue; } configurations.put(pathKeyItem, configurationItem); } } if (KEY_WHITE_LIST_PREFIX.equals(prefix)) { this.whiteList = configurations; logConfigurations(configurations, true); } else { this.blackList = configurations; logConfigurations(configurations, false); } }
Example #18
Source File: TestMicroServiceInstance.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
@Test public void testCreateMicroserviceInstanceFromFile() { AbstractConfiguration config = ConfigUtil.createDynamicConfig(); ConcurrentCompositeConfiguration configuration = new ConcurrentCompositeConfiguration(); configuration.addConfiguration(config); ConfigurationManager.install(configuration); MicroserviceInstance instance = MicroserviceInstance.createFromDefinition(config); Assert.assertEquals(instance.getDataCenterInfo().getName(), "myDC"); Assert.assertEquals(instance.getDataCenterInfo().getRegion(), "my-Region"); Assert.assertEquals(instance.getDataCenterInfo().getAvailableZone(), "my-Zone"); }
Example #19
Source File: TestRegistry.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
@BeforeClass public static void initSetup() { AbstractConfiguration dynamicConfig = ConfigUtil.createDynamicConfig(); ConcurrentCompositeConfiguration configuration = new ConcurrentCompositeConfiguration(); configuration.addConfiguration(dynamicConfig); configuration.addConfiguration(inMemoryConfig); ConfigurationManager.install(configuration); }
Example #20
Source File: URLMappedEdgeDispatcher.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
private void loadConfigurations() { ConcurrentCompositeConfiguration config = (ConcurrentCompositeConfiguration) DynamicPropertyFactory .getBackingConfigurationSource(); configurations = URLMappedConfigurationLoader.loadConfigurations(config, KEY_MAPPING_PREFIX); config.addConfigurationListener(event -> { if (event.getPropertyName().startsWith(KEY_MAPPING_PREFIX)) { LOG.info("Map rule have been changed. Reload configurations. Event=" + event.getType()); configurations = URLMappedConfigurationLoader.loadConfigurations(config, KEY_MAPPING_PREFIX); } }); }
Example #21
Source File: EdgeAddHeaderClientFilter.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
public EdgeAddHeaderClientFilter() { init(); ((ConcurrentCompositeConfiguration) DynamicPropertyFactory .getBackingConfigurationSource()).addConfigurationListener(event -> { if (event.getPropertyName().startsWith(KEY_HEADERS) || event.getPropertyName().startsWith(KEY_ENABLED)) { LOGGER.info("Public headers config have been changed. Event=" + event.getType()); init(); } }); }
Example #22
Source File: URLMappedConfigurationLoader.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
public static Map<String, URLMappedConfigurationItem> loadConfigurations( ConcurrentCompositeConfiguration config, String configPrefix) { Map<String, URLMappedConfigurationItem> configurations = new HashMap<>(); Iterator<String> configsItems = config.getKeys(configPrefix); while (configsItems.hasNext()) { String pathKey = configsItems.next(); if (pathKey.endsWith(KEY_MAPPING_PATH)) { URLMappedConfigurationItem configurationItem = new URLMappedConfigurationItem(); String pattern = DynamicPropertyFactory.getInstance() .getStringProperty(pathKey, null).get(); if (StringUtils.isEmpty(pattern)) { continue; } configurationItem.setPattern(Pattern.compile(pattern)); configurationItem.setStringPattern(pattern); String pathKeyItem = pathKey .substring(configPrefix.length() + 1, pathKey.length() - KEY_MAPPING_PATH.length()); configurationItem.setMicroserviceName(DynamicPropertyFactory.getInstance() .getStringProperty(String.format(KEY_MAPPING_SERVICE_NAME, configPrefix, pathKeyItem), null).get()); if (StringUtils.isEmpty(configurationItem.getMicroserviceName())) { continue; } configurationItem.setPrefixSegmentCount(DynamicPropertyFactory.getInstance() .getIntProperty(String.format(KEY_MAPPING_PREFIX_SEGMENT_COUNT, configPrefix, pathKeyItem), 0).get()); configurationItem.setVersionRule(DynamicPropertyFactory.getInstance() .getStringProperty(String.format(KEY_MAPPING_VERSION_RULE, configPrefix, pathKeyItem), "0.0.0+").get()); configurations.put(pathKeyItem, configurationItem); } } logConfigurations(configurations); return configurations; }
Example #23
Source File: CommonHttpEdgeDispatcher.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
private void loadConfigurations() { ConcurrentCompositeConfiguration config = (ConcurrentCompositeConfiguration) DynamicPropertyFactory .getBackingConfigurationSource(); configurations = URLMappedConfigurationLoader.loadConfigurations(config, KEY_MAPPING_PREFIX); config.addConfigurationListener(event -> { if (event.getPropertyName().startsWith(KEY_MAPPING_PREFIX)) { LOG.info("Map rule have been changed. Reload configurations. Event=" + event.getType()); configurations = URLMappedConfigurationLoader.loadConfigurations(config, KEY_MAPPING_PREFIX); } }); }
Example #24
Source File: AccessController.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
private void loadConfigurations(String prefix) { ConcurrentCompositeConfiguration config = (ConcurrentCompositeConfiguration) DynamicPropertyFactory .getBackingConfigurationSource(); loadConfigurations(config, prefix); config.addConfigurationListener(event -> { if (event.getPropertyName().startsWith(prefix)) { LOG.info("Access rule have been changed. Reload configurations. Event=" + event.getType()); loadConfigurations(config, prefix); } }); }
Example #25
Source File: ConfigurationSpringInitializer.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
private void setUpSpringPropertySource(Environment environment) { if (environment instanceof ConfigurableEnvironment) { ConfigurableEnvironment ce = (ConfigurableEnvironment) environment; ConfigCenterConfigurationSource configCenterConfigurationSource = SPIServiceUtils.getTargetService(ConfigCenterConfigurationSource.class); if (configCenterConfigurationSource != null) { try { ce.getPropertySources() .addFirst(new MapPropertySource("dynamic-source", configCenterConfigurationSource.getCurrentData())); } catch (Exception e) { LOGGER.warn("set up spring property source failed. msg: {}", e.getMessage()); } } ConcurrentCompositeConfiguration concurrentCompositeConfiguration = ConfigUtil.createLocalConfig(); ce.getPropertySources().addLast( new EnumerablePropertySource<ConcurrentCompositeConfiguration>("microservice.yaml", concurrentCompositeConfiguration) { private String[] propertyNames = null; @Override public String[] getPropertyNames() { if (propertyNames == null) { List<String> keyList = Lists.newArrayList(this.source.getKeys()); propertyNames = keyList.toArray(new String[keyList.size()]); } return propertyNames; } @Override public Object getProperty(String s) { return this.source.getProperty(s); } }); } }
Example #26
Source File: ConfigurationBuilder.java From chassis with Apache License 2.0 | 5 votes |
@SuppressWarnings({"unchecked", "rawtypes"}) private void initApplicationFileConfiguration() { if (applicationPropertiesPath == null) { LOGGER.debug("No client application properties to configure. Skipping..."); applicationFileConfiguration = new ConcurrentMapConfiguration(); return; } this.applicationFileConfiguration = new ConcurrentCompositeConfiguration(); String path = SystemPropertyUtils.resolvePlaceholders(applicationPropertiesPath); LOGGER.debug("Configuring client application properties from path " + applicationPropertiesPath); Map applicationProperties = new Properties(); if (SystemUtils.IS_OS_WINDOWS) { if (path.startsWith("file://")) { if (!path.startsWith("file:///")) { path = path.replaceFirst(Pattern.quote("file://"), "file:///"); } } } try (InputStream is = resourceLoader.getResource(path).getInputStream()) { ((Properties) applicationProperties).load(is); } catch (Exception e) { BootstrapException.resourceLoadingFailed(path, applicationPropertiesPath, e); } Map environmentApplicationProperties = getEnvironmentSpecificProperties(path); if (environmentApplicationProperties != null) { ((ConcurrentCompositeConfiguration) this.applicationFileConfiguration).addConfiguration(new ConcurrentMapConfiguration(environmentApplicationProperties)); } ((ConcurrentCompositeConfiguration) this.applicationFileConfiguration).addConfiguration(new ConcurrentMapConfiguration(applicationProperties)); if (applicationFileConfiguration.containsKey(BootstrapConfigKeys.PUBLISH_DEFAULTS_KEY.getPropertyName())) { this.publishDefaults = applicationFileConfiguration.getBoolean(BootstrapConfigKeys.PUBLISH_DEFAULTS_KEY.getPropertyName()); } }
Example #27
Source File: ConfigurationBuilder.java From chassis with Apache License 2.0 | 5 votes |
private void configureArchaius(ConcurrentCompositeConfiguration finalConfiguration) { if (configureArchaius) { Properties systemProps = System.getProperties(); if (systemProps.getProperty(ARCHAIUS_DEPLOYMENT_ENVIRONMENT) == null) { systemProps.setProperty(ARCHAIUS_DEPLOYMENT_ENVIRONMENT, appEnvironment); } ConfigurationManager.install(finalConfiguration); } }
Example #28
Source File: ConfigurationBuilder.java From chassis with Apache License 2.0 | 5 votes |
/** * Build the Configuration * * @return the configuration */ public AbstractConfiguration build() { initApplicationFileConfiguration(); initAppVersion(); initApplicationConfiguration(); initModuleConfiguration(); ConcurrentCompositeConfiguration finalConfiguration = new ConcurrentCompositeConfiguration(); if (addSystemConfigs) { finalConfiguration.addConfiguration(new ConcurrentMapConfiguration(new SystemConfiguration())); } finalConfiguration.addProperty(BootstrapConfigKeys.APP_VERSION_KEY.getPropertyName(), appVersion); addServerInstanceProperties(finalConfiguration); if (applicationConfiguration == null) { LOGGER.warn("\n\n ****** Default configuration being used ******\n client application \"" + appName + "\" is being configured with modules defaults. Defaults should only be used in development environments.\n In non-developement environments, a configuration provider should be used to configure the client application and it should define ALL required configuration properties.\n"); finalConfiguration.addConfiguration(applicationFileConfiguration); finalConfiguration.addConfiguration(moduleDefaultConfiguration); } else { finalConfiguration.addConfiguration(applicationConfiguration); finalConfiguration.addConfiguration(applicationFileConfiguration); } finalConfiguration.setProperty(BootstrapConfigKeys.APP_VERSION_KEY.getPropertyName(), appVersion); configureArchaius(finalConfiguration); logConfiguration(finalConfiguration); return finalConfiguration; }
Example #29
Source File: CuratorFrameworkBuilder.java From chassis with Apache License 2.0 | 5 votes |
private ConcurrentCompositeConfiguration buildConfiguration() { ConcurrentCompositeConfiguration configuration = new ConcurrentCompositeConfiguration(); configuration.addConfiguration(new ConcurrentMapConfiguration(new SystemConfiguration())); configuration.addConfiguration(this.configuration); configuration.addConfiguration(defaults); return configuration; }
Example #30
Source File: SSLOptionFactory.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
static SSLOptionFactory createSSLOptionFactory(String tag, ConcurrentCompositeConfiguration configSource) { String name = SSLOption.getStringProperty(configSource, null, "ssl." + tag + ".sslOptionFactory", "ssl.sslOptionFactory"); return createSSLOptionFactory(name); }