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.model.Action;
27
28 /***
29 * Our custom "hello world" action.
30 */
31 public class Hello extends Action {
32
33 /*** Serial version UID. */
34 private static final long serialVersionUID = 1L;
35 /*** This is who we say hello to. */
36 private String name;
37 /*** We count callbacks to execute() as part of the test suite. */
38 public static int callbacks = 0;
39
40 /*** Public constructor is needed for the I in SCXML IO. */
41 public Hello() {
42 super();
43 }
44
45 /***
46 * Get the name.
47 *
48 * @return Returns the name.
49 */
50 public String getName() {
51 return name;
52 }
53
54 /***
55 * Set the name.
56 *
57 * @param name The name to set.
58 */
59 public void setName(String name) {
60 this.name = name;
61 }
62
63 /***
64 * @inheritDoc
65 */
66 public void execute(final EventDispatcher evtDispatcher,
67 final ErrorReporter errRep, final SCInstance scInstance,
68 final Log appLog, final Collection derivedEvents)
69 throws ModelException, SCXMLExpressionException {
70 if (appLog.isInfoEnabled()) {
71 appLog.info("Hello " + name);
72 }
73 callbacks++;
74 }
75 }
76