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