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.itn.configuration.HibernateConfiguration.java

@Bean
public Properties prop() {
    Properties prop = new Properties();
    prop.put("hibernate.dialect", env.getRequiredProperty("hibernate.dialect"));
    prop.put("hibernate.show_sql", env.getRequiredProperty("hibernate.show_sql"));
    prop.put("hibernate.format_sql", env.getRequiredProperty("hibernate.format_sql"));
    prop.put("hibernate.hbm2ddl.auto", env.getRequiredProperty("hibernate.hbm2ddl.auto"));

    return prop;//from ww  w  . j  a  va 2s.c  om
}

From source file:com.blackberry.bdp.test.utils.LocalKafkaServer.java

public LocalKafkaServer() throws IOException {

    while (new File(logDir).exists()) {
        FileUtils.deleteDirectory(new File(logDir));
    }//from   ww w .j a  va2s. 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);

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

From source file:com.springsource.greenhouse.config.MailConfig.java

/**
 * The Java Mail sender.//from ww w  .j a  v  a2s.  c  o  m
 * It's not generally expected for mail sending to work in embedded mode.
 * Since this mail sender is always invoked asynchronously, this won't cause problems for the developer.
 */
@Bean
public JavaMailSender mailSender() {
    JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
    mailSender.setDefaultEncoding("UTF-8");
    mailSender.setHost(environment.getProperty("mail.host"));
    mailSender.setPort(environment.getProperty("mail.port", Integer.class, 25));
    mailSender.setUsername(environment.getProperty("mail.username"));
    mailSender.setPassword(environment.getProperty("mail.password"));
    Properties properties = new Properties();
    properties.put("mail.smtp.auth", environment.getProperty("mail.smtp.auth", Boolean.class, false));
    properties.put("mail.smtp.starttls.enable",
            environment.getProperty("mail.smtp.starttls.enable", Boolean.class, false));
    mailSender.setJavaMailProperties(properties);
    return mailSender;
}

From source file:io.github.bibekshakya35.ehealth.configuration.EhealthCofiguration.java

private Properties getHibernateProperties() {
    Properties properties = new Properties();
    properties.put("hibernate.show_sql", "true");
    properties.put("hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect");
    properties.put("hibernate.hbm2ddl.auto", "update");
    return properties;
}

From source file:net.craigstars.app.config.CSHibernateConfigurer.java

public void configure(Configuration configuration) {
    try {/*from www . ja va2 s .  c om*/
        // Reads an external file in the ~/bootstrap directory
        // This file contains all the hibernate credentials/driver for the current server.
        File cfgFile = new File(System.getProperty("user.home"), "bootstrap/cs.hibernate.cfg.properties");
        PropertiesConfiguration config = new PropertiesConfiguration(cfgFile.getAbsolutePath());
        Properties properties = new Properties();
        properties.put("hibernate.connection.driver_class", config.getProperty("driver"));
        properties.put("hibernate.connection.url", config.getProperty("url"));
        properties.put("hibernate.dialect", config.getProperty("dialect"));
        properties.put("hibernate.connection.username", config.getProperty("username"));
        properties.put("hibernate.connection.password", config.getProperty("password"));
        configuration.addProperties(properties);
    } catch (Exception ex) {
        throw new RuntimeException("Failed to load hibernate properties file", ex);
    }
}

From source file:com.springmvc.videoteca.spring.config.SpringDBConfig.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"));
    properties.put("hibernate.hbm2ddl.auto", environment.getRequiredProperty("hibernate.hbm2ddl.auto"));
    return properties;
}

From source file:org.davidmendoza.fileUpload.config.MailConfig.java

@Bean
public JavaMailSender mailSender() {
    JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
    mailSender.setDefaultEncoding("UTF-8");
    mailSender.setHost(mailHost);/*  w w  w. j a v  a 2s. c  o m*/
    mailSender.setPassword(mailPassword);
    mailSender.setUsername(mailUser);
    mailSender.setPort(new Integer(mailPort));
    Properties properties = new Properties();
    properties.put("mail.smtp.auth", mailAuth);
    properties.put("mail.smtp.starttls.enable", mailStarttls);
    properties.put("mail.smtp.socketFactory.class", mailSocketFactory);
    properties.put("mail.debug", mailDebug);
    mailSender.setJavaMailProperties(properties);
    return mailSender;
}

From source file:org.springframework.social.vkontakte.api.impl.AudioTemplate.java

public List<Audio> get(Integer ownerId) {
    requireAuthorization();//from  w  w w.  j av  a2  s  . c  o m
    Properties props = new Properties();
    props.put("need_user", "0");
    props.put("owner_id", String.valueOf(ownerId));

    // http://vk.com/dev/wall.get
    URI uri = makeOperationURL("audio.get", props, ApiVersion.VERSION_5_21);
    VKGenericResponse response = restTemplate.getForObject(uri, VKGenericResponse.class);
    checkForError(response);
    return deserializeArray(response, Audio.class).getItems();
}

From source file:com.ehealth.infrustructure.RepositoryConfig.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_AUTO_GENRATE_TABLES,
            env.getRequiredProperty(PROPERTY_NAME_HIBERNATE_AUTO_GENRATE_TABLES));
    return properties;
}

From source file:com.ushahidi.swiftriver.core.mail.EmailHelperTest.java

@Before
public void setUp() {
    mockMailSender = mock(JavaMailSender.class);

    // Initialize the velocity engine
    VelocityEngine velocityEngine = new VelocityEngine();

    Properties props = new Properties();
    props.put("resource.loader", "class");
    props.put("class.resource.loader.class",
            "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
    velocityEngine.init(props);/*from w w w .  j  a  v a 2  s.  c o  m*/

    emailHelper = new EmailHelper();
    emailHelper.setMailSender(mockMailSender);
    emailHelper.setSenderAddress("no-reply@myswiftriver.com");
    emailHelper.setResetPasswordUrl("http://myswiftriver.com");
    emailHelper.setVelocityEngine(velocityEngine);
}