Example usage for org.apache.commons.configuration PropertiesConfiguration PropertiesConfiguration

List of usage examples for org.apache.commons.configuration PropertiesConfiguration PropertiesConfiguration

Introduction

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

Prototype

public PropertiesConfiguration() 

Source Link

Document

Creates an empty PropertyConfiguration object which can be used to synthesize a new Properties file by adding values and then saving().

Usage

From source file:WBSTest.java

private static void initTorque() {
    try {/*from  w ww.j a v  a 2  s  . co m*/
        PropertiesConfiguration tcfg = new PropertiesConfiguration();
        System.out.println(WBSTest.class.getResource("/Torque.properties"));
        URL torqueURL = WBSTest.class.getResource("/Torque.properties");
        InputStream in = torqueURL.openStream();
        tcfg.load(in);
        in.close();
        Torque.init(tcfg); // Now really do it: initialize Torque

    } catch (Exception e) {
        e.printStackTrace();
    }

}

From source file:com.zavakid.mushroom.impl.ConfigUtil.java

static void dump(String header, Configuration c, PrintStream out) {
    PropertiesConfiguration p = new PropertiesConfiguration();
    p.copy(c);//from ww w.  ja va 2  s .  c  o  m
    if (header != null) {
        out.println(header);
    }
    try {
        p.save(out);
    } catch (Exception e) {
        throw new RuntimeException("Error saving config", e);
    }
}

From source file:net.sf.zekr.common.config.ResourceManager.java

