tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@locus.apache.org
Subject cvs commit: jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/valves AccessLogValve.java InterceptorValve.java
Date Wed, 26 Apr 2000 02:14:56 GMT
craigmcc    00/04/25 19:14:56

  Modified:    proposals/catalina/src/share/org/apache/tomcat/connector/test
                        HttpConnector.java HttpProcessor.java
               proposals/catalina/src/share/org/apache/tomcat/core
                        LocalStrings.properties StandardContext.java
                        StandardEngine.java StandardHost.java
                        StandardWrapper.java
               proposals/catalina/src/share/org/apache/tomcat/logger
                        FileLogger.java
               proposals/catalina/src/share/org/apache/tomcat/realm
                        MemoryRealm.java
               proposals/catalina/src/share/org/apache/tomcat/security
                        HttpSecurityValve.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/loader
                        Constants.java LocalStrings.properties
                        StandardLoader.java
  Removed:     proposals/catalina/src/share/org/apache/tomcat/core
                        StandardLoader.java
  Log:
  Refine the lifecycle related processing in all components that use it,
  such that lifecycle event listeners are called *before* the started status
  for a particular component is changed, rather than *after*.  This avoids
  significant timing issues during the initialization of Catalina, and
  eases runtime addition of default utility components where appropriate.
  
  Move StandardLoader out of org.apache.tomcat.core and into
  org.apache.tomcat.loader, consistent with the approach used for other
  utility components.
  
  Revision  Changes    Path
  1.3       +6 -6      jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/test/HttpConnector.java
  
  Index: HttpConnector.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/test/HttpConnector.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HttpConnector.java	2000/04/22 23:15:50	1.2
  +++ HttpConnector.java	2000/04/26 02:14:49	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/test/HttpConnector.java,v
1.2 2000/04/22 23:15:50 craigmcc Exp $
  - * $Revision: 1.2 $
  - * $Date: 2000/04/22 23:15:50 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/test/HttpConnector.java,v
