List of usage examples for java.util Properties keySet
@Override
public Set<Object> keySet()
From source file:com.kylinolap.rest.service.AdminService.java
/** * Get Java Env info as string//from w ww .j av a 2 s .c o m * * @return */ @PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN) public String getEnv() { logger.debug("Get Kylin Runtime environment"); PropertiesConfiguration tempConfig = new PropertiesConfiguration(); // Add Java Env try { String content = ""; ByteArrayOutputStream baos = new ByteArrayOutputStream(); // env Map<String, String> env = System.getenv(); for (String envName : env.keySet()) { tempConfig.addProperty(envName, env.get(envName)); } // properties Properties properteis = System.getProperties(); for (Object propName : properteis.keySet()) { tempConfig.setProperty((String) propName, properteis.get(propName)); } // do save tempConfig.save(baos); content = baos.toString(); return content; } catch (ConfigurationException e) { logger.debug("Failed to get Kylin Runtime env", e); throw new InternalErrorException("Failed to get Kylin env Config", e); } }
From source file:fr.aliasource.webmail.server.FrontEndConfig.java
private void loadIniFile(File f) { FileInputStream in = null;/* www . j a va2s . c o m*/ try { Properties p = new Properties(); in = new FileInputStream(f); p.load(in); for (Object key : p.keySet()) { values.put((String) key, p.getProperty((String) key)); } } catch (Exception e) { e.printStackTrace(); } finally { if (in != null) { try { in.close(); } catch (IOException e) { } } } }
From source file:com.googlecode.t7mp.steps.CopyUserConfigStep.java
private void mergeProperties(Properties target, Properties source, Collection<String> excludes) { for (Object key : source.keySet()) { if (!excludes.contains(key)) { target.setProperty((String) key, (String) source.get(key)); } else {//w w w . ja v a 2 s . c o m log.debug("Skip property " + key + " from user catalina.properties"); } } }
From source file:org.opencron.common.utils.PropertyPlaceholder.java
@Override protected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, Properties props) throws BeansException { super.processProperties(beanFactoryToProcess, props); for (Object key : props.keySet()) { String keyStr = key.toString(); String value = props.getProperty(keyStr); properties.put(keyStr, value);//from w w w.j a v a 2s . c o m } }
From source file:fr.aliasource.utils.IniFile.java
private void loadIniFile(File f) { FileInputStream in = null;/*from w w w . ja va 2 s . co m*/ try { Properties p = new Properties(); in = new FileInputStream(f); p.load(in); for (Object key : p.keySet()) { settings.put((String) key, p.getProperty((String) key)); } } catch (Exception e) { logger.error(e.getMessage(), e); } finally { if (in != null) { try { in.close(); } catch (IOException e) { } } } }
From source file:fr.smartcontext.yatte.context.cli.properties.PropertiesContextInitializer.java
private Collection<String> searchFeatureForVariable(Properties properties, String varName) { Collection<String> result = new ArrayList<>(); Set<Object> keySet = properties.keySet(); for (Object key : keySet) { if (key instanceof String) { String str = (String) key; if (str.startsWith(varName + DOT) && !str.equals(varName + TYPE_SUFFIX)) { result.add(str.substring((varName + DOT).length(), str.length())); }/* w w w. j ava 2s .c o m*/ } } return result; }
From source file:ar.com.zauber.commons.spring.exceptions.StatusSimpleMappingExceptionHandler.java
/** * Sets the Status mappings (for each view name, it determines an http error * code). The key are the view names (Strings) and the values must be * integers/* w w w . j ava 2 s .com*/ */ public final void setStatusMappings(final Properties values) { if (values != null) { // fail fast if the configuration is wrong for (Object k : values.keySet()) { if (k instanceof String) { final Object v = values.get(k); Integer value = null; if (v instanceof String) { value = Integer.parseInt((String) v); } else if (v instanceof Number) { value = ((Number) v).intValue(); } else { throw new IllegalArgumentException("values must be integers"); } Validate.notNull(value, "null status for " + k); statusMappings.put((String) k, value); } else { throw new IllegalArgumentException("keys are view names, " + "and view names must be strings"); } } } }
From source file:org.dkpro.lab.engine.impl.DefaultTaskExecutionService.java
@SuppressWarnings("unchecked") public void setMappingDescriptors(Resource[] aResources) throws ClassNotFoundException, IOException { final ClassLoader cl = getClass().getClassLoader(); for (final Resource res : aResources) { final Properties props = new Properties(); props.load(res.getInputStream()); for (final Object key : props.keySet()) { final String taskClass = (String) key; final String engineClass = props.getProperty(taskClass); map.put((Class<? extends Task>) Class.forName(taskClass, true, cl), (Class<? extends TaskExecutionEngine>) Class.forName(engineClass, true, cl)); }/*from w w w. j av a2s .com*/ } }
From source file:org.powertac.util.PropertiesUtil.java
@Override protected void processProperties(ConfigurableListableBeanFactory beanFactory, Properties props) throws BeansException { super.processProperties(beanFactory, props); propertiesMap = new HashMap<String, String>(); for (Object key : props.keySet()) { String keyStr = key.toString(); propertiesMap.put(keyStr, resolvePlaceholder(props.getProperty(keyStr), props)); }/*from w w w .ja v a 2s. c om*/ }
From source file:net.bubble.common.utils.PropertiesUtil.java
@Override protected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, Properties props) throws BeansException { contextProperties = new HashMap<String, String>(); for (Object key : props.keySet()) { if (logger.isDebugEnabled()) { logger.debug("load property content: {}={}", String.valueOf(key), props.get(String.valueOf(key))); }/*from w w w . ja va 2 s. c om*/ contextProperties.put(String.valueOf(key), String.valueOf(props.get(String.valueOf(key)))); } super.processProperties(beanFactoryToProcess, props); }