Adding flags to master to give flexibility to choose between C++ and Java for every...
authorrtrimana <rtrimana@uci.edu>
Tue, 14 Feb 2017 00:00:57 +0000 (16:00 -0800)
committerrtrimana <rtrimana@uci.edu>
Tue, 14 Feb 2017 00:00:57 +0000 (16:00 -0800)
20 files changed:
benchmarks/Cpp/Lifxtest/Lifxtest.config
benchmarks/Java/Lifxtest/Lifxtest.config
benchmarks/drivers/Cpp/LabRoom/LabRoom.config
benchmarks/drivers/Cpp/LifxLightBulb/LifxLightBulb.config
benchmarks/drivers/Java/AmcrestCamera/AmcrestCamera.config
benchmarks/drivers/Java/AudioRoom/AudioRoom.config
benchmarks/drivers/Java/EspAlarm/EspAlarm.config
benchmarks/drivers/Java/EspSprinkler/EspSprinkler.config
benchmarks/drivers/Java/GPSPhoneGateway/GPSPhoneGateway.config
benchmarks/drivers/Java/GreenLawn/GreenLawn.config
benchmarks/drivers/Java/HomeRoom/HomeRoom.config
benchmarks/drivers/Java/IHome/IHome.config
benchmarks/drivers/Java/LabRoom/LabRoom.config
benchmarks/drivers/Java/LifxLightBulb/LifxLightBulb.config
benchmarks/drivers/Java/MotionSensor/MotionSensor.config
benchmarks/drivers/Java/MultipurposeSensor/MultipurposeSensor.config
benchmarks/drivers/Java/SpruceSensor/SpruceSensor.config
benchmarks/drivers/Java/WaterLeakSensor/WaterLeakSensor.config
benchmarks/drivers/Java/WeatherPhoneGateway/WeatherPhoneGateway.config
iotjava/iotruntime/master/IoTMaster.java

index a5c5a5c..718f292 100644 (file)
@@ -18,3 +18,6 @@ FIELD_2=roomLightRelation
 FIELD_CLASS_2=RoomSmart
 FIELD_CLASS_REL_2=LightBulbTest
 FIELD_TYPE_2=IoTRelation
+
+# Language
+LANGUAGE=Java
index 39b3a38..c7823d5 100644 (file)
@@ -5,3 +5,6 @@ FIELD_NUMBER=1
 FIELD_0=lifx_light_bulb
 FIELD_CLASS_0=LightBulbTest
 FIELD_TYPE_0=IoTSet
+
+# Language
+LANGUAGE=Java
index 6d899b8..89aad71 100644 (file)
@@ -6,3 +6,8 @@ INTERFACE_STUB_CLASS=RoomSmart
 # For C++ instrumentation
 FIELD_NUMBER=0
 
+# Language
+#LANGUAGE=C++
+# Language (fine-grained flags)
+LANGUAGE_LabRoomRM1=C++
+LANGUAGE_LabRoomRM2=C++
index aed4665..878d6c4 100644 (file)
@@ -9,3 +9,9 @@ FIELD_NUMBER=1
 FIELD_0=lb_addresses
 FIELD_CLASS_0=IoTDeviceAddress
 FIELD_TYPE_0=IoTSet
+
+# Language
+#LANGUAGE=C++
+# Language (fine-grained flags)
+LANGUAGE_LifxLightBulbLB1=C++
+LANGUAGE_LifxLightBulbLB2=C++
index f10cb63..30be632 100644 (file)
@@ -2,3 +2,6 @@
 INTERFACE_CLASS=Room
 # Stub
 INTERFACE_STUB_CLASS=RoomSmart
+
+# Language
+LANGUAGE=Java
index 0912d87..a4f10a8 100644 (file)
@@ -2,3 +2,6 @@
 INTERFACE_CLASS=Alarm
 # Stub
 INTERFACE_STUB_CLASS=AlarmSmart
+
+# Language
+LANGUAGE=Java
index 77c2cf6..1f025f1 100644 (file)
@@ -2,3 +2,6 @@
 INTERFACE_CLASS=Lawn
 # Stub
 INTERFACE_STUB_CLASS=LawnSmart
