List of usage examples for java.util Properties stringPropertyNames
public Set<String> stringPropertyNames()
From source file:com.tesora.dve.common.PEUrl.java
public PEUrl setQueryOptions(Properties props) { for (String key : props.stringPropertyNames()) { setQueryOption(key, props.getProperty(key)); }/* w w w . j a va 2 s . c o m*/ return this; }
From source file:org.apache.qpid.server.security.group.FileGroupDatabase.java
private synchronized void readGroupFile(String groupFile) throws IOException { _groupFile = groupFile;//from ww w.j av a2s .c o m _groupToUserMap.clear(); _userToGroupMap.clear(); Properties propertiesFile = new Properties(); FileInputStream fileInputStream = new FileInputStream(groupFile); try { propertiesFile.load(fileInputStream); } finally { if (fileInputStream != null) { fileInputStream.close(); } } for (String propertyName : propertiesFile.stringPropertyNames()) { validatePropertyNameIsGroupName(propertyName); String groupName = propertyName.replaceAll("\\.users$", ""); String userString = propertiesFile.getProperty(propertyName); final Set<String> userSet = buildUserSetFromCommaSeparateValue(userString); _groupToUserMap.put(groupName, userSet); for (String userName : userSet) { Set<String> groupsForThisUser = _userToGroupMap.get(userName); if (groupsForThisUser == null) { groupsForThisUser = new ConcurrentSkipListSet<String>(); _userToGroupMap.put(userName, groupsForThisUser); } groupsForThisUser.add(groupName); } } }
From source file:org.apache.syncope.installer.utilities.MavenUtils.java
private void logToHandler(final List<String> goals, final Properties properties) { handler.logOutput("Executing maven command:", true); final StringBuilder mavenCommand = new StringBuilder("mvn "); for (final String goal : goals) { mavenCommand.append(goal).append(" "); }/* www .j a v a 2s. c o m*/ handler.logOutput(mavenCommand.toString(), true); for (final String propertyName : properties.stringPropertyNames()) { handler.logOutput("-D " + propertyName + "=" + properties.getProperty(propertyName), true); } }
From source file:uta.ak.usttmp.console.controller.TaskController.java
@RequestMapping("/newTask") public ModelAndView newTask() { ModelAndView mav = new ModelAndView("newTask"); try {/*from www. j a v a 2s. com*/ Resource preprocessRes = new ClassPathResource("preprocess.properties"); Resource miningRes = new ClassPathResource("mining.properties"); Resource trackingRes = new ClassPathResource("tracking.properties"); Properties preprocessProps = PropertiesLoaderUtils.loadProperties(preprocessRes); Properties miningProps = PropertiesLoaderUtils.loadProperties(miningRes); Properties trackingProps = PropertiesLoaderUtils.loadProperties(trackingRes); List<Map> preprocessCPList = new ArrayList<>(); for (String key : preprocessProps.stringPropertyNames()) { String value = preprocessProps.getProperty(key); Map<String, String> hm = new HashMap(); hm.put("cpName", key); hm.put("cpValue", value); preprocessCPList.add(hm); } List<Map> miningCPList = new ArrayList<>(); for (String key : miningProps.stringPropertyNames()) { String value = miningProps.getProperty(key); Map<String, String> hm = new HashMap(); hm.put("cpName", key); hm.put("cpValue", value); miningCPList.add(hm); } List<Map> trackingCPList = new ArrayList<>(); for (String key : trackingProps.stringPropertyNames()) { String value = trackingProps.getProperty(key); Map<String, String> hm = new HashMap(); hm.put("cpName", key); hm.put("cpValue", value); trackingCPList.add(hm); } mav.addObject("preprocessCp", preprocessCPList); mav.addObject("miningCp", miningCPList); mav.addObject("trackingCp", trackingCPList); } catch (IOException ex) { Logger.getLogger(TaskController.class.getName()).log(Level.SEVERE, null, ex); } return mav; }
From source file:annis.security.ANNISUserConfigurationManager.java
private void reloadGroupsFromFile() { lock.writeLock().lock();//from w ww . ja v a 2 s . c o m try { Properties propGroups = new Properties(); try (FileInputStream inStream = new FileInputStream(groupsFile);) { propGroups.load(inStream); lastTimeReloaded = new Date(groupsFile.lastModified()); groups.clear(); for (String k : propGroups.stringPropertyNames()) { groups.put(k, new Group(k, propGroups.getProperty(k))); } } catch (IOException ex) { log.error(null, ex); } } finally { lock.writeLock().unlock(); } }
From source file:org.apache.syncope.installer.utilities.MavenUtils.java
private void logToFile(final List<String> goals, final Properties properties) { InstallLog.getInstance().info("Executing maven command:"); final StringBuilder mavenCommand = new StringBuilder("mvn "); for (final String goal : goals) { mavenCommand.append(goal).append(" "); }//ww w.j av a2 s .co m InstallLog.getInstance().info(mavenCommand.toString()); for (final String propertyName : properties.stringPropertyNames()) { InstallLog.getInstance().info("-D " + propertyName + "=" + properties.getProperty(propertyName)); } }
From source file:org.broadleafcommerce.common.extensibility.context.merge.MergeManager.java
private void setHandlers(Properties props) throws ClassNotFoundException, IllegalAccessException, InstantiationException { ArrayList<MergeHandler> handlers = new ArrayList<MergeHandler>(); for (String key : props.stringPropertyNames()) { if (key.startsWith("handler.")) { MergeHandler temp = (MergeHandler) Class.forName(props.getProperty(key)).newInstance(); String name = key.substring(8, key.length()); temp.setName(name);/*from w w w. j a va2 s .c o m*/ String priority = props.getProperty("priority." + name); if (priority != null) { temp.setPriority(Integer.parseInt(priority)); } String xpath = props.getProperty("xpath." + name); if (priority != null) { temp.setXPath(xpath); } handlers.add(temp); } } MergeHandler[] explodedView = {}; explodedView = handlers.toArray(explodedView); Comparator<Object> nameCompare = new Comparator<Object>() { @Override public int compare(Object arg0, Object arg1) { return ((MergeHandler) arg0).getName().compareTo(((MergeHandler) arg1).getName()); } }; Arrays.sort(explodedView, nameCompare); ArrayList<MergeHandler> finalHandlers = new ArrayList<MergeHandler>(); for (MergeHandler temp : explodedView) { if (temp.getName().contains(".")) { final String parentName = temp.getName().substring(0, temp.getName().lastIndexOf(".")); int pos = Arrays.binarySearch(explodedView, new MergeHandlerAdapter() { @Override public String getName() { return parentName; } }, nameCompare); if (pos >= 0) { MergeHandler[] parentHandlers = explodedView[pos].getChildren(); MergeHandler[] newHandlers = new MergeHandler[parentHandlers.length + 1]; System.arraycopy(parentHandlers, 0, newHandlers, 0, parentHandlers.length); newHandlers[newHandlers.length - 1] = temp; Arrays.sort(newHandlers); explodedView[pos].setChildren(newHandlers); } } else { finalHandlers.add(temp); } } this.handlers = new MergeHandler[0]; this.handlers = finalHandlers.toArray(this.handlers); Arrays.sort(this.handlers); }
From source file:eu.dnetlib.maven.plugin.properties.WritePredefinedProjectProperties.java
/** * Removes properties which should not be written. * @param properties//from w w w. j a v a 2s . c o m * @param omitCSV * @param includeCSV * @throws MojoExecutionException */ protected void trim(Properties properties, String omitCSV, String includeCSV) throws MojoExecutionException { List<String> omitKeys = getListFromCSV(omitCSV); for (String key : omitKeys) { properties.remove(key); } List<String> includeKeys = getListFromCSV(includeCSV); // mh: including keys from predefined properties if (includePropertyKeysFromFiles != null && includePropertyKeysFromFiles.length > 0) { for (String currentIncludeLoc : includePropertyKeysFromFiles) { if (validate(currentIncludeLoc)) { Properties p = getProperties(currentIncludeLoc); for (String key : p.stringPropertyNames()) { includeKeys.add(key); } } } } if (includeKeys != null && !includeKeys.isEmpty()) { // removing only when include keys provided Set<String> keys = properties.stringPropertyNames(); for (String key : keys) { if (!includeKeys.contains(key)) { properties.remove(key); } } } }
From source file:org.apache.nifi.processors.ccda.ExtractCCDAAttributes.java
protected void loadMappings() { ClassLoader classloader = Thread.currentThread().getContextClassLoader(); Properties mappings = new Properties(); try (InputStream is = classloader.getResourceAsStream("mapping.properties")) { mappings.load(is);//from w w w. ja va 2 s . c o m // each child element is key#value and multiple elements are separated by @ for (String property : mappings.stringPropertyNames()) { String[] variables = StringUtils.split(mappings.getProperty(property), FIELD_SEPARATOR); Map<String, String> map = new LinkedHashMap<String, String>(); for (String variable : variables) { String[] keyvalue = StringUtils.split(variable, KEY_VALUE_SEPARATOR); map.put(keyvalue[0], keyvalue[1]); } processMap.put(property, map); } } catch (IOException e) { getLogger().error("Failed to load mappings", e); throw new ProcessException("Failed to load mappings", e); } }
From source file:eu.dnetlib.maven.plugin.properties.WritePredefinedProjectProperties.java
/** * Returns content.//from w w w . j av a2 s. com * @param comment * @param properties * @param escapeTokens * @return content */ protected String getContent(String comment, Properties properties, List<String> escapeTokens) { List<String> names = new ArrayList<String>(properties.stringPropertyNames()); Collections.sort(names); StringBuilder sb = new StringBuilder(); if (!StringUtils.isBlank(comment)) { sb.append(comment); } for (String name : names) { String value = properties.getProperty(name); String escapedValue = escape(value, escapeTokens); sb.append(name + "=" + escapedValue + "\n"); } return sb.toString(); }