Home » apache-tomcat-6.0.26-src » org.apache » catalina » [javadoc | source]

    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements.  See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache License, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License.  You may obtain a copy of the License at
    8    * 
    9    *      http://www.apache.org/licenses/LICENSE-2.0
   10    * 
   11    * Unless required by applicable law or agreed to in writing, software
   12    * distributed under the License is distributed on an "AS IS" BASIS,
   13    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   14    * See the License for the specific language governing permissions and
   15    * limitations under the License.
   16    */
   17   
   18   
   19   package org.apache.catalina;
   20   
   21   
   22   import java.util.EventObject;
   23   
   24   
   25   /**
   26    * General event for notifying listeners of significant changes on a component
   27    * that implements the Lifecycle interface.  In particular, this will be useful
   28    * on Containers, where these events replace the ContextInterceptor concept in
   29    * Tomcat 3.x.
   30    *
   31    * @author Craig R. McClanahan
   32    * @version $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (Tue, 24 Oct 2006) $
   33    */
   34   
   35   public final class LifecycleEvent
   36       extends EventObject {
   37   
   38   
   39       // ----------------------------------------------------------- Constructors
   40   
   41   
   42       /**
   43        * Construct a new LifecycleEvent with the specified parameters.
   44        *
   45        * @param lifecycle Component on which this event occurred
   46        * @param type Event type (required)
   47        */
   48       public LifecycleEvent(Lifecycle lifecycle, String type) {
   49   
   50           this(lifecycle, type, null);
   51   
   52       }
   53   
   54   
   55       /**
   56        * Construct a new LifecycleEvent with the specified parameters.
   57        *
   58        * @param lifecycle Component on which this event occurred
   59        * @param type Event type (required)
   60        * @param data Event data (if any)
   61        */
   62       public LifecycleEvent(Lifecycle lifecycle, String type, Object data) {
   63   
   64           super(lifecycle);
   65           this.lifecycle = lifecycle;
   66           this.type = type;
   67           this.data = data;
   68   
   69       }
   70   
   71   
   72       // ----------------------------------------------------- Instance Variables
   73   
   74   
   75       /**
   76        * The event data associated with this event.
   77        */
   78       private Object data = null;
   79   
   80   
   81       /**
   82        * The Lifecycle on which this event occurred.
   83        */
   84       private Lifecycle lifecycle = null;
   85   
   86   
   87       /**
   88        * The event type this instance represents.
   89        */
   90       private String type = null;
   91   
   92   
   93       // ------------------------------------------------------------- Properties
   94   
   95   
   96       /**
   97        * Return the event data of this event.
   98        */
   99       public Object getData() {
  100   
  101           return (this.data);
  102   
  103       }
  104   
  105   
  106       /**
  107        * Return the Lifecycle on which this event occurred.
  108        */
  109       public Lifecycle getLifecycle() {
  110   
  111           return (this.lifecycle);
  112   
  113       }
  114   
  115   
  116       /**
  117        * Return the event type of this event.
  118        */
  119       public String getType() {
  120   
  121           return (this.type);
  122   
  123       }
  124   
  125   
  126   }

Home » apache-tomcat-6.0.26-src » org.apache » catalina » [javadoc | source]