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