001 /* 002 * Copyright 1999-2001,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.commons.workflow; 018 019 020 import java.util.EventObject; 021 022 023 /** 024 * A <strong>ContextEvent</strong> provides notification to a 025 * <code>ContextListener</code> that a specified event has occurred for 026 * the specified context. 027 * 028 * @version $Revision: 155475 $ $Date: 2005-02-26 13:31:11 +0000 (Sat, 26 Feb 2005) $ 029 * @author Craig R. McClanahan 030 */ 031 032 public class ContextEvent extends EventObject { 033 034 035 // ----------------------------------------------------------- Constructors 036 037 038 /** 039 * Construct a new immutable ContextEvent. 040 * 041 * @param context Context in which this event occurred 042 */ 043 public ContextEvent(Context context) { 044 045 this(context, null, null); 046 047 } 048 049 050 /** 051 * Construct a new immutable ContextEvent. 052 * 053 * @param context Context upon which this event occurred 054 * @param step Step this event is associated with (if any) 055 */ 056 public ContextEvent(Context context, Step step) { 057 058 this(context, step, null); 059 060 } 061 062 063 /** 064 * Construct a new immutable ContextEvent. 065 * 066 * 067 * @param context Context upon which this event occurred 068 * @param step Step this event is associated with (if any) 069 * @param exception StepException that was thrown 070 * (<code>afterStep()</code> and <code>afterActivity()</code> only) 071 */ 072 public ContextEvent(Context context, Step step, StepException exception) { 073 074 super(context); 075 this.context = context; 076 this.step = step; 077 this.exception = exception; 078 079 } 080 081 082 // ------------------------------------------------------------- Properties 083 084 085 /** 086 * The <code>Context</code> upon which this event occurred. 087 */ 088 protected Context context = null; 089 090 public Context getContext() { 091 092 return (this.context); 093 094 } 095 096 097 /** 098 * The <code>StepException</code> that caused this event. 099 */ 100 protected StepException exception = null; 101 102 public StepException getException() { 103 104 return (this.exception); 105 106 } 107 108 109 /** 110 * The <code>Step</code> upon which this event occurred. For 111 * <code>beanReplaced</code> events, this will be the previous step. 112 */ 113 protected Step step = null; 114 115 public Step getStep() { 116 117 return (this.step); 118 119 } 120 121 122 }