Fri, 04 Oct 2013 16:21:34 +0100
8025054: Update JAX-WS RI integration to 2.2.9-b130926.1035
Reviewed-by: chegar
ohair@286 | 1 | /* |
mkos@408 | 2 | * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
ohair@286 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ohair@286 | 4 | * |
ohair@286 | 5 | * This code is free software; you can redistribute it and/or modify it |
ohair@286 | 6 | * under the terms of the GNU General Public License version 2 only, as |
ohair@286 | 7 | * published by the Free Software Foundation. Oracle designates this |
ohair@286 | 8 | * particular file as subject to the "Classpath" exception as provided |
ohair@286 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
ohair@286 | 10 | * |
ohair@286 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
ohair@286 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ohair@286 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ohair@286 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
ohair@286 | 15 | * accompanied this code). |
ohair@286 | 16 | * |
ohair@286 | 17 | * You should have received a copy of the GNU General Public License version |
ohair@286 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
ohair@286 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ohair@286 | 20 | * |
ohair@286 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@286 | 22 | * or visit www.oracle.com if you need additional information or have any |
ohair@286 | 23 | * questions. |
ohair@286 | 24 | */ |
ohair@286 | 25 | |
ohair@286 | 26 | package com.sun.xml.internal.ws.api.model.wsdl; |
ohair@286 | 27 | |
ohair@286 | 28 | |
ohair@286 | 29 | import com.sun.istack.internal.NotNull; |
ohair@286 | 30 | import com.sun.xml.internal.ws.api.server.Container; |
ohair@286 | 31 | import com.sun.xml.internal.ws.api.wsdl.parser.WSDLParserExtension; |
ohair@286 | 32 | import com.sun.xml.internal.ws.api.wsdl.parser.XMLEntityResolver; |
ohair@286 | 33 | import com.sun.xml.internal.ws.api.policy.PolicyResolver; |
ohair@286 | 34 | import com.sun.xml.internal.ws.api.policy.PolicyResolverFactory; |
ohair@286 | 35 | import com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser; |
ohair@286 | 36 | import com.sun.xml.internal.ws.policy.PolicyMap; |
mkos@408 | 37 | |
ohair@286 | 38 | import org.xml.sax.SAXException; |
ohair@286 | 39 | |
ohair@286 | 40 | import javax.xml.namespace.QName; |
ohair@286 | 41 | import javax.xml.stream.XMLStreamException; |
mkos@408 | 42 | |
ohair@286 | 43 | import java.io.IOException; |
ohair@286 | 44 | import java.util.Map; |
ohair@286 | 45 | |
ohair@286 | 46 | /** |
ohair@286 | 47 | * Provides abstraction of wsdl:definitions. |
ohair@286 | 48 | * |
ohair@286 | 49 | * @author Vivek Pandey |
ohair@286 | 50 | */ |
ohair@286 | 51 | public interface WSDLModel extends WSDLExtensible { |
ohair@286 | 52 | /** |
ohair@286 | 53 | * Gets {@link WSDLPortType} that models <code>wsdl:portType</code> |
ohair@286 | 54 | * |
ohair@286 | 55 | * @param name non-null quaified name of wsdl:message, where the localName is the value of <code>wsdl:portType@name</code> and |
ohair@286 | 56 | * the namespaceURI is the value of wsdl:definitions@targetNamespace |
ohair@286 | 57 | * @return A {@link com.sun.xml.internal.ws.api.model.wsdl.WSDLPortType} or null if no wsdl:portType found. |
ohair@286 | 58 | */ |
ohair@286 | 59 | WSDLPortType getPortType(@NotNull QName name); |
ohair@286 | 60 | |
ohair@286 | 61 | /** |
ohair@286 | 62 | * Gets {@link WSDLBoundPortType} that models <code>wsdl:binding</code> |
ohair@286 | 63 | * |
ohair@286 | 64 | * @param name non-null quaified name of wsdl:binding, where the localName is the value of <code>wsdl:binding@name</code> and |
ohair@286 | 65 | * the namespaceURI is the value of wsdl:definitions@targetNamespace |
ohair@286 | 66 | * @return A {@link WSDLBoundPortType} or null if no wsdl:binding found |
ohair@286 | 67 | */ |
ohair@286 | 68 | WSDLBoundPortType getBinding(@NotNull QName name); |
ohair@286 | 69 | |
ohair@286 | 70 | /** |
ohair@286 | 71 | * Give a {@link WSDLBoundPortType} for the given wsdl:service and wsdl:port names. |
ohair@286 | 72 | * |
ohair@286 | 73 | * @param serviceName service QName |
ohair@286 | 74 | * @param portName port QName |
ohair@286 | 75 | * @return A {@link WSDLBoundPortType}. null if the Binding for the given wsd:service and wsdl:port name are not |
ohair@286 | 76 | * found. |
ohair@286 | 77 | */ |
ohair@286 | 78 | WSDLBoundPortType getBinding(@NotNull QName serviceName, @NotNull QName portName); |
ohair@286 | 79 | |
ohair@286 | 80 | /** |
ohair@286 | 81 | * Gets {@link WSDLService} that models <code>wsdl:service</code> |
ohair@286 | 82 | * |
ohair@286 | 83 | * @param name non-null quaified name of wsdl:service, where the localName is the value of <code>wsdl:service@name</code> and |
ohair@286 | 84 | * the namespaceURI is the value of wsdl:definitions@targetNamespace |
ohair@286 | 85 | * @return A {@link WSDLService} or null if no wsdl:service found |
ohair@286 | 86 | */ |
ohair@286 | 87 | WSDLService getService(@NotNull QName name); |
ohair@286 | 88 | |
ohair@286 | 89 | /** |
ohair@286 | 90 | * Gives a {@link Map} of wsdl:portType {@link QName} and {@link WSDLPortType} |
ohair@286 | 91 | * |
ohair@286 | 92 | * @return an empty Map if the wsdl document has no wsdl:portType |
ohair@286 | 93 | */ |
ohair@286 | 94 | @NotNull Map<QName, ? extends WSDLPortType> getPortTypes(); |
ohair@286 | 95 | |
ohair@286 | 96 | /** |
ohair@286 | 97 | * Gives a {@link Map} of wsdl:binding {@link QName} and {@link WSDLBoundPortType} |
ohair@286 | 98 | * |
ohair@286 | 99 | * @return an empty Map if the wsdl document has no wsdl:binding |
ohair@286 | 100 | */ |
mkos@408 | 101 | @NotNull Map<QName, ? extends WSDLBoundPortType> getBindings(); |
ohair@286 | 102 | |
ohair@286 | 103 | /** |
ohair@286 | 104 | * Gives a {@link Map} of wsdl:service qualified name and {@link com.sun.xml.internal.ws.api.model.wsdl.WSDLService} |
ohair@286 | 105 | * |
ohair@286 | 106 | * @return an empty Map if the wsdl document has no wsdl:service |
ohair@286 | 107 | */ |
ohair@286 | 108 | @NotNull Map<QName, ? extends WSDLService> getServices(); |
ohair@286 | 109 | |
ohair@286 | 110 | /** |
mkos@408 | 111 | * Returns the first service QName from insertion order |
mkos@408 | 112 | */ |
mkos@408 | 113 | public QName getFirstServiceName(); |
mkos@408 | 114 | |
mkos@408 | 115 | /** |
mkos@408 | 116 | * Returns the message with the given QName |
mkos@408 | 117 | * @param name Message name |
mkos@408 | 118 | * @return Message |
mkos@408 | 119 | */ |
mkos@408 | 120 | public WSDLMessage getMessage(QName name); |
mkos@408 | 121 | |
mkos@408 | 122 | /** |
mkos@408 | 123 | * Gives a {@link Map} of wsdl:message qualified name and {@link com.sun.xml.internal.ws.api.model.wsdl.WSDLMesage} |
mkos@408 | 124 | * |
mkos@408 | 125 | * @return an empty Map if the wsdl document has no wsdl:message |
mkos@408 | 126 | */ |
mkos@408 | 127 | @NotNull Map<QName, ? extends WSDLMessage> getMessages(); |
mkos@408 | 128 | |
mkos@408 | 129 | /** |
ohair@286 | 130 | * Gives the PolicyMap associated with the WSDLModel |
ohair@286 | 131 | * |
ohair@286 | 132 | * @return PolicyMap |
ohair@286 | 133 | * |
ohair@286 | 134 | * @deprecated |
ohair@286 | 135 | * Do not use this method as the PolicyMap API is not final yet and might change in next few months. |
ohair@286 | 136 | */ |
ohair@286 | 137 | public PolicyMap getPolicyMap(); |
ohair@286 | 138 | |
ohair@286 | 139 | /** |
ohair@286 | 140 | * Main purpose of this class is to parsing of a WSDL and get the {@link WSDLModel} from it. |
ohair@286 | 141 | */ |
ohair@286 | 142 | public class WSDLParser{ |
ohair@286 | 143 | /** |
ohair@286 | 144 | * Parses WSDL from the given wsdlLoc and gives a {@link WSDLModel} built from it. |
ohair@286 | 145 | * |
ohair@286 | 146 | * @param wsdlEntityParser Works like an entityResolver to resolve WSDLs |
ohair@286 | 147 | * @param resolver {@link XMLEntityResolver}, works at XML infoset level |
ohair@286 | 148 | * @param isClientSide true - its invoked on the client, false means its invoked on the server |
ohair@286 | 149 | * @param extensions var args of {@link com.sun.xml.internal.ws.api.wsdl.parser.WSDLParserExtension}s |
ohair@286 | 150 | * @return A {@link WSDLModel} built from the given wsdlLocation} |
ohair@286 | 151 | * @throws java.io.IOException |
ohair@286 | 152 | * @throws javax.xml.stream.XMLStreamException |
ohair@286 | 153 | * @throws org.xml.sax.SAXException |
ohair@286 | 154 | */ |
ohair@286 | 155 | public static @NotNull WSDLModel parse(XMLEntityResolver.Parser wsdlEntityParser, XMLEntityResolver resolver, boolean isClientSide, WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException { |
ohair@286 | 156 | return parse(wsdlEntityParser, resolver, isClientSide, Container.NONE, extensions); |
ohair@286 | 157 | } |
ohair@286 | 158 | |
ohair@286 | 159 | /** |
ohair@286 | 160 | * Parses WSDL from the given wsdlLoc and gives a {@link WSDLModel} built from it. |
ohair@286 | 161 | * |
ohair@286 | 162 | * @param wsdlEntityParser Works like an entityResolver to resolve WSDLs |
ohair@286 | 163 | * @param resolver {@link XMLEntityResolver}, works at XML infoset level |
ohair@286 | 164 | * @param isClientSide true - its invoked on the client, false means its invoked on the server |
ohair@286 | 165 | * @param container - container in which the parser is run |
ohair@286 | 166 | * @param extensions var args of {@link com.sun.xml.internal.ws.api.wsdl.parser.WSDLParserExtension}s |
ohair@286 | 167 | * @return A {@link WSDLModel} built from the given wsdlLocation} |
ohair@286 | 168 | * @throws java.io.IOException |
ohair@286 | 169 | * @throws javax.xml.stream.XMLStreamException |
ohair@286 | 170 | * @throws org.xml.sax.SAXException |
ohair@286 | 171 | */ |
ohair@286 | 172 | public static @NotNull WSDLModel parse(XMLEntityResolver.Parser wsdlEntityParser, XMLEntityResolver resolver, boolean isClientSide, @NotNull Container container, WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException { |
ohair@286 | 173 | return parse(wsdlEntityParser, resolver, isClientSide, container, PolicyResolverFactory.create(),extensions); |
ohair@286 | 174 | } |
ohair@286 | 175 | |
ohair@286 | 176 | |
ohair@286 | 177 | /** |
ohair@286 | 178 | * Parses WSDL from the given wsdlLoc and gives a {@link WSDLModel} built from it. |
ohair@286 | 179 | * |
ohair@286 | 180 | * @param wsdlEntityParser Works like an entityResolver to resolve WSDLs |
ohair@286 | 181 | * @param resolver {@link XMLEntityResolver}, works at XML infoset level |
ohair@286 | 182 | * @param isClientSide true - its invoked on the client, false means its invoked on the server |
ohair@286 | 183 | * @param container - container in which the parser is run |
ohair@286 | 184 | * @param policyResolver - PolicyResolver for resolving effective Policy |
ohair@286 | 185 | * @param extensions var args of {@link com.sun.xml.internal.ws.api.wsdl.parser.WSDLParserExtension}s |
ohair@286 | 186 | * @return A {@link WSDLModel} built from the given wsdlLocation} |
ohair@286 | 187 | * @throws java.io.IOException |
ohair@286 | 188 | * @throws javax.xml.stream.XMLStreamException |
ohair@286 | 189 | * @throws org.xml.sax.SAXException |
ohair@286 | 190 | */ |
ohair@286 | 191 | public static @NotNull WSDLModel parse(XMLEntityResolver.Parser wsdlEntityParser, XMLEntityResolver resolver, boolean isClientSide, @NotNull Container container, PolicyResolver policyResolver, WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException { |
ohair@286 | 192 | return RuntimeWSDLParser.parse(wsdlEntityParser, resolver, isClientSide, container, policyResolver, extensions); |
ohair@286 | 193 | } |
ohair@286 | 194 | |
ohair@286 | 195 | } |
ohair@286 | 196 | } |