1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.scxml.model;
18
19 import java.util.Collection;
20
21 import org.apache.commons.logging.Log;
22 import org.apache.commons.scxml.ErrorReporter;
23 import org.apache.commons.scxml.EventDispatcher;
24 import org.apache.commons.scxml.SCInstance;
25 import org.apache.commons.scxml.SCXMLExpressionException;
26 import org.apache.commons.scxml.TriggerEvent;
27
28 /***
29 * The class in this SCXML object model that corresponds to the
30 * <event> SCXML element.
31 *
32 * @since 0.7
33 */
34 public class Event extends Action {
35
36 /***
37 * Serial version UID.
38 */
39 private static final long serialVersionUID = 1L;
40
41 /***
42 * The name of the derived event to be generated.
43 */
44 private String name;
45
46 /***
47 * Constructor.
48 */
49 public Event() {
50 super();
51 }
52
53 /***
54 * Get the event name.
55 *
56 * @return Returns the name.
57 */
58 public final String getName() {
59 return name;
60 }
61
62 /***
63 * Set the event name.
64 *
65 * @param name The event name to set.
66 */
67 public final void setName(final String name) {
68 this.name = name;
69 }
70
71 /***
72 * {@inheritDoc}
73 */
74 public void execute(final EventDispatcher evtDispatcher,
75 final ErrorReporter errRep, final SCInstance scInstance,
76 final Log appLog, final Collection derivedEvents)
77 throws ModelException, SCXMLExpressionException {
78
79 if (appLog.isDebugEnabled()) {
80 appLog.debug("<event>: Adding event named '" + name
81 + "' to list of derived events.");
82 }
83 TriggerEvent ev = new TriggerEvent(name, TriggerEvent.SIGNAL_EVENT);
84 derivedEvents.add(ev);
85
86 }
87
88 }
89