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:br.com.joaops.smt.configuration.PersistenceConfig.java

private Properties getAdditionalProperties() {
    Properties properties = new Properties();
    properties.setProperty("hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect");
    properties.setProperty("hibernate.show_sql", "false");
    properties.setProperty("hibernate.format_sql", "true");
    properties.setProperty("hibernate.tenant_identifier_resolver",
            CurrentTenantIdentifierResolverImpl.class.getName());
    properties.setProperty("hibernate.multi_tenant_connection_provider",
            MultiTenantConnectionProvider.class.getName());
    properties.setProperty("hibernate.multiTenancy", "DATABASE");
    return properties;
}

From source file:example.app.spring.boot.geode.server.BootGeodeServerApplication.java

@Bean
Properties gemfireProperties(@Value("${gemfire.log.level:" + DEFAULT_GEMFIRE_LOG_LEVEL + "}") String logLevel,
        @Value("${gemfire.locator.embedded.host-port:localhost[10334]}") String startLocator,
        @Value("${gemfire.manager:true}") boolean jmxManager,
        @Value("${gemfire.manager.port:1099}") int jmxManagerPort,
        @Value("${gemfire.manager.start:false}") boolean jmxManagerStart) {

    Properties gemfireProperties = new Properties();

    gemfireProperties.setProperty("name", applicationName());
    gemfireProperties.setProperty("mcast-port", "0");
    gemfireProperties.setProperty("log-level", logLevel);
    gemfireProperties.setProperty("jmx-manager", String.valueOf(jmxManager));
    gemfireProperties.setProperty("jmx-manager-port", String.valueOf(jmxManagerPort));
    gemfireProperties.setProperty("jmx-manager-start", String.valueOf(jmxManagerStart));
    gemfireProperties.setProperty("start-locator", startLocator);

    return gemfireProperties;
}

From source file:py.una.pol.karaku.test.test.PropertiesUtilTest.java

@Test(expected = KarakuWrongConfigurationFileException.class)
public void testNotExitingFile() throws Exception {

    Properties p = new Properties();
    p.setProperty(PropertiesUtil.ANOTHER_KEY, "/test");

    prop = new PropertiesUtil();
    prop.setProperties(p);//  ww w .j  a  v  a  2 s  .  c om
    prop.postProcessBeanFactory(new DefaultListableBeanFactory());
}

From source file:com.bekwam.examples.javafx.oldscores.SettingsDAOImpl.java

@Override
public void save() throws IOException {

    if (logger.isDebugEnabled()) {
        logger.debug("[SAVE] saving " + getAbsolutePath());
    }/*from  ww  w  .  ja  va  2 s .  c om*/
    FileWriter fw = new FileWriter(getAbsolutePath());
    Properties props = new Properties();
    props.setProperty("oldscores.roundUp", String.valueOf(settings.getRoundUp()));
    props.store(fw, "");
    fw.close();
}

From source file:com.apress.prospringintegration.webservice.web.TicketIssuerServiceConfiguration.java

@Bean
public SimpleUrlHandlerMapping simpleUrlHandlerMapping() {
    SimpleUrlHandlerMapping simpleHandlerMapping = new SimpleUrlHandlerMapping();
    simpleHandlerMapping.setDefaultHandler(soapMessageDispatcher());
    Properties urlMap = new Properties();
    urlMap.setProperty("*.wsdl", "tickets");
    simpleHandlerMapping.setMappings(urlMap);
    return simpleHandlerMapping;
}

From source file:net.ontopia.topicmaps.webed.impl.utils.TagUtils.java

