Doing the same set of transformations for C++
authorrtrimana <rtrimana@uci.edu>
Sat, 5 Nov 2016 21:11:09 +0000 (14:11 -0700)
committerrtrimana <rtrimana@uci.edu>
Sat, 5 Nov 2016 21:11:09 +0000 (14:11 -0700)
15 files changed:
iotjava/Makefile
iotjava/iotrmi/C++/IoTRMICall.hpp
iotjava/iotrmi/C++/IoTRMIObject.hpp
iotjava/iotrmi/C++/sample/CallBack_CBSkeleton.hpp
iotjava/iotrmi/C++/sample/CallBack_CBStub.hpp
iotjava/iotrmi/C++/sample/CallBack_Skeleton.hpp
iotjava/iotrmi/C++/sample/CallBack_Stub.hpp
iotjava/iotrmi/C++/sample/TestClass_Skeleton.hpp
iotjava/iotrmi/C++/sample/TestClass_Stub.hpp
iotjava/iotrmi/Java/IoTRMIObject.java
iotjava/iotrmi/Java/sample/CallBack_CBSkeleton.java
iotjava/iotrmi/Java/sample/CallBack_Skeleton.java
iotjava/iotrmi/Java/sample/TestClass_CBSkeleton.java [deleted file]
iotjava/iotrmi/Java/sample/TestClass_CBStub.java [deleted file]
iotjava/iotrmi/Java/sample/TestClass_Skeleton.java

index 7427642043416accc30f9117f72d777e545cf37b..267c006fcbf92dd85bf19ebcf3788306043cb50a 100644 (file)
@@ -31,23 +31,23 @@ runtime:
 PHONY += rmi
 rmi:
        mkdir -p $(BIN_DIR)
