List of usage examples for java.util Properties putAll
@Override public synchronized void putAll(Map<?, ?> t)
From source file:org.apache.zeppelin.interpreter.SessionConfInterpreter.java
@Override public InterpreterResult interpret(String st, InterpreterContext context) throws InterpreterException { try {/*from w ww. j a v a 2s .c o m*/ Properties finalProperties = new Properties(); finalProperties.putAll(this.properties); Properties updatedProperties = new Properties(); updatedProperties.load(new StringReader(st)); finalProperties.putAll(updatedProperties); LOGGER.debug("Properties for Session: " + sessionId + ": " + finalProperties); List<Interpreter> interpreters = interpreterSetting.getInterpreterGroup(interpreterGroupId) .get(sessionId); for (Interpreter intp : interpreters) { // only check the RemoteInterpreter, ConfInterpreter itself will be ignored here. if (intp instanceof RemoteInterpreter) { RemoteInterpreter remoteInterpreter = (RemoteInterpreter) intp; if (remoteInterpreter.isOpened()) { return new InterpreterResult(InterpreterResult.Code.ERROR, "Can not change interpreter session properties after this session is started"); } remoteInterpreter.setProperties(finalProperties); } } return new InterpreterResult(InterpreterResult.Code.SUCCESS); } catch (IOException e) { LOGGER.error("Fail to update interpreter setting", e); return new InterpreterResult(InterpreterResult.Code.ERROR, ExceptionUtils.getStackTrace(e)); } }
From source file:sk.lazyman.gizmo.SpringApplicationContextTest.java
private void createSQLSchema(String fileName) throws Exception { org.hibernate.cfg.Configuration configuration = new Configuration(); Properties properties = new Properties(); properties.putAll(sessionFactoryBean.getJpaPropertyMap()); configuration.setProperties(properties); configuration.setNamingStrategy(new GizmoNamingStrategy()); System.out.println("Dialect: " + properties.getProperty("hibernate.dialect")); addAnnotatedClasses("sk.lazyman.gizmo.data", configuration); SchemaExport export = new SchemaExport(configuration); export.setOutputFile(fileName);//w ww .jav a 2 s .c o m export.setDelimiter(";"); export.execute(true, false, false, true); }
From source file:org.apache.zeppelin.interpreter.ConfInterpreter.java
@Override public InterpreterResult interpret(String st, InterpreterContext context) throws InterpreterException { try {// w ww. j a v a 2 s .c o m Properties finalProperties = new Properties(); finalProperties.putAll(getProperties()); Properties newProperties = new Properties(); newProperties.load(new StringReader(st)); finalProperties.putAll(newProperties); LOGGER.debug("Properties for InterpreterGroup: " + interpreterGroupId + " is " + finalProperties); interpreterSetting.setInterpreterGroupProperties(interpreterGroupId, finalProperties); return new InterpreterResult(InterpreterResult.Code.SUCCESS); } catch (IOException e) { LOGGER.error("Fail to update interpreter setting", e); return new InterpreterResult(InterpreterResult.Code.ERROR, ExceptionUtils.getStackTrace(e)); } }
From source file:org.ajax4jsf.cache.OSCacheCacheFactory.java
public Cache createCache(Map env, CacheLoader cacheLoader, CacheConfigurationLoader cacheConfigurationloader) throws CacheException { // Load our implementation properties Properties cacheProperties = cacheConfigurationloader.loadProperties("oscache.properties"); cacheProperties.putAll(cacheConfigurationloader.loadProperties("/oscache.properties")); cacheProperties.putAll(env);/* ww w .j a v a 2 s . co m*/ log.info("Creating OSCache cache instance using parameters: " + cacheProperties); GeneralCacheAdministrator cacheAdministrator = new GeneralCacheAdministrator(cacheProperties); return new OSCacheCache(cacheAdministrator.getCache(), cacheLoader); }
From source file:ezbakehelpers.ezconfigurationhelpers.postgres.PostgresConfigurationHelper.java
public Connection getEzPostgresConnection(EzSecurityToken token) throws SQLException, TException { String appName = ezProperties.getProperty(EzBakePropertyConstants.EZBAKE_APPLICATION_NAME); Properties dbProperties = new Properties(); dbProperties.putAll(ezProperties); dbProperties.put("user", ezProperties.getProperty(EzBakePropertyConstants.POSTGRES_USERNAME, appName)); dbProperties.put("password", ezProperties.getProperty(EzBakePropertyConstants.POSTGRES_PASSWORD, appName)); if (useSSL()) { dbProperties.put("ssl", "true"); dbProperties.put("sslfactory", "org.postgresql.ssl.NonValidatingFactory"); }/*from ww w. j a v a 2s .c om*/ if (token != null) { dbProperties.put("ezbakeTokenProvider", "ezbake.data.postgres.ExplicitTokenProvider"); dbProperties.put("ezbakeToken", new String(Base64.encodeBase64(new TSerializer().serialize(token)), Charsets.US_ASCII)); } return DriverManager.getConnection(String.format("jdbc:ezbake:postgresql://%s:%s/%s", ezProperties.getProperty(EzBakePropertyConstants.POSTGRES_HOST, "localhost"), ezProperties.getProperty(EzBakePropertyConstants.POSTGRES_PORT, "5432"), ezProperties.getProperty(EzBakePropertyConstants.POSTGRES_DB, appName)), dbProperties); }
From source file:com.seajas.search.utilities.spring.CatalinaContextPropertiesPersister.java
/** * Override XML loading so to inject all Catalina context properties. * // w w w . j a v a 2 s. c o m * @param props * @param is */ @Override public void loadFromXml(final Properties props, final InputStream is) { props.putAll(retrieveContextProperties(is)); }
From source file:br.edu.ufcg.lsd.commune.context.PropertiesFileParser.java
private Map<Object, Object> getDefaultProperties(File propertiesFile) { Properties properties = new Properties(); properties.putAll(new DefaultContextFactory().getDefaultProperties()); try {//from w w w .ja v a 2 s. co m FileUtils.touch(propertiesFile); FileOutputStream fileOutputStream = new FileOutputStream(propertiesFile); properties.store(fileOutputStream, null); fileOutputStream.close(); } catch (Exception e) { e.printStackTrace(); throw new CommuneRuntimeException("File could not be created: " + fileName); } return properties; }
From source file:net.xy.jcms.controller.configurations.AbstractPropertyBasedConfiguration.java
/** * merges two pproperties/*from w w w .j a va 2 s .com*/ * * @param config1 * @param config2 * @return */ protected Properties mergeConfiguration(final Properties config1, final Properties config2) { final Properties result = new Properties(); result.putAll(config1); result.putAll(config2); return result; }
From source file:net.dempsy.distconfig.apahcevfs.ApacheVfsPropertiesStore.java
@Override public int merge(final Properties props) throws IOException { return mapChecked(() -> { final FileObject latest = getLatest(parentDirObj); if (latest == null) return push(props); final Properties oldProps = read(latest); final Properties newProps = new Properties(); newProps.putAll(oldProps); newProps.putAll(props);/* w w w . j av a 2s . com*/ final FileObject next = nextFile(latest, parentDirObj); try (OutputStream os = next.getContent().getOutputStream()) { newProps.store(os, COMMENT); } return new Integer(getVersion(next)); }, em).intValue(); }
From source file:net.dempsy.distconfig.apahcevfs.ApacheVfsPropertiesStore.java
@Override public int clear(final String... props) throws IOException { return mapChecked(() -> { final FileObject latest = getLatest(parentDirObj); if (latest == null) return -1; final Properties oldProps = read(latest); final Properties newProps = new Properties(); newProps.putAll(oldProps); Arrays.stream(props).forEach(newProps::remove); final FileObject next = nextFile(latest, parentDirObj); try (OutputStream os = next.getContent().getOutputStream()) { newProps.store(os, COMMENT); }/* w ww. ja v a 2 s. c o m*/ return new Integer(getVersion(next)); }, em).intValue(); }