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:olsps.com.healthsoftproject.config.ApplicationConfigClass.java

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

From source file:com.mnxfst.streams.webtrends.kafka.producer.WebtrendsKafkaProducer.java

/**
 * @see akka.actor.UntypedActor#preStart()
 *///from w  w w .j  a  v a2 s.  c o  m
public void preStart() throws Exception {

    Properties properties = new Properties();
    properties.put(CFG_BROKER_LIST, configuration.getKafkaBrokers());
    properties.put(CFG_SERIALIZER_CLASS, configuration.getSerializerClass());
    properties.put(CFG_ZOOKEEPER_CONNECT, configuration.getZookeeperConnect());
    if (StringUtils.isNotBlank(configuration.getPartitionerClass()))
        properties.put(CFG_PARTITIONER_CLASS, configuration.getPartitionerClass());

    producer = new Producer<>(new ProducerConfig(properties));
}

From source file:org.jasig.portlet.widget.service.SpringELProcessorTest.java

@Test
public void testLookupProperties() {
    Properties testProps = new Properties();
    testProps.put("key", "value");
    testProps.put("key.with.dots", "key.with.dots");

    PortletRequest request = new MockPortletRequest();

    processor.setProperties(testProps);/* w w w . ja  v a 2 s  . c om*/
    assertThat(processor.process("${key}", request), equalTo("value"));
    assertThat(processor.process("${['key.with.dots']}", request), equalTo("key.with.dots"));
}

From source file:com.jasperreports.report.service.ReportServiceService.java

public Downloadable deptBudgetGenerator(ExportType exportType, String reportTitle, Integer noOfEmployees,
        String orderClause) {//  w w w  .j a  v a2 s  .  c o  m
    Map<String, Object> parameters = new HashMap<>();
    parameters.put("ReportTitle", reportTitle);
    parameters.put("NoOfEmployees", noOfEmployees);
    parameters.put("OrderClause", (orderClause == null ? "budget" : orderClause));

    Properties properties = new Properties();
    properties.put("queryType", "sql");
    properties.put("sessionFactoryRef", "hrdbSessionFactory");

    ReportContext reportContext = new ReportContext();
    reportContext.setReportName("DeptBudget");
    reportContext.setDataSourceType("dbReport");
    reportContext.setExportType(exportType);
    reportContext.setProperties(properties);
    reportContext.setParameters(parameters);

    return reportServiceManager.generateReport(reportContext);
}

From source file:com.jasperreports.report.service.ReportServiceService.java

public Downloadable empVacationGenerator(ExportType exportType, String reportTitle, Integer empID,
        String orderClause) {/*from   w  ww.  j  ava2  s . co  m*/
    Map<String, Object> parameters = new HashMap<>();
    parameters.put("ReportTitle", reportTitle);
    parameters.put("EmpID", empID);
    parameters.put("OrderClause", (orderClause == null ? "startdate" : orderClause));

    Properties properties = new Properties();
    properties.put("queryType", "hql");
    properties.put("sessionFactoryRef", "hrdbSessionFactory");

    ReportContext reportContext = new ReportContext();
    reportContext.setReportName("EmpVacation");
    reportContext.setDataSourceType("dbReport");
    reportContext.setExportType(exportType);
    reportContext.setProperties(properties);
    reportContext.setParameters(parameters);

    return reportServiceManager.generateReport(reportContext);
}

From source file:com.otz.transport.config.TransportProducerConfiguration.java

