aoqi@0: /* aoqi@0: * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. aoqi@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: * aoqi@0: * This code is free software; you can redistribute it and/or modify it aoqi@0: * under the terms of the GNU General Public License version 2 only, as aoqi@0: * published by the Free Software Foundation. Oracle designates this aoqi@0: * particular file as subject to the "Classpath" exception as provided aoqi@0: * by Oracle in the LICENSE file that accompanied this code. aoqi@0: * aoqi@0: * This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: * version 2 for more details (a copy is included in the LICENSE file that aoqi@0: * accompanied this code). aoqi@0: * aoqi@0: * You should have received a copy of the GNU General Public License version aoqi@0: * 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: * aoqi@0: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: * or visit www.oracle.com if you need additional information or have any aoqi@0: * questions. aoqi@0: */ aoqi@0: aoqi@0: /* aoqi@0: * To change this template, choose Tools | Templates aoqi@0: * and open the template in the editor. aoqi@0: */ aoqi@0: package com.sun.xml.internal.ws.assembler; aoqi@0: aoqi@0: import com.sun.istack.internal.NotNull; aoqi@0: import com.sun.istack.internal.Nullable; aoqi@0: import com.sun.xml.internal.ws.api.model.SEIModel; aoqi@0: import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort; aoqi@0: import com.sun.xml.internal.ws.api.pipe.Codec; aoqi@0: import com.sun.xml.internal.ws.api.pipe.ServerTubeAssemblerContext; aoqi@0: import com.sun.xml.internal.ws.api.pipe.Tube; aoqi@0: import com.sun.xml.internal.ws.api.server.WSEndpoint; aoqi@0: import com.sun.xml.internal.ws.assembler.dev.ServerTubelineAssemblyContext; aoqi@0: import com.sun.xml.internal.ws.policy.PolicyMap; aoqi@0: aoqi@0: /** aoqi@0: * The context is a wrapper around the existing JAX-WS {@link ServerTubeAssemblerContext} with additional features aoqi@0: * aoqi@0: * @author Marek Potociar (marek.potociar at sun.com) aoqi@0: */ aoqi@0: class DefaultServerTubelineAssemblyContext extends TubelineAssemblyContextImpl implements ServerTubelineAssemblyContext { aoqi@0: aoqi@0: private final @NotNull ServerTubeAssemblerContext wrappedContext; aoqi@0: private final PolicyMap policyMap; aoqi@0: // TODO: add next tube getter/package-private setter aoqi@0: // TODO: replace the PipeConfiguration aoqi@0: aoqi@0: public DefaultServerTubelineAssemblyContext(@NotNull ServerTubeAssemblerContext context) { aoqi@0: this.wrappedContext = context; aoqi@0: this.policyMap = context.getEndpoint().getPolicyMap(); aoqi@0: } aoqi@0: aoqi@0: public PolicyMap getPolicyMap() { aoqi@0: return policyMap; aoqi@0: } aoqi@0: aoqi@0: public boolean isPolicyAvailable() { aoqi@0: return policyMap != null && !policyMap.isEmpty(); aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * The created pipeline will use seiModel to get java concepts for the endpoint aoqi@0: * aoqi@0: * @return Null if the service doesn't have SEI model e.g. Provider endpoints, aoqi@0: * and otherwise non-null. aoqi@0: */ aoqi@0: public @Nullable SEIModel getSEIModel() { aoqi@0: return wrappedContext.getSEIModel(); aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * The created pipeline will be used to serve this port. aoqi@0: * aoqi@0: * @return Null if the service isn't associated with any port definition in WSDL, aoqi@0: * and otherwise non-null. aoqi@0: */ aoqi@0: public @Nullable WSDLPort getWsdlPort() { aoqi@0: return wrappedContext.getWsdlModel(); aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * aoqi@0: * The created pipeline is used to serve this {@link com.sun.xml.internal.ws.api.server.WSEndpoint}. aoqi@0: * Specifically, its {@link com.sun.xml.internal.ws.api.WSBinding} should be of interest to many aoqi@0: * {@link com.sun.xml.internal.ws.api.pipe.Pipe}s. aoqi@0: * @return Always non-null. aoqi@0: */ aoqi@0: public @NotNull WSEndpoint getEndpoint() { aoqi@0: return wrappedContext.getEndpoint(); aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * The last {@link com.sun.xml.internal.ws.api.pipe.Pipe} in the pipeline. The assembler is expected to put aoqi@0: * additional {@link com.sun.xml.internal.ws.api.pipe.Pipe}s in front of it. aoqi@0: * aoqi@0: *

aoqi@0: * (Just to give you the idea how this is used, normally the terminal pipe aoqi@0: * is the one that invokes the user application or {@link javax.xml.ws.Provider}.) aoqi@0: * aoqi@0: * @return always non-null terminal pipe aoqi@0: */ aoqi@0: public @NotNull Tube getTerminalTube() { aoqi@0: return wrappedContext.getTerminalTube(); aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * If this server pipeline is known to be used for serving synchronous transport, aoqi@0: * then this method returns true. This can be potentially use as an optimization aoqi@0: * hint, since often synchronous versions are cheaper to execute than asycnhronous aoqi@0: * versions. aoqi@0: */ aoqi@0: public boolean isSynchronous() { aoqi@0: return wrappedContext.isSynchronous(); aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Gets the {@link Codec} that is set by {@link #setCodec} or the default codec aoqi@0: * based on the binding. The codec is a full codec that is responsible for aoqi@0: * encoding/decoding entire protocol message(for e.g: it is responsible to aoqi@0: * encode/decode entire MIME messages in SOAP binding) aoqi@0: * aoqi@0: * @return codec to be used for web service requests aoqi@0: * @see {@link com.sun.xml.internal.ws.api.pipe.Codecs} aoqi@0: */ aoqi@0: public @NotNull Codec getCodec() { aoqi@0: return wrappedContext.getCodec(); aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Interception point to change {@link Codec} during {@link Tube}line assembly. The aoqi@0: * new codec will be used by jax-ws server runtime for encoding/decoding web service aoqi@0: * request/response messages. {@link WSEndpoint#createCodec()} will return a copy aoqi@0: * of this new codec and will be used in the server runtime. aoqi@0: * aoqi@0: *

aoqi@0: * The codec is a full codec that is responsible for aoqi@0: * encoding/decoding entire protocol message(for e.g: it is responsible to aoqi@0: * encode/decode entire MIME messages in SOAP binding) aoqi@0: * aoqi@0: *

aoqi@0: * the codec should correctly implement {@link Codec#copy} since it is used while aoqi@0: * serving requests concurrently. aoqi@0: * aoqi@0: * @param codec codec to be used for web service requests aoqi@0: * @see {@link com.sun.xml.internal.ws.api.pipe.Codecs} aoqi@0: */ aoqi@0: public void setCodec(@NotNull Codec codec) { aoqi@0: wrappedContext.setCodec(codec); aoqi@0: } aoqi@0: aoqi@0: public ServerTubeAssemblerContext getWrappedContext() { aoqi@0: return wrappedContext; aoqi@0: } aoqi@0: }