Sat, 07 Nov 2020 10:30:02 +0800
Added tag mips-jdk8u275-b01 for changeset fdbe50121f48
1 /*
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
26 /*
27 * To change this template, choose Tools | Templates
28 * and open the template in the editor.
29 */
30 package com.sun.xml.internal.ws.assembler;
32 import com.sun.istack.internal.NotNull;
33 import com.sun.istack.internal.Nullable;
34 import com.sun.xml.internal.ws.api.model.SEIModel;
35 import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort;
36 import com.sun.xml.internal.ws.api.pipe.Codec;
37 import com.sun.xml.internal.ws.api.pipe.ServerTubeAssemblerContext;
38 import com.sun.xml.internal.ws.api.pipe.Tube;
39 import com.sun.xml.internal.ws.api.server.WSEndpoint;
40 import com.sun.xml.internal.ws.assembler.dev.ServerTubelineAssemblyContext;
41 import com.sun.xml.internal.ws.policy.PolicyMap;
43 /**
44 * The context is a wrapper around the existing JAX-WS {@link ServerTubeAssemblerContext} with additional features
45 *
46 * @author Marek Potociar (marek.potociar at sun.com)
47 */
48 class DefaultServerTubelineAssemblyContext extends TubelineAssemblyContextImpl implements ServerTubelineAssemblyContext {
50 private final @NotNull ServerTubeAssemblerContext wrappedContext;
51 private final PolicyMap policyMap;
52 // TODO: add next tube getter/package-private setter
53 // TODO: replace the PipeConfiguration
55 public DefaultServerTubelineAssemblyContext(@NotNull ServerTubeAssemblerContext context) {
56 this.wrappedContext = context;
57 this.policyMap = context.getEndpoint().getPolicyMap();
58 }
60 public PolicyMap getPolicyMap() {
61 return policyMap;
62 }
64 public boolean isPolicyAvailable() {
65 return policyMap != null && !policyMap.isEmpty();
66 }
68 /**
69 * The created pipeline will use seiModel to get java concepts for the endpoint
70 *
71 * @return Null if the service doesn't have SEI model e.g. Provider endpoints,
72 * and otherwise non-null.
73 */
74 public @Nullable SEIModel getSEIModel() {
75 return wrappedContext.getSEIModel();
76 }
78 /**
79 * The created pipeline will be used to serve this port.
80 *
81 * @return Null if the service isn't associated with any port definition in WSDL,
82 * and otherwise non-null.
83 */
84 public @Nullable WSDLPort getWsdlPort() {
85 return wrappedContext.getWsdlModel();
86 }
88 /**
89 *
90 * The created pipeline is used to serve this {@link com.sun.xml.internal.ws.api.server.WSEndpoint}.
91 * Specifically, its {@link com.sun.xml.internal.ws.api.WSBinding} should be of interest to many
92 * {@link com.sun.xml.internal.ws.api.pipe.Pipe}s.
93 * @return Always non-null.
94 */
95 public @NotNull WSEndpoint getEndpoint() {
96 return wrappedContext.getEndpoint();
97 }
99 /**
100 * The last {@link com.sun.xml.internal.ws.api.pipe.Pipe} in the pipeline. The assembler is expected to put
101 * additional {@link com.sun.xml.internal.ws.api.pipe.Pipe}s in front of it.
102 *
103 * <p>
104 * (Just to give you the idea how this is used, normally the terminal pipe
105 * is the one that invokes the user application or {@link javax.xml.ws.Provider}.)
106 *
107 * @return always non-null terminal pipe
108 */
109 public @NotNull Tube getTerminalTube() {
110 return wrappedContext.getTerminalTube();
111 }
113 /**
114 * If this server pipeline is known to be used for serving synchronous transport,
115 * then this method returns true. This can be potentially use as an optimization
116 * hint, since often synchronous versions are cheaper to execute than asycnhronous
117 * versions.
118 */
119 public boolean isSynchronous() {
120 return wrappedContext.isSynchronous();
121 }
123 /**
124 * Gets the {@link Codec} that is set by {@link #setCodec} or the default codec
125 * based on the binding. The codec is a full codec that is responsible for
126 * encoding/decoding entire protocol message(for e.g: it is responsible to
127 * encode/decode entire MIME messages in SOAP binding)
128 *
129 * @return codec to be used for web service requests
130 * @see {@link com.sun.xml.internal.ws.api.pipe.Codecs}
131 */
132 public @NotNull Codec getCodec() {
133 return wrappedContext.getCodec();
134 }
136 /**
137 * Interception point to change {@link Codec} during {@link Tube}line assembly. The
138 * new codec will be used by jax-ws server runtime for encoding/decoding web service
139 * request/response messages. {@link WSEndpoint#createCodec()} will return a copy
140 * of this new codec and will be used in the server runtime.
141 *
142 * <p>
143 * The codec is a full codec that is responsible for
144 * encoding/decoding entire protocol message(for e.g: it is responsible to
145 * encode/decode entire MIME messages in SOAP binding)
146 *
147 * <p>
148 * the codec should correctly implement {@link Codec#copy} since it is used while
149 * serving requests concurrently.
150 *
151 * @param codec codec to be used for web service requests
152 * @see {@link com.sun.xml.internal.ws.api.pipe.Codecs}
153 */
154 public void setCodec(@NotNull Codec codec) {
155 wrappedContext.setCodec(codec);
156 }
158 public ServerTubeAssemblerContext getWrappedContext() {
159 return wrappedContext;
160 }
161 }