1.3 2000/04/26 02:14:49 craigmcc Exp $
  + * $Revision: 1.3 $
  + * $Date: 2000/04/26 02:14:49 $
    *
    * ====================================================================
    *
  @@ -91,7 +91,7 @@
    * purposes.  Not intended to be the final solution.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.2 $ $Date: 2000/04/22 23:15:50 $
  + * @version $Revision: 1.3 $ $Date: 2000/04/26 02:14:49 $
    */
   
   
  @@ -604,8 +604,8 @@
   	if (started)
   	    throw new LifecycleException
   		(sm.getString("httpConnector.alreadyStarted"));
  -	started = true;
   	lifecycle.fireLifecycleEvent(START_EVENT, null);
  +	started = true;
   
   	// Establish a server socket on the specified port
   	try {
  @@ -639,8 +639,8 @@
   	if (!started)
   	    throw new LifecycleException
   		(sm.getString("httpConnector.notStarted"));
  -	started = false;
   	lifecycle.fireLifecycleEvent(STOP_EVENT, null);
  +	started = false;
   
   	// Gracefully shut down all processors we have created
   	for (int i = created.size() - 1; i >= 0; i--) {
  
  
  
  1.3       +6 -6      jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/test/HttpProcessor.java
  
  Index: HttpProcessor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/test/HttpProcessor.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HttpProcessor.java	2000/04/22 23:15:50	1.2
  +++ HttpProcessor.java	2000/04/26 02:14:49	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/test/HttpProcessor.java,v
1.2 2000/04/22 23:15:50 craigmcc Exp $
  - * $Revision: 1.2 $
  - * $Date: 2000/04/22 23:15:50 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/connector/test/HttpProcessor.java,v
1.3 2000/04/26 02:14:49 craigmcc Exp $
  + * $Revision: 1.3 $
  + * $Date: 2000/04/26 02:14:49 $
    *
    * ====================================================================
    *
  @@ -97,7 +97,7 @@
    * the request.  When the processor is completed, it will recycle itself.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.2 $ $Date: 2000/04/22 23:15:50 $
  + * @version $Revision: 1.3 $ $Date: 2000/04/26 02:14:49 $
    */
   
   final class HttpProcessor
  @@ -678,8 +678,8 @@
   	if (started)
   	    throw new LifecycleException
   		(sm.getString("httpProcessor.start"));
  -	started = true;
   	lifecycle.fireLifecycleEvent(START_EVENT, null);
  +	started = true;
   
   	threadStart();
   
  @@ -696,8 +696,8 @@
   	if (!started)
   	    throw new LifecycleException
   		(sm.getString("httpProcessor.stop"));
  -	started = false;
   	lifecycle.fireLifecycleEvent(STOP_EVENT, null);
  +	started = false;
   
   	threadStop();
   
  
  
  
  1.9       +2 -7      jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/LocalStrings.properties,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- LocalStrings.properties	2000/04/26 01:03:59	1.8
  +++ LocalStrings.properties	2000/04/26 02:14:50	1.9
  @@ -9,7 +9,7 @@
   standardEngine.notHost=Child of an Engine must be a Host
   standardEngine.notParent=Engine cannot have a parent Container
   standardEngine.notStarted=Engine has not yet been started
  -standardEngine.unfoundHost=Virtual host $0 not found
  +standardEngine.unfoundHost=Virtual host {0} not found
   standardEngine.unknownHost=No server host specified in this request
   standardHost.alreadyStarted=Host has already been started
   standardHost.noContext=No Context configured to process this request
  @@ -17,12 +17,7 @@
   standardHost.notContext=Child of a Host must be a Context
   standardHost.notStarted=Host has not yet been started
   standardHost.nullName=Host name is required
  -standardHost.unfoundContext=Cannot find context for request URI $0
  -standardLoader.alreadyStarted=Loader has already been started
  -standardLoader.exists=Repository $0 does not exist
  -standardLoader.notStarted=Loader has not yet been started
  -standardLoader.read=Repository $0 cannot be read
  -standardLoader.type=Repository $0 is not a supported file type
  +standardHost.unfoundContext=Cannot find context for request URI {0}
   standardServer.addContainer.ise=No connectors available to associate this container with
   standardServer.start.connectors=At least one connector is not associated with any container
   standardServer.start.started=This server has already been started
  
  
  
  1.11      +22 -4     jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardContext.java
  
  Index: StandardContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardContext.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- StandardContext.java	2000/04/25 20:11:28	1.10
  +++ StandardContext.java	2000/04/26 02:14:50	1.11
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardContext.java,v
1.10 2000/04/25 20:11:28 craigmcc Exp $
  - * $Revision: 1.10 $
  - * $Date: 2000/04/25 20:11:28 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardContext.java,v
1.11 2000/04/26 02:14:50 craigmcc Exp $
  + * $Revision: 1.11 $
  + * $Date: 2000/04/26 02:14:50 $
    *
    * ====================================================================
    *
  @@ -92,7 +92,7 @@
    * requests directed to a particular servlet.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.10 $ $Date: 2000/04/25 20:11:28 $
  + * @version $Revision: 1.11 $ $Date: 2000/04/26 02:14:50 $
    */
   
   public final class StandardContext
  @@ -1330,6 +1330,24 @@
   
   	welcomeFiles.remove(name);
   	fireContainerEvent("removeWelcomeFile", name);
  +
  +    }
  +
  +
  +    /**
  +     * Return a String representation of this component.
  +     */
  +    public String toString() {
  +
  +	StringBuffer sb = new StringBuffer();
  +	if (getParent() != null) {
  +	    sb.append(getParent().toString());
  +	    sb.append(".");
  +	}
  +	sb.append("StandardContext[");
  +	sb.append(getName());
  +	sb.append("]");
  +	return (sb.toString());
   
       }
   
  
  
  
  1.5       +17 -4     jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardEngine.java
  
  Index: StandardEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardEngine.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StandardEngine.java	2000/04/23 01:42:33	1.4
  +++ StandardEngine.java	2000/04/26 02:14:50	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardEngine.java,v
1.4 2000/04/23 01:42:33 craigmcc Exp $
  - * $Revision: 1.4 $
  - * $Date: 2000/04/23 01:42:33 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardEngine.java,v
1.5 2000/04/26 02:14:50 craigmcc Exp $
  + * $Revision: 1.5 $
  + * $Date: 2000/04/26 02:14:50 $
    *
    * ====================================================================
    *
  @@ -81,7 +81,7 @@
    * fully qualified host name of that virtual host.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.4 $ $Date: 2000/04/23 01:42:33 $
  + * @version $Revision: 1.5 $ $Date: 2000/04/26 02:14:50 $
    */
   
   public final class StandardEngine
  @@ -248,6 +248,19 @@
   
   	throw new IllegalArgumentException
   	    (sm.getString("standardEngine.notParent"));
  +
  +    }
  +
  +
  +    /**
  +     * Return a String representation of this component.
  +     */
  +    public String toString() {
  +
  +	StringBuffer sb = new StringBuffer("StandardEngine[");
  +	sb.append(getName());
  +	sb.append("]");
  +	return (sb.toString());
   
       }
   
  
  
  
  1.7       +22 -4     jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardHost.java
  
  Index: StandardHost.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardHost.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- StandardHost.java	2000/04/25 20:11:29	1.6
  +++ StandardHost.java	2000/04/26 02:14:50	1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardHost.java,v
