Adding enum support for method argument; need to emulate the same functionality for...
[iot2.git] / iotjava / iotrmi / Java / sample / CallBack_CBSkeleton.java
index 2c8ece38343d1314655fbdf8efda7d666b099ce4..0e01eba2619aac8d3f2a37f9c9be46a90324fd6b 100644 (file)
@@ -34,8 +34,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,26 +47,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 {
+       public void invokeMethod(IoTRMIObject rmiObj) throws IOException {
 
-               String methodSign = rmiObj.getSignature();
-               Object[] paramObj = null;
-               Object retObj = null;
+               int methodId = rmiObj.getMethodId();
 
-               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;
+               switch (methodId) {
+                       case 0: ___printInt(rmiObj); break;
+                       case 1: ___setInt(rmiObj); break;
+                       default: 
+                               throw new Error("Method Id not recognized!");
+               }
        }