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  */
25 
26 package com.sun.xml.internal.ws.api.pipe;
27 
28 import com.sun.xml.internal.ws.api.WSBinding;
29 import com.sun.xml.internal.ws.api.server.WSEndpoint;
30 import com.sun.xml.internal.ws.api.WSService;
31 import com.sun.xml.internal.ws.api.EndpointAddress;
32 import com.sun.xml.internal.ws.api.model.SEIModel;
33 import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort;
34 import com.sun.istack.internal.NotNull;
35 import com.sun.istack.internal.Nullable;
36 
37 import javax.xml.ws.Dispatch;
38 import javax.xml.ws.Provider;
39 import javax.xml.ws.Service;
40 import javax.xml.ws.WebServiceException;
41 
42 /**
43  * Creates a pipeline.
44  *
45  * <p>
46  * This pluggability layer enables the upper layer to
47  * control exactly how the pipeline is composed.
48  *
49  * <p>
50  * JAX-WS is going to have its own default implementation
51  * when used all by itself, but it can be substituted by
52  * other implementations.
53  *
54  * <p>
55  * See {@link PipelineAssemblerFactory} for how {@link PipelineAssembler}s
56  * are located.
57  *
58  * <p>
59  * TODO: the JAX-WS team felt that no {@link Pipe} should be relying
60  * on the {@link SEIModel}, so it is no longer given to the assembler.
61  * Talk to us if you need it.
62  *
63  * @see ClientPipeAssemblerContext
64  *
65  * @author Kohsuke Kawaguchi
66  */
67 public interface PipelineAssembler {
68     /**
69      * Creates a new pipeline for clients.
70      *
71      * <p>
72      * When a JAX-WS client creates a proxy or a {@link Dispatch} from
73      * a {@link Service}, JAX-WS runtime internally uses this method
74      * to create a new pipeline as a part of the initilization.
75      *
76      * @param context
77      *      Object that captures various contextual information
78      *      that can be used to determine the pipeline to be assembled.
79      *
80      * @return
81      *      non-null freshly created pipeline.
82      *
83      * @throws WebServiceException
84      *      if there's any configuration error that prevents the
85      *      pipeline from being constructed. This exception will be
86      *      propagated into the application, so it must have
87      *      a descriptive error.
88      */
createClient(@otNull ClientPipeAssemblerContext context)89     @NotNull Pipe createClient(@NotNull ClientPipeAssemblerContext context);
90 
91     /**
92      * Creates a new pipeline for servers.
93      *
94      * <p>
95      * When a JAX-WS server deploys a new endpoint, it internally
96      * uses this method to create a new pipeline as a part of the
97      * initialization.
98      *
99      * <p>
100      * Note that this method is called only once to set up a
101      * 'master pipeline', and it gets {@link Pipe#copy(PipeCloner) copied}
102      * from it.
103      *
104      * @param context
105      *      Object that captures various contextual information
106      *      that can be used to determine the pipeline to be assembled.
107      *
108      * @return
109      *      non-null freshly created pipeline.
110      *
111      * @throws WebServiceException
112      *      if there's any configuration error that prevents the
113      *      pipeline from being constructed. This exception will be
114      *      propagated into the container, so it must have
115      *      a descriptive error.
116      *
117      */
createServer(@otNull ServerPipeAssemblerContext context)118     @NotNull Pipe createServer(@NotNull ServerPipeAssemblerContext context);
119 }
120