public static void dumpPropStructure(ConfigurationManager cm) { Map map = ConfigurationManagerUtils.listAllsPropNames(cm); [email protected](new StringBuilder().append("Property-structure of '").append(cm.getConfigURL()).append("':").toString()); [email protected]("\nUnambiguous properties = "); Iterator iterator = map.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry)iterator.next(); if (((List)entry.getValue()).size() == 1) { [email protected](new StringBuilder().append((string)entry.getKey()).append(", ").toString()); } } [email protected]("\n\nAmbiguous properties: "); iterator = map.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry entry = (Map.Entry)iterator.next(); if (((List)entry.getValue()).size() != 1) { [email protected](new StringBuilder().append((string)entry.getKey()).append('=').toString()); Iterator iterator2 = ((List)entry.getValue()).iterator(); while (iterator2.hasNext()) { PropertySheet propertySheet = (PropertySheet)iterator2.next(); [email protected](new StringBuilder().append(propertySheet.getInstanceName()).append(", ").toString()); } [email protected](); } } }
public static void setProperty(ConfigurationManager cm, string propName, string propValue) { if (!ConfigurationManagerUtils.assertionsDisabled && propValue == null) { throw new AssertionError(); } Map map = ConfigurationManagerUtils.listAllsPropNames(cm); Set componentNames = cm.getComponentNames(); object _ref; CharSequence charSequence; if (!map.containsKey(propName)) { string text = propName; _ref = "->"; charSequence = CharSequence.Cast(_ref); if (!String.instancehelper_contains(text, charSequence) && !componentNames.contains(propName)) { string text2 = new StringBuilder().append("No property or configurable '").append(propName).append("' in configuration '").append(cm.getConfigURL()).append("'!").toString(); throw new RuntimeException(text2); } } if (componentNames.contains(propName)) { try { Class confClass = Class.forName(propValue, ConfigurationManagerUtils.__GetCallerID()).asSubclass(ClassLiteral <Configurable> .Value); ConfigurationManagerUtils.setClass(cm.getPropertySheet(propName), confClass); } catch (ClassNotFoundException ex) { throw new RuntimeException(ex); } } string text3 = propName; _ref = "->"; charSequence = CharSequence.Cast(_ref); if (!String.instancehelper_contains(text3, charSequence) && ((List)map.get(propName)).size() > 1) { string text4 = new StringBuilder().append("Property-name '").append(propName).append("' is ambiguous with respect to configuration '").append(cm.getConfigURL()).append("'. Use 'componentName->propName' to disambiguate your request.").toString(); throw new RuntimeException(text4); } string text5 = propName; _ref = "->"; charSequence = CharSequence.Cast(_ref); string componentName; if (String.instancehelper_contains(text5, charSequence)) { string[] array = String.instancehelper_split(propName, "->"); componentName = array[0]; propName = array[1]; } else { componentName = ((PropertySheet)((List)map.get(propName)).get(0)).getInstanceName(); } ConfigurationManagerUtils.setProperty(cm, componentName, propName, propValue); }