View Javadoc

1   /*
2    * Copyright 1999-2001,2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */ 
16  
17  package org.apache.commons.workflow;
18  
19  
20  import java.util.EventObject;
21  
22  
23  /**
24   * A <strong>ContextEvent</strong> provides notification to a
25   * <code>ContextListener</code> that a specified event has occurred for
26   * the specified context.
27   *
28   * @version $Revision: 155475 $ $Date: 2005-02-26 13:31:11 +0000 (Sat, 26 Feb 2005) $
29   * @author Craig R. McClanahan
30   */
31  
32  public class ContextEvent extends EventObject {
33  
34  
35      // ----------------------------------------------------------- Constructors
36  
37  
38      /**
39       * Construct a new immutable ContextEvent.
40       *
41       * @param context Context in which this event occurred
42       */
43      public ContextEvent(Context context) {
44  
45          this(context, null, null);
46  
47      }
48          
49  
50      /**
51       * Construct a new immutable ContextEvent.
52       *
53       * @param context Context upon which this event occurred
54       * @param step Step this event is associated with (if any)
55       */
56      public ContextEvent(Context context, Step step) {
57  
58          this(context, step, null);
59  
60      }
61  
62  
63      /**
64       * Construct a new immutable ContextEvent.
65       *
66       *
67       * @param context Context upon which this event occurred
68       * @param step Step this event is associated with (if any)
69       * @param exception StepException that was thrown
70       *  (<code>afterStep()</code> and <code>afterActivity()</code> only)
71       */
72      public ContextEvent(Context context, Step step, StepException exception) {
73  
74          super(context);
75          this.context = context;
76          this.step = step;
77          this.exception = exception;
78  
79      }
80          
81  
82      // ------------------------------------------------------------- Properties
83  
84  
85      /**
86       * The <code>Context</code> upon which this event occurred.
87       */
88      protected Context context = null;
89  
90      public Context getContext() {
91  
92          return (this.context);
93  
94      }
95  
96  
97      /**
98       * The <code>StepException</code> that caused this event.
99       */
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 }