Example usage for org.apache.commons.configuration Configuration getBoolean

List of usage examples for org.apache.commons.configuration Configuration getBoolean

Introduction

In this page you can find the example usage for org.apache.commons.configuration Configuration getBoolean.

Prototype

Boolean getBoolean(String key, Boolean defaultValue);

Source Link

Document

Get a Boolean associated with the given configuration key.

Usage

From source file:com.linkedin.pinot.common.utils.ClientSSLContextGenerator.java

public ClientSSLContextGenerator(Configuration sslConfig) {
    if (sslConfig.getBoolean(CONFIG_OF_ENABLE_SERVER_VERIFICATION, true)) {
        _serverCACertFile = sslConfig.getString(CONFIG_OF_SERVER_CA_CERT);
    } else {/*from ww  w .j  av a 2 s .co m*/
        _serverCACertFile = null;
        LOGGER.warn("Https Server CA file not configured.. All servers will be trusted!");
    }
    _keyStoreFile = sslConfig.getString(CONFIG_OF_CLIENT_PKCS12_FILE);
    _keyStorePassword = sslConfig.getString(CONFIG_OF_CLIENT_PKCS12_PASSWORD);
    if ((_keyStorePassword == null && _keyStoreFile != null)
            || (_keyStorePassword != null && _keyStoreFile == null)) {
        throw new IllegalArgumentException("Invalid configuration of keystore file and passowrd");
    }
}

From source file:com.boozallen.cognition.ingest.storm.bolt.csv.CsvLogRecordParserConfig.java

public CsvLogRecordParserConfig(Configuration conf) {
    delimiter = IngestUtilities.getDelimiterByName(conf.getString(DELIMITER, DEFAULT_DELIMITER));
    cleanKeysForES = conf.getBoolean(CLEAN_KEYS_FOR_ES, true);
    skipBlankFields = conf.getBoolean(SKIP_BLANK_FIELDS, true);
    trimFieldValue = conf.getBoolean(TRIM_FIELD_VALUE, true);
}

From source file:com.caricah.iotracah.core.init.EventersInitializer.java

/**
 * <code>configure</code> allows the initializer to configure its self
 * Depending on the implementation conditional operation can be allowed
 * So as to make the system instance more specialized.
 * <p>//from   w w  w  . jav  a2s  .  c  om
 * For example: via the configurations the implementation may decide to
 * shutdown backend services and it just works as a server application to receive
 * and route requests to the workers which are in turn connected to the backend/datastore servers...
 *
 * @param configuration
 * @throws UnRetriableException
 */
@Override
public void configure(Configuration configuration) throws UnRetriableException {

    boolean configEventsEnabled = configuration.getBoolean(CORE_CONFIG_ENGINE_EVENT_IS_ENABLED,
            CORE_CONFIG_ENGINE_EVENT_IS_ENABLED_DEFAULT_VALUE);

    log.debug(" configure : Eventer function is configured to be enabled [{}]", configEventsEnabled);
    setEventEngineEnabled(configEventsEnabled);

    super.configure(configuration);

}

From source file:net.sf.jclal.activelearning.oracle.SimulatedOracle.java

/**
 * @param settings/*from   w  w  w  .j  av a2  s .  c  o  m*/
 *            Configuration object for the oracle.
 *
 *            The XML labels supported are:
 *            <ul>
 *            <li><b>show-on-console= true</b></li>
 *            </ul>
 */
@Override
public void configure(Configuration settings) {

    super.configure(settings);

    boolean console = settings.getBoolean("show-on-console", isShowOnConsole());
    setOnConsole(console);
}

From source file:de.iai.ilcd.webgui.controller.FeatureBean.java

/**
 * Initialize feature bean/*w  w  w  .  j  a v a  2s  .  c  om*/
 */
public FeatureBean() {
    Configuration c = ConfigurationService.INSTANCE.getProperties();

    this.browseProcesses = c.getBoolean("feature.browse.processes", Boolean.TRUE);
    this.browseLCIAMethods = c.getBoolean("feature.browse.lciamethods", Boolean.TRUE);
    this.browseFlows = c.getBoolean("feature.browse.flows", Boolean.TRUE);
    this.browseFlowProperties = c.getBoolean("feature.browse.flowproperties", Boolean.TRUE);
    this.browseUnitGroups = c.getBoolean("feature.browse.unitgroups", Boolean.TRUE);
    this.browseSources = c.getBoolean("feature.browse.sources", Boolean.TRUE);
    this.browseContacts = c.getBoolean("feature.browse.contacts", Boolean.TRUE);

    this.searchProcesses = c.getBoolean("feature.search.processes", Boolean.TRUE);
}

