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:org.ibankapp.base.persistence.validation.test.TestContextConfig.java

@Bean
LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource) {
    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();

    entityManagerFactoryBean.setDataSource(dataSource);
    entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
    entityManagerFactoryBean.setPackagesToScan("org.ibankapp");

    Properties properties = new Properties();
    properties.put("hibernate.dialect", "org.hibernate.dialect.H2Dialect");
    properties.put("hibernate.ejb.naming_strategy", "org.hibernate.cfg.ImprovedNamingStrategy");
    properties.put("hibernate.hbm2ddl.auto", "update");
    properties.put("hibernate.show_sql", true);

    entityManagerFactoryBean.setJpaProperties(properties);
    return entityManagerFactoryBean;

}

From source file:uk.co.parso.barebones.DbConfig.java

private Properties hibProperties() {
    Properties properties = new Properties();
    properties.put("hibernate.dialect", "org.hibernate.dialect.MySQL5InnoDBDialect");
    properties.put("hibernate.show_sql", "true");
    return properties;
}

From source file:aka.pirana.springsecurity.config.AppConfig.java

@Bean
public JavaMailSenderImpl javaMailSenderImpl() {
    System.out.println("aka.pirana.springsecurity.config.AppConfig.javaMailSenderImpl()");
    JavaMailSenderImpl mailSenderImpl = new JavaMailSenderImpl();
    mailSenderImpl.setHost(env.getProperty("smtp.host"));
    mailSenderImpl.setPort(env.getProperty("smtp.port", Integer.class));
    mailSenderImpl.setProtocol(env.getProperty("smtp.protocol"));
    mailSenderImpl.setUsername(env.getProperty("smtp.username"));
    mailSenderImpl.setPassword(env.getProperty("smtp.password"));

    Properties javaMailProps = new Properties();
    javaMailProps.put("mail.smtp.auth", true);
    javaMailProps.put("mail.smtp.starttls.enable", true);

    mailSenderImpl.setJavaMailProperties(javaMailProps);

    return mailSenderImpl;
}

From source file:com.orange.spring.cloud.connector.s3.core.creator.S3FactoryCreator.java

public SpringCloudBlobStoreContext create(S3ServiceInfo serviceInfo,
        ServiceConnectorConfig serviceConnectorConfig) {
    Properties storeProviderInitProperties = new Properties();
    storeProviderInitProperties.put(PROPERTY_S3_VIRTUAL_HOST_BUCKETS, serviceInfo.isVirtualHostBuckets());
    this.loadProxy(storeProviderInitProperties);
    storeProviderInitProperties.put(PROPERTY_TRUST_ALL_CERTS, SKIP_SSL_VERIFICATION);
    ContextBuilder contextBuilder = ContextBuilder.newBuilder("s3");
    contextBuilder.overrides(storeProviderInitProperties).endpoint(serviceInfo.getS3Host())
            .credentials(serviceInfo.getAccessKeyId(), serviceInfo.getSecretAccessKey());
    return new SpringCloudBlobStoreContext(contextBuilder.buildView(BlobStoreContext.class),
            serviceInfo.getBucket());//from   ww w. j  a va  2  s  . com
}

From source file:com.pavikumbhar.javaheart.springconfiguration.AppConfig.java

private Properties hibernateProperties() {
    Properties properties = new Properties();
    properties.put("hibernate.dialect", environment.getRequiredProperty("hibernate.dialect"));
    properties.put("hibernate.show_sql", environment.getRequiredProperty("hibernate.show_sql"));
    properties.put("hibernate.format_sql", environment.getRequiredProperty("hibernate.format_sql"));
    return properties;
}

From source file:com.widen.valet.importer.ImportBulkZones.java

private Properties zoneProperties(String fileName, String zoneId) {
    Properties properties = new Properties();

    properties.put("widen.valet.dry-run", "false");
    properties.put("widen.valet.aws-access-key", AWS_ACCESS_KEY);
    properties.put("widen.valet.aws-private-key", AWS_SECRET_KEY);
    properties.put("widen.valet.import-file", fileName);
    properties.put("widen.valet.aws-route53-zone-id", zoneId);
    properties.put("widen.valet.aws-name-server", "route53rrs");
    properties.put("widen.valet.default-ttl", "600");

    return properties;
}

