List of usage examples for java.util Properties keySet
@Override
public Set<Object> keySet()
From source file:org.apache.stratos.manager.client.CloudControllerServiceClient.java
@SuppressWarnings("unused") private Properties extractProperties(java.util.Properties properties) { Properties props = new Properties(); if (properties != null) { for (Iterator<Object> iterator = properties.keySet().iterator(); iterator.hasNext();) { String key = (String) iterator.next(); String value = properties.getProperty(key); Property prop = new Property(); prop.setName(key);//from w ww . j av a 2 s . c o m prop.setValue(value); props.addProperties(prop); } } return props; }
From source file:com.twinsoft.convertigo.engine.EnginePropertiesManager.java
public static void copySystemProperties() { if (system_properties == null) { Properties sys_prop = System.getProperties(); system_properties = new Properties(); for (String name : GenericUtils.<Collection<String>>cast(sys_prop.keySet())) { if (name.startsWith("convertigo.")) { system_properties.setProperty(name, sys_prop.getProperty(name)); }//from ww w .j a v a 2 s . c o m } } }
From source file:org.springmodules.cache.interceptor.caching.AbstractCachingInterceptor.java
private Map propertiesToModels() { PropertyEditor editor = cache.getCachingModelEditor(); Properties properties = (Properties) modelMap; Map m = new HashMap(); for (Iterator i = properties.keySet().iterator(); i.hasNext();) { String id = (String) i.next(); editor.setAsText(properties.getProperty(id)); m.put(id, editor.getValue());/*from w w w . j a v a 2 s . c o m*/ } return m; }
From source file:com.mirth.connect.server.migration.Migrate2_0_0.java
private void migrateServerProperties() throws MigrationException { /*/* w w w.j a v a 2 s .c om*/ * Since we moved the server properties from a file to the database, we need * to copy over the previous properties into the database if a file exists */ File propertiesFile = new File(getBaseDir() + IOUtils.DIR_SEPARATOR + "server.properties"); if (propertiesFile.exists()) { try { Properties serverProperties = new Properties(); serverProperties.load(new FileInputStream(propertiesFile)); for (Object name : serverProperties.keySet()) { updateServerProperty((String) name, serverProperties.getProperty((String) name)); } if (!propertiesFile.delete()) { logger.error("Could not delete existing server.properties file. Please delete it manually."); } } catch (FileNotFoundException e) { logger.error("Error loading existing server.properties file.", e); } catch (IOException e) { logger.error("Error loading existing server.properties file.", e); } } }
From source file:com.jdom.word.playdough.model.GamePackPlayerSerializerImpl.java
public Jumble deserialize(Properties properties, Jumble jumble) { Map<String, Set<String>> wordsFoundMap = new HashMap<String, Set<String>>(); Map<String, Integer> scoreMap = new HashMap<String, Integer>(); for (Object obj : properties.keySet()) { String key = (String) obj; if (key.endsWith(FOUND_WORDS_SUFFIX)) { String word = key.replaceAll(FOUND_WORDS_SUFFIX, ""); Set<String> values = PropertiesUtil.getPropertyAsSet(properties, key); wordsFoundMap.put(word, values); }// www. j a va 2 s . c o m if (key.endsWith(SCORE_SUFFIX)) { String word = key.replaceAll(SCORE_SUFFIX, ""); int score = PropertiesUtil.getInteger(properties, key); scoreMap.put(word, score); } } jumble = new Jumble(jumble.getGamePackName(), jumble.getGamePack(), "testUser", jumble.getServerCommunicationManager()); jumble.wordsFoundMap = wordsFoundMap; jumble.scoreMap = scoreMap; String currentWord = properties.getProperty(CURRENT_WORD); do { jumble.setupNextWord(); } while (!currentWord.equals(jumble.getSourceWord())); return jumble; }
From source file:org.apache.falcon.util.StateStoreProperties.java
private void loadCredentials(InputStream resourceAsStream) throws IOException { Properties origProps = new Properties(); origProps.load(resourceAsStream);// w ww .j av a2s .co m LOG.info("Initializing {} properties with domain {}", this.getClass().getName(), domain); Set<String> keys = getKeys(origProps.keySet()); for (String key : keys) { String value = origProps.getProperty(domain + "." + key, origProps.getProperty("*." + key)); if (value != null) { value = ExpressionHelper.substitute(value); LOG.debug("{}={}", key, value); put(key, value); } } }
From source file:com.qualogy.qafe.bind.core.application.ApplicationStack.java
private void loadFromPropertiesFile(File externalPropertiesFile) throws IOException, FileNotFoundException { Properties p = new Properties(); p.load(new FileInputStream(externalPropertiesFile)); Iterator<Object> itr = p.keySet().iterator(); while (itr.hasNext()) { Object o = itr.next();/*from w w w .j a v a 2s . com*/ getGlobalConfiguration().put(o.toString(), p.getProperty(o.toString())); } }
From source file:eu.eidas.config.impl.FileEidasNodeConfiguration.java
private void loadParametersMap(Properties properties, EIDASNodeConfFile sourceFile) { Iterator iterator = properties.keySet().iterator(); while (iterator.hasNext()) { EIDASNodeParameter p = new EIDASNodeParameter(); p.setName(iterator.next().toString()); p.setValue(properties.getProperty(p.getName())); EIDASParameterMetaImpl metadata = (EIDASParameterMetaImpl) metadataProvider.getMetadata(p.getName()); if (metadata == null) { metadata = new EIDASParameterMetaImpl(); metadata.setName(p.getName()); metadataProvider.addMetadata(p.getName(), metadata); }/*www. j a v a 2 s .c o m*/ metadata.setSourceFile(sourceFile); p.setMetadata(metadata); parameters.put(p.getName(), p); } }
From source file:de.micromata.genome.util.runtime.StdLocalSettingsLoader.java
protected void loadDefaultProperties(LocalSettings ls) { try {//from w ww . ja va2 s .c o m Enumeration<URL> res = getClass().getClassLoader().getResources("local-settings-defaults.properties"); while (res.hasMoreElements()) { URL fs = res.nextElement(); try (InputStream is = fs.openStream()) { Properties p = new Properties(); p.load(is); for (Object k : p.keySet()) { String key = (String) k; if (ls.getMap().containsKey(key) == true) { continue; } String v = p.getProperty((String) k); ls.getMap().put(key, v); } } } } catch (IOException ex) { throw new RuntimeIOException(ex); } }
From source file:org.biopax.psidev.ontology_manager.impl.OntologyManagerImpl.java
public void loadOntologies(Properties config) throws OntologyLoaderException { if (config != null && !config.isEmpty()) { for (Object ontId : config.keySet()) { String key = (String) ontId; try { URI uri = LOADER.getResource(config.getProperty(key)).getURI(); log.info("Loading ontology: ID= " + ontId + ", uri=" + uri); OntologyAccess oa = fetchOntology(key, "OBO", uri); putOntology(key, oa);/*w w w .j a va2 s . com*/ } catch (Throwable e) { //using Throwable because StackOverflowError is also possible here throw new OntologyLoaderException( "Failed loading/parsing ontology " + key + " from " + config.getProperty(key), e); } } } else { throw new OntologyLoaderException("OntologyAccess configuration map is missing or empty (map)!"); } }