List of usage examples for java.util Properties setProperty
public synchronized Object setProperty(String key, String value)
From source file:com.sosee.util.PropertyUtil.java
public static void writePropertiesFile(String key, String value) { Properties properties = new Properties(); try {/* w ww . ja v a 2s . c o m*/ OutputStream outputStream = new FileOutputStream(getFilePath()); properties.setProperty(key, value); properties.store(outputStream, "user register"); outputStream.close(); } catch (IOException e) { e.printStackTrace(); } }
From source file:com.qcadoo.model.Utils.java
public static DynamicSessionFactoryBeanImpl createNewSessionFactory() { Properties hibernateProperties = new Properties(); hibernateProperties.setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect"); DynamicSessionFactoryBeanImpl sessionFactory = new DynamicSessionFactoryBeanImpl(); sessionFactory.setDataSource(createDataSource()); sessionFactory.setHibernateProperties(hibernateProperties); return sessionFactory; }
From source file:com.iluwatar.repository.AppConfig.java
/** * Properties for Jpa/*from w ww. ja v a 2 s . com*/ */ private static Properties jpaProperties() { Properties properties = new Properties(); properties.setProperty("hibernate.dialect", "org.hibernate.dialect.H2Dialect"); properties.setProperty("hibernate.hbm2ddl.auto", "create-drop"); return properties; }
From source file:com.amazonaws.services.cognito.streams.connector.AmazonCognitoStreamsEnvironmentOptions.java
public static void bootstrapEnv(Properties properties) { properties.setProperty(KinesisConnectorConfiguration.PROP_REDSHIFT_URL, getJDBCConnection()); properties.setProperty(KinesisConnectorConfiguration.PROP_S3_BUCKET, getS3BucketName()); properties.setProperty(KinesisConnectorConfiguration.PROP_REDSHIFT_USERNAME, getRedshiftUserName()); properties.setProperty(KinesisConnectorConfiguration.PROP_REDSHIFT_PASSWORD, getRedshiftPassword()); properties.setProperty(KinesisConnectorConfiguration.PROP_KINESIS_INPUT_STREAM, getKinesisInputStream()); properties.setProperty(KinesisConnectorConfiguration.PROP_REGION_NAME, getRegion()); createRedshiftTable(properties);/*www. j a va 2s. c o m*/ }
From source file:com.sap.prd.mobile.ios.mios.VersionWithAppAsSnapshotTest.java
@BeforeClass public static void __setup() throws Exception { dynamicVersion = "1.0." + String.valueOf(System.currentTimeMillis()); testName = VersionWithAppAsSnapshotTest.class.getName() + File.separator + Thread.currentThread().getStackTrace()[1].getMethodName(); remoteRepositoryDirectory = getRemoteRepositoryDirectory(VersionWithAppAsSnapshotTest.class.getName()); prepareRemoteRepository(remoteRepositoryDirectory); Properties pomReplacements = new Properties(); pomReplacements.setProperty(PROP_NAME_DEPLOY_REPO_DIR, remoteRepositoryDirectory.getAbsolutePath()); pomReplacements.setProperty(PROP_NAME_DYNAMIC_VERSION, dynamicVersion); test(testName, new File(getTestRootDirectory(), "straight-forward/MyLibrary"), "deploy", THE_EMPTY_LIST, THE_EMPTY_MAP, pomReplacements, new NullProjectModifier()); appVerifier = test(testName, new File(getTestRootDirectory(), "straight-forward/MyApp"), "deploy", THE_EMPTY_LIST, null, pomReplacements, new AppendSnapshotToProjectVersionProjectModifier()); appTestBaseDir = new File(appVerifier.getBasedir()); }
From source file:com.thoughtworks.go.agent.bootstrapper.osx.AgentMacWindow.java
private static Properties defaultProperties() { Properties props = new Properties(); props.setProperty("server", "127.0.0.1"); props.setProperty("port", "8153"); return props; }
From source file:Main.java
/** * returns a P with the value of the specifed attribute of the specifed tags * // w ww .j av a 2s.c o m * @param doc * @param strTagName * @param strAttribute * @return */ public static Properties getPropertiesFromArrayList(ArrayList<String> al) { Properties pr = new Properties(); // cycles on all of them for (int i = 0; i < al.size(); i++) { pr.setProperty(al.get(i), ""); } return pr; }
From source file:cpcc.core.utils.PropertyUtils.java
/** * @param <T> generic type definition of values. * @param properties the {@code Properties} instance. * @param key the key of the property to set. * @param value the property value to set. *//*from www .java2 s . c o m*/ public static <T> void setProperty(Properties properties, String key, T value) { if (StringUtils.isNotBlank(key) && value != null) { properties.setProperty(key, value.toString()); } }
From source file:com.qspin.qtaste.util.PythonHelper.java
/** * Executes a python script, returning its output or not. * * @param fileName the filename of the python script to execute * @param redirectOutput true to redirect outputs and return them, false otherwise * @param arguments the arguments to pass to the python script * @return the output of the python script execution (combined standard and error outputs) or null if outputs were not * redirected/* w ww .ja va2 s. c o m*/ * @throws PyException in case of exception during Python script execution */ public static String execute(String fileName, boolean redirectOutput, String... arguments) throws PyException { Properties properties = new Properties(); properties.setProperty("python.home", StaticConfiguration.JYTHON_HOME); properties.setProperty("python.path", StaticConfiguration.FORMATTER_DIR); PythonInterpreter.initialize(System.getProperties(), properties, new String[] { "" }); try (PythonInterpreter interp = new PythonInterpreter(new org.python.core.PyStringMap(), new org.python.core.PySystemState())) { StringWriter output = null; if (redirectOutput) { output = new StringWriter(); interp.setOut(output); interp.setErr(output); } interp.cleanup(); interp.exec("import sys;sys.argv[1:]= [r'" + StringUtils.join(arguments, "','") + "']"); interp.exec("__name__ = '__main__'"); interp.exec("execfile(r'" + fileName + "')"); return redirectOutput ? output.toString() : null; } }
From source file:Main.java
/** * /* w ww.j a v a 2 s .c o m*/ */ protected static void decorateProperties(ThreadPoolExecutor executor, Properties properties) { if (executor != null) { if (properties != null) { properties.setProperty("thread-keep-alive-time", Long.toString(executor.getKeepAliveTime(TimeUnit.MILLISECONDS))); properties.setProperty("thread-pool-size-largest", Integer.toString(executor.getLargestPoolSize())); properties.setProperty("thread-pool-size-minimum", Integer.toString(executor.getCorePoolSize())); properties.setProperty("thread-pool-size-maximum", Integer.toString(executor.getMaximumPoolSize())); properties.setProperty("thread-pool-size", Integer.toString(executor.getPoolSize())); properties.setProperty("runnable-completed-count", Long.toString(executor.getCompletedTaskCount())); properties.setProperty("runnable-active-count", Integer.toString(executor.getActiveCount())); properties.setProperty("queue-size", Integer.toString(executor.getQueue().size())); properties.setProperty("queue-capacity-remaining", Integer.toString(executor.getQueue().remainingCapacity())); } } }