You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by un...@apache.org on 2004/09/23 12:52:21 UTC

svn commit: rev 47094 - in forrest/trunk/src/java/org/apache/cocoon/components/modules/input: . lm

Author: unico
Date: Thu Sep 23 03:52:17 2004
New Revision: 47094

Modified:
   forrest/trunk/src/java/org/apache/cocoon/components/modules/input/LocationMapModule.java
   forrest/trunk/src/java/org/apache/cocoon/components/modules/input/lm/AbstractNode.java
   forrest/trunk/src/java/org/apache/cocoon/components/modules/input/lm/LocationMap.java
   forrest/trunk/src/java/org/apache/cocoon/components/modules/input/lm/LocationNode.java
   forrest/trunk/src/java/org/apache/cocoon/components/modules/input/lm/LocatorNode.java
   forrest/trunk/src/java/org/apache/cocoon/components/modules/input/lm/MatchNode.java
   forrest/trunk/src/java/org/apache/cocoon/components/modules/input/lm/SelectNode.java
Log:
Migrate from Composable to Serviceable in order to work with both Cocoon 2.2 and 2.1.x


Modified: forrest/trunk/src/java/org/apache/cocoon/components/modules/input/LocationMapModule.java
==============================================================================
--- forrest/trunk/src/java/org/apache/cocoon/components/modules/input/LocationMapModule.java	(original)
+++ forrest/trunk/src/java/org/apache/cocoon/components/modules/input/LocationMapModule.java	Thu Sep 23 03:52:17 2004
@@ -22,16 +22,16 @@
 
 import org.apache.avalon.framework.activity.Disposable;
 import org.apache.avalon.framework.component.Component;
-import org.apache.avalon.framework.component.ComponentException;
-import org.apache.avalon.framework.component.ComponentManager;
-import org.apache.avalon.framework.component.Composable;
 import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.configuration.NamespacedSAXConfigurationHandler;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
 import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.cocoon.components.modules.input.lm.*;
+import org.apache.cocoon.components.modules.input.lm.LocationMap;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceResolver;
 import org.apache.excalibur.source.SourceValidity;
@@ -43,11 +43,11 @@
  * Resolves a request against a LocationMap.
  */
 public class LocationMapModule extends AbstractLogEnabled 
