src/share/classes/com/sun/xml/internal/messaging/saaj/soap/SOAPDocumentImpl.java

Fri, 07 Aug 2009 11:27:00 -0700

author
asaha
date
Fri, 07 Aug 2009 11:27:00 -0700
changeset 78
860b95cc8d1d
parent 50
42dfec6871f6
permissions
-rw-r--r--

6813167: 6u14 JAX-WS audit mutable static bugs
6803688: Integrate latest JAX-WS (2.1.6) in to JDK 6u14
Reviewed-by: darcy, ramap

duke@1 1 /*
tbell@45 2 * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
duke@1 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 *
duke@1 5 * This code is free software; you can redistribute it and/or modify it
duke@1 6 * under the terms of the GNU General Public License version 2 only, as
duke@1 7 * published by the Free Software Foundation. Sun designates this
duke@1 8 * particular file as subject to the "Classpath" exception as provided
duke@1 9 * by Sun in the LICENSE file that accompanied this code.
duke@1 10 *
duke@1 11 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 14 * version 2 for more details (a copy is included in the LICENSE file that
duke@1 15 * accompanied this code).
duke@1 16 *
duke@1 17 * You should have received a copy of the GNU General Public License version
duke@1 18 * 2 along with this work; if not, write to the Free Software Foundation,
duke@1 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 20 *
duke@1 21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@1 22 * CA 95054 USA or visit www.sun.com if you need additional information or
duke@1 23 * have any questions.
duke@1 24 */
tbell@45 25
tbell@45 26
duke@1 27
duke@1 28 /**
duke@1 29 *
duke@1 30 * @author SAAJ RI Development Team
duke@1 31 */
duke@1 32 package com.sun.xml.internal.messaging.saaj.soap;
duke@1 33
duke@1 34 import java.util.logging.Logger;
duke@1 35
duke@1 36 import com.sun.org.apache.xerces.internal.dom.DocumentImpl;
duke@1 37 import org.w3c.dom.*;
duke@1 38
duke@1 39 import com.sun.xml.internal.messaging.saaj.soap.impl.*;
duke@1 40 import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl;
duke@1 41 import com.sun.xml.internal.messaging.saaj.util.LogDomainConstants;
duke@1 42
duke@1 43 public class SOAPDocumentImpl extends DocumentImpl implements SOAPDocument {
duke@1 44
asaha@78 45 protected static final Logger log =
duke@1 46 Logger.getLogger(LogDomainConstants.SOAP_DOMAIN,
duke@1 47 "com.sun.xml.internal.messaging.saaj.soap.LocalStrings");
duke@1 48
duke@1 49 SOAPPartImpl enclosingSOAPPart;
duke@1 50
duke@1 51 public SOAPDocumentImpl(SOAPPartImpl enclosingDocument) {
duke@1 52 this.enclosingSOAPPart = enclosingDocument;
duke@1 53 }
duke@1 54
duke@1 55 // public SOAPDocumentImpl(boolean grammarAccess) {
duke@1 56 // super(grammarAccess);
duke@1 57 // }
duke@1 58 //
duke@1 59 // public SOAPDocumentImpl(DocumentType doctype) {
duke@1 60 // super(doctype);
duke@1 61 // }
duke@1 62 //
duke@1 63 // public SOAPDocumentImpl(DocumentType doctype, boolean grammarAccess) {
duke@1 64 // super(doctype, grammarAccess);
duke@1 65 // }
duke@1 66
duke@1 67 public SOAPPartImpl getSOAPPart() {
duke@1 68 if (enclosingSOAPPart == null) {
duke@1 69 log.severe("SAAJ0541.soap.fragment.not.bound.to.part");
duke@1 70 throw new RuntimeException("Could not complete operation. Fragment not bound to SOAP part.");
duke@1 71 }
duke@1 72 return enclosingSOAPPart;
duke@1 73 }
duke@1 74
duke@1 75 public SOAPDocumentImpl getDocument() {
duke@1 76 return this;
duke@1 77 }
duke@1 78
duke@1 79 public DocumentType getDoctype() {
duke@1 80 // SOAP means no DTD, No DTD means no doctype (SOAP 1.2 only?)
duke@1 81 return null;
duke@1 82 }
duke@1 83
duke@1 84 public DOMImplementation getImplementation() {
duke@1 85 return super.getImplementation();
duke@1 86 }
duke@1 87
duke@1 88 public Element getDocumentElement() {
duke@1 89 // This had better be an Envelope!
duke@1 90 getSOAPPart().doGetDocumentElement();
duke@1 91 return doGetDocumentElement();
duke@1 92 }
duke@1 93
duke@1 94 protected Element doGetDocumentElement() {
duke@1 95 return super.getDocumentElement();
duke@1 96 }
duke@1 97
duke@1 98 public Element createElement(String tagName) throws DOMException {
duke@1 99 return ElementFactory.createElement(
duke@1 100 this,
duke@1 101 NameImpl.getLocalNameFromTagName(tagName),
duke@1 102 NameImpl.getPrefixFromTagName(tagName),
duke@1 103 null);
duke@1 104 }
duke@1 105
duke@1 106 public DocumentFragment createDocumentFragment() {
duke@1 107 return new SOAPDocumentFragment(this);
duke@1 108 }
duke@1 109
duke@1 110 public org.w3c.dom.Text createTextNode(String data) {
duke@1 111 return new TextImpl(this, data);
duke@1 112 }
duke@1 113
duke@1 114 public Comment createComment(String data) {
duke@1 115 return new CommentImpl(this, data);
duke@1 116 }
duke@1 117
duke@1 118 public CDATASection createCDATASection(String data) throws DOMException {
duke@1 119 return new CDATAImpl(this, data);
duke@1 120 }
duke@1 121
duke@1 122 public ProcessingInstruction createProcessingInstruction(
duke@1 123 String target,
duke@1 124 String data)
duke@1 125 throws DOMException {
duke@1 126 log.severe("SAAJ0542.soap.proc.instructions.not.allowed.in.docs");
duke@1 127 throw new UnsupportedOperationException("Processing Instructions are not allowed in SOAP documents");
duke@1 128 }
duke@1 129
duke@1 130 public Attr createAttribute(String name) throws DOMException {
duke@1 131 return super.createAttribute(name);
duke@1 132 }
duke@1 133
duke@1 134 public EntityReference createEntityReference(String name)
duke@1 135 throws DOMException {
duke@1 136 log.severe("SAAJ0543.soap.entity.refs.not.allowed.in.docs");
duke@1 137 throw new UnsupportedOperationException("Entity References are not allowed in SOAP documents");
duke@1 138 }
duke@1 139
duke@1 140 public NodeList getElementsByTagName(String tagname) {
duke@1 141 return super.getElementsByTagName(tagname);
duke@1 142 }
duke@1 143
duke@1 144 public org.w3c.dom.Node importNode(Node importedNode, boolean deep)
duke@1 145 throws DOMException {
duke@1 146 return super.importNode(importedNode, deep);
duke@1 147 }
duke@1 148
duke@1 149 public Element createElementNS(String namespaceURI, String qualifiedName)
duke@1 150 throws DOMException {
duke@1 151 return ElementFactory.createElement(
duke@1 152 this,
duke@1 153 NameImpl.getLocalNameFromTagName(qualifiedName),
duke@1 154 NameImpl.getPrefixFromTagName(qualifiedName),
duke@1 155 namespaceURI);
duke@1 156 }
duke@1 157
duke@1 158 public Attr createAttributeNS(String namespaceURI, String qualifiedName)
duke@1 159 throws DOMException {
duke@1 160 return super.createAttributeNS(namespaceURI, qualifiedName);
duke@1 161 }
duke@1 162
duke@1 163 public NodeList getElementsByTagNameNS(
duke@1 164 String namespaceURI,
duke@1 165 String localName) {
duke@1 166 return super.getElementsByTagNameNS(namespaceURI, localName);
duke@1 167 }
duke@1 168
duke@1 169 public Element getElementById(String elementId) {
duke@1 170 return super.getElementById(elementId);
duke@1 171 }
duke@1 172
duke@1 173 public Node cloneNode(boolean deep) {
duke@1 174 SOAPPartImpl newSoapPart = getSOAPPart().doCloneNode();
duke@1 175 super.cloneNode(newSoapPart.getDocument(), deep);
duke@1 176 return newSoapPart;
duke@1 177 }
duke@1 178
duke@1 179 public void cloneNode(SOAPDocumentImpl newdoc, boolean deep) {
duke@1 180 super.cloneNode(newdoc, deep);
duke@1 181 }
duke@1 182 }

mercurial