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

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

Introduction

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

Prototype

String getString(String key, String defaultValue);

Source Link

Document

Get a string associated with the given configuration key.

Usage

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:edu.berkeley.sparrow.daemon.SparrowDaemon.java

public void initialize(Configuration conf) throws Exception {
    Level logLevel = Level.toLevel(conf.getString(SparrowConf.LOG_LEVEL, ""), DEFAULT_LOG_LEVEL);
    Logger.getRootLogger().setLevel(logLevel);

    // Start as many node monitors as specified in config
    String[] nmPorts = conf.getStringArray(SparrowConf.NM_THRIFT_PORTS);
    String[] inPorts = conf.getStringArray(SparrowConf.INTERNAL_THRIFT_PORTS);

    if (nmPorts.length != inPorts.length) {
        throw new ConfigurationException(SparrowConf.NM_THRIFT_PORTS + " and "
                + SparrowConf.INTERNAL_THRIFT_PORTS + " not of equal length");
    }//from w w w .  j  ava  2  s .  c  o  m
    if (nmPorts.length > 1 && (!conf.getString(SparrowConf.DEPLYOMENT_MODE, "").equals("standalone"))) {
        throw new ConfigurationException("Mutliple NodeMonitors only allowed " + "in standalone deployment");
    }
    if (nmPorts.length == 0) {
        (new NodeMonitorThrift()).initialize(conf, NodeMonitorThrift.DEFAULT_NM_THRIFT_PORT,
                NodeMonitorThrift.DEFAULT_INTERNAL_THRIFT_PORT);
    } else {
        for (int i = 0; i < nmPorts.length; i++) {
            (new NodeMonitorThrift()).initialize(conf, Integer.parseInt(nmPorts[i]),
                    Integer.parseInt(inPorts[i]));
        }
    }

    SchedulerThrift scheduler = new SchedulerThrift();
    scheduler.initialize(conf);
}

From source file:com.caricah.iotracah.datastore.ignitecache.internal.impl.RoleHandler.java

@Override
public void configure(Configuration configuration) {

    String cacheName = configuration.getString(CONFIG_IGNITECACHE_ROLE_CACHE_NAME,
            CONFIG_IGNITECACHE_ROLE_CACHE_NAME_VALUE_DEFAULT);
    setCacheName(cacheName);/*www. jav a2 s  . c  o  m*/

}

From source file:com.caricah.iotracah.datastore.ignitecache.internal.impl.AccountHandler.java

@Override
public void configure(Configuration configuration) {

    String cacheName = configuration.getString(CONFIG_IGNITECACHE_ACCOUNT_CACHE_NAME,
            CONFIG_IGNITECACHE_ACCOUNT_CACHE_NAME_VALUE_DEFAULT);
    setCacheName(cacheName);//from w  w  w .  j  a  v a 2s .c o  m

}

From source file:com.caricah.iotracah.datastore.ignitecache.internal.impl.RetainedMessageHandler.java

@Override
public void configure(Configuration configuration) {

    String cacheName = configuration.getString(CONFIG_IGNITECACHE_RETAINED_MESSAGE_CACHE_NAME,
            CONFIG_IGNITECACHE_RETAINED_MESSAGE_CACHE_NAME_VALUE_DEFAULT);
    setCacheName(cacheName);/*from  w  w w  .  j a v a2  s. com*/

}

From source file:ch.epfl.eagle.daemon.EagleDaemon.java

