本文整理汇总了Java中org.apache.commons.configuration.AbstractConfiguration.getBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractConfiguration.getBoolean方法的具体用法?Java AbstractConfiguration.getBoolean怎么用?Java AbstractConfiguration.getBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.configuration.AbstractConfiguration
的用法示例。
在下文中一共展示了AbstractConfiguration.getBoolean方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Plugin
import org.apache.commons.configuration.AbstractConfiguration; //导入方法依赖的package包/类
/** Create a new instance. */
@Inject
Plugin(Registry registry) throws IOException {
AbstractConfiguration config = ConfigurationManager.getConfigInstance();
final boolean enabled = config.getBoolean(ENABLED_PROP, true);
if (enabled) {
ConfigurationManager.loadPropertiesFromResources(CONFIG_FILE);
if (config.getBoolean("spectator.gc.loggingEnabled")) {
GC_LOGGER.start(null);
LOGGER.info("gc logging started");
} else {
LOGGER.info("gc logging is not enabled");
}
Jmx.registerStandardMXBeans(registry);
} else {
LOGGER.debug("plugin not enabled, set " + ENABLED_PROP + "=true to enable");
}
}
示例2: init
import org.apache.commons.configuration.AbstractConfiguration; //导入方法依赖的package包/类
@Override
public void init(AbstractConfiguration config) {
this.allowDollar = config.getBoolean("allowDollar", true);
this.deniedTopic = config.getString("deniedTopic", null);
mongoStorage = new MongoStorage();
mongoStorage.init(config);
}
示例3: getConfiguration
import org.apache.commons.configuration.AbstractConfiguration; //导入方法依赖的package包/类
@Override
protected AbstractConfiguration getConfiguration() throws ConfigNotFoundException {
AbstractConfiguration config = ConfigurationManager.getConfigInstance();
boolean dynamic = config.getBoolean(DYNAMIC_CONFIG, true);
if (!dynamic) {
return new DynamicConfiguration();
}
String appId;
DeploymentContext context = ConfigurationManager.getDeploymentContext();
appId = context.getApplicationId();
if (appId == null) {
LOG.info(
"No applicationId set on archaius deployment context. Will try to use the 'application' property as fallback.");
appId = config.getString("application");
}
if (appId == null) {
throw new RuntimeException(
"Archaius deployment context's applicationId not set nor property 'application' found");
}
String[] etcdHosts = config.getStringArray(ETCD_HOSTS);
Etcd etcdClient;
if(etcdHosts != null && etcdHosts.length > 0) {
URI[] etcdHostURIs = Arrays.stream(etcdHosts).map(URI::create).toArray(URI[]::new);
etcdClient = ClientBuilder.builder().hosts(etcdHostURIs).createClient();
} else {
throw new ConfigNotFoundException("No etcd hosts configured. Could not create etcd client");
}
EtcdConfigurationSource configSource = new EtcdConfigurationSource(etcdClient, appId);
return new DynamicWatchedConfiguration(configSource);
}
示例4: getConfiguration
import org.apache.commons.configuration.AbstractConfiguration; //导入方法依赖的package包/类
@Override
protected AbstractConfiguration getConfiguration() throws Exception {
AbstractConfiguration config = ConfigurationManager.getConfigInstance();
boolean dynamic = config.getBoolean(DYNAMIC_CONFIG, true);
if (!dynamic) {
return new DynamicConfiguration();
}
String appId = null;
DeploymentContext context = ConfigurationManager.getDeploymentContext();
appId = context.getApplicationId();
if (appId == null) {
LOG.info(
"No applicationId set on archaius deployment context. Will try to use the 'application' property as fallback.");
appId = config.getString("application");
}
if (appId == null) {
throw new RuntimeException(
"Archaius deployment context's applicationId not set nor property 'application' found");
}
String zooKeeperConnString = config.getString(ZOOKEEPER_HOSTS);
String rootConfigPath = "/" + appId;
CuratorFramework client = CuratorFrameworkFactory.newClient(zooKeeperConnString, new ExponentialBackoffRetry(1000, 3));
ZooKeeperConfigurationSource configSource = new ZooKeeperConfigurationSource(client, rootConfigPath);
// do the first update synchronously
try {
client.start();
configSource.start();
} catch (Exception e) {
configSource.close();
throw e;
}
return new DynamicWatchedConfiguration(configSource);
}
示例5: getConfiguration
import org.apache.commons.configuration.AbstractConfiguration; //导入方法依赖的package包/类
@Override
protected AbstractConfiguration getConfiguration() {
AbstractConfiguration config = ConfigurationManager.getConfigInstance();
boolean dynamic = config.getBoolean(DYNAMIC_CONFIG, true);
if (!dynamic) {
return new DynamicConfiguration();
} else {
String appId = null;
DeploymentContext context = ConfigurationManager.getDeploymentContext();
appId = context.getApplicationId();
if (appId == null) {
throw new RuntimeException(
"Archaius deployment context's applicationId not set (archaius.deployment.applicationId)");
}
String consulHost = config.getString(CONSUL_HOST, CONSUL_DEFAULT_HOST);
int consulPort = config.getInt(CONSUL_PORT, 8500);
String consulAclToken = config.getString(CONSUL_TOKEN);
ConsulWatchedConfigurationSource configSource = new ConsulWatchedConfigurationSource(appId,
new ConsulClient(consulHost, consulPort), 30, TimeUnit.SECONDS, consulAclToken);
// do the first update synchronously
try {
configSource.runOnce();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
configSource.startAsync();
return new DynamicWatchedConfiguration(configSource);
}
}
示例6: init
import org.apache.commons.configuration.AbstractConfiguration; //导入方法依赖的package包/类
@Override
public void init(AbstractConfiguration config) {
this.allowDollar = config.getBoolean("allowDollar", true);
this.deniedTopic = config.getString("deniedTopic", null);
}