From 249223e9f93b5806b67d66240e631cb9681dcd32 Mon Sep 17 00:00:00 2001 From: markt Date: Thu, 4 Feb 2010 23:22:24 +0000 Subject: [PATCH] Remove the Pipeline interface from ContainerBase 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 | 87 ++-------------------- java/org/apache/catalina/core/StandardHost.java | 2 +- java/org/apache/catalina/mbeans/MBeanFactory.java | 10 +-- .../org/apache/catalina/startup/ContextConfig.java | 2 +- 4 files changed, 14 insertions(+), 87 deletions(-) diff --git a/java/org/apache/catalina/core/ContainerBase.java b/java/org/apache/catalina/core/ContainerBase.java index a2bfb5c75..ccab2ace5 100644 --- a/java/org/apache/catalina/core/ContainerBase.java +++ b/java/org/apache/catalina/core/ContainerBase.java @@ -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 - * setContainer method must be called, with this Container - * as an argument. The method may throw an - * IllegalArgumentException if this Valve chooses not to - * be associated with this Container, or IllegalStateException - * 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(); } - - /** - *

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); - } - - - /** - *

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 setContainer() will be called, if it - * implements Contained, with the owning Container as an - * argument. The method may throw an IllegalArgumentException - * if this Valve chooses not to be associated with this Container, or - * IllegalStateException if it is already associated with - * a different Container.

- * - * @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(); - } - - - - } diff --git a/java/org/apache/catalina/core/StandardHost.java b/java/org/apache/catalina/core/StandardHost.java index aaa8689b6..20e6ecb32 100644 --- a/java/org/apache/catalina/core/StandardHost.java +++ b/java/org/apache/catalina/core/StandardHost.java @@ -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) { diff --git a/java/org/apache/catalina/mbeans/MBeanFactory.java b/java/org/apache/catalina/mbeans/MBeanFactory.java index 9e8922b6a..7e62ad56f 100644 --- a/java/org/apache/catalina/mbeans/MBeanFactory.java +++ b/java/org/apache/catalina/mbeans/MBeanFactory.java @@ -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]); } } } diff --git a/java/org/apache/catalina/startup/ContextConfig.java b/java/org/apache/catalina/startup/ContextConfig.java index f2d68903b..12041d821 100644 --- a/java/org/apache/catalina/startup/ContextConfig.java +++ b/java/org/apache/catalina/startup/ContextConfig.java @@ -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", -- 2.11.0