當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。