1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.commons.scxml.model;
17
18 import java.util.Collection;
19
20 import org.apache.commons.logging.Log;
21 import org.apache.commons.scxml.ErrorReporter;
22 import org.apache.commons.scxml.EventDispatcher;
23 import org.apache.commons.scxml.SCInstance;
24 import org.apache.commons.scxml.SCXMLExpressionException;
25 import org.apache.commons.scxml.model.Action;
26
27 /***
28 * Our custom "hello world" action.
29 */
30 public class Hello extends Action {
31
32 /*** This is who we say hello to. */
33 private String name;
34 /*** We count callbacks to execute() as part of the test suite. */
35 public static int callbacks = 0;
36
37 /*** Public constructor is needed for the I in SCXML IO. */
38 public Hello() {
39 super();
40 }
41
42 /***
43 * Get the name.
44 *
45 * @return Returns the name.
46 */
47 public String getName() {
48 return name;
49 }
50
51 /***
52 * Set the name.
53 *
54 * @param name The name to set.
55 */
56 public void setName(String name) {
57 this.name = name;
58 }
59
60 /***
61 * @inheritDoc
62 */
63 public void execute(final EventDispatcher evtDispatcher,
64 final ErrorReporter errRep, final SCInstance scInstance,
65 final Log appLog, final Collection derivedEvents)
66 throws ModelException, SCXMLExpressionException {
67 if (appLog.isInfoEnabled()) {
68 appLog.info("Hello " + name);
69 }
70 callbacks++;
71 }
72 }
73