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:br.com.etec.Main.java

private static Properties getLaFProperties() {
    Properties props = new Properties();

    props.put("logoString", "CTPS");
    props.put("licenseKey", "INSERT YOUR LICENSE KEY HERE");

    props.put("selectionBackgroundColor", COR_AZUL_CLARO_);
    props.put("menuSelectionBackgroundColor", COR_AZUL_CLARO_);

    props.put("controlColor", COR_AZUL_CLARO_);
    props.put("controlColorLight", COR_AZUL_CLARO_);
    props.put("controlColorDark", COR_AZUL_CLARO_);

    props.put("buttonColor", "214 219 229");
    props.put("buttonColorLight", COR_BRANCO);
    props.put("buttonColorDark", "225 225 224");

    props.put("rolloverColor", COR_CINZA_BORDAS);
    props.put("rolloverColorLight", COR_CINZA_BORDAS);
    props.put("rolloverColorDark", COR_AZUL_CLARO_);

    props.put("windowTitleForegroundColor", COR_PRETO);
    props.put("windowTitleBackgroundColor", COR_AZUL_CLARO_);
    props.put("windowTitleColorLight", COR_AZUL_CLARO_);
    props.put("windowTitleColorDark", COR_AZUL_CLARO_);
    props.put("windowBorderColor", COR_CINZA_BORDAS);

    props.put("windowInactiveTitleColorLight", COR_CINZA_BORDAS);
    props.put("windowInactiveTitleColorDark", COR_CINZA_BORDAS);

    props.put("backgroundColor", COR_BRANCO);
    props.put("desktopColor", COR_BRANCO);
    props.put("backgroundPattern", "off");

    props.put("textureSet", "Custom");
    props.put("menubarTexture", COR_BRANCO);
    props.put("windowTexture", COR_BRANCO);

    return props;
}

From source file:ac.simons.tweetarchive.Application.java

static void createTwitterOauthTokens(final String consumerKey, final String consumerSecret) throws Exception {
    final Twitter twitter = TwitterFactory.getSingleton();
    twitter.setOAuthConsumer(consumerKey, consumerSecret);
    final RequestToken requestToken = twitter.getOAuthRequestToken();
    AccessToken accessToken = null;/*from w ww  . j a  va  2s  . c  o m*/
    final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    while (null == accessToken) {
        System.out.println("Open the following URL and grant access to your account:");
        System.out.println(requestToken.getAuthorizationURL());
        System.out.print("Enter the PIN(if aviailable) or just hit enter.[PIN]:");
        String pin = br.readLine();
        try {
            if (pin.length() > 0) {
                accessToken = twitter.getOAuthAccessToken(requestToken, pin);
            } else {
                accessToken = twitter.getOAuthAccessToken();
            }
        } catch (TwitterException te) {
            if (401 == te.getStatusCode()) {
                System.out.println("Unable to get the access token.");
            } else {
                throw te;
            }
        }
    }

    final Properties properties = new Properties();
    properties.put("twitter4j.oauth.consumerKey", consumerKey);
    properties.put("twitter4j.oauth.consumerSecret", consumerSecret);
    properties.put("twitter4j.oauth.accessToken", accessToken.getToken());
    properties.put("twitter4j.oauth.accessTokenSecret", accessToken.getTokenSecret());

    try (final FileOutputStream out = new FileOutputStream("application.properties", true)) {
        properties.store(out, null);
    }
}

From source file:uk.ac.ebi.eva.pipeline.configuration.CommonConfiguration.java