-       $(JAVAC) -cp .:../$(BIN_DIR) -d $(BIN_DIR) iotrmi/Java/*.java
-       $(JAVAC) -cp .:../$(BIN_DIR) -d $(BIN_DIR) iotrmi/Java/sample/*.java
+#      $(JAVAC) -cp .:../$(BIN_DIR) -d $(BIN_DIR) iotrmi/Java/*.java
+#      $(JAVAC) -cp .:../$(BIN_DIR) -d $(BIN_DIR) iotrmi/Java/sample/*.java
 #      mkdir -p $(BIN_DIR)/iotrmi/C++
        #$(G++) iotrmi/C++/IoTSocketServer.cpp -o $(BIN_DIR)/iotrmi/C++/IoTSocketServer.out
        #$(G++) iotrmi/C++/IoTSocketClient.cpp -o $(BIN_DIR)/iotrmi/C++/IoTSocketClient.out
 #      $(G++) iotrmi/C++/IoTRMICall.cpp -o $(BIN_DIR)/iotrmi/C++/IoTRMICall.out --std=c++11
 #      $(G++) iotrmi/C++/IoTRMIObject.cpp -o $(BIN_DIR)/iotrmi/C++/IoTRMIObject.out --std=c++11
-#      mkdir -p $(BIN_DIR)/iotrmi/C++/sample
+       mkdir -p $(BIN_DIR)/iotrmi/C++/sample
        #$(G++) iotrmi/C++/sample/CallBackInterface.hpp -o $(BIN_DIR)/iotrmi/C++/sample/CallBackInterface.out --std=c++11
        #$(G++) iotrmi/C++/sample/CallBack.hpp -o $(BIN_DIR)/iotrmi/C++/sample/CallBack.out --std=c++11
-       #$(G++) iotrmi/C++/sample/CallBack_CBStub.hpp -o $(BIN_DIR)/iotrmi/C++/sample/CallBack_CBStub.out --std=c++11
-       #$(G++) iotrmi/C++/sample/CallBack_CBSkeleton.hpp -o $(BIN_DIR)/iotrmi/C++/sample/CallBack_CBSkeleton.out --std=c++11
-#      $(G++) iotrmi/C++/sample/CallBack_Stub.cpp -o $(BIN_DIR)/iotrmi/C++/sample/CallBack_Stub.out --std=c++11
-#      $(G++) iotrmi/C++/sample/CallBack_Skeleton.cpp -o $(BIN_DIR)/iotrmi/C++/sample/CallBack_Skeleton.out --std=c++11
+       $(G++) iotrmi/C++/sample/CallBack_CBStub.hpp -o $(BIN_DIR)/iotrmi/C++/sample/CallBack_CBStub.out --std=c++11
+       $(G++) iotrmi/C++/sample/CallBack_CBSkeleton.hpp -o $(BIN_DIR)/iotrmi/C++/sample/CallBack_CBSkeleton.out --std=c++11
+       $(G++) iotrmi/C++/sample/CallBack_Stub.cpp -o $(BIN_DIR)/iotrmi/C++/sample/CallBack_Stub.out --std=c++11
+       $(G++) iotrmi/C++/sample/CallBack_Skeleton.cpp -o $(BIN_DIR)/iotrmi/C++/sample/CallBack_Skeleton.out --std=c++11
        #$(G++) iotrmi/C++/sample/TestClass.cpp -o $(BIN_DIR)/iotrmi/C++/sample/TestClass.out --std=c++11
-#      $(G++) iotrmi/C++/sample/TestClass_Stub.cpp -o $(BIN_DIR)/iotrmi/C++/sample/TestClass_Stub.out --std=c++11 -pthread
-#      $(G++) iotrmi/C++/sample/TestClass_Skeleton.cpp -o $(BIN_DIR)/iotrmi/C++/sample/TestClass_Skeleton.out --std=c++11 -pthread
+       $(G++) iotrmi/C++/sample/TestClass_Stub.cpp -o $(BIN_DIR)/iotrmi/C++/sample/TestClass_Stub.out --std=c++11 -pthread
+       $(G++) iotrmi/C++/sample/TestClass_Skeleton.cpp -o $(BIN_DIR)/iotrmi/C++/sample/TestClass_Skeleton.out --std=c++11 -pthread
        #$(G++) iotrmi/C++/sample/Test.cpp -o ../bin/iotrmi/C++/sample/Test.out --std=c++11 -lpthread
        #$(G++) iotrmi/C++/sample/Test2.cpp -o ../bin/iotrmi/C++/sample/Test2.out --std=c++11 -pthread -pg
 #      $(G++) iotrmi/C++/sample/StructC.cpp -o ../bin/iotrmi/C++/sample/StructC.out --std=c++11
index 36378094ba06577133f5d6d78cadfa8c0314760d..729b03614ab4da6cbc14c7a90e04d72193fc83ce 100644 (file)
@@ -25,14 +25,13 @@ mutex mtx;
 
 class IoTRMICall {
        public:
-               IoTRMICall(int _port, const char* _address, int _rev, bool* _bResult, 
-                                       const string _methodSign[], const int _size);
+               IoTRMICall(int _port, const char* _address, int _rev, bool* _bResult);
                ~IoTRMICall();
                // Public methods
                int             methodLength(string paramCls[], void* paramObj[], int numParam);
-               char*   methodToBytes(int objectId, string methodSign, string paramCls[], void* paramObj[],
+               char*   methodToBytes(int objectId, int methId, string paramCls[], void* paramObj[],
                                                                char* method, int numParam);
-               void*   remoteCall(int objectId, string methodSign, string retType, string paramCls[], 
+               void*   remoteCall(int objectId, int methodId, string retType, string paramCls[], 
                                                                void* paramObj[], int numParam, void* retObj);
 
        private:
@@ -46,9 +45,8 @@ class IoTRMICall {
 
 
 // Constructor
-IoTRMICall::IoTRMICall(int _port, const char* _address, int _rev, bool* _bResult, const string _methodSign[], const int _size) {
+IoTRMICall::IoTRMICall(int _port, const char* _address, int _rev, bool* _bResult) {
 
-       getMethodIds(_methodSign, _size);
        rmiUtil = new IoTRMIUtil();
        if (rmiUtil == NULL) {
                perror("IoTRMICall: IoTRMIUtil isn't initialized!");
@@ -80,7 +78,7 @@ IoTRMICall::~IoTRMICall() {
 
 
 // Calls a method remotely by passing in parameters and getting a return object
-void* IoTRMICall::remoteCall(int objectId, string methodSign, string retType, string paramCls[], 
+void* IoTRMICall::remoteCall(int objectId, int methodId, string retType, string paramCls[], 
                                                                void* paramObj[], int numParam, void* retObj) {
 
        // Critical section that is used by different objects
@@ -88,7 +86,7 @@ void* IoTRMICall::remoteCall(int objectId, string methodSign, string retType, st
        // Send input parameters
        int len = methodLength(paramCls, paramObj, numParam);
        char method[len];
-       methodToBytes(objectId, methodSign, paramCls, paramObj, method, numParam);
+       methodToBytes(objectId, methodId, paramCls, paramObj, method, numParam);
 //     IoTRMIUtil::printBytes(method, len, false);
        // Send bytes
        fflush(NULL);
@@ -133,7 +131,7 @@ int IoTRMICall::methodLength(string paramCls[], void* paramObj[], int numParam)
 
 
 // Convert method and its parameters into bytes
-char* IoTRMICall::methodToBytes(int objectId, string methodSign, string paramCls[], 
+char* IoTRMICall::methodToBytes(int objectId, int methId, string paramCls[], 
                void* paramObj[], char* method, int numParam) {
 
        // Get object Id in bytes
@@ -143,7 +141,6 @@ char* IoTRMICall::methodToBytes(int objectId, string methodSign, string paramCls
        int pos = IoTRMIUtil::OBJECT_ID_LEN;
        // Get method Id in bytes
        char methodId[IoTRMIUtil::METHOD_ID_LEN];
-       int methId = mapSign2MethodId.find(methodSign)->second;
        IoTRMIUtil::intToByteArray(methId, methodId);
        memcpy(method + pos, methodId, IoTRMIUtil::METHOD_ID_LEN);
        pos = pos + IoTRMIUtil::METHOD_ID_LEN;
@@ -169,19 +166,6 @@ char* IoTRMICall::methodToBytes(int objectId, string methodSign, string paramCls
        return method;
 }
 
-
-// *************
-//    Helpers
-// *************
-void IoTRMICall::getMethodIds(const string methodSign[], const int size) {
-
-       for(int i = 0; i < size; i++) {
-               mapSign2MethodId[methodSign[i]] = i;
-       }
-}
-
-
-
 #endif
 
 
index 830be11bdb2d8b087e9c6b008187363e1d2e18c5..6cffb4ee4d52665f7bb244733952bf8b69c014c4 100644 (file)
@@ -22,7 +22,7 @@ using namespace std;
 
 class IoTRMIObject {
        public:
-               IoTRMIObject(int _port, bool* _bResult, const string _methodSign[], const int _size);
+               IoTRMIObject(int _port, bool* _bResult);
                ~IoTRMIObject();
                // Public methods
                void            sendReturnObj(void* retObj, string type);
@@ -31,11 +31,11 @@ class IoTRMIObject {
                void            setMethodBytes(char* _methodBytes);
                int                     getObjectId();
                static int      getObjectId(char* methodBytes);
-               string          getSignature();
+               int                     getMethodId();
                void**          getMethodParams(string paramCls[], int numParam, void* paramObj[]);
 
        private:
-               map<int,string>         mapMethodId2Sign;
+               //map<int,string>               mapMethodId2Sign;
                IoTRMIUtil                      *rmiUtil;
                IoTSocketServer         *rmiServer;
                char*                           methodBytes;
@@ -47,7 +47,7 @@ class IoTRMIObject {
 
 
 // Constructor
-IoTRMIObject::IoTRMIObject(int _port, bool* _bResult, const string _methodSign[], const int _size) {
+IoTRMIObject::IoTRMIObject(int _port, bool* _bResult) {
 
        rmiUtil = new IoTRMIUtil();
        if (rmiUtil == NULL) {
@@ -56,7 +56,7 @@ IoTRMIObject::IoTRMIObject(int _port, bool* _bResult, const string _methodSign[]
 
        methodBytes = NULL;
        methodLen = 0;
-       getMethodIds(_methodSign, _size);
+       //getMethodIds(_methodSign, _size);
 
        rmiServer = new IoTSocketServer(_port, _bResult);
        if (rmiServer == NULL) {
@@ -147,15 +147,15 @@ int IoTRMIObject::getObjectId(char* methodBytes) {
 
 
 // Set method bytes
-void IoTRMIObject::setMethodBytes(char* _methodBytes) {
+/*void IoTRMIObject::setMethodBytes(char* _methodBytes) {
 
        // Set method bytes
        methodBytes = _methodBytes;
-}
+}*/
 
 
-// Get signature from the method-Id-to-method-signature map
-string IoTRMIObject::getSignature() {
+// Get methodId
+int IoTRMIObject::getMethodId() {
 
        // Get method Id
        char methodIdBytes[IoTRMIUtil::METHOD_ID_LEN];
@@ -164,7 +164,7 @@ string IoTRMIObject::getSignature() {
        int methodId = 0;
        IoTRMIUtil::byteArrayToInt(&methodId, methodIdBytes);
        
-       return mapMethodId2Sign.find(methodId)->second;
+       return methodId;
 }
 
 
@@ -202,17 +202,6 @@ void** IoTRMIObject::getMethodParams(string paramCls[], int numParam, void* para
 }
 
 
-// *************
-//    Helpers
-// *************
-void IoTRMIObject::getMethodIds(const string methodSign[], const int size) {
-
-       for(int i = 0; i < size; i++) {
-               mapMethodId2Sign[i] = methodSign[i];
-       }
-}
-
-
 #endif
 
 
index 510ed646e02ec063de5ed64ea3ed8cdbe3d6e434..ffd6c42e75d522711e81396f12835aa9a08a4dda 100644 (file)
@@ -41,7 +41,6 @@ CallBack_CBSkeleton::CallBack_CBSkeleton(CallBackInterface* _cb, int _objectId)
 
        cb = _cb;
        objectId = _objectId;
-       cout << "Creating CallBack_Skeleton and waiting!" << endl;
 }
 
 
@@ -87,15 +86,14 @@ void CallBack_CBSkeleton::___setInt(IoTRMIObject* rmiObj) {
 
 void CallBack_CBSkeleton::invokeMethod(IoTRMIObject* rmiObj) {
 
-       string methodSign = rmiObj->getSignature();
+       int methodId = rmiObj->getMethodId();
        
-       if (methodSign.compare("intprintInt()") == 0) {
-               ___printInt(rmiObj);
-       } else if (methodSign.compare("voidsetInt(int)") == 0) {
-               ___setInt(rmiObj);
-       } else {
-               string error = "Signature not recognized: " + string(methodSign);
-               throw error;
+       switch (methodId) {
+               case 0 : ___printInt(rmiObj); break;
+               case 1 : ___setInt(rmiObj); break;
+               default:
+                       string error = "Method Id not recognized!";
+                       throw error;
        }
 }
 
index 090b2c4bedb684e1829a2434194f70c42dc63c48..0ab69b50f87094b55544c4bccd7cf644b9a7e250 100644 (file)
@@ -60,14 +60,13 @@ int CallBack_CBStub::printInt() {
 
        cout << "Got here in printInt()" << endl;
        int numParam = 0;
-       string sign = "intprintInt()";
+       int methodId = 0;
        string retType = "int";
        string paramCls[] = { };
        void* paramObj[] = { };
        int retVal = 0;
        void* retObj = &retVal;
-       rmiCall->remoteCall(objectId, sign, retType, paramCls, paramObj, numParam, retObj);
-       cout << "Return value from printInt(): " << retVal << endl;
+       rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
        return retVal;
 }
 
@@ -75,12 +74,12 @@ int CallBack_CBStub::printInt() {
 void CallBack_CBStub::setInt(int _i) {
 
        int numParam = 1;
-       string sign = "voidsetInt(int)";
+       int methodId = 1;
        string retType = "void";
        string paramCls[] = { "int" };
        void* paramObj[] = { &_i };
        void* retObj = NULL;
-       rmiCall->remoteCall(objectId, sign, retType, paramCls, paramObj, numParam, retObj);
+       rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
 }
 
 #endif
index ff80e02b479e13dc8a41333897429e817f4356fd..9ab5c03bf0462aaa3848e886a3de41979fd48122 100644 (file)
@@ -40,7 +40,7 @@ CallBack_Skeleton::CallBack_Skeleton(CallBackInterface* _cb, int _port) {
 
        bool _bResult = false;
        cb = _cb;
-       rmiObj = new IoTRMIObject(_port, &_bResult, methodSignatures, size);
+       rmiObj = new IoTRMIObject(_port, &_bResult);
        ___waitRequestInvokeMethod();
 }
 
@@ -95,16 +95,14 @@ void CallBack_Skeleton::___waitRequestInvokeMethod() {
        while (true) {
 
                rmiObj->getMethodBytes();
-               string methodSign = rmiObj->getSignature();
-               cout << "Method sign: " << methodSign << endl;
+               int methodId = rmiObj->getMethodId();
                
-               if (methodSign.compare("intprintInt()") == 0) {
-                       ___printInt();
-               } else if (methodSign.compare("voidsetInt(int)") == 0) {
-                       ___setInt();
-               } else {
-                       string error = "Signature not recognized: " + string(methodSign);
-                       throw error;
+               switch (methodId) {
+                       case 0 : ___printInt(); break;
+                       case 1 : ___setInt(); break;
+                       default:
+                               string error = "Method Id not recognized!";
+                               throw error;
                }
        }
 }
index 42f105994df70b847d1eccd289244f11d035f0d2..9bdcef4f04a89bdb50e7ae20ec9ddc0641ba46fd 100644 (file)
@@ -45,7 +45,7 @@ CallBack_Stub::CallBack_Stub() {
 CallBack_Stub::CallBack_Stub(int _port, const char* _address, int _rev, bool* _bResult) {
 
        address = _address;
-       rmiCall = new IoTRMICall(_port, _address, _rev, _bResult, methodSignatures, size);
+       rmiCall = new IoTRMICall(_port, _address, _rev, _bResult);
 }
 
 
@@ -61,13 +61,13 @@ CallBack_Stub::~CallBack_Stub() {
 int CallBack_Stub::printInt() {
 
        int numParam = 0;
-       string sign = "intprintInt()";
+       int methodId = 0;
        string retType = "int";
        string paramCls[] = { };
        void* paramObj[] = { };
        int retVal = 0;
        void* retObj = &retVal;
-       rmiCall->remoteCall(objectId, sign, retType, paramCls, paramObj, numParam, retObj);
+       rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
        return retVal;
 }
 
@@ -75,12 +75,12 @@ int CallBack_Stub::printInt() {
 void CallBack_Stub::setInt(int _i) {
 
        int numParam = 1;
-       string sign = "voidsetInt(int)";
+       int methodId = 1;
        string retType = "void";
        string paramCls[] = { "int" };
        void* paramObj[] = { &_i };
        void* retObj = NULL;
-       rmiCall->remoteCall(objectId, sign, retType, paramCls, paramObj, numParam, retObj);
+       rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
 }
 
 #endif
index dd66cc668d97caf2f8b3ceb8c376e16921f93e02..f8bf9bf0a293a1ba82f77598317ffcaa14422e0b 100644 (file)
@@ -57,19 +57,19 @@ class TestClass_Skeleton : public TestClassInterface {
 
 
 const string TestClass_Skeleton::methodSignatures[TestClass_Skeleton::size] = {
-       "voidsetA(int)",
-       "voidsetB(float)",
-       "voidsetC(string)",
-       "sumArray(string[])",
+       "voidsetA(int)", // 0
+       "voidsetB(float)", // 1
+       "voidsetC(string)", // 2
+       "sumArray(string[])", // 3
        //"sumArray(int[])",
-       "intsetAndGetA(int)",
-       "intsetACAndGetA(string,int)",
-       "intcallBack()",
-       "voidregisterCallBack(CallBackInterface)",
-       "voidregisterCallBack(CallBackInterface[])",
-       "registercallback",
-       "handleStruct(StructJ[])",
-       "structsize"
+       "intsetAndGetA(int)", // 4
+       "intsetACAndGetA(string,int)", // 5
+       "intcallBack()", // 6
+       "voidregisterCallBack(CallBackInterface)", // 7
+       "voidregisterCallBack(CallBackInterface[])", // 8
+       "registercallback", // 9
+       "handleStruct(StructJ[])", // 10
+       "structsize" // 11
 };
 
 
@@ -80,7 +80,7 @@ TestClass_Skeleton::TestClass_Skeleton(TestClassInterface* _tc, int _port) {
 
        bool _bResult = false;
        tc = _tc;
-       rmiObj = new IoTRMIObject(_port, &_bResult, methodSignatures, size);
+       rmiObj = new IoTRMIObject(_port, &_bResult);
        ___waitRequestInvokeMethod();
 }
 
@@ -250,8 +250,7 @@ void TestClass_Skeleton::___regCB() {
        rmiObj->getMethodParams(paramCls, numParam, paramObj);
        // Instantiate IoTRMICall object
        bool bResult = false;
-       rmiCall = new IoTRMICall(param1, param2.c_str(), param3, &bResult, 
-               CallBack_CBStub::methodSignatures, CallBack_CBStub::size);
+       rmiCall = new IoTRMICall(param1, param2.c_str(), param3, &bResult);
 }
 
 
@@ -341,39 +340,26 @@ void TestClass_Skeleton::___waitRequestInvokeMethod() {
        while (true) {
 
                rmiObj->getMethodBytes();
-               string methodSign = rmiObj->getSignature();
-               cout << "Method sign: " << methodSign << endl;
+               int methodId = rmiObj->getMethodId();
                
-               if (methodSign.compare("voidsetA(int)") == 0) {
-                       ___setA();
-               } else if (methodSign.compare("voidsetB(float)") == 0) {
-                       ___setB();
-               } else if (methodSign.compare("voidsetC(string)") == 0) {
-                       ___setC();
-               } else if (methodSign.compare("sumArray(string[])") == 0) {
-                       ___sumArray();
-               /*} else if (methodSign.compare("sumArray(int[])") == 0) {
-                       ____sumArray();*/
-               } else if (methodSign.compare("intsetAndGetA(int)") == 0) {
-                       ___setAndGetA();
-               } else if (methodSign.compare("intsetACAndGetA(string,int)") == 0) {
-                       ___setACAndGetA();
-               } else if (methodSign.compare("voidregisterCallBack(CallBackInterface)") == 0) {
-                       //
-               } else if (methodSign.compare("voidregisterCallBack(CallBackInterface[])") == 0) {
-                       ____registerCallback();
-               } else if (methodSign.compare("registercallback") == 0) {
-                       ___regCB();
-               } else if (methodSign.compare("intcallBack()") == 0) {
-                       ___callBack();
-               // Handle struct
-               } else if (methodSign.compare("structsize") == 0) {
-                       structsize1 = ___structSize();
-               } else if (methodSign.compare("handleStruct(StructJ[])") == 0) {
-                       ___handleStruct(structsize1);
-               } else {
-                       string error = "Signature unrecognized: " + string(methodSign);
-                       throw error;
+               switch (methodId) {
+                       case 0: ___setA(); break;
+                       case 1: ___setB(); break;
+                       case 2: ___setC(); break;
+                       case 3: ___sumArray(); break;
+               /*  case 3: ____sumArray(); break;*/
+                       case 4: ___setAndGetA(); break;
+                       case 5: ___setACAndGetA(); break;
+                       case 6: ___callBack(); break; 
+                       case 7: ___registerCallback(); break;
+                       case 8: ____registerCallback(); break;
+                       case 9: ___regCB(); break;
+                       // Handle struct
+                       case 10: ___handleStruct(structsize1); break;
+                       case 11: structsize1 = ___structSize(); break;
+                       default:
+                               string error = "Method Id not recognized!";
+                               throw error;
                }
        }
 }
index db12b4876da0b435d115d40577a6298a13e1796d..1a623f165cc83c63ff9ea2d5cb8834dafac78723 100644 (file)
@@ -54,19 +54,19 @@ int TestClass_Stub::objIdCnt = 0;
 
 
 const string TestClass_Stub::methodSignatures[TestClass_Stub::size] = {
-       "voidsetA(int)",
-       "voidsetB(float)",
-       "voidsetC(string)",
-       "sumArray(string[])",
+       "voidsetA(int)", // 0
+       "voidsetB(float)", // 1
+       "voidsetC(string)", // 2
+       "sumArray(string[])", // 3
        //"sumArray(int[])",
-       "intsetAndGetA(int)",
-       "intsetACAndGetA(string,int)",
-       "intcallBack()",
-       "voidregisterCallBack(CallBackInterface)",
-       "voidregisterCallBack(CallBackInterface[])",
-       "registercallback",
-       "handleStruct(StructJ[])",
-       "structsize"
+       "intsetAndGetA(int)", // 4
+       "intsetACAndGetA(string,int)", // 5
+       "intcallBack()", // 6
+       "voidregisterCallBack(CallBackInterface)", // 7
+       "voidregisterCallBack(CallBackInterface[])", // 8
+       "registercallback", // 9
+       "handleStruct(StructJ[])", // 10
+       "structsize" // 11
 };
 
 
@@ -80,7 +80,7 @@ TestClass_Stub::TestClass_Stub() {
 TestClass_Stub::TestClass_Stub(int _port, const char* _address, int _rev, bool* _bResult, vector<int> _ports) {
 
        address = _address;
-       rmiCall = new IoTRMICall(_port, _address, _rev, _bResult, methodSignatures, size);
+       rmiCall = new IoTRMICall(_port, _address, _rev, _bResult);
        ports = _ports;
        // Start thread
        thread th1 (&TestClass_Stub::____init_CallBack, this);
@@ -111,7 +111,7 @@ TestClass_Stub::~TestClass_Stub() {
 void TestClass_Stub::____init_CallBack() {
 
        bool bResult = false;
-       rmiObj = new IoTRMIObject(ports[0], &bResult, CallBack_CBSkeleton::methodSignatures, CallBack_CBSkeleton::size);
+       rmiObj = new IoTRMIObject(ports[0], &bResult);
        while (true) {
                char* method = rmiObj->getMethodBytes();
                int objId = IoTRMIObject::getObjectId(method);
@@ -131,62 +131,62 @@ void TestClass_Stub::____init_CallBack() {
 void TestClass_Stub::____registerCallBack() {
 
        int numParam = 3;
-       string sign = "registercallback";
+       int methodId = 9;
        string retType = "void";
        string paramCls[] = { "int", "string", "int" };
        int rev = 0;
        void* paramObj[] = { &ports[0], &address, &rev };
        void* retObj = NULL;
-       rmiCall->remoteCall(objectId, sign, retType, paramCls, paramObj, numParam, retObj);
+       rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
 }
 
 
 void TestClass_Stub::setA(int _int) {
 
        int numParam = 1;
-       string sign = "voidsetA(int)";
+       int methodId = 0;
        string retType = "void";
        string paramCls[] = { "int" };
        void* paramObj[] = { &_int };
        void* retObj = NULL;
-       rmiCall->remoteCall(objectId, sign, retType, paramCls, paramObj, numParam, retObj);
+       rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
 }
 
 
 void TestClass_Stub::setB(float _float) {
 
        int numParam = 1;
-       string sign = "voidsetB(float)";
+       int methodId = 1;
        string retType = "void";
        string paramCls[] = { "float" };
        void* paramObj[] = { &_float };
        void* retObj = NULL;
-       rmiCall->remoteCall(objectId, sign, retType, paramCls, paramObj, numParam, retObj);
+       rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
 }
 
 
 void TestClass_Stub::setC(string _string) {
 
        int numParam = 1;
-       string sign = "voidsetC(string)";
+       int methodId = 2;
        string retType = "void";
        string paramCls[] = { "string" };
        void* paramObj[] = { &_string };
        void* retObj = NULL;
-       rmiCall->remoteCall(objectId, sign, retType, paramCls, paramObj, numParam, retObj);
+       rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
 }
 
 
 string TestClass_Stub::sumArray(vector<string> newA) {
 
        int numParam = 1;
-       string sign = "sumArray(string[])";
+       int methodId = 3;
        string retType = "string";
        string paramCls[] = { "string[]" };
        void* paramObj[] = { &newA };
        string retVal = "";
        void* retObj = &retVal;
-       rmiCall->remoteCall(objectId, sign, retType, paramCls, paramObj, numParam, retObj);
+       rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
        return retVal;
 }
 
@@ -209,13 +209,13 @@ string TestClass_Stub::sumArray(vector<string> newA) {
 int TestClass_Stub::setAndGetA(int newA) {
 
        int numParam = 1;
-       string sign = "intsetAndGetA(int)";
+       int methodId = 4;
        string retType = "int";
        string paramCls[] = { "int" };
        void* paramObj[] = { &newA };
        int retVal = 0;
        void* retObj = &retVal;
-       rmiCall->remoteCall(objectId, sign, retType, paramCls, paramObj, numParam, retObj);
+       rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
        return retVal;
 }
 
@@ -223,13 +223,13 @@ int TestClass_Stub::setAndGetA(int newA) {
 int TestClass_Stub::setACAndGetA(string newC, int newA) {
 
        int numParam = 2;
-       string sign = "intsetACAndGetA(string,int)";
+       int methodId = 5;
        string retType = "int";
        string paramCls[] = { "string", "int" };
        void* paramObj[] = { &newC, &newA };
        int retVal = 0;
        void* retObj = &retVal;
-       rmiCall->remoteCall(objectId, sign, retType, paramCls, paramObj, numParam, retObj);
+       rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
        return retVal;
 }
 
@@ -248,26 +248,26 @@ void TestClass_Stub::registerCallback(vector<CallBackInterface*> _cb) {
        }
 
        int numParam = 1;
-       string sign = "voidregisterCallBack(CallBackInterface[])";
+       int methodId = 8;
        string retType = "void";
        string paramCls[] = { "int" };
        int param1 = _cb.size();
        void* paramObj[] = { &param1 };
        void* retObj = NULL;
-       rmiCall->remoteCall(objectId, sign, retType, paramCls, paramObj, numParam, retObj);
+       rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
 }
 
 
 int TestClass_Stub::callBack() {
 
        int numParam = 0;
-       string sign = "intcallBack()";
+       int methodId = 6;
        string retType = "int";
        string paramCls[] = { };
        void* paramObj[] = { };
        int retVal = 0;
        void* retObj = &retVal;
-       rmiCall->remoteCall(objectId, sign, retType, paramCls, paramObj, numParam, retObj);
+       rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
        return retVal;
 }
 
@@ -275,16 +275,16 @@ int TestClass_Stub::callBack() {
 void TestClass_Stub::handleStruct(vector<data> vecData) {
 
        int numParam = 1;
-       string sign = "structsize";
+       int methodId = 11;
        string retType = "void";
        string paramCls[] = { "int" };
        int structsize = vecData.size();
        void* paramObj[] = { &structsize };
        void* retObj = NULL;
-       rmiCall->remoteCall(objectId, sign, retType, paramCls, paramObj, numParam, retObj);
+       rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
 
        int numParam2 = 3*vecData.size();
-       string sign2 = "handleStruct(StructJ[])";
+       int methodId2 = 10;
        string retType2 = "void";
        string paramCls2[numParam2];
        void* paramObj2[numParam2];
@@ -299,7 +299,7 @@ void TestClass_Stub::handleStruct(vector<data> vecData) {
        }
        void* retObj2 = NULL;
        cout << "In handle struct 3!" << endl;
-       rmiCall->remoteCall(objectId, sign2, retType2, paramCls2, paramObj2, numParam2, retObj2);
+       rmiCall->remoteCall(objectId, methodId2, retType2, paramCls2, paramObj2, numParam2, retObj2);
 }
 
 
index 317ed1f5804837c300a26643a33185b74ada7747..e801e44530bcf59de21bb1e8c147f20c474bcb5e 100644 (file)
@@ -91,11 +91,11 @@ public class IoTRMIObject {
        /**
         * setMethodBytes() sets bytes for method
         */
-       public void setMethodBytes(byte[] _methodBytes) throws IOException {
+       /*public void setMethodBytes(byte[] _methodBytes) throws IOException {
 
                // Set method bytes
                methodBytes = _methodBytes;
-       }
+       }*/
 
 
        /**
index 4149630600cbedd1f73bbddba9af58d65d3f9f54..cb6b9d8f390453fde903be2d396434d6503c3a0b 100644 (file)
@@ -60,7 +60,7 @@ public class CallBack_CBSkeleton implements CallBackInterface {
                        case 0: ___printInt(rmiObj); break;
                        case 1: ___setInt(rmiObj); break;
                        default: 
-                               throw new Error("Signature not recognized!");
+                               throw new Error("Method Id not recognized!");
                }
        }
 
index ed297c8c5b5d3e83a7861f082e72dda8650a5b58..3d540f194821e81ecc425c6202c45fb630cb7ad1 100644 (file)
@@ -65,7 +65,7 @@ public class CallBack_Skeleton implements CallBackInterface {
                                        case 0: ___printInt(); break;
                                        case 1: ___setInt(); break;
                                        default:
-                                               throw new Error("Signature not recognized!");
+                                               throw new Error("Method Id not recognized!");
                                }
                        }
                }
diff --git a/iotjava/iotrmi/Java/sample/TestClass_CBSkeleton.java b/iotjava/iotrmi/Java/sample/TestClass_CBSkeleton.java
deleted file mode 100644 (file)
index 3435959..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-package iotrmi.Java.sample;
-
-import java.io.IOException;
-import java.util.Set;
-import java.util.Arrays;
-import java.util.Map;
-import java.util.HashMap;
-
-import iotrmi.Java.IoTRMIObject;
-import iotrmi.Java.IoTRMICall;
-
-public class TestClass_CBSkeleton implements TestClassInterface {
-
-       /**
-        * Class Constants
-        */
-       private int objectId = 0;       // Default value is 0
-       private static int objIdCnt = 0; // Counter for callback object Ids
-       private final static String[] methodSignatures = {
-
-               "voidsetA(int)",
-               "voidsetB(float)",
-               "voidsetC(string)",
-               "sumArray(string[])",
-               "intsetAndGetA(int)",
-               "intsetACAndGetA(string,int)",
-               "intcallBack()",
-               "voidregisterCallBack(CallBackInterface)",
-               "voidregisterCallBack(CallBackInterface[])",
-               "registercallback",
-               "handleStruct(StructJ)"
-       };
-
-       private TestClassInterface tc;
-       private int port;
-       private CallBackInterface cbstub;
-       private IoTRMICall rmiCall;
-
-
-       /**
-        * Constructors
-        */
-       public TestClass_CBSkeleton(TestClass _tc, int _objectId) throws
-               ClassNotFoundException, InstantiationException,
-                       IllegalAccessException, IOException {
-
-               tc = _tc;
-               objectId = _objectId;
-               System.out.println("Creating object with object Id: " + objectId);
-       }
-
-
-       // Callback object multiplexing
-       public Object invokeMethod(IoTRMIObject rmiObj) throws IOException {
-
-               String methodSign = rmiObj.getSignature();
-               Object[] paramObj = null;
-               Object retObj = null;
-
-               if (methodSign.equals("voidsetA(int)")) {
-                       paramObj = rmiObj.getMethodParams(new Class<?>[] { int.class }, 
-                               new Class<?>[] { null }, new Class<?>[] { null });
-                       setA((int) paramObj[0]);
-               } else if (methodSign.equals("voidsetB(float)")) {
-                       paramObj = rmiObj.getMethodParams(new Class<?>[] { float.class }, 
-                               new Class<?>[] { null }, new Class<?>[] { null });
-                       setB((float) paramObj[0]);
-               } else if (methodSign.equals("voidsetC(string)")) {
-                       paramObj = rmiObj.getMethodParams(new Class<?>[] { String.class }, 
-                               new Class<?>[] { null }, new Class<?>[] { null });
-                       setC((String) paramObj[0]);
-               } else if (methodSign.equals("sumArray(string[])")) {
-                       paramObj = rmiObj.getMethodParams(new Class<?>[] { String[].class }, 
-                               new Class<?>[] { null }, new Class<?>[] { null });
-                       retObj = sumArray((String[]) paramObj[0]);
-               } else if (methodSign.equals("intsetAndGetA(int)")) {
-                       paramObj = rmiObj.getMethodParams(new Class<?>[] { int.class }, 
-                               new Class<?>[] { null }, new Class<?>[] { null });
-                       retObj = setAndGetA((int) paramObj[0]);
-               } else if (methodSign.equals("intsetACAndGetA(string,int)")) {
-                       paramObj = rmiObj.getMethodParams(new Class<?>[] { String.class, int.class }, 
-                               new Class<?>[] { null, null }, new Class<?>[] { null, null });
-                       retObj = setACAndGetA((String) paramObj[0], (int) paramObj[1]);
-               } else if (methodSign.equals("voidregisterCallBack(CallBackInterface)")) {
-                       paramObj = rmiObj.getMethodParams(new Class<?>[] { int.class, String.class, int.class }, 
-                               new Class<?>[] { null, null, null }, new Class<?>[] { null, null, null });
-                       CallBackInterface cbstub = new CallBack_Stub((int) paramObj[0], (String) paramObj[1], (int) paramObj[2]);
-                       registerCallback((CallBackInterface) cbstub);
-               } else if (methodSign.equals("voidregisterCallBack(CallBackInterface[])")) {
-                       paramObj = rmiObj.getMethodParams(new Class<?>[] { int.class }, 
-                               new Class<?>[] { null }, new Class<?>[] { null });
-                       int numStubs = (int) paramObj[0];
-                       CallBackInterface[] stub = new CallBackInterface[numStubs];
-                       for (int objId = 0; objId < numStubs; objId++) {
-                               stub[objId] = new CallBack_CBStub(rmiCall, objIdCnt);
-                               objIdCnt++;
-                       }
-                       registerCallback(stub);
-               } else if (methodSign.equals("intcallBack()")) {
-                       retObj = callBack();
-               // Special option to register callback
-               } else if (methodSign.equals("registercallback")) {
-                       paramObj = rmiObj.getMethodParams(new Class<?>[] { int.class, String.class, int.class }, 
-                               new Class<?>[] { null, null, null }, new Class<?>[] { null, null, null });
-                       String[] methodSignatures = CallBack_CBStub.getMethodSignatures();
-                       rmiCall = new IoTRMICall((int) paramObj[0], (String) paramObj[1], (int) paramObj[2], methodSignatures);
-                       System.out.println("Creating a new IoTRMICall object");
-               } else
-                       throw new Error("Signature not recognized!");
-
-               return retObj;
-       }
-
-
-       // Return method signatures
-       public static String[] getMethodSignatures() {
-
-               return methodSignatures;
-       }
-       
-       
-       public void setA(int _int) {
-               
-               tc.setA(_int);
-       }
-       
-       
-       public void setB(float _float) {
-               
-               tc.setB(_float);
-       }
-       
-       
-       public void setC(String _string) {
-               
-               tc.setC(_string);
-       }
-       
-       
-       public String sumArray(String[] newA) {
-               
-               return tc.sumArray(newA);
-       }
-       
-       
-       public int setAndGetA(int newA) {
-               
-               return tc.setAndGetA(newA);
-       }
-       
-       
-       public int setACAndGetA(String newC, int newA) {
-               
-               return tc.setACAndGetA(newC, newA);
-       }
-       
-       
-       public void registerCallback(CallBackInterface _cb) {
-               
-               tc.registerCallback(_cb);
-       }
-
-       public void registerCallback(CallBackInterface[] _cb) {
-               
-               tc.registerCallback(_cb);
-       }
-       
-       public int callBack() {
-               
-               return tc.callBack();
-       }
-
-       public void handleStruct(StructJ[] data) {
-
-               tc.handleStruct(data);
-       }
-
-
-       public static void main(String[] args) throws Exception {
-
-       }
-}
diff --git a/iotjava/iotrmi/Java/sample/TestClass_CBStub.java b/iotjava/iotrmi/Java/sample/TestClass_CBStub.java
deleted file mode 100644 (file)
index a3d80fd..0000000
+++ /dev/null
@@ -1,277 +0,0 @@
-package iotrmi.Java.sample;
-
-import java.io.IOException;
-import iotrmi.Java.IoTRMICall;
-import iotruntime.master.CommunicationHandler;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.ArrayList;
-
-import iotrmi.Java.IoTRMIObject;
-
-public class TestClass_CBStub implements TestClassInterface {
-
-       /**
-        * Class Properties
-        */
-       private IoTRMICall rmiCall;
-       private String address;
-       private int[] ports;
-       private List<CallBackInterface> listCBObj;
-       private IoTRMIObject rmiObj;
-
-       /**
-        * Class Constants
-        */
-       private final static int NUM_CB_OBJ = 1;
-       private int objectId = 0;       // Default value is 0
-       private static int objIdCnt = 0; // Counter for callback object Ids
-       private final static String[] methodSignatures = {
-
-               "voidsetA(int)",
-               "voidsetB(float)",
-               "voidsetC(string)",
-               "sumArray(string[])",
-               "intsetAndGetA(int)",
-               "intsetACAndGetA(string,int)",
-               "intcallBack()",
-               "voidregisterCallBack(CallBackInterface)",
-               "voidregisterCallBack(CallBackInterface[])",
-               "registercallback",
-               "handleStruct(StructJ)"
-       };
-
-       /**
-        * Constructors
-        */
-       // Assign rmiCall from outside
-       public TestClass_CBStub(IoTRMICall _rmiCall, int _objectId, String _address, int[] _ports) throws IOException {
-
-               address = _address;
-               ports = _ports;
-               objectId = _objectId;
-               rmiCall = _rmiCall;
-               listCBObj = new ArrayList<CallBackInterface>();
-               init_CallBack();
-       }
-
-
-       /**
-        * Instantiation of callback objects
-        */
-       public static int numCallbackObjects() {
-
-               return NUM_CB_OBJ;      // Generated by the IoTCompiler
-       }
-
-
-       // Return method signatures
-       public static String[] getMethodSignatures() {
-
-               return methodSignatures;
-       }
-
-
-       // Initialize callback
-       public void init_CallBack() {
-
-               Thread thread = new Thread() {
-                       public void run() {
-                       try{
-                                       String[] methodSignatures = CallBack_CBSkeleton.getMethodSignatures();
-                                       rmiObj = new IoTRMIObject(ports[0], methodSignatures);
-                                       Object retObj = null;
-                                       while (true) {
-                                               byte[] method = rmiObj.getMethodBytes();
-                                               int objId = IoTRMIObject.getObjectId(method);
-                                               //CallBack_CBSkeleton skel = (CallBack_CBSkeleton) listCBObj.get(objId);
-                                               CallBackInterface cb = listCBObj.get(objId);
-                                               CallBack_CBSkeleton skel = null;
-                                               if (cb instanceof CallBack_CBSkeleton) { // in case we have multiple callback classes
-                                                       skel = (CallBack_CBSkeleton) cb;
-                                               }
-                                               if (skel != null) {
-                                                       rmiObj.setMethodBytes(method);
-                                                       retObj = skel.invokeMethod(rmiObj);
-                                               }
-                                               if (retObj != null) {
-                                                       rmiObj.sendReturnObj(retObj);
-                                               }
-                                       }
-                               } catch (Exception ex){
-                                       ex.printStackTrace();
-                                       throw new Error("Error instantiating class CallBack_Skeleton!");
-                       }
-                   }
-               };
-               thread.start();
-
-               String sign = "registercallback";
-               Class<?> retType = void.class;
-               // port, address, rev, and number of objects
-               Class<?>[] paramCls = new Class<?>[] { int.class, String.class, int.class };
-               Object[] paramObj = new Object[] { ports[0], address, 0 };
-               rmiCall.remoteCall(objectId, sign, retType, null, null, paramCls, paramObj);
-       }
-
-
-       // Single callback handling
-       public void registerCallback(CallBackInterface _cb) {
-
-               Thread thread = new Thread() {
-                       public void run() {
-                   try{
-                                       CallBack_Skeleton cbskel = new CallBack_Skeleton(_cb, ports[0]);
-                                       cbskel.waitRequestInvokeMethod();
-                               } catch (Exception ex){
-                                       ex.printStackTrace();
-                                       throw new Error("Error instantiating class CallBack_Skeleton!");
-                   }
-               }
-           };
-               thread.start();
-
-               String sign = "voidregisterCallBack(CallBackInterface)";
-               Class<?> retType = void.class;
-               // port, address, and rev
-               Class<?>[] paramCls = new Class<?>[] { int.class, String.class, int.class };
-               Object[] paramObj = new Object[] { ports[0], address, 0 };
-               rmiCall.remoteCall(objectId, sign, retType, null, null, paramCls, paramObj);
-       }
-
-
-       public void registerCallback(CallBackInterface[] _cb) {
-
-               try {
-                       //for (int objId = 0; objId < _cb.length; objId++) {
-                       for (CallBackInterface cb : _cb) {
-                               CallBack_CBSkeleton skel = new CallBack_CBSkeleton(cb, objIdCnt++);
-                               listCBObj.add(skel);
-                       }
-               } catch (Exception ex){
-                       ex.printStackTrace();
-                       throw new Error("Class not found / instantiation / illegal access / IO error!");
-               }
-
-               String sign = "voidregisterCallBack(CallBackInterface[])";
-               Class<?> retType = void.class;
-               // port, address, rev, and number of objects
-               Class<?>[] paramCls = new Class<?>[] { int.class };
-               Object[] paramObj = new Object[] { _cb.length };
-               rmiCall.remoteCall(objectId, sign, retType, null, null, paramCls, paramObj);
-       }
-
-
-       public void setA(int _int) {
-
-               String sign = "voidsetA(int)";
-               Class<?> retType = void.class;
-               Class<?>[] paramCls = new Class<?>[] { int.class };
-               Object[] paramObj = new Object[] { _int };
-               rmiCall.remoteCall(objectId, sign, retType, null, null, paramCls, paramObj);
-       }
-
-
-       public void setB(float _float) {
-
-               String sign = "voidsetB(float)";
-               Class<?> retType = void.class;
-               Class<?>[] paramCls = new Class<?>[] { float.class };
-               Object[] paramObj = new Object[] { _float };
-               rmiCall.remoteCall(objectId, sign, retType, null, null, paramCls, paramObj);
-       }
-
-
-       public void setC(String _string) {
-
-               String sign = "voidsetC(string)";
-               Class<?> retType = void.class;
-               Class<?>[] paramCls = new Class<?>[] { String.class };
-               Object[] paramObj = new Object[] { _string };
-               rmiCall.remoteCall(objectId, sign, retType, null, null, paramCls, paramObj);
-       }
-
-
-       // Getters
-       public String sumArray(String[] newA) {
-
-               String sign = "sumArray(string[])";
-               Class<?> retType = String.class;
-               Class<?>[] paramCls = new Class<?>[] { String[].class };
-               Object[] paramObj = new Object[] { newA };
-               Object retObj = rmiCall.remoteCall(objectId, sign, retType, null, null, paramCls, paramObj);
-               return (String)retObj;
-       }
-
-
-       public int setAndGetA(int newA) {
-               String sign = "intsetAndGetA(int)";
-               Class<?> retType = int.class;
-               Class<?>[] paramCls = new Class<?>[] { int.class };
-               Object[] paramObj = new Object[] { newA };
-               Object retObj = rmiCall.remoteCall(objectId, sign, retType, null, null, paramCls, paramObj);
-               return (int)retObj;
-       }
-
-
-       public int setACAndGetA(String newC, int newA) {
-
-               String sign = "intsetACAndGetA(string,int)";
-               Class<?> retType = int.class;
-               Class<?>[] paramCls = new Class<?>[] { String.class, int.class };
-               Object[] paramObj = new Object[] { newC, newA };
-               Object retObj = rmiCall.remoteCall(objectId, sign, retType, null, null, paramCls, paramObj);
-               return (int)retObj;
-       }
-
-
-       public int callBack() {
-
-               String sign = "intcallBack()";
-               Class<?> retType = int.class;
-               Class<?>[] paramCls = new Class<?>[] { };
-               Object[] paramObj = new Object[] { };
-               Object retObj = rmiCall.remoteCall(objectId, sign, retType, null, null, paramCls, paramObj);
-               return (int)retObj;
-
-       }
-
-       public void handleStruct(StructJ[] data) {
-
-       }
-
-
-       public static void main(String[] args) throws Exception {
-
-               CommunicationHandler comHan = new CommunicationHandler(true);
-               int numOfPorts = TestClass_Stub.numCallbackObjects();
-               int[] ports = comHan.getCallbackPorts(numOfPorts);
-
-               int port = 5010;
-               String address = "localhost";
-               int rev = 0;
-
-               System.out.println("Allocated ports: " + Arrays.toString(ports));
-
-               TestClass_Stub tcstub = new TestClass_Stub(port, address, rev, ports);
-               System.out.println("Return value: " + tcstub.setAndGetA(123));
-               System.out.println("Return value: " + tcstub.setACAndGetA("string", 123));
-               System.out.println("Return value: " + tcstub.sumArray(new String[] { "123", "456", "987" }));
-
-               CallBackInterface cb1 = new CallBack(23);
-               CallBackInterface cb2 = new CallBack(33);
-               CallBackInterface cb3 = new CallBack(43);
-               CallBackInterface[] cb = { cb1, cb2, cb3 };
-               tcstub.registerCallback(cb);
-               System.out.println("Return value from callback: " + tcstub.callBack());
-               CallBackInterface cb4 = new CallBack(10);
-               CallBackInterface cb5 = new CallBack(11);
-               CallBackInterface cb6 = new CallBack(12);
-               CallBackInterface[] cbt = { cb4, cb5, cb6 };
-               tcstub.registerCallback(cbt);
-               System.out.println("Return value from callback: " + tcstub.callBack());
-       }
-}
-
-
index aec1d56381e782b233da908b2e06da432e437771..ce2b1b78691b9874d5cf108908cd079d30911339 100644 (file)
@@ -259,7 +259,7 @@ public class TestClass_Skeleton implements TestClassInterface {
                                        case 10: ___handleStruct(structsize1); break;
                                        case 11: structsize1 = ___structSize(); break;
                                        default:
-                                               throw new Error("Signature not recognized!");
+                                               throw new Error("Method Id not recognized!");
                                }
                        }
                }