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 import, and may contain a reference
|
|
15 * to the imported definition.
|
|
16 *
|
|
17 * @author Matthew J. Duftler (duftler@us.ibm.com)
|
|
18 */
|
|
19 public class IncludeImpl implements Include
|
|
20 {
|
|
21 protected String namespaceURI = null;
|
|
22 protected String locationURI = null;
|
|
23 /*
|
|
24 This would need to be made into a generic reference to handle other
|
|
25 types of referenced documents.
|
|
26 */
|
|
27 protected Application application = null;
|
|
28 protected Element docEl = null;
|
|
29 protected Map extensionAttributes = new HashMap();
|
|
30 protected List nativeAttributeNames =
|
|
31 Arrays.asList(Constants.IMPORT_ATTR_NAMES);
|
|
32
|
|
33 public static final long serialVersionUID = 1;
|
|
34
|
|
35 public void setNamespaceURI(String namespaceURI)
|
|
36 {
|
|
37 this.namespaceURI = namespaceURI;
|
|
38 }
|
|
39
|
|
40 public String getNamespaceURI()
|
|
41 {
|
|
42 return namespaceURI;
|
|
43 }
|
|
44
|
|
45 public void setLocationURI(String locationURI)
|
|
46 {
|
|
47 this.locationURI = locationURI;
|
|
48 }
|
|
49
|
|
50 public String getLocationURI()
|
|
51 {
|
|
52 return locationURI;
|
|
53 }
|
|
54
|
|
55 /**
|
|
56 * This property can be used to hang a referenced Definition,
|
|
57 * and the top-level Definition (i.e. the one with the <import>)
|
|
58 * will use this Definition when resolving referenced WSDL parts.
|
|
59 * This would need to be made into a generic reference to handle
|
|
60 * other types of referenced documents.
|
|
61 */
|
|
62 public void setApplication(Application application)
|
|
63 {
|
|
64 this.application = application;
|
|
65 }
|
|
66
|
|
67 /**
|
|
68 * This property can be used to hang a referenced Definition,
|
|
69 * and the top-level Definition (i.e. the one with the <import>)
|
|
70 * will use this Definition when resolving referenced WSDL parts.
|
|
71 * This would need to be made into a generic reference to handle
|
|
72 * other types of referenced documents.
|
|
73 */
|
|
74 public Application getApplication()
|
|
75 {
|
|
76 return application;
|
|
77 }
|
|
78
|
|
79 /**
|
|
80 * Set the documentation element for this document. This dependency
|
|
81 * on org.w3c.dom.Element should eventually be removed when a more
|
|
82 * appropriate way of representing this information is employed.
|
|
83 *
|
|
84 * @param docEl the documentation element
|
|
85 */
|
|
86 public void setDocumentationElement(Element docEl)
|
|
87 {
|
|
88 this.docEl = docEl;
|
|
89 }
|
|
90
|
|
91 /**
|
|
92 * Get the documentation element. This dependency on org.w3c.dom.Element
|
|
93 * should eventually be removed when a more appropriate way of
|
|
94 * representing this information is employed.
|
|
95 *
|
|
96 * @return the documentation element
|
|
97 */
|
|
98 public Element getDocumentationElement()
|
|
99 {
|
|
100 return docEl;
|
|
101 }
|
|
102
|
|
103 /**
|
|
104 * Set an extension attribute on this element. Pass in a null value to remove
|
|
105 * an extension attribute.
|
|
106 *
|
|
107 * @param name the extension attribute name
|
|
108 * @param value the extension attribute value. Can be a String, a QName, a
|
|
109 * List of Strings, or a List of QNames.
|
|
110 *
|
|
111 * @see #getExtensionAttribute
|
|
112 * @see #getExtensionAttributes
|
|
113 * @see ExtensionRegistry#registerExtensionAttributeType
|
|
114 * @see ExtensionRegistry#queryExtensionAttributeType
|
|
115 */
|
|
116 public void setExtensionAttribute(QName name, Object value)
|
|
117 {
|
|
118 if (value != null)
|
|
119 {
|
|
120 extensionAttributes.put(name, value);
|
|
121 }
|
|
122 else
|
|
123 {
|
|
124 extensionAttributes.remove(name);
|
|
125 }
|
|
126 }
|
|
127
|
|
128 /**
|
|
129 * Retrieve an extension attribute from this element. If the extension
|
|
130 * attribute is not defined, null is returned.
|
|
131 *
|
|
132 * @param name the extension attribute name
|
|
133 *
|
|
134 * @return the value of the extension attribute, or null if
|
|
135 * it is not defined. Can be a String, a QName, a List of Strings, or a List
|
|
136 * of QNames.
|
|
137 *
|
|
138 * @see #setExtensionAttribute
|
|
139 * @see #getExtensionAttributes
|
|
140 * @see ExtensionRegistry#registerExtensionAttributeType
|
|
141 * @see ExtensionRegistry#queryExtensionAttributeType
|
|
142 */
|
|
143 public Object getExtensionAttribute(QName name)
|
|
144 {
|
|
145 return extensionAttributes.get(name);
|
|
146 }
|
|
147
|
|
148 /**
|
|
149 * Get the map containing all the extension attributes defined
|
|
150 * on this element. The keys are the qnames of the attributes.
|
|
151 *
|
|
152 * @return a map containing all the extension attributes defined
|
|
153 * on this element
|
|
154 *
|
|
155 * @see #setExtensionAttribute
|
|
156 * @see #getExtensionAttribute
|
|
157 */
|
|
158 public Map getExtensionAttributes()
|
|
159 {
|
|
160 return extensionAttributes;
|
|
161 }
|
|
162
|
|
163 /**
|
|
164 * Get the list of local attribute names defined for this element in
|
|
165 * the WSDL specification.
|
|
166 *
|
|
167 * @return a List of Strings, one for each local attribute name
|
|
168 */
|
|
169 public List getNativeAttributeNames()
|
|
170 {
|
|
171 return nativeAttributeNames;
|
|
172 }
|
|
173
|
|
174 public String toString()
|
|
175 {
|
|
176 StringBuffer strBuf = new StringBuffer();
|
|
177
|
|
178 strBuf.append("Import:");
|
|
179
|
|
180 if (namespaceURI != null)
|
|
181 {
|
|
182 strBuf.append("\nnamespaceURI=" + namespaceURI);
|
|
183 }
|
|
184
|
|
185 if (locationURI != null)
|
|
186 {
|
|
187 strBuf.append("\nlocationURI=" + locationURI);
|
|
188 }
|
|
189
|
|
190 if (application != null)
|
|
191 {
|
|
192 strBuf.append("\napplication=" + application);
|
|
193 }
|
|
194
|
|
195 Iterator keys = extensionAttributes.keySet().iterator();
|
|
196
|
|
197 while (keys.hasNext())
|
|
198 {
|
|
199 QName name = (QName)keys.next();
|
|
200
|
|
201 strBuf.append("\nextension attribute: " + name + "=" +
|
|
202 extensionAttributes.get(name));
|
|
203 }
|
|
204
|
|
205 return strBuf.toString();
|
|
206 }
|
|
207 }
|