001: /*
002: * Copyright 1999,2004 The Apache Software Foundation.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: package org.apache.catalina;
018:
019: import java.util.EventObject;
020:
021: /**
022: * General event for notifying listeners of significant changes on a component
023: * that implements the Lifecycle interface. In particular, this will be useful
024: * on Containers, where these events replace the ContextInterceptor concept in
025: * Tomcat 3.x.
026: *
027: * @author Craig R. McClanahan
028: * @version $Revision: 1.2 $ $Date: 2004/02/27 14:58:38 $
029: */
030:
031: public final class LifecycleEvent extends EventObject {
032:
033: // ----------------------------------------------------------- Constructors
034:
035: /**
036: * Construct a new LifecycleEvent with the specified parameters.
037: *
038: * @param lifecycle Component on which this event occurred
039: * @param type Event type (required)
040: */
041: public LifecycleEvent(Lifecycle lifecycle, String type) {
042:
043: this (lifecycle, type, null);
044:
045: }
046:
047: /**
048: * Construct a new LifecycleEvent with the specified parameters.
049: *
050: * @param lifecycle Component on which this event occurred
051: * @param type Event type (required)
052: * @param data Event data (if any)
053: */
054: public LifecycleEvent(Lifecycle lifecycle, String type, Object data) {
055:
056: super (lifecycle);
057: this .lifecycle = lifecycle;
058: this .type = type;
059: this .data = data;
060:
061: }
062:
063: // ----------------------------------------------------- Instance Variables
064:
065: /**
066: * The event data associated with this event.
067: */
068: private Object data = null;
069:
070: /**
071: * The Lifecycle on which this event occurred.
072: */
073: private Lifecycle lifecycle = null;
074:
075: /**
076: * The event type this instance represents.
077: */
078: private String type = null;
079:
080: // ------------------------------------------------------------- Properties
081:
082: /**
083: * Return the event data of this event.
084: */
085: public Object getData() {
086:
087: return (this .data);
088:
089: }
090:
091: /**
092: * Return the Lifecycle on which this event occurred.
093: */
094: public Lifecycle getLifecycle() {
095:
096: return (this .lifecycle);
097:
098: }
099:
100: /**
101: * Return the event type of this event.
102: */
103: public String getType() {
104:
105: return (this.type);
106:
107: }
108:
109: }
|