1.6 2000/04/25 20:11:29 craigmcc Exp $
  - * $Revision: 1.6 $
  - * $Date: 2000/04/25 20:11:29 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardHost.java,v
1.7 2000/04/26 02:14:50 craigmcc Exp $
  + * $Revision: 1.7 $
  + * $Date: 2000/04/26 02:14:50 $
    *
    * ====================================================================
    *
  @@ -84,7 +84,7 @@
    * requests directed to a particular web application.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.6 $ $Date: 2000/04/25 20:11:29 $
  + * @version $Revision: 1.7 $ $Date: 2000/04/26 02:14:50 $
    */
   
   public final class StandardHost
  @@ -298,6 +298,24 @@
   
   	// Return the mapped Context (if any)
   	return (context);
  +
  +    }
  +
  +
  +    /**
  +     * Return a String representation of this component.
  +     */
  +    public String toString() {
  +
  +	StringBuffer sb = new StringBuffer();
  +	if (getParent() != null) {
  +	    sb.append(getParent().toString());
  +	    sb.append(".");
  +	}
  +	sb.append("StandardHost[");
  +	sb.append(getName());
  +	sb.append("]");
  +	return (sb.toString());
   
       }
   
  
  
  
  1.5       +22 -4     jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardWrapper.java
  
  Index: StandardWrapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardWrapper.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StandardWrapper.java	2000/02/08 05:43:36	1.4
  +++ StandardWrapper.java	2000/04/26 02:14:51	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardWrapper.java,v
1.4 2000/02/08 05:43:36 craigmcc Exp $
  - * $Revision: 1.4 $
  - * $Date: 2000/02/08 05:43:36 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/core/StandardWrapper.java,v
1.5 2000/04/26 02:14:51 craigmcc Exp $
  + * $Revision: 1.5 $
  + * $Date: 2000/04/26 02:14:51 $
    *
    * ====================================================================
    *
  @@ -96,7 +96,7 @@
    * make them efficient are counter-productive.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.4 $ $Date: 2000/02/08 05:43:36 $
  + * @version $Revision: 1.5 $ $Date: 2000/04/26 02:14:51 $
    */
   
   public final class StandardWrapper
  @@ -564,6 +564,24 @@
   	    references.remove(name);
   	    fireContainerEvent("removeSecurityReference", name);
   	}
  +
  +    }
  +
  +
  +    /**
  +     * Return a String representation of this component.
  +     */
  +    public String toString() {
  +
  +	StringBuffer sb = new StringBuffer();
  +	if (getParent() != null) {
  +	    sb.append(getParent().toString());
  +	    sb.append(".");
  +	}
  +	sb.append("StandardWrapper[");
  +	sb.append(getName());
  +	sb.append("]");
  +	return (sb.toString());
   
       }
   
  
  
  
  1.1                  jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/loader/Constants.java
  
  Index: Constants.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/loader/Constants.java,v
1.1 2000/04/26 02:14:53 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/04/26 02:14:53 $
   *
   * ====================================================================
   *
   * 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.loader;
  
  
  public class Constants {
  
      public static final String Package = "org.apache.tomcat.loader";
  
  }
  
  
  
  
  1.1                  jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/loader/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===================================================================
  standardLoader.alreadyStarted=Loader has already been started
  standardLoader.exists=Repository {0} does not exist
  standardLoader.notStarted=Loader has not yet been started
  standardLoader.read=Repository {0} cannot be read
  standardLoader.type=Repository {0} is not a supported file type
  
  
  
  1.1                  jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/loader/StandardLoader.java
  
  Index: StandardLoader.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/loader/StandardLoader.java,v
