|
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.oracle.webservices.internal.api.databinding; |
|
27 |
|
28 import java.lang.reflect.Method; |
|
29 import java.net.URL; |
|
30 |
|
31 import javax.xml.namespace.QName; |
|
32 import javax.xml.transform.Source; |
|
33 import javax.xml.ws.WebServiceFeature; |
|
34 |
|
35 import org.xml.sax.EntityResolver; |
|
36 |
|
37 import com.oracle.webservices.internal.api.message.MessageContext; |
|
38 |
|
39 /** |
|
40 * {@code Databinding} is the entry point for all the WebService Databinding |
|
41 * functionality. Primarily, a Databinding is to serialize/deserialize an |
|
42 * XML(SOAP) message to/from a JAVA method invocation and return which are |
|
43 * represented as <code>JavaCallInfo</code> instances. A WSDLGenerator can |
|
44 * be created from a Databinding object to genreate WSDL representation of |
|
45 * a JAVA service endpoint interface. |
|
46 * <p> |
|
47 * </p> |
|
48 * The supported databinding modes(flavors) are: |
|
49 * <ul> |
|
50 * <li>"toplink.jaxb"</li> |
|
51 * <li>"glassfish.jaxb"</li> |
|
52 * </ul> |
|
53 * <blockquote> Following is an example that creates a {@code Databinding} which |
|
54 * provides the operations to serialize/deserialize a JavaCallInfo to/from a |
|
55 * SOAP message:<br/> |
|
56 * |
|
57 * <pre> |
|
58 * DatabindingFactory factory = DatabindingFactory.newInstance(); |
|
59 * Databinding.Builder builder = factory.createBuilder(seiClass, endpointClass); |
|
60 * Databinding databinding = builder.build(); |
|
61 * </pre> |
|
62 * |
|
63 * </blockquote> |
|
64 * |
|
65 * @see com.oracle.webservices.internal.api.databinding.DatabindingFactory |
|
66 * |
|
67 * @author shih-chang.chen@oracle.com |
|
68 */ |
|
69 public interface Databinding { |
|
70 |
|
71 /** |
|
72 * Creates a new instance of a <code>JavaCallInfo</code>. |
|
73 * |
|
74 * @param method The JAVA method |
|
75 * @param args The parameter objects |
|
76 * |
|
77 * @return New instance of a <code>JavaCallInfo</code> |
|
78 */ |
|
79 JavaCallInfo createJavaCallInfo(Method method, Object[] args); |
|
80 |
|
81 /** |
|
82 * Serializes a JavaCallInfo instance representing a JAVA method call to a |
|
83 * request XML(SOAP) message. |
|
84 * |
|
85 * @param call The JavaCallInfo representing a method call |
|
86 * |
|
87 * @return The request XML(SOAP) message |
|
88 */ |
|
89 MessageContext serializeRequest(JavaCallInfo call); |
|
90 |
|
91 /** |
|
92 * Deserializes a response XML(SOAP) message to a JavaCallInfo instance |
|
93 * representing the return value or exception of a JAVA method call. |
|
94 * |
|
95 * @param message The response message |
|
96 * @param call The JavaCallInfo instance to be updated |
|
97 * |
|
98 * @return The JavaCallInfo updated with the return value or exception of a |
|
99 * JAVA method call |
|
100 */ |
|
101 JavaCallInfo deserializeResponse(MessageContext message, JavaCallInfo call); |
|
102 |
|
103 /** |
|
104 * Deserializes a request XML(SOAP) message to a JavaCallInfo instance |
|
105 * representing a JAVA method call. |
|
106 * |
|
107 * @param message The request message |
|
108 * |
|
109 * @return The JavaCallInfo representing a method call |
|
110 */ |
|
111 JavaCallInfo deserializeRequest(MessageContext message); |
|
112 |
|
113 /** |
|
114 * Serializes a JavaCallInfo instance representing the return value or |
|
115 * exception of a JAVA method call to a response XML(SOAP) message. |
|
116 * |
|
117 * @param call The JavaCallInfo representing the return value or exception |
|
118 * of a JAVA method call |
|
119 * |
|
120 * @return The response XML(SOAP) message |
|
121 */ |
|
122 MessageContext serializeResponse(JavaCallInfo call); |
|
123 |
|
124 /** |
|
125 * Gets the MessageContextFactory |
|
126 * |
|
127 * @return The MessageContextFactory |
|
128 */ |
|
129 //Wait for WLS/src1212 - wls.jaxrpc wrapper |
|
130 // MessageContextFactory getMessageContextFactory(); |
|
131 |
|
132 /** |
|
133 * {@code Databinding.Builder}, created from the DatabindingFactory, is used to |
|
134 * configure how a Databinding instance is to be built from this builder. |
|
135 * |
|
136 * @see com.oracle.webservices.internal.api.databinding.DatabindingFactory |
|
137 * @author shih-chang.chen@oracle.com |
|
138 */ |
|
139 public interface Builder { |
|
140 |
|
141 /** |
|
142 * Sets the targetNamespace of the WSDL |
|
143 * |
|
144 * @param targetNamespace The targetNamespace to set |
|
145 * |
|
146 * @return this Builder instance |
|
147 */ |
|
148 Builder targetNamespace(String targetNamespace); |
|
149 |
|
150 /** |
|
151 * Sets the service name of the WSDL |
|
152 * |
|
153 * @param serviceName The serviceName to set |
|
154 * |
|
155 * @return this Builder instance |
|
156 */ |
|
157 Builder serviceName(QName serviceName); |
|
158 |
|
159 /** |
|
160 * Sets the port name of the WSDL |
|
161 * |
|
162 * @param portName The portName to set |
|
163 * |
|
164 * @return this Builder instance |
|
165 */ |
|
166 Builder portName(QName portName); |
|
167 |
|
168 /** |
|
169 * @deprecated - no replacement - this was never implemented |
|
170 * |
|
171 * Sets the WSDL URL where the WSDL can be read from |
|
172 * |
|
173 * @param wsdlURL The wsdlURL to set |
|
174 * |
|
175 * @return this Builder instance |
|
176 */ |
|
177 Builder wsdlURL(URL wsdlURL); |
|
178 |
|
179 /** |
|
180 * @deprecated - no replacement - this was never implemented |
|
181 * |
|
182 * Sets the WSDL Source where the WSDL can be read from |
|
183 * |
|
184 * @param wsdlSource The wsdlSource to set |
|
185 * |
|
186 * @return this Builder instance |
|
187 */ |
|
188 Builder wsdlSource(Source wsdlSource); |
|
189 |
|
190 /** |
|
191 * @deprecated - no replacement - this was never implemented |
|
192 * |
|
193 * Sets the {@link EntityResolver} for reading the WSDL |
|
194 * |
|
195 * @param entityResolver The {@link EntityResolver} to set |
|
196 * |
|
197 * @return this Builder instance |
|
198 */ |
|
199 Builder entityResolver(EntityResolver entityResolver); |
|
200 |
|
201 /** |
|
202 * Sets the ClassLoader which is used to load the service endpoint |
|
203 * interface, implementation bean, and all the value types. If this |
|
204 * value is not set, the default it uses contractClass.getClassLoader(). |
|
205 * |
|
206 * @param classLoader The classLoader to set |
|
207 * |
|
208 * @return this Builder instance |
|
209 */ |
|
210 Builder classLoader(ClassLoader classLoader); |
|
211 |
|
212 /** |
|
213 * Sets A list of WebServiceFeatures |
|
214 * |
|
215 * @param features The list of WebServiceFeatures |
|
216 * |
|
217 * @return this Builder instance |
|
218 */ |
|
219 Builder feature(WebServiceFeature... features); |
|
220 |
|
221 /** |
|
222 * Sets A property of the Databinding object to be created |
|
223 * |
|
224 * @param name The name of the property |
|
225 * @param value The value of the property |
|
226 * |
|
227 * @return this Builder instance |
|
228 */ |
|
229 Builder property(String name, Object value); |
|
230 |
|
231 /** |
|
232 * Builds a new Databinding instance |
|
233 * |
|
234 * @return The Builder instance |
|
235 */ |
|
236 Databinding build(); |
|
237 |
|
238 /** |
|
239 * Creates the WSDLGenerator which can be used to generate the WSDL |
|
240 * representation of the service endpoint interface of this Databinding |
|
241 * object. |
|
242 * |
|
243 * @return WSDLGenerator The WSDLGenerator |
|
244 */ |
|
245 com.oracle.webservices.internal.api.databinding.WSDLGenerator createWSDLGenerator(); |
|
246 } |
|
247 } |