You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by cr...@locus.apache.org on 2000/04/10 22:01:41 UTC
cvs commit: jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/valves AccessLogValve.java InterceptorValve.java
craigmcc 00/04/10 13:01:41
Modified: proposals/catalina/src/share/org/apache/tomcat/connector/http
HttpConnector.java HttpProcessor.java
proposals/catalina/src/share/org/apache/tomcat/core
ContainerBase.java StandardLoader.java
StandardResources.java
proposals/catalina/src/share/org/apache/tomcat/logger
FileLogger.java
proposals/catalina/src/share/org/apache/tomcat/security
SecurityValve.java
proposals/catalina/src/share/org/apache/tomcat/session
FileStore.java StandardManager.java
proposals/catalina/src/share/org/apache/tomcat/valves
AccessLogValve.java InterceptorValve.java
Added: proposals/catalina/src/share/org/apache/tomcat/util
LifecycleSupport.java
Log:
Bring all current Catalina components up to date with respect to the
new support for Lifecycle events. Uses a common support class modelled on
the PropertyChangeSupport for JavaBeans.
Revision Changes Path
1.2 +37 -2 jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http/HttpConnector.java
Index: HttpConnector.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http/HttpConnector.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- HttpConnector.java 2000/02/20 02:57:10 1.1
+++ HttpConnector.java 2000/04/10 20:01:36 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http/HttpConnector.java,v 1.1 2000/02/20 02:57:10 craigmcc Exp $
- * $Revision: 1.1 $
- * $Date: 2000/02/20 02:57:10 $
+ * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http/HttpConnector.java,v 1.2 2000/04/10 20:01:36 craigmcc Exp $
+ * $Revision: 1.2 $
+ * $Date: 2000/04/10 20:01:36 $
*
* ====================================================================
*
@@ -72,11 +72,14 @@
import org.apache.tomcat.Connector;
import org.apache.tomcat.Container;
import org.apache.tomcat.Lifecycle;
+import org.apache.tomcat.LifecycleEvent;
import org.apache.tomcat.LifecycleException;
+import org.apache.tomcat.LifecycleListener;
import org.apache.tomcat.Logger;
import org.apache.tomcat.Request;
import org.apache.tomcat.Response;
import org.apache.tomcat.connector.ConnectorBase;
+import org.apache.tomcat.util.LifecycleSupport;
import org.apache.tomcat.util.StringManager;
@@ -108,6 +111,12 @@
/**
+ * The lifecycle event support for this component.
+ */
+ protected LifecycleSupport lifecycle = new LifecycleSupport(this);
+
+
+ /**
* The maximum number of processors allowed, or <0 for unlimited.
*/
private int maxProcessors = -1;
@@ -482,6 +491,30 @@
/**
+ * Add a lifecycle event listener to this component.
+ *
+ * @param listener The listener to add
+ */
+ public void addLifecycleListener(LifecycleListener listener) {
+
+ lifecycle.addLifecycleListener(listener);
+
+ }
+
+
+ /**
+ * Remove a lifecycle event listener from this component.
+ *
+ * @param listener The listener to add
+ */
+ public void removeLifecycleListener(LifecycleListener listener) {
+
+ lifecycle.removeLifecycleListener(listener);
+
+ }
+
+
+ /**
* Begin processing requests via this Connector.
*
* @exception LifecycleException if a fatal startup error occurs
@@ -493,6 +526,7 @@
throw new LifecycleException
(sm.getString("httpConnector.alreadyStarted"));
started = true;
+ lifecycle.fireLifecycleEvent(START_EVENT, null);
// Establish a server socket on the specified port
try {
@@ -519,6 +553,7 @@
throw new LifecycleException
(sm.getString("httpConnector.notStarted"));
started = false;
+ lifecycle.fireLifecycleEvent(STOP_EVENT, null);
// Gracefully shut down all processors we have created
; // FIXME
1.2 +38 -3 jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http/HttpProcessor.java
Index: HttpProcessor.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http/HttpProcessor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- HttpProcessor.java 2000/02/20 02:57:10 1.1
+++ HttpProcessor.java 2000/04/10 20:01:36 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http/HttpProcessor.java,v 1.1 2000/02/20 02:57:10 craigmcc Exp $
- * $Revision: 1.1 $
- * $Date: 2000/02/20 02:57:10 $
+ * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/http/HttpProcessor.java,v 1.2 2000/04/10 20:01:36 craigmcc Exp $
+ * $Revision: 1.2 $
+ * $Date: 2000/04/10 20:01:36 $
*
* ====================================================================
*
@@ -70,9 +70,12 @@
import org.apache.tomcat.Connector;
import org.apache.tomcat.Container;
import org.apache.tomcat.Lifecycle;
+import org.apache.tomcat.LifecycleEvent;
import org.apache.tomcat.LifecycleException;
+import org.apache.tomcat.LifecycleListener;
import org.apache.tomcat.Request;
import org.apache.tomcat.Response;
+import org.apache.tomcat.util.LifecycleSupport;
import org.apache.tomcat.util.StringManager;
@@ -84,7 +87,7 @@
* the request. When the processor is completed, it will recycle itself.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.1 $ $Date: 2000/02/20 02:57:10 $
+ * @version $Revision: 1.2 $ $Date: 2000/04/10 20:01:36 $
*/
final class HttpProcessor
@@ -116,6 +119,12 @@
private HttpConnector connector = null;
+ /**
+ * The lifecycle event support for this component.
+ */
+ private LifecycleSupport lifecycle = new LifecycleSupport(this);
+
+
// -------------------------------------------------------- Package Methods
@@ -139,12 +148,37 @@
/**
+ * Add a lifecycle event listener to this component.
+ *
+ * @param listener The listener to add
+ */
+ public void addLifecycleListener(LifecycleListener listener) {
+
+ lifecycle.addLifecycleListener(listener);
+
+ }
+
+
+ /**
+ * Remove a lifecycle event listener from this component.
+ *
+ * @param listener The listener to add
+ */
+ public void removeLifecycleListener(LifecycleListener listener) {
+
+ lifecycle.removeLifecycleListener(listener);
+
+ }
+
+
+ /**
* Start the background thread we will use for request processing.
*
* @exception LifecycleException if a fatal startup error occurs
*/
public void start() throws LifecycleException {
+ lifecycle.fireLifecycleEvent(START_EVENT, null);
; // FIXME: start()
}
@@ -157,6 +191,7 @@
*/
public void stop() throws LifecycleException {
+ lifecycle.fireLifecycleEvent(STOP_EVENT, null);
; // FIXME: stop()
}
1.9 +11 -31 jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/ContainerBase.java
Index: ContainerBase.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/ContainerBase.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ContainerBase.java 2000/04/10 18:44:41 1.8
+++ ContainerBase.java 2000/04/10 20:01:37 1.9
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/ContainerBase.java,v 1.8 2000/04/10 18:44:41 craigmcc Exp $
- * $Revision: 1.8 $
- * $Date: 2000/04/10 18:44:41 $
+ * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/ContainerBase.java,v 1.9 2000/04/10 20:01:37 craigmcc Exp $
+ * $Revision: 1.9 $
+ * $Date: 2000/04/10 20:01:37 $
*
* ====================================================================
*
@@ -88,6 +88,7 @@
import org.apache.tomcat.Resources;
import org.apache.tomcat.Response;
import org.apache.tomcat.Valve;
+import org.apache.tomcat.util.LifecycleSupport;
import org.apache.tomcat.util.StringManager;
@@ -148,7 +149,7 @@
* class comments of the implementation class.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.8 $ $Date: 2000/04/10 18:44:41 $
+ * @version $Revision: 1.9 $ $Date: 2000/04/10 20:01:37 $
*/
public abstract class ContainerBase
@@ -177,9 +178,9 @@
/**
- * The lifecycle event listeners for this Container.
+ * The lifecycle event support for this component.
*/
- protected Vector lifecycles = new Vector();
+ protected LifecycleSupport lifecycle = new LifecycleSupport(this);
/**
@@ -719,7 +720,7 @@
*/
public void addLifecycleListener(LifecycleListener listener) {
- lifecycles.addElement(listener);
+ lifecycle.addLifecycleListener(listener);
}
@@ -731,7 +732,7 @@
*/
public void removeLifecycleListener(LifecycleListener listener) {
- listeners.removeElement(listener);
+ lifecycle.removeLifecycleListener(listener);
}
@@ -751,7 +752,7 @@
throw new LifecycleException
(sm.getString("containerBase.alreadyStarted"));
started = true;
- fireLifecycleEvent(START_EVENT, null);
+ lifecycle.fireLifecycleEvent(START_EVENT, null);
// Start our subordinate components, if any
if ((loader != null) && (loader instanceof Lifecycle))
@@ -790,7 +791,7 @@
throw new LifecycleException
(sm.getString("containerBase.notStarted"));
started = false;
- fireLifecycleEvent(STOP_EVENT, null);
+ lifecycle.fireLifecycleEvent(STOP_EVENT, null);
// Stop the Valves in our pipeline (including the basic), if any
Valve current = basic;
@@ -942,27 +943,6 @@
}
for (int i = 0; i < list.size(); i++)
((ContainerListener) list.elementAt(i)).containerEvent(event);
-
- }
-
-
- /**
- * Notify all lifecycle event listeners that a particular event has
- * occurred for this Container. The default implementation performs
- * this notification synchronously using the calling thread.
- *
- * @param type Event type
- * @param data Event data
- */
- protected void fireLifecycleEvent(String type, Object data) {
-
- LifecycleEvent event = new LifecycleEvent(this, type, data);
- Vector list = null;
- synchronized (this) {
- list = (Vector) listeners.clone();
- }
- for (int i = 0; i < list.size(); i++)
- ((LifecycleListener) list.elementAt(i)).lifecycleEvent(event);
}
1.3 +39 -5 jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardLoader.java
Index: StandardLoader.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardLoader.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- StandardLoader.java 2000/02/09 05:10:08 1.2
+++ StandardLoader.java 2000/04/10 20:01:37 1.3
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardLoader.java,v 1.2 2000/02/09 05:10:08 craigmcc Exp $
- * $Revision: 1.2 $
- * $Date: 2000/02/09 05:10:08 $
+ * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardLoader.java,v 1.3 2000/04/10 20:01:37 craigmcc Exp $
+ * $Revision: 1.3 $
+ * $Date: 2000/04/10 20:01:37 $
*
* ====================================================================
*
@@ -75,9 +75,12 @@
import java.util.zip.ZipFile;
import org.apache.tomcat.Container;
import org.apache.tomcat.Lifecycle;
+import org.apache.tomcat.LifecycleEvent;
import org.apache.tomcat.LifecycleException;
+import org.apache.tomcat.LifecycleListener;
import org.apache.tomcat.Loader;
import org.apache.tomcat.loader.AdaptiveClassLoader;
+import org.apache.tomcat.util.LifecycleSupport;
import org.apache.tomcat.util.StringManager;
@@ -94,7 +97,7 @@
* is not present, the system class loader will be used instead.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.2 $ $Date: 2000/02/09 05:10:08 $
+ * @version $Revision: 1.3 $ $Date: 2000/04/10 20:01:37 $
*/
public final class StandardLoader
@@ -124,6 +127,12 @@
/**
+ * The lifecycle event support for this component.
+ */
+ protected LifecycleSupport lifecycle = new LifecycleSupport(this);
+
+
+ /**
* The set of class repositories for this class loader. The contents of
* this list must be directories, JAR files, and ZIP files that contain
* the classes to be loaded by this class loader.
@@ -304,6 +313,30 @@
/**
+ * Add a lifecycle event listener to this component.
+ *
+ * @param listener The listener to add
+ */
+ public void addLifecycleListener(LifecycleListener listener) {
+
+ lifecycle.addLifecycleListener(listener);
+
+ }
+
+
+ /**
+ * Remove a lifecycle event listener from this component.
+ *
+ * @param listener The listener to remove
+ */
+ public void removeLifecycleListener(LifecycleListener listener) {
+
+ lifecycle.removeLifecycleListener(listener);
+
+ }
+
+
+ /**
* Start this component, initializing our associated class loader.
*
* @exception LifecycleException if a lifecycle error occurs
@@ -315,6 +348,7 @@
throw new LifecycleException
(sm.getString("standardLoader.alreadyStarted"));
started = true;
+ lifecycle.fireLifecycleEvent(START_EVENT, null);
// Validate the specified repositories
Vector files = new Vector();
@@ -361,6 +395,7 @@
throw new LifecycleException
(sm.getString("standardLoader.notStarted"));
started = false;
+ lifecycle.fireLifecycleEvent(STOP_EVENT, null);
// Throw away our current class loader
classLoader = null;
@@ -405,4 +440,3 @@
}
-
1.4 +42 -4 jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardResources.java
Index: StandardResources.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardResources.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- StandardResources.java 2000/01/29 07:46:34 1.3
+++ StandardResources.java 2000/04/10 20:01:37 1.4
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardResources.java,v 1.3 2000/01/29 07:46:34 craigmcc Exp $
- * $Revision: 1.3 $
- * $Date: 2000/01/29 07:46:34 $
+ * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardResources.java,v 1.4 2000/04/10 20:01:37 craigmcc Exp $
+ * $Revision: 1.4 $
+ * $Date: 2000/04/10 20:01:37 $
*
* ====================================================================
*
@@ -72,11 +72,15 @@
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.Vector;
import org.apache.tomcat.Container;
import org.apache.tomcat.Context;
import org.apache.tomcat.Lifecycle;
+import org.apache.tomcat.LifecycleEvent;
import org.apache.tomcat.LifecycleException;
+import org.apache.tomcat.LifecycleListener;
import org.apache.tomcat.Resources;
+import org.apache.tomcat.util.LifecycleSupport;
import org.apache.tomcat.util.StringManager;
import org.apache.tomcat.util.URLUtil;
@@ -86,7 +90,7 @@
* requests are resolved against the document base URL that is configured.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.3 $ $Date: 2000/01/29 07:46:34 $
+ * @version $Revision: 1.4 $ $Date: 2000/04/10 20:01:37 $
*/
public final class StandardResources
@@ -130,6 +134,12 @@
/**
+ * The lifecycle event support for this component.
+ */
+ protected LifecycleSupport lifecycle = new LifecycleSupport(this);
+
+
+ /**
* The string manager for this package.
*/
private StringManager sm = StringManager.getManager(Constants.Package);
@@ -376,6 +386,30 @@
/**
+ * Add a lifecycle event listener to this component.
+ *
+ * @param listener The listener to add
+ */
+ public void addLifecycleListener(LifecycleListener listener) {
+
+ lifecycle.addLifecycleListener(listener);
+
+ }
+
+
+ /**
+ * Remove a lifecycle event listener from this component.
+ *
+ * @param listener The listener to remove
+ */
+ public void removeLifecycleListener(LifecycleListener listener) {
+
+ lifecycle.removeLifecycleListener(listener);
+
+ }
+
+
+ /**
* Prepare for the beginning of active use of the public methods of this
* component. This method should be called after <code>configure()</code>,
* and before any of the public methods of the component are utilized.
@@ -392,6 +426,7 @@
throw new LifecycleException
(sm.getString("standardResources.alreadyStarted"));
started = true;
+ lifecycle.fireLifecycleEvent(START_EVENT, null);
}
@@ -411,6 +446,9 @@
if (!started)
throw new LifecycleException
(sm.getString("standardResources.notStarted"));
+
+ started = false;
+ lifecycle.fireLifecycleEvent(STOP_EVENT, null);
}
1.5 +39 -6 jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/logger/FileLogger.java
Index: FileLogger.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/logger/FileLogger.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- FileLogger.java 2000/01/30 02:25:34 1.4
+++ FileLogger.java 2000/04/10 20:01:38 1.5
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/logger/FileLogger.java,v 1.4 2000/01/30 02:25:34 craigmcc Exp $
- * $Revision: 1.4 $
- * $Date: 2000/01/30 02:25:34 $
+ * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/logger/FileLogger.java,v 1.5 2000/04/10 20:01:38 craigmcc Exp $
+ * $Revision: 1.5 $
+ * $Date: 2000/04/10 20:01:38 $
*
* ====================================================================
*
@@ -71,10 +71,11 @@
import java.io.PrintWriter;
import java.sql.Timestamp;
import org.apache.tomcat.Lifecycle;
+import org.apache.tomcat.LifecycleEvent;
import org.apache.tomcat.LifecycleException;
+import org.apache.tomcat.LifecycleListener;
+import org.apache.tomcat.util.LifecycleSupport;
import org.apache.tomcat.util.StringManager;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
/**
@@ -83,7 +84,7 @@
* optional preceding timestamp.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.4 $ $Date: 2000/01/30 02:25:34 $
+ * @version $Revision: 1.5 $ $Date: 2000/04/10 20:01:38 $
*/
public final class FileLogger
@@ -115,6 +116,12 @@
/**
+ * The lifecycle event support for this component.
+ */
+ protected LifecycleSupport lifecycle = new LifecycleSupport(this);
+
+
+ /**
* The prefix that is added to log file filenames.
*/
private String prefix = "tomcat.";
@@ -334,6 +341,30 @@
/**
+ * Add a lifecycle event listener to this component.
+ *
+ * @param listener The listener to add
+ */
+ public void addLifecycleListener(LifecycleListener listener) {
+
+ lifecycle.addLifecycleListener(listener);
+
+ }
+
+
+ /**
+ * Remove a lifecycle event listener from this component.
+ *
+ * @param listener The listener to add
+ */
+ public void removeLifecycleListener(LifecycleListener listener) {
+
+ lifecycle.removeLifecycleListener(listener);
+
+ }
+
+
+ /**
* Prepare for the beginning of active use of the public methods of this
* component. This method should be called after <code>configure()</code>,
* and before any of the public methods of the component are utilized.
@@ -350,6 +381,7 @@
throw new LifecycleException
(sm.getString("fileLogger.alreadyStarted"));
started = true;
+ lifecycle.fireLifecycleEvent(START_EVENT, null);
}
@@ -370,6 +402,7 @@
throw new LifecycleException
(sm.getString("fileLogger.notStarted"));
started = false;
+ lifecycle.fireLifecycleEvent(STOP_EVENT, null);
close();
1.5 +40 -4 jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/security/SecurityValve.java
Index: SecurityValve.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/security/SecurityValve.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SecurityValve.java 2000/02/13 01:43:47 1.4
+++ SecurityValve.java 2000/04/10 20:01:39 1.5
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/security/SecurityValve.java,v 1.4 2000/02/13 01:43:47 craigmcc Exp $
- * $Revision: 1.4 $
- * $Date: 2000/02/13 01:43:47 $
+ * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/security/SecurityValve.java,v 1.5 2000/04/10 20:01:39 craigmcc Exp $
+ * $Revision: 1.5 $
+ * $Date: 2000/04/10 20:01:39 $
*
* ====================================================================
*
@@ -68,18 +68,22 @@
import java.io.IOException;
import java.security.Principal;
import java.util.Enumeration;
+import java.util.Vector;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletResponse;
import org.apache.tomcat.Container;
import org.apache.tomcat.Context;
import org.apache.tomcat.Lifecycle;
+import org.apache.tomcat.LifecycleEvent;
import org.apache.tomcat.LifecycleException;
+import org.apache.tomcat.LifecycleListener;
import org.apache.tomcat.Realm;
import org.apache.tomcat.Request;
import org.apache.tomcat.Response;
import org.apache.tomcat.Valve;
import org.apache.tomcat.deploy.LoginConfig;
import org.apache.tomcat.deploy.SecurityConstraint;
+import org.apache.tomcat.util.LifecycleSupport;
import org.apache.tomcat.util.StringManager;
import org.apache.tomcat.valves.ValveBase;
@@ -106,7 +110,7 @@
* </ul>
*
* @author Craig R. McClanahan
- * @version $Revision: 1.4 $ $Date: 2000/02/13 01:43:47 $
+ * @version $Revision: 1.5 $ $Date: 2000/04/10 20:01:39 $
*/
@@ -132,6 +136,12 @@
/**
+ * The lifecycle event support for this component.
+ */
+ protected LifecycleSupport lifecycle = new LifecycleSupport(this);
+
+
+ /**
* The string manager for this package.
*/
private StringManager sm =
@@ -417,6 +427,30 @@
/**
+ * Add a lifecycle event listener to this component.
+ *
+ * @param listener The listener to add
+ */
+ public void addLifecycleListener(LifecycleListener listener) {
+
+ lifecycle.addLifecycleListener(listener);
+
+ }
+
+
+ /**
+ * Remove a lifecycle event listener from this component.
+ *
+ * @param listener The listener to remove
+ */
+ public void removeLifecycleListener(LifecycleListener listener) {
+
+ lifecycle.removeLifecycleListener(listener);
+
+ }
+
+
+ /**
* Prepare for the beginning of active use of the public methods of this
* component. This method should be called after <code>configure()</code>,
* and before any of the public methods of the component are utilized.
@@ -433,6 +467,7 @@
throw new LifecycleException
(sm.getString("securityValve.alreadyStarted"));
started = true;
+ lifecycle.fireLifecycleEvent(START_EVENT, null);
}
@@ -453,6 +488,7 @@
throw new LifecycleException
(sm.getString("securityValve.notStarted"));
started = false;
+ lifecycle.fireLifecycleEvent(STOP_EVENT, null);
}
1.4 +39 -4 jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/session/FileStore.java
Index: FileStore.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/session/FileStore.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FileStore.java 2000/01/29 07:46:35 1.3
+++ FileStore.java 2000/04/10 20:01:39 1.4
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/session/FileStore.java,v 1.3 2000/01/29 07:46:35 craigmcc Exp $
- * $Revision: 1.3 $
- * $Date: 2000/01/29 07:46:35 $
+ * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/session/FileStore.java,v 1.4 2000/04/10 20:01:39 craigmcc Exp $
+ * $Revision: 1.4 $
+ * $Date: 2000/04/10 20:01:39 $
*
* ====================================================================
*
@@ -81,9 +81,12 @@
import java.util.Hashtable;
import java.util.Vector;
import org.apache.tomcat.Lifecycle;
+import org.apache.tomcat.LifecycleEvent;
import org.apache.tomcat.LifecycleException;
+import org.apache.tomcat.LifecycleListener;
import org.apache.tomcat.Session;
import org.apache.tomcat.Store;
+import org.apache.tomcat.util.LifecycleSupport;
import org.apache.tomcat.util.StringManager;
@@ -93,7 +96,7 @@
* saved are still subject to being expired based on inactivity.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.3 $ $Date: 2000/01/29 07:46:35 $
+ * @version $Revision: 1.4 $ $Date: 2000/04/10 20:01:39 $
*/
public final class FileStore
@@ -123,6 +126,12 @@
/**
+ * The lifecycle event support for this component.
+ */
+ protected LifecycleSupport lifecycle = new LifecycleSupport(this);
+
+
+ /**
* The string manager for this package.
*/
private StringManager sm =
@@ -331,6 +340,30 @@
/**
+ * Add a lifecycle event listener to this component.
+ *
+ * @param listener The listener to add
+ */
+ public void addLifecycleListener(LifecycleListener listener) {
+
+ lifecycle.addLifecycleListener(listener);
+
+ }
+
+
+ /**
+ * Remove a lifecycle event listener from this component.
+ *
+ * @param listener The listener to add
+ */
+ public void removeLifecycleListener(LifecycleListener listener) {
+
+ lifecycle.removeLifecycleListener(listener);
+
+ }
+
+
+ /**
* Prepare for the beginning of active use of the public methods of this
* component. This method should be called after <code>configure()</code>,
* and before any of the public methods of the component are utilized.
@@ -347,6 +380,7 @@
throw new LifecycleException
(sm.getString("fileStore.alreadyStarted"));
started = true;
+ lifecycle.fireLifecycleEvent(START_EVENT, null);
// Start the background reaper thread
threadStart();
@@ -370,6 +404,7 @@
throw new LifecycleException
(sm.getString("fileStore.notStarted"));
started = false;
+ lifecycle.fireLifecycleEvent(STOP_EVENT, null);
// Stop the background reaper thread
threadStop();
1.5 +39 -4 jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/session/StandardManager.java
Index: StandardManager.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/session/StandardManager.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- StandardManager.java 2000/01/31 05:29:04 1.4
+++ StandardManager.java 2000/04/10 20:01:39 1.5
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/session/StandardManager.java,v 1.4 2000/01/31 05:29:04 craigmcc Exp $
- * $Revision: 1.4 $
- * $Date: 2000/01/31 05:29:04 $
+ * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/session/StandardManager.java,v 1.5 2000/04/10 20:01:39 craigmcc Exp $
+ * $Revision: 1.5 $
+ * $Date: 2000/04/10 20:01:39 $
*
* ====================================================================
*
@@ -78,10 +78,13 @@
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpSession;
import org.apache.tomcat.Lifecycle;
+import org.apache.tomcat.LifecycleEvent;
import org.apache.tomcat.LifecycleException;
+import org.apache.tomcat.LifecycleListener;
import org.apache.tomcat.Manager;
import org.apache.tomcat.Request;
import org.apache.tomcat.Session;
+import org.apache.tomcat.util.LifecycleSupport;
import org.apache.tomcat.util.StringManager;
@@ -96,7 +99,7 @@
* <code>stop()</code> methods of this class at the correct times.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.4 $ $Date: 2000/01/31 05:29:04 $
+ * @version $Revision: 1.5 $ $Date: 2000/04/10 20:01:39 $
*/
public final class StandardManager
@@ -120,6 +123,12 @@
/**
+ * The lifecycle event support for this component.
+ */
+ protected LifecycleSupport lifecycle = new LifecycleSupport(this);
+
+
+ /**
* The maximum number of active Sessions allowed, or -1 for no limit.
*/
private int maxActiveSessions = -1;
@@ -287,6 +296,30 @@
/**
+ * Add a lifecycle event listener to this component.
+ *
+ * @param listener The listener to add
+ */
+ public void addLifecycleListener(LifecycleListener listener) {
+
+ lifecycle.addLifecycleListener(listener);
+
+ }
+
+
+ /**
+ * Remove a lifecycle event listener from this component.
+ *
+ * @param listener The listener to remove
+ */
+ public void removeLifecycleListener(LifecycleListener listener) {
+
+ lifecycle.removeLifecycleListener(listener);
+
+ }
+
+
+ /**
* Prepare for the beginning of active use of the public methods of this
* component. This method should be called after <code>configure()</code>,
* and before any of the public methods of the component are utilized.
@@ -303,6 +336,7 @@
throw new LifecycleException
(sm.getString("standardManager.alreadyStarted"));
started = true;
+ lifecycle.fireLifecycleEvent(START_EVENT, null);
// Load any previously persisted sessions
load();
@@ -329,6 +363,7 @@
throw new LifecycleException
(sm.getString("standardManager.notStarted"));
started = false;
+ lifecycle.fireLifecycleEvent(STOP_EVENT, null);
// Stop the background reaper thread
threadStop();
1.1 jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/util/LifecycleSupport.java
Index: LifecycleSupport.java
===================================================================
/*
* $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/util/LifecycleSupport.java,v 1.1 2000/04/10 20:01:40 craigmcc Exp $
* $Revision: 1.1 $
* $Date: 2000/04/10 20:01:40 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* [Additional notices, if required by prior licensing conditions]
*
*/
package org.apache.tomcat.util;
import java.util.Vector;
import org.apache.tomcat.Lifecycle;
import org.apache.tomcat.LifecycleEvent;
import org.apache.tomcat.LifecycleListener;
/**
* Support class to assist in firing LifecycleEvent notifications to
* registered LifecycleListeners.
*
* @author Craig R. McClanahan
* @version $Id: LifecycleSupport.java,v 1.1 2000/04/10 20:01:40 craigmcc Exp $
*/
public final class LifecycleSupport {
// ----------------------------------------------------------- Constructors
/**
* Construct a new LifecycleSupport object associated with the specified
* Lifecycle component.
*
* @param lifecycle The Lifecycle component that will be the source
* of events that we fire
*/
public LifecycleSupport(Lifecycle lifecycle) {
super();
this.lifecycle = lifecycle;
}
// ----------------------------------------------------- Instance Variables
/**
* The source component for lifecycle events that we will fire.
*/
private Lifecycle lifecycle = null;
/**
* The set of registered LifecycleListeners for event notifications.
*/
private Vector listeners = new Vector();
// --------------------------------------------------------- Public Methods
/**
* Add a lifecycle event listener to this component.
*
* @param listener The listener to add
*/
public void addLifecycleListener(LifecycleListener listener) {
listeners.addElement(listener);
}
/**
* Notify all lifecycle event listeners that a particular event has
* occurred for this Container. The default implementation performs
* this notification synchronously using the calling thread.
*
* @param type Event type
* @param data Event data
*/
public void fireLifecycleEvent(String type, Object data) {
LifecycleEvent event = new LifecycleEvent(lifecycle, type, data);
Vector list = null;
synchronized (this) {
list = (Vector) listeners.clone();
}
for (int i = 0; i < list.size(); i++)
((LifecycleListener) list.elementAt(i)).lifecycleEvent(event);
}
/**
* Remove a lifecycle event listener from this component.
*
* @param listener The listener to remove
*/
public void removeLifecycleListener(LifecycleListener listener) {
listeners.removeElement(listener);
}
}
1.3 +36 -1 jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/valves/AccessLogValve.java
Index: AccessLogValve.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/valves/AccessLogValve.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AccessLogValve.java 2000/01/31 04:38:45 1.2
+++ AccessLogValve.java 2000/04/10 20:01:41 1.3
@@ -68,9 +68,12 @@
import java.sql.Timestamp;
import javax.servlet.ServletException;
import org.apache.tomcat.Lifecycle;
+import org.apache.tomcat.LifecycleEvent;
import org.apache.tomcat.LifecycleException;
+import org.apache.tomcat.LifecycleListener;
import org.apache.tomcat.Request;
import org.apache.tomcat.Response;
+import org.apache.tomcat.util.LifecycleSupport;
import org.apache.tomcat.util.StringManager;
@@ -114,7 +117,7 @@
* can be implemented.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.2 $ $Date: 2000/01/31 04:38:45 $
+ * @version $Revision: 1.3 $ $Date: 2000/04/10 20:01:41 $
*/
public final class AccessLogValve
@@ -160,6 +163,12 @@
/**
+ * The lifecycle event support for this component.
+ */
+ protected LifecycleSupport lifecycle = new LifecycleSupport(this);
+
+
+ /**
* The set of month abbreviations for log messages.
*/
protected static final String months[] =
@@ -521,6 +530,30 @@
/**
+ * Add a lifecycle event listener to this component.
+ *
+ * @param listener The listener to add
+ */
+ public void addLifecycleListener(LifecycleListener listener) {
+
+ lifecycle.addLifecycleListener(listener);
+
+ }
+
+
+ /**
+ * Remove a lifecycle event listener from this component.
+ *
+ * @param listener The listener to add
+ */
+ public void removeLifecycleListener(LifecycleListener listener) {
+
+ lifecycle.removeLifecycleListener(listener);
+
+ }
+
+
+ /**
* Prepare for the beginning of active use of the public methods of this
* component. This method should be called after <code>configure()</code>,
* and before any of the public methods of the component are utilized.
@@ -537,6 +570,7 @@
throw new LifecycleException
(sm.getString("accessLogValve.alreadyStarted"));
started = true;
+ lifecycle.fireLifecycleEvent(START_EVENT, null);
}
@@ -557,6 +591,7 @@
throw new LifecycleException
(sm.getString("accessLogValve.notStarted"));
started = false;
+ lifecycle.fireLifecycleEvent(STOP_EVENT, null);
close();
1.2 +39 -4 jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/valves/InterceptorValve.java
Index: InterceptorValve.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/valves/InterceptorValve.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- InterceptorValve.java 2000/01/31 04:38:46 1.1
+++ InterceptorValve.java 2000/04/10 20:01:41 1.2
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/valves/InterceptorValve.java,v 1.1 2000/01/31 04:38:46 craigmcc Exp $
- * $Revision: 1.1 $
- * $Date: 2000/01/31 04:38:46 $
+ * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/valves/InterceptorValve.java,v 1.2 2000/04/10 20:01:41 craigmcc Exp $
+ * $Revision: 1.2 $
+ * $Date: 2000/04/10 20:01:41 $
*
* ====================================================================
*
@@ -72,10 +72,13 @@
import org.apache.tomcat.Container;
import org.apache.tomcat.Interceptor;
import org.apache.tomcat.Lifecycle;
+import org.apache.tomcat.LifecycleEvent;
import org.apache.tomcat.LifecycleException;
+import org.apache.tomcat.LifecycleListener;
import org.apache.tomcat.Request;
import org.apache.tomcat.Response;
import org.apache.tomcat.Valve;
+import org.apache.tomcat.util.LifecycleSupport;
import org.apache.tomcat.util.StringManager;
@@ -98,7 +101,7 @@
* <ul>
*
* @author Craig R. McClanahan
- * @version $Revision: 1.1 $ $Date: 2000/01/31 04:38:46 $
+ * @version $Revision: 1.2 $ $Date: 2000/04/10 20:01:41 $
*/
public final class InterceptorValve
@@ -123,6 +126,12 @@
/**
+ * The lifecycle event support for this component.
+ */
+ protected LifecycleSupport lifecycle = new LifecycleSupport(this);
+
+
+ /**
* The StringManager for this package.
*/
private StringManager sm =
@@ -297,6 +306,30 @@
/**
+ * Add a lifecycle event listener to this component.
+ *
+ * @param listener The listener to add
+ */
+ public void addLifecycleListener(LifecycleListener listener) {
+
+ lifecycle.addLifecycleListener(listener);
+
+ }
+
+
+ /**
+ * Remove a lifecycle event listener from this component.
+ *
+ * @param listener The listener to add
+ */
+ public void removeLifecycleListener(LifecycleListener listener) {
+
+ lifecycle.removeLifecycleListener(listener);
+
+ }
+
+
+ /**
* Prepare for the beginning of active use of the public methods of this
* component. This method should be called after <code>configure()</code>,
* and before any of the public methods of the component are utilized.
@@ -313,6 +346,7 @@
throw new LifecycleException
(sm.getString("interceptorValve.alreadyStarted"));
started = true;
+ lifecycle.fireLifecycleEvent(START_EVENT, null);
// Start our subordinate Interceptors
synchronized (interceptors) {
@@ -341,6 +375,7 @@
throw new LifecycleException
(sm.getString("interceptorValve.notStarted"));
started = false;
+ lifecycle.fireLifecycleEvent(STOP_EVENT, null);
// Stop our subordinate Interceptors
synchronized (interceptors) {