-    implements InputModule, Composable, Configurable, Disposable, ThreadSafe {
+    implements InputModule, Serviceable, Configurable, Disposable, ThreadSafe {
     
     private static final Iterator ATTNAMES = Collections.EMPTY_LIST.iterator();
     
-    private ComponentManager m_manager;
+    private ServiceManager m_manager;
     private SourceResolver m_resolver;
     private String m_src;
     private SourceValidity m_srcVal;
@@ -58,7 +58,7 @@
     public LocationMapModule() {
     }
     
-    public void compose(ComponentManager manager) throws ComponentException {
+    public void service(ServiceManager manager) throws ServiceException {
         m_manager = manager;
         m_resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
     }
@@ -130,7 +130,7 @@
         catch (SAXException e) {
             throw new ConfigurationException("Unable to build LocationMap.",e);
         }
-        catch (ComponentException e) {
+        catch (ServiceException e) {
             throw new ConfigurationException("Unable to build LocationMap.",e);
         }
         finally {

Modified: forrest/trunk/src/java/org/apache/cocoon/components/modules/input/lm/AbstractNode.java
==============================================================================
--- forrest/trunk/src/java/org/apache/cocoon/components/modules/input/lm/AbstractNode.java	(original)
+++ forrest/trunk/src/java/org/apache/cocoon/components/modules/input/lm/AbstractNode.java	Thu Sep 23 03:52:17 2004
@@ -19,29 +19,31 @@
 import java.util.Iterator;
 import java.util.Map;
 
-import org.apache.avalon.framework.component.ComponentManager;
+import org.apache.avalon.framework.component.WrapperComponentManager;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.cocoon.components.treeprocessor.InvokeContext;
 import org.apache.cocoon.components.treeprocessor.variables.VariableResolver;
 import org.apache.cocoon.components.treeprocessor.variables.VariableResolverFactory;
 import org.apache.cocoon.sitemap.PatternException;
 
 /**
- * Base class for LocationMap nodes.
+ * Base class for LocationMap nodes. Defines the contract between the
+ * LocationMap and its nodes.
  */
 public abstract class AbstractNode extends AbstractLogEnabled {
     
     
-    protected final ComponentManager m_manager;
+    protected final ServiceManager m_manager;
     
     // optional parameters defined by the node's configuration
     private Map m_parameters;
     
     
-    public AbstractNode(final ComponentManager manager) {
+    public AbstractNode(final ServiceManager manager) {
         m_manager = manager;
     }
     
@@ -70,8 +72,8 @@
             final String value = children[i].getAttribute("value");
             try {
                 parameters.put(
-                    VariableResolverFactory.getResolver(name,m_manager),
-                    VariableResolverFactory.getResolver(value,m_manager));
+                    VariableResolverFactory.getResolver(name, new WrapperComponentManager(m_manager)),
+                    VariableResolverFactory.getResolver(value, new WrapperComponentManager(m_manager)));
             } catch(PatternException pe) {
                 String msg = "Invalid pattern '" + value + "' at " 
                     + children[i].getLocation();

Modified: forrest/trunk/src/java/org/apache/cocoon/components/modules/input/lm/LocationMap.java
==============================================================================
--- forrest/trunk/src/java/org/apache/cocoon/components/modules/input/lm/LocationMap.java	(original)
+++ forrest/trunk/src/java/org/apache/cocoon/components/modules/input/lm/LocationMap.java	Thu Sep 23 03:52:17 2004
@@ -19,15 +19,15 @@
 import java.util.Iterator;
 import java.util.Map;
 
-import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.framework.component.ComponentManager;
-import org.apache.avalon.framework.component.DefaultComponentManager;
-import org.apache.avalon.framework.component.DefaultComponentSelector;
+import org.apache.avalon.framework.component.WrapperComponentManager;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.container.ContainerUtil;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.logger.Logger;
+import org.apache.avalon.framework.service.DefaultServiceManager;
+import org.apache.avalon.framework.service.DefaultServiceSelector;
+import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.cocoon.components.treeprocessor.InvokeContext;
 import org.apache.cocoon.matching.Matcher;
 import org.apache.cocoon.selection.Selector;
@@ -47,8 +47,7 @@
  *   Provide a tool for more powerful virtual linking.
  *  </li>
  *  <li>
- *   Enable Forrest with a standard configuration override
- *   mechanism.
+ *   Enable Forrest with a standard configuration override mechanism.
  *  </li>
  * </ul>
  * </p>
@@ -93,22 +92,21 @@
      */
     public static final String HINT_PARAM = "#" + ANCHOR_NAME + ":" + HINT_KEY;
     
-    // Component manager containing the locationmap components
-    // as declared in the components section.
-    private LocationMapComponentManager m_manager;
+    /** Component manager containing the locationmap components */
+    private LocationMapServiceManager m_manager;
     
-    // default matcher as configured in the components section
+    /** default matcher */
     private String m_defaultMatcher;
     
-    // default selector as configured in the components section
+    /** default selector */
     private String m_defaultSelector;
     
-    // the list of LocatorNodes
+    /** list of LocatorNodes */
     private LocatorNode[] m_locatorNodes;
     
     
-    public LocationMap(ComponentManager manager) {
-        m_manager = new LocationMapComponentManager(manager);
+    public LocationMap(ServiceManager manager) {
+        m_manager = new LocationMapServiceManager(manager);
     }
     
     /**
@@ -116,33 +114,33 @@
      * the LocatorNodes.
      */
     public void build(final Configuration configuration) throws ConfigurationException {
-        
+
         // components
         final Configuration components = configuration.getChild("components");
-        
+
         // matchers
         Configuration child = components.getChild("matchers",false);
         if (child != null) {
-            final DefaultComponentSelector matcherSelector = new DefaultComponentSelector();
+            final DefaultServiceSelector matcherSelector = new DefaultServiceSelector();
             m_defaultMatcher = child.getAttribute("default");
             final Configuration[] matchers = child.getChildren("matcher");
             for (int i = 0; i < matchers.length; i++) {
                 String name = matchers[i].getAttribute("name");
                 String src  = matchers[i].getAttribute("src");
-                Matcher matcher = (Matcher) createComponent(src,matchers[i]);
-                matcherSelector.put(name,matcher);
+                Matcher matcher = (Matcher) createComponent(src, matchers[i]);
+                matcherSelector.put(name, matcher);
             }
             matcherSelector.makeReadOnly();
-            if (!matcherSelector.hasComponent(m_defaultMatcher)) {
+            if (!matcherSelector.isSelectable(m_defaultMatcher)) {
                 throw new ConfigurationException("Default matcher is not defined.");
             }
-            m_manager.put(Matcher.ROLE+"Selector",matcherSelector);
+            m_manager.put(Matcher.ROLE+"Selector", matcherSelector);
         }
-        
+
         // selectors
         child = components.getChild("selectors",false);
         if (child != null) {
-            final DefaultComponentSelector selectorSelector = new DefaultComponentSelector();
+            final DefaultServiceSelector selectorSelector = new DefaultServiceSelector();
             m_defaultSelector = child.getAttribute("default");
             final Configuration[] selectors = child.getChildren("selector");
             for (int i = 0; i < selectors.length; i++) {
@@ -152,18 +150,19 @@
                 selectorSelector.put(name,selector);
             }
             selectorSelector.makeReadOnly();
-            if (!selectorSelector.hasComponent(m_defaultSelector)) {
+            if (!selectorSelector.isSelectable(m_defaultSelector)) {
                 throw new ConfigurationException("Default selector is not defined.");
             }
             m_manager.put(Selector.ROLE+"Selector",selectorSelector);
-            m_manager.makeReadOnly();
         }
-        
+
+        m_manager.makeReadOnly();
+
         // locators
         final Configuration[] children = configuration.getChildren("locator");
         m_locatorNodes = new LocatorNode[children.length];
         for (int i = 0; i < children.length; i++) {
-            m_locatorNodes[i] = new LocatorNode(this,m_manager);
+            m_locatorNodes[i] = new LocatorNode(this, m_manager);
             m_locatorNodes[i].enableLogging(getLogger());
             m_locatorNodes[i].build(children[i]);
         }
@@ -183,7 +182,9 @@
         try {
             component = Class.forName(src).newInstance();
             ContainerUtil.enableLogging(component,getLogger());
-            ContainerUtil.configure(component,config);
+            if (config != null) {
+                ContainerUtil.configure(component, config);
+            }
             ContainerUtil.initialize(component);
         } catch (Exception e) {
             throw new ConfigurationException("Couldn't create object of type " + src,e);
@@ -192,12 +193,9 @@
     }
     
     public void dispose() {
-        Iterator components = m_manager.getComponents();
+        final Iterator components = m_manager.getObjects();
         while(components.hasNext()) {
-            Object component = components.next();
-            if (component instanceof Disposable) {
-                ((Disposable) component).dispose();
-            }
+        	ContainerUtil.dispose(components.next());
         }
         m_manager = null;
         m_locatorNodes = null;
@@ -209,21 +207,20 @@
      * the first non-null result.
      */
     public String locate(String hint, Map om) throws Exception {
-        
+
         String location = null;
-        
+
         final InvokeContext context = new InvokeContext();
         final Logger contextLogger = getLogger().getChildLogger("ctx");
-        context.enableLogging(contextLogger);
-        //TODO nicolaken: temp hack to get it compiling with 2.2
-        throw new RuntimeException("Cannot use LocationMap intended for 2.1 with 2.2; please reconvert to Serviceable.");
-        /* uncomment
-        context.compose(m_manager);       
-        
+
+        ContainerUtil.enableLogging(context, contextLogger);
+        ContainerUtil.compose(context, new WrapperComponentManager(m_manager));
+        ContainerUtil.service(context, m_manager);
+
         final Map anchorMap = new HashMap(2);
         anchorMap.put(HINT_KEY,hint);
         context.pushMap(ANCHOR_NAME,anchorMap);
-        
+
         for (int i = 0; i < m_locatorNodes.length; i++) {
             location = m_locatorNodes[i].locate(om,context);
             if (location != null) {
@@ -231,14 +228,13 @@
             }
         }
         
-        context.dispose();
-        
+        ContainerUtil.dispose(context);
+
         if (getLogger().isDebugEnabled() && location == null) {
             getLogger().debug("No location matched request with hint " + hint);
         }
-        
+
         return location;
-        */
     }
     
     /**
@@ -259,14 +255,16 @@
      * Overide DefaultComponentManager to access the list of all
      * components.
      */
-    private static class LocationMapComponentManager extends DefaultComponentManager {
+    private static class LocationMapServiceManager extends DefaultServiceManager {
         
-        LocationMapComponentManager(ComponentManager parent) {
+        LocationMapServiceManager(ServiceManager parent) {
             super(parent);
         }
         
-        Iterator getComponents() {
-            return super.getComponentMap().values().iterator();
+        Iterator getObjects() {
+            return super.getObjectMap().values().iterator();
         }
+
     }
+
 }

Modified: forrest/trunk/src/java/org/apache/cocoon/components/modules/input/lm/LocationNode.java
==============================================================================
--- forrest/trunk/src/java/org/apache/cocoon/components/modules/input/lm/LocationNode.java	(original)
+++ forrest/trunk/src/java/org/apache/cocoon/components/modules/input/lm/LocationNode.java	Thu Sep 23 03:52:17 2004
@@ -17,14 +17,14 @@
 
 import java.util.Map;
 
-import org.apache.avalon.framework.component.ComponentManager;
+import org.apache.avalon.framework.component.WrapperComponentManager;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.cocoon.components.treeprocessor.InvokeContext;
 import org.apache.cocoon.components.treeprocessor.variables.VariableResolver;
 import org.apache.cocoon.components.treeprocessor.variables.VariableResolverFactory;
 import org.apache.cocoon.sitemap.PatternException;
-import org.apache.excalibur.source.SourceUtil;
 
 /**
  * locationmap leaf statement identifying a location.
@@ -38,44 +38,32 @@
 public class LocationNode extends AbstractNode {
 
     private final LocatorNode m_ln;
-    
+
     // the resolvable location source
     private VariableResolver m_src;
-    
-    public LocationNode(final LocatorNode ln, final ComponentManager manager) {
+
+    public LocationNode(final LocatorNode ln, final ServiceManager manager) {
         super(manager);
         m_ln = ln;
     }
-    
+
     public void build(final Configuration configuration) throws ConfigurationException {
         try {
             m_src = VariableResolverFactory.getResolver(
-                configuration.getAttribute("src"),super.m_manager);
+            		configuration.getAttribute("src"), 
+					new WrapperComponentManager(super.m_manager));
         } catch (PatternException e) {
-            final String message = "Illegal pattern syntax at for location attribute 'src' " +                "at " + configuration.getLocation();
+            final String message = "Illegal pattern syntax at for location attribute 'src'" +
+            		" at " + configuration.getLocation();
             throw new ConfigurationException(message,e);
         }
-
     }
     
     /**
      * Resolve the location string against the InvokeContext.
      */
     public String locate(Map om, InvokeContext context) throws Exception {
-        
-        String src = m_src.resolve(context,om);
-        
-        // relative, prefix with locator base
-        if (src.charAt(0) != '/' && SourceUtil.indexOfSchemeColon(src) == -1) {
-            String base = (String) context.getMapByAnchor(LocationMap.ANCHOR_NAME).get("base");
-            src =  base + (base.charAt(base.length()-1) == '/' ? "" : "/") + src;
-        }
-        
-        if (getLogger().isDebugEnabled()) {
-            getLogger().debug("location: " + src);
-        }
-        
-        return src;
+        return m_src.resolve(context, om);
     }
 
 }

Modified: forrest/trunk/src/java/org/apache/cocoon/components/modules/input/lm/LocatorNode.java
==============================================================================
--- forrest/trunk/src/java/org/apache/cocoon/components/modules/input/lm/LocatorNode.java	(original)
+++ forrest/trunk/src/java/org/apache/cocoon/components/modules/input/lm/LocatorNode.java	Thu Sep 23 03:52:17 2004
@@ -19,14 +19,15 @@
 import java.util.List;
 import java.util.Map;
 
-
-import org.apache.avalon.framework.component.ComponentManager;
+import org.apache.avalon.framework.component.WrapperComponentManager;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.cocoon.components.treeprocessor.InvokeContext;
 import org.apache.cocoon.components.treeprocessor.variables.VariableResolver;
 import org.apache.cocoon.components.treeprocessor.variables.VariableResolverFactory;
 import org.apache.cocoon.sitemap.PatternException;
+import org.apache.excalibur.source.SourceUtil;
 
 
 /**
@@ -52,29 +53,38 @@
     
     // the contained Match- and SelectNodes
     private AbstractNode[] m_nodes;
-    
-    public LocatorNode(final LocationMap lm, final ComponentManager manager) {
+
+    public LocatorNode(final LocationMap lm, final ServiceManager manager) {
         super(manager);
         m_lm = lm;
     }
     
     public void build(final Configuration configuration) throws ConfigurationException {
-        String base = configuration.getAttribute("base",".");
-        try {
-            m_baseLocation = VariableResolverFactory.getResolver(base,super.m_manager);
-        } catch (PatternException e) {
-            final String message = "Illegal pattern syntax for locator attribute 'base' " +                "at " + configuration.getLocation(); 
-            throw new ConfigurationException(message);
+    	
+    	super.build(configuration);
+
+        // get the base attribute
+        String base = configuration.getAttribute("base", null);
+        if (base != null) {
+            try {
+                m_baseLocation = VariableResolverFactory.getResolver(base, new WrapperComponentManager(super.m_manager));
+            } catch (PatternException e) {
+                final String message = "Illegal pattern syntax for locator attribute 'base'" +
+                		" at " + configuration.getLocation();
+                throw new ConfigurationException(message);
+            }
         }
+        
+        // get the child nodes
         final Configuration[] children = configuration.getChildren();
         final List nodes = new ArrayList(children.length);
         for (int i = 0; i < children.length; i++) {
             AbstractNode node = null;
             if (children[i].getName().equals("match")) {
-                node = new MatchNode(this,super.m_manager);
+                node = new MatchNode(this, super.m_manager);
             }
             else if (children[i].getName().equals("select")) {
-                node = new SelectNode(this,super.m_manager);
+                node = new SelectNode(this, super.m_manager);
             }
             else {
                 final String message = "Illegal locator node child: " 
@@ -94,14 +104,24 @@
      * non-null result.
      */
     public String locate(Map om, InvokeContext context) throws Exception {
-        
-        // resolve the base location and put it in the anchor map
-        Map anchorMap = context.getMapByAnchor(LocationMap.ANCHOR_NAME);
-        anchorMap.put("base",m_baseLocation.resolve(context,om));
-        
+
+        // resolve the base location
+    	String base = null;
+    	if (m_baseLocation != null) {
+    		base = m_baseLocation.resolve(context, om);
+        	if (base != null && base.charAt(base.length()-1) != '/') {
+        		base = base + "/";
+        	}
+    	}
+
         for (int i = 0; i < m_nodes.length; i++) {
-            final String location = m_nodes[i].locate(om,context);
+            String location = m_nodes[i].locate(om, context);
             if (location != null) {
+                if (base != null && base.length() != 0)  {
+                	if (location.charAt(0) != '/' && SourceUtil.indexOfSchemeColon(location) == -1) {
+                        location = base + location;
+                	}
+                }
                 if (getLogger().isDebugEnabled()) {
                     getLogger().debug("located: " + location);
                 }

Modified: forrest/trunk/src/java/org/apache/cocoon/components/modules/input/lm/MatchNode.java
==============================================================================
--- forrest/trunk/src/java/org/apache/cocoon/components/modules/input/lm/MatchNode.java	(original)
+++ forrest/trunk/src/java/org/apache/cocoon/components/modules/input/lm/MatchNode.java	Thu Sep 23 03:52:17 2004
@@ -19,12 +19,12 @@
 import java.util.List;
 import java.util.Map;
 
-import org.apache.avalon.framework.component.ComponentException;
-import org.apache.avalon.framework.component.ComponentManager;
-import org.apache.avalon.framework.component.ComponentSelector;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.ServiceSelector;
 import org.apache.cocoon.components.treeprocessor.InvokeContext;
 import org.apache.cocoon.matching.Matcher;
 
@@ -63,7 +63,7 @@
     // the child nodes
     private AbstractNode[] m_nodes;
     
-    public MatchNode(final LocatorNode ln, final ComponentManager manager) {
+    public MatchNode(final LocatorNode ln, final ServiceManager manager) {
         super(manager);
         m_ln = ln;
     }
@@ -75,10 +75,9 @@
         // get the matcher
         m_type = configuration.getAttribute("type",m_ln.getDefaultMatcher());
         try {
-            ComponentSelector matchers = (ComponentSelector) 
-                super.m_manager.lookup(Matcher.ROLE + "Selector");
+            ServiceSelector matchers = (ServiceSelector) super.m_manager.lookup(Matcher.ROLE + "Selector");
             m_matcher = (Matcher) matchers.select(m_type);
-        } catch (ComponentException e) {
+        } catch (ServiceException e) {
             final String message = "Unable to get Matcher of type " + m_type;
             throw new ConfigurationException(message,e);
         }
@@ -93,13 +92,13 @@
             AbstractNode node = null;
             String name = children[i].getName();
             if (name.equals("location")) {
-                node = new LocationNode(m_ln,super.m_manager);
+                node = new LocationNode(m_ln, super.m_manager);
             }
             else if (name.equals("match")) {
                 node = new MatchNode(m_ln,super.m_manager);
             }
             else if (name.equals("select")) {
-                node = new SelectNode(m_ln,super.m_manager);
+                node = new SelectNode(m_ln, super.m_manager);
             }
             else if (!name.equals("parameter")) {
                 final String message =

Modified: forrest/trunk/src/java/org/apache/cocoon/components/modules/input/lm/SelectNode.java
==============================================================================
--- forrest/trunk/src/java/org/apache/cocoon/components/modules/input/lm/SelectNode.java	(original)
+++ forrest/trunk/src/java/org/apache/cocoon/components/modules/input/lm/SelectNode.java	Thu Sep 23 03:52:17 2004
@@ -19,12 +19,12 @@
 import java.util.List;
 import java.util.Map;
 
-import org.apache.avalon.framework.component.ComponentException;
-import org.apache.avalon.framework.component.ComponentManager;
-import org.apache.avalon.framework.component.ComponentSelector;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.ServiceSelector;
 import org.apache.cocoon.components.treeprocessor.InvokeContext;
 import org.apache.cocoon.selection.Selector;
 
@@ -47,7 +47,7 @@
     private AbstractNode[] m_nodes;
     
     
-    public SelectNode(LocatorNode ln, ComponentManager manager) {
+    public SelectNode(LocatorNode ln, ServiceManager manager) {
         super(manager);
         m_ln = ln;
     }
@@ -59,10 +59,9 @@
         // get the selector
         m_type = configuration.getAttribute("type",m_ln.getDefaultSelector());
         try {
-            final ComponentSelector selectors = (ComponentSelector) 
-                super.m_manager.lookup(Selector.ROLE + "Selector");
+            final ServiceSelector selectors = (ServiceSelector) super.m_manager.lookup(Selector.ROLE + "Selector");
             m_selector = (Selector) selectors.select(m_type);
-        } catch (ComponentException e) {
+        } catch (ServiceException e) {
             final String message = "Unable to get Selector of type " + m_type;
             throw new ConfigurationException(message,e);
         }
@@ -74,13 +73,13 @@
             AbstractNode node = null;
             String name = children[i].getName();
             if (name.equals("location")) {
-                node = new LocationNode(m_ln,super.m_manager);
+                node = new LocationNode(m_ln, super.m_manager);
             } 
             else if (name.equals("match")) {
-                node = new MatchNode(m_ln,super.m_manager);
+                node = new MatchNode(m_ln, super.m_manager);
             }
             else if (name.equals("select")) {
-                node = new SelectNode(m_ln,super.m_manager);
+                node = new SelectNode(m_ln, super.m_manager);
             }
             else if (!name.equals("parameter")) {
                 final String message = "Unknown select node child:" + name;