Using sorted integer as method Id instead of hash values
[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 String[] methodSignatures = {
14
15                 "intprintInt()",
16                 "voidsetInt(int)"
17         };
18
19         /**
20          * Constructors
21          */
22         public CallBack_Stub(int _port, String _address, int _rev) throws IOException {
23
24                 rmiCall = new IoTRMICall(_port, _address, _rev, methodSignatures);
25         }
26
27
28         public int printInt() {
29
30                 String sign = "intprintInt()";
31                 Class<?> retType = int.class;
32                 Class<?>[] paramCls = new Class<?>[] { };
33                 Object[] paramObj = new Object[] { };
34                 Object retObj = rmiCall.remoteCall(sign, retType, null, null, paramCls, paramObj);
35                 return (int)retObj;
36         }
37
38
39         public void setInt(int _i) {
40
41                 String sign = "voidsetInt(int)";
42                 Class<?> retType = void.class;
43                 Class<?>[] paramCls = new Class<?>[] { int.class };
44                 Object[] paramObj = new Object[] { _i };
45                 rmiCall.remoteCall(sign, retType, null, null, paramCls, paramObj);
46         }
47
48
49         public static void main(String[] args) throws Exception {
50
51                 int port = 5010;
52                 String address = "localhost";
53                 int rev = 0;
54
55                 CallBack_Stub cbstub = new CallBack_Stub(port, address, rev);
56                 cbstub.setInt(23);
57                 cbstub.printInt();
58         }
59 }