1.1 2000/04/26 02:14:53 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2000/04/26 02:14:53 $
   *
   * ====================================================================
   *
   * 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.loader;
  
  
  import java.beans.PropertyChangeListener;
  import java.beans.PropertyChangeSupport;
  import java.io.File;
  import java.io.IOException;
  import java.util.Enumeration;
  import java.util.Vector;
  import java.util.zip.ZipException;
  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;
  
  
  /**
   * Standard implementation of the <b>Loader</b> interface that wraps the
   * <code>AdaptiveClassLoader</code> implementation imported from the
   * Apache JServ project.  This class loader supports detection of modified
   * Java classes, which can be used to implement auto-reload support.
   * <p>
   * This class loader is configured by adding the pathnames of directories,
   * JAR files, and ZIP files with the <code>addRepository()</code> method,
   * prior to calling <code>start()</code>.  When a new class is required,
   * these repositories will be consulted first to locate the class.  If it
   * is not present, the system class loader will be used instead.
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2000/04/26 02:14:53 $
   */
  
  public final class StandardLoader
      implements Lifecycle, Loader {
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      /**
       * The class loader being managed by this Loader component.
       */
      private AdaptiveClassLoader classLoader = null;
  
  
      /**
       * The Container with which this Loader has been associated.
       */
      private Container container = null;
  
  
      /**
       * The descriptive information about this Loader implementation.
       */
      private static final String info =
  	"org.apache.tomcat.loader.StandardLoader/1.0";
  
  
      /**
       * 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.
       */
      private Vector repositories = new Vector();
  
  
      /**
       * The string manager for this package.
       */
      protected static final StringManager sm =
  	StringManager.getManager(Constants.Package);
  
  
      /**
       * Has this component been started?
       */
      private boolean started = false;
  
  
      /**
       * The property change support for this component.
       */
      protected PropertyChangeSupport support = new PropertyChangeSupport(this);
  
  
      // ------------------------------------------------------------- Properties
  
  
      /**
       * Return the Java class loader to be used by this Container.
       */
      public ClassLoader getClassLoader() {
  
  	return (classLoader);
  
      }
  
  
      /**
       * Return the Container with which this Logger has been associated.
       */
      public Container getContainer() {
  
  	return (container);
  
      }
  
  
      /**
       * Set the Container with which this Logger has been associated.
       *
       * @param container The associated Container
       */
      public void setContainer(Container container) {
  
  	Container oldContainer = this.container;
  	this.container = container;
  	support.firePropertyChange("container", oldContainer, this.container);
  
      }
  
  
      /**
       * Return descriptive information about this Loader implementation and
       * the corresponding version number, in the format
       * <code>&lt;description&gt;/&lt;version&gt;</code>.
       */
      public String getInfo() {
  
  	return (info);
  
      }
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Add a property change listener to this component.
       *
       * @param listener The listener to add
       */
      public void addPropertyChangeListener(PropertyChangeListener listener) {
  
  	support.addPropertyChangeListener(listener);
  
      }
  
  
      /**
       * Add a new repository to the set of repositories for this class loader.
       *
       * @param repository Repository to be added
       */
      public void addRepository(String repository) {
  
  	if (!repositories.contains(repository))
  	    repositories.addElement(repository);
  
      }
  
  
      /**
       * Return the set of repositories defined for this class loader.
       * If none are defined, a zero-length array is returned.
       */
      public String[] findRepositories() {
  
  	synchronized (repositories) {
  	    String results[] = new String[repositories.size()];
  	    for (int i = 0; i < results.length; i++)
  		results[i] = (String) repositories.elementAt(i);
  	    return (results);
  	}
  
      }
  
  
      /**
       * Has the internal repository associated with this Loader been modified,
       * such that the loaded classes should be reloaded?
       */
      public boolean modified() {
  
  	if (classLoader != null)
  	    return (classLoader.shouldReload());
  	else
  	    return (false);
  
      }
  
  
      /**
       * Cause the underlying class loader (and therefore all of the classes
       * loaded by that class loader) to be thrown away, and creates a new one.
       *
       * @exception IllegalStateException if a change to the repositories for
       *  this class loader has rendered restart impossible
       */
      public void reload() {
  
  	try {
  	    stop();
  	    start();
  	} catch (Throwable t) {
  	    throw new IllegalStateException("reload: " + t);
  	}
  
      }
  
  
      /**
       * Remove a property change listener from this component.
       *
       * @param listener The listener to remove
       */
      public void removePropertyChangeListener(PropertyChangeListener listener) {
  
  	support.removePropertyChangeListener(listener);
  
      }
  
  
      /**
       * Remove a repository from the set of repositories for this loader.
       *
       * @param repository Repository to be removed
       */
      public void removeRepository(String repository) {
  
  	repositories.removeElement(repository);
  
      }
  
  
      // ------------------------------------------------------ Lifecycle Methods
  
  
      /**
       * 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
       */
      public void start() throws LifecycleException {
  
  	// Validate and update our current component state
  	if (started)
  	    throw new LifecycleException
  		(sm.getString("standardLoader.alreadyStarted"));
  	lifecycle.fireLifecycleEvent(START_EVENT, null);
  	started = true;
  
  	// Validate the specified repositories
  	Vector files = new Vector();
  	Enumeration names = repositories.elements();
  	while (names.hasMoreElements()) {
  	    File file = new File((String) names.nextElement());
  	    files.addElement(file);
  	    String path = null;
  	    try {
  		path = file.getCanonicalPath();
  	    } catch (IOException e) {
  		path = "UNKNOWN";
  	    }
  	    if (!file.exists())
  		throw new LifecycleException
  		    (sm.getString("standardLoader.exists", path));
  	    else if (!file.canRead())
  		throw new LifecycleException
  		    (sm.getString("standardLoader.read", path));
  	    else if (!checkType(file))
  		throw new LifecycleException
  		    (sm.getString("standardLoader.type", path));
  	}
  
  	// Construct a new class loader instance for our use
  	try {
  	    classLoader = new AdaptiveClassLoader(files);
  	} catch (IllegalArgumentException e) {
  	    throw new LifecycleException("start: ", e);
  	}
  
      }
  
  
      /**
       * Stop this component, finalizing our associated class loader.
       *
       * @exception LifecycleException if a lifecycle error occurs
       */
      public void stop() throws LifecycleException {
  
  	// Validate and update our current component state
  	if (!started)
  	    throw new LifecycleException
  		(sm.getString("standardLoader.notStarted"));
  	lifecycle.fireLifecycleEvent(STOP_EVENT, null);
  	started = false;
  
  	// Throw away our current class loader
  	classLoader = null;
  
      }
  
  
      // ------------------------------------------------------- Private Methods
  
  
      /**
       * Is the specified file an appropriate entry for a repository?
       *
       * @param file The repository entry to be validated
       */
      private boolean checkType(File file) {
  
  	// Directories are acceptable
  	if (file.isDirectory())
  	    return (true);
  
  	// ZIP and JAR files that we can recognize are acceptable
  	boolean isArchive = true;
  	ZipFile zipFile = null;
  	try {
  	    zipFile = new ZipFile(file);
  	} catch (ZipException e) {
  	    isArchive = false;
  	} catch (IOException e) {
  	    isArchive = false;
  	}
  	if (zipFile != null) {
  	    try {
  		zipFile.close();
  	    } catch (IOException e) {
  		;
  	    }
  	}
  	return (isArchive);
  
      }
  
  
  }
  
  
  
  1.6       +6 -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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FileLogger.java	2000/04/10 20:01:38	1.5
  +++ FileLogger.java	2000/04/26 02:14:53	1.6
  @@ -1,7 +1,7 @@
   /*
  - * $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 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/logger/FileLogger.java,v
1.6 2000/04/26 02:14:53 craigmcc Exp $
  + * $Revision: 1.6 $
  + * $Date: 2000/04/26 02:14:53 $
    *
    * ====================================================================
    *
  @@ -84,7 +84,7 @@
    * optional preceding timestamp.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.5 $ $Date: 2000/04/10 20:01:38 $
  + * @version $Revision: 1.6 $ $Date: 2000/04/26 02:14:53 $
    */
   
   public final class FileLogger
  @@ -380,8 +380,8 @@
   	if (started)
   	    throw new LifecycleException
   		(sm.getString("fileLogger.alreadyStarted"));
  -	started = true;
   	lifecycle.fireLifecycleEvent(START_EVENT, null);
  +	started = true;
   
       }
   
  @@ -401,8 +401,8 @@
   	if (!started)
   	    throw new LifecycleException
   		(sm.getString("fileLogger.notStarted"));
  -	started = false;
   	lifecycle.fireLifecycleEvent(STOP_EVENT, null);
  +	started = false;
   
   	close();
   
  
  
  
  1.2       +6 -6      jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/realm/MemoryRealm.java
  
  Index: MemoryRealm.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/realm/MemoryRealm.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MemoryRealm.java	2000/04/18 20:41:22	1.1
  +++ MemoryRealm.java	2000/04/26 02:14:54	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/realm/MemoryRealm.java,v
