Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
DialogMetadata |
|
| 1.0555555555555556;1.056 | ||||
DialogMetadata$SCXMLAction |
|
| 1.0555555555555556;1.056 |
1 | /* | |
2 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
3 | * contributor license agreements. See the NOTICE file distributed with | |
4 | * this work for additional information regarding copyright ownership. | |
5 | * The ASF licenses this file to you under the Apache License, Version 2.0 | |
6 | * (the "License"); you may not use this file except in compliance with | |
7 | * the License. You may obtain a copy of the License at | |
8 | * | |
9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
10 | * | |
11 | * Unless required by applicable law or agreed to in writing, software | |
12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | * See the License for the specific language governing permissions and | |
15 | * limitations under the License. | |
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 | //---------------------------------------- SCXML dialog metadata variables | |
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 | //---------------------------------------- Constructors | |
98 | ||
99 | /** | |
100 | * Constructor. | |
101 | */ | |
102 | 0 | public DialogMetadata() { |
103 | 0 | this.dataclassname = DEFAULT_DIALOG_DATA_CLASS_NAME; |
104 | 0 | this.dialogActions = new ArrayList(); |
105 | 0 | } |
106 | ||
107 | ||
108 | //---------------------------------------- Public methods | |
109 | ||
110 | /** | |
111 | * Get the dialog name. | |
112 | * | |
113 | * @return Returns the dialog name. | |
114 | */ | |
115 | public String getName() { | |
116 | 0 | 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 | 0 | this.name = name; |
127 | 0 | } |
128 | ||
129 | ||
130 | /** | |
131 | * Get the data class FQN. | |
132 | * | |
133 | * @return Returns the dataclassname. | |
134 | */ | |
135 | public String getDataclassname() { | |
136 | 0 | 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 | 0 | if (dataclassname != null && dataclassname.trim().length() > 0) { |
147 | 0 | this.dataclassname = dataclassname; |
148 | } | |
149 | 0 | } |
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 | 0 | 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 | 0 | this.scxmlconfig = scxmlconfig; |
169 | 0 | } |
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 | 0 | 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 | 0 | this.stateMachine = stateMachine; |
191 | 0 | } |
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 | 0 | dialogActions.add(scxmlAction); |
200 | 0 | } |
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 | 0 | 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 | //------------------------------------------- Properties | |
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 | //------------------------------------------- Constructor | |
242 | ||
243 | /** | |
244 | * Constructor. | |
245 | */ | |
246 | public SCXMLAction() { | |
247 | 0 | super(); |
248 | 0 | } |
249 | ||
250 | //-------------------------------------------- Public methods | |
251 | ||
252 | /** | |
253 | * Get the action name. | |
254 | * | |
255 | * @return The action name. | |
256 | */ | |
257 | public String getName() { | |
258 | 0 | 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 | 0 | this.name = name; |
268 | 0 | } |
269 | ||
270 | /** | |
271 | * Get the action URI. | |
272 | * | |
273 | * @return The action URI. | |
274 | */ | |
275 | public String getUri() { | |
276 | 0 | 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 | 0 | this.uri = uri; |
286 | 0 | } |
287 | ||
288 | /** | |
289 | * Get the action class FQN. | |
290 | * | |
291 | * @return The action class FQN. | |
292 | */ | |
293 | public String getActionclassname() { | |
294 | 0 | 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 | 0 | this.actionclassname = actionclassname; |
304 | 0 | } |
305 | ||
306 | } | |
307 | ||
308 | } |