ohair@286: /* alanb@368: * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. ohair@286: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ohair@286: * ohair@286: * This code is free software; you can redistribute it and/or modify it ohair@286: * under the terms of the GNU General Public License version 2 only, as ohair@286: * published by the Free Software Foundation. Oracle designates this ohair@286: * particular file as subject to the "Classpath" exception as provided ohair@286: * by Oracle in the LICENSE file that accompanied this code. ohair@286: * ohair@286: * This code is distributed in the hope that it will be useful, but WITHOUT ohair@286: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ohair@286: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ohair@286: * version 2 for more details (a copy is included in the LICENSE file that ohair@286: * accompanied this code). ohair@286: * ohair@286: * You should have received a copy of the GNU General Public License version ohair@286: * 2 along with this work; if not, write to the Free Software Foundation, ohair@286: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ohair@286: * ohair@286: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@286: * or visit www.oracle.com if you need additional information or have any ohair@286: * questions. ohair@286: */ ohair@286: ohair@286: package com.sun.xml.internal.ws.api; ohair@286: ohair@286: import com.sun.istack.internal.NotNull; ohair@286: import com.sun.istack.internal.Nullable; ohair@286: import com.sun.xml.internal.ws.api.addressing.AddressingVersion; ohair@286: import com.sun.xml.internal.ws.api.message.Message; ohair@286: import com.sun.xml.internal.ws.api.pipe.Codec; ohair@286: import com.sun.xml.internal.ws.api.pipe.Tube; ohair@286: ohair@286: import javax.xml.namespace.QName; ohair@286: import javax.xml.ws.Binding; ohair@286: import javax.xml.ws.WebServiceFeature; ohair@286: import javax.xml.ws.handler.Handler; ohair@286: import java.util.List; ohair@286: import java.util.Set; ohair@286: alanb@368: ohair@286: /** ohair@286: * JAX-WS implementation of {@link Binding}. ohair@286: * ohair@286: *

ohair@286: * This object can be created by {@link BindingID#createBinding()}. ohair@286: * ohair@286: *

ohair@286: * Binding conceptually includes the on-the-wire format of the message, ohair@286: * this this object owns {@link Codec}. ohair@286: * ohair@286: * @author Kohsuke Kawaguchi ohair@286: */ ohair@286: public interface WSBinding extends Binding { ohair@286: /** ohair@286: * Gets the SOAP version of this binding. ohair@286: * ohair@286: * TODO: clarify what to do with XML/HTTP binding ohair@286: * ohair@286: *

ohair@286: * This is just a short-cut for {@code getBindingID().getSOAPVersion()} ohair@286: * ohair@286: * @return ohair@286: * If the binding is using SOAP, this method returns ohair@286: * a {@link SOAPVersion} constant. ohair@286: * ohair@286: * If the binding is not based on SOAP, this method ohair@286: * returns null. See {@link Message} for how a non-SOAP ohair@286: * binding shall be handled by {@link Tube}s. ohair@286: */ ohair@286: SOAPVersion getSOAPVersion(); ohair@286: /** ohair@286: * Gets the WS-Addressing version of this binding. ohair@286: *

ohair@286: * TODO: clarify what to do with XML/HTTP binding ohair@286: * ohair@286: * @return If the binding is using SOAP and WS-Addressing is enabled, ohair@286: * this method returns a {@link AddressingVersion} constant. ohair@286: * If binding is not using SOAP or WS-Addressing is not enabled, ohair@286: * this method returns null. ohair@286: * ohair@286: * This might be little slow as it has to go over all the features on binding. ohair@286: * Its advisable to cache the addressingVersion wherever possible and reuse it. ohair@286: */ ohair@286: AddressingVersion getAddressingVersion(); ohair@286: ohair@286: /** ohair@286: * Gets the binding ID, which uniquely identifies the binding. ohair@286: * ohair@286: *

ohair@286: * The relevant specs define the binding IDs and what they mean. ohair@286: * The ID is used in many places to identify the kind of binding ohair@286: * (such as SOAP1.1, SOAP1.2, REST, ...) ohair@286: * ohair@286: * @return ohair@286: * Always non-null same value. ohair@286: */ ohair@286: @NotNull BindingID getBindingId(); ohair@286: alanb@368: @NotNull@Override alanb@368: List getHandlerChain(); ohair@286: ohair@286: /** ohair@286: * Checks if a particular {@link WebServiceFeature} is enabled. ohair@286: * ohair@286: * @return ohair@286: * true if enabled. ohair@286: */ ohair@286: boolean isFeatureEnabled(@NotNull Class feature); ohair@286: ohair@286: /** ohair@286: * Experimental: Checks if a particular {@link WebServiceFeature} on an operation is enabled. ohair@286: * ohair@286: * @param operationName ohair@286: * The WSDL name of the operation. ohair@286: * @return ohair@286: * true if enabled. ohair@286: */ ohair@286: boolean isOperationFeatureEnabled(@NotNull Class feature, ohair@286: @NotNull final QName operationName); ohair@286: ohair@286: /** ohair@286: * Gets a {@link WebServiceFeature} of the specific type. ohair@286: * ohair@286: * @param featureType ohair@286: * The type of the feature to retrieve. ohair@286: * @return ohair@286: * If the feature is present and enabled, return a non-null instance. ohair@286: * Otherwise null. ohair@286: */ ohair@286: @Nullable F getFeature(@NotNull Class featureType); ohair@286: ohair@286: /** ohair@286: * Experimental: Gets a {@link WebServiceFeature} of the specific type that applies to an operation. ohair@286: * ohair@286: * @param featureType ohair@286: * The type of the feature to retrieve. ohair@286: * @param operationName ohair@286: * The WSDL name of the operation. ohair@286: * @return ohair@286: * If the feature is present and enabled, return a non-null instance. ohair@286: * Otherwise null. ohair@286: */ ohair@286: @Nullable F getOperationFeature(@NotNull Class featureType, ohair@286: @NotNull final QName operationName); ohair@286: ohair@286: /** ohair@286: * Returns a list of features associated with {@link WSBinding}. ohair@286: */ ohair@286: @NotNull WSFeatureList getFeatures(); ohair@286: ohair@286: /** ohair@286: * Experimental: Returns a list of features associated with {@link WSBinding} that apply to ohair@286: * a particular operation. ohair@286: * ohair@286: * @param operationName ohair@286: * The WSDL name of the operation. ohair@286: */ ohair@286: @NotNull WSFeatureList getOperationFeatures(@NotNull final QName operationName); ohair@286: ohair@286: /** ohair@286: * Experimental: Returns a list of features associated with {@link WSBinding} that apply to ohair@286: * the input message of an operation. ohair@286: * ohair@286: * @param operationName ohair@286: * The WSDL name of the operation. ohair@286: */ ohair@286: @NotNull WSFeatureList getInputMessageFeatures(@NotNull final QName operationName); ohair@286: ohair@286: /** ohair@286: * Experimental: Returns a list of features associated with {@link WSBinding} that apply to ohair@286: * the output message of an operation. ohair@286: * ohair@286: * @param operationName ohair@286: * The WSDL name of the operation. ohair@286: */ ohair@286: @NotNull WSFeatureList getOutputMessageFeatures(@NotNull final QName operationName); ohair@286: ohair@286: /** ohair@286: * Experimental: Returns a list of features associated with {@link WSBinding} that apply to ohair@286: * one of the fault messages of an operation. ohair@286: * ohair@286: * @param operationName ohair@286: * The WSDL name of the operation. ohair@286: * @param messageName ohair@286: * The WSDL name of the fault message. ohair@286: */ ohair@286: @NotNull WSFeatureList getFaultMessageFeatures(@NotNull final QName operationName, ohair@286: @NotNull final QName messageName); ohair@286: ohair@286: /** alanb@368: * Returns set of header QNames known to be supported by this binding. ohair@286: * @return Set of known QNames ohair@286: */ ohair@286: @NotNull Set getKnownHeaders(); alanb@368: alanb@368: /** alanb@368: * Adds header QName to set known to be supported by this binding alanb@368: * @param knownHeader Known header QName alanb@368: * @return true, if new entry was added; false, if known header QName was already known alanb@368: */ alanb@368: boolean addKnownHeader(QName knownHeader); alanb@368: alanb@368: /** alanb@368: * @return A MessageContextFactory configured according to the binding's features. alanb@368: */ alanb@368: @NotNull com.oracle.webservices.internal.api.message.MessageContextFactory getMessageContextFactory(); ohair@286: }