@Bean
private static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
    PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();

    Properties properties = new Properties();
    properties.put("input.vcf", "");
    properties.put("input.vcf.id", "1");
    properties.put("input.vcf.aggregation", "NONE");
    properties.put("input.study.type", "COLLECTION");
    properties.put("input.study.name", "input.study.name");
    properties.put("input.study.id", "1");
    properties.put("input.pedigree", "");
    properties.put("input.gtf", "");
    properties.put("input.fasta", "");

    properties.put("output.dir", "/tmp");
    properties.put("output.dir.annotation", "");
    properties.put("output.dir.statistics", "/tmp");

    properties.put("statistics.overwrite", "false");

    properties.put("db.hosts", "localhost:27017");
    //        properties.put("dbName", null);
    properties.put("db.collection.variants.name", "variants");
    properties.put("db.collection.files.name", "files");
    properties.put("db.collections.features.name", "features");
    properties.put("config.db.read-preference", "primary");

    properties.put("app.opencga.path", opencgaHome);
    properties.put("app.vep.path", "");
    properties.put("app.vep.cache.path", "");
    properties.put("app.vep.cache.version", "");
    properties.put("app.vep.cache.species", "");
    properties.put("app.vep.num-forks", "3");

    properties.put("config.restartability.allow", false);

    configurer.setProperties(properties);

    return configurer;
}

From source file:Main.java

/**
 * Returns properties for non XA datasource
 * @param jndiName/*from   w  w w .j a v a2 s . c om*/
 */
public static Properties nonXaDsProperties(String jndiName) {
    Properties params = commonDsProperties(jndiName); //attributes
    params.put("jta", "false");
    //common
    params.put("driver-class", "org.hsqldb.jdbcDriver");
    params.put("datasource-class", "org.jboss.as.connector.subsystems.datasources.ModifiableDataSource");
    params.put("connection-url", "jdbc:h2:mem:test;DB_CLOSE_DELAY=-1");

    return params;
}

From source file:io.amient.examples.TwitterStreamDemo.java

private static KafkaStreams createTwitterStreamsInstance(String bootstrapServers) {

    final Serializer<JsonNode> jsonSerializer = new JsonSerializer();
    final Deserializer<JsonNode> jsonDeserializer = new JsonDeserializer();
    final Serde<JsonNode> jsonSerde = Serdes.serdeFrom(jsonSerializer, jsonDeserializer);

    KStreamBuilder builder = new KStreamBuilder();
    Properties props = new Properties();
    props.put(StreamsConfig.APPLICATION_ID_CONFIG, "twitter-streams");
    props.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);

    KStream<JsonNode, JsonNode> kTwitter = builder.stream(jsonSerde, jsonSerde, "twitter");

    //some print//from  w w w .j  a va2 s  .  com
    kTwitter.process(() -> new AbstractProcessor<JsonNode, JsonNode>() {
        @Override
        public void process(JsonNode u, JsonNode msg) {
            System.out.println("tweet model: " + msg);
        }
    });

    return new KafkaStreams(builder, props);

}

From source file:com.lang.pat.kafkairc.Consumer.java

private static ConsumerConfig createConsumerConfig() {
    Properties props = new Properties();
    props.put("zookeeper.connect", ClientMain.HOSTNAME + ":" + ClientMain.PORT);
    props.put("group.id", ClientMain.USERNAME);
    props.put("zookeeper.session.timeout.ms", "400");
    props.put("zookeeper.sync.time.ms", "200");
    props.put("auto.commit.interval.ms", "1000");

    return new ConsumerConfig(props);
}

From source file:lucee.runtime.net.mail.SMTPVerifier.java

private static boolean _verify(String host, String username, String password, int port)
        throws MessagingException {
    boolean hasAuth = !StringUtil.isEmpty(username);

    Properties props = new Properties();
    props.put("mail.smtp.host", host);
    if (hasAuth)/*from w  w  w .  ja va 2 s.  com*/
        props.put("mail.smtp.auth", "true");
    if (hasAuth)
        props.put("mail.smtp.user", username);
    if (hasAuth)
        props.put("mail.transport.connect-timeout", "30");
    if (port > 0)
        props.put("mail.smtp.port", String.valueOf(port));

    Authenticator auth = null;
    if (hasAuth)
        auth = new DefaultAuthenticator(username, password);
    Session session = Session.getInstance(props, auth);

    Transport transport = session.getTransport("smtp");
    if (hasAuth)
        transport.connect(host, username, password);
    else
        transport.connect();
    boolean rtn = transport.isConnected();
    transport.close();

    return rtn;
}

From source file:Main.java

/**
 * Returns properties for RA connection-definition element
 *//*  ww  w. ja v  a2s . co m*/
