List of usage examples for java.util Properties setProperty
public synchronized Object setProperty(String key, String value)
From source file:com.bibisco.test.AllTests.java
public static SqlSessionFactory getProjectSqlSessionFactoryById(String pStrIdProject) { SqlSessionFactory mSqlSessionFactory; try {/*www . j a v a 2 s.co m*/ if (!mBlnEnvironmentInitialized) { init(); } Reader lReader = Resources.getResourceAsReader(RESOURCE_FILE_NAME); Properties lProperties = new Properties(); StringBuilder lStringBuilderProjectDBUrl = new StringBuilder(); lStringBuilderProjectDBUrl.append("jdbc:h2:file:"); lStringBuilderProjectDBUrl.append(mStrPathSeparator); lStringBuilderProjectDBUrl.append(BIBISCO_INTERNAL_PROJECTS_DIR); lStringBuilderProjectDBUrl.append(mStrPathSeparator); lStringBuilderProjectDBUrl.append(pStrIdProject); lStringBuilderProjectDBUrl.append(mStrPathSeparator); lStringBuilderProjectDBUrl.append(pStrIdProject); lProperties.setProperty("url", lStringBuilderProjectDBUrl.toString()); lProperties.setProperty("username", DB_USERNAME); lProperties.setProperty("password", DB_PASSWORD); mSqlSessionFactory = new SqlSessionFactoryBuilder().build(lReader, lProperties); } catch (Exception e) { throw new IllegalStateException(e); } return mSqlSessionFactory; }
From source file:com.websqrd.catbot.setting.CatbotSettings.java
public static void storeAccessLog(String username, String ip) { Properties props = getProperties(passwdFilename); props.setProperty(username + ".ip", ip); props.setProperty(username + ".time", getSimpleDatetime()); storeProperties(props, passwdFilename); putToCache(props, passwdFilename);/*w w w . j a v a2 s. c o m*/ }
From source file:org.cloudfoundry.reconfiguration.tomee.provider.DB2PropertiesProvider.java
@Override protected void configure(RelationalServiceInfo serviceInfo, Properties properties) { properties.setProperty(PROPERTY_JDBC_DRIVER, JDBC_DRIVER_CLASS); properties.setProperty(PROPERTY_VALIDATION_QUERY, VALIDATION_QUERY); }
From source file:org.spring.data.gemfire.app.main.SpringGemFireRedisServer.java
@Bean Properties gemfireProperties(@Value("${spring.gemfire.log.level:config}") String logLevel, @Value("${spring.gemfire.redis.bind-address:localhost}") String redisBindAddress, @Value("${spring.gemfire.redis.port:1234}") String redisPort) { Properties gemfireProperties = new Properties(); gemfireProperties.setProperty("name", SpringGemFireRedisServer.class.getSimpleName()); gemfireProperties.setProperty("mcast-port", "0"); gemfireProperties.setProperty("log-level", logLevel); gemfireProperties.setProperty("redis-bind-address", redisBindAddress); gemfireProperties.setProperty("redis-port", redisPort); return gemfireProperties; }
From source file:net.officefloor.plugin.jdbc.vendor.hsqldb.HsqldbJdbcTest.java
@Override protected void loadProperties(Properties properties) { properties.setProperty(JdbcManagedObjectSource.CONNECTION_POOL_DATA_SOURCE_CLASS_PROPERTY, DriverAdapterCPDS.class.getName()); properties.setProperty("driver", jdbcDriver.class.getName()); properties.setProperty("url", "jdbc:hsqldb:mem:test"); properties.setProperty("user", "sa"); properties.setProperty("password", ""); }
From source file:org.beast.project.template.config.ExceptionResolverConfig.java
@Bean public SimpleMappingExceptionResolver simpleMappingExceptionResolver() { SimpleMappingExceptionResolver smer = new SimpleMappingExceptionResolver(); smer.setOrder(2);//from ww w . jav a 2 s. c o m smer.setDefaultErrorView("errorPage"); Properties props = new Properties(); props.setProperty("javax.servlet.ServletException", "errorPage404"); smer.setExceptionMappings(props); return smer; }
From source file:com.mirth.connect.connectors.smtp.DefaultSmtpConfiguration.java
@Override public void configureMailProperties(Properties mailProperties) { mailProperties.setProperty("mail.smtp.ssl.protocols", protocols); mailProperties.setProperty("mail.smtp.ssl.ciphersuites", cipherSuites); }
From source file:com.apress.prospringintegration.social.mail.MailConfiguration.java
@Bean public JavaMailSenderImpl mailSender() { JavaMailSenderImpl mailSender = new JavaMailSenderImpl(); mailSender.setHost("smtp.gmail.com"); mailSender.setPort(587);/*from w ww . jav a2 s .c om*/ mailSender.setUsername("[username]"); mailSender.setPassword("[password]"); Properties properties = new Properties(); properties.setProperty("mail.smtp.starttls.enable", "true"); properties.setProperty("mail.smtp.auth", "true"); mailSender.setJavaMailProperties(properties); return mailSender; }
From source file:ru.elcor.mis.scheduler.config.AppConfig.java
@Bean public PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() { PropertySourcesPlaceholderConfigurer properties = new PropertySourcesPlaceholderConfigurer(); Properties Props = new Properties(); Props.setProperty("cron", "0-59/2 * * * * *"); properties.setProperties(Props);/*from ww w .j a v a2 s .c o m*/ properties.setLocation(new ClassPathResource("scheduler.properties")); properties.setIgnoreResourceNotFound(false); return properties; }
From source file:es.csic.iiia.planes.cli.Cli.java
/** * Parse the provided list of arguments according to the program's options. * // w w w . ja v a 2 s . co m * @param in_args * list of input arguments. * @return a configuration object set according to the input options. */ private static Configuration parseOptions(String[] in_args) { CommandLineParser parser = new PosixParser(); CommandLine line = null; Properties settings = loadDefaultSettings(); try { line = parser.parse(options, in_args); } catch (ParseException ex) { Logger.getLogger(Cli.class.getName()).log(Level.SEVERE, ex.getLocalizedMessage(), ex); showHelp(); } if (line.hasOption('h')) { showHelp(); } if (line.hasOption('d')) { dumpSettings(); } if (line.hasOption('s')) { String fname = line.getOptionValue('s'); try { settings.load(new FileReader(fname)); } catch (IOException ex) { throw new IllegalArgumentException("Unable to load the settings file \"" + fname + "\""); } } // Apply overrides settings.setProperty("gui", String.valueOf(line.hasOption('g'))); settings.setProperty("quiet", String.valueOf(line.hasOption('q'))); Properties overrides = line.getOptionProperties("o"); settings.putAll(overrides); String[] args = line.getArgs(); if (args.length < 1) { showHelp(); } settings.setProperty("problem", args[0]); Configuration c = new Configuration(settings); System.out.println(c.toString()); /** * Modified by Guillermo B. Print settings to a result file, titled * "results.txt" */ try { FileWriter fw = new FileWriter("results.txt", true); BufferedWriter bw = new BufferedWriter(fw); PrintWriter out = new PrintWriter(bw); String[] results = c.toString().split("\n"); // out.println(results[8]); for (String s : results) { out.println(s); } // out.println(results[2]); // out.println(results[8]); out.close(); } catch (IOException e) { } /** * Modified by Ebtesam Save settings to a .csv file, titled * "resultsCSV.csv" */ try { FileWriter writer = new FileWriter("resultsCSV.csv", true); FileReader reader = new FileReader("resultsCSV.csv"); String header = "SAR Strategy,# of Searcher UAVs,# of Survivors," + "# of Survivors rescued,Min.Time needed to rescue Survivors,Mean. Time needed to rescue Survivors,Max. Time needed to rescue Survivors," + "# of Survivors found,Min. Time needed to find Survivors,Mean Time needed to find Survivors,Max. Time needed to find Survivors," + "Running Time of Simulation\n"; if (reader.read() == -1) { writer.append(header); writer.append("\n"); } reader.close(); String[] results = c.toString().split("\n"); writer.append(results[2].substring(10)); writer.append(","); writer.append(results[20].substring(11)); writer.append(","); writer.append(results[30].substring(18)); writer.write(","); writer.close(); } catch (IOException e) { } if (line.hasOption('t')) { System.exit(0); } return c; }