Example usage for java.util Properties setProperty

List of usage examples for java.util Properties setProperty

Introduction

In this page you can find the example usage for java.util Properties setProperty.

Prototype

public synchronized Object setProperty(String key, String value) 

Source Link

Document

Calls the Hashtable method put .

Usage

From source file:dao.FetchEmailDAO.java

/**
 *
 * @return/*from  w w w. ja  v a 2 s  .com*/
 */
public Message[] fetchEmail() {
    Properties props = new Properties();
    props.setProperty("mail.store.protocol", "imaps");
    //store inbox emails as Message object, store all into Message[] array.
    Message[] msgArr = null;
    try {
        Session session = Session.getInstance(props, null);
        Store store = session.getStore();
        store.connect("imap-mail.outlook.com", "joshymantou@outlook.com", "mcgrady11");
        Folder inbox = store.getFolder("INBOX");
        inbox.open(Folder.READ_ONLY);
        msgArr = inbox.getMessages();

        //System.out.println(msgArr.length);
        /*for (int i = 0; i < msgArr.length; i++) {
        Message msg = msgArr[i];
        Address[] in = msg.getFrom();
        for (Address address : in) {
            System.out.println("FROM:" + address.toString());
        }
                
        Multipart mp = (Multipart) msg.getContent();
        BodyPart bp = mp.getBodyPart(0);
        /*
        System.out.println("SENT DATE:" + msg.getSentDate());
        System.out.println("SUBJECT:" + msg.getSubject());
        System.out.println("CONTENT:" + bp.getContent());
                
        }*/
        ArrayUtils.reverse(msgArr);
        return msgArr;
    } catch (Exception mex) {
        mex.printStackTrace();
    }
    return msgArr;
}

From source file:kafka.KafkaTestBroker.java

private KafkaConfig buildKafkaConfig(String zookeeperConnectionString) {
    Properties p = new Properties();
    p.setProperty("zookeeper.connect", zookeeperConnectionString);
    p.setProperty("broker.id", "0");
    p.setProperty("port", "" + port);
    p.setProperty("log.dirs", logDir.getAbsolutePath());
    return new KafkaConfig(p);
}

From source file:fr.lepellerin.ecole.config.GestEcolePersistenceConfig.java

Properties additionalProperties() {
    final Properties properties = new Properties();
    properties.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect");
    return properties;
}

From source file:org.example.app.bootstrap.config.ExampleApplicationGemFireConfiguration.java

public Properties gemfireProperties() {
    Properties gemfireProperties = new Properties();
    gemfireProperties.setProperty("name", "ExampleApplicationSpringGemFirePeerCache");
    gemfireProperties.setProperty("mcast-port", "0");
    gemfireProperties.setProperty("log-level", "config");
    return gemfireProperties;
}

From source file:com.mycompany.spring2explore.config.PersistenceJPAConfig.java

Properties additionalProperties() {
    Properties properties = new Properties();
    properties.setProperty("hibernate.hbm2ddl.auto", "update");
    //perubahan dialect ke postgresql
    properties.setProperty("hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect");
    //jika menggunakan mysql dialect sbb:
    //properties.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect");
    return properties;
}

From source file:ml.shifu.guagua.mapreduce.example.sum.SumTest.java

@Test
public void testSumApp() throws IOException {
    Properties props = new Properties();
    props.setProperty(GuaguaConstants.MASTER_COMPUTABLE_CLASS, SumMaster.class.getName());
    props.setProperty(GuaguaConstants.WORKER_COMPUTABLE_CLASS, SumWorker.class.getName());
    props.setProperty(GuaguaConstants.GUAGUA_ITERATION_COUNT, "10");
    props.setProperty(GuaguaConstants.GUAGUA_MASTER_RESULT_CLASS, LongWritable.class.getName());
    props.setProperty(GuaguaConstants.GUAGUA_WORKER_RESULT_CLASS, LongWritable.class.getName());

    props.setProperty(GuaguaConstants.GUAGUA_MASTER_INTERCEPTERS, SumOutput.class.getName());

    props.setProperty(GuaguaConstants.GUAGUA_INPUT_DIR, getClass().getResource("/sum").toString());

    props.setProperty("guagua.sum.output", SUM_OUTPUT);

    GuaguaUnitDriver<GuaguaWritableAdapter<LongWritable>, GuaguaWritableAdapter<LongWritable>> driver = new GuaguaMRUnitDriver<GuaguaWritableAdapter<LongWritable>, GuaguaWritableAdapter<LongWritable>>(
            props);/*from w w  w .  j  a va  2  s.  co  m*/

    driver.run();

    Assert.assertEquals(15345 + "",
            FileUtils.readLines(new File(System.getProperty("user.dir") + File.separator + SUM_OUTPUT)).get(0));
}

From source file:br.com.joaops.awc.configuration.PersistenceConfig.java

private Properties getAdditionalProperties() {
    Properties properties = new Properties();
    properties.setProperty("hibernate.show_sql", "false");
    properties.setProperty("hibernate.format_sql", "true");
    properties.setProperty("hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect");
    properties.setProperty("hibernate.hbm2ddl.auto", "create-drop"); //validate
    //properties.setProperty("hibernate.hbm2ddl.import_files", "/META-INF/sql/system_module_data.sql, /META-INF/sql/system_user_data.sql, /META-INF/sql/system_user_permission.sql"); //o validate no realiza importao dos arquivos sql
    return properties;
}

From source file:com.amazonaws.sample.entitlement.AWSConfig.java

@Bean
@Qualifier("configuration")
public Properties cognitoProperties() {
    Properties properties = new Properties();
    properties.setProperty("awsCognitoDeveloperProviderName",
            env.getRequiredProperty("aws.cognito.developer.provider.name"));
    properties.setProperty("awsCognitoIdentityPool", env.getRequiredProperty("aws.cognito.identity.pool"));
    return properties;
}

From source file:com.pamarin.income.component.MailSenderImpl.java

private Properties propertiesSetup() {
    Properties pro = new Properties();
    pro.setProperty("mail.smtps.auth", "true");
    pro.setProperty("mail.smtps.starttls.enable", "true");
    pro.setProperty("mail.debug", "true");

    return pro;// w w  w  . ja v  a  2 s  . c  o m
}

From source file:de.ingrid.iplug.csw.dsc.Configuration.java

@Override
public void setPropertiesFromPlugdescription(Properties props, PlugdescriptionCommandObject pd) {
    props.setProperty("plugdescription.serviceUrl", serviceUrl);
}