0
|
1 /*
|
|
2 * (c) Copyright IBM Corp 2001, 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 import org.w3c.dom.*;
|
|
12
|
|
13 /**
|
|
14 * This class represents an output message, and contains the name
|
|
15 * of the output and the message itself.
|
|
16 *
|
|
17 * @author Matthew J. Duftler
|
|
18 */
|
|
19 public class ResponseImpl implements Response
|
|
20 {
|
|
21 protected String name = null;
|
|
22 List<String> inputXSDList = new Vector();
|
|
23 List<ParamImpl> paramList = new Vector();
|
|
24 protected List<ModelReference> modelReferences = null;
|
|
25 protected Element docEl = null;
|
|
26 protected Map extensionAttributes = new HashMap();
|
|
27 protected List nativeAttributeNames =
|
|
28 Arrays.asList(Constants.OUTPUT_ATTR_NAMES);
|
|
29
|
|
30 public static final long serialVersionUID = 1;
|
|
31
|
|
32 /**
|
|
33 * Set the name of this output message.
|
|
34 *
|
|
35 * @param name the desired name
|
|
36 */
|
|
37 public void setName(String name)
|
|
38 {
|
|
39 this.name = name;
|
|
40 }
|
|
41
|
|
42 public void setInputXSDList(List inputXSDList){
|
|
43 this.inputXSDList=inputXSDList;
|
|
44 }
|
|
45 public List getInputXSDList(){
|
|
46
|
|
47 return this.inputXSDList;
|
|
48 }
|
|
49
|
|
50
|
|
51 public void setParamList(List paramList){
|
|
52 this.paramList=paramList;
|
|
53 }
|
|
54 public List getParamList(){
|
|
55
|
|
56 return this.paramList;
|
|
57 }
|
|
58 /**
|
|
59 * Get the name of this output message.
|
|
60 *
|
|
61 * @return the output message name
|
|
62 */
|
|
63 public String getName()
|
|
64 {
|
|
65 return name;
|
|
66 }
|
|
67
|
|
68
|
|
69 /**
|
|
70 * Set the documentation element for this document. This dependency
|
|
71 * on org.w3c.dom.Element should eventually be removed when a more
|
|
72 * appropriate way of representing this information is employed.
|
|
73 *
|
|
74 * @param docEl the documentation element
|
|
75 */
|
|
76 public void setDocumentationElement(Element docEl)
|
|
77 {
|
|
78 this.docEl = docEl;
|
|
79 }
|
|
80 public ModelReference getModelReference(){
|
|
81 if(modelReferences == null)
|
|
82 return null;
|
|
83 return modelReferences.get(0);
|
|
84 }
|
|
85
|
|
86 /**
|
|
87 * Set the modelReference.
|
|
88 *
|
|
89 * @param modelReference The desired modelReference.
|
|
90 */
|
|
91 public void addModelReference(ModelReference modelReference){
|
|
92 if(modelReferences == null)
|
|
93 modelReferences = new ArrayList<ModelReference>();
|
|
94 modelReferences.add(0, modelReference);
|
|
95 }
|
|
96 public List<ModelReference> getModelReferences() {
|
|
97 return modelReferences;
|
|
98 }
|
|
99
|
|
100 public void setModelReferences(List<ModelReference> refs) {
|
|
101 modelReferences = refs;
|
|
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 WSDL 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("Output: name=" + name);
|
|
191
|
|
192
|
|
193 Iterator keys = extensionAttributes.keySet().iterator();
|
|
194
|
|
195 while (keys.hasNext())
|
|
196 {
|
|
197 QName name = (QName)keys.next();
|
|
198
|
|
199 strBuf.append("\nextension attribute: " + name + "=" +
|
|
200 extensionAttributes.get(name));
|
|
201 }
|
|
202
|
|
203 return strBuf.toString();
|
|
204 }
|
|
205 }
|