1.1 2000/04/18 20:41:22 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/04/18 20:41:22 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/realm/MemoryRealm.java,v
1.2 2000/04/26 02:14:54 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2000/04/26 02:14:54 $
    *
    * ====================================================================
    *
  @@ -92,7 +92,7 @@
    * location) are identical to those currently supported by Tomcat 3.X.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2000/04/18 20:41:22 $
  + * @version $Revision: 1.2 $ $Date: 2000/04/26 02:14:54 $
    */
   
   public final class MemoryRealm
  @@ -366,8 +366,8 @@
   	if (started)
   	    throw new LifecycleException
   		(sm.getString("memoryRealm.alreadyStarted"));
  -	started = true;
   	lifecycle.fireLifecycleEvent(START_EVENT, null);
  +	started = true;
   
   	// Validate the existence of our database file
   	// FIXME - Resolve relative pathname against tomcat home?
  @@ -401,8 +401,8 @@
   	if (!started)
   	    throw new LifecycleException
   		(sm.getString("memoryRealm.notStarted"));
  -	started = false;
   	lifecycle.fireLifecycleEvent(STOP_EVENT, null);
  +	started = false;
   
   	// No shutdown activities required
   
  
  
  
  1.4       +6 -6      jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/security/HttpSecurityValve.java
  
  Index: HttpSecurityValve.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/security/HttpSecurityValve.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HttpSecurityValve.java	2000/04/14 19:41:53	1.3
  +++ HttpSecurityValve.java	2000/04/26 02:14:54	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/security/HttpSecurityValve.java,v
