001: /*
002: * The contents of this file are subject to the terms
003: * of the Common Development and Distribution License
004: * (the "License"). You may not use this file except
005: * in compliance with the License.
006: *
007: * You can obtain a copy of the license at
008: * https://jwsdp.dev.java.net/CDDLv1.0.html
009: * See the License for the specific language governing
010: * permissions and limitations under the License.
011: *
012: * When distributing Covered Code, include this CDDL
013: * HEADER in each file and include the License file at
014: * https://jwsdp.dev.java.net/CDDLv1.0.html If applicable,
015: * add the following below this CDDL HEADER, with the
016: * fields enclosed by brackets "[]" replaced with your
017: * own identifying information: Portions Copyright [yyyy]
018: * [name of copyright owner]
019: */
020: /*
021: * $Id: SOAPPartImpl.java,v 1.4 2007/07/24 10:37:43 kumarjayanti Exp $
022: * $Revision: 1.4 $
023: * $Date: 2007/07/24 10:37:43 $
024: */
025:
026: /*
027: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
028: *
029: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
030: *
031: * The contents of this file are subject to the terms of either the GNU
032: * General Public License Version 2 only ("GPL") or the Common Development
033: * and Distribution License("CDDL") (collectively, the "License"). You
034: * may not use this file except in compliance with the License. You can obtain
035: * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
036: * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
037: * language governing permissions and limitations under the License.
038: *
039: * When distributing the software, include this License Header Notice in each
040: * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
041: * Sun designates this particular file as subject to the "Classpath" exception
042: * as provided by Sun in the GPL Version 2 section of the License file that
043: * accompanied this code. If applicable, add the following below the License
044: * Header, with the fields enclosed by brackets [] replaced by your own
045: * identifying information: "Portions Copyrighted [year]
046: * [name of copyright owner]"
047: *
048: * Contributor(s):
049: *
050: * If you wish your version of this file to be governed by only the CDDL or
051: * only the GPL Version 2, indicate your decision by adding "[Contributor]
052: * elects to include this software in this distribution under the [CDDL or GPL
053: * Version 2] license." If you don't indicate a single choice of license, a
054: * recipient has the option to distribute your version of this file under
055: * either the CDDL, the GPL Version 2 or to extend the choice of license to
056: * its licensees as provided above. However, if you add GPL Version 2 code
057: * and therefore, elected the GPL Version 2 license, then the option applies
058: * only if the new code is made subject to such option by the copyright
059: * holder.
060: */
061: package com.sun.xml.messaging.saaj.soap;
062:
063: import java.io.*;
064: import java.util.Iterator;
065: import java.util.logging.Logger;
066: import java.util.logging.Level;
067:
068: import javax.activation.DataHandler;
069: import javax.activation.DataSource;
070: import javax.xml.soap.*;
071: import javax.xml.transform.Source;
072: import javax.xml.transform.stream.StreamSource;
073:
074: import org.w3c.dom.*;
075:
076: import com.sun.xml.messaging.saaj.packaging.mime.internet.MimeBodyPart;
077:
078: import com.sun.xml.messaging.saaj.SOAPExceptionImpl;
079: import com.sun.xml.messaging.saaj.soap.impl.ElementImpl;
080: import com.sun.xml.messaging.saaj.soap.impl.EnvelopeImpl;
081: import com.sun.xml.messaging.saaj.soap.name.NameImpl;
082: import com.sun.xml.messaging.saaj.util.*;
083: import javax.xml.transform.sax.SAXSource;
084:
085: /**
086: * SOAPPartImpl is the first attachment. This contains the XML/SOAP document.
087: *
088: * @author Anil Vijendran (anil@sun.com)
089: */
090: public abstract class SOAPPartImpl extends SOAPPart implements
091: SOAPDocument {
092: protected static Logger log = Logger.getLogger(
093: LogDomainConstants.SOAP_DOMAIN,
094: "com.sun.xml.messaging.saaj.soap.LocalStrings");
095:
096: protected MimeHeaders headers;
097: protected Envelope envelope;
098: protected Source source;
099: protected SOAPDocumentImpl document;
100:
101: //flag to indicate if a setContent happened.
102: private boolean sourceWasSet = false;
103:
104: // Records whether the input source had an xml decl or not.
105: protected boolean omitXmlDecl = true;
106:
107: // Records the charset encoding of the input stream source if provided.
108: protected String sourceCharsetEncoding = null;
109:
110: /**
111: * Reference to containing message (may be null)
112: */
113: protected MessageImpl message;
114:
115: protected SOAPPartImpl() {
116: this (null);
117: }
118:
119: protected SOAPPartImpl(MessageImpl message) {
120: document = new SOAPDocumentImpl(this );
121: headers = new MimeHeaders();
122: this .message = message;
123: headers.setHeader("Content-Type", getContentType());
124: }
125:
126: protected abstract String getContentType();
127:
128: protected abstract Envelope createEnvelopeFromSource()
129: throws SOAPException;
130:
131: protected abstract Envelope createEmptyEnvelope(String prefix)
132: throws SOAPException;
133:
134: protected abstract SOAPPartImpl duplicateType();
135:
136: protected String getContentTypeString() {
137: return getContentType();
138: }
139:
140: public boolean isFastInfoset() {
141: return (message != null) ? message.isFastInfoset() : false;
142: }
143:
144: public SOAPEnvelope getEnvelope() throws SOAPException {
145:
146: // If there is no SOAP envelope already created, then create
147: // one from a source if one exists. If there is a newer source
148: // then use that source.
149:
150: if (sourceWasSet)
151: sourceWasSet = false;
152:
153: lookForEnvelope();
154: if (envelope != null) {
155: if (source != null) { // there's a newer source, use it
156: document.removeChild(envelope);
157: envelope = createEnvelopeFromSource();
158: }
159: } else if (source != null) {
160: envelope = createEnvelopeFromSource();
161: } else {
162: envelope = createEmptyEnvelope(null);
163: document.insertBefore(envelope, null);
164: }
165: return envelope;
166: }
167:
168: protected void lookForEnvelope() throws SOAPException {
169: Element envelopeChildElement = document.doGetDocumentElement();
170: if (envelopeChildElement == null
171: || envelopeChildElement instanceof Envelope) {
172: envelope = (EnvelopeImpl) envelopeChildElement;
173: } else if (!(envelopeChildElement instanceof ElementImpl)) {
174: log.severe("SAAJ0512.soap.incorrect.factory.used");
175: throw new SOAPExceptionImpl(
176: "Unable to create envelope: incorrect factory used during tree construction");
177: } else {
178: ElementImpl soapElement = (ElementImpl) envelopeChildElement;
179: if (soapElement.getLocalName().equalsIgnoreCase("Envelope")) {
180: String prefix = soapElement.getPrefix();
181: String uri = (prefix == null) ? soapElement
182: .getNamespaceURI() : soapElement
183: .getNamespaceURI(prefix);
184: if (!uri.equals(NameImpl.SOAP11_NAMESPACE)
185: && !uri.equals(NameImpl.SOAP12_NAMESPACE)) {
186: log.severe("SAAJ0513.soap.unknown.ns");
187: throw new SOAPVersionMismatchException(
188: "Unable to create envelope from given source because the namespace was not recognized");
189: }
190: } else {
191: log
192: .severe("SAAJ0514.soap.root.elem.not.named.envelope");
193: throw new SOAPExceptionImpl(
194: "Unable to create envelope from given source because the root element is not named \"Envelope\"");
195: }
196: }
197: }
198:
199: public void removeAllMimeHeaders() {
200: headers.removeAllHeaders();
201: }
202:
203: public void removeMimeHeader(String header) {
204: headers.removeHeader(header);
205: }
206:
207: public String[] getMimeHeader(String name) {
208: return headers.getHeader(name);
209: }
210:
211: public void setMimeHeader(String name, String value) {
212: headers.setHeader(name, value);
213: }
214:
215: public void addMimeHeader(String name, String value) {
216: headers.addHeader(name, value);
217: }
218:
219: public Iterator getAllMimeHeaders() {
220: return headers.getAllHeaders();
221: }
222:
223: public Iterator getMatchingMimeHeaders(String[] names) {
224: return headers.getMatchingHeaders(names);
225: }
226:
227: public Iterator getNonMatchingMimeHeaders(String[] names) {
228: return headers.getNonMatchingHeaders(names);
229: }
230:
231: public Source getContent() throws SOAPException {
232: if (source != null) {
233: InputStream bis = null;
234: if (source instanceof JAXMStreamSource) {
235: StreamSource streamSource = (StreamSource) source;
236: bis = streamSource.getInputStream();
237: } else if (FastInfosetReflection
238: .isFastInfosetSource(source)) {
239: // FastInfosetSource inherits from SAXSource
240: SAXSource saxSource = (SAXSource) source;
241: bis = saxSource.getInputSource().getByteStream();
242: }
243:
244: if (bis != null) {
245: try {
246: bis.reset();
247: } catch (IOException e) {
248: /* This exception will never be thrown.
249: *
250: * The setContent method will modify the source
251: * if StreamSource to JAXMStreamSource, that uses
252: * a ByteInputStream, and for a FastInfosetSource will
253: * replace the InputStream with a ByteInputStream.
254: */
255: }
256: }
257: return source;
258: }
259:
260: return ((Envelope) getEnvelope()).getContent();
261: }
262:
263: public void setContent(Source source) throws SOAPException {
264: try {
265: if (source instanceof StreamSource) {
266: InputStream is = ((StreamSource) source)
267: .getInputStream();
268: Reader rdr = ((StreamSource) source).getReader();
269:
270: if (is != null) {
271: this .source = new JAXMStreamSource(is);
272: } else if (rdr != null) {
273: this .source = new JAXMStreamSource(rdr);
274: } else {
275: log.severe("SAAJ0544.soap.no.valid.reader.for.src");
276: throw new SOAPExceptionImpl(
277: "Source does not have a valid Reader or InputStream");
278: }
279: } else if (FastInfosetReflection
280: .isFastInfosetSource(source)) {
281: // InputStream is = source.getInputStream()
282: InputStream is = FastInfosetReflection
283: .FastInfosetSource_getInputStream(source);
284:
285: /*
286: * Underlying stream must be ByteInputStream for getContentAsStream(). We pay the
287: * cost of copying the underlying bytes here to avoid multiple copies every time
288: * getBytes() is called on a ByteInputStream.
289: */
290: if (!(is instanceof ByteInputStream)) {
291: ByteOutputStream bout = new ByteOutputStream();
292: bout.write(is);
293:
294: // source.setInputStream(new ByteInputStream(...))
295: FastInfosetReflection
296: .FastInfosetSource_setInputStream(source,
297: bout.newInputStream());
298: }
299: this .source = source;
300: } else {
301: this .source = source;
302: }
303: sourceWasSet = true;
304: } catch (Exception ex) {
305: ex.printStackTrace();
306:
307: log.severe("SAAJ0545.soap.cannot.set.src.for.part");
308: throw new SOAPExceptionImpl(
309: "Error setting the source for SOAPPart: "
310: + ex.getMessage());
311: }
312: }
313:
314: public ByteInputStream getContentAsStream() throws IOException {
315: if (source != null) {
316: InputStream is = null;
317:
318: // Allow message to be transcode if so requested
319: if (source instanceof StreamSource && !isFastInfoset()) {
320: is = ((StreamSource) source).getInputStream();
321: } else if (FastInfosetReflection
322: .isFastInfosetSource(source)
323: && isFastInfoset()) {
324: try {
325: // InputStream is = source.getInputStream()
326: is = FastInfosetReflection
327: .FastInfosetSource_getInputStream(source);
328: } catch (Exception e) {
329: throw new IOException(e.toString());
330: }
331: }
332:
333: if (is != null) {
334: if (!(is instanceof ByteInputStream)) {
335: log.severe("SAAJ0546.soap.stream.incorrect.type");
336: throw new IOException(
337: "Internal error: stream not of the right type");
338: }
339: return (ByteInputStream) is;
340: }
341: // need to do something here for reader...
342: // for now we'll see if we can fallback...
343: }
344:
345: ByteOutputStream b = new ByteOutputStream();
346:
347: Envelope env = null;
348:
349: try {
350: env = (Envelope) getEnvelope();
351: env.output(b, isFastInfoset());
352: } catch (SOAPException soapException) {
353: log.severe("SAAJ0547.soap.cannot.externalize");
354: throw new SOAPIOException(
355: "SOAP exception while trying to externalize: ",
356: soapException);
357: }
358:
359: return b.newInputStream();
360: }
361:
362: MimeBodyPart getMimePart() throws SOAPException {
363: try {
364: MimeBodyPart headerEnvelope = new MimeBodyPart();
365:
366: headerEnvelope.setDataHandler(getDataHandler());
367: AttachmentPartImpl.copyMimeHeaders(headers, headerEnvelope);
368:
369: return headerEnvelope;
370: } catch (SOAPException ex) {
371: throw ex;
372: } catch (Exception ex) {
373: log.severe("SAAJ0548.soap.cannot.externalize.hdr");
374: throw new SOAPExceptionImpl("Unable to externalize header",
375: ex);
376: }
377: }
378:
379: MimeHeaders getMimeHeaders() {
380: return headers;
381: }
382:
383: DataHandler getDataHandler() {
384: DataSource ds = new DataSource() {
385: public OutputStream getOutputStream() throws IOException {
386: throw new IOException("Illegal Operation");
387: }
388:
389: public String getContentType() {
390: return getContentTypeString();
391: }
392:
393: public String getName() {
394: return getContentId();
395: }
396:
397: public InputStream getInputStream() throws IOException {
398: return getContentAsStream();
399: }
400: };
401: return new DataHandler(ds);
402: }
403:
404: public SOAPDocumentImpl getDocument() {
405: handleNewSource();
406: return document;
407: }
408:
409: public SOAPPartImpl getSOAPPart() {
410: return this ;
411: }
412:
413: public DocumentType getDoctype() {
414: return document.getDoctype();
415: }
416:
417: // Forward all of these calls to the document to ensure that they work the
418: // same way whether they are called from here or directly from the document.
419: // If the document needs any help from this SOAPPart then
420: // Make it use a call-back as in doGetDocumentElement() below
421: public DOMImplementation getImplementation() {
422: return document.getImplementation();
423: }
424:
425: public Element getDocumentElement() {
426: // If there is no SOAP envelope already created, then create
427: // one from a source if one exists. If there is a newer source
428: // then use that source.
429: try {
430: getEnvelope();
431: } catch (SOAPException e) {
432: }
433: return document.getDocumentElement();
434: }
435:
436: protected void doGetDocumentElement() {
437: handleNewSource();
438: try {
439: lookForEnvelope();
440: } catch (SOAPException e) {
441: }
442: }
443:
444: public Element createElement(String tagName) throws DOMException {
445: return document.createElement(tagName);
446: }
447:
448: public DocumentFragment createDocumentFragment() {
449: return document.createDocumentFragment();
450: }
451:
452: public org.w3c.dom.Text createTextNode(String data) {
453: return document.createTextNode(data);
454: }
455:
456: public Comment createComment(String data) {
457: return document.createComment(data);
458: }
459:
460: public CDATASection createCDATASection(String data)
461: throws DOMException {
462: return document.createCDATASection(data);
463: }
464:
465: public ProcessingInstruction createProcessingInstruction(
466: String target, String data) throws DOMException {
467: return document.createProcessingInstruction(target, data);
468: }
469:
470: public Attr createAttribute(String name) throws DOMException {
471: return document.createAttribute(name);
472: }
473:
474: public EntityReference createEntityReference(String name)
475: throws DOMException {
476: return document.createEntityReference(name);
477: }
478:
479: public NodeList getElementsByTagName(String tagname) {
480: handleNewSource();
481: return document.getElementsByTagName(tagname);
482: }
483:
484: public org.w3c.dom.Node importNode(org.w3c.dom.Node importedNode,
485: boolean deep) throws DOMException {
486: handleNewSource();
487: return document.importNode(importedNode, deep);
488: }
489:
490: public Element createElementNS(String namespaceURI,
491: String qualifiedName) throws DOMException {
492: return document.createElementNS(namespaceURI, qualifiedName);
493: }
494:
495: public Attr createAttributeNS(String namespaceURI,
496: String qualifiedName) throws DOMException {
497: return document.createAttributeNS(namespaceURI, qualifiedName);
498: }
499:
500: public NodeList getElementsByTagNameNS(String namespaceURI,
501: String localName) {
502: handleNewSource();
503: return document.getElementsByTagNameNS(namespaceURI, localName);
504: }
505:
506: public Element getElementById(String elementId) {
507: handleNewSource();
508: return document.getElementById(elementId);
509: }
510:
511: public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
512: throws DOMException {
513: handleNewSource();
514: return document.appendChild(newChild);
515: }
516:
517: public org.w3c.dom.Node cloneNode(boolean deep) {
518: handleNewSource();
519: return document.cloneNode(deep);
520: }
521:
522: protected SOAPPartImpl doCloneNode() {
523: handleNewSource();
524: SOAPPartImpl newSoapPart = duplicateType();
525:
526: newSoapPart.headers = MimeHeadersUtil.copy(this .headers);
527: newSoapPart.source = this .source;
528: return newSoapPart;
529: }
530:
531: public NamedNodeMap getAttributes() {
532: return document.getAttributes();
533: }
534:
535: public NodeList getChildNodes() {
536: handleNewSource();
537: return document.getChildNodes();
538: }
539:
540: public org.w3c.dom.Node getFirstChild() {
541: handleNewSource();
542: return document.getFirstChild();
543: }
544:
545: public org.w3c.dom.Node getLastChild() {
546: handleNewSource();
547: return document.getLastChild();
548: }
549:
550: public String getLocalName() {
551: return document.getLocalName();
552: }
553:
554: public String getNamespaceURI() {
555: return document.getNamespaceURI();
556: }
557:
558: public org.w3c.dom.Node getNextSibling() {
559: handleNewSource();
560: return document.getNextSibling();
561: }
562:
563: public String getNodeName() {
564: return document.getNodeName();
565: }
566:
567: public short getNodeType() {
568: return document.getNodeType();
569: }
570:
571: public String getNodeValue() throws DOMException {
572: return document.getNodeValue();
573: }
574:
575: public Document getOwnerDocument() {
576: return document.getOwnerDocument();
577: }
578:
579: public org.w3c.dom.Node getParentNode() {
580: return document.getParentNode();
581: }
582:
583: public String getPrefix() {
584: return document.getPrefix();
585: }
586:
587: public org.w3c.dom.Node getPreviousSibling() {
588: return document.getPreviousSibling();
589: }
590:
591: public boolean hasAttributes() {
592: return document.hasAttributes();
593: }
594:
595: public boolean hasChildNodes() {
596: handleNewSource();
597: return document.hasChildNodes();
598: }
599:
600: public org.w3c.dom.Node insertBefore(org.w3c.dom.Node arg0,
601: org.w3c.dom.Node arg1) throws DOMException {
602: handleNewSource();
603: return document.insertBefore(arg0, arg1);
604: }
605:
606: public boolean isSupported(String arg0, String arg1) {
607: return document.isSupported(arg0, arg1);
608: }
609:
610: public void normalize() {
611: handleNewSource();
612: document.normalize();
613: }
614:
615: public org.w3c.dom.Node removeChild(org.w3c.dom.Node arg0)
616: throws DOMException {
617: handleNewSource();
618: return document.removeChild(arg0);
619: }
620:
621: public org.w3c.dom.Node replaceChild(org.w3c.dom.Node arg0,
622: org.w3c.dom.Node arg1) throws DOMException {
623: handleNewSource();
624: return document.replaceChild(arg0, arg1);
625: }
626:
627: public void setNodeValue(String arg0) throws DOMException {
628: document.setNodeValue(arg0);
629: }
630:
631: public void setPrefix(String arg0) throws DOMException {
632: document.setPrefix(arg0);
633: }
634:
635: private void handleNewSource() {
636: if (sourceWasSet) {
637: // There is a newer source use that source.
638: try {
639: getEnvelope();
640: } catch (SOAPException e) {
641: }
642: }
643: }
644:
645: protected XMLDeclarationParser lookForXmlDecl()
646: throws SOAPException {
647: if ((source != null) && (source instanceof StreamSource)) {
648:
649: Reader reader = null;
650:
651: InputStream inputStream = ((StreamSource) source)
652: .getInputStream();
653: if (inputStream != null) {
654: if (getSourceCharsetEncoding() == null) {
655: reader = new InputStreamReader(inputStream);
656: } else {
657: try {
658: reader = new InputStreamReader(inputStream,
659: getSourceCharsetEncoding());
660: } catch (UnsupportedEncodingException uee) {
661: log
662: .log(
663: Level.SEVERE,
664: "SAAJ0551.soap.unsupported.encoding",
665: new Object[] { getSourceCharsetEncoding() });
666: throw new SOAPExceptionImpl(
667: "Unsupported encoding "
668: + getSourceCharsetEncoding(),
669: uee);
670: }
671: }
672: } else {
673: reader = ((StreamSource) source).getReader();
674: }
675: if (reader != null) {
676: PushbackReader pushbackReader = new PushbackReader(
677: reader, 4096); //some size to unread <?xml ....?>
678: XMLDeclarationParser ev = new XMLDeclarationParser(
679: pushbackReader);
680: try {
681: ev.parse();
682: } catch (Exception e) {
683: log.log(Level.SEVERE,
684: "SAAJ0552.soap.xml.decl.parsing.failed");
685: throw new SOAPExceptionImpl(
686: "XML declaration parsing failed", e);
687: }
688: String xmlDecl = ev.getXmlDeclaration();
689: if ((xmlDecl != null) && (xmlDecl.length() > 0))
690: this .omitXmlDecl = false;
691: return ev;
692: }
693: }
694: return null;
695: }
696:
697: public void setSourceCharsetEncoding(String charset) {
698: this .sourceCharsetEncoding = charset;
699: }
700:
701: public org.w3c.dom.Node renameNode(org.w3c.dom.Node n,
702: String namespaceURI, String qualifiedName)
703: throws DOMException {
704: handleNewSource();
705: return document.renameNode(n, namespaceURI, qualifiedName);
706: }
707:
708: public void normalizeDocument() {
709: document.normalizeDocument();
710: }
711:
712: public DOMConfiguration getDomConfig() {
713: return document.getDomConfig();
714: }
715:
716: public org.w3c.dom.Node adoptNode(org.w3c.dom.Node source)
717: throws DOMException {
718: handleNewSource();
719: return document.adoptNode(source);
720: }
721:
722: public void setDocumentURI(String documentURI) {
723: document.setDocumentURI(documentURI);
724: }
725:
726: public String getDocumentURI() {
727: return document.getDocumentURI();
728: }
729:
730: public void setStrictErrorChecking(boolean strictErrorChecking) {
731: document.setStrictErrorChecking(strictErrorChecking);
732: }
733:
734: public String getInputEncoding() {
735: return document.getInputEncoding();
736: }
737:
738: public String getXmlEncoding() {
739: return document.getXmlEncoding();
740: }
741:
742: public boolean getXmlStandalone() {
743: return document.getXmlStandalone();
744: }
745:
746: public void setXmlStandalone(boolean xmlStandalone)
747: throws DOMException {
748: document.setXmlStandalone(xmlStandalone);
749: }
750:
751: public String getXmlVersion() {
752: return document.getXmlVersion();
753: }
754:
755: public void setXmlVersion(String xmlVersion) throws DOMException {
756: document.setXmlVersion(xmlVersion);
757: }
758:
759: public boolean getStrictErrorChecking() {
760: return document.getStrictErrorChecking();
761: }
762:
763: // DOM L3 methods from org.w3c.dom.Node
764: public String getBaseURI() {
765: return document.getBaseURI();
766: }
767:
768: public short compareDocumentPosition(org.w3c.dom.Node other)
769: throws DOMException {
770: return document.compareDocumentPosition(other);
771: }
772:
773: public String getTextContent() throws DOMException {
774: return document.getTextContent();
775: }
776:
777: public void setTextContent(String textContent) throws DOMException {
778: document.setTextContent(textContent);
779: }
780:
781: public boolean isSameNode(org.w3c.dom.Node other) {
782: return document.isSameNode(other);
783: }
784:
785: public String lookupPrefix(String namespaceURI) {
786: return document.lookupPrefix(namespaceURI);
787: }
788:
789: public boolean isDefaultNamespace(String namespaceURI) {
790: return document.isDefaultNamespace(namespaceURI);
791: }
792:
793: public String lookupNamespaceURI(String prefix) {
794: return document.lookupNamespaceURI(prefix);
795: }
796:
797: public boolean isEqualNode(org.w3c.dom.Node arg) {
798: return document.isEqualNode(arg);
799: }
800:
801: public Object getFeature(String feature, String version) {
802: return document.getFeature(feature, version);
803: }
804:
805: public Object setUserData(String key, Object data,
806: UserDataHandler handler) {
807: return document.setUserData(key, data, handler);
808: }
809:
810: public Object getUserData(String key) {
811: return document.getUserData(key);
812: }
813:
814: public void recycleNode() {
815: // Nothing seems to be required to be done here
816: }
817:
818: public String getValue() {
819: return null;
820: }
821:
822: public void setValue(String value) {
823: log.severe("SAAJ0571.soappart.setValue.not.defined");
824: throw new IllegalStateException(
825: "Setting value of a soap part is not defined");
826: }
827:
828: public void setParentElement(SOAPElement parent)
829: throws SOAPException {
830: log.severe("SAAJ0570.soappart.parent.element.not.defined");
831: throw new SOAPExceptionImpl(
832: "The parent element of a soap part is not defined");
833: }
834:
835: public SOAPElement getParentElement() {
836: return null;
837: }
838:
839: public void detachNode() {
840: // Nothing seems to be required to be done here
841: }
842:
843: public String getSourceCharsetEncoding() {
844: return sourceCharsetEncoding;
845: }
846: }
|