List of usage examples for java.util Properties keys
@Override
public Enumeration<Object> keys()
From source file:org.tolven.appserverproperties.AppServerPropertiesPlugin.java
@Override public void execute(String[] args) { logger.info("*** execute ***"); CommandLine commandLine = getCommandLine(args); AppServerProperties loadServerProperties = getAppServerProperties(); if (commandLine.hasOption(CMD_LINE_DISPLAY_OPTION)) { logger.info("Displaying server properties..."); loadServerProperties.displayProperties(); } else if (commandLine.hasOption(CMD_LINE_LOAD_OPTION)) { logger.info("Importing server properties..."); List<File> propertiesFiles = getPropertiesFiles(); loadServerProperties.uploadPropertiesFiles(propertiesFiles); } else if (commandLine.hasOption(CMD_LINE_FIND_OPTION)) { String property = commandLine.getOptionValue(CMD_LINE_FIND_OPTION); logger.info("Find server property: " + property); String value = loadServerProperties.findProperty(property); System.out.println(value); } else if (commandLine.hasOption(CMD_LINE_SET_OPTION)) { Properties optionProperties = commandLine.getOptionProperties(CMD_LINE_SET_OPTION); String propertyName = (String) optionProperties.keys().nextElement(); String propertyValue = optionProperties.getProperty(propertyName); logger.info("Setting server property: " + propertyName); loadServerProperties.setProperty(propertyName, propertyValue); } else if (commandLine.hasOption(CMD_LINE_REMOVE_OPTION)) { String property = commandLine.getOptionValue(CMD_LINE_REMOVE_OPTION); logger.info("Removing server property: " + property); loadServerProperties.removeProperty(property); } else if (commandLine.hasOption(CMD_LINE_GUI_OPTION)) { logger.info("Starting the appserver properties gui..."); //getPropertiesUI().setVisible(true); } else {//from ww w. j ava 2s . com throw new RuntimeException("Unrecognized command line option:" + commandLine); } logger.info("server properties completed"); }
From source file:gov.nih.nci.cacis.ip.mirthconnect.ftp.FTPMapping.java
private void setupFTPInfoMap(String ftpMappingFile) throws IOException { final File mappingFile = new File(ftpMappingFile); InputStream is = null;// w ww. j a v a 2 s . c om // FileInputStream fis = null; // BufferedReader br = null; try { Properties configFile = new Properties(); is = new FileInputStream(ftpMappingFile); configFile.load(is); ftpInfoMap = new HashMap<String, FTPInfo>(); Enumeration<Object> enumeration = configFile.keys(); while (enumeration.hasMoreElements()) { addFTPSiteToMap((String) enumeration.nextElement()); } // fis = new FileInputStream(mappingFile); // br = new BufferedReader(new InputStreamReader(fis)); // // ftpInfoMap = new HashMap<String, FTPInfo>(); // String currLine = br.readLine(); // // while (currLine != null) { // addFTPSiteToMap(currLine); // currLine = br.readLine(); // } } finally { if (is != null) { is.close(); } // if (br != null) { // br.close(); // } // if (fis != null) { // fis.close(); // } } }
From source file:org.solmix.runtime.cm.support.SpringConfigureUnitManager.java
private Dictionary<String, ?> toDictionary(Properties properties) { Dictionary<String, Object> dic = new Hashtable<String, Object>(); if (properties != null) { Enumeration<Object> en = properties.keys(); while (en.hasMoreElements()) { Object key = en.nextElement(); dic.put(key.toString(), properties.get(key)); }//ww w. j a v a2 s.com } return dic; }
From source file:com.liangc.hq.base.web.ConfiguratorListener.java
private void loadPreferences(ServletContext ctx) { ConfigResponse userPrefs = new ConfigResponse(); ConfigResponse userDashPrefs = new ConfigResponse(); ConfigResponse roleDashPrefs = new ConfigResponse(); try {/* w ww . j av a 2 s . c o m*/ // Load User Preferences Properties userProps = loadProperties(ctx, getPreferenceFile()); Enumeration keys = userProps.keys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); userPrefs.setValue(key, userProps.getProperty(key)); } ctx.setAttribute(Constants.DEF_USER_PREFS, userPrefs); // Load User Dashboard Preferences Properties userDashProps = loadProperties(ctx, getUserDashboardPreferenceFile()); keys = userDashProps.keys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); userDashPrefs.setValue(key, userDashProps.getProperty(key)); } ctx.setAttribute(Constants.DEF_USER_DASH_PREFS, userDashPrefs); // Load Role Dashboard Preferences Properties roleDashProps; try { roleDashProps = loadProperties(ctx, getRoleDashboardPreferenceFile()); } catch (Exception e) { roleDashProps = null; } if (roleDashProps != null) { keys = roleDashProps.keys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); roleDashPrefs.setValue(key, roleDashProps.getProperty(key)); } } ctx.setAttribute(Constants.DEF_ROLE_DASH_PREFS, roleDashPrefs); } catch (Exception e) { error("loading table properties file " + Constants.PROPS_TAGLIB + "failed: ", e); } }
From source file:org.castor.ddlgen.Configuration.java
/** * add properties (key, value) for configuration, the existed item will * be overwrited.//w ww .j a v a2 s. c om * @param props properties */ public final void addProperties(final Properties props) { if (props != null) { Object key; Object value; for (Enumeration<Object> e = props.keys(); e.hasMoreElements();) { key = e.nextElement(); value = props.get(key); _conf.put(key, value); } } }
From source file:org.apache.jcs.config.PropertySetter.java
/** * Set the properites for the object that match the <code>prefix</code> * passed as parameter./* ww w. j a v a 2s.c o m*/ * * @param properties * The new properties value * @param prefix * The new properties value */ public void setProperties(Properties properties, String prefix) { int len = prefix.length(); for (Enumeration e = properties.keys(); e.hasMoreElements();) { String key = (String) e.nextElement(); // handle only properties that start with the desired frefix. if (key.startsWith(prefix)) { // ignore key if it contains dots after the prefix if (key.indexOf('.', len + 1) > 0) { //System.err.println("----------Ignoring---["+key // +"], prefix=["+prefix+"]."); continue; } String value = OptionConverter.findAndSubst(key, properties); key = key.substring(len); setProperty(key, value); } } }
From source file:com.glaf.core.service.impl.MxSysDataServiceImpl.java
@Transactional public void reload(String path) { File dir = new File(path); if (dir.exists() && dir.isDirectory()) { File contents[] = dir.listFiles(); if (contents != null) { for (int i = 0; i < contents.length; i++) { if (contents[i].isFile() && contents[i].getName().endsWith(".properties")) { try { Properties props = PropertiesUtils.loadFilePathResource(contents[i]); if (props != null && !props.isEmpty()) { Enumeration<?> e = props.keys(); while (e.hasMoreElements()) { String key = (String) e.nextElement(); if (this.getSysData(key) == null) { String value = props.getProperty(key); JSONObject json = JSON.parseObject(value); SysData model = SysDataJsonFactory.jsonToObject(json); model.setId(key); model.setCreateBy("system"); model.setUpdateBy("system"); this.save(model); }//from w w w.j av a 2s . c om } } } catch (Exception ex) { ex.printStackTrace(); logger.error(contents[i].getName() + " load error", ex); } } } } } }
From source file:es.itecban.deployment.resource.taxonomy.DefaultTaxonomyImpl.java
private void initTaxonomy() { categories = new Hashtable<String, Category>(); Properties types = new Properties(); try {//from ww w . j av a2 s . c o m types.load(supportedTypes.getInputStream()); } catch (Exception e) { e.printStackTrace(); } if (types != null) { Enumeration keys = types.keys(); while (keys.hasMoreElements()) { String categoryName = (String) keys.nextElement(); String categoryDescription = (String) types.get(categoryName); addCategory(categoryName, categoryDescription); } } }
From source file:com.linkedin.databus.client.generic.SimpleFileLoggingConsumer.java
private Boolean hasServerSideFilterConfig(Properties startupProps) { Enumeration<Object> propKeys = startupProps.keys(); while (propKeys.hasMoreElements()) { String key = (String) propKeys.nextElement(); if (key.contains(SERVER_SIDE_FILTER_PREFIX)) { return true; }//from w w w .jav a2 s . c o m } return false; }
From source file:com.peoplemerge.recaptcha.ReCaptchaImpl.java
/** * Produces javascript array with the RecaptchaOptions encoded. * /*ww w. j a va 2s. c o m*/ * @param properties * @return */ private String fetchJSOptions(Properties properties) { if (properties == null || properties.size() == 0) { return ""; } String jsOptions = "<script type=\"text/javascript\">\r\n" + "var RecaptchaOptions = {"; for (Enumeration e = properties.keys(); e.hasMoreElements();) { String property = (String) e.nextElement(); jsOptions += property + ":'" + properties.getProperty(property) + "'"; if (e.hasMoreElements()) { jsOptions += ","; } } jsOptions += "};\r\n</script>\r\n"; return jsOptions; }