001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.commons.scxml.model;
018:
019: import java.io.Serializable;
020: import java.util.ArrayList;
021: import java.util.HashMap;
022: import java.util.List;
023: import java.util.Map;
024:
025: import org.apache.commons.scxml.PathResolver;
026:
027: /**
028: * The class in this SCXML object model that corresponds to the
029: * <invoke> SCXML element.
030: *
031: */
032: public class Invoke implements NamespacePrefixesHolder,
033: PathResolverHolder, Serializable {
034:
035: /**
036: * Serial version UID.
037: */
038: private static final long serialVersionUID = 1L;
039:
040: /**
041: * The type of target to be invoked.
042: */
043: private String targettype;
044:
045: /**
046: * The source URL for the external service.
047: */
048: private String src;
049:
050: /**
051: * The expression that evaluates to the source URL for the
052: * external service.
053: */
054: private String srcexpr;
055:
056: /**
057: * The Map of the params to be sent to the invoked process.
058: *
059: * Remove with deprecated getParams() in 1.0
060: */
061: private Map params;
062:
063: /**
064: * The List of the params to be sent to the invoked process.
065: */
066: private List paramsList;
067:
068: /**
069: * The <finalize> child, may be null.
070: */
071: private Finalize finalize;
072:
073: /**
074: * {@link PathResolver} for resolving the "src" or "srcexpr" result.
075: */
076: private PathResolver pathResolver;
077:
078: /**
079: * The current XML namespaces in the SCXML document for this action node,
080: * preserved for deferred XPath evaluation.
081: */
082: private Map namespaces;
083:
084: /**
085: * Default no-args constructor for Digester.
086: */
087: public Invoke() {
088: params = new HashMap();
089: paramsList = new ArrayList();
090: }
091:
092: /**
093: * Get the target type for this <invoke> element.
094: *
095: * @return String Returns the targettype.
096: */
097: public final String getTargettype() {
098: return targettype;
099: }
100:
101: /**
102: * Set the target type for this <invoke> element.
103: *
104: * @param targettype The targettype to set.
105: */
106: public final void setTargettype(final String targettype) {
107: this .targettype = targettype;
108: }
109:
110: /**
111: * Get the URL for the external service.
112: *
113: * @return String The URL.
114: */
115: public final String getSrc() {
116: return src;
117: }
118:
119: /**
120: * Set the URL for the external service.
121: *
122: * @param src The source URL.
123: */
124: public final void setSrc(final String src) {
125: this .src = src;
126: }
127:
128: /**
129: * Get the expression that evaluates to the source URL for the
130: * external service.
131: *
132: * @return String The source expression.
133: */
134: public final String getSrcexpr() {
135: return srcexpr;
136: }
137:
138: /**
139: * Set the expression that evaluates to the source URL for the
140: * external service.
141: *
142: * @param srcexpr The source expression.
143: */
144: public final void setSrcexpr(final String srcexpr) {
145: this .srcexpr = srcexpr;
146: }
147:
148: /**
149: * Get the params Map.
150: *
151: * @return Map The params map.
152: * @deprecated Remove in v1.0, use params() instead
153: */
154: public final Map getParams() {
155: return params;
156: }
157:
158: /**
159: * Get the list of {@link Param}s.
160: *
161: * @return List The params list.
162: */
163: public final List params() {
164: return paramsList;
165: }
166:
167: /**
168: * Add this param to this invoke.
169: *
170: * @param param The invoke parameter.
171: */
172: public final void addParam(final Param param) {
173: params.put(param.getName(), param.getExpr());
174: paramsList.add(param);
175: }
176:
177: /**
178: * Get the Finalize for this Invoke.
179: *
180: * @return Finalize The Finalize for this Invoke.
181: */
182: public final Finalize getFinalize() {
183: return finalize;
184: }
185:
186: /**
187: * Set the Finalize for this Invoke.
188: *
189: * @param finalize The Finalize for this Invoke.
190: */
191: public final void setFinalize(final Finalize finalize) {
192: this .finalize = finalize;
193: }
194:
195: /**
196: * Get the {@link PathResolver}.
197: *
198: * @return Returns the pathResolver.
199: */
200: public PathResolver getPathResolver() {
201: return pathResolver;
202: }
203:
204: /**
205: * Set the {@link PathResolver}.
206: *
207: * @param pathResolver The pathResolver to set.
208: */
209: public void setPathResolver(final PathResolver pathResolver) {
210: this .pathResolver = pathResolver;
211: }
212:
213: /**
214: * Get the XML namespaces at this action node in the SCXML document.
215: *
216: * @return Returns the map of namespaces.
217: */
218: public final Map getNamespaces() {
219: return namespaces;
220: }
221:
222: /**
223: * Set the XML namespaces at this action node in the SCXML document.
224: *
225: * @param namespaces The document namespaces.
226: */
227: public final void setNamespaces(final Map namespaces) {
228: this.namespaces = namespaces;
229: }
230:
231: }
|