Tue, 06 Mar 2012 16:09:35 -0800
7150322: Stop using drop source bundles in jaxws
Reviewed-by: darcy, ohrstrom
ohair@286 | 1 | /* |
ohair@286 | 2 | * Copyright (c) 1997, 2010, 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; |
ohair@286 | 37 | import org.xml.sax.SAXException; |
ohair@286 | 38 | |
ohair@286 | 39 | import javax.xml.namespace.QName; |
ohair@286 | 40 | import javax.xml.stream.XMLStreamException; |
ohair@286 | 41 | import java.io.IOException; |
ohair@286 | 42 | import java.util.Map; |
ohair@286 | 43 | |
ohair@286 | 44 | /** |
ohair@286 | 45 | * Provides abstraction of wsdl:definitions. |
ohair@286 | 46 | * |
ohair@286 | 47 | * @author Vivek Pandey |
ohair@286 | 48 | */ |
ohair@286 | 49 | public interface WSDLModel extends WSDLExtensible { |
ohair@286 | 50 | /** |
ohair@286 | 51 | * Gets {@link WSDLPortType} that models <code>wsdl:portType</code> |
ohair@286 | 52 | * |
ohair@286 | 53 | * @param name non-null quaified name of wsdl:message, where the localName is the value of <code>wsdl:portType@name</code> and |
ohair@286 | 54 | * the namespaceURI is the value of wsdl:definitions@targetNamespace |
ohair@286 | 55 | * @return A {@link com.sun.xml.internal.ws.api.model.wsdl.WSDLPortType} or null if no wsdl:portType found. |
ohair@286 | 56 | */ |
ohair@286 | 57 | WSDLPortType getPortType(@NotNull QName name); |
ohair@286 | 58 | |
ohair@286 | 59 | /** |
ohair@286 | 60 | * Gets {@link WSDLBoundPortType} that models <code>wsdl:binding</code> |
ohair@286 | 61 | * |
ohair@286 | 62 | * @param name non-null quaified name of wsdl:binding, where the localName is the value of <code>wsdl:binding@name</code> and |
ohair@286 | 63 | * the namespaceURI is the value of wsdl:definitions@targetNamespace |
ohair@286 | 64 | * @return A {@link WSDLBoundPortType} or null if no wsdl:binding found |
ohair@286 | 65 | */ |
ohair@286 | 66 | WSDLBoundPortType getBinding(@NotNull QName name); |
ohair@286 | 67 | |
ohair@286 | 68 | /** |
ohair@286 | 69 | * Give a {@link WSDLBoundPortType} for the given wsdl:service and wsdl:port names. |
ohair@286 | 70 | * |
ohair@286 | 71 | * @param serviceName service QName |
ohair@286 | 72 | * @param portName port QName |
ohair@286 | 73 | * @return A {@link WSDLBoundPortType}. null if the Binding for the given wsd:service and wsdl:port name are not |
ohair@286 | 74 | * found. |
ohair@286 | 75 | */ |
ohair@286 | 76 | WSDLBoundPortType getBinding(@NotNull QName serviceName, @NotNull QName portName); |
ohair@286 | 77 | |
ohair@286 | 78 | /** |
ohair@286 | 79 | * Gets {@link WSDLService} that models <code>wsdl:service</code> |
ohair@286 | 80 | * |
ohair@286 | 81 | * @param name non-null quaified name of wsdl:service, where the localName is the value of <code>wsdl:service@name</code> and |
ohair@286 | 82 | * the namespaceURI is the value of wsdl:definitions@targetNamespace |
ohair@286 | 83 | * @return A {@link WSDLService} or null if no wsdl:service found |
ohair@286 | 84 | */ |
ohair@286 | 85 | WSDLService getService(@NotNull QName name); |
ohair@286 | 86 | |
ohair@286 | 87 | /** |
ohair@286 | 88 | * Gives a {@link Map} of wsdl:portType {@link QName} and {@link WSDLPortType} |
ohair@286 | 89 | * |
ohair@286 | 90 | * @return an empty Map if the wsdl document has no wsdl:portType |
ohair@286 | 91 | */ |
ohair@286 | 92 | @NotNull Map<QName, ? extends WSDLPortType> getPortTypes(); |
ohair@286 | 93 | |
ohair@286 | 94 | /** |
ohair@286 | 95 | * Gives a {@link Map} of wsdl:binding {@link QName} and {@link WSDLBoundPortType} |
ohair@286 | 96 | * |
ohair@286 | 97 | * @return an empty Map if the wsdl document has no wsdl:binding |
ohair@286 | 98 | */ |
ohair@286 | 99 | @NotNull Map<QName, WSDLBoundPortType> getBindings(); |
ohair@286 | 100 | |
ohair@286 | 101 | /** |
ohair@286 | 102 | * Gives a {@link Map} of wsdl:service qualified name and {@link com.sun.xml.internal.ws.api.model.wsdl.WSDLService} |
ohair@286 | 103 | * |
ohair@286 | 104 | * @return an empty Map if the wsdl document has no wsdl:service |
ohair@286 | 105 | */ |
ohair@286 | 106 | @NotNull Map<QName, ? extends WSDLService> getServices(); |
ohair@286 | 107 | |
ohair@286 | 108 | /** |
ohair@286 | 109 | * Gives the PolicyMap associated with the WSDLModel |
ohair@286 | 110 | * |
ohair@286 | 111 | * @return PolicyMap |
ohair@286 | 112 | * |
ohair@286 | 113 | * @deprecated |
ohair@286 | 114 | * Do not use this method as the PolicyMap API is not final yet and might change in next few months. |
ohair@286 | 115 | */ |
ohair@286 | 116 | public PolicyMap getPolicyMap(); |
ohair@286 | 117 | |
ohair@286 | 118 | |
ohair@286 | 119 | /** |
ohair@286 | 120 | * Main purpose of this class is to parsing of a WSDL and get the {@link WSDLModel} from it. |
ohair@286 | 121 | */ |
ohair@286 | 122 | public class WSDLParser{ |
ohair@286 | 123 | /** |
ohair@286 | 124 | * Parses WSDL from the given wsdlLoc and gives a {@link WSDLModel} built from it. |
ohair@286 | 125 | * |
ohair@286 | 126 | * @param wsdlEntityParser Works like an entityResolver to resolve WSDLs |
ohair@286 | 127 | * @param resolver {@link XMLEntityResolver}, works at XML infoset level |
ohair@286 | 128 | * @param isClientSide true - its invoked on the client, false means its invoked on the server |
ohair@286 | 129 | * @param extensions var args of {@link com.sun.xml.internal.ws.api.wsdl.parser.WSDLParserExtension}s |
ohair@286 | 130 | * @return A {@link WSDLModel} built from the given wsdlLocation} |
ohair@286 | 131 | * @throws java.io.IOException |
ohair@286 | 132 | * @throws javax.xml.stream.XMLStreamException |
ohair@286 | 133 | * @throws org.xml.sax.SAXException |
ohair@286 | 134 | */ |
ohair@286 | 135 | public static @NotNull WSDLModel parse(XMLEntityResolver.Parser wsdlEntityParser, XMLEntityResolver resolver, boolean isClientSide, WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException { |
ohair@286 | 136 | return parse(wsdlEntityParser, resolver, isClientSide, Container.NONE, extensions); |
ohair@286 | 137 | } |
ohair@286 | 138 | |
ohair@286 | 139 | /** |
ohair@286 | 140 | * Parses WSDL from the given wsdlLoc and gives a {@link WSDLModel} built from it. |
ohair@286 | 141 | * |
ohair@286 | 142 | * @param wsdlEntityParser Works like an entityResolver to resolve WSDLs |
ohair@286 | 143 | * @param resolver {@link XMLEntityResolver}, works at XML infoset level |
ohair@286 | 144 | * @param isClientSide true - its invoked on the client, false means its invoked on the server |
ohair@286 | 145 | * @param container - container in which the parser is run |
ohair@286 | 146 | * @param extensions var args of {@link com.sun.xml.internal.ws.api.wsdl.parser.WSDLParserExtension}s |
ohair@286 | 147 | * @return A {@link WSDLModel} built from the given wsdlLocation} |
ohair@286 | 148 | * @throws java.io.IOException |
ohair@286 | 149 | * @throws javax.xml.stream.XMLStreamException |
ohair@286 | 150 | * @throws org.xml.sax.SAXException |
ohair@286 | 151 | */ |
ohair@286 | 152 | public static @NotNull WSDLModel parse(XMLEntityResolver.Parser wsdlEntityParser, XMLEntityResolver resolver, boolean isClientSide, @NotNull Container container, WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException { |
ohair@286 | 153 | return parse(wsdlEntityParser, resolver, isClientSide, container, PolicyResolverFactory.create(),extensions); |
ohair@286 | 154 | } |
ohair@286 | 155 | |
ohair@286 | 156 | |
ohair@286 | 157 | /** |
ohair@286 | 158 | * Parses WSDL from the given wsdlLoc and gives a {@link WSDLModel} built from it. |
ohair@286 | 159 | * |
ohair@286 | 160 | * @param wsdlEntityParser Works like an entityResolver to resolve WSDLs |
ohair@286 | 161 | * @param resolver {@link XMLEntityResolver}, works at XML infoset level |
ohair@286 | 162 | * @param isClientSide true - its invoked on the client, false means its invoked on the server |
ohair@286 | 163 | * @param container - container in which the parser is run |
ohair@286 | 164 | * @param policyResolver - PolicyResolver for resolving effective Policy |
ohair@286 | 165 | * @param extensions var args of {@link com.sun.xml.internal.ws.api.wsdl.parser.WSDLParserExtension}s |
ohair@286 | 166 | * @return A {@link WSDLModel} built from the given wsdlLocation} |
ohair@286 | 167 | * @throws java.io.IOException |
ohair@286 | 168 | * @throws javax.xml.stream.XMLStreamException |
ohair@286 | 169 | * @throws org.xml.sax.SAXException |
ohair@286 | 170 | */ |
ohair@286 | 171 | 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 | 172 | return RuntimeWSDLParser.parse(wsdlEntityParser, resolver, isClientSide, container, policyResolver, extensions); |
ohair@286 | 173 | } |
ohair@286 | 174 | |
ohair@286 | 175 | } |
ohair@286 | 176 | } |