KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > hello_world_soap_http > AnotherDerivedGreeterImpl


1 package org.objectweb.hello_world_soap_http;
2
3 import java.rmi.RemoteException JavaDoc;
4 import java.util.HashMap JavaDoc;
5 import java.util.Map JavaDoc;
6 import java.util.concurrent.Future JavaDoc;
7 import java.util.logging.Logger JavaDoc;
8
9 import javax.xml.ws.AsyncHandler;
10 import javax.xml.ws.Response;
11
12 import org.objectweb.hello_world_soap_http.types.BareDocumentResponse;
13 import org.objectweb.hello_world_soap_http.types.GreetMeResponse;
14 import org.objectweb.hello_world_soap_http.types.GreetMeSometimeResponse;
15 import org.objectweb.hello_world_soap_http.types.SayHiResponse;
16 import org.objectweb.hello_world_soap_http.types.TestDocLitFaultResponse;
17
18
19 @javax.jws.WebService(endpointInterface = "org.objectweb.hello_world_soap_http.Greeter")
20 public class AnotherDerivedGreeterImpl implements GreeterEndpointInterface {
21
22     private static final Logger JavaDoc LOG =
23         Logger.getLogger(DerivedGreeterImpl.class.getName());
24     private final Map JavaDoc<String JavaDoc, Integer JavaDoc> invocationCount = new HashMap JavaDoc<String JavaDoc, Integer JavaDoc>();
25
26     public AnotherDerivedGreeterImpl() {
27         invocationCount.put("sayHi", 0);
28         invocationCount.put("greetMe", 0);
29         invocationCount.put("greetMeOneWay", 0);
30         invocationCount.put("overloadedSayHi", 0);
31     }
32
33     public int getInvocationCount(String JavaDoc method) {
34         if (invocationCount.containsKey(method)) {
35             return invocationCount.get(method).intValue();
36         } else {
37             System.out.println("No invocation count for method: " + method);
38             return 0;
39         }
40     }
41
42     /**
43      * overloaded method - present for test purposes
44      */

45     public String JavaDoc sayHi(String JavaDoc me) throws RemoteException JavaDoc {
46         incrementInvocationCount("overloadedSayHi");
47         return "Hi " + me + "!";
48     }
49
50     @javax.jws.WebMethod(operationName = "sayHi")
51     /*
52      * @javax.jws.WebResult(name="responseType",
53      * targetNamespace="http://objectweb.org/hello_world_soap_http")
54      */

55     public String JavaDoc sayHi() {
56         incrementInvocationCount("sayHi");
57         return "Hi";
58     }
59
60     public void testDocLitFault(String JavaDoc faultType) throws BadRecordLitFault, NoSuchCodeLitFault {
61     }
62
63     public Response<TestDocLitFaultResponse> testDocLitFaultAsync(String JavaDoc faultType) {
64         return null;
65         /*not called */
66     }
67
68     public Response<TestDocLitFaultResponse> testDocLitFaultAsync(String JavaDoc faultType, AsyncHandler ah) {
69         return null;
70         /*not called */
71     }
72
73
74     public String JavaDoc greetMe(String JavaDoc me) {
75         incrementInvocationCount("greetMe");
76         return "Bonjour " + me + "!";
77     }
78
79     public String JavaDoc greetMeSometime(String JavaDoc me) {
80         incrementInvocationCount("greetMeSometime");
81         return "Hello there " + me + "!";
82     }
83
84     public Future JavaDoc<?> greetMeSometimeAsync(String JavaDoc requestType,
85                                            AsyncHandler<GreetMeSometimeResponse> asyncHandler) {
86         return null;
87         /* to be implemented */
88     }
89
90     public Response<GreetMeSometimeResponse> greetMeSometimeAsync(String JavaDoc requestType) {
91         return null;
92         /* to be implemented */
93     }
94
95     public Future JavaDoc<?> greetMeAsync(String JavaDoc requestType, AsyncHandler<GreetMeResponse> asyncHandler) {
96         return null;
97         /*not called */
98     }
99
100     public Response<GreetMeResponse> greetMeAsync(String JavaDoc requestType) {
101         return null;
102         /*not called */
103     }
104
105     public Future JavaDoc<?> sayHiAsync(AsyncHandler<SayHiResponse> asyncHandler) {
106         return null;
107         /*not called */
108     }
109
110     public Response<SayHiResponse> sayHiAsync() {
111         return null;
112         /*not called */
113     }
114
115     public Future JavaDoc<?> testDocLitBareAsync(String JavaDoc in, AsyncHandler<BareDocumentResponse> asyncHandler) {
116         return null;
117         /*not called */
118     }
119
120     public Response<BareDocumentResponse> testDocLitBareAsync(String JavaDoc in) {
121         return null;
122         /*not called */
123     }
124
125     public void greetMeOneWay(String JavaDoc me) {
126         incrementInvocationCount("greetMeOneWay");
127     }
128
129     public BareDocumentResponse testDocLitBare(String JavaDoc in) {
130         incrementInvocationCount("testDocLitBare");
131         BareDocumentResponse res = new BareDocumentResponse();
132         res.setCompany("Celtix");
133         res.setId(1);
134         return res;
135     }
136
137     private void incrementInvocationCount(String JavaDoc method) {
138         LOG.info("Executing " + method);
139         int n = invocationCount.get(method);
140         invocationCount.put(method, n + 1);
141     }
142
143 }
144
145
Popular Tags