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