You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by gr...@locus.apache.org on 2000/11/16 18:31:56 UTC

cvs commit: xml-cocoon/src/org/apache/cocoon/framework DestroyListener.java Manager.java

greenrd     00/11/16 09:31:56

  Modified:    .        changes.xml
               src/org/apache/cocoon Engine.java Cocoon.java
               src/org/apache/cocoon/framework Manager.java
  Added:       src/org/apache/cocoon/framework DestroyListener.java
  Log:
  Cocoon servlet now notifies DestroyListeners when it is destroyed
  
  Revision  Changes    Path
  1.147     +5 -0      xml-cocoon/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/changes.xml,v
  retrieving revision 1.146
  retrieving revision 1.147
  diff -u -r1.146 -r1.147
  --- changes.xml	2000/11/14 22:02:55	1.146
  +++ changes.xml	2000/11/16 17:31:53	1.147
  @@ -4,7 +4,7 @@
   
   <!--
     History of Cocoon changes   
  -  $Id: changes.xml,v 1.146 2000/11/14 22:02:55 greenrd Exp $ 
  +  $Id: changes.xml,v 1.147 2000/11/16 17:31:53 greenrd Exp $ 
   -->
   
   <changes title="History of Changes">
  @@ -18,6 +18,11 @@
     </devs>
   
    <release version="@version@" date="@date@">
  +  <action dev="RDG" type="add">
  +   Added ability for Engine components to implement 
  +   org.apache.cocoon.framework.DestroyListener and be notified for cleanup
  +   purposes if/when the Cocoon servlet is destroyed.
  +  </action>
     <action dev="RDG" type="fix" due-to="Tagunov Anthony" 
      due-to-email="atagunov@nnt.ru">
      Fixed zombie caching bug where old versions of pages would reappear after
  
  
  
  1.37      +4 -0      xml-cocoon/src/org/apache/cocoon/Engine.java
  
  Index: Engine.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Engine.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- Engine.java	2000/11/01 20:12:17	1.36
  +++ Engine.java	2000/11/16 17:31:53	1.37
  @@ -1,4 +1,4 @@
  -/*-- $Id: Engine.java,v 1.36 2000/11/01 20:12:17 greenrd Exp $ --
  +/*-- $Id: Engine.java,v 1.37 2000/11/16 17:31:53 greenrd Exp $ --
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -75,7 +75,7 @@
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
    * @author <a href="mailto:greenrd@hotmail.com">Robin Green</a>
  - * @version $Revision: 1.36 $ $Date: 2000/11/01 20:12:17 $
  + * @version $Revision: 1.37 $ $Date: 2000/11/16 17:31:53 $
    */
   
   public class Engine implements Defaults {
  @@ -496,6 +496,10 @@
               }
           }
           return table;
  +    }
  +
  +    public void destroy () {
  +      manager.destroyAll ();
       }
   
       /**
  
  
  
  1.17      +6 -2      xml-cocoon/src/org/apache/cocoon/Cocoon.java
  
  Index: Cocoon.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Cocoon.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- Cocoon.java	2000/05/12 12:40:29	1.16
  +++ Cocoon.java	2000/11/16 17:31:53	1.17
  @@ -1,4 +1,4 @@
  -/*-- $Id: Cocoon.java,v 1.16 2000/05/12 12:40:29 stefano Exp $ -- 
  +/*-- $Id: Cocoon.java,v 1.17 2000/11/16 17:31:53 greenrd Exp $ -- 
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -64,7 +64,7 @@
    * separate different knowledge contexts in different processing layers.
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version $Revision: 1.16 $ $Date: 2000/05/12 12:40:29 $
  + * @version $Revision: 1.17 $ $Date: 2000/11/16 17:31:53 $
    */
   
   public class Cocoon extends HttpServlet implements Defaults {
  @@ -180,6 +180,10 @@
                   }
               }
           }
  +    }
  +
  +    public void destroy () {
  +       engine.destroy ();
       }
   
       /**
  
  
  
  1.9       +16 -3     xml-cocoon/src/org/apache/cocoon/framework/Manager.java
  
  Index: Manager.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/framework/Manager.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Manager.java	2000/03/17 16:49:44	1.8
  +++ Manager.java	2000/11/16 17:31:56	1.9
  @@ -1,4 +1,4 @@
  -/*-- $Id: Manager.java,v 1.8 2000/03/17 16:49:44 stefano Exp $ --
  +/*-- $Id: Manager.java,v 1.9 2000/11/16 17:31:56 greenrd Exp $ --
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -57,7 +57,7 @@
    * This class is used to create and control software actors and resources.
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version $Revision: 1.8 $ $Date: 2000/03/17 16:49:44 $
  + * @version $Revision: 1.9 $ $Date: 2000/11/16 17:31:56 $
    */
   
   public class Manager extends Hashtable implements Actor, Factory, Director {
  @@ -137,6 +137,19 @@
        }
   
       /**
  +     * Calls destroy() on all components that are instances of DestroyListener
  +     */
  +    public void destroyAll () {
  +       Enumeration e = elements ();
  +       while (e.hasMoreElements ()) {
  +          Object x = e.nextElement ();
  +          if (x instanceof DestroyListener) {
  +            ((DestroyListener) x).destroy ();
  +          }
  +       }
  +    }
  +
  +    /**
        * Get the actor currently playing the given role.
        */
       public Object getActor(String role) {
  @@ -156,4 +169,4 @@
       public Enumeration getRoles() {
           return this.keys();
       }
  -}
  \ No newline at end of file
  +}
  
  
  
  1.1                  xml-cocoon/src/org/apache/cocoon/framework/DestroyListener.java
  
  Index: DestroyListener.java
  ===================================================================
  /*-- $Id: DestroyListener.java,v 1.1 2000/11/16 17:31:56 greenrd Exp $ --
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) @year@ The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, 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  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Cocoon" 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 name,  without prior written permission  of the
      Apache Software Foundation.
  
   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 (INCLU-
   DING, 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 and was  originally created by
   Stefano Mazzocchi  <st...@apache.org>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
   */
  package org.apache.cocoon.framework;
  
  /**
   * Implement this interface if your class needs to be notified of the
   * destruction of the Cocoon servlet.
   *
   * @author <a href="mailto:greenrd@hotmail.com">Robin Green</a>
   * @version $Revision: 1.1 $ $Date: 2000/11/16 17:31:56 $
   */
  
  public interface DestroyListener {
  
      public void destroy ();
  
  }