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