1 package iotrmi.Java.sample;
3 import java.io.IOException;
5 import java.util.Arrays;
6 import iotrmi.Java.IoTRMIObject;
8 public class CallBack_CBSkeleton implements CallBackInterface {
10 private int objectId = 0; // Default value is 0
11 private final static String[] methodSignatures = {
16 private CallBackInterface cb;
22 public CallBack_CBSkeleton(CallBackInterface _cb, int _objectId) throws
23 ClassNotFoundException, InstantiationException,
24 IllegalAccessException, IOException {
28 System.out.println("Creating CallBack_Skeleton and waiting!");
32 public Object invokeMethod(IoTRMIObject rmiObj) throws IOException {
34 String methodSign = rmiObj.getSignature();
35 Object[] paramObj = null;
38 if (methodSign.equals("intprintInt()")) {
40 } else if (methodSign.equals("voidsetInt(int)")) {
41 paramObj = rmiObj.getMethodParams(new Class<?>[] { int.class },
42 new Class<?>[] { null }, new Class<?>[] { null });
43 setInt((int) paramObj[0]);
45 throw new Error("Signature not recognized!");
46 System.out.println("Return object: " + retObj);
52 // Return method signatures
53 public static String[] getMethodSignatures() {
55 return methodSignatures;
59 public int printInt() {
64 public void setInt(int _i) {
69 public static void main(String[] args) throws Exception {
72 CallBack cb = new CallBack(23);
73 CallBack_Skeleton cbSkel = new CallBack_Skeleton(cb, port);
74 cbSkel.waitRequestInvokeMethod();