本文整理匯總了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);
}