|
1 /* |
|
2 * Copyright (c) 2009, 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 javax.xml.ws.spi; |
|
27 |
|
28 import javax.xml.ws.WebServiceContext; |
|
29 import javax.xml.ws.WebServiceFeature; |
|
30 import java.lang.reflect.Method; |
|
31 import java.lang.reflect.InvocationTargetException; |
|
32 |
|
33 /** |
|
34 * Invoker hides the detail of calling into application endpoint |
|
35 * implementation. Container hands over an implementation of Invoker |
|
36 * to JAX-WS runtime, and jax-ws runtime calls {@link #invoke} |
|
37 * for a web service invocation. Finally, Invoker does the actual |
|
38 * invocation of web service on endpoint instance. |
|
39 * |
|
40 * Container also injects the provided <code>WebServiceContext</code> and takes |
|
41 * care of invoking <code>javax.annotation.PostConstruct</code> methods, |
|
42 * if present, on the endpoint implementation. |
|
43 * |
|
44 * @see Provider#createEndpoint(String, Class, Invoker, WebServiceFeature...) |
|
45 * @author Jitendra Kotamraju |
|
46 * @since JAX-WS 2.2 |
|
47 */ |
|
48 |
|
49 public abstract class Invoker { |
|
50 |
|
51 /** |
|
52 * JAX-WS runtimes calls this method to ask container to inject |
|
53 * WebServiceContext on the endpoint instance. The |
|
54 * <code>WebServiceContext</code> object uses thread-local information |
|
55 * to return the correct information during the actual endpoint invocation |
|
56 * regardless of how many threads are concurrently being used to serve |
|
57 * requests. |
|
58 * |
|
59 * @param webServiceContext a holder for MessageContext |
|
60 * @throws IllegalAccessException if the injection done |
|
61 * by reflection API throws this exception |
|
62 * @throws IllegalArgumentException if the injection done |
|
63 * by reflection API throws this exception |
|
64 * @throws InvocationTargetException if the injection done |
|
65 * by reflection API throws this exception |
|
66 */ |
|
67 public abstract void inject(WebServiceContext webServiceContext) |
|
68 throws IllegalAccessException, IllegalArgumentException, InvocationTargetException; |
|
69 |
|
70 /** |
|
71 * JAX-WS runtime calls this method to do the actual web service |
|
72 * invocation on endpoint instance. The injected |
|
73 * <code>WebServiceContext.getMessageContext()</code> gives the correct |
|
74 * information for this invocation. |
|
75 * |
|
76 * @param m Method to be invoked on the service |
|
77 * @param args Method arguments |
|
78 * @return return value of the method |
|
79 * @throws IllegalAccessException if the invocation done |
|
80 * by reflection API throws this exception |
|
81 * @throws IllegalArgumentException if the invocation done |
|
82 * by reflection API throws this exception |
|
83 * @throws InvocationTargetException if the invocation done |
|
84 * by reflection API throws this exception |
|
85 |
|
86 * @see Method#invoke |
|
87 */ |
|
88 public abstract Object invoke(Method m, Object... args) |
|
89 throws IllegalAccessException, IllegalArgumentException, InvocationTargetException; |
|
90 |
|
91 } |