1.3 2000/04/14 19:41:53 craigmcc Exp $
  - * $Revision: 1.3 $
  - * $Date: 2000/04/14 19:41:53 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/security/HttpSecurityValve.java,v
1.4 2000/04/26 02:14:54 craigmcc Exp $
  + * $Revision: 1.4 $
  + * $Date: 2000/04/26 02:14:54 $
    *
    * ====================================================================
    *
  @@ -116,7 +116,7 @@
    * </ul>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.3 $ $Date: 2000/04/14 19:41:53 $
  + * @version $Revision: 1.4 $ $Date: 2000/04/26 02:14:54 $
    */
   
   
  @@ -491,8 +491,8 @@
   	if (started)
   	    throw new LifecycleException
   		(sm.getString("securityValve.alreadyStarted"));
  -	started = true;
   	lifecycle.fireLifecycleEvent(START_EVENT, null);
  +	started = true;
   
       }
   
  @@ -512,8 +512,8 @@
   	if (!started)
   	    throw new LifecycleException
   		(sm.getString("securityValve.notStarted"));
  -	started = false;
   	lifecycle.fireLifecycleEvent(STOP_EVENT, null);
  +	started = false;
   
       }
   
  
  
  
  1.5       +6 -6      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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FileStore.java	2000/04/10 20:01:39	1.4
  +++ FileStore.java	2000/04/26 02:14:54	1.5
  @@ -1,7 +1,7 @@
   /*
  - * $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 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/session/FileStore.java,v
1.5 2000/04/26 02:14:54 craigmcc Exp $
  + * $Revision: 1.5 $
  + * $Date: 2000/04/26 02:14:54 $
    *
    * ====================================================================
    *
  @@ -96,7 +96,7 @@
    * saved are still subject to being expired based on inactivity.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.4 $ $Date: 2000/04/10 20:01:39 $
  + * @version $Revision: 1.5 $ $Date: 2000/04/26 02:14:54 $
    */
   
   public final class FileStore
  @@ -379,8 +379,8 @@
   	if (started)
   	    throw new LifecycleException
   		(sm.getString("fileStore.alreadyStarted"));
  -	started = true;
   	lifecycle.fireLifecycleEvent(START_EVENT, null);
  +	started = true;
   
   	// Start the background reaper thread
   	threadStart();
  @@ -403,8 +403,8 @@
   	if (!started)
   	    throw new LifecycleException
   		(sm.getString("fileStore.notStarted"));
  -	started = false;
   	lifecycle.fireLifecycleEvent(STOP_EVENT, null);
  +	started = false;
   
   	// Stop the background reaper thread
   	threadStop();
  
  
  
  1.7       +6 -6      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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- StandardManager.java	2000/04/12 18:46:38	1.6
  +++ StandardManager.java	2000/04/26 02:14:55	1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/session/StandardManager.java,v
