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

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

Introduction

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

Prototype

int getInt(String key, int defaultValue);

Source Link

Document

Get a int associated with the given configuration key.

Usage

From source file:com.caricah.iotracah.server.mqttserver.netty.MqttServerImpl.java

/**
 * @param configuration Object carrying all configurable properties from file.
 * @throws UnRetriableException// w w  w.j  a  v  a  2 s. c o  m
 * @link configure method supplies the configuration object carrying all the
 * properties parsed from the external properties file.
 */

public void configure(Configuration configuration) throws UnRetriableException {
    log.info(" configure : setting up our configurations.");

    int tcpPort = configuration.getInt(CONFIGURATION_SERVER_MQTT_TCP_PORT,
            CONFIGURATION_VALUE_DEFAULT_SERVER_MQTT_TCP_PORT);
    setTcpPort(tcpPort);

    int sslPort = configuration.getInt(CONFIGURATION_SERVER_MQTT_SSL_PORT,
            CONFIGURATION_VALUE_DEFAULT_SERVER_MQTT_SSL_PORT);
    setSslPort(sslPort);

    boolean sslEnabled = configuration.getBoolean(CONFIGURATION_SERVER_MQTT_SSL_IS_ENABLED,
            CONFIGURATION_VALUE_DEFAULT_SERVER_MQTT_SSL_IS_ENABLED);
    setSslEnabled(sslEnabled);

    if (isSslEnabled()) {

        setSslHandler(new SSLHandler(configuration));

    }

    int connectionTimeout = configuration.getInt(CONFIGURATION_SERVER_MQTT_CONNECTION_TIMEOUT,
            CONFIGURATION_VALUE_DEFAULT_SERVER_MQTT_CONNECTION_TIMEOUT);
    setConnectionTimeout(connectionTimeout);

}

From source file:edu.berkeley.sparrow.daemon.scheduler.SchedulerThrift.java

/**
 * Initialize this thrift service.//from  w  w  w  .ja  v a2  s  . c om
 *
 * This spawns a multi-threaded thrift server and listens for Sparrow
 * scheduler requests.
 */
public void initialize(Configuration conf) throws IOException {
    SchedulerService.Processor<SchedulerService.Iface> processor = new SchedulerService.Processor<SchedulerService.Iface>(
            this);
    int port = conf.getInt(SparrowConf.SCHEDULER_THRIFT_PORT, DEFAULT_SCHEDULER_THRIFT_PORT);
    int threads = conf.getInt(SparrowConf.SCHEDULER_THRIFT_THREADS, DEFAULT_SCHEDULER_THRIFT_THREADS);
    String hostname = Network.getHostName(conf);
    InetSocketAddress addr = new InetSocketAddress(hostname, port);
    scheduler.initialize(conf, addr);
    TServers.launchThreadedThriftServer(port, threads, processor);
    int getTaskPort = conf.getInt(SparrowConf.GET_TASK_PORT, DEFAULT_GET_TASK_PORT);
    GetTaskService.Processor<GetTaskService.Iface> getTaskprocessor = new GetTaskService.Processor<GetTaskService.Iface>(
            this);
    TServers.launchSingleThreadThriftServer(getTaskPort, getTaskprocessor);
}

From source file:com.boozallen.cognition.ingest.accumulo.storm.AccumuloEventStorageBolt.java

@Override
void configureAccumuloBolt(Configuration conf) {
    eventTable = conf.getString(EVENT_TABLE);
    uuidPrefix = conf.getString(UUID_PREFIX, UUID_PREFIX_DEFAULT);
    splits = conf.getInt(SPLITS, SPLITS_DEFAULT);
    visibility = conf.getString(VISIBILITY);
    visibilityByField = conf.getString(VISIBILITY_BY_FIELD);

    Validate.notBlank(eventTable);// w w  w.j  a  va  2s  . c  om
}

From source file:ch.epfl.eagle.daemon.scheduler.SchedulerThrift.java

/**
 * Initialize this thrift service./*from   w ww  . j  av a  2 s.c  o  m*/
 *
 * This spawns a multi-threaded thrift server and listens for Eagle
 * scheduler requests.
 */
public void initialize(Configuration conf) throws IOException {
    SchedulerService.Processor<SchedulerService.Iface> processor = new SchedulerService.Processor<SchedulerService.Iface>(
            this);
    int port = conf.getInt(EagleConf.SCHEDULER_THRIFT_PORT, DEFAULT_SCHEDULER_THRIFT_PORT);
    int threads = conf.getInt(EagleConf.SCHEDULER_THRIFT_THREADS, DEFAULT_SCHEDULER_THRIFT_THREADS);
    String hostname = Network.getHostName(conf);
    InetSocketAddress addr = new InetSocketAddress(hostname, port);
    scheduler.initialize(conf, addr);
    TServers.launchThreadedThriftServer(port, threads, processor);
    int getTaskPort = conf.getInt(EagleConf.GET_TASK_PORT, DEFAULT_GET_TASK_PORT);
    GetTaskService.Processor<GetTaskService.Iface> getTaskprocessor = new GetTaskService.Processor<GetTaskService.Iface>(
            this);
    TServers.launchSingleThreadThriftServer(getTaskPort, getTaskprocessor);
}

From source file:TestExtractor.java

