/** * fills in all the classes (based on the packages in the input properties * file) into the output properties file * * @throws Exception if something goes wrong * @see #m_OutputProperties */ protected void generateOutputProperties() throws Exception { Enumeration<?> keys; String key; String value; String pkg; StringTokenizer tok; Vector<String> classes; HashSet<String> names; int i; m_OutputProperties = new Properties(); keys = m_InputProperties.propertyNames(); while (keys.hasMoreElements()) { key = keys.nextElement().toString(); if (key.equals(USE_DYNAMIC)) { continue; } tok = new StringTokenizer(m_InputProperties.getProperty(key), ","); names = new HashSet<String>(); // get classes for all packages while (tok.hasMoreTokens()) { pkg = tok.nextToken().trim(); try { classes = ClassDiscovery.find(Class.forName(key), pkg); } catch (Exception e) { System.out.println("Problem with '" + key + "': " + e); classes = new Vector<String>(); } for (i = 0; i < classes.size(); i++) { // skip non-public classes if (!isValidClassname(classes.get(i).toString())) { continue; } // some classes should not be listed for some keys if (!isValidClassname(key, classes.get(i).toString())) { continue; } names.add(classes.get(i)); } } // generate list value = ""; classes = new Vector<String>(); classes.addAll(names); Collections.sort(classes, new StringCompare()); for (i = 0; i < classes.size(); i++) { if (!value.equals("")) { value += ","; } value += classes.get(i).toString(); } if (VERBOSE) { System.out.println(pkg + " -> " + value); } // set value m_OutputProperties.setProperty(key, value); } }
/** * fills in all the classes (based on the packages in the input properties * file) into the output properties file * * @throws Exception if something goes wrong * @see #m_OutputProperties */ protected void generateOutputProperties() throws Exception { Enumeration keys; String key; String value; String pkg; StringTokenizer tok; Vector classes; HashSet names; int i; m_OutputProperties = new Properties(); keys = m_InputProperties.propertyNames(); while (keys.hasMoreElements()) { key = keys.nextElement().toString(); if (key.equals(USE_DYNAMIC)) continue; tok = new StringTokenizer(m_InputProperties.getProperty(key), ","); names = new HashSet(); // get classes for all packages while (tok.hasMoreTokens()) { pkg = tok.nextToken().trim(); try { classes = ClassDiscovery.find(Class.forName(key), pkg); } catch (Exception e) { System.out.println("Problem with '" + key + "': " + e); classes = new Vector(); } for (i = 0; i < classes.size(); i++) { // skip non-public classes if (!isValidClassname(classes.get(i).toString())) continue; // some classes should not be listed for some keys if (!isValidClassname(key, classes.get(i).toString())) continue; names.add(classes.get(i)); } } // generate list value = ""; classes = new Vector(); classes.addAll(names); Collections.sort(classes, new StringCompare()); for (i = 0; i < classes.size(); i++) { if (!value.equals("")) value += ","; value += classes.get(i).toString(); } if (VERBOSE) System.out.println(pkg + " -> " + value); // set value m_OutputProperties.setProperty(key, value); } }
/** * fills in all the classes (based on the packages in the input properties * file) into the output properties file * * @throws Exception if something goes wrong * @see #m_OutputProperties */ protected void generateOutputProperties() throws Exception { Enumeration keys; String key; String value; String pkg; StringTokenizer tok; Vector classes; HashSet names; int i; m_OutputProperties = new Properties(); keys = m_InputProperties.propertyNames(); while (keys.hasMoreElements()) { key = keys.nextElement().toString(); if (key.equals(USE_DYNAMIC)) continue; tok = new StringTokenizer(m_InputProperties.getProperty(key), ","); names = new HashSet(); // get classes for all packages while (tok.hasMoreTokens()) { pkg = tok.nextToken().trim(); try { classes = ClassDiscovery.find(Class.forName(key), pkg); } catch (Exception e) { System.out.println(Thread.currentThread().getStackTrace()[1].getClassName() +Messages.getInstance().getString("GenericPropertiesCreator_GenerateOutputProperties_Text_First") + key + Messages.getInstance().getString("GenericPropertiesCreator_GenerateOutputProperties_Text_Second") + e); classes = new Vector(); } for (i = 0; i < classes.size(); i++) { // skip non-public classes if (!isValidClassname(classes.get(i).toString())) continue; // some classes should not be listed for some keys if (!isValidClassname(key, classes.get(i).toString())) continue; names.add(classes.get(i)); } } // generate list value = ""; classes = new Vector(); classes.addAll(names); Collections.sort(classes, new StringCompare()); for (i = 0; i < classes.size(); i++) { if (!value.equals("")) value += ","; value += classes.get(i).toString(); } if (VERBOSE) System.out.println(Thread.currentThread().getStackTrace()[1].getClassName() +pkg + " -> " + value); // set value m_OutputProperties.setProperty(key, value); } }