+
+# Language
+LANGUAGE=Java
index f10cb63..30be632 100644 (file)
@@ -2,3 +2,6 @@
 INTERFACE_CLASS=Room
 # Stub
 INTERFACE_STUB_CLASS=RoomSmart
+
+# Language
+LANGUAGE=Java
index a1384ce..5d7772c 100644 (file)
@@ -2,3 +2,6 @@
 INTERFACE_CLASS=Speaker
 # Stub
 INTERFACE_STUB_CLASS=SpeakerSmart
+
+# Language
+LANGUAGE=Java
index f10cb63..30be632 100644 (file)
@@ -2,3 +2,6 @@
 INTERFACE_CLASS=Room
 # Stub
 INTERFACE_STUB_CLASS=RoomSmart
+
+# Language
+LANGUAGE=Java
index aed4665..e178dd8 100644 (file)
@@ -4,8 +4,8 @@ INTERFACE_CLASS=LightBulb
 #INTERFACE_STUB_CLASS=LightBulbTest
 INTERFACE_STUB_CLASS=LightBulbSmart
 
-# For C++ instrumentation
-FIELD_NUMBER=1
-FIELD_0=lb_addresses
-FIELD_CLASS_0=IoTDeviceAddress
-FIELD_TYPE_0=IoTSet
+# Language
+LANGUAGE=Java
+# Language (fine-grained flags)
+#LANGUAGE_LifxLightBulbLB1=Java
+#LANGUAGE_LifxLightBulbLB2=Java
index 61eb381..73b43f1 100644 (file)
@@ -2,3 +2,6 @@
 INTERFACE_CLASS=SmartthingsSensor
 # Stub
 INTERFACE_STUB_CLASS=SmartthingsSensorSmart
+
+# Language
+LANGUAGE=Java
index 0ba4568..a9bb3cb 100644 (file)
@@ -2,3 +2,6 @@
 INTERFACE_CLASS=MoistureSensor
 # Stub
 INTERFACE_STUB_CLASS=MoistureSensorSmart
