List of usage examples for java.util Properties stringPropertyNames
public Set<String> stringPropertyNames()
From source file:com.joliciel.talismane.utils.StringUtils.java
/** * Get a map of strings from Properties. *//*from w w w .ja v a 2 s. c o m*/ public static Map<String, String> getArgMap(Properties props) { Map<String, String> argMap = new HashMap<String, String>(); for (String propertyName : props.stringPropertyNames()) { argMap.put(propertyName, props.getProperty(propertyName)); } return argMap; }
From source file:org.dcm4che3.tool.ianscp.IanSCP.java
private static void configureTransferCapability(ApplicationEntity ae, CommandLine cl) throws IOException { Properties p = CLIUtils.loadProperties(cl.getOptionValue("sop-classes", "resource:sop-classes.properties"), null);//from ww w . j av a 2s . c o m for (String cuid : p.stringPropertyNames()) { String ts = p.getProperty(cuid); ae.addTransferCapability(new TransferCapability(null, CLIUtils.toUID(cuid), TransferCapability.Role.SCP, CLIUtils.toUIDs(ts))); } }
From source file:org.wso2.carbon.identity.core.util.IdentityLogTokenParser.java
private static void buildConfiguration() { if (filePath == null) { filePath = CarbonUtils.getCarbonSecurityConfigDirPath() + File.separator + IdentityConstants.IdentityTokens.FILE_NAME; }//from w ww.j a v a2s . co m FileInputStream fileInput = null; try { File file = new File(filePath); fileInput = new FileInputStream(file); Properties properties = new Properties(); properties.load(fileInput); for (String propertyName : properties.stringPropertyNames()) { logTokenMap.put(propertyName, properties.getProperty(propertyName)); } } catch (IOException e) { log.error("An error occur while reading the file", e); } finally { try { if (fileInput != null) { fileInput.close(); } } catch (IOException e) { log.error("Error while closing the file", e); } } }
From source file:org.candlepin.client.cmds.Utils.java
public static Map<String, String> getHardwareFacts() { Map<String, String> facts = new HashMap<String, String>(); // TODO: Just using system properties for now Properties properties = System.getProperties(); for (String property : properties.stringPropertyNames()) { facts.put(property, properties.getProperty(property)); }// w w w . java2 s. com // get rid of a few attributes facts.remove("java.class.path"); facts.remove("java.io.tmpdir"); facts.remove("file.separator"); facts.remove("java.endorsed.dirs"); facts.remove("user.name"); facts.remove("path.separator"); facts.remove("line.separator"); facts.remove("sun.boot.library.path"); facts.remove("java.library.path"); facts.remove("java.ext.dirs"); facts.remove("sun.boot.class.path"); facts.remove("user.dir"); return facts; }
From source file:net.ontopia.utils.PropertyUtils.java
public static Map<String, String> toMap(Properties properties) { Map<String, String> result = new HashMap<String, String>(properties.size()); for (String key : properties.stringPropertyNames()) { result.put(key, properties.getProperty(key)); }//from ww w.j a va2 s .com return result; }
From source file:Main.java
public static void loadHashMapData() throws IOException { HashMap<String, String> hashMap = new HashMap<String, String>(); Properties properties = new Properties(); File file = new File(HASHMAPFILEPATH); if (file.exists()) { properties.load(new FileInputStream(HASHMAPFILEPATH)); for (String key : properties.stringPropertyNames()) { hashMap.put(key, properties.getProperty(key)); GPSDataMap = hashMap;/*from www. j av a 2 s . com*/ } } else { file.createNewFile(); } }
From source file:com.izforge.izpack.util.LogUtils.java
private static void mergeLoggingConfiguration(Properties to, Properties from) { for (String fromName : from.stringPropertyNames()) { String fromValue = from.getProperty(fromName); if (fromName.matches("\\.?handlers") && to.containsKey(fromName)) { String oldValue = to.getProperty(fromName); if (!fromValue.equals(oldValue)) { to.setProperty(fromName, oldValue + ", " + fromValue); }//from ww w . j av a 2 s . c om continue; } if (!to.containsKey(fromName)) { to.setProperty(fromName, fromValue); } } }
From source file:com.joliciel.talismane.utils.StringUtils.java
/** * Get a map of strings from Properties, for any properties beginning with a certain prefix. * The prefix will be removed from the property keys. *//*from ww w .ja va 2 s .c o m*/ public static Map<String, String> getArgMap(Properties props, String prefix) { Map<String, String> argMap = new HashMap<String, String>(); for (String propertyName : props.stringPropertyNames()) { if (propertyName.startsWith(prefix)) argMap.put(propertyName.substring(prefix.length()), props.getProperty(propertyName)); } return argMap; }
From source file:com.jkoolcloud.tnt4j.streams.utils.StreamsScriptingUtils.java
/** * Initiates default set of Java API imported packages. *//*from w w w .j av a 2 s . c o m*/ private static void initDefaultImportPackages() { try { Properties p = Utils.loadPropertiesResources("scripting.properties"); // NON-NLS for (String pName : p.stringPropertyNames()) { if (pName.endsWith(".scripting.import.packages")) { // NON-NLS String importPackages = p.getProperty(pName); if (StringUtils.isNotEmpty(importPackages)) { String[] pArray = importPackages.split(";"); Collections.addAll(DEFAULT_IMPORT_PACKAGES, pArray); } } } } catch (Exception exc) { } }
From source file:org.apache.blur.console.util.Config.java
private static void setDevelopmentProperties() { Properties properties = System.getProperties(); for (String name : properties.stringPropertyNames()) { if (name.startsWith("blur.")) { blurConfig.set(name, properties.getProperty(name)); }/*from ww w. j av a 2 s .co m*/ } }