当前位置: 首页>>代码示例>>Java>>正文


Java AbstractConfiguration.getBoolean方法代码示例

本文整理汇总了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");
  }
}
 
开发者ID:Netflix,项目名称:spectator,代码行数:21,代码来源:Plugin.java

示例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);

}
 
开发者ID:12315jack,项目名称:j1st-mqtt,代码行数:9,代码来源:PowerAuthenticator.java

示例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);
}
 
开发者ID:irenical,项目名称:jindy,代码行数:40,代码来源:ArchaiusEtcdFactory.java

示例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);
}
 
开发者ID:irenical,项目名称:jindy,代码行数:40,代码来源:ArchaiusZooKeeperFactory.java

示例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);
  }
}
 
开发者ID:irenical,项目名称:jindy,代码行数:37,代码来源:ArchaiusConsulFactory.java

示例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);
}
 
开发者ID:12315jack,项目名称:j1st-mqtt,代码行数:6,代码来源:DummyAuthenticator.java


注:本文中的org.apache.commons.configuration.AbstractConfiguration.getBoolean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。