src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLModel.java

Wed, 27 Apr 2016 01:27:09 +0800

author
aoqi
date
Wed, 27 Apr 2016 01:27:09 +0800
changeset 0
373ffda63c9a
child 637
9c07ef4934dd
permissions
-rw-r--r--

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

mercurial