@Bean(name = "KafkaProducerProperties")
public Properties kafkaProducerProperties(Environment environment) {
    String kafkaServer = environment.getProperty(environment.getActiveProfiles()[0] + KAFKA);

    Properties properties = new Properties();
    properties.put(RETRIES, environment.getProperty(TRANSPORT_RETRIES));
    properties.put(BATCH_SIZE, environment.getProperty(TRANSPORT_BATCH_SIZE));
    properties.put(TIMEOUT_MS, environment.getProperty(TRANSPORT_TIMEOUT_MS));
    properties.put(BUFFER_MEMORY, environment.getProperty(TRANSPORT_BUFFER_MEMORY));
    properties.put(ACK, environment.getProperty(TRANSPORT_ACK));
    properties.put(MAX_BLOCK, environment.getProperty(TRANSPORT_MAX_BLOCK));
    properties.put(KEY_SERIALIZER, environment.getProperty(TRANSPORT_KAFKA_KEY_SERIALIZER));
    properties.put(VALUE_SERIALIZER, environment.getProperty(TRANSPORT_KAFKA_VALUE_SERIALIZER));
    properties.put(BOOTSTRAP_SERVERS, kafkaServer);

    return properties;
}

From source file:uk.org.funcube.fcdw.config.MailConfig.java

@Bean
VelocityEngineFactoryBean velocityEngine() {
    VelocityEngineFactoryBean velocityEngine = new VelocityEngineFactoryBean();

    velocityEngine.setResourceLoaderPath("/WEB-INF/velocity/");

    Properties velocityProperties = new Properties();
    velocityProperties.put("input.encoding", "utf-8");
    velocityProperties.put("output.encoding", "utf-8");

    velocityEngine.setVelocityProperties(velocityProperties);

    return velocityEngine;
}

From source file:org.esigate.DriverCookieTest.java

/**
 * Ensure Secure attribute is kept is connection uses https.
 * //from  w w w.jav  a  2s.  c om
 * @throws Exception
 */
public void testSecure() throws Exception {

    // Conf
    Properties properties = new Properties();
    properties.put(Parameters.REMOTE_URL_BASE.getName(), "http://provider/");

    // Setup remote server (provider) response.
    Driver driver = TestUtils.createMockDriver(properties, new IResponseHandler() {
        @Override
        public HttpResponse execute(HttpRequest request) throws IOException {
            return TestUtils.createHttpResponse().status(HttpStatus.SC_OK).reason("OK")
                    .header("Set-Cookie", "testcookie=testvalue; Secure").entity("test").build();
        }
    });

    // Https request : Cookie is forwarded as Secure
    IncomingRequest request = TestUtils.createRequest("https://test.mydomain.fr/foobar/").build();

    TestUtils.driverProxy(driver, request);
    Assert.assertTrue(((ClientCookie) request.getNewCookies()[0]).isSecure());

    // Http request : Cookie is forwarded as NOT secure
    request = TestUtils.createRequest("http://test.mydomain.fr/foobar/").build();
    TestUtils.driverProxy(driver, request);
    Assert.assertFalse(((ClientCookie) request.getNewCookies()[0]).isSecure());
}

From source file:any.ejbtest.MoviesTest.java

private void initEjbContext() throws Exception {
    Properties p = new Properties();
    p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory");
    p.put("openejb.deployments.classpath.ear", "true");
    context = new InitialContext(p);

    moviesLocal = (Movies) context.lookup("MoviesImplLocal");
    moviesLegacyLocal = (Movies) context.lookup("MoviesImplLegacyLocal");
}

From source file:easyproject.service.Mail.java

public void sendMail() {
    Properties props = new Properties();

    props.put("mail.debug", "true");
    props.put("mail.smtp.auth", true);
    props.put("mail.smtp.starttls.enable", true);
    props.put("mail.smtp.host", servidorSMTP);
    props.put("mail.smtp.port", puerto);

    Session session = Session.getInstance(props, null);

    try {//from  www . jav  a2  s .com
        MimeMessage message = new MimeMessage(session);

        message.addRecipient(Message.RecipientType.TO, new InternetAddress(destino));
        message.setSubject(asunto);
        message.setSentDate(new Date());
        message.setContent(mensaje, "text/html; charset=utf-8");

        Transport tr = session.getTransport("smtp");
        tr.connect(servidorSMTP, usuario, password);
        message.saveChanges();
        tr.sendMessage(message, message.getAllRecipients());
        tr.close();

    } catch (MessagingException e) {
        e.printStackTrace();
    }
}