author | chegar |
Sun, 17 Aug 2014 15:52:15 +0100 | |
changeset 25871 | b80b84e87032 |
parent 23782 | jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/impl/BodyImpl.java@953bfc3fbe31 |
permissions | -rw-r--r-- |
12009 | 1 |
/* |
23782
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
2 |
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. |
12009 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
24 |
*/ |
|
25 |
||
26 |
package com.sun.xml.internal.messaging.saaj.soap.impl; |
|
27 |
||
28 |
import java.util.Iterator; |
|
29 |
import java.util.Locale; |
|
30 |
import java.util.logging.Level; |
|
31 |
||
32 |
import javax.xml.namespace.QName; |
|
33 |
import javax.xml.soap.*; |
|
23782
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
34 |
import javax.xml.stream.XMLStreamException; |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
35 |
import javax.xml.stream.XMLStreamReader; |
12009 | 36 |
import javax.xml.parsers.DocumentBuilder; |
37 |
import javax.xml.parsers.DocumentBuilderFactory; |
|
38 |
||
39 |
import org.w3c.dom.*; |
|
23782
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
40 |
import org.w3c.dom.Node; |
12009 | 41 |
|
42 |
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; |
|
43 |
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocument; |
|
44 |
import com.sun.xml.internal.messaging.saaj.soap.SOAPDocumentImpl; |
|
23782
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
45 |
import com.sun.xml.internal.messaging.saaj.soap.StaxBridge; |
12009 | 46 |
import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl; |
47 |
||
48 |
/** |
|
49 |
* The implementation of SOAP-ENV:BODY or the SOAPBody abstraction. |
|
50 |
* |
|
51 |
* @author Anil Vijendran (anil@sun.com) |
|
52 |
*/ |
|
53 |
public abstract class BodyImpl extends ElementImpl implements SOAPBody { |
|
54 |
private SOAPFault fault; |
|
23782
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
55 |
// private XMLStreamReaderToXMLStreamWriter staxBridge; |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
56 |
private StaxBridge staxBridge; |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
57 |
private boolean payloadStreamRead = false; |
12009 | 58 |
|
59 |
protected BodyImpl(SOAPDocumentImpl ownerDoc, NameImpl bodyName) { |
|
60 |
super(ownerDoc, bodyName); |
|
61 |
} |
|
62 |
||
63 |
protected abstract NameImpl getFaultName(String name); |
|
64 |
protected abstract boolean isFault(SOAPElement child); |
|
65 |
protected abstract SOAPBodyElement createBodyElement(Name name); |
|
66 |
protected abstract SOAPBodyElement createBodyElement(QName name); |
|
67 |
protected abstract SOAPFault createFaultElement(); |
|
68 |
protected abstract QName getDefaultFaultCode(); |
|
69 |
||
70 |
public SOAPFault addFault() throws SOAPException { |
|
71 |
if (hasFault()) { |
|
72 |
log.severe("SAAJ0110.impl.fault.already.exists"); |
|
73 |
throw new SOAPExceptionImpl("Error: Fault already exists"); |
|
74 |
} |
|
75 |
||
76 |
fault = createFaultElement(); |
|
77 |
||
78 |
addNode(fault); |
|
79 |
||
80 |
fault.setFaultCode(getDefaultFaultCode()); |
|
81 |
fault.setFaultString("Fault string, and possibly fault code, not set"); |
|
82 |
||
83 |
return fault; |
|
84 |
} |
|
85 |
||
86 |
public SOAPFault addFault( |
|
87 |
Name faultCode, |
|
88 |
String faultString, |
|
89 |
Locale locale) |
|
90 |
throws SOAPException { |
|
91 |
||
92 |
SOAPFault fault = addFault(); |
|
93 |
fault.setFaultCode(faultCode); |
|
94 |
fault.setFaultString(faultString, locale); |
|
95 |
return fault; |
|
96 |
} |
|
97 |
||
98 |
public SOAPFault addFault( |
|
99 |
QName faultCode, |
|
100 |
String faultString, |
|
101 |
Locale locale) |
|
102 |
throws SOAPException { |
|
103 |
||
104 |
SOAPFault fault = addFault(); |
|
105 |
fault.setFaultCode(faultCode); |
|
106 |
fault.setFaultString(faultString, locale); |
|
107 |
return fault; |
|
108 |
} |
|
109 |
||
110 |
public SOAPFault addFault(Name faultCode, String faultString) |
|
111 |
throws SOAPException { |
|
112 |
||
113 |
SOAPFault fault = addFault(); |
|
114 |
fault.setFaultCode(faultCode); |
|
115 |
fault.setFaultString(faultString); |
|
116 |
return fault; |
|
117 |
} |
|
118 |
||
119 |
public SOAPFault addFault(QName faultCode, String faultString) |
|
120 |
throws SOAPException { |
|
121 |
||
122 |
SOAPFault fault = addFault(); |
|
123 |
fault.setFaultCode(faultCode); |
|
124 |
fault.setFaultString(faultString); |
|
125 |
return fault; |
|
126 |
} |
|
127 |
||
128 |
void initializeFault() { |
|
129 |
FaultImpl flt = (FaultImpl) findFault(); |
|
130 |
fault = flt; |
|
131 |
} |
|
132 |
||
133 |
protected SOAPElement findFault() { |
|
134 |
Iterator eachChild = getChildElementNodes(); |
|
135 |
while (eachChild.hasNext()) { |
|
136 |
SOAPElement child = (SOAPElement) eachChild.next(); |
|
137 |
if (isFault(child)) { |
|
138 |
return child; |
|
139 |
} |
|
140 |
} |
|
141 |
||
142 |
return null; |
|
143 |
} |
|
144 |
||
145 |
public boolean hasFault() { |
|
23782
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
146 |
QName payloadQName = getPayloadQName(); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
147 |
return getFaultQName().equals(payloadQName); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
148 |
} |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
149 |
|
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
150 |
private Object getFaultQName() { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
151 |
return new QName(getNamespaceURI(), "Fault"); |
12009 | 152 |
} |
153 |
||
154 |
public SOAPFault getFault() { |
|
23782
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
155 |
if (hasFault()) { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
156 |
if (fault == null) { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
157 |
//initialize fault member |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
158 |
fault = (SOAPFault) getFirstChildElement(); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
159 |
} |
12009 | 160 |
return fault; |
23782
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
161 |
} |
12009 | 162 |
return null; |
163 |
} |
|
164 |
||
165 |
public SOAPBodyElement addBodyElement(Name name) throws SOAPException { |
|
166 |
SOAPBodyElement newBodyElement = |
|
167 |
(SOAPBodyElement) ElementFactory.createNamedElement( |
|
168 |
((SOAPDocument) getOwnerDocument()).getDocument(), |
|
169 |
name.getLocalName(), |
|
170 |
name.getPrefix(), |
|
171 |
name.getURI()); |
|
172 |
if (newBodyElement == null) { |
|
173 |
newBodyElement = createBodyElement(name); |
|
174 |
} |
|
175 |
addNode(newBodyElement); |
|
176 |
return newBodyElement; |
|
177 |
} |
|
178 |
||
179 |
public SOAPBodyElement addBodyElement(QName qname) throws SOAPException { |
|
180 |
SOAPBodyElement newBodyElement = |
|
181 |
(SOAPBodyElement) ElementFactory.createNamedElement( |
|
182 |
((SOAPDocument) getOwnerDocument()).getDocument(), |
|
183 |
qname.getLocalPart(), |
|
184 |
qname.getPrefix(), |
|
185 |
qname.getNamespaceURI()); |
|
186 |
if (newBodyElement == null) { |
|
187 |
newBodyElement = createBodyElement(qname); |
|
188 |
} |
|
189 |
addNode(newBodyElement); |
|
190 |
return newBodyElement; |
|
191 |
} |
|
192 |
||
193 |
public void setParentElement(SOAPElement element) throws SOAPException { |
|
194 |
||
195 |
if (!(element instanceof SOAPEnvelope)) { |
|
196 |
log.severe("SAAJ0111.impl.body.parent.must.be.envelope"); |
|
197 |
throw new SOAPException("Parent of SOAPBody has to be a SOAPEnvelope"); |
|
198 |
} |
|
199 |
super.setParentElement(element); |
|
200 |
} |
|
201 |
||
202 |
protected SOAPElement addElement(Name name) throws SOAPException { |
|
203 |
return addBodyElement(name); |
|
204 |
} |
|
205 |
||
206 |
protected SOAPElement addElement(QName name) throws SOAPException { |
|
207 |
return addBodyElement(name); |
|
208 |
} |
|
209 |
||
210 |
// public Node insertBefore(Node newElement, Node ref) throws DOMException { |
|
211 |
// if (!(newElement instanceof SOAPBodyElement) && (newElement instanceof SOAPElement)) { |
|
212 |
// newElement = new ElementWrapper((ElementImpl) newElement); |
|
213 |
// } |
|
214 |
// return super.insertBefore(newElement, ref); |
|
215 |
// } |
|
216 |
// |
|
217 |
// public Node replaceChild(Node newElement, Node ref) throws DOMException { |
|
218 |
// if (!(newElement instanceof SOAPBodyElement) && (newElement instanceof SOAPElement)) { |
|
219 |
// newElement = new ElementWrapper((ElementImpl) newElement); |
|
220 |
// } |
|
221 |
// return super.replaceChild(newElement, ref); |
|
222 |
// } |
|
223 |
||
224 |
public SOAPBodyElement addDocument(Document document) |
|
225 |
throws SOAPException { |
|
226 |
/* |
|
227 |
||
228 |
Element rootNode = |
|
229 |
document.getDocumentElement(); |
|
230 |
// Causes all deferred nodes to be inflated |
|
231 |
rootNode.normalize(); |
|
232 |
adoptElement(rootNode); |
|
233 |
SOAPBodyElement bodyElement = (SOAPBodyElement) convertToSoapElement(rootNode); |
|
234 |
addNode(bodyElement); |
|
235 |
return bodyElement; |
|
236 |
*/ |
|
237 |
///* |
|
238 |
SOAPBodyElement newBodyElement = null; |
|
239 |
DocumentFragment docFrag = document.createDocumentFragment(); |
|
240 |
Element rootElement = document.getDocumentElement(); |
|
241 |
if(rootElement != null) { |
|
242 |
docFrag.appendChild(rootElement); |
|
243 |
||
244 |
Document ownerDoc = getOwnerDocument(); |
|
245 |
// This copies the whole tree which could be very big so it's slow. |
|
246 |
// However, it does have the advantage of actually working. |
|
247 |
org.w3c.dom.Node replacingNode = ownerDoc.importNode(docFrag, true); |
|
248 |
// Adding replacingNode at the last of the children list of body |
|
249 |
addNode(replacingNode); |
|
250 |
Iterator i = |
|
251 |
getChildElements(NameImpl.copyElementName(rootElement)); |
|
252 |
// Return the child element with the required name which is at the |
|
253 |
// end of the list |
|
254 |
while(i.hasNext()) |
|
255 |
newBodyElement = (SOAPBodyElement) i.next(); |
|
256 |
} |
|
257 |
return newBodyElement; |
|
258 |
//*/ |
|
259 |
} |
|
260 |
||
261 |
protected SOAPElement convertToSoapElement(Element element) { |
|
262 |
if ((element instanceof SOAPBodyElement) && |
|
263 |
//this check is required because ElementImpl currently |
|
264 |
// implements SOAPBodyElement |
|
265 |
!(element.getClass().equals(ElementImpl.class))) { |
|
266 |
return (SOAPElement) element; |
|
267 |
} else { |
|
268 |
return replaceElementWithSOAPElement( |
|
269 |
element, |
|
270 |
(ElementImpl) createBodyElement(NameImpl |
|
271 |
.copyElementName(element))); |
|
272 |
} |
|
273 |
} |
|
274 |
||
275 |
public SOAPElement setElementQName(QName newName) throws SOAPException { |
|
276 |
log.log(Level.SEVERE, |
|
277 |
"SAAJ0146.impl.invalid.name.change.requested", |
|
278 |
new Object[] {elementQName.getLocalPart(), |
|
279 |
newName.getLocalPart()}); |
|
280 |
throw new SOAPException("Cannot change name for " |
|
281 |
+ elementQName.getLocalPart() + " to " |
|
282 |
+ newName.getLocalPart()); |
|
283 |
} |
|
284 |
||
285 |
public Document extractContentAsDocument() throws SOAPException { |
|
286 |
||
287 |
Iterator eachChild = getChildElements(); |
|
288 |
javax.xml.soap.Node firstBodyElement = null; |
|
289 |
||
290 |
while (eachChild.hasNext() && |
|
291 |
!(firstBodyElement instanceof SOAPElement)) |
|
292 |
firstBodyElement = (javax.xml.soap.Node) eachChild.next(); |
|
293 |
||
294 |
boolean exactlyOneChildElement = true; |
|
295 |
if (firstBodyElement == null) |
|
296 |
exactlyOneChildElement = false; |
|
297 |
else { |
|
298 |
for (org.w3c.dom.Node node = firstBodyElement.getNextSibling(); |
|
299 |
node != null; |
|
300 |
node = node.getNextSibling()) { |
|
301 |
||
302 |
if (node instanceof Element) { |
|
303 |
exactlyOneChildElement = false; |
|
304 |
break; |
|
305 |
} |
|
306 |
} |
|
307 |
} |
|
308 |
||
309 |
if(!exactlyOneChildElement) { |
|
310 |
log.log(Level.SEVERE, |
|
311 |
"SAAJ0250.impl.body.should.have.exactly.one.child"); |
|
312 |
throw new SOAPException("Cannot extract Document from body"); |
|
313 |
} |
|
314 |
||
315 |
Document document = null; |
|
316 |
try { |
|
317 |
DocumentBuilderFactory factory = |
|
318 |
new com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl(); |
|
319 |
factory.setNamespaceAware(true); |
|
320 |
DocumentBuilder builder = factory.newDocumentBuilder(); |
|
321 |
document = builder.newDocument(); |
|
322 |
||
323 |
Element rootElement = (Element) document.importNode( |
|
324 |
firstBodyElement, |
|
325 |
true); |
|
326 |
||
327 |
document.appendChild(rootElement); |
|
328 |
||
329 |
} catch(Exception e) { |
|
330 |
log.log(Level.SEVERE, |
|
331 |
"SAAJ0251.impl.cannot.extract.document.from.body"); |
|
332 |
throw new SOAPExceptionImpl( |
|
333 |
"Unable to extract Document from body", e); |
|
334 |
} |
|
335 |
||
336 |
firstBodyElement.detachNode(); |
|
337 |
||
338 |
return document; |
|
339 |
} |
|
340 |
||
23782
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
341 |
private void materializePayloadWrapException() { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
342 |
try { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
343 |
materializePayload(); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
344 |
} catch (SOAPException e) { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
345 |
throw new RuntimeException(e); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
346 |
} |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
347 |
} |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
348 |
private void materializePayload() throws SOAPException { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
349 |
if (staxBridge != null) { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
350 |
if (payloadStreamRead) { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
351 |
//the payload has already been read via stream reader and the |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
352 |
//stream has been exhausted already. Throw an |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
353 |
//exception since we are now trying to materialize as DOM and |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
354 |
//there is no stream left to read |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
355 |
throw new SOAPException("SOAPBody payload stream has been fully read - cannot materialize as DOM!"); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
356 |
} |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
357 |
try { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
358 |
staxBridge.bridgePayload(); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
359 |
staxBridge = null; |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
360 |
payloadStreamRead = true; |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
361 |
} catch (XMLStreamException e) { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
362 |
throw new SOAPException(e); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
363 |
} |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
364 |
} |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
365 |
} |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
366 |
|
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
367 |
@Override |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
368 |
public boolean hasChildNodes() { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
369 |
boolean hasChildren = super.hasChildNodes(); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
370 |
//to answer this question we need to know _whether_ we have at least one child |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
371 |
//So no need to materialize body if we already know we have a header child |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
372 |
if (!hasChildren) { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
373 |
materializePayloadWrapException(); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
374 |
} |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
375 |
return super.hasChildNodes(); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
376 |
} |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
377 |
|
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
378 |
@Override |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
379 |
public NodeList getChildNodes() { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
380 |
materializePayloadWrapException(); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
381 |
return super.getChildNodes(); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
382 |
} |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
383 |
|
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
384 |
@Override |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
385 |
public Node getFirstChild() { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
386 |
Node child = super.getFirstChild(); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
387 |
if (child == null) { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
388 |
materializePayloadWrapException(); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
389 |
} |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
390 |
return super.getFirstChild(); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
391 |
} |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
392 |
|
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
393 |
public Node getFirstChildNoMaterialize() { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
394 |
return super.getFirstChild(); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
395 |
} |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
396 |
|
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
397 |
@Override |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
398 |
public Node getLastChild() { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
399 |
materializePayloadWrapException(); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
400 |
return super.getLastChild(); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
401 |
} |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
402 |
|
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
403 |
XMLStreamReader getPayloadReader() { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
404 |
return staxBridge.getPayloadReader(); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
405 |
} |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
406 |
|
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
407 |
void setStaxBridge(StaxBridge bridge) { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
408 |
this.staxBridge = bridge; |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
409 |
} |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
410 |
|
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
411 |
StaxBridge getStaxBridge() { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
412 |
return staxBridge; |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
413 |
} |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
414 |
|
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
415 |
void setPayloadStreamRead() { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
416 |
this.payloadStreamRead = true; |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
417 |
} |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
418 |
|
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
419 |
QName getPayloadQName() { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
420 |
if (staxBridge != null) { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
421 |
return staxBridge.getPayloadQName(); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
422 |
} else { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
423 |
//not lazy - Just get first child element and return its name |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
424 |
Element elem = getFirstChildElement(); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
425 |
if (elem != null) { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
426 |
String ns = elem.getNamespaceURI(); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
427 |
String pref = elem.getPrefix(); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
428 |
String local = elem.getLocalName(); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
429 |
if (pref != null) return new QName(ns, local, pref); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
430 |
if (ns != null) return new QName(ns, local); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
431 |
return new QName(local); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
432 |
} |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
433 |
} |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
434 |
return null; |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
435 |
} |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
436 |
|
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
437 |
String getPayloadAttributeValue(String attName) { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
438 |
if (staxBridge != null) { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
439 |
return staxBridge.getPayloadAttributeValue(attName); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
440 |
} else { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
441 |
//not lazy -Just get first child element and return its attribute |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
442 |
Element elem = getFirstChildElement(); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
443 |
if (elem != null) { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
444 |
return elem.getAttribute(localName); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
445 |
} |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
446 |
} |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
447 |
return null; |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
448 |
} |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
449 |
|
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
450 |
String getPayloadAttributeValue(QName attNAme) { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
451 |
if (staxBridge != null) { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
452 |
return staxBridge.getPayloadAttributeValue(attNAme); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
453 |
} else { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
454 |
//not lazy -Just get first child element and return its attribute |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
455 |
Element elem = getFirstChildElement(); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
456 |
if (elem != null) { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
457 |
return elem.getAttributeNS(attNAme.getNamespaceURI(), attNAme.getLocalPart()); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
458 |
} |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
459 |
} |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
460 |
return null; |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
461 |
} |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
462 |
|
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
463 |
public boolean isLazy() { |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
464 |
return (staxBridge != null && !payloadStreamRead); |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
465 |
} |
953bfc3fbe31
8036030: Update JAX-WS RI integration to latest version
mkos
parents:
22679
diff
changeset
|
466 |
|
12009 | 467 |
} |