Thu, 31 Aug 2017 15:18:52 +0800
merge
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; |
aoqi@0 | 27 | |
aoqi@0 | 28 | import com.sun.istack.internal.NotNull; |
aoqi@0 | 29 | import com.sun.istack.internal.Nullable; |
aoqi@0 | 30 | import com.sun.xml.internal.ws.api.addressing.AddressingVersion; |
aoqi@0 | 31 | import com.sun.xml.internal.ws.api.message.Message; |
aoqi@0 | 32 | import com.sun.xml.internal.ws.api.pipe.Codec; |
aoqi@0 | 33 | import com.sun.xml.internal.ws.api.pipe.Tube; |
aoqi@0 | 34 | |
aoqi@0 | 35 | import javax.xml.namespace.QName; |
aoqi@0 | 36 | import javax.xml.ws.Binding; |
aoqi@0 | 37 | import javax.xml.ws.WebServiceFeature; |
aoqi@0 | 38 | import javax.xml.ws.handler.Handler; |
aoqi@0 | 39 | import java.util.List; |
aoqi@0 | 40 | import java.util.Set; |
aoqi@0 | 41 | |
aoqi@0 | 42 | |
aoqi@0 | 43 | /** |
aoqi@0 | 44 | * JAX-WS implementation of {@link Binding}. |
aoqi@0 | 45 | * |
aoqi@0 | 46 | * <p> |
aoqi@0 | 47 | * This object can be created by {@link BindingID#createBinding()}. |
aoqi@0 | 48 | * |
aoqi@0 | 49 | * <p> |
aoqi@0 | 50 | * Binding conceptually includes the on-the-wire format of the message, |
aoqi@0 | 51 | * this this object owns {@link Codec}. |
aoqi@0 | 52 | * |
aoqi@0 | 53 | * @author Kohsuke Kawaguchi |
aoqi@0 | 54 | */ |
aoqi@0 | 55 | public interface WSBinding extends Binding { |
aoqi@0 | 56 | /** |
aoqi@0 | 57 | * Gets the SOAP version of this binding. |
aoqi@0 | 58 | * |
aoqi@0 | 59 | * TODO: clarify what to do with XML/HTTP binding |
aoqi@0 | 60 | * |
aoqi@0 | 61 | * <p> |
aoqi@0 | 62 | * This is just a short-cut for {@code getBindingID().getSOAPVersion()} |
aoqi@0 | 63 | * |
aoqi@0 | 64 | * @return |
aoqi@0 | 65 | * If the binding is using SOAP, this method returns |
aoqi@0 | 66 | * a {@link SOAPVersion} constant. |
aoqi@0 | 67 | * |
aoqi@0 | 68 | * If the binding is not based on SOAP, this method |
aoqi@0 | 69 | * returns null. See {@link Message} for how a non-SOAP |
aoqi@0 | 70 | * binding shall be handled by {@link Tube}s. |
aoqi@0 | 71 | */ |
aoqi@0 | 72 | SOAPVersion getSOAPVersion(); |
aoqi@0 | 73 | /** |
aoqi@0 | 74 | * Gets the WS-Addressing version of this binding. |
aoqi@0 | 75 | * <p/> |
aoqi@0 | 76 | * TODO: clarify what to do with XML/HTTP binding |
aoqi@0 | 77 | * |
aoqi@0 | 78 | * @return If the binding is using SOAP and WS-Addressing is enabled, |
aoqi@0 | 79 | * this method returns a {@link AddressingVersion} constant. |
aoqi@0 | 80 | * If binding is not using SOAP or WS-Addressing is not enabled, |
aoqi@0 | 81 | * this method returns null. |
aoqi@0 | 82 | * |
aoqi@0 | 83 | * This might be little slow as it has to go over all the features on binding. |
aoqi@0 | 84 | * Its advisable to cache the addressingVersion wherever possible and reuse it. |
aoqi@0 | 85 | */ |
aoqi@0 | 86 | AddressingVersion getAddressingVersion(); |
aoqi@0 | 87 | |
aoqi@0 | 88 | /** |
aoqi@0 | 89 | * Gets the binding ID, which uniquely identifies the binding. |
aoqi@0 | 90 | * |
aoqi@0 | 91 | * <p> |
aoqi@0 | 92 | * The relevant specs define the binding IDs and what they mean. |
aoqi@0 | 93 | * The ID is used in many places to identify the kind of binding |
aoqi@0 | 94 | * (such as SOAP1.1, SOAP1.2, REST, ...) |
aoqi@0 | 95 | * |
aoqi@0 | 96 | * @return |
aoqi@0 | 97 | * Always non-null same value. |
aoqi@0 | 98 | */ |
aoqi@0 | 99 | @NotNull BindingID getBindingId(); |
aoqi@0 | 100 | |
aoqi@0 | 101 | @NotNull@Override |
aoqi@0 | 102 | List<Handler> getHandlerChain(); |
aoqi@0 | 103 | |
aoqi@0 | 104 | /** |
aoqi@0 | 105 | * Checks if a particular {@link WebServiceFeature} is enabled. |
aoqi@0 | 106 | * |
aoqi@0 | 107 | * @return |
aoqi@0 | 108 | * true if enabled. |
aoqi@0 | 109 | */ |
aoqi@0 | 110 | boolean isFeatureEnabled(@NotNull Class<? extends WebServiceFeature> feature); |
aoqi@0 | 111 | |
aoqi@0 | 112 | /** |
aoqi@0 | 113 | * Experimental: Checks if a particular {@link WebServiceFeature} on an operation is enabled. |
aoqi@0 | 114 | * |
aoqi@0 | 115 | * @param operationName |
aoqi@0 | 116 | * The WSDL name of the operation. |
aoqi@0 | 117 | * @return |
aoqi@0 | 118 | * true if enabled. |
aoqi@0 | 119 | */ |
aoqi@0 | 120 | boolean isOperationFeatureEnabled(@NotNull Class<? extends WebServiceFeature> feature, |
aoqi@0 | 121 | @NotNull final QName operationName); |
aoqi@0 | 122 | |
aoqi@0 | 123 | /** |
aoqi@0 | 124 | * Gets a {@link WebServiceFeature} of the specific type. |
aoqi@0 | 125 | * |
aoqi@0 | 126 | * @param featureType |
aoqi@0 | 127 | * The type of the feature to retrieve. |
aoqi@0 | 128 | * @return |
aoqi@0 | 129 | * If the feature is present and enabled, return a non-null instance. |
aoqi@0 | 130 | * Otherwise null. |
aoqi@0 | 131 | */ |
aoqi@0 | 132 | @Nullable <F extends WebServiceFeature> F getFeature(@NotNull Class<F> featureType); |
aoqi@0 | 133 | |
aoqi@0 | 134 | /** |
aoqi@0 | 135 | * Experimental: Gets a {@link WebServiceFeature} of the specific type that applies to an operation. |
aoqi@0 | 136 | * |
aoqi@0 | 137 | * @param featureType |
aoqi@0 | 138 | * The type of the feature to retrieve. |
aoqi@0 | 139 | * @param operationName |
aoqi@0 | 140 | * The WSDL name of the operation. |
aoqi@0 | 141 | * @return |
aoqi@0 | 142 | * If the feature is present and enabled, return a non-null instance. |
aoqi@0 | 143 | * Otherwise null. |
aoqi@0 | 144 | */ |
aoqi@0 | 145 | @Nullable <F extends WebServiceFeature> F getOperationFeature(@NotNull Class<F> featureType, |
aoqi@0 | 146 | @NotNull final QName operationName); |
aoqi@0 | 147 | |
aoqi@0 | 148 | /** |
aoqi@0 | 149 | * Returns a list of features associated with {@link WSBinding}. |
aoqi@0 | 150 | */ |
aoqi@0 | 151 | @NotNull WSFeatureList getFeatures(); |
aoqi@0 | 152 | |
aoqi@0 | 153 | /** |
aoqi@0 | 154 | * Experimental: Returns a list of features associated with {@link WSBinding} that apply to |
aoqi@0 | 155 | * a particular operation. |
aoqi@0 | 156 | * |
aoqi@0 | 157 | * @param operationName |
aoqi@0 | 158 | * The WSDL name of the operation. |
aoqi@0 | 159 | */ |
aoqi@0 | 160 | @NotNull WSFeatureList getOperationFeatures(@NotNull final QName operationName); |
aoqi@0 | 161 | |
aoqi@0 | 162 | /** |
aoqi@0 | 163 | * Experimental: Returns a list of features associated with {@link WSBinding} that apply to |
aoqi@0 | 164 | * the input message of an operation. |
aoqi@0 | 165 | * |
aoqi@0 | 166 | * @param operationName |
aoqi@0 | 167 | * The WSDL name of the operation. |
aoqi@0 | 168 | */ |
aoqi@0 | 169 | @NotNull WSFeatureList getInputMessageFeatures(@NotNull final QName operationName); |
aoqi@0 | 170 | |
aoqi@0 | 171 | /** |
aoqi@0 | 172 | * Experimental: Returns a list of features associated with {@link WSBinding} that apply to |
aoqi@0 | 173 | * the output message of an operation. |
aoqi@0 | 174 | * |
aoqi@0 | 175 | * @param operationName |
aoqi@0 | 176 | * The WSDL name of the operation. |
aoqi@0 | 177 | */ |
aoqi@0 | 178 | @NotNull WSFeatureList getOutputMessageFeatures(@NotNull final QName operationName); |
aoqi@0 | 179 | |
aoqi@0 | 180 | /** |
aoqi@0 | 181 | * Experimental: Returns a list of features associated with {@link WSBinding} that apply to |
aoqi@0 | 182 | * one of the fault messages of an operation. |
aoqi@0 | 183 | * |
aoqi@0 | 184 | * @param operationName |
aoqi@0 | 185 | * The WSDL name of the operation. |
aoqi@0 | 186 | * @param messageName |
aoqi@0 | 187 | * The WSDL name of the fault message. |
aoqi@0 | 188 | */ |
aoqi@0 | 189 | @NotNull WSFeatureList getFaultMessageFeatures(@NotNull final QName operationName, |
aoqi@0 | 190 | @NotNull final QName messageName); |
aoqi@0 | 191 | |
aoqi@0 | 192 | /** |
aoqi@0 | 193 | * Returns set of header QNames known to be supported by this binding. |
aoqi@0 | 194 | * @return Set of known QNames |
aoqi@0 | 195 | */ |
aoqi@0 | 196 | @NotNull Set<QName> getKnownHeaders(); |
aoqi@0 | 197 | |
aoqi@0 | 198 | /** |
aoqi@0 | 199 | * Adds header QName to set known to be supported by this binding |
aoqi@0 | 200 | * @param knownHeader Known header QName |
aoqi@0 | 201 | * @return true, if new entry was added; false, if known header QName was already known |
aoqi@0 | 202 | */ |
aoqi@0 | 203 | boolean addKnownHeader(QName knownHeader); |
aoqi@0 | 204 | |
aoqi@0 | 205 | /** |
aoqi@0 | 206 | * @return A MessageContextFactory configured according to the binding's features. |
aoqi@0 | 207 | */ |
aoqi@0 | 208 | @NotNull com.oracle.webservices.internal.api.message.MessageContextFactory getMessageContextFactory(); |
aoqi@0 | 209 | } |