public static Properties raConnectionProperties() {
    Properties params = new Properties();
    //attributes
    params.put("use-java-context", "false");
    params.put("class-name", "Class1");
    params.put("use-ccm", "true");
    params.put("jndi-name", "java:jboss/name1");
    params.put("enabled", "false");
    //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", "IdleConnections");
    //xa-pool
    params.put("same-rm-override", "true");
    params.put("interleaving", "true");
    params.put("no-tx-separate-pool", "true");
    params.put("pad-xid", "true");
    params.put("wrap-xa-resource", "true");
    //security
    params.put("security-application", "true");
    //validation
    params.put("background-validation", "true");
    params.put("background-validation-millis", "5000");
    params.put("use-fast-fail", "true");
    //time-out
    params.put("blocking-timeout-wait-millis", "5000");
    params.put("idle-timeout-minutes", "4");
    params.put("allocation-retry", "2");
    params.put("allocation-retry-wait-millis", "3000");
    params.put("xa-resource-timeout", "300");
    //recovery
    params.put("no-recovery", "false");
    params.put("recovery-plugin-class-name", "someClass2");
    params.put("recovery-username", "sa");
    params.put("recovery-password", "sa-pass");
    //AS7-5300
    //params.put("recovery-security-domain", "HsqlDbRealm");

    return params;
}

From source file:se.ivankrizsan.messagecowboy.ProductionPropertyOverrides.java

/**
 * Overrides properties configured on beans.
 */// w ww.j  a v  a 2 s  .c  o  m
@Bean()
@Lazy(false)
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
public static BeanFactoryPostProcessor propertyOverrideConfigurer() {
    PropertyOverrideConfigurer theOverrideConfigurer = new PropertyOverrideConfigurer();

    final Properties thePropertiesHolder = new Properties();
    /* Task refresh interval. */
    thePropertiesHolder.put("starterService.taskReschedulingCronExpression", "0/20 * * * * ?");
    /* Transport service configuration refresh interval. */
    thePropertiesHolder.put("starterService.transportServiceConfigurationRefreshCronExpression",
            "0/30 * * * * ?");
    /* Task execution status reports cleanup interval. */
    thePropertiesHolder.put("starterService.taskExecutionStatusCleanupCronExpression", "0/30 0/15 * * * ?");

    theOverrideConfigurer.setProperties(thePropertiesHolder);
    theOverrideConfigurer.setIgnoreInvalidKeys(false);
    theOverrideConfigurer.setIgnoreResourceNotFound(false);
    theOverrideConfigurer.setOrder(0);
    return theOverrideConfigurer;
}

From source file:Main.java

/**
 * Returns properties for RA connection-definition element
             //  ww  w  .  j a v  a2  s.  co m
 */
public static Properties raConnectionProperties() {
    Properties params = new Properties();
    //attributes
    params.put("use-java-context", "false");
    params.put("class-name", "Class1");
    params.put("use-ccm", "true");
    params.put("jndi-name", "java:jboss/name1");
    params.put("enabled", "false");
    //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", "IdleConnections");
    //xa-pool
    params.put("same-rm-override", "true");
    params.put("interleaving", "true");
    params.put("no-tx-separate-pool", "true");
    params.put("pad-xid", "true");
    params.put("wrap-xa-resource", "true");
    //security
    params.put("application", "true");
    params.put("security-domain-and-application", "HsqlDbRealm1");
    params.put("security-domain", "HsqlDbRealm");
    //validation
    params.put("background-validation", "true");
    params.put("background-validation-millis", "5000");
    params.put("use-fast-fail", "true");
    //time-out
    params.put("blocking-timeout-wait-millis", "5000");
    params.put("idle-timeout-minutes", "4");
    params.put("allocation-retry", "2");
    params.put("allocation-retry-wait-millis", "3000");
    params.put("xa-resource-timeout", "300");
    //recovery
    params.put("no-recovery", "false");
    params.put("recovery-plugin-class-name", "someClass2");
    params.put("recovery-username", "sa");
    params.put("recovery-password", "sa-pass");
    params.put("recovery-security-domain", "HsqlDbRealm");

    return params;
}