本文整理汇总了Java中org.apache.commons.configuration.EnvironmentConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java EnvironmentConfiguration类的具体用法?Java EnvironmentConfiguration怎么用?Java EnvironmentConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EnvironmentConfiguration类属于org.apache.commons.configuration包,在下文中一共展示了EnvironmentConfiguration类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createLocalConfig
import org.apache.commons.configuration.EnvironmentConfiguration; //导入依赖的package包/类
public static ConcurrentCompositeConfiguration createLocalConfig(List<ConfigModel> configModelList) {
ConcurrentCompositeConfiguration config = new ConcurrentCompositeConfiguration();
duplicateServiceCombConfigToCse(config,
new ConcurrentMapConfiguration(new SystemConfiguration()),
"configFromSystem");
duplicateServiceCombConfigToCse(config,
convertEnvVariable(new ConcurrentMapConfiguration(new EnvironmentConfiguration())),
"configFromEnvironment");
duplicateServiceCombConfigToCse(config,
new DynamicConfiguration(
new MicroserviceConfigurationSource(configModelList), new NeverStartPollingScheduler()),
"configFromYamlFile");
return config;
}
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:17,代码来源:ConfigUtil.java
示例2: getUserConfigFilename
import org.apache.commons.configuration.EnvironmentConfiguration; //导入依赖的package包/类
private Optional<String> getUserConfigFilename() throws NamingException {
CompositeConfiguration cc = new CompositeConfiguration();
JNDIConfiguration jndi = new JNDIConfiguration();
EnvironmentConfiguration env = new EnvironmentConfiguration();
SystemConfiguration jvm = new SystemConfiguration();
cc.addConfiguration(jvm);
cc.addConfiguration(env);
cc.addConfiguration(jndi);
//
final String CONFIG_FILENAME = (String) cc.getProperty("gladosWiki_configFile");
if (false == Strings.isNullOrEmpty(CONFIG_FILENAME)) {
LOG.debug(String.format("LOCAL-CONFIG CONFIG_FILENAME = %s", CONFIG_FILENAME));
return Optional.of(CONFIG_FILENAME);
} else {
return Optional.absent();
}
}
开发者ID:ageldama,项目名称:glados-wiki,代码行数:18,代码来源:GroovyConfigurer.java
示例3: append
import org.apache.commons.configuration.EnvironmentConfiguration; //导入依赖的package包/类
private void append(Map<String, Object> map, Configuration config) {
if (config instanceof ConfigurableEnvironmentConfiguration) {
return;
}
if (config instanceof SystemConfiguration) {
return;
}
if (config instanceof EnvironmentConfiguration) {
return;
}
for (Iterator<String> iter = config.getKeys(); iter.hasNext();) {
String key = iter.next();
map.put(key, config.getProperty(key));
}
}
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:16,代码来源:ArchaiusEndpoint.java
示例4: getData
import org.apache.commons.configuration.EnvironmentConfiguration; //导入依赖的package包/类
/**
* Returns the configuration data. If configuration data is null, method first attempts to
* create a configuration data from JVM's system properties.<br>
*
* @return test configuration data
*/
public synchronized Configuration getData() {
if (data != null) {
return data;
}
final HierarchicalConfiguration cfg = new HierarchicalConfiguration();
cfg.copy(new EnvironmentConfiguration());// copy the environment variables.
cfg.copy(new SystemConfiguration());// JVM args
log.debug("Configuration data from Env:\n" + ConfigurationUtils.toString(cfg));
return data = prepareData(cfg);
}
开发者ID:vmware,项目名称:data-driven-framework,代码行数:17,代码来源:DDConfig.java
示例5: configureArchaius
import org.apache.commons.configuration.EnvironmentConfiguration; //导入依赖的package包/类
protected static void configureArchaius(ConfigurableEnvironmentConfiguration envConfig, ConfigurableEnvironment env, List<AbstractConfiguration> externalConfigurations) {
if (initialized.compareAndSet(false, true)) {
String appName = 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();
// support to add other Configurations (Jdbc, DynamoDb, Zookeeper, jclouds,
// etc...)
if (externalConfigurations != null) {
for (AbstractConfiguration externalConfig : externalConfigurations) {
config.addConfiguration(externalConfig);
}
}
config.addConfiguration(envConfig,
ConfigurableEnvironmentConfiguration.class.getSimpleName());
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");
}
}
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:53,代码来源:ArchaiusAutoConfiguration.java
注:本文中的org.apache.commons.configuration.EnvironmentConfiguration类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论