List of usage examples for java.util Properties keySet
@Override
public Set<Object> keySet()
From source file:com.thoughtworks.go.server.security.PasswordFileUserSearch.java
private List<User> findUserNameContaining(String searchText, Properties properties) { List<User> users = new ArrayList<User>(); for (Iterator iter = properties.keySet().iterator(); iter.hasNext();) { String username = (String) iter.next(); if (username.toLowerCase().contains(searchText.toLowerCase())) { users.add(new User(username)); }/* ww w .j av a 2s. c o m*/ } return users; }
From source file:org.apache.jackrabbit.j2ee.AbstractConfig.java
/** * Initializes the configuration with values from the given properties * @param props the configuration properties *///from w w w. j a va 2 s . c o m public void init(Properties props) throws ServletException { Iterator iter = props.keySet().iterator(); while (iter.hasNext()) { String name = (String) iter.next(); String mapName = toMapName(name, '.'); try { if (map.containsKey(mapName)) { map.put(mapName, props.getProperty(name)); } } catch (Exception e) { throw new ServletExceptionWithCause("Invalid configuration property: " + name, e); } } }
From source file:com.thoughtworks.go.server.security.providers.FileAuthenticationProvider.java
private Properties addDummyRoleToPropertiesIfRequired(Properties properties) { for (Object key : properties.keySet()) { String value = properties.getProperty(String.valueOf(key)); if (!value.contains(",")) { properties.setProperty(String.valueOf(key), value + ",ROLE_USER"); }//w ww.j a v a 2 s . co m } return properties; }
From source file:com.thoughtworks.go.server.security.providers.FileAuthenticationProvider.java
private Properties stripShaFromPasswordsIfRequired(Properties properties) { for (Object key : properties.keySet()) { String value = properties.getProperty(String.valueOf(key)); if (value.startsWith("{SHA}")) { properties.setProperty(String.valueOf(key), value.substring(5)); }/*from www.jav a 2s . co m*/ } return properties; }
From source file:com.telefonica.euro_iaas.commons.properties.impl.PropertiesDAOJPAImpl.java
/** * @see PropertiesDAO#store(Properties, String) *//*w w w .ja v a 2 s. com*/ public void store(Properties properties, String namespace) { for (Iterator i = properties.keySet().iterator(); i.hasNext();) { String key = (String) i.next(); String value = properties.getProperty(key); PersistentProperty propEntity = new PersistentProperty(); propEntity.setNamespace(namespace); propEntity.setKey(key); propEntity.setValue(value); entityManager.merge(propEntity); } }
From source file:nl.uva.sne.extractors.JtopiaExtractor.java
@Override public void configure(Properties prop) { for (Object k : prop.keySet()) { Logger.getLogger(JtopiaExtractor.class.getName()).log(Level.INFO, "{0} : {1}", new Object[] { k, prop.getProperty((String) k) }); }/*from w ww . jav a2 s.c o m*/ String taggerType = prop.getProperty("tagger.type", "stanford"); String modelPath = prop.getProperty("model.path", System.getProperty("user.home") + File.separator + "workspace" + File.separator + "TEXT2" + File.separator + "etc" + File.separator + "model"); if (modelPath.endsWith("/")) { modelPath = modelPath.substring(0, modelPath.length() - 1); } switch (taggerType) { case "stanford": Configuration.setModelFileLocation( modelPath + File.separator + "stanford" + File.separator + "english-left3words-distsim.tagger"); Configuration.setTaggerType("stanford"); break; case "openNLP": Configuration.setModelFileLocation( modelPath + File.separator + "openNLP" + File.separator + "en-pos-maxent.bin"); Configuration.setTaggerType("openNLP"); break; case "default": Configuration.setModelFileLocation( modelPath + File.separator + "default" + File.separator + "english-lexicon.txt"); Configuration.setTaggerType("default"); break; } Integer singleStrength = Integer.valueOf(prop.getProperty("single.strength", "3")); Configuration.setSingleStrength(singleStrength); Integer noLimitStrength = Integer.valueOf(prop.getProperty("no.limit.strength", "2")); Configuration.setNoLimitStrength(noLimitStrength); }
From source file:info.magnolia.content2bean.impl.PropertiesBasedTypeMapping.java
public PropertiesBasedTypeMapping() { Properties properties = SystemProperty.getProperties(); for (Iterator<Object> iterator = properties.keySet().iterator(); iterator.hasNext();) { String key = (String) iterator.next(); if (key.endsWith(".transformer")) { String className = StringUtils.removeEnd(key, ".transformer"); String transformerClassName = properties.getProperty(key); try { final ClassFactory cl = Classes.getClassFactory(); final Class<?> beanClass = cl.forName(className); final Class<Content2BeanTransformer> transformerClass = cl.forName(transformerClassName); // TODO - we can't instantiate the bastards here, unless we fetch them from IoC. final Content2BeanTransformer transformer = cl.newInstance(transformerClass); getTypeDescriptor(beanClass).setTransformer(transformer); log.debug("Registered custom transformer [{}] for [{}]", className, transformerClassName); } catch (Exception e) { log.error("Can't register custom transformer for [" + className + "]", e); }// w w w . j a va2 s .c o m } } }
From source file:fr.smartcontext.yatte.context.cli.properties.PropertiesContextInitializer.java
private Collection<String> searchVariableNames(Properties properties) { Collection<String> result = new ArrayList<>(); Set<Object> keySet = properties.keySet(); for (Object key : keySet) { if (key instanceof String) { String str = (String) key; if (str.endsWith(TYPE_SUFFIX)) { result.add(str.substring(0, str.length() - TYPE_SUFFIX.length())); }//from ww w. ja v a 2 s .co m } } return result; }
From source file:com.autentia.wuija.util.spring.SpringPropertiesHolder.java
@Override protected void processProperties(ConfigurableListableBeanFactory beanFactory, Properties props) { super.processProperties(beanFactory, props); propertiesMap = new HashMap<String, String>(); for (Object key : props.keySet()) { final String keyStr = key.toString(); final String value = props.getProperty(keyStr); propertiesMap.put(keyStr, value); LOG.trace("property found '{}={}'", keyStr, value); }/*from w w w .j a v a 2 s . c om*/ }
From source file:de.yaio.commons.config.Configuration.java
public void putProperties(final Properties props) { for (final Object prop : props.keySet()) { this.putProperty(new ConfigurationOption(prop.toString(), props.get(prop))); }//from ww w . j a va2s .c o m }