Remove the Pipeline interface from ContainerBase
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 4 Feb 2010 23:22:24 +0000 (23:22 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 4 Feb 2010 23:22:24 +0000 (23:22 +0000)
Access valves via getPipeline() rather than directly on ContainerBase

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@906727 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/core/ContainerBase.java
java/org/apache/catalina/core/StandardHost.java
java/org/apache/catalina/mbeans/MBeanFactory.java
java/org/apache/catalina/startup/ContextConfig.java

index a2bfb5c..ccab2ac 100644 (file)
@@ -122,7 +122,7 @@ import org.apache.tomcat.util.modeler.Registry;
  */
 
 public abstract class ContainerBase
-    implements Container, Lifecycle, Pipeline, MBeanRegistration {
+    implements Container, Lifecycle, MBeanRegistration {
 
     private static final org.apache.juli.logging.Log log=
         org.apache.juli.logging.LogFactory.getLog( ContainerBase.class );
@@ -1195,13 +1195,12 @@ public abstract class ContainerBase
 
 
     /**
-     * Add a new Valve to the end of the pipeline associated with this
-     * Container.  Prior to adding the Valve, the Valve's
-     * <code>setContainer</code> method must be called, with this Container
-     * as an argument.  The method may throw an
-     * <code>IllegalArgumentException</code> if this Valve chooses not to
-     * be associated with this Container, or <code>IllegalStateException</code>
-     * if it is already associated with a different Container.
+     * Convenience method, intended for use by the digester to simplify the
+     * process of adding Valves to containers. See
+     * {@link Pipeline#addValve(Valve)} for full details. Components other than
+     * the digester should use {@link #getPipeline()#addValve(Valve)} in case a
+     * future implementation provides an alternative method for the digester to
+     * use.
      *
      * @param valve Valve to be added
      *
@@ -1220,69 +1219,6 @@ public abstract class ContainerBase
     public ObjectName[] getValveObjectNames() {
         return ((StandardPipeline)pipeline).getValveObjectNames();
     }
-    
-    /**
-     * <p>Return the Valve instance that has been distinguished as the basic
-     * Valve for this Pipeline (if any).
-     */
-    public Valve getBasic() {
-
-        return (pipeline.getBasic());
-
-    }
-
-
-    /**
-     * Return the first valve in the pipeline.
-     */
-    public Valve getFirst() {
-
-        return (pipeline.getFirst());
-
-    }
-
-
-    /**
-     * Return the set of Valves in the pipeline associated with this
-     * Container, including the basic Valve (if any).  If there are no
-     * such Valves, a zero-length array is returned.
-     */
-    public Valve[] getValves() {
-
-        return (pipeline.getValves());
-
-    }
-
-
-    /**
-     * Remove the specified Valve from the pipeline associated with this
-     * Container, if it is found; otherwise, do nothing.
-     *
-     * @param valve Valve to be removed
-     */
-    public synchronized void removeValve(Valve valve) {
-
-        pipeline.removeValve(valve);
-    }
-
-
-    /**
-     * <p>Set the Valve instance that has been distinguished as the basic
-     * Valve for this Pipeline (if any).  Prior to setting the basic Valve,
-     * the Valve's <code>setContainer()</code> will be called, if it
-     * implements <code>Contained</code>, with the owning Container as an
-     * argument.  The method may throw an <code>IllegalArgumentException</code>
-     * if this Valve chooses not to be associated with this Container, or
-     * <code>IllegalStateException</code> if it is already associated with
-     * a different Container.</p>
-     *
-     * @param valve Valve to be distinguished as the basic Valve
-     */
-    public void setBasic(Valve valve) {
-
-        pipeline.setBasic(valve);
-
-    }
 
 
     /**
@@ -1612,13 +1548,4 @@ public abstract class ContainerBase
 
     }
 
-
-    @Override
-    public boolean isAsyncSupported() {
-        return pipeline.isAsyncSupported();
-    }
-    
-    
-
-
 }
index aaa8689..20e6ecb 100644 (file)
@@ -752,7 +752,7 @@ public class StandardHost
                     if(!found) {               
                         Valve valve = (Valve) Class.forName(errorReportValveClass)
                         .newInstance();
-                        addValve(valve);
+                        getPipeline().addValve(valve);
                         errorReportValveObjectName = ((ValveBase)valve).getObjectName() ;
                     }
             } catch (Throwable t) {
index 9e8922b..7e62ad5 100644 (file)
@@ -248,7 +248,7 @@ public class MBeanFactory extends BaseModelMBean {
         AccessLogValve accessLogger = new AccessLogValve();
         ContainerBase containerBase = getParentContainerFromParent(pname);
         // Add the new instance to its parent component
-        containerBase.addValve(accessLogger);
+        containerBase.getPipeline().addValve(accessLogger);
         ObjectName oname = accessLogger.getObjectName();
         return (oname.toString());
 
@@ -481,7 +481,7 @@ public class MBeanFactory extends BaseModelMBean {
         // Add the new instance to its parent component
         ObjectName pname = new ObjectName(parent);
         ContainerBase containerBase = getParentContainerFromParent(pname);
-        containerBase.addValve(valve);
+        containerBase.getPipeline().addValve(valve);
         ObjectName oname = valve.getObjectName();
         return (oname.toString());
 
@@ -504,7 +504,7 @@ public class MBeanFactory extends BaseModelMBean {
         // Add the new instance to its parent component
         ObjectName pname = new ObjectName(parent);
         ContainerBase containerBase = getParentContainerFromParent(pname);
-        containerBase.addValve(valve);
+        containerBase.getPipeline().addValve(valve);
         ObjectName oname = valve.getObjectName();
         return (oname.toString());
         
@@ -527,7 +527,7 @@ public class MBeanFactory extends BaseModelMBean {
         // Add the new instance to its parent component
         ObjectName pname = new ObjectName(parent);
         ContainerBase containerBase = getParentContainerFromParent(pname);
-        containerBase.addValve(valve);
+        containerBase.getPipeline().addValve(valve);
         ObjectName oname = valve.getObjectName();
         return (oname.toString());
 
@@ -961,7 +961,7 @@ public class MBeanFactory extends BaseModelMBean {
         for (int i = 0; i < valves.length; i++) {
             ObjectName voname = ((ValveBase) valves[i]).getObjectName();
             if (voname.equals(oname)) {
-                container.removeValve(valves[i]);
+                container.getPipeline().removeValve(valves[i]);
             }
         }
     }
index f2d6890..12041d8 100644 (file)
@@ -421,7 +421,7 @@ public class ContextConfig
         if (authenticator != null && context instanceof ContainerBase) {
             Pipeline pipeline = ((ContainerBase) context).getPipeline();
             if (pipeline != null) {
-                ((ContainerBase) context).addValve(authenticator);
+                ((ContainerBase) context).getPipeline().addValve(authenticator);
                 if (log.isDebugEnabled()) {
                     log.debug(sm.getString(
                                     "contextConfig.authenticatorConfigured",