craigmcc    02/04/09 16:48:21

  Modified:    catalina/src/share/org/apache/catalina Deployer.java
               catalina/src/share/org/apache/catalina/core
                        StandardHostDeployer.java
  Log:
  When using the Manager webapp to deploy, add a container event *after* the
  new context has been created, but *before* it is started.  This lets you
  customize configuration properties in the same way that you can when using
  the Embedded interface, in between the Embedded.createContext() and
  host.addChild() method calls.
  
  Revision  Changes    Path
  1.6       +13 -5     
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Deployer.java
  
  Index: Deployer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Deployer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Deployer.java     25 Oct 2001 00:23:02 -0000      1.5
  +++ Deployer.java     9 Apr 2002 23:48:21 -0000       1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Deployer.java,v 
1.5 2001/10/25 00:23:02 craigmcc Exp $
  - * $Revision: 1.5 $
  - * $Date: 2001/10/25 00:23:02 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Deployer.java,v 
1.6 2002/04/09 23:48:21 craigmcc Exp $
  + * $Revision: 1.6 $
  + * $Date: 2002/04/09 23:48:21 $
    *
    * ====================================================================
    *
  @@ -76,7 +76,7 @@
    * for each web application will be the context path to which it is attached.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.5 $ $Date: 2001/10/25 00:23:02 $
  + * @version $Revision: 1.6 $ $Date: 2002/04/09 23:48:21 $
    */
   
   /* public interface Deployer extends Container { */
  @@ -88,7 +88,15 @@
   
       /**
        * The ContainerEvent event type sent when a new application is
  -     * installed by <code>install()</code>.
  +     * being installed by <code>install()</code>, before it has been
  +     * started.
  +     */
  +    public static final String PRE_INSTALL_EVENT = "pre-install";
  +
  +
  +    /**
  +     * The ContainerEvent event type sent when a new application is
  +     * installed by <code>install()</code>, after it has been started.
        */
       public static final String INSTALL_EVENT = "install";
   
  
  
  
  1.9       +17 -10    
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java
  
  Index: StandardHostDeployer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- StandardHostDeployer.java 20 Mar 2002 12:29:55 -0000      1.8
  +++ StandardHostDeployer.java 9 Apr 2002 23:48:21 -0000       1.9
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java,v
 1.8 2002/03/20 12:29:55 glenn Exp $
  - * $Revision: 1.8 $
  - * $Date: 2002/03/20 12:29:55 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java,v
 1.9 2002/04/09 23:48:21 craigmcc Exp $
  + * $Revision: 1.9 $
  + * $Date: 2002/04/09 23:48:21 $
    *
    * ====================================================================
    *
  @@ -91,7 +91,7 @@
    * <code>StandardHost</code> implementation class.</p>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.8 $ $Date: 2002/03/20 12:29:55 $
  + * @version $Revision: 1.9 $ $Date: 2002/04/09 23:48:21 $
    */
   
   public class StandardHostDeployer implements Deployer {
  @@ -189,8 +189,11 @@
        * start with a slash.
        * <p>
        * If this application is successfully installed, a ContainerEvent of type
  -     * <code>INSTALL_EVENT</code> will be sent to all registered listeners,
  -     * with the newly created <code>Context</code> as an argument.
  +     * <code>PRE_INSTALL_EVENT</code> will be sent to registered listeners
  +     * before the associated Context is started, and a ContainerEvent of type
  +     * <code>INSTALL_EVENT</code> will be sent to all registered listeners
  +     * after the associated Context is started, with the newly created
  +     * <code>Context</code> as an argument.
        *
        * @param contextPath The context path to which this application should
        *  be installed (must be unique)
  @@ -250,6 +253,7 @@
                       (LifecycleListener) clazz.newInstance();
                   ((Lifecycle) context).addLifecycleListener(listener);
               }
  +            host.fireContainerEvent(PRE_INSTALL_EVENT, context);
               host.addChild(context);
               host.fireContainerEvent(INSTALL_EVENT, context);
           } catch (Exception e) {
  @@ -266,10 +270,12 @@
        * (consisting of a <code>&lt;Context&gt;</code> element) and (optional)
        * web application archive are at the specified URLs.</p>
        *
  -     * <p>If this application is successfully installed, a ContainerEvent
  -     * of type <code>INSTALL_EVENT</code> will be sent to all registered
  -     * listeners, with the newly created <code>Context</code> as an argument.
  -     * </p>
  +     * If this application is successfully installed, a ContainerEvent of type
  +     * <code>PRE_INSTALL_EVENT</code> will be sent to registered listeners
  +     * before the associated Context is started, and a ContainerEvent of type
  +     * <code>INSTALL_EVENT</code> will be sent to all registered listeners
  +     * after the associated Context is started, with the newly created
  +     * <code>Context</code> as an argument.
        *
        * @param config A URL that points to the context configuration descriptor
        *  to be used for configuring the new Context
  @@ -518,6 +524,7 @@
                   (sm.getString("standardHost.pathUsed", contextPath));
           if (this.overrideDocBase != null)
               context.setDocBase(this.overrideDocBase);
  +        host.fireContainerEvent(PRE_INSTALL_EVENT, context);
           host.addChild(child);
           host.fireContainerEvent(INSTALL_EVENT, context);
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to