1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/api/WSBinding.java Wed Apr 27 01:27:09 2016 +0800 1.3 @@ -0,0 +1,209 @@ 1.4 +/* 1.5 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. Oracle designates this 1.11 + * particular file as subject to the "Classpath" exception as provided 1.12 + * by Oracle in the LICENSE file that accompanied this code. 1.13 + * 1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 + * version 2 for more details (a copy is included in the LICENSE file that 1.18 + * accompanied this code). 1.19 + * 1.20 + * You should have received a copy of the GNU General Public License version 1.21 + * 2 along with this work; if not, write to the Free Software Foundation, 1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 + * 1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.25 + * or visit www.oracle.com if you need additional information or have any 1.26 + * questions. 1.27 + */ 1.28 + 1.29 +package com.sun.xml.internal.ws.api; 1.30 + 1.31 +import com.sun.istack.internal.NotNull; 1.32 +import com.sun.istack.internal.Nullable; 1.33 +import com.sun.xml.internal.ws.api.addressing.AddressingVersion; 1.34 +import com.sun.xml.internal.ws.api.message.Message; 1.35 +import com.sun.xml.internal.ws.api.pipe.Codec; 1.36 +import com.sun.xml.internal.ws.api.pipe.Tube; 1.37 + 1.38 +import javax.xml.namespace.QName; 1.39 +import javax.xml.ws.Binding; 1.40 +import javax.xml.ws.WebServiceFeature; 1.41 +import javax.xml.ws.handler.Handler; 1.42 +import java.util.List; 1.43 +import java.util.Set; 1.44 + 1.45 + 1.46 +/** 1.47 + * JAX-WS implementation of {@link Binding}. 1.48 + * 1.49 + * <p> 1.50 + * This object can be created by {@link BindingID#createBinding()}. 1.51 + * 1.52 + * <p> 1.53 + * Binding conceptually includes the on-the-wire format of the message, 1.54 + * this this object owns {@link Codec}. 1.55 + * 1.56 + * @author Kohsuke Kawaguchi 1.57 + */ 1.58 +public interface WSBinding extends Binding { 1.59 + /** 1.60 + * Gets the SOAP version of this binding. 1.61 + * 1.62 + * TODO: clarify what to do with XML/HTTP binding 1.63 + * 1.64 + * <p> 1.65 + * This is just a short-cut for {@code getBindingID().getSOAPVersion()} 1.66 + * 1.67 + * @return 1.68 + * If the binding is using SOAP, this method returns 1.69 + * a {@link SOAPVersion} constant. 1.70 + * 1.71 + * If the binding is not based on SOAP, this method 1.72 + * returns null. See {@link Message} for how a non-SOAP 1.73 + * binding shall be handled by {@link Tube}s. 1.74 + */ 1.75 + SOAPVersion getSOAPVersion(); 1.76 + /** 1.77 + * Gets the WS-Addressing version of this binding. 1.78 + * <p/> 1.79 + * TODO: clarify what to do with XML/HTTP binding 1.80 + * 1.81 + * @return If the binding is using SOAP and WS-Addressing is enabled, 1.82 + * this method returns a {@link AddressingVersion} constant. 1.83 + * If binding is not using SOAP or WS-Addressing is not enabled, 1.84 + * this method returns null. 1.85 + * 1.86 + * This might be little slow as it has to go over all the features on binding. 1.87 + * Its advisable to cache the addressingVersion wherever possible and reuse it. 1.88 + */ 1.89 + AddressingVersion getAddressingVersion(); 1.90 + 1.91 + /** 1.92 + * Gets the binding ID, which uniquely identifies the binding. 1.93 + * 1.94 + * <p> 1.95 + * The relevant specs define the binding IDs and what they mean. 1.96 + * The ID is used in many places to identify the kind of binding 1.97 + * (such as SOAP1.1, SOAP1.2, REST, ...) 1.98 + * 1.99 + * @return 1.100 + * Always non-null same value. 1.101 + */ 1.102 + @NotNull BindingID getBindingId(); 1.103 + 1.104 + @NotNull@Override 1.105 + List<Handler> getHandlerChain(); 1.106 + 1.107 + /** 1.108 + * Checks if a particular {@link WebServiceFeature} is enabled. 1.109 + * 1.110 + * @return 1.111 + * true if enabled. 1.112 + */ 1.113 + boolean isFeatureEnabled(@NotNull Class<? extends WebServiceFeature> feature); 1.114 + 1.115 + /** 1.116 + * Experimental: Checks if a particular {@link WebServiceFeature} on an operation is enabled. 1.117 + * 1.118 + * @param operationName 1.119 + * The WSDL name of the operation. 1.120 + * @return 1.121 + * true if enabled. 1.122 + */ 1.123 + boolean isOperationFeatureEnabled(@NotNull Class<? extends WebServiceFeature> feature, 1.124 + @NotNull final QName operationName); 1.125 + 1.126 + /** 1.127 + * Gets a {@link WebServiceFeature} of the specific type. 1.128 + * 1.129 + * @param featureType 1.130 + * The type of the feature to retrieve. 1.131 + * @return 1.132 + * If the feature is present and enabled, return a non-null instance. 1.133 + * Otherwise null. 1.134 + */ 1.135 + @Nullable <F extends WebServiceFeature> F getFeature(@NotNull Class<F> featureType); 1.136 + 1.137 + /** 1.138 + * Experimental: Gets a {@link WebServiceFeature} of the specific type that applies to an operation. 1.139 + * 1.140 + * @param featureType 1.141 + * The type of the feature to retrieve. 1.142 + * @param operationName 1.143 + * The WSDL name of the operation. 1.144 + * @return 1.145 + * If the feature is present and enabled, return a non-null instance. 1.146 + * Otherwise null. 1.147 + */ 1.148 + @Nullable <F extends WebServiceFeature> F getOperationFeature(@NotNull Class<F> featureType, 1.149 + @NotNull final QName operationName); 1.150 + 1.151 + /** 1.152 + * Returns a list of features associated with {@link WSBinding}. 1.153 + */ 1.154 + @NotNull WSFeatureList getFeatures(); 1.155 + 1.156 + /** 1.157 + * Experimental: Returns a list of features associated with {@link WSBinding} that apply to 1.158 + * a particular operation. 1.159 + * 1.160 + * @param operationName 1.161 + * The WSDL name of the operation. 1.162 + */ 1.163 + @NotNull WSFeatureList getOperationFeatures(@NotNull final QName operationName); 1.164 + 1.165 + /** 1.166 + * Experimental: Returns a list of features associated with {@link WSBinding} that apply to 1.167 + * the input message of an operation. 1.168 + * 1.169 + * @param operationName 1.170 + * The WSDL name of the operation. 1.171 + */ 1.172 + @NotNull WSFeatureList getInputMessageFeatures(@NotNull final QName operationName); 1.173 + 1.174 + /** 1.175 + * Experimental: Returns a list of features associated with {@link WSBinding} that apply to 1.176 + * the output message of an operation. 1.177 + * 1.178 + * @param operationName 1.179 + * The WSDL name of the operation. 1.180 + */ 1.181 + @NotNull WSFeatureList getOutputMessageFeatures(@NotNull final QName operationName); 1.182 + 1.183 + /** 1.184 + * Experimental: Returns a list of features associated with {@link WSBinding} that apply to 1.185 + * one of the fault messages of an operation. 1.186 + * 1.187 + * @param operationName 1.188 + * The WSDL name of the operation. 1.189 + * @param messageName 1.190 + * The WSDL name of the fault message. 1.191 + */ 1.192 + @NotNull WSFeatureList getFaultMessageFeatures(@NotNull final QName operationName, 1.193 + @NotNull final QName messageName); 1.194 + 1.195 + /** 1.196 + * Returns set of header QNames known to be supported by this binding. 1.197 + * @return Set of known QNames 1.198 + */ 1.199 + @NotNull Set<QName> getKnownHeaders(); 1.200 + 1.201 + /** 1.202 + * Adds header QName to set known to be supported by this binding 1.203 + * @param knownHeader Known header QName 1.204 + * @return true, if new entry was added; false, if known header QName was already known 1.205 + */ 1.206 + boolean addKnownHeader(QName knownHeader); 1.207 + 1.208 + /** 1.209 + * @return A MessageContextFactory configured according to the binding's features. 1.210 + */ 1.211 + @NotNull com.oracle.webservices.internal.api.message.MessageContextFactory getMessageContextFactory(); 1.212 +}