Preparing 3rd benchmark for porting with capability-based RMI
[iot2.git] / benchmarks / SpeakerController / GPSGatewayCallback_CallbackSkeleton.java
1 package SpeakerController;
2
3 import java.io.IOException;
4 import java.util.List;
5 import java.util.ArrayList;
6 import java.util.Arrays;
7 import iotrmi.Java.IoTRMICall;
8 import iotrmi.Java.IoTRMIObject;
9
10 import iotcode.interfaces.*;
11
12 public class GPSGatewayCallback_CallbackSkeleton implements GPSGatewayCallback {
13
14         private GPSGatewayCallback mainObj;
15         private int objectId = 0;
16         private String callbackAddress;
17         
18
19         public GPSGatewayCallback_CallbackSkeleton(GPSGatewayCallback _mainObj, String _callbackAddress, int _objectId) throws Exception {
20                 callbackAddress = _callbackAddress;
21                 mainObj = _mainObj;
22                 objectId = _objectId;
23         }
24
25         public void newRoomIDRetrieved(int _roomIdentifier) {
26                 mainObj.newRoomIDRetrieved(_roomIdentifier);
27         }
28
29         public void newRingStatusRetrieved(boolean _ringStatus) {
30                 mainObj.newRingStatusRetrieved(_ringStatus);
31         }
32
33         public void ___newRoomIDRetrieved(IoTRMIObject rmiObj) {
34                 Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { int.class }, 
35                 new Class<?>[] { null });
36                 newRoomIDRetrieved((int) paramObj[0]);
37         }
38
39         public void ___newRingStatusRetrieved(IoTRMIObject rmiObj) {
40                 Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { boolean.class }, 
41                 new Class<?>[] { null });
42                 newRingStatusRetrieved((boolean) paramObj[0]);
43         }
44
45         public void invokeMethod(IoTRMIObject rmiObj) throws IOException {
46                 int methodId = rmiObj.getMethodId();
47                 switch (methodId) {
48                         case 0: ___newRoomIDRetrieved(rmiObj); break;
49                         case 1: ___newRingStatusRetrieved(rmiObj); break;
50                         default: 
51                         throw new Error("Method Id " + methodId + " not recognized!");
52                 }
53         }
54
55 }