1.6 2000/04/12 18:46:38 craigmcc Exp $
  - * $Revision: 1.6 $
  - * $Date: 2000/04/12 18:46:38 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/session/StandardManager.java,v
1.7 2000/04/26 02:14:55 craigmcc Exp $
  + * $Revision: 1.7 $
  + * $Date: 2000/04/26 02:14:55 $
    *
    * ====================================================================
    *
  @@ -97,7 +97,7 @@
    * <code>stop()</code> methods of this class at the correct times.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.6 $ $Date: 2000/04/12 18:46:38 $
  + * @version $Revision: 1.7 $ $Date: 2000/04/26 02:14:55 $
    */
   
   public final class StandardManager
  @@ -333,8 +333,8 @@
   	if (started)
   	    throw new LifecycleException
   		(sm.getString("standardManager.alreadyStarted"));
  -	started = true;
   	lifecycle.fireLifecycleEvent(START_EVENT, null);
  +	started = true;
   
   	// Load any previously persisted sessions
   	load();
  @@ -360,8 +360,8 @@
   	if (!started)
   	    throw new LifecycleException
   		(sm.getString("standardManager.notStarted"));
  -	started = false;
   	lifecycle.fireLifecycleEvent(STOP_EVENT, null);
  +	started = false;
   
   	// Stop the background reaper thread
   	threadStop();
  
  
  
  1.6       +3 -3      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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AccessLogValve.java	2000/04/14 19:41:54	1.5
  +++ AccessLogValve.java	2000/04/26 02:14:55	1.6
  @@ -122,7 +122,7 @@
    * can be implemented.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.5 $ $Date: 2000/04/14 19:41:54 $
  + * @version $Revision: 1.6 $ $Date: 2000/04/26 02:14:55 $
    */
   
   public final class AccessLogValve
  @@ -599,8 +599,8 @@
   	if (started)
   	    throw new LifecycleException
   		(sm.getString("accessLogValve.alreadyStarted"));
  -	started = true;
   	lifecycle.fireLifecycleEvent(START_EVENT, null);
  +	started = true;
   
       }
   
  @@ -620,8 +620,8 @@
   	if (!started)
   	    throw new LifecycleException
   		(sm.getString("accessLogValve.notStarted"));
  -	started = false;
   	lifecycle.fireLifecycleEvent(STOP_EVENT, null);
  +	started = false;
   
   	close();
   
  
  
  
  1.3       +6 -6      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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- InterceptorValve.java	2000/04/10 20:01:41	1.2
  +++ InterceptorValve.java	2000/04/26 02:14:55	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $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 $
  + * $Header: /home/cvs/jakarta-tomcat/proposals/catalina/src/share/org/apache/tomcat/valves/InterceptorValve.java,v
1.3 2000/04/26 02:14:55 craigmcc Exp $
  + * $Revision: 1.3 $
  + * $Date: 2000/04/26 02:14:55 $
    *
    * ====================================================================
    *
  @@ -101,7 +101,7 @@
    * <ul>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.2 $ $Date: 2000/04/10 20:01:41 $
  + * @version $Revision: 1.3 $ $Date: 2000/04/26 02:14:55 $
    */
   
   public final class InterceptorValve
  @@ -345,8 +345,8 @@
   	if (started)
   	    throw new LifecycleException
   		(sm.getString("interceptorValve.alreadyStarted"));
  -	started = true;
   	lifecycle.fireLifecycleEvent(START_EVENT, null);
  +	started = true;
   
   	// Start our subordinate Interceptors
   	synchronized (interceptors) {
  @@ -374,8 +374,8 @@
   	if (!started)
   	    throw new LifecycleException
   		(sm.getString("interceptorValve.notStarted"));
  -	started = false;
   	lifecycle.fireLifecycleEvent(STOP_EVENT, null);
  +	started = false;
   
   	// Stop our subordinate Interceptors
   	synchronized (interceptors) {
  
  
  

Mime
View raw message