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.io.Serializable;
20 import java.util.Map;
21
22 import org.w3c.dom.Node;
23
24 /***
25 * The class in this SCXML object model that corresponds to the SCXML
26 * <data> child element of the <datamodel> element.
27 *
28 */
29 public class Data implements NamespacePrefixesHolder, Serializable {
30
31 /***
32 * Serial version UID.
33 */
34 private static final long serialVersionUID = 1L;
35
36 /***
37 * The name of this data instance, that is used as its identifier.
38 */
39 private String name;
40
41 /***
42 * The URL to get the XML data tree from.
43 */
44 private String src;
45
46 /***
47 * The expression that evaluates to the value of this data instance.
48 */
49 private String expr;
50
51 /***
52 * The child XML data tree, parsed as a Node, cloned per execution
53 * instance.
54 */
55 private Node node;
56
57 /***
58 * The current XML namespaces in the SCXML document for this action node,
59 * preserved for deferred XPath evaluation. Easier than to scrape node
60 * above, given the Builtin API.
61 */
62 private Map namespaces;
63
64 /***
65 * Constructor.
66 */
67 public Data() {
68 this.name = null;
69 this.src = null;
70 this.expr = null;
71 this.node = null;
72 }
73
74 /***
75 * Get the name.
76 *
77 * @return String The name.
78 */
79 public final String getName() {
80 return name;
81 }
82
83 /***
84 * Set the name.
85 *
86 * @param name The name.
87 */
88 public final void setName(final String name) {
89 this.name = name;
90 }
91
92 /***
93 * Get the URL where the XML data tree resides.
94 *
95 * @return String The URL.
96 */
97 public final String getSrc() {
98 return src;
99 }
100
101 /***
102 * Set the URL where the XML data tree resides.
103 *
104 * @param src The source URL.
105 */
106 public final void setSrc(final String src) {
107 this.src = src;
108 }
109
110 /***
111 * Get the expression that evaluates to the value of this data instance.
112 *
113 * @return String The expression.
114 */
115 public final String getExpr() {
116 return expr;
117 }
118
119 /***
120 * Set the expression that evaluates to the value of this data instance.
121 *
122 * @param expr The expression.
123 */
124 public final void setExpr(final String expr) {
125 this.expr = expr;
126 }
127
128 /***
129 * Get the XML data tree.
130 *
131 * @return Node The XML data tree, parsed as a <code>Node</code>.
132 */
133 public final Node getNode() {
134 return node;
135 }
136
137 /***
138 * Set the XML data tree.
139 *
140 * @param node The XML data tree, parsed as a <code>Node</code>.
141 */
142 public final void setNode(final Node node) {
143 this.node = node;
144 }
145
146 /***
147 * Get the XML namespaces at this action node in the SCXML document.
148 *
149 * @return Returns the map of namespaces.
150 */
151 public final Map getNamespaces() {
152 return namespaces;
153 }
154
155 /***
156 * Set the XML namespaces at this action node in the SCXML document.
157 *
158 * @param namespaces The document namespaces.
159 */
160 public final void setNamespaces(final Map namespaces) {
161 this.namespaces = namespaces;
162 }
163
164 }
165