X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=iotjava%2Fiotrmi%2FJava%2Fsample%2FCallBack_CBSkeleton.java;h=7eaf1ff555e08bd68d105b916d5022725b9d28b4;hb=8e565033fd19c4696f67862ade27f0ebbacf5682;hp=2c8ece38343d1314655fbdf8efda7d666b099ce4;hpb=d43feb7e1c475292af92e8cd57dae2ff31d6a587;p=iot2.git diff --git a/iotjava/iotrmi/Java/sample/CallBack_CBSkeleton.java b/iotjava/iotrmi/Java/sample/CallBack_CBSkeleton.java index 2c8ece3..7eaf1ff 100644 --- a/iotjava/iotrmi/Java/sample/CallBack_CBSkeleton.java +++ b/iotjava/iotrmi/Java/sample/CallBack_CBSkeleton.java @@ -8,11 +8,6 @@ import iotrmi.Java.IoTRMIObject; public class CallBack_CBSkeleton implements CallBackInterface { private int objectId = 0; // Default value is 0 - private final static String[] methodSignatures = { - - "intprintInt()", - "voidsetInt(int)" - }; private CallBackInterface cb; @@ -34,8 +29,9 @@ public class CallBack_CBSkeleton implements CallBackInterface { } - public int ___printInt() { - return printInt(); + public void ___printInt(IoTRMIObject rmiObj) throws IOException { + Object retObj = printInt(); + rmiObj.sendReturnObj(retObj); } @@ -46,33 +42,21 @@ public class CallBack_CBSkeleton implements CallBackInterface { public void ___setInt(IoTRMIObject rmiObj) { Object[] paramObj = rmiObj.getMethodParams(new Class[] { int.class }, - new Class[] { null }, new Class[] { null }); + new Class[] { null }); setInt((int) paramObj[0]); } - public Object invokeMethod(IoTRMIObject rmiObj) throws IOException { - - String methodSign = rmiObj.getSignature(); - Object[] paramObj = null; - Object retObj = null; - - if (methodSign.equals("intprintInt()")) { - retObj = ___printInt(); - } else if (methodSign.equals("voidsetInt(int)")) { - ___setInt(rmiObj); - } else - throw new Error("Signature not recognized!"); - System.out.println("Return object: " + retObj); - - return retObj; - } - + public void invokeMethod(IoTRMIObject rmiObj) throws IOException { - // Return method signatures - public static String[] getMethodSignatures() { + int methodId = rmiObj.getMethodId(); - return methodSignatures; + switch (methodId) { + case 0: ___printInt(rmiObj); break; + case 1: ___setInt(rmiObj); break; + default: + throw new Error("Method Id not recognized!"); + } }