@Test public void testGetComponentClass() { URL url = getClass().getResource("ConfigurationManagerTest.sxl"); ConfigurationManager cm = new ConfigurationManager(url); String instanceName = "duco"; PropertySheet ps = cm.getPropertySheet(instanceName); assertEquals(ps.getComponentClass("frontend"), DummyFrontEnd.class); assertEquals(ps.getComponentClass("anotherFrontend"), DummyFrontEnd.class); }
public PropertySheet getPropertySheet(String instanceName) { if (!symbolTable.containsKey(instanceName)) { RawPropertyData rpd = rawPropertyMap.get(instanceName); if (rpd != null) { String className = rpd.getClassName(); try { Class<?> cls = Class.forName(className); PropertySheet propertySheet = new PropertySheet(cls.asSubclass(Configurable.class), instanceName, this, rpd); symbolTable.put(instanceName, propertySheet); } catch (ClassNotFoundException e) { System.err.println("class not found !" + e); } catch (ClassCastException e) { System.err.println("can not cast class !" + e); } catch (ExceptionInInitializerError e) { System.err.println("couldn't load class !" + e); } } } return symbolTable.get(instanceName); }
ConfigurationManager implements Cloneable { public PropertySheet getPropertySheet(String instanceName) { if (!symbolTable.containsKey(instanceName)) { RawPropertyData rpd = rawPropertyMap.get(instanceName); if (rpd != null) { String className = rpd.getClassName(); try { Class<?> cls = Class.forName(className); PropertySheet propertySheet = new PropertySheet(cls.asSubclass(Configurable.class), instanceName, this, rpd); symbolTable.put(instanceName, propertySheet); } catch (ClassNotFoundException e) { System.err.println("class not found !" + e); } catch (ClassCastException e) { System.err.println("can not cast class !" + e); } catch (ExceptionInInitializerError e) { System.err.println("couldn't load class !" + e); } } } return symbolTable.get(instanceName); } }
ConfigurationManager implements Cloneable { public PropertySheet getPropertySheet(String instanceName) { if (!symbolTable.containsKey(instanceName)) { RawPropertyData rpd = rawPropertyMap.get(instanceName); if (rpd != null) { String className = rpd.getClassName(); try { Class<?> cls = Class.forName(className); PropertySheet propertySheet = new PropertySheet(cls.asSubclass(Configurable.class), instanceName, this, rpd); symbolTable.put(instanceName, propertySheet); } catch (ClassNotFoundException e) { System.err.println("class not found !" + e); } catch (ClassCastException e) { System.err.println("can not cast class !" + e); } catch (ExceptionInInitializerError e) { System.err.println("couldn't load class !" + e); } } } return symbolTable.get(instanceName); } ConfigurationManager();  ConfigurationManager(String configFileName);  ConfigurationManager(URL url); }
ConfigurationManager implements Cloneable { public PropertySheet getPropertySheet(String instanceName) { if (!symbolTable.containsKey(instanceName)) { RawPropertyData rpd = rawPropertyMap.get(instanceName); if (rpd != null) { String className = rpd.getClassName(); try { Class<?> cls = Class.forName(className); PropertySheet propertySheet = new PropertySheet(cls.asSubclass(Configurable.class), instanceName, this, rpd); symbolTable.put(instanceName, propertySheet); } catch (ClassNotFoundException e) { System.err.println("class not found !" + e); } catch (ClassCastException e) { System.err.println("can not cast class !" + e); } catch (ExceptionInInitializerError e) { System.err.println("couldn't load class !" + e); } } } return symbolTable.get(instanceName); } ConfigurationManager();  ConfigurationManager(String configFileName);  ConfigurationManager(URL url); PropertySheet getPropertySheet(String instanceName); Collection<String> getInstanceNames(Class<? extends Configurable> type); Set<String> getComponentNames(); @SuppressWarnings("unchecked") C lookup(String instanceName); C lookup(Class<C> confClass); List<PropertySheet> getPropSheets(Class<? extends Configurable> confClass); void addConfigurable(Class<? extends Configurable> confClass, String name); void addConfigurable(Class<? extends Configurable> confClass, String name, Map<String, Object> props); void addConfigurable(Configurable configurable, String name); void renameConfigurable(String oldName, String newName); void removeConfigurable(String name); void addSubConfiguration(ConfigurationManager subCM); void addSubConfiguration(ConfigurationManager subCM, boolean doOverrideComponents); Map<String, String> getGlobalProperties(); String getGlobalProperty(String propertyName); String getGloPropReference(String propertyName); URL getConfigURL(); void setGlobalProperty(String propertyName, String value); String getStrippedComponentName(String propertyName); void addConfigurationChangeListener(ConfigurationChangeListener l); void removeConfigurationChangeListener(ConfigurationChangeListener l); @Override boolean equals(Object obj); @Override int hashCode(); @Override ConfigurationManager clone(); static C getInstance(Class<C> targetClass); static C getInstance(Class<C> targetClass, Map<String, Object> props); static C getInstance(Class<C> targetClass, Map<String, Object> props, String compName); Logger getRootLogger(); }
ConfigurationManager implements Cloneable { public PropertySheet getPropertySheet(String instanceName) { if (!symbolTable.containsKey(instanceName)) { RawPropertyData rpd = rawPropertyMap.get(instanceName); if (rpd != null) { String className = rpd.getClassName(); try { Class<?> cls = Class.forName(className); PropertySheet propertySheet = new PropertySheet(cls.asSubclass(Configurable.class), instanceName, this, rpd); symbolTable.put(instanceName, propertySheet); } catch (ClassNotFoundException e) { System.err.println("class not found !" + e); } catch (ClassCastException e) { System.err.println("can not cast class !" + e); } catch (ExceptionInInitializerError e) { System.err.println("couldn't load class !" + e); } } } return symbolTable.get(instanceName); } ConfigurationManager();  ConfigurationManager(String configFileName);  ConfigurationManager(URL url); PropertySheet getPropertySheet(String instanceName); Collection<String> getInstanceNames(Class<? extends Configurable> type); Set<String> getComponentNames(); @SuppressWarnings("unchecked") C lookup(String instanceName); C lookup(Class<C> confClass); List<PropertySheet> getPropSheets(Class<? extends Configurable> confClass); void addConfigurable(Class<? extends Configurable> confClass, String name); void addConfigurable(Class<? extends Configurable> confClass, String name, Map<String, Object> props); void addConfigurable(Configurable configurable, String name); void renameConfigurable(String oldName, String newName); void removeConfigurable(String name); void addSubConfiguration(ConfigurationManager subCM); void addSubConfiguration(ConfigurationManager subCM, boolean doOverrideComponents); Map<String, String> getGlobalProperties(); String getGlobalProperty(String propertyName); String getGloPropReference(String propertyName); URL getConfigURL(); void setGlobalProperty(String propertyName, String value); String getStrippedComponentName(String propertyName); void addConfigurationChangeListener(ConfigurationChangeListener l); void removeConfigurationChangeListener(ConfigurationChangeListener l); @Override boolean equals(Object obj); @Override int hashCode(); @Override ConfigurationManager clone(); static C getInstance(Class<C> targetClass); static C getInstance(Class<C> targetClass, Map<String, Object> props); static C getInstance(Class<C> targetClass, Map<String, Object> props, String compName); Logger getRootLogger();  }