Example usage for java.util Properties put

List of usage examples for java.util Properties put

Introduction

In this page you can find the example usage for java.util Properties put.

Prototype

@Override
    public synchronized Object put(Object key, Object value) 

Source Link

Usage

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

public static void configureKafkaPort(Properties configuration, int port) {
    configuration.put("port", Integer.toString(port));
}

From source file:mx.itesm.imb.ImbBusController.java

private static Template getEcoreTemplate() {
    Template returnValue;//ww w  .jav  a2 s .co  m
    Properties velocityProperties;
    try {
        velocityProperties = new Properties();
        velocityProperties.put("resource.loader", "class");
        velocityProperties.put("class.resource.loader.class",
                "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
        Velocity.init(velocityProperties);
        returnValue = Velocity.getTemplate("mx/itesm/imb/ImbBusController.vml");
    } catch (Exception e) {
        returnValue = null;
        System.out.println("Error configuring velocity: " + e.getMessage());
    }

    return returnValue;
}

From source file:com.dragome.web.helpers.serverside.DragomeCompilerLauncher.java

private static Classpath runProguard(File file, DragomeConfigurator configurator) throws Exception {
    URI uri = DragomeCompilerLauncher.class.getResource("/proguard.conf").toURI();
    Properties properties = System.getProperties();
    properties.put("in-jar-filename", file.getAbsolutePath());
    String outFilename = file.getAbsolutePath().replace(".jar", "-proguard.jar");
    new File(outFilename).deleteOnExit();
    properties.put("out-jar-filename", outFilename);
    ConfigurationParser parser = new ConfigurationParser(uri.toURL(), properties);
    URL additionalCodeKeepConfigFile = configurator.getAdditionalCodeKeepConfigFile();
    Configuration configuration = new Configuration();
    parser.parse(configuration);/*from  ww  w  . j a va2 s  .  c  o  m*/

    if (additionalCodeKeepConfigFile != null) {
        ConfigurationParser parserForAdditionalKeepCodeConfigFile = new ConfigurationParser(
                additionalCodeKeepConfigFile, properties);
        parserForAdditionalKeepCodeConfigFile.parse(configuration);
    }

    new ProGuard(configuration).execute();
    return new Classpath(JarClasspathEntry.createFromPath(outFilename));
}

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

public static void configureKafkaLogDirectory(Properties configuration, File logDir) {
    configuration.put("log.dirs", logDir.getAbsolutePath());
}

From source file:Main.java

/**
 * Returns common properties for both XA and Non-XA datasource
 *
 * @param jndiName//from  w w w  .  ja  v  a2 s  .com
 */
public static Properties commonDsProperties(String jndiName, boolean userName) {
    Properties params = new Properties();
    //attributes
    params.put("use-java-context", "true");
    params.put("spy", "false");
    params.put("use-ccm", "true");
    params.put("jndi-name", jndiName);
    //common elements
    params.put("driver-name", "h2");
    params.put("new-connection-sql", "select 1");
    params.put("transaction-isolation", "TRANSACTION_READ_COMMITTED");
    params.put("url-delimiter", ":");
    params.put("url-selector-strategy-class-name", "someClass");
    //pool
    params.put("min-pool-size", "1");
    params.put("max-pool-size", "5");
    params.put("pool-prefill", "true");
    params.put("pool-use-strict-min", "true");
    params.put("flush-strategy", "EntirePool");
    //security
    if (userName) {
        params.put("user-name", "sa");
        params.put("password", "sa");
    } else {
        params.put("security-domain", "HsqlDbRealm");
    }
    params.put("reauth-plugin-class-name", "someClass1");
    //validation
    params.put("valid-connection-checker-class-name", "someClass2");
    params.put("check-valid-connection-sql", "select 1");
    params.put("validate-on-match", "true");
    params.put("background-validation", "true");
    params.put("background-validation-millis", "2000");
    params.put("use-fast-fail", "true");
    params.put("stale-connection-checker-class-name", "someClass3");
    params.put("exception-sorter-class-name", "someClass4");
    //time-out
    params.put("blocking-timeout-wait-millis", "20000");
    params.put("idle-timeout-minutes", "4");
    params.put("set-tx-query-timeout", "true");
    params.put("query-timeout", "120");
    params.put("use-try-lock", "100");
    params.put("allocation-retry", "2");
    params.put("allocation-retry-wait-millis", "3000");
    //statement
    params.put("track-statements", "nowarn");
    params.put("prepared-statements-cache-size", "30");
    params.put("share-prepared-statements", "true");

    return params;
}

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

public static void configureSegmentSizeBytes(Properties properties, int segmentSize) {
    properties.put("log.segment.bytes", Integer.toString(segmentSize));
}

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

public static void configureBrokerId(Properties configuration, int brokerId) {
    configuration.put("broker.id", Integer.toString(brokerId));
}

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

public static void configureZkConnectionString(Properties configuration, String zkStr) {
    configuration.put("zookeeper.connect", zkStr);
}

From source file:net.zcarioca.zcommons.config.SpringEndToEndTest.java

@BeforeClass
public static void setupFilesystem() {
    setupMockEnvironment();/*from ww w.  j a  v a2 s  .com*/
    createConfDir();
    Properties props = new Properties();
    props.put("value.1", "This is the first value");
    props.put("value.2", "This is the second value");

    try {
        OutputStream out = new FileOutputStream(new File(getConfDir(), "test.properties"));

        props.store(out, "this is a comment");
    } catch (IOException exc) {
        // do nothing
    }
}

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

public static void configureHostName(Properties configuration, String hostName) {
    configuration.put("host.name", hostName);
}