@Test
public void TestConf() {

    try {// w  w  w  . j  a v  a 2 s.co  m

        Configuration conf = new PropertiesConfiguration(
                System.getProperty("user.dir") + "/src/test/resources/xwiki.cfg");

        int ldapPort = conf.getInt("xwiki.authentication.ldap.port", 389);

        String tmpldap_server = conf
                .getString("xwiki.authentication.trustedldap.remoteUserMapping.ldap_server");
        //String tmpldap_base_DN = conf.getString("xwiki.authentication.trustedldap.remoteUserMapping.ldap_base_DN");
        String tmpBinDN = conf.getString("xwiki.authentication.trustedldap.remoteUserMapping.ldap_bind_DN");
        String tmpldap_bind_pass = conf
                .getString("xwiki.authentication.trustedldap.remoteUserMapping.ldap_bind_pass");
        String[] ldap_server = StringUtils.split(tmpldap_server, "|");
        //String[] ldap_base_DN = StringUtils.split(tmpldap_base_DN,"|");
        String[] BinDN = StringUtils.split(tmpBinDN, "|");
        String[] ldap_bind_pass = StringUtils.split(tmpldap_bind_pass, "|");
        //assertTrue(ldap_server.length == ldap_base_DN.length);
        assertTrue(BinDN.length == ldap_bind_pass.length);
        assertTrue(ldap_server.length == ldap_bind_pass.length);
        assertTrue(ldap_server.length == 6);
        assertTrue(ldapPort == 389);

        String className = conf.getString("xwiki.authentication.ldap.ssl.secure_provider",
                "com.sun.net.ssl.internal.ssl.Provider");
        assertEquals(className, "com.sun.net.ssl.internal.ssl.Provider");
        assertEquals(conf.getInt("xwiki.authentication.ldap.timeout", 500), 500);
        assertEquals(conf.getInt("xwiki.authentication.ldap.maxresults", 10), 10);
    } catch (ConfigurationException ex) {
        Logger.getLogger(TestExtractor.class.getName()).log(Level.SEVERE, null, ex);
        fail(ex.getLocalizedMessage());
    }

}

From source file:com.boozallen.cognition.ingest.storm.topology.ConfigurableIngestTopology.java

String getSubscribingToComponent(String prevComponent, Map<Integer, String> boltNumberToId,
        Configuration boltConf) {

    int subscribingToBoltNumber = boltConf.getInt(SUBSCRIBE_TO_BOLT, -1);
    boolean isSubscribeToBoltDeclared = subscribingToBoltNumber >= 0;

    if (isSubscribeToBoltDeclared && boltNumberToId.containsKey(subscribingToBoltNumber))
        return boltNumberToId.get(subscribingToBoltNumber);
    else/*ww  w  . ja  v a 2  s.c o  m*/
        return prevComponent;
}

From source file:com.microrisc.simply.network.udp.UDPNetworkLayerFactory.java

/**
 * Creates network layer parameters encapsulation object.
 * @param connectionStorage//from   w  ww .j  a v  a 2 s .co m
 * @param configuration
 * @return network layer parameters encapsulation object
 */
private NetworkLayerParams createNetworkLayerParams(NetworkConnectionStorage connectionStorage,
        Configuration configuration) {
    String localAddress = configuration.getString("networkLayer.type.udp.localaddress", "");
    int localPort = configuration.getInt("networkLayer.type.udp.localport", -1);
    String remoteAddress = configuration.getString("networkLayer.type.udp.remoteaddress", "");
    int remotePort = configuration.getInt("networkLayer.type.udp.remoteport", -1);

    int maxRecvPacketSize = configuration.getInt("networkLayer.type.udp.maxRecvPacketSize",
            UDPNetworkLayerMultinet.MAX_RECEIVED_PACKET_SIZE);
    int receptionTimeout = configuration.getInt("networkLayer.type.udp.receptionTimeout",
            UDPNetworkLayer.RECEPTION_TIMEOUT_DEFAULT);

    return new NetworkLayerParams(connectionStorage, localAddress, localPort, remoteAddress, remotePort,
            maxRecvPacketSize, receptionTimeout);
}

From source file:com.baifendian.swordfish.execserver.runner.streaming.StreamingRunnerManager.java

public StreamingRunnerManager(Configuration conf) {
    streamingDao = DaoFactory.getDaoInstance(StreamingDao.class);

    int threads = conf.getInt(Constants.EXECUTOR_STREAMING_THREADS, Constants.defaultStreamingThreadNum);

    ThreadFactory flowThreadFactory = new ThreadFactoryBuilder().setNameFormat("Exec-Server-StreamingRunner")
            .build();/*ww  w. j av  a2s . co m*/
    streamingExecutorService = Executors.newFixedThreadPool(threads, flowThreadFactory);
}

From source file:keel.Algorithms.Neural_Networks.NNEP_Common.util.random.RanNnep.java

/**
 * <p>//from w  w w.  j  av a2s.c o  m
 * Configuration settings for Randnnep random generator are:
 * 
 * <ul>
 * <li>
 * <code>a (int, default = 12345)</code>
 * </li><li>
 * <code>b (int, default = 67890</code>
 * </li>
 * </ul>
 * </p>
 * @param settings Configuration object to read the properties of
 */
public void configure(Configuration settings) {
    a = 100001;
    b = 1;
    // Get seed
    int seed = settings.getInt("seed", 7897);
    // Initialize
    for (int i = 0; i < seed % 999; i++)
        raw();
}

From source file:com.appeligo.amazon.AmazonService.java

private AmazonService() {
    Configuration config = ConfigUtils.getAmazonConfig();
    throttle = config.getInt("throttle", 1000);
}