2009/05/20 - Apache Shale has been retired.
For more information, please explore the Attic.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.shale.dialog.scxml.config;
19
20 import java.io.Serializable;
21 import java.util.ArrayList;
22 import java.util.List;
23
24 import org.apache.commons.scxml.model.SCXML;
25
26
27 /***
28 * <p>Bean encapsulating metadata for a Shale dialog when using Commons SCXML
29 * to drive the underlying state machine.</p>
30 *
31 * <p>This includes:
32 * <ul>
33 * <li>The logical name of this dialog.</li>
34 * <li>The document location where Commons SCXML can find the SCXML document
35 * describing this dialog.</li>
36 * <li>The Commons SCXML object model for this dialog obtained by parsing
37 * the above document.</li>
38 * <li>The dialog data class name, an instance of which will be set as
39 * dialog data once an instance of this dialog is started.</li>
40 * <li>A list of Commons SCXML custom actions, that will be defined for this
41 * dialog.</li>
42 * </ul>
43 * </p>
44 *
45 * <p><strong>WARNING</strong> - These classes should <strong>ONLY</strong>
46 * be used by the dialog framework infrastructure. They are
47 * <strong>NOT</strong> meant to be used by the application.</p>
48 *
49 * @since 1.0.4
50 *
51 * $Id: DialogMetadata.java 491384 2006-12-31 04:43:49Z rahul $
52 */
53 public class DialogMetadata implements Serializable {
54
55
56
57 /***
58 * Serial version UID.
59 */
60 private static final long serialVersionUID = -4399162240006113135L;
61
62 /***
63 * <p>Default FQCN for dialog data.</p>
64 */
65 private static final String DEFAULT_DIALOG_DATA_CLASS_NAME = "java.util.HashMap";
66
67
68 /***
69 * The dialog name.
70 */
71 private String name;
72
73 /***
74 * The location where the SCXML document for this dialog resides.
75 */
76 private String scxmlconfig;
77
78
79 /***
80 * The Commons SCXML object model describing the state machine for this dialog.
81 */
82 private SCXML stateMachine;
83
84
85 /***
86 * The FQCN of the dialog data.
87 */
88 private String dataclassname;
89
90
91 /***
92 * The custom Commons SCXML actions for this dialog.
93 */
94 private List dialogActions;
95
96
97
98
99 /***
100 * Constructor.
101 */
102 public DialogMetadata() {
103 this.dataclassname = DEFAULT_DIALOG_DATA_CLASS_NAME;
104 this.dialogActions = new ArrayList();
105 }
106
107
108
109
110 /***
111 * Get the dialog name.
112 *
113 * @return Returns the dialog name.
114 */
115 public String getName() {
116 return name;
117 }
118
119
120 /***
121 * Set the dialog name.
122 *
123 * @param name The dialog name.
124 */
125 public void setName(String name) {
126 this.name = name;
127 }
128
129
130 /***
131 * Get the data class FQN.
132 *
133 * @return Returns the dataclassname.
134 */
135 public String getDataclassname() {
136 return dataclassname;
137 }
138
139
140 /***
141 * Set the data class FQN.
142 *
143 * @param dataclassname The data class FQN.
144 */
145 public void setDataclassname(String dataclassname) {
146 if (dataclassname != null && dataclassname.trim().length() > 0) {
147 this.dataclassname = dataclassname;
148 }
149 }
150
151
152 /***
153 * Get the location where the SCXML document for this dialog resides.
154 *
155 * @return Returns the scxmlconfig.
156 */
157 public String getScxmlconfig() {
158 return scxmlconfig;
159 }
160
161
162 /***
163 * Set the location where the SCXML document for this dialog resides.
164 *
165 * @param scxmlconfig The SCXML dialog configuration file location.
166 */
167 public void setScxmlconfig(String scxmlconfig) {
168 this.scxmlconfig = scxmlconfig;
169 }
170
171
172 /***
173 * Get the Commons SCXML object model describing the state machine
174 * for this dialog.
175 *
176 * @return Returns the stateMachine.
177 */
178 public SCXML getStateMachine() {
179 return stateMachine;
180 }
181
182
183 /***
184 * Set the Commons SCXML object model describing the state machine
185 * for this dialog.
186 *
187 * @param stateMachine The stateMachine to set.
188 */
189 public void setStateMachine(SCXML stateMachine) {
190 this.stateMachine = stateMachine;
191 }
192
193 /***
194 * Add this Commons SCXML custom action for this specific dialog.
195 *
196 * @param scxmlAction The SCXMLAction to be added.
197 */
198 public void addDialogAction(SCXMLAction scxmlAction) {
199 dialogActions.add(scxmlAction);
200 }
201
202
203 /***
204 * Get the list of dialog actions defined for this specific dialog.
205 *
206 * @return Returns the list of DialogActions.
207 */
208 public List getDialogActions() {
209 return dialogActions;
210 }
211
212
213 /***
214 * A POJO representing the bits of a custom Commons SCXML action used
215 * in a Shale dialog.
216 *
217 */
218 public static class SCXMLAction implements Serializable {
219
220 /***
221 * Serial version UID.
222 */
223 private static final long serialVersionUID = 1L;
224
225
226 /***
227 * The action name.
228 */
229 private String name;
230
231 /***
232 * The action URI.
233 */
234 private String uri;
235
236 /***
237 * The action class FQN.
238 */
239 private String actionclassname;
240
241
242
243 /***
244 * Constructor.
245 */
246 public SCXMLAction() {
247 super();
248 }
249
250
251
252 /***
253 * Get the action name.
254 *
255 * @return The action name.
256 */
257 public String getName() {
258 return name;
259 }
260
261 /***
262 * Set the action name.
263 *
264 * @param name The action name.
265 */
266 public void setName(String name) {
267 this.name = name;
268 }
269
270 /***
271 * Get the action URI.
272 *
273 * @return The action URI.
274 */
275 public String getUri() {
276 return uri;
277 }
278
279 /***
280 * Set the action URI.
281 *
282 * @param uri The action URI.
283 */
284 public void setUri(String uri) {
285 this.uri = uri;
286 }
287
288 /***
289 * Get the action class FQN.
290 *
291 * @return The action class FQN.
292 */
293 public String getActionclassname() {
294 return actionclassname;
295 }
296
297 /***
298 * Set the action class FQN.
299 *
300 * @param actionclassname The action class FQN.
301 */
302 public void setActionclassname(String actionclassname) {
303 this.actionclassname = actionclassname;
304 }
305
306 }
307
308 }