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.ewerk.prototype.proc.ProcessConfiguration.java

@Bean
public QuartzComponent quartzComponent(
        @Value("${scheduler.startup-delay-seconds}") final int startupDelaySeconds) {
    Properties quartzProperties = new Properties();
    quartzProperties.put("org.quartz.plugin.shutdownhook.class",
            "org.quartz.plugins.management.ShutdownHookPlugin");
    quartzProperties.put("org.quartz.plugin.shutdownhook.cleanShutdown", "true");

    QuartzComponent component = new QuartzComponent();
    component.setEnableJmx(false);/*from   w  ww. java2s .co m*/
    component.setStartDelayedSeconds(startupDelaySeconds);
    component.setProperties(quartzProperties);
    return component;
}

From source file:com.flipkart.aesop.processor.kafka.client.KafkaClient.java

void init() {
    this.config = ConfigFactory.parseFile(new File(kafkaConfig.getConfig()));

    Properties props = new Properties();
    props.put("zookeeper.connect", config.getString("zookeeper.connect"));
    props.put("value.serializer", "org.apache.kafka.common.serialization.ByteArraySerializer");
    props.put("key.serializer", "org.apache.kafka.common.serialization.ByteArraySerializer");
    props.put("zk.connectiontimeout.ms", config.getString("zk.connectiontimeout.ms"));
    props.put("bootstrap.servers", config.getString("bootstrap.servers"));

    this.client = new KafkaProducer(props);
}

From source file:org.trustedanalytics.ingestion.kafka2hdfs.config.KafkaConfiguration.java

@Bean
public ConsumerConfig consumerConfig() {
    Properties props = new Properties();
    props.put("zookeeper.connect", zookeeper);
    props.put("group.id", consumerGroup);
    props.put("consumer.timeout.ms", "1000"); // it will throw ConsumerTimeoutException
    props.put("auto.offset.reset", "smallest"); // when there is no (valid) offset
    props.put("zookeeper.session.timeout.ms", "1000");
    props.put("zookeeper.sync.time.ms", "200");
    props.put("auto.commit.interval.ms", "1000");
    return new ConsumerConfig(props);
}

From source file:com.blackberry.testutil.LocalKafkaServer.java

public LocalKafkaServer() throws IOException {

    while (new File(logDir).exists()) {
        FileUtils.deleteDirectory(new File(logDir));
    }//  w w w  . j  a v  a 2s  .c  om

    Properties props = new Properties();
    props.put("broker.id", nodeId);
    props.put("port", port);
    props.put("log.dir", logDir);
    props.put("zookeeper.connect", zkConnect);
    props.put("host.name", "127.0.0.1");
    KafkaConfig conf = new KafkaConfig(props);

    zkUtils = ZkUtils.apply(props.getProperty("zookeeper.connect"), 30000, 30000,
            JaasUtils.isZkSecurityEnabled());

    server = new KafkaServerStartable(conf);
    server.startup();
}

From source file:aka.pirana.springsecurity.web.config.WebMvcConfig.java

@Bean
public SimpleMappingExceptionResolver simpleMappingExceptionResolver() {
    System.out.println("aka.pirana.springsecurity.web.config.WebMvcConfig.simpleMappingExceptionResolver()");
    SimpleMappingExceptionResolver b = new SimpleMappingExceptionResolver();
    Properties mappings = new Properties();
    mappings.put("org.springframework.dao.DataAccessException", "error");
    b.setExceptionMappings(mappings);//from  w  w  w. j a va 2 s .  c  o  m
    return b;
}

From source file:com.banco.config.RootConfig.java

private Properties hibProperties() {
    Properties properties = new Properties();
    properties.put(PROPERTY_NAME_HIBERNATE_DIALECT, env.getRequiredProperty(PROPERTY_NAME_HIBERNATE_DIALECT));
    properties.put(PROPERTY_NAME_HIBERNATE_SHOW_SQL, env.getRequiredProperty(PROPERTY_NAME_HIBERNATE_SHOW_SQL));
    properties.put(PROPERTY_NAME_HIBERNATE_HBM2DDL, env.getRequiredProperty(PROPERTY_NAME_HIBERNATE_HBM2DDL));
    return properties;
}

From source file:com.sisrni.config.FreeMarkerConfig.java

@Bean
public JavaMailSender getMailSender() {
    JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
    Parametros parametrosMail = parametrosService.getParametrosMail();

    //para gmail.
    mailSender.setHost(parametrosMail.getSmtp());
    mailSender.setPort(parametrosMail.getPuerto());
    mailSender.setUsername(parametrosMail.getCuentaCorreo());
    mailSender.setPassword("tragra01");

    Properties javaMailProperties = new Properties();
    javaMailProperties.put("mail.smtp.starttls.enable", "true");
    javaMailProperties.put("mail.smtp.auth", "true");
    javaMailProperties.put("mail.transport.protocol", "smtp");
    javaMailProperties.put("mail.debug", "true");

    mailSender.setJavaMailProperties(javaMailProperties);
    return mailSender;
}

From source file:com.flipkart.flux.MigrationUtil.MigrationsRunner.java

public void migrate(String dbName) {
    try {/*from w w w.j  ava2s.com*/
        Configuration configuration = yamlConfiguration.subset(dbName + ".Hibernate");
        Properties properties = new Properties();
        properties.put("user", configuration.getProperty("hibernate.connection.username"));
        properties.put("password", configuration.getProperty("hibernate.connection.password"));
        String url = (String) configuration.getProperty("hibernate.connection.url");
        Class.forName("com.mysql.jdbc.Driver").newInstance();
        java.sql.Connection connection = DriverManager.getConnection(url, properties);
        Database database = DatabaseFactory.getInstance()
                .findCorrectDatabaseImplementation(new JdbcConnection(connection));
        ClassLoader classLoader = getClass().getClassLoader();
        File file = new File(classLoader.getResource(dbName + "/migrations.xml").getFile());
        Liquibase liquibase = new Liquibase(file.getCanonicalPath(), new FileSystemResourceAccessor(),
                database);
        liquibase.update(new Contexts());
    } catch (Exception e) {
        System.err.println("Unable to perform database migration.");
        e.printStackTrace();
    }
}

From source file:br.com.joaops.springdatajpajavaconfigfirebird.configuration.DataConfiguration.java

@Bean
public EntityManagerFactory entityManagerFactory() {
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setGenerateDdl(true);/*from w  w  w  .  j a  v  a2 s. co  m*/

    Properties jpaProperties = new Properties();
    jpaProperties.put("hibernate.hbm2ddl.auto", "create-drop");
    jpaProperties.put("hibernate.dialect", "org.hibernate.dialect.FirebirdDialect");

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setDataSource(dataSource());
    factory.setPackagesToScan("br.com.joaops.springdatajpajavaconfigfirebird.model");
    factory.setJpaVendorAdapter(vendorAdapter);
    factory.setJpaProperties(jpaProperties);
    factory.afterPropertiesSet();

    return factory.getObject();
}

From source file:com.opitzconsulting.springdata.jpa.InfrastructureConfig.java

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setDatabase(Database.H2);
    vendorAdapter.setGenerateDdl(true);// w  w  w.j a v a 2  s . c o  m
    vendorAdapter.setShowSql(false);

    Properties jpaProperties = new Properties();
    jpaProperties.put(Environment.DIALECT, ImprovedH2Dialect.class.getName());

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(vendorAdapter);
    factory.setPackagesToScan(getClass().getPackage().getName());
    factory.setDataSource(dataSource());

    return factory;
}