KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > asap > AsapObserverBindingImpl


1 /**
2  * AsapObserverBindingImpl.java
3  *
4  * This file was auto-generated from WSDL by the Apache Axis WSDL2Java emitter.
5  */

6
7 package org.enhydra.shark.asap;
8
9 import java.rmi.RemoteException JavaDoc;
10
11 import javax.xml.rpc.holders.ObjectHolder JavaDoc;
12 import javax.xml.rpc.holders.StringHolder JavaDoc;
13
14 import org.apache.axis.types.URI;
15 import org.enhydra.shark.api.common.SharkConstants;
16 import org.enhydra.shark.asap.types.*;
17 import org.enhydra.shark.asap.types.holders.GetPropertiesRsHolder;
18 import org.enhydra.shark.asap.types.holders.ResponseHolder;
19
20 /**
21  * ASAP observer implementation
22  *
23  * @author V.Puskas
24  * @version 0.11
25  */

26 public class AsapObserverBindingImpl implements ObserverPortType {
27    public void getProperties(Request rqHead,
28                              String JavaDoc rqBody,
29                              ResponseHolder rsHead,
30                              GetPropertiesRsHolder rsBody) throws java.rmi.RemoteException JavaDoc {
31       URI rqReceiverKey = AsapBindingUtilitiesImpl.turnHeads(rqHead, rsHead);
32       rsBody.value = new GetPropertiesRs();
33    }
34
35    public void completed(Request rqHead,
36                          CompletedRq rqBody,
37                          ResponseHolder rsHead,
38                          StringHolder JavaDoc rsBody) throws java.rmi.RemoteException JavaDoc {
39       URI rqReceiverKey = AsapBindingUtilitiesImpl.turnHeads(rqHead, rsHead);
40       URI rqInstanceKey = rqBody.getInstanceKey();
41       CompletedRqResultData rqResultData = rqBody.getResultData();
42
43       if (!AsapBindingUtilitiesImpl.sendEventToActivity(rqReceiverKey,
44                                                         rqInstanceKey.toString(),
45                                                         rqResultData,
46                                                         null,
47                                                         null)) {
48 // AsapBindingUtilitiesImpl.completeActivity(rqReceiverKey,
49
// rqResultData);
50
}
51       rsBody.value = "";
52    }
53
54    public void stateChanged(Request rqHead,
55                             StateChangedRq rqBody,
56                             ResponseHolder rsHead,
57                             StringHolder JavaDoc rsBody) throws java.rmi.RemoteException JavaDoc {
58       URI rqReceiverKey = AsapBindingUtilitiesImpl.turnHeads(rqHead, rsHead);
59       URI rqSenderKey = rqHead.getSenderKey();
60       StateType rqPreviousState = rqBody.getPreviousState();
61       StateType rqState = rqBody.getState();
62       try {
63          String JavaDoc newState = AsapBindingUtilitiesImpl.parseState(rqState);
64          if (!SharkConstants.STATE_CLOSED_COMPLETED.equals(newState)) {
65             AsapBindingUtilitiesImpl.sendEventToActivity(rqReceiverKey,
66                                                          rqSenderKey.toString(),
67                                                          null,
68                                                          AsapBindingUtilitiesImpl.parseState(rqPreviousState),
69                                                          AsapBindingUtilitiesImpl.parseState(rqState));
70          }
71       } catch (Exception JavaDoc e) {
72          throw new RemoteException JavaDoc(e.getMessage(), e);
73       }
74       // System.err.println("AsapObserverBindingImpl.stateChanged:"
75
// + rqHead.getSenderKey() + " from " + rqPreviousState
76
// + " to " + rqState);
77
rsBody.value = "";
78    }
79 }
Popular Tags