001: package org.objectweb.hello_world_soap_http;
002:
003: import java.rmi.RemoteException;
004: import java.util.HashMap;
005: import java.util.Map;
006: import java.util.concurrent.Future;
007: import java.util.logging.Logger;
008:
009: import javax.xml.ws.AsyncHandler;
010: import javax.xml.ws.Response;
011:
012: import org.objectweb.hello_world_soap_http.types.BareDocumentResponse;
013: import org.objectweb.hello_world_soap_http.types.GreetMeResponse;
014: import org.objectweb.hello_world_soap_http.types.GreetMeSometimeResponse;
015: import org.objectweb.hello_world_soap_http.types.SayHiResponse;
016: import org.objectweb.hello_world_soap_http.types.TestDocLitFaultResponse;
017:
018: @javax.jws.WebService(name="Greeter",serviceName="SOAPService",targetNamespace="http://objectweb.org/hello_world_soap_http")
019: public class DerivedGreeterImpl implements Greeter {
020:
021: private static final Logger LOG = Logger
022: .getLogger(DerivedGreeterImpl.class.getName());
023: private final Map<String, Integer> invocationCount = new HashMap<String, Integer>();
024:
025: public DerivedGreeterImpl() {
026: invocationCount.put("sayHi", 0);
027: invocationCount.put("greetMe", 0);
028: invocationCount.put("greetMeOneWay", 0);
029: invocationCount.put("overloadedSayHi", 0);
030: }
031:
032: public int getInvocationCount(String method) {
033: if (invocationCount.containsKey(method)) {
034: return invocationCount.get(method).intValue();
035: } else {
036: System.out.println("No invocation count for method: "
037: + method);
038: return 0;
039: }
040: }
041:
042: /**
043: * overloaded method - present for test purposes
044: */
045: public String sayHi(String me) throws RemoteException {
046: incrementInvocationCount("overloadedSayHi");
047: return "Hi " + me + "!";
048: }
049:
050: @javax.jws.WebMethod(operationName="sayHi")
051: /*
052: * @javax.jws.WebResult(name="responseType",
053: * targetNamespace="http://objectweb.org/hello_world_soap_http")
054: */
055: public String sayHi() {
056: incrementInvocationCount("sayHi");
057: return "Hi";
058: }
059:
060: public void testDocLitFault(String faultType)
061: throws BadRecordLitFault, NoSuchCodeLitFault {
062: }
063:
064: public Response<TestDocLitFaultResponse> testDocLitFaultAsync(
065: String faultType) {
066: return null;
067: /*not called */
068: }
069:
070: public Response<TestDocLitFaultResponse> testDocLitFaultAsync(
071: String faultType, AsyncHandler ah) {
072: return null;
073: /*not called */
074: }
075:
076: public String greetMe(String me) {
077: incrementInvocationCount("greetMe");
078: return "Bonjour " + me + "!";
079: }
080:
081: public String greetMeSometime(String me) {
082: incrementInvocationCount("greetMeSometime");
083: return "Hello there " + me + "!";
084: }
085:
086: public Future<?> greetMeSometimeAsync(String requestType,
087: AsyncHandler<GreetMeSometimeResponse> asyncHandler) {
088: return null;
089: /* to be implemented */
090: }
091:
092: public Response<GreetMeSometimeResponse> greetMeSometimeAsync(
093: String requestType) {
094: return null;
095: /* to be implemented */
096: }
097:
098: public Future<?> greetMeAsync(String requestType,
099: AsyncHandler<GreetMeResponse> asyncHandler) {
100: return null;
101: /*not called */
102: }
103:
104: public Response<GreetMeResponse> greetMeAsync(String requestType) {
105: return null;
106: /*not called */
107: }
108:
109: public Future<?> sayHiAsync(AsyncHandler<SayHiResponse> asyncHandler) {
110: return null;
111: /*not called */
112: }
113:
114: public Response<SayHiResponse> sayHiAsync() {
115: return null;
116: /*not called */
117: }
118:
119: public Future<?> testDocLitBareAsync(String in,
120: AsyncHandler<BareDocumentResponse> asyncHandler) {
121: return null;
122: /*not called */
123: }
124:
125: public Response<BareDocumentResponse> testDocLitBareAsync(String in) {
126: return null;
127: /*not called */
128: }
129:
130: public void greetMeOneWay(String me) {
131: incrementInvocationCount("greetMeOneWay");
132: }
133:
134: public BareDocumentResponse testDocLitBare(String in) {
135: incrementInvocationCount("testDocLitBare");
136: BareDocumentResponse res = new BareDocumentResponse();
137: res.setCompany("Celtix");
138: res.setId(1);
139: return res;
140: }
141:
142: private void incrementInvocationCount(String method) {
143: LOG.info("Executing " + method);
144: int n = invocationCount.get(method);
145: invocationCount.put(method, n + 1);
146: }
147:
148: }
|