ovidiu      02/03/13 10:59:19

  Added:       src/scratchpad/schecoon/src/org/apache/cocoon/components/flow
                        InterpreterSelector.java
  Log:
  Selector of different flow control interpreters.
  
  Revision  Changes    Path
  1.1                  
xml-cocoon2/src/scratchpad/schecoon/src/org/apache/cocoon/components/flow/InterpreterSelector.java
  
  Index: InterpreterSelector.java
  ===================================================================
  package org.apache.cocoon.components.flow;
  
  import org.apache.avalon.excalibur.component.ExcaliburComponentSelector;
  import org.apache.avalon.framework.configuration.Configurable;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  
  public class InterpreterSelector extends ExcaliburComponentSelector
    implements Configurable
  {
    ClassLoader loader = Thread.currentThread().getContextClassLoader();
  
    public void configure(Configuration config)
      throws ConfigurationException
    {
      System.out.println("InterpreterSelector = " + this);
      
      Configuration[] components = config.getChildren("component-instance");
      for (int i = 0; i < components.length; i++) {
        Configuration component = components[i];
        String name = component.getAttribute("name");
        String className = component.getAttribute("class");
        System.out.println("Adding component with name " + name
                           + ", class = " + className);
  
        Class clazz;
        try {
          clazz = loader.loadClass(className);
          addComponent(name, clazz, component);
        }
        catch (Exception ex) {
          throw new ConfigurationException("Cannot load class " + className);
        }
      }
    }
  }
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to