Cleaning methodSignatures
[iot2.git] / iotjava / iotrmi / Java / sample / CallBack_Stub.java
1 package iotrmi.Java.sample;
2
3 import java.io.IOException;
4 import iotrmi.Java.IoTRMICall;
5
6 public class CallBack_Stub implements CallBackInterface {
7
8         /**
9          * Class Properties
10          */
11         private IoTRMICall rmiCall;
12
13         private int objectId = 0;       // Default value is 0
14
15         /**
16          * Constructors
17          */
18         public CallBack_Stub(int _port, String _address, int _rev) throws IOException {
19
20                 rmiCall = new IoTRMICall(_port, _address, _rev);
21         }
22
23
24         public int printInt() {
25
26                 int methodId = 0;
27                 Class<?> retType = int.class;
28                 Class<?>[] paramCls = new Class<?>[] { };
29                 Object[] paramObj = new Object[] { };
30                 Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, null, paramCls, paramObj);
31                 return (int)retObj;
32         }
33
34
35         public void setInt(int _i) {
36
37                 int methodId = 1;
38                 Class<?> retType = void.class;
39                 Class<?>[] paramCls = new Class<?>[] { int.class };
40                 Object[] paramObj = new Object[] { _i };
41                 rmiCall.remoteCall(objectId, methodId, retType, null, null, paramCls, paramObj);
42         }
43
44
45         public static void main(String[] args) throws Exception {
46
47                 int port = 5010;
48                 String address = "localhost";
49                 int rev = 0;
50
51                 CallBack_Stub cbstub = new CallBack_Stub(port, address, rev);
52                 cbstub.setInt(23);
53                 cbstub.printInt();
54         }
55 }