private ResourceManager() {
    try {//from w  w  w . j  av a2  s  .  c  o  m
        resource = new PropertiesConfiguration();
        resource.load(new VelocityInputStream("res/resource-path.properties"), "utf-8");
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.linkedin.pinot.server.starter.helix.DefaultHelixStarterServerConfig.java

public static Configuration loadDefaultServerConf() {
    Configuration serverConf = new PropertiesConfiguration();
    serverConf.addProperty(CommonConstants.Server.CONFIG_OF_INSTANCE_DATA_DIR,
            CommonConstants.Server.DEFAULT_INSTANCE_DATA_DIR);
    serverConf.addProperty(CommonConstants.Server.CONFIG_OF_INSTANCE_SEGMENT_TAR_DIR,
            CommonConstants.Server.DEFAULT_INSTANCE_SEGMENT_TAR_DIR);

    serverConf.addProperty(CommonConstants.Server.CONFIG_OF_INSTANCE_READ_MODE,
            CommonConstants.Server.DEFAULT_READ_MODE);
    serverConf.addProperty(CommonConstants.Server.CONFIG_OF_INSTANCE_DATA_MANAGER_CLASS,
            CommonConstants.Server.DEFAULT_DATA_MANAGER_CLASS);
    serverConf.addProperty(CommonConstants.Server.CONFIG_OF_INSTANCE_SEGMENT_METADATA_LOADER_CLASS,
            CommonConstants.Server.DEFAULT_SEGMENT_METADATA_LOADER_CLASS);
    serverConf.addProperty(CommonConstants.Server.CONFIG_OF_SEGMENT_FORMAT_VERSION,
            CommonConstants.Server.DEFAULT_SEGMENT_FORMAT_VERSION);

    // query executor parameters
    serverConf.addProperty(CommonConstants.Server.CONFIG_OF_QUERY_EXECUTOR_PRUNER_CLASS,
            " DataSchemaSegmentPruner,TimeSegmentPruner,ValidSegmentPruner");
    serverConf.addProperty("pinot.server.query.executor.pruner.DataSchemaSegmentPruner.id", "0");
    serverConf.addProperty("pinot.server.query.executor.pruner.TimeSegmentPruner.id", "1");
    serverConf.addProperty("pinot.server.query.executor.pruner.ValidSegmentPruner.id", "2");
    serverConf.addProperty(CommonConstants.Server.CONFIG_OF_QUERY_EXECUTOR_TIMEOUT,
            CommonConstants.Server.DEFAULT_QUERY_EXECUTOR_TIMEOUT);
    serverConf.addProperty(CommonConstants.Server.CONFIG_OF_QUERY_EXECUTOR_CLASS,
            CommonConstants.Server.DEFAULT_QUERY_EXECUTOR_CLASS);

    serverConf.addProperty(CommonConstants.Server.CONFIG_OF_HELIX_FLAPPING_TIMEWINDOW_MS,
            CommonConstants.Server.DEFAULT_HELIX_FLAPPING_TIMEWINDOW_MS);

    // request handler factory parameters
    serverConf.addProperty(CommonConstants.Server.CONFIG_OF_REQUEST_HANDLER_FACTORY_CLASS,
            CommonConstants.Server.DEFAULT_REQUEST_HANDLER_FACTORY_CLASS);

    // netty port
    serverConf.addProperty(CommonConstants.Server.CONFIG_OF_NETTY_PORT,
            CommonConstants.Helix.DEFAULT_SERVER_NETTY_PORT);

    return serverConf;
}

From source file:edu.berkeley.sparrow.examples.ProtoBackend.java

public static void main(String[] args) throws IOException, TException {
    OptionParser parser = new OptionParser();
    parser.accepts("c", "configuration file").withRequiredArg().ofType(String.class);
    parser.accepts("help", "print help statement");
    OptionSet options = parser.parse(args);

    if (options.has("help")) {
        parser.printHelpOn(System.out);
        System.exit(-1);//from   w w  w.j a va2s.  c om
    }

    // Logger configuration: log to the console
    BasicConfigurator.configure();
    LOG.setLevel(Level.DEBUG);
    LOG.debug("debug logging on");

    Configuration conf = new PropertiesConfiguration();

    if (options.has("c")) {
        String configFile = (String) options.valueOf("c");
        try {
            conf = new PropertiesConfiguration(configFile);
        } catch (ConfigurationException e) {
        }
    }
    // Start backend server
    ProtoBackend protoBackend = new ProtoBackend();
    BackendService.Processor<BackendService.Iface> processor = new BackendService.Processor<BackendService.Iface>(
            protoBackend);

    int listenPort = conf.getInt("listen_port", DEFAULT_LISTEN_PORT);
    NM_PORT = conf.getInt("node_monitor_port", NodeMonitorThrift.DEFAULT_NM_THRIFT_PORT);
    TServers.launchThreadedThriftServer(listenPort, THRIFT_WORKER_THREADS, processor);
    protoBackend.initialize(listenPort);
}

From source file:com.paolodragone.util.DConfiguration.java

public DConfiguration() {
    properties = new PropertiesConfiguration();
}

From source file:com.linkedin.pinot.core.query.scheduler.resources.UnboundedResourceManagerTest.java

@Test
public void testDefault() {
    Configuration config = new PropertiesConfiguration();

    UnboundedResourceManager rm = new UnboundedResourceManager(config);
    assertTrue(rm.getNumQueryRunnerThreads() > 1);
    assertTrue(rm.getNumQueryWorkerThreads() >= 1);
    assertEquals(rm.getTableThreadsHardLimit(), rm.getNumQueryRunnerThreads() + rm.getNumQueryWorkerThreads());
    assertEquals(rm.getTableThreadsSoftLimit(), rm.getNumQueryRunnerThreads() + rm.getNumQueryWorkerThreads());
}

From source file:com.marklogic.shell.AbstractEnvironment.java

public AbstractEnvironment() {
    properties = new PropertiesConfiguration();
    try {/*from   ww w . jav  a2  s  . c o m*/
        properties.load(".cqshrc");
    } catch (ConfigurationException ignored) {
    }
}

From source file:com.zavakid.mushroom.impl.ConfigBuilder.java

/**
 * Default constructor
 */
public ConfigBuilder() {
    config = new PropertiesConfiguration();
}

From source file:com.pinterest.secor.util.ReflectionUtilTest.java

public void setUp() throws Exception {
    PropertiesConfiguration properties = new PropertiesConfiguration();
    mSecorConfig = new SecorConfig(properties);
    mLogFilePath = new LogFilePath("/foo", "/foo/bar/baz/1_1_1");
}