public void initialize(Configuration conf) throws Exception {
    Level logLevel = Level.toLevel(conf.getString(EagleConf.LOG_LEVEL, ""), DEFAULT_LOG_LEVEL);
    Logger.getRootLogger().setLevel(logLevel);

    // Start as many node monitors as specified in config
    String[] nmPorts = conf.getStringArray(EagleConf.NM_THRIFT_PORTS);
    String[] inPorts = conf.getStringArray(EagleConf.INTERNAL_THRIFT_PORTS);

    if (nmPorts.length != inPorts.length) {
        throw new ConfigurationException(
                EagleConf.NM_THRIFT_PORTS + " and " + EagleConf.INTERNAL_THRIFT_PORTS + " not of equal length");
    }/*  ww  w.j av  a2s.c om*/
    if (nmPorts.length > 1 && (!conf.getString(EagleConf.DEPLOYMENT_MODE, "").equals("standalone"))) {
        throw new ConfigurationException("Mutliple NodeMonitors only allowed " + "in standalone deployment");
    }
    if (nmPorts.length == 0) {
        (new NodeMonitorThrift()).initialize(conf, NodeMonitorThrift.DEFAULT_NM_THRIFT_PORT,
                NodeMonitorThrift.DEFAULT_INTERNAL_THRIFT_PORT);
    } else {
        for (int i = 0; i < nmPorts.length; i++) {
            (new NodeMonitorThrift()).initialize(conf, Integer.parseInt(nmPorts[i]),
                    Integer.parseInt(inPorts[i]));
        }
    }

    SchedulerThrift scheduler = new SchedulerThrift();
    scheduler.initialize(conf);
}

From source file:com.tinkerpop.rexster.config.ImgraphGraphConfiguration.java

@Override
public Graph configureGraphInstance(Configuration properties) throws GraphConfigurationException {
    String configFile = properties.getString("config-file", null);

    try {//from w  w  w. jav a 2  s .com

        System.setProperty("java.net.preferIPv4Stack", "true");

        if (configFile != null)
            com.steffi.common.Configuration.loadProperties(configFile);

        CacheContainer.getCacheContainer().start();
        CacheContainer.getCellCache().start();

        while (!CacheContainer.getCacheContainer().getStatus().equals(ComponentStatus.RUNNING))
            ;

        new Thread(new NodeServer()).start();

        Thread.sleep(2000);

    } catch (Exception x) {
        throw new GraphConfigurationException(x);
    }

    return SteffiGraphDBGraph.getInstance();
}

From source file:com.caricah.iotracah.datastore.ignitecache.internal.impl.PartitionHandler.java

@Override
public void configure(Configuration configuration) {

    String cacheName = configuration.getString(CONFIG_IGNITECACHE_PARTITION_CACHE_NAME,
            CONFIG_IGNITECACHE_PARTITION_CACHE_NAME_VALUE_DEFAULT);
    setCacheName(cacheName);/*from w w  w  .j  a va  2  s.  co m*/

    String defaultPartitionName = configuration.getString(
            DefaultSecurityHandler.CONFIG_SYSTEM_SECURITY_DEFAULT_PARTITION_NAME,
            DefaultSecurityHandler.CONFIG_SYSTEM_SECURITY_DEFAULT_PARTITION_NAME_VALUE_DEFAULT);
    setDefaultPartitionName(defaultPartitionName);

}

From source file:com.microrisc.simply.connector.SimpleConnectorFactory.java

/**
 * Returns type of connector.//ww  w.j av  a  2  s  .co  m
 * @param configuration source configuration to discover
 * @return connector type
 * @throws Exception 
 */
private ConnectorType getConnectorType(Configuration configuration) throws Exception {
    String connTypeStr = configuration.getString("connector.type", "");
    if (connTypeStr.equals("")) {
        throw new Exception("Connector type not specified");
    }

    for (ConnectorConfigMapping configMapping : ConnectorConfigMapping.values()) {
        if (configMapping.getConfigString().equals(connTypeStr)) {
            return configMapping.getConnectorType();
        }
    }
    throw new Exception("Unrecognized connector type");
}

From source file:com.microrisc.simply.network.spi.SPINetworkLayerFactory.java

/**
 * Creates and returns network layer parameters encapsulation object.
 * @param connectionStorage/* w ww .  j av  a  2  s  .  com*/
 * @param configProps
 * @return network layer parameters encapsulation object
 */
private NetworkLayerParams createNetworkLayerParams(NetworkConnectionStorage connectionStorage,
        Configuration configProps) {
    String portName = configProps.getString("networkLayer.type.spi.port", AUTOCONF);
    return new NetworkLayerParams(connectionStorage, portName);
}