1 package org.objectweb.hello_world_soap_http; 2 3 import java.rmi.RemoteException ; 4 import java.util.HashMap ; 5 import java.util.Map ; 6 import java.util.concurrent.Future ; 7 import java.util.logging.Logger ; 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 LOG = 23 Logger.getLogger(DerivedGreeterImpl.class.getName()); 24 private final Map <String , Integer > invocationCount = new HashMap <String , Integer >(); 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 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 45 public String sayHi(String me) throws RemoteException { 46 incrementInvocationCount("overloadedSayHi"); 47 return "Hi " + me + "!"; 48 } 49 50 @javax.jws.WebMethod(operationName = "sayHi") 51 55 public String sayHi() { 56 incrementInvocationCount("sayHi"); 57 return "Hi"; 58 } 59 60 public void testDocLitFault(String faultType) throws BadRecordLitFault, NoSuchCodeLitFault { 61 } 62 63 public Response<TestDocLitFaultResponse> testDocLitFaultAsync(String faultType) { 64 return null; 65 66 } 67 68 public Response<TestDocLitFaultResponse> testDocLitFaultAsync(String faultType, AsyncHandler ah) { 69 return null; 70 71 } 72 73 74 public String greetMe(String me) { 75 incrementInvocationCount("greetMe"); 76 return "Bonjour " + me + "!"; 77 } 78 79 public String greetMeSometime(String me) { 80 incrementInvocationCount("greetMeSometime"); 81 return "Hello there " + me + "!"; 82 } 83 84 public Future <?> greetMeSometimeAsync(String requestType, 85 AsyncHandler<GreetMeSometimeResponse> asyncHandler) { 86 return null; 87 88 } 89 90 public Response<GreetMeSometimeResponse> greetMeSometimeAsync(String requestType) { 91 return null; 92 93 } 94 95 public Future <?> greetMeAsync(String requestType, AsyncHandler<GreetMeResponse> asyncHandler) { 96 return null; 97 98 } 99 100 public Response<GreetMeResponse> greetMeAsync(String requestType) { 101 return null; 102 103 } 104 105 public Future <?> sayHiAsync(AsyncHandler<SayHiResponse> asyncHandler) { 106 return null; 107 108 } 109 110 public Response<SayHiResponse> sayHiAsync() { 111 return null; 112 113 } 114 115 public Future <?> testDocLitBareAsync(String in, AsyncHandler<BareDocumentResponse> asyncHandler) { 116 return null; 117 118 } 119 120 public Response<BareDocumentResponse> testDocLitBareAsync(String in) { 121 return null; 122 123 } 124 125 public void greetMeOneWay(String me) { 126 incrementInvocationCount("greetMeOneWay"); 127 } 128 129 public BareDocumentResponse testDocLitBare(String 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 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 |