From source file:com.project.framework.configuration.DBConfig.java

@Bean
public Properties getHibernateProperties() {
    Properties properties = new Properties();
    properties.put(DIALECT, env.getProperty("hibernate.dialect"));
    properties.put(USE_SQL_COMMENTS, env.getProperty("hibernate.use_sql_comments"));
    properties.put(SHOW_SQL, env.getProperty("hibernate.show_sql"));
    properties.put(FORMAT_SQL, env.getProperty("hibernate.format_sql"));
    properties.put(DEFAULT_SCHEMA, env.getProperty("hibernate.default_schema"));
    properties.put(HBM2DDL_AUTO, env.getProperty("hibernate.hbm2ddl.auto"));
    properties.put(C3P0_MIN_SIZE, env.getProperty("hibernate.c3p0.min_size"));
    properties.put(C3P0_MAX_SIZE, env.getProperty("hibernate.c3p0.max_size"));
    properties.put(C3P0_ACQUIRE_INCREMENT, env.getProperty("hibernate.c3p0.acquire_increment"));
    properties.put(C3P0_TIMEOUT, env.getProperty("hibernate.c3p0.timeout"));
    properties.put(C3P0_MAX_STATEMENTS, env.getProperty("hibernate.c3p0.max_statements"));
    return properties;
}

From source file:gov.nih.nci.ncicb.cadsr.ProcessMultipleFilesTestCase.java

public void testProcessor() {
    Properties props = new Properties();
    props.put("db.url", getPropertyManager().getUnitDataSourceURL());
    props.put("db.username", getPropertyManager().getUnitDataSourceUser());
    props.put("db.password", getPropertyManager().getUnitDataSourcePassword());

    SpringBeansUtil.getInstance().initialize(props);

    CaDSRBulkLoadProcessor blProcessor = SpringBeansUtil.getInstance().getBulkLoadProcessor();

    BulkLoadProcessResult[] processResults = blProcessor.process(WORKING_IN_DIR, WORKING_OUT_DIR, true);
    assertNotNull(processResults);/*from  w w  w .  j av a  2s.  c om*/
    assertTrue(processResults.length == 2);
    for (BulkLoadProcessResult result : processResults) {
        assertTrue(result.getLoadResult().isSuccessful());
    }

}

From source file:org.dspace.orm.DSpaceSessionFactoryBuilder.java

public SessionFactory createInstall(DatabaseInformation info, DataSource datasource) throws IOException {
    LocalSessionFactoryBean local = new LocalSessionFactoryBean();
    local.setDataSource(datasource);//from w w  w. ja  v a2  s.  c  o  m
    local.setPackagesToScan(IDSpaceObject.class.getPackage().getName());
    Properties prop = new Properties();
    prop.put("hibernate.dialect", info.getDialectClass().getName());
    prop.put("hibernate.connection.autocommit", false);
    prop.put("hibernate.current_session_context_class", "thread");
    prop.put("hibernate.show_sql", true);
    prop.put("hibernate.hbm2ddl.auto", "create");

    local.setHibernateProperties(prop);
    local.afterPropertiesSet();
    SessionFactory sessionFac = local.getObject();
    return sessionFac;
}

From source file:com.jeqo.samples.eventsource.infra.kafka.KafkaConsumerProvider.java

public void init(@Observes @Initialized(ApplicationScoped.class) Object init) {
    try {/* w  w  w . j a  v a  2 s  .  co m*/
        config = new ObjectMapper(new YAMLFactory()).readValue(
                this.getClass().getClassLoader().getResourceAsStream("kafka-consumer.yml"),
                KafkaConsumerConfig.class);

        Properties props = new Properties();
        props.put("zookeeper.connect", "localhost:2181");
        props.put("group.id", config.getGroupId());
        props.put("zookeeper.session.timeout.ms", "413");
        props.put("zookeeper.sync.time.ms", "203");
        props.put("auto.commit.interval.ms", "1000");

        ConsumerConfig cf = new ConsumerConfig(props);
        consumer = Consumer.createJavaConsumerConnector(cf);
    } catch (IOException ex) {
        LOGGER.log(Level.SEVERE, "Error KafkaConsumerProvider init", ex);
    }
}