1/*
2 * Copyright (c) 1997, 2013, 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
26package com.sun.xml.internal.ws.api.model.wsdl;
27
28import com.sun.istack.internal.NotNull;
29import com.sun.istack.internal.Nullable;
30import com.sun.xml.internal.ws.api.model.ParameterBinding;
31
32import javax.jws.WebParam.Mode;
33import javax.xml.namespace.QName;
34
35import java.util.Map;
36
37/**
38 * Abstracts wsdl:binding/wsdl:operation. It can be used to determine the parts and their binding.
39 *
40 * @author Vivek Pandey
41 */
42public interface WSDLBoundOperation extends WSDLObject, WSDLExtensible {
43    /**
44     * Short-cut for {@code getOperation().getName()}
45     */
46    @NotNull QName getName();
47
48    /**
49     * Gives soapbinding:operation@soapAction value. soapbinding:operation@soapAction is optional attribute.
50     * If not present an empty String is returned as per BP 1.1 R2745.
51     */
52    @NotNull String getSOAPAction();
53
54    /**
55     * Gets the wsdl:portType/wsdl:operation model - {@link WSDLOperation},
56     * associated with this binding operation.
57     *
58     * @return always same {@link WSDLOperation}
59     */
60    @NotNull WSDLOperation getOperation();
61
62    /**
63     * Gives the owner {@link WSDLBoundPortType}
64     */
65    @NotNull WSDLBoundPortType getBoundPortType();
66
67    /**
68     * Gets the soapbinding:binding/operation/wsaw:Anonymous. A default value of OPTIONAL is returned.
69     *
70     * @return Anonymous value of the operation
71     */
72    ANONYMOUS getAnonymous();
73
74    enum ANONYMOUS { optional, required, prohibited }
75
76    /**
77     * Gets {@link WSDLPart} for the given wsdl:input or wsdl:output part
78     *
79     * @return null if no part is found
80     */
81    @Nullable WSDLPart getPart(@NotNull String partName, @NotNull Mode mode);
82
83    /**
84     * Gets {@link ParameterBinding} for a given wsdl part in wsdl:input
85     *
86     * @param part Name of wsdl:part, must be non-null
87     * @return null if the part is not found.
88     */
89    public ParameterBinding getInputBinding(String part);
90
91    /**
92     * Gets {@link ParameterBinding} for a given wsdl part in wsdl:output
93     *
94     * @param part Name of wsdl:part, must be non-null
95     * @return null if the part is not found.
96     */
97    public ParameterBinding getOutputBinding(String part);
98
99    /**
100     * Gets {@link ParameterBinding} for a given wsdl part in wsdl:fault
101     *
102     * @param part Name of wsdl:part, must be non-null
103     * @return null if the part is not found.
104     */
105    public ParameterBinding getFaultBinding(String part);
106
107    /**
108     * Gets the MIME type for a given wsdl part in wsdl:input
109     *
110     * @param part Name of wsdl:part, must be non-null
111     * @return null if the part is not found.
112     */
113    public String getMimeTypeForInputPart(String part);
114
115    /**
116     * Gets the MIME type for a given wsdl part in wsdl:output
117     *
118     * @param part Name of wsdl:part, must be non-null
119     * @return null if the part is not found.
120     */
121    public String getMimeTypeForOutputPart(String part);
122
123    /**
124     * Gets the MIME type for a given wsdl part in wsdl:fault
125     *
126     * @param part Name of wsdl:part, must be non-null
127     * @return null if the part is not found.
128     */
129    public String getMimeTypeForFaultPart(String part);
130
131    /**
132     * Gets all inbound {@link WSDLPart} by its {@link WSDLPart#getName() name}.
133     */
134    @NotNull Map<String,? extends WSDLPart> getInParts();
135
136    /**
137     * Gets all outbound {@link WSDLPart} by its {@link WSDLPart#getName() name}.
138     */
139    @NotNull Map<String,? extends WSDLPart> getOutParts();
140
141    /**
142     * Gets all the {@link WSDLFault} bound to this operation.
143     */
144    @NotNull Iterable<? extends WSDLBoundFault> getFaults();
145
146    /**
147     * Map of wsdl:input part name and the binding as {@link ParameterBinding}
148     *
149     * @return empty Map if there is no parts
150     */
151    public Map<String, ParameterBinding> getInputParts();
152
153    /**
154     * Map of wsdl:output part name and the binding as {@link ParameterBinding}
155     *
156     * @return empty Map if there is no parts
157     */
158    public Map<String, ParameterBinding> getOutputParts();
159
160    /**
161     * Map of wsdl:fault part name and the binding as {@link ParameterBinding}
162     *
163     * @return empty Map if there is no parts
164     */
165    public Map<String, ParameterBinding> getFaultParts();
166
167    /**
168     * Gets the payload QName of the request message.
169     *
170     * <p>
171     * It's possible for an operation to define no body part, in which case
172     * this method returns null.
173     */
174    @Nullable QName getRequestPayloadName();
175
176    /**
177     * Gets the payload QName of the response message.
178     *
179     * <p>
180     * It's possible for an operation to define no body part, in which case
181     * this method returns null.
182     */
183    @Nullable QName getResponsePayloadName();
184
185    /**
186     * Gets the namespace of request payload.
187     */
188    String getRequestNamespace();
189
190    /**
191     * Gets the namespace of response payload.
192     */
193    String getResponseNamespace();
194
195}
196