From source file:edu.cwru.sepia.agent.visual.VisualAgent.java

@Override
public void setConfiguration(Configuration config) {
    super.setConfiguration(config);
    humanControllable = config.getBoolean("HumanControllable", false);
    infoVisible = config.getBoolean("InfoVisible", true);
}

From source file:com.caricah.iotracah.core.init.WorkersInitializer.java

/**
 * <code>configure</code> allows the initializer to configure its self
 * Depending on the implementation conditional operation can be allowed
 * So as to make the system instance more specialized.
 * <p>// www .j av  a 2  s  .  com
 * For example: via the configurations the implementation may decide to
 * shutdown backend services and it just works as a server application to receive
 * and route requests to the workers which are in turn connected to the backend/datastore servers...
 *
 * @param configuration
 * @throws UnRetriableException
 */
@Override
public void configure(Configuration configuration) throws UnRetriableException {

    boolean configWorkerEnabled = configuration.getBoolean(CORE_CONFIG_ENGINE_WORKER_IS_ENABLED,
            CORE_CONFIG_ENGINE_WORKER_IS_ENABLED_DEFAULT_VALUE);

    log.debug(" configure : The worker function is configured to be enabled [{}]", configWorkerEnabled);

    setWorkerEngineEnabled(configWorkerEnabled);

    super.configure(configuration);

}

From source file:net.sf.jclal.evaluation.method.RealScenario.java

@Override
protected void setDataConfiguration(Configuration configuration) {
    // Set multiLabel flag
    boolean multi = configuration.getBoolean("multi-label", false);
    setMultiLabel(multi);// ww  w . jav  a  2 s. c  o  m

    // Set multiInstance flag
    boolean multiInstance = configuration.getBoolean("multi-instance", false);
    setMultiInstance(multiInstance);

    // Set the xml file, it is used in the case of a multi-label
    // dataset
    String xml = configuration.getString("file-xml", "");
    setXmlPath(xml);

    // the multi-label elements are verified
    if (multi && xml.isEmpty()) {
        throw new ConfigurationRuntimeException(
                "\nThe multi-label flag is " + "enabled and the xml path is empty. "
                        + "<multi-label>true</multi-label>" + " <file-xml></file-xml>");
    }

    // Set file labeled
    String fileLabeled = configuration.getString("file-labeled", "");
    setFileLabeledDataset(fileLabeled);

    // Set file unlabeled
    String fileUnlabeled = configuration.getString("file-unlabeled", "");
    setFileUnlabeledDataset(fileUnlabeled);

    if (fileLabeled.isEmpty() || fileUnlabeled.isEmpty()) {
        throw new ConfigurationRuntimeException("\n <file-labeled> and <file-unlabeled> tags must be defined.");
    }

    // Set file test
    String fileTest = configuration.getString("file-test", "");

    if (fileTest.isEmpty()) {
        /*
         * Logger.getLogger(RealScenario.class.getName()).log(Level.INFO,
         * "The param <file-test> is empty, the active learning algorithm require this property "
         * +
         * "for evaluating the constructed model, but in real scenario is not really necessary. In this case, "
         * + "we assign the <file-unlabeled> as <file-test>.");
         */
        fileTest = fileUnlabeled;
    }

    setFileTestDataset(fileTest);

    // Set class attribute
    int classAttributeT = configuration.getInt("class-attribute", -1);

    setClassAttribute(classAttributeT);
}

From source file:com.nesscomputing.config.AbstractTestConfig.java

@Test
public void loadBooleanValues() {
    Assert.assertThat(cfg, is(notNullValue()));
    final Configuration config = cfg.getConfiguration();

    Assert.assertThat(config, is(notNullValue()));

    final Boolean s_cfg1 = config.getBoolean("boolean-null-value", null);
    Assert.assertThat(s_cfg1, is(nullValue()));

    final boolean s_cfg2 = config.getBoolean("boolean-value");
    Assert.assertThat(s_cfg2, is(true));
}

From source file:com.nesscomputing.config.AbstractTestConfig.java

@Test
public void loadBooleanValues2() {
    Assert.assertThat(cfg2, is(notNullValue()));
    final Configuration config = cfg2.getConfiguration();

    Assert.assertThat(config, is(notNullValue()));

    final Boolean s_cfg1 = config.getBoolean("boolean-null-value", null);
    Assert.assertThat(s_cfg1, is(nullValue()));

    final boolean s_cfg2 = config.getBoolean("boolean-value");
    Assert.assertThat(s_cfg2, is(true));
}