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;
27
28import com.sun.istack.internal.NotNull;
29import com.sun.xml.internal.bind.api.Bridge;
30import com.sun.xml.internal.bind.api.JAXBRIContext;
31import com.sun.xml.internal.bind.api.TypeReference;
32import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort;
33import com.sun.xml.internal.ws.util.Pool;
34
35import javax.xml.bind.JAXBContext;
36import javax.xml.namespace.QName;
37import javax.xml.ws.Dispatch;
38import javax.xml.ws.Provider;
39import java.lang.reflect.Method;
40import java.util.Collection;
41
42/**
43 * Represents abstraction of SEI.
44 *
45 * <p>
46 * This interface would be used to access which Java concepts correspond to
47 * which WSDL concepts, such as which <code>wsdl:port</code> corresponds to
48 * a SEI, or which <code>wsdl:operation</code> corresponds to {@link JavaMethod}.
49 *
50 * <P>
51 * It also retains information about the databinding done for a SEI;
52 * such as {@link JAXBRIContext} and {@link Bridge}.
53 *
54 * <p>
55 * This model is constructed only when there is a Java SEI. Therefore it's
56 * not available with {@link Dispatch} or {@link Provider}. Technologies that
57 * need to work regardless of such surface API difference shall not be using
58 * this model.
59 *
60 * @author Vivek Pandey
61 */
62public interface SEIModel {
63    Pool.Marshaller getMarshallerPool();
64
65    /**
66     * JAXBContext that will be used to marshall/unmarshall the java classes found in the SEI.
67     *
68     * @return the <code>{@link JAXBRIContext}</code>
69     * @deprecated Why do you need this?
70     */
71    JAXBContext getJAXBContext();
72
73    /**
74     * Get the Bridge associated with the {@link TypeReference}
75     *
76     * @param type
77     * @return the <code>{@link Bridge}</code> for the <code>type</code>
78     */
79//    Bridge getBridge(TypeReference type);
80
81    /**
82     * Its a known fault if the exception thrown by {@link Method} is annotated with the
83     * {@link javax.xml.ws.WebFault#name()} thas equal to the name passed as parameter.
84     *
85     * @param name   is the qualified name of fault detail element as specified by wsdl:fault@element value.
86     * @param method is the Java {@link Method}
87     * @return true if <code>name</code> is the name
88     *         of a known fault name for the <code>method</code>
89     */
90//    boolean isKnownFault(QName name, Method method);
91
92    /**
93     * Checks if the {@link JavaMethod} for the {@link Method} knowns the exception class.
94     *
95     * @param m  {@link Method} to pickup the right {@link JavaMethod} model
96     * @param ex exception class
97     * @return true if <code>ex</code> is a Checked Exception
98     *         for <code>m</code>
99     */
100//    boolean isCheckedException(Method m, Class ex);
101
102    /**
103     * This method will be useful to get the {@link JavaMethod} corrrespondiong to
104     * a {@link Method} - such as on the client side.
105     *
106     * @param method for which {@link JavaMethod} is asked for
107     * @return the {@link JavaMethod} representing the <code>method</code>
108     */
109    JavaMethod getJavaMethod(Method method);
110
111    /**
112     * Gives a {@link JavaMethod} for a given {@link QName}. The {@link QName} will
113     * be equivalent to the SOAP Body or Header block or can simply be the name of an
114     * infoset that corresponds to the payload.
115     * @param name
116     * @return the <code>JavaMethod</code> associated with the
117     *         operation named name
118     */
119    public JavaMethod getJavaMethod(QName name);
120
121    /**
122     * Gives the JavaMethod associated with the wsdl operation
123     * @param operationName QName of the wsdl operation
124     * @return
125     */
126    public JavaMethod getJavaMethodForWsdlOperation(QName operationName);
127
128
129    /**
130     * Gives all the {@link JavaMethod} for a wsdl:port for which this {@link SEIModel} is
131     * created.
132     *
133     * @return a {@link Collection} of {@link JavaMethod}
134     *         associated with the {@link SEIModel}
135     */
136    Collection<? extends JavaMethod> getJavaMethods();
137
138    /**
139     * Location of the WSDL that defines the port associated with the {@link SEIModel}
140     *
141     * @return wsdl location uri - always non-null
142     */
143    @NotNull String getWSDLLocation();
144
145    /**
146     * wsdl:service qualified name for the port associated with the {@link SEIModel}
147     *
148     * @return wsdl:service@name value - always non-null
149     */
150    @NotNull QName getServiceQName();
151
152    /**
153     * Gets the {@link WSDLPort} that represents the port that this SEI binds to.
154     */
155    @NotNull WSDLPort getPort();
156
157    /**
158     * Value of the wsdl:port name associated with the {@link SEIModel}
159     *
160     * @return wsdl:service/wsdl:port@name value, always non-null
161     */
162    @NotNull QName getPortName();
163
164    /**
165     * Value of wsdl:portType bound to the port associated with the {@link SEIModel}
166     *
167     * @return
168     */
169    @NotNull QName getPortTypeName();
170
171    /**
172     *  Gives the wsdl:binding@name value
173     */
174    @NotNull QName getBoundPortTypeName();
175
176    /**
177     * Namespace of the wsd;:port associated with the {@link SEIModel}
178     */
179    @NotNull String getTargetNamespace();
180}
181