List of usage examples for java.util Properties keySet
@Override
public Set<Object> keySet()
From source file:com.adaptris.core.http.JdkHttpProducer.java
private void addHeaders(AdaptrisMessage msg, URLConnection c) { Properties p = getAdditionalHeaders(msg); for (Iterator i = p.keySet().iterator(); i.hasNext();) { String key = (String) i.next(); c.addRequestProperty(key, p.getProperty(key)); }/*from w ww.j a va 2 s . co m*/ // Bug#2555 // for (String key : p.stringPropertyNames()) { // c.addRequestProperty(key, p.getProperty(key)); // } }
From source file:com.adaptris.core.management.BootstrapProperties.java
public String[] getConfigurationUrls() { List<String> list = new ArrayList<String>(); Properties p = getPropertySubset(this, CFG_KEY_CONFIG_URL, true); Object[] urlKeys = p.keySet().toArray(); Arrays.sort(urlKeys);/*from w w w . j a v a 2s . co m*/ for (int i = 0; i < urlKeys.length; i++) { String url = p.getProperty(urlKeys[i].toString()); list.add(url); } if (DBG) { log.trace("Configuration URLS [{}]", list); } return list.toArray(new String[0]); }
From source file:com.bluexml.side.Integration.alfresco.sql.synchronization.dictionary.PropertyFileDatabaseDictionary.java
private void _loadResource(Resource r) { Properties properties = new Properties(); try {//from w ww. j a v a 2s . c o m properties.load(r.getInputStream()); } catch (IOException e) { logger.error(e); } for (Object property : properties.keySet()) { String key = (String) property; String value = (String) properties.getProperty(key); _dictionary.put(key, value); } }
From source file:org.apache.falcon.oozie.process.ProcessExecutionWorkflowBuilder.java
protected void addInputFeedsAsParams(List<String> paramList, Cluster cluster) throws FalconException { if (entity.getInputs() == null) { return;/*from w w w .ja va2s. c o m*/ } for (Input input : entity.getInputs().getInputs()) { Feed feed = EntityUtil.getEntity(EntityType.FEED, input.getFeed()); Storage storage = FeedHelper.createStorage(cluster, feed); final String inputName = input.getName(); if (storage.getType() == Storage.TYPE.FILESYSTEM) { paramList.add(inputName + "=${" + inputName + "}"); // no prefix for backwards compatibility } else if (storage.getType() == Storage.TYPE.TABLE) { final String paramName = "falcon_" + inputName; // prefix 'falcon' for new params Properties props = new Properties(); propagateCommonCatalogTableProperties((CatalogStorage) storage, props, paramName); for (Object key : props.keySet()) { paramList.add(key + "=${wf:conf('" + key + "')}"); } paramList.add(paramName + "_filter=${wf:conf('" + paramName + "_partition_filter_" + entity.getWorkflow().getEngine().name().toLowerCase() + "')}"); } } }
From source file:fr.fastconnect.factory.tibco.bw.maven.run.LaunchDesignerMojo.java
private void updateAliasesFile() throws IOException { File aliasesFile = getAliasesFile(); File designer5Prefs = getDesigner5Prefs(); Properties prefs = new SortedProperties(); FileInputStream fisPrefs = new FileInputStream(designer5Prefs); prefs.load(fisPrefs);/*from ww w. ja v a 2 s . c om*/ fisPrefs.close(); Integer maxFileAliasPref = 0; for (Object k : prefs.keySet()) { String key = (String) k; if (key.startsWith(FILE_ALIAS_PREFIX)) { maxFileAliasPref++; } } Properties aliases = new Properties(); FileInputStream fis = new FileInputStream(aliasesFile); aliases.load(fis); fis.close(); String projectVersion = getProject().getVersion(); Properties duplicates = new Properties(); for (Object k : aliases.keySet()) { String key = (String) k; String value = aliases.getProperty(key); if (key.contains(projectVersion) && key.endsWith(":jar")) { getLog().debug(key); key = key.replace(projectVersion, "${project.version}"); duplicates.put(key, value); } } if (!duplicates.isEmpty()) { for (Object k : duplicates.keySet()) { String key = (String) k; String value = duplicates.getProperty(key); key = key.replace(TIBCO_ALIAS_PREFIX, ""); prefs.put(FILE_ALIAS_PREFIX + maxFileAliasPref.toString(), key + "=" + value); maxFileAliasPref++; } FileOutputStream fosPrefs = new FileOutputStream(designer5Prefs); prefs.store(fosPrefs, ""); fis.close(); aliases.putAll(duplicates); FileOutputStream fos = new FileOutputStream(aliasesFile); aliases.store(fos, ""); fis.close(); } }
From source file:com.glaf.jbpm.connection.HikariCPConnectionProvider.java
public void configure(Properties props) throws RuntimeException { Properties properties = new Properties(); properties.putAll(props);/*from w ww. ja va2 s . co m*/ for (Iterator<?> ii = props.keySet().iterator(); ii.hasNext();) { String key = (String) ii.next(); if (key.startsWith("hikari.")) { String newKey = key.substring(7); properties.put(newKey, props.get(key)); } } String jdbcDriverClass = properties.getProperty(Environment.DRIVER); String jdbcUrl = properties.getProperty(Environment.URL); Properties connectionProps = ConnectionProviderFactory.getConnectionProperties(properties); log.info("HikariCP using driver: " + jdbcDriverClass + " at URL: " + jdbcUrl); log.info("Connection properties: " + PropertiesHelper.maskOut(connectionProps, Environment.PASS)); autocommit = PropertiesHelper.getBoolean(Environment.AUTOCOMMIT, props); log.info("autocommit mode: " + autocommit); if (jdbcDriverClass == null) { log.warn("No JDBC Driver class was specified by property " + Environment.DRIVER); } else { try { Class.forName(jdbcDriverClass); } catch (ClassNotFoundException cnfe) { try { ClassUtils.classForName(jdbcDriverClass); } catch (Exception e) { String msg = "JDBC Driver class not found: " + jdbcDriverClass; log.error(msg, e); throw new RuntimeException(msg, e); } } } try { String validationQuery = properties.getProperty(ConnectionConstants.PROP_VALIDATIONQUERY); Integer initialPoolSize = PropertiesHelper.getInteger(ConnectionConstants.PROP_INITIALSIZE, properties); Integer minPoolSize = PropertiesHelper.getInteger(ConnectionConstants.PROP_MINACTIVE, properties); Integer maxPoolSize = PropertiesHelper.getInteger(ConnectionConstants.PROP_MAXACTIVE, properties); if (initialPoolSize == null && minPoolSize != null) { properties.put(ConnectionConstants.PROP_INITIALSIZE, String.valueOf(minPoolSize).trim()); } Integer maxWait = PropertiesHelper.getInteger(ConnectionConstants.PROP_MAXWAIT, properties); if (maxPoolSize == null) { maxPoolSize = 50; } String dbUser = properties.getProperty(Environment.USER); String dbPassword = properties.getProperty(Environment.PASS); if (dbUser == null) { dbUser = ""; } if (dbPassword == null) { dbPassword = ""; } HikariConfig config = new HikariConfig(); config.setDriverClassName(jdbcDriverClass); config.setJdbcUrl(jdbcUrl); config.setUsername(dbUser); config.setPassword(dbPassword); config.setMaximumPoolSize(maxPoolSize); config.setDataSourceProperties(properties); if (StringUtils.isNotEmpty(validationQuery)) { config.setConnectionTestQuery(validationQuery); } if (maxWait != null) { config.setConnectionTimeout(maxWait * 1000L); } config.setMaxLifetime(1000L * 3600 * 8); String isolationLevel = properties.getProperty(Environment.ISOLATION); if (isolationLevel == null) { isolation = null; } else { isolation = new Integer(isolationLevel); log.info("JDBC isolation level: " + Environment.isolationLevelToString(isolation.intValue())); } if (StringUtils.isNotEmpty(isolationLevel)) { config.setTransactionIsolation(isolationLevel); } ds = new HikariDataSource(config); } catch (Exception ex) { ex.printStackTrace(); log.error("could not instantiate HikariCP connection pool", ex); throw new RuntimeException("Could not instantiate HikariCP connection pool", ex); } }
From source file:org.apache.ace.agent.launcher.Launcher.java
private void propagateConfiguration(Properties properties, Map<String, String> config) { if (properties == null) { return;// w w w . j a v a 2 s.c o m } for (Object _key : properties.keySet()) { String key = (String) _key; String value = properties.getProperty(key); if (key.startsWith(SYSTEM_PREFIX)) { System.setProperty(key.substring(SYSTEM_PREFIX.length()), value); } else if (key.startsWith(FRAMEWORK_PREFIX)) { // Strip off the framework prefix, as we pass all configuration options as fw property... config.put(key.substring(FRAMEWORK_PREFIX.length()), value); } else { config.put(key, value); } } }
From source file:gov.nasa.ensemble.common.CommonPlugin.java
/** * Initialize Ensemble with the ensemble properties file. This method will * attempt to find the properties file in the following manner: * // w w w .j a va2 s . c o m * 1. Search for the system property "ensemble.properties.file". If this * property is defined, then use the property's value to find the properties * file. * * 2. Search for the extension point * gov.nasa.ensemble.core.rcp.EnsemblePropertiesProvider. If one and only * one of these extension points are defined, then use it to create an * EnsemblePropertiesProvider class and then ask this class for the * properties file location. * * 3. If neither of these options provide a properties file location, then * return an empty properties object. Else read in the properties file to a * properties object and return it. In addition, populate the System * properties with all the Ensemble properties. * * 4. If there are any registered implementations of IEnsemblePropertiesPatch, * load their properties on top of the properties assembled thus far. * */ private Properties initializeEnsembleProperties() { final Properties props = basicInitializeEnsembleProperties(); ensemblePropertiesDefinedInFile = new ArrayList(props.keySet()); TreeSet<EnsemblePropertiesPatch> patchers = new TreeSet<EnsemblePropertiesPatch>( ClassRegistry.createInstances(EnsemblePropertiesPatch.class)); for (EnsemblePropertiesPatch patch : patchers) props.putAll(patch.getPatchedProperties(props)); // MAE-5459, -D<property>=<value> should override ensemble.properties props.putAll(System.getProperties()); // add the ensemble properties to the System properties for (Object obj : props.keySet()) { String key = (String) obj; // Don't patch in empty keys if (key.isEmpty()) continue; System.setProperty(key, props.getProperty(key)); } return props; }
From source file:eu.europa.ejusticeportal.dss.demo.web.portal.PortalFacadeImpl.java
@Override public Map<String, String> getLocalisedMessages(HttpServletRequest request, List<String> codes) { HashMap<String, String> map = new HashMap<String, String>(); Properties p = new Properties(); InputStream is = PortalFacadeImpl.class.getClassLoader().getResourceAsStream("i18n/messages_en.xml"); try {//from ww w .j a v a 2 s . c o m p.loadFromXML(is); for (Object o : p.keySet()) { map.put((String) o, messageSource.getMessage((String) o, null, request.getLocale())); } } catch (Exception e) { LOG.error("Error getting messages", e); } return map; }
From source file:net.sourceforge.jabm.VariableBindingsIterator.java
@SuppressWarnings("rawtypes") public void parseVarFile(String varFile) throws IOException { Properties properties = new Properties(); variableRanges = new HashMap<String, VariableRange>(); properties.load(new FileInputStream(varFile)); for (Object variable : properties.keySet()) { Class type = getType(variable.toString()); VariableRange range = parseVariableRange(properties.get(variable).toString(), type); logger.debug("range = " + range); variableRanges.put(variable.toString(), range); }/* w ww .jav a 2 s .c om*/ variables = new ArrayList<String>(variableRanges.keySet()); }