View Javadoc

1   /*
2    *
3    *   Copyright 2006 The Apache Software Foundation.
4    *
5    *  Licensed under the Apache License, Version 2.0 (the "License");
6    *  you may not use this file except in compliance with the License.
7    *  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.commons.scxml.model;
19  
20  import java.util.HashMap;
21  import java.util.Map;
22  
23  import org.apache.commons.scxml.PathResolver;
24  
25  /***
26   * The class in this SCXML object model that corresponds to the
27   * <invoke> SCXML element.
28   *
29   */
30  public class Invoke implements PathResolverHolder {
31  
32      /***
33       * The type of target to be invoked.
34       */
35      private String targettype;
36  
37      /***
38       * The source URL for the external service.
39       */
40      private String src;
41  
42      /***
43       * The expression that evaluates to the source URL for the
44       * external service.
45       */
46      private String srcexpr;
47  
48      /***
49       * The Map of the params to be sent to the invoked process.
50       */
51      private Map params;
52  
53      /***
54       * The <finalize> child, may be null.
55       */
56      private Finalize finalize;
57  
58      /***
59       * {@link PathResolver} for resolving the "src" or "srcexpr" result.
60       */
61      private PathResolver pathResolver;
62  
63      /***
64       * Default no-args constructor for Digester.
65       */
66      public Invoke() {
67          params = new HashMap();
68      }
69  
70      /***
71       * Get the target type for this <invoke> element.
72       *
73       * @return String Returns the targettype.
74       */
75      public final String getTargettype() {
76          return targettype;
77      }
78  
79      /***
80       * Set the target type for this <invoke> element.
81       *
82       * @param targettype The targettype to set.
83       */
84      public final void setTargettype(final String targettype) {
85          this.targettype = targettype;
86      }
87  
88      /***
89       * Get the URL for the external service.
90       *
91       * @return String The URL.
92       */
93      public final String getSrc() {
94          return src;
95      }
96  
97      /***
98       * Set the URL for the external service.
99       *
100      * @param src The source URL.
101      */
102     public final void setSrc(final String src) {
103         this.src = src;
104     }
105 
106     /***
107      * Get the expression that evaluates to the source URL for the
108      * external service.
109      *
110      * @return String The source expression.
111      */
112     public final String getSrcexpr() {
113         return srcexpr;
114     }
115 
116     /***
117      * Set the expression that evaluates to the source URL for the
118      * external service.
119      *
120      * @param srcexpr The source expression.
121      */
122     public final void setSrcexpr(final String srcexpr) {
123         this.srcexpr = srcexpr;
124     }
125 
126     /***
127      * Get the params Map.
128      *
129      * @return Map The params map.
130      */
131     public final Map getParams() {
132         return params;
133     }
134 
135     /***
136      * Add this param to this invoke.
137      *
138      * @param param The invoke parameter.
139      */
140     public final void addParam(final Param param) {
141         params.put(param.getName(), param.getExpr());
142     }
143 
144     /***
145      * Get the Finalize for this Invoke.
146      *
147      * @return Finalize The Finalize for this Invoke.
148      */
149     public final Finalize getFinalize() {
150         return finalize;
151     }
152 
153     /***
154      * Set the Finalize for this Invoke.
155      *
156      * @param finalize The Finalize for this Invoke.
157      */
158     public final void setFinalize(final Finalize finalize) {
159         this.finalize = finalize;
160     }
161 
162     /***
163      * Get the {@link PathResolver}.
164      *
165      * @return Returns the pathResolver.
166      */
167     public PathResolver getPathResolver() {
168         return pathResolver;
169     }
170 
171     /***
172      * Set the {@link PathResolver}.
173      *
174      * @param pathResolver The pathResolver to set.
175      */
176     public void setPathResolver(final PathResolver pathResolver) {
177         this.pathResolver = pathResolver;
178     }
179 
180 }
181