Mercurial > repos > ganjoo > webservice_toolsuite
comparison WebServiceToolWorkflow/lib/SAWADLParser/src/edu/uga/cs/lsdis/meteors/wadls/OperationAddOnImpl.java @ 0:d5cd409b8a18 default tip
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
author | ganjoo |
---|---|
date | Tue, 07 Jun 2011 18:00:50 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:d5cd409b8a18 |
---|---|
1 /* | |
2 * Created on Apr 4, 2005 | |
3 * | |
4 */ | |
5 package edu.uga.cs.lsdis.meteors.wadls; | |
6 | |
7 import java.util.*; | |
8 | |
9 import javax.wadls.*; | |
10 import javax.xml.namespace.*; | |
11 | |
12 import org.w3c.dom.*; | |
13 | |
14 /** | |
15 * This class represents an instance of PreCondition or Effect, | |
16 * | |
17 * @author Zixin Wu | |
18 */ | |
19 public class OperationAddOnImpl implements PreCondition, Effect | |
20 { | |
21 protected String name = null; | |
22 protected List<ModelReference> modelReferences = null; | |
23 protected String expression = null; | |
24 protected Element docEl = null; | |
25 protected Map extensionAttributes = new HashMap(); | |
26 protected List nativeAttributeNames = | |
27 Arrays.asList(Constants.OPADDON_ATTR_NAMES); | |
28 | |
29 public static final long serialVersionUID = 1; | |
30 | |
31 /** | |
32 * Set the name. | |
33 * | |
34 * @param name the desired name | |
35 */ | |
36 public void setName(String name) | |
37 { | |
38 this.name = name; | |
39 } | |
40 | |
41 /** | |
42 * Get the name. | |
43 * | |
44 * @return the name | |
45 */ | |
46 public String getName() | |
47 { | |
48 return name; | |
49 } | |
50 | |
51 /** | |
52 * Get the modelReference. | |
53 * | |
54 * @return The modelReference | |
55 */ | |
56 public ModelReference getModelReference(){ | |
57 if(modelReferences == null) | |
58 return null; | |
59 return modelReferences.get(0); | |
60 } | |
61 | |
62 /** | |
63 * Set the modelReference. | |
64 * | |
65 * @param modelReference The desired modelReference. | |
66 */ | |
67 public void addModelReference(ModelReference modelReference){ | |
68 if(modelReferences == null) | |
69 modelReferences = new ArrayList<ModelReference>(); | |
70 modelReferences.add(0, modelReference); | |
71 } | |
72 | |
73 /** | |
74 * Set the expression. | |
75 * | |
76 * @param expression The desired expression. | |
77 */ | |
78 public void setExpression(String expression){ | |
79 this.expression = expression; | |
80 } | |
81 | |
82 /** | |
83 * Get the expression. | |
84 * | |
85 * @return The expression. | |
86 */ | |
87 public String getExpression(){ | |
88 return this.expression; | |
89 } | |
90 | |
91 /** | |
92 * Set the documentation element for this document. This dependency | |
93 * on org.w3c.dom.Element should eventually be removed when a more | |
94 * appropriate way of representing this information is employed. | |
95 * | |
96 * @param docEl the documentation element | |
97 */ | |
98 public void setDocumentationElement(Element docEl) | |
99 { | |
100 this.docEl = docEl; | |
101 } | |
102 | |
103 /** | |
104 * Get the documentation element. This dependency on org.w3c.dom.Element | |
105 * should eventually be removed when a more appropriate way of | |
106 * representing this information is employed. | |
107 * | |
108 * @return the documentation element | |
109 */ | |
110 public Element getDocumentationElement() | |
111 { | |
112 return docEl; | |
113 } | |
114 | |
115 /** | |
116 * Set an extension attribute on this element. Pass in a null value to remove | |
117 * an extension attribute. | |
118 * | |
119 * @param name the extension attribute name | |
120 * @param value the extension attribute value. Can be a String, a QName, a | |
121 * List of Strings, or a List of QNames. | |
122 * | |
123 * @see #getExtensionAttribute | |
124 * @see #getExtensionAttributes | |
125 * @see ExtensionRegistry#registerExtensionAttributeType | |
126 * @see ExtensionRegistry#queryExtensionAttributeType | |
127 */ | |
128 public void setExtensionAttribute(QName name, Object value) | |
129 { | |
130 if (value != null) | |
131 { | |
132 extensionAttributes.put(name, value); | |
133 } | |
134 else | |
135 { | |
136 extensionAttributes.remove(name); | |
137 } | |
138 } | |
139 | |
140 /** | |
141 * Retrieve an extension attribute from this element. If the extension | |
142 * attribute is not defined, null is returned. | |
143 * | |
144 * @param name the extension attribute name | |
145 * | |
146 * @return the value of the extension attribute, or null if | |
147 * it is not defined. Can be a String, a QName, a List of Strings, or a List | |
148 * of QNames. | |
149 * | |
150 * @see #setExtensionAttribute | |
151 * @see #getExtensionAttributes | |
152 * @see ExtensionRegistry#registerExtensionAttributeType | |
153 * @see ExtensionRegistry#queryExtensionAttributeType | |
154 */ | |
155 public Object getExtensionAttribute(QName name) | |
156 { | |
157 return extensionAttributes.get(name); | |
158 } | |
159 | |
160 /** | |
161 * Get the map containing all the extension attributes defined | |
162 * on this element. The keys are the qnames of the attributes. | |
163 * | |
164 * @return a map containing all the extension attributes defined | |
165 * on this element | |
166 * | |
167 * @see #setExtensionAttribute | |
168 * @see #getExtensionAttribute | |
169 */ | |
170 public Map getExtensionAttributes() | |
171 { | |
172 return extensionAttributes; | |
173 } | |
174 | |
175 /** | |
176 * Get the list of local attribute names defined for this element in | |
177 * the WSDLS specification. | |
178 * | |
179 * @return a List of Strings, one for each local attribute name | |
180 */ | |
181 public List getNativeAttributeNames() | |
182 { | |
183 return nativeAttributeNames; | |
184 } | |
185 | |
186 public String toString() | |
187 { | |
188 StringBuffer strBuf = new StringBuffer(); | |
189 | |
190 strBuf.append("name=" + name); | |
191 | |
192 strBuf.append("\nmodelReference="); | |
193 for(ModelReference ref : modelReferences) { | |
194 strBuf.append(ref.toString()); | |
195 strBuf.append('\n'); | |
196 } | |
197 | |
198 if (expression != null) | |
199 { | |
200 strBuf.append("\nexpression=" + expression); | |
201 } | |
202 | |
203 // Iterator keys = extensionAttributes.keySet().iterator(); | |
204 // | |
205 // while (keys.hasNext()) | |
206 // { | |
207 // QName name = (QName)keys.next(); | |
208 // | |
209 // strBuf.append("\nextension attribute: " + name + "=" + | |
210 // extensionAttributes.get(name)); | |
211 // } | |
212 | |
213 return strBuf.toString(); | |
214 } | |
215 | |
216 public List<ModelReference> getModelReferences() { | |
217 return modelReferences; | |
218 } | |
219 | |
220 public void setModelReferences(List<ModelReference> refs) { | |
221 modelReferences = refs; | |
222 } | |
223 } |