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

/**
 * Returns properties for RA admin-object element
             //  w  w  w  .  j a  v  a2s . c  o  m
 */
public static Properties raAdminProperties() {
    Properties params = new Properties();
    //attributes
    params.put("use-java-context", "false");
    params.put("class-name", "Class3");
    params.put("jndi-name", "java:jboss/Name3");
    params.put("enabled", "true");

    return params;
}

From source file:com.seasbase.video.kafka.Consumer.java

private static ConsumerConfig createConsumerConfig() {
    Properties props = new Properties();
    props.put("zookeeper.connect", KafkaProperties.zkConnect);
    props.put("group.id", KafkaProperties.groupId);
    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:com.trackplus.persist.TpEm.java

public static void initEntityManagerFactory(PropertiesConfiguration tcfg, String persistUnit) {
    Properties properties = new Properties();
    properties.put("javax.persistence.jdbc.driver",
            tcfg.getProperty("torque.dsfactory.track.connection.driver"));
    properties.put("javax.persistence.jdbc.url", tcfg.getProperty("torque.dsfactory.track.connection.url"));
    properties.put("javax.persistence.jdbc.user", tcfg.getProperty("torque.dsfactory.track.connection.user"));
    properties.put("javax.persistence.jdbc.password",
            tcfg.getProperty("torque.dsfactory.track.connection.password"));
    emf = Persistence.createEntityManagerFactory(persistUnit, properties);
}

From source file:com.ebay.jetstream.event.channel.kafka.TestKafkaServer.java

private static Properties createProperties(String logDir, int port, int brokerId, String zkConnect,
        int numPartitions) {
    Properties properties = new Properties();
    properties.put("port", port + "");
    properties.put("broker.id", brokerId + "");
    properties.put("num.partitions", numPartitions + "");
    properties.put("log.dir", logDir);
    properties.put("enable.zookeeper", "true");
    properties.put("zookeeper.connect", zkConnect);
    return properties;
}

From source file:eu.vital.maps.server.servlets.EventsConsumer.java

private static ConsumerConfig createConsumerConfig() {
    Properties props = new Properties();
    props.put("zookeeper.connect", "localhost:2181");
    props.put("group.id", "test");
    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:org.opentestsystem.authoring.testspecbank.client.config.TestClientIntegratedConfigScanner.java

@Bean
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
    return new PropertySourcesPlaceholderConfigurer() {

        @Override/*from w ww.  j  a v a 2 s.c o m*/
        protected Properties mergeProperties() throws IOException {
            Properties props = super.mergeProperties();
            props.put("tsb.tsbUrl", "http://go.no.where");
            return props;
        }
    };
}

From source file:se.curity.examples.oauth.ExternalResourceLoader.java

private static Properties defaultProperties() {
    Properties properties = new Properties();
    properties.put(HTTP_CLIENT_PROPERTY, DefaultJwkHttpClientSupplier.class.getName());
    return properties;
}

From source file:com.impetus.benchmark.utils.MailUtils.java

public static void sendMail(Map<String, Double> delta, String operationType, String dataStore) {
    String host = "mail1.impetus.co.in";
    int port = 465;
    Properties props = new Properties();
    props.put("mail.smtp.auth", "true");
    props.put("mail.smtp.starttls.enable", "true");
    // props.put("mail.smtp.port", "465");
    props.put("mail.smtp.host", host);

    JavaMailSenderImpl emailSender = new JavaMailSenderImpl();
    emailSender.setHost(host);/*from  w w  w. j  ava 2  s.  c o m*/
    // emailSender.setPort(port);
    emailSender.setUsername("amresh.singh@impetus.co.in");
    emailSender.setPassword("dragon@131");
    emailSender.setJavaMailProperties(props);
    SimpleMailMessage mail = new SimpleMailMessage();
    mail.setTo(new String[] { /*"vivek.mishra@impetus.co.in",*/ "amresh.singh@impetus.co.in",
            /*"kuldeep.mishra@impetus.co.in"*//*, "vivek.shrivastava@impetus.co.in"*/ });
    mail.setFrom("amresh.singh@impetus.co.in");
    mail.setReplyTo("amresh.singh@impetus.co.in");

    // mail.se
    if (operationType.equalsIgnoreCase("load")) {
        operationType = "write";
    } else if (operationType.equalsIgnoreCase("t")) {
        operationType = "read";
    }
    mail.setSubject(operationType + " kundera-" + dataStore + "-performance Delta");
    String mailBody = null;
    for (String key : delta.keySet()) {
        if (mailBody == null) {
            mailBody = key + " Performance Delta ==> " + delta.get(key) + " \n";
        } else {
            mailBody = mailBody + key + " Performance Delta ==> " + delta.get(key) + " \n";
        }
    }
    mail.setText(mailBody);
    emailSender.send(mail);
}

From source file:com.diffplug.gradle.ConfigMisc.java

/** Creates an XML string from a groovy.util.Node. */
public static byte[] props(Map<String, String> map) {
    Properties properties = new Properties();
    map.forEach((key, value) -> properties.put(key, value));
    try (ByteArrayOutputStream output = new ByteArrayOutputStream()) {
        Errors.rethrow().run(() -> properties.store(output, ""));
        return output.toByteArray();
    } catch (IOException e) {
        throw Errors.asRuntime(e);
    }/*www .j av  a 2s .  co  m*/
}

From source file:com.google.code.oauth.OAuth2Authenticator.java

/**
 * Connects and authenticates to an IMAP server with OAuth2. You must have called {@code initialize}.
 *
 * @param userEmail Email address of the user to authenticate, for example {@code oauth@gmail.com}.
 * @param oauthToken The user's OAuth token.
 *
 * @return An authenticated IMAPStore that can be used for IMAP operations.
 *//*  w  ww. j a v a2 s.  co  m*/
public static IMAPStore connectToImap(String userEmail, String oauthToken) throws MessagingException {
    Properties props = new Properties();
    props.put("mail.imaps.sasl.enable", "true");
    props.put("mail.imaps.sasl.mechanisms", "XOAUTH2");
    props.put(OAuth2SaslClientFactory.OAUTH_TOKEN_PROP, oauthToken);
    Session session = Session.getInstance(props);

    IMAPSSLStore store = new IMAPSSLStore(session, null);
    store.connect("imap.gmail.com", 993, userEmail, StringUtils.EMPTY);
    return store;
}