+
+# Language
+LANGUAGE=Java
index 7578f3b..e85f8d2 100644 (file)
@@ -99,7 +99,7 @@ public class IoTMaster {
        private static String STR_NUM_CALLBACK_PORTS;
        private static String STR_JVM_INIT_HEAP_SIZE;
        private static String STR_JVM_MAX_HEAP_SIZE;
-       private static String STR_LANGUAGE;
+       private static String STR_LANGUAGE_CONTROLLER;
        private static String STR_SKEL_CLASS_SUFFIX;
        private static String STR_STUB_CLASS_SUFFIX;
        private static boolean BOOL_VERBOSE;
@@ -123,6 +123,7 @@ public class IoTMaster {
        private static final String STR_INTERFACE_CLS_CFG = "INTERFACE_CLASS";
        private static final String STR_INT_STUB_CLS_CFG = "INTERFACE_STUB_CLASS";
        private static final String STR_FILE_TRF_CFG = "ADDITIONAL_ZIP_FILE";
+       private static final String STR_LANGUAGE = "LANGUAGE";
        private static final String STR_YES = "Yes";
        private static final String STR_NO = "No";
        private static final String STR_JAVA = "Java";
@@ -190,7 +191,7 @@ public class IoTMaster {
                STR_NUM_CALLBACK_PORTS = null;
                STR_JVM_INIT_HEAP_SIZE = null;
                STR_JVM_MAX_HEAP_SIZE = null;
-               STR_LANGUAGE = null;
+               STR_LANGUAGE_CONTROLLER = null;
                BOOL_VERBOSE = false;
        }
 
@@ -249,7 +250,7 @@ public class IoTMaster {
                STR_NUM_CALLBACK_PORTS = prop.getProperty("NUMBER_CALLBACK_PORTS");
                STR_JVM_INIT_HEAP_SIZE = prop.getProperty("JVM_INIT_HEAP_SIZE");
                STR_JVM_MAX_HEAP_SIZE = prop.getProperty("JVM_MAX_HEAP_SIZE");
-               STR_LANGUAGE = prop.getProperty("LANGUAGE");
+               //STR_LANGUAGE = prop.getProperty("LANGUAGE");
                STR_SKEL_CLASS_SUFFIX = prop.getProperty("SKEL_CLASS_SUFFIX");
                STR_STUB_CLASS_SUFFIX = prop.getProperty("STUB_CLASS_SUFFIX");
                if(prop.getProperty("VERBOSE").equals(STR_YES)) {
@@ -275,7 +276,7 @@ public class IoTMaster {
                RuntimeOutput.print("STR_NUM_CALLBACK_PORTS=" + STR_NUM_CALLBACK_PORTS, BOOL_VERBOSE);
                RuntimeOutput.print("STR_JVM_INIT_HEAP_SIZE=" + STR_JVM_INIT_HEAP_SIZE, BOOL_VERBOSE);
                RuntimeOutput.print("STR_JVM_MAX_HEAP_SIZE=" + STR_JVM_MAX_HEAP_SIZE, BOOL_VERBOSE);
-               RuntimeOutput.print("STR_LANGUAGE=" + STR_LANGUAGE, BOOL_VERBOSE);
+               //RuntimeOutput.print("STR_LANGUAGE=" + STR_LANGUAGE, BOOL_VERBOSE);
                RuntimeOutput.print("STR_SKEL_CLASS_SUFFIX=" + STR_SKEL_CLASS_SUFFIX, BOOL_VERBOSE);
                RuntimeOutput.print("STR_STUB_CLASS_SUFFIX=" + STR_STUB_CLASS_SUFFIX, BOOL_VERBOSE);
                RuntimeOutput.print("BOOL_VERBOSE=" + BOOL_VERBOSE, BOOL_VERBOSE);
@@ -383,13 +384,13 @@ public class IoTMaster {
         * @return  void
         */
        private void instrumentIoTSetDevice(String strFieldIdentifier, String strObjName, String strFieldName, String strIoTSlaveObjectHostAdd,
-               InputStream inStream, OutputStream outStream)  
+               InputStream inStream, OutputStream outStream, String strLanguage)  
                        throws IOException, ClassNotFoundException, InterruptedException {
 
                // Get information from the set
                List<Object[]> listObject = objAddInitHand.getFields(strFieldIdentifier);
                // Create a new IoTSet
-               if(STR_LANGUAGE.equals(STR_JAVA)) {
+               if(strLanguage.equals(STR_JAVA)) {
                        Message msgCrtIoTSet = new MessageCreateSetRelation(IoTCommCode.CREATE_NEW_IOTSET, strFieldName);
                        commMasterToSlave(msgCrtIoTSet, "Create new IoTSet for IoTDeviceAddress!", inStream, outStream);
                } else
@@ -429,7 +430,7 @@ public class IoTMaster {
                        System.out.println("DEBUG: InstrumentSetDevice: Device address: " + strDeviceAddressKey + "\n\n");
 
                        // Send address one by one
-                       if(STR_LANGUAGE.equals(STR_JAVA)) {
+                       if(strLanguage.equals(STR_JAVA)) {
                                Message msgGetIoTSetObj = null;
                                if (bDstPortWildCard) {
                                        String strUniqueDev = strDeviceAddressKey + ":" + iRow;
@@ -444,7 +445,7 @@ public class IoTMaster {
                                        bSrcPortWildCard, bDstPortWildCard);
                }
                // Reinitialize IoTSet on device object
-               if(STR_LANGUAGE.equals(STR_JAVA))
+               if(strLanguage.equals(STR_JAVA))
                        commMasterToSlave(new MessageSimple(IoTCommCode.REINITIALIZE_IOTSET_FIELD), "Reinitialize IoTSet fields!", inStream, outStream);
                else
                        reinitializeIoTSetFieldCpp(outStream, inStream);
@@ -462,13 +463,13 @@ public class IoTMaster {
         * @return  void
         */
        private void instrumentIoTSetZBDevice(Map.Entry<String,Object> map, String strObjName, String strFieldName, String strIoTSlaveObjectHostAdd,
-               InputStream inStream, OutputStream outStream)  
+               InputStream inStream, OutputStream outStream, String strLanguage)  
                        throws IOException, ClassNotFoundException, InterruptedException {
 
                // Get information from the set
                SetInstrumenter setInstrumenter = (SetInstrumenter) map.getValue();
                // Create a new IoTSet
-               if(STR_LANGUAGE.equals(STR_JAVA)) {
+               if(strLanguage.equals(STR_JAVA)) {
                        Message msgCrtIoTSet = new MessageCreateSetRelation(IoTCommCode.CREATE_NEW_IOTSET, strFieldName);
                        commMasterToSlave(msgCrtIoTSet, "Create new IoTSet for IoTZigbeeAddress!", inStream, outStream);
                } else  // TODO: will need to implement IoTSet Zigbee for C++ later
@@ -501,7 +502,7 @@ public class IoTMaster {
                        // Send policy to Zigbee gateway - TODO: Need to clear policy first?
                        zbConfig.setPolicy(strIoTSlaveObjectHostAdd, commHan.getComPort(strZigbeeGWAddressKey), strZBDevAddress);
                        // Send address one by one
-                       if(STR_LANGUAGE.equals(STR_JAVA)) {
+                       if(strLanguage.equals(STR_JAVA)) {
                                Message msgGetIoTSetZBObj = new MessageGetSimpleDeviceObject(IoTCommCode.GET_ZB_DEV_IOTSET_OBJECT, strZBDevAddress);
                                commMasterToSlave(msgGetIoTSetZBObj, "Get IoTSet objects!", inStream, outStream);
                        } else  // TODO: Implement IoTSet Zigbee for C++
@@ -523,13 +524,13 @@ public class IoTMaster {
         * @return  void
         */
        private void instrumentIoTSetAddress(String strFieldIdentifier, String strFieldName,
-               InputStream inStream, OutputStream outStream)  
+               InputStream inStream, OutputStream outStream, String strLanguage)  
                        throws IOException, ClassNotFoundException, InterruptedException {
 
                // Get information from the set
                List<Object[]> listObject = objAddInitHand.getFields(strFieldIdentifier);
                // Create a new IoTSet
-               if(STR_LANGUAGE.equals(STR_JAVA)) {
+               if(strLanguage.equals(STR_JAVA)) {
                        Message msgCrtIoTSet = new MessageCreateSetRelation(IoTCommCode.CREATE_NEW_IOTSET, strFieldName);
                        commMasterToSlave(msgCrtIoTSet, "Create new IoTSet for IoTAddress!", inStream, outStream);
                } else
@@ -542,7 +543,7 @@ public class IoTMaster {
                        // Get device address
                        String strAddress = (String) arrFieldValues[0];
                        // Send address one by one
-                       if(STR_LANGUAGE.equals(STR_JAVA)) {
+                       if(strLanguage.equals(STR_JAVA)) {
                                Message msgGetIoTSetAddObj = new MessageGetSimpleDeviceObject(IoTCommCode.GET_ADD_IOTSET_OBJECT, strAddress);
                                commMasterToSlave(msgGetIoTSetAddObj, "Get IoTSet objects!", inStream, outStream);
                        } else  // TODO: Implement IoTSet Address for C++
@@ -936,10 +937,16 @@ public class IoTMaster {
                String strIoTSlaveObjectHostAdd, String strFieldObjectID, Object[] arrFieldValues, Class[] arrFieldClasses) 
                throws IOException, FileNotFoundException, ClassNotFoundException, InterruptedException {
 
+               // Read config file
+               String sCfgFile = STR_IOT_CODE_PATH + strObjClassName + "/" + strObjClassName + STR_CFG_FILE_EXT;
+               String strLanguageDriver = parseConfigFile(sCfgFile, STR_LANGUAGE + "_" + strObjName);
+               if(strLanguageDriver == null)   // Read just the field LANGUAGE if the first read is null
+                       strLanguageDriver = parseConfigFile(sCfgFile, STR_LANGUAGE);
+               if(strLanguageDriver == null) // Check nullness for the second time - report if it is still null
+                       throw new Error("IoTMaster: Language specification missing in config file: " + sCfgFile);
                // PROFILING
                long start = 0;
                long result = 0;
-
                // PROFILING
                start = System.currentTimeMillis();
 
@@ -950,10 +957,13 @@ public class IoTMaster {
                //           iotruntime.IoTSlave dw-1.eecs.uci.edu 46151 23829 42874 &
                // The In-Port for IoTMaster is the Out-Port for IoTSlave and vice versa
                String strSSHCommand = null;
-               if(STR_LANGUAGE.equals(STR_JAVA))
+               if(strLanguageDriver.equals(STR_JAVA))
                        strSSHCommand = getCmdJavaDriverIoTSlave(strIoTMasterHostAdd, strIoTSlaveObjectHostAdd, strObjName);
-               else
+               else if(strLanguageDriver.equals(STR_CPP))
                        strSSHCommand = getCmdCppDriverIoTSlave(strIoTMasterHostAdd, strIoTSlaveObjectHostAdd, strObjName);
+               else
+                       throw new Error("IoTMaster: Language specification not recognized: " + strLanguageDriver);
+               RuntimeOutput.print("IoTMaster: Language for " + strObjName + " is " + strLanguageDriver, BOOL_VERBOSE);
 
                RuntimeOutput.print(strSSHCommand, BOOL_VERBOSE);
                // Start a new thread to start a new JVM
@@ -964,7 +974,7 @@ public class IoTMaster {
                //OutputStream outStream = new ObjectOutputStream(socket.getOutputStream());
                InputStream inStream = null;
                OutputStream outStream = null;
-               if(STR_LANGUAGE.equals(STR_JAVA)) {
+               if(strLanguageDriver.equals(STR_JAVA)) {
                        inStream = new ObjectInputStream(socket.getInputStream());
                        outStream = new ObjectOutputStream(socket.getOutputStream());
                } else {        // At this point the language is certainly C++, otherwise would've complained above
@@ -980,7 +990,7 @@ public class IoTMaster {
                // PROFILING
                start = System.currentTimeMillis();
 
-               if(STR_LANGUAGE.equals(STR_JAVA)) {
+               if(strLanguageDriver.equals(STR_JAVA)) {
                        sendFileToJavaSlaveDriver(serverSocket, inStream, outStream, strObjName, 
                                strObjClassName, strObjClassInterfaceName, strObjStubClsIntfaceName,
                                strIoTSlaveObjectHostAdd, strFieldObjectID, arrFieldValues, arrFieldClasses);
@@ -1023,17 +1033,17 @@ public class IoTMaster {
                                if(setInstrumenter.getObjTableName().equals(STR_IOT_DEV_ADD_CLS)) { 
                                // Instrument the normal IoTDeviceAddress
                                        synchronized(this) {
-                                               instrumentIoTSetDevice(strFieldIdentifier, strObjName, strFieldName, strIoTSlaveObjectHostAdd, inStream, outStream);
+                                               instrumentIoTSetDevice(strFieldIdentifier, strObjName, strFieldName, strIoTSlaveObjectHostAdd, inStream, outStream, strLanguageDriver);
                                        }
                                } else if(setInstrumenter.getObjTableName().equals(STR_IOT_ZB_ADD_CLS)) { 
                                // Instrument the IoTZigbeeAddress - special feature for Zigbee device support
                                        synchronized(this) {
-                                               instrumentIoTSetZBDevice(map, strObjName, strFieldName, strIoTSlaveObjectHostAdd, inStream, outStream);
+                                               instrumentIoTSetZBDevice(map, strObjName, strFieldName, strIoTSlaveObjectHostAdd, inStream, outStream, strLanguageDriver);
                                        }
                                } else if(setInstrumenter.getObjTableName().equals(STR_IOT_ADD_CLS)) { 
                                // Instrument the IoTAddress
                                        synchronized(this) {
-                                               instrumentIoTSetAddress(strFieldIdentifier, strFieldName, inStream, outStream);
+                                               instrumentIoTSetAddress(strFieldIdentifier, strFieldName, inStream, outStream, strLanguageDriver);
                                        }
                                } else {
                                        String strErrMsg = "IoTMaster: Device driver object can only have IoTSet<IoTAddress>, IoTSet<IoTDeviceAddress>," +
@@ -1047,8 +1057,7 @@ public class IoTMaster {
                }
                // End the session
                // TODO: Change this later
-
-               if(STR_LANGUAGE.equals(STR_JAVA)) {
+               if(strLanguageDriver.equals(STR_JAVA)) {
                        ObjectOutputStream oStream = (ObjectOutputStream) outStream;
                        oStream.writeObject(new MessageSimple(IoTCommCode.END_SESSION));
                } else {        // C++ side for now will be running continuously because it's an infinite loop (not in a separate thread)
@@ -1073,7 +1082,7 @@ public class IoTMaster {
         *
         * @return  void
         */
-       private void createControllerObjects() throws InterruptedException {
+       private void createDriverObjects() throws InterruptedException {
 
                // Create a list of threads
                List<Thread> threads = new ArrayList<Thread>();
@@ -1629,7 +1638,7 @@ public class IoTMaster {
        /**
         * Receive ACK
         */
-       public boolean recvAck(InputStream inStream) throws IOException {
+       public synchronized boolean recvAck(InputStream inStream) throws IOException {
 
                int intAck = recvInteger(inStream);
                IoTCommCode codeAck = getCode(intAck);
@@ -1921,15 +1930,19 @@ public class IoTMaster {
                                        strIoTSlaveControllerHostAdd, STR_TCP_PROTOCOL, commHan.getComPort(strObjControllerName));
                                routerConfig.configureHostMainPolicies(strIoTSlaveControllerHostAdd, strIoTMasterHostAdd,
                                        strIoTSlaveControllerHostAdd, STR_TCP_PROTOCOL, commHan.getComPort(strObjControllerName));
-
+                               // Read config file
+                               String strControllerCfg = STR_CONT_PATH + strObjControllerName + "/" + strObjControllerName + STR_CFG_FILE_EXT;
+                               STR_LANGUAGE_CONTROLLER = parseConfigFile(strControllerCfg, STR_LANGUAGE);
+                               if(STR_LANGUAGE_CONTROLLER == null)
+                                       throw new Error("IoTMaster: Language specification missing in config file: " + strControllerCfg);
                                // Construct ssh command line and create a controller thread for e.g. AcmeProximity
                                String strSSHCommand = null;
-                               if(STR_LANGUAGE.equals(STR_JAVA))
+                               if(STR_LANGUAGE_CONTROLLER.equals(STR_JAVA))
                                        strSSHCommand = getCmdJavaIoTSlave(strObjControllerName);
-                               else if(STR_LANGUAGE.equals(STR_CPP))
+                               else if(STR_LANGUAGE_CONTROLLER.equals(STR_CPP))
                                        strSSHCommand = getCmdCppIoTSlave(strObjControllerName);
                                else
-                                       throw new Error("IoTMaster: Language specification not recognized: " + STR_LANGUAGE);
+                                       throw new Error("IoTMaster: Language specification not recognized: " + STR_LANGUAGE_CONTROLLER);
                                RuntimeOutput.print(strSSHCommand, BOOL_VERBOSE);
                                createThread(strSSHCommand);
                                // Wait for connection
@@ -1938,7 +1951,7 @@ public class IoTMaster {
                                Socket socket = serverSocket.accept();
                                InputStream inStream = null;
                                OutputStream outStream = null;
-                               if(STR_LANGUAGE.equals(STR_JAVA)) {
+                               if(STR_LANGUAGE_CONTROLLER.equals(STR_JAVA)) {
                                        inStream = new ObjectInputStream(socket.getInputStream());
                                        outStream = new ObjectOutputStream(socket.getOutputStream());
                                } else {        // At this point the language is certainly C++, otherwise would've complained above
@@ -1960,7 +1973,7 @@ public class IoTMaster {
                                String strControllerClassNamePath = STR_CONT_PATH + strObjControllerName + "/" +
                                        strControllerClassName;
 
-                               if(STR_LANGUAGE.equals(STR_JAVA)) {
+                               if(STR_LANGUAGE_CONTROLLER.equals(STR_JAVA)) {
                                        sendFileToJavaSlave(strObjControllerName, serverSocket, inStream, outStream);
                                        // Create main controller/device object
                                        commMasterToSlave(new MessageCreateMainObject(IoTCommCode.CREATE_MAIN_OBJECT, strObjControllerName),
@@ -1984,7 +1997,7 @@ public class IoTMaster {
                                RuntimeOutput.print("IoTMaster: Opening class file: " + strControllerClassName, BOOL_VERBOSE);
                                RuntimeOutput.print("IoTMaster: Class file path: " + strControllerClassNamePath, BOOL_VERBOSE);
                                HashMap<String,Object> hmControllerFieldObjects = null;
-                               if(STR_LANGUAGE.equals(STR_JAVA)) {
+                               if(STR_LANGUAGE_CONTROLLER.equals(STR_JAVA)) {
                                        FileInputStream fis = new FileInputStream(strControllerClassNamePath);
                                        ClassReader cr = new ClassReader(fis);
                                        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
@@ -2019,7 +2032,7 @@ public class IoTMaster {
                                                } else if(setInstrumenter.getObjTableName().equals(STR_IOT_ADD_CLS)) { 
                                                // Instrument the IoTAddress
                                                        setRouterPolicyIoTSetAddress(strFieldName, map, strIoTSlaveControllerHostAdd);
-                                                       instrumentIoTSetAddress(strFieldName, strFieldName, inStream, outStream);
+                                                       instrumentIoTSetAddress(strFieldName, strFieldName, inStream, outStream, STR_LANGUAGE_CONTROLLER);
                                                } else {
                                                // Any other cases
                                                        instrumentIoTSet(map, strFieldName);
@@ -2061,7 +2074,7 @@ public class IoTMaster {
                                start = System.currentTimeMillis();
 
                                // Separating object creations and Set/Relation initializations
-                               createControllerObjects();
+                               createDriverObjects();
 
                                // PROFILING
                                result = System.currentTimeMillis()-start;
@@ -2070,7 +2083,7 @@ public class IoTMaster {
                                start = System.currentTimeMillis();
 
                                // Sets and relations initializations
-                               if(STR_LANGUAGE.equals(STR_JAVA))
+                               if(STR_LANGUAGE_CONTROLLER.equals(STR_JAVA))
                                        initializeSetsAndRelationsJava(inStream, outStream);
                                else
                                        initializeSetsAndRelationsCpp(inStream, outStream);;
@@ -2079,13 +2092,13 @@ public class IoTMaster {
                                result = System.currentTimeMillis()-start;
                                System.out.println("\n\n ==> Time needed to initialize sets and relations: " + result + "\n\n");
 
-                               if(STR_LANGUAGE.equals(STR_JAVA))
+                               if(STR_LANGUAGE_CONTROLLER.equals(STR_JAVA))
                                        // == COMMUNICATION WITH IOTSLAVE CONTROLLER TO EXECUTE INIT METHOD
                                        commMasterToSlave(new MessageSimple(IoTCommCode.INVOKE_INIT_METHOD), "Invoke init() method!", inStream, outStream);
                                else
                                        invokeInitMethodCpp(outStream, inStream);
                                // == COMMUNICATION WITH IOTSLAVE CONTROLLER TO END PROCESS
-                               if(STR_LANGUAGE.equals(STR_JAVA)) {
+                               if(STR_LANGUAGE_CONTROLLER.equals(STR_JAVA)) {
                                        ObjectOutputStream oStream = (ObjectOutputStream) outStream;
                                        oStream.writeObject(new MessageSimple(IoTCommCode.END_SESSION));
                                } else  // C++ side will wait until the program finishes, it's not generating a separate thread for now