protected static VelocityEngine getVelocityEngine(ServletContext scontext) {
    VelocityEngine vengine = (VelocityEngine) scontext.getAttribute(Constants.SCTXT_VELOCITY_ENGINE);

    if (vengine == null) {

        // create a new velocity engine
        vengine = new VelocityEngine();

        // --- try to get properties from an own file
        String relPath = scontext.getInitParameter(Constants.SCTXT_VELOPROPS_PATH);
        if (relPath != null) {
            String velocityPropPath = scontext.getRealPath(relPath);
            log.info("Initialising velocity from property file: " + velocityPropPath);
            // load in properties
            Properties props = new Properties();
            try {
                props.load(new java.io.FileInputStream(velocityPropPath));
            } catch (java.io.IOException ioe) {
                throw new OntopiaRuntimeException(ioe);
            }//from   ww w.j  a v  a  2  s .  c  o  m
            // pre-cat the real directory
            String path = props.getProperty(Velocity.FILE_RESOURCE_LOADER_PATH, null);
            if (path != null) {
                path = scontext.getRealPath(path);
                props.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, path);
            } else {
                // no directory set, use default loader (classpath) for default templates
                props.setProperty("resource.loader", "class");
                props.setProperty("class.resource.loader.class",
                        "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
                props.setProperty("class.resource.loader.cache", "true");
            }
            try {
                vengine.init(props);
            } catch (Exception e) {
                throw new OntopiaRuntimeException(e);
            }
        } else {
            log.info("Initializing velocity with default properties.");
            // use class resource loaders
            Properties props = new Properties();
            props.setProperty("resource.loader", "class");
            props.setProperty("class.resource.loader.class",
                    "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
            props.setProperty("class.resource.loader.cache", "true");
            // use log4j logging system
            props.setProperty("runtime.log.system", "org.apache.velocity.runtime.log.SimpleLog4JLogSystem");
            props.setProperty("runtime.log.logsystem.log4j.category", "net.ontopia.velocity");
            props.setProperty("runtime.log", "velocity.log");
            try {
                vengine.init(props);
            } catch (Exception e) {
                throw new OntopiaRuntimeException(e);
            }
        }

        // add velocity engine to servlet context
        scontext.setAttribute(Constants.SCTXT_VELOCITY_ENGINE, vengine);
    }
    return vengine;
}

From source file:com.sangupta.jerry.email.helper.GmailJavaMailSender.java

/**
 * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
 *///from ww  w  .  j  a v  a 2 s .co m
@Override
public void afterPropertiesSet() throws Exception {
    Properties properties = new Properties();
    if (smtpSSLEnabled) {
        properties.setProperty("mail.smtp.auth", "true");
        properties.setProperty("mail.smtp.starttls.enable", "true");
        setJavaMailProperties(properties);
    }
}

From source file:org.csc.phynixx.spring.integration.config.AtomikosJtaConfiguration.java

public Properties tailorEntityManagerFactoryProperties(Properties properties) {
    properties.setProperty("hibernate.transaction.manager_lookup_class",
            TransactionManagerLookup.class.getName());
    return properties;
}

From source file:com.sharksharding.util.mail.SendMail.java

public SendMail() {
    mailBean = new MailBean();
    mailSender = new JavaMailSenderImpl();
    mailSender.setPort(mailBean.getPORT());
    mailSender.setHost(mailBean.getHOST());
    mailSender.setUsername(mailBean.getUSERNAME());
    mailSender.setPassword(mailBean.getPASSWORD());
    Properties properties = new Properties();
    properties.setProperty("mail.smtp.auth", "true");
    mailSender.setJavaMailProperties(properties);
    mailMessage = new SimpleMailMessage();
    mailMessage.setFrom(mailBean.getFROM());
    mailMessage.setTo(mailBean.getTO());
    mailMessage.setSubject(mailBean.getSUBJECT());
    GetUserInfo getUserInfo = new GetUserInfo();
    mailMessage.setText("[version]:" + LoadVersion.getVersion() + "\n[javaVersion]:"
            + getUserInfo.getJavaVersion() + "\n[osName]:" + getUserInfo.getOsName() + "\n[jvmName]:"
            + getUserInfo.getJvmName() + "\n[address]:" + getUserInfo.getAddress() + "\n[hostName]:"
            + getUserInfo.getHostname() + "\n[startTime]:" + getUserInfo.getStartTime());
}

From source file:org.smigo.config.ProductionConfiguration.java

@Bean
public JavaMailSenderImpl javaMailSender() {
    log.debug("JavaMailSender init");
    final JavaMailSenderImpl ret = new JavaMailSenderImpl();
    ret.setUsername(mailSenderUsername);
    ret.setPassword(mailSenderPassword);
    ret.setHost(mailSenderHost);/*  ww  w  .j  a  v  a 2  s . c o  m*/
    ret.setPort(mailSenderPort);
    ret.setDefaultEncoding("UTF-8");

    final Properties props = new Properties();
    props.setProperty("mail.smtp.starttls.enable", "true");
    props.setProperty("mail.smtp.auth", "true");
    props.setProperty("mail.smtp.ssl.enable", "true");
    props.setProperty("mail.smtp.ssl.trust", mailSenderHost);

    ret.setJavaMailProperties(props);
    return ret;
}