Fixing a bug in IoTMaster (wrong variable for language flag check); adding LANGUAGE...
authorrtrimana <rtrimana@uci.edu>
Tue, 14 Feb 2017 18:03:46 +0000 (10:03 -0800)
committerrtrimana <rtrimana@uci.edu>
Tue, 14 Feb 2017 18:03:46 +0000 (10:03 -0800)
benchmarks/Java/HomeSecurityController/HomeSecurityController.config
benchmarks/Java/HomeSecurityController/HomeSecurityController.java
benchmarks/Java/IrrigationController/IrrigationController.config
benchmarks/Java/SmartLightsController/SmartLightsController.config
benchmarks/Java/SpeakerController/SpeakerController.config
benchmarks/drivers/Java/MultipurposeSensor/MultipurposeSensor.java
iotjava/iotruntime/master/IoTMaster.java

index 5a44766d290480763eb37ce6be4cc517539b9e20..a3a2f9877a3f39b04113606b0c01737d75a8acc9 100644 (file)
@@ -1 +1,4 @@
 ADDITIONAL_ZIP_FILE=No
 ADDITIONAL_ZIP_FILE=No
+
+# Language
+LANGUAGE=Java
index 8647f2eedbc5f8f44755524025c6d59b4bf9e69e..68cf0fb6dc76e43c02f9e4667d5a79146bd26f4f 100644 (file)
@@ -127,6 +127,7 @@ public class HomeSecurityController implements SmartthingsSensorCallback {
 
                // Get and init the IAS sensors for this specific room
                HashSet<SmartthingsSensorSmart> sensors = roomSensorRelation.get(rm);
 
                // Get and init the IAS sensors for this specific room
                HashSet<SmartthingsSensorSmart> sensors = roomSensorRelation.get(rm);
+               System.out.println("DEBUG: We have " + sensors.size() + " sensors!");
                for (SmartthingsSensorSmart sen : sensors) {
        
                        try {
                for (SmartthingsSensorSmart sen : sensors) {
        
                        try {
index a53b2c11ffac93e9d34e9496df266912c3bcafb8..7f70cd70cb33e4ce6c85f0c815cce11190877f4c 100644 (file)
@@ -1 +1,4 @@
 ADDITIONAL_ZIP_FILE=Yes
 ADDITIONAL_ZIP_FILE=Yes
+
+# Language
+LANGUAGE=Java
index 5a44766d290480763eb37ce6be4cc517539b9e20..a3a2f9877a3f39b04113606b0c01737d75a8acc9 100644 (file)
@@ -1 +1,4 @@
 ADDITIONAL_ZIP_FILE=No
 ADDITIONAL_ZIP_FILE=No
+
+# Language
+LANGUAGE=Java
index a53b2c11ffac93e9d34e9496df266912c3bcafb8..7f70cd70cb33e4ce6c85f0c815cce11190877f4c 100644 (file)
@@ -1 +1,4 @@
 ADDITIONAL_ZIP_FILE=Yes
 ADDITIONAL_ZIP_FILE=Yes
+
+# Language
+LANGUAGE=Java
index ae1aaf371759ec0ee1b654394778da93a017bbae..5b91b4ef4922393d1d34a0f8f2340b8a4fe90b50 100644 (file)
@@ -57,7 +57,6 @@ public class MultipurposeSensor implements IoTZigbeeCallback, SmartthingsSensor
                if (didAlreadyInit.compareAndSet(false, true) == false) {
                        return; // already init
                }
                if (didAlreadyInit.compareAndSet(false, true) == false) {
                        return; // already init
                }
-
                didAlreadyClose.set(false);
 
                try {
                didAlreadyClose.set(false);
 
                try {
index e85f8d2e78ba27f3d2bc38a1d8b4b2c28c815ed5..5fb917807b47d9183b8299100279f0434395f497 100644 (file)
@@ -381,6 +381,7 @@ public class IoTMaster {
         * @params  strIoTSlaveObjectHostAdd  String slave host address
         * @params  inStream                  ObjectInputStream communication
         * @params  inStream                  ObjectOutputStream communication
         * @params  strIoTSlaveObjectHostAdd  String slave host address
         * @params  inStream                  ObjectInputStream communication
         * @params  inStream                  ObjectOutputStream communication
+        * @params  strLanguage                           String language
         * @return  void
         */
        private void instrumentIoTSetDevice(String strFieldIdentifier, String strObjName, String strFieldName, String strIoTSlaveObjectHostAdd,
         * @return  void
         */
        private void instrumentIoTSetDevice(String strFieldIdentifier, String strObjName, String strFieldName, String strIoTSlaveObjectHostAdd,
@@ -460,6 +461,7 @@ public class IoTMaster {
         * @params  strIoTSlaveObjectHostAdd  String slave host address
         * @params  inStream                  ObjectInputStream communication
         * @params  inStream                  ObjectOutputStream communication
         * @params  strIoTSlaveObjectHostAdd  String slave host address
         * @params  inStream                  ObjectInputStream communication
         * @params  inStream                  ObjectOutputStream communication
+        * @params  strLanguage                           String language
         * @return  void
         */
        private void instrumentIoTSetZBDevice(Map.Entry<String,Object> map, String strObjName, String strFieldName, String strIoTSlaveObjectHostAdd,
         * @return  void
         */
        private void instrumentIoTSetZBDevice(Map.Entry<String,Object> map, String strObjName, String strFieldName, String strIoTSlaveObjectHostAdd,
@@ -521,6 +523,7 @@ public class IoTMaster {
         * @params  strFieldName              String field name
         * @params  inStream                  ObjectInputStream communication
         * @params  inStream                  ObjectOutputStream communication
         * @params  strFieldName              String field name
         * @params  inStream                  ObjectInputStream communication
         * @params  inStream                  ObjectOutputStream communication
+        * @params  strLanguage                           String language
         * @return  void
         */
        private void instrumentIoTSetAddress(String strFieldIdentifier, String strFieldName,
         * @return  void
         */
        private void instrumentIoTSetAddress(String strFieldIdentifier, String strFieldName,
@@ -558,10 +561,11 @@ public class IoTMaster {
        /**
         * A private method to instrument an object on a specific machine and setting up policies
         *
        /**
         * A private method to instrument an object on a specific machine and setting up policies
         *
-        * @params  strFieldObjectID  String field object ID
+        * @params  strFieldObjectID              String field object ID
+        * @params  strLanguage                           String language
         * @return  void
         */
         * @return  void
         */
-       private void instrumentObject(String strFieldObjectID) throws IOException {
+       private void instrumentObject(String strFieldObjectID, String strLanguage) throws IOException {
 
                // Extract the interface name for RMI
                // e.g. ProximitySensorInterface, TempSensorInterface, etc.
 
                // Extract the interface name for RMI
                // e.g. ProximitySensorInterface, TempSensorInterface, etc.
@@ -607,7 +611,7 @@ public class IoTMaster {
                        routerConfig.configureHostMainPolicies(strIoTSlaveObjectHostAdd, strIoTSlaveControllerHostAdd,
                                strIoTSlaveObjectHostAdd, STR_TCP_PROTOCOL);
                        // Instrument the IoTSet declarations inside the class file
                        routerConfig.configureHostMainPolicies(strIoTSlaveObjectHostAdd, strIoTSlaveControllerHostAdd,
                                strIoTSlaveObjectHostAdd, STR_TCP_PROTOCOL);
                        // Instrument the IoTSet declarations inside the class file
-                       instrumentObjectIoTSet(strFieldObjectID);
+                       instrumentObjectIoTSet(strFieldObjectID, strLanguage);
                }
                // Send routing policy to router for controller object
                // ROUTING POLICY: RMI communication - RMI registry and stub ports
                }
                // Send routing policy to router for controller object
                // ROUTING POLICY: RMI communication - RMI registry and stub ports
@@ -766,16 +770,17 @@ public class IoTMaster {
         * <p>
         * Mostly the IoTSet fields would contain IoTDeviceAddress objects
         *
         * <p>
         * Mostly the IoTSet fields would contain IoTDeviceAddress objects
         *
-        * @params  strFieldObjectID  String field object ID
+        * @params  strFieldObjectID    String field object ID
+        * @params  strLanguage                 String language
         * @return  void
         */
         * @return  void
         */
-       private void instrumentObjectIoTSet(String strFieldObjectID) throws IOException {
+       private void instrumentObjectIoTSet(String strFieldObjectID, String strLanguage) throws IOException {
 
                // If this is a new object ... then create one
                // Instrument the class source code and look for IoTSet for device addresses
                // e.g. @config private IoTSet<IoTDeviceAddress> lb_addresses;
                HashMap<String,Object> hmObjectFieldObjects = null;
 
                // If this is a new object ... then create one
                // Instrument the class source code and look for IoTSet for device addresses
                // e.g. @config private IoTSet<IoTDeviceAddress> lb_addresses;
                HashMap<String,Object> hmObjectFieldObjects = null;
-               if(STR_LANGUAGE.equals(STR_JAVA)) {
+               if(strLanguage.equals(STR_JAVA)) {
                        String strObjectClassNamePath = STR_IOT_CODE_PATH + strObjClassName + "/" + strObjClassName + STR_CLS_FILE_EXT;
                        FileInputStream fis = new FileInputStream(strObjectClassNamePath);
                        ClassReader cr = new ClassReader(fis);
                        String strObjectClassNamePath = STR_IOT_CODE_PATH + strObjClassName + "/" + strObjClassName + STR_CLS_FILE_EXT;
                        FileInputStream fis = new FileInputStream(strObjectClassNamePath);
                        ClassReader cr = new ClassReader(fis);
@@ -1126,9 +1131,10 @@ public class IoTMaster {
         *
         * @params  Map.Entry<String,Object>  Entry of map IoTSet instrumentation
         * @params  strFieldName              String field name
         *
         * @params  Map.Entry<String,Object>  Entry of map IoTSet instrumentation
         * @params  strFieldName              String field name
+        * @params  strLanguage                           String language
         * @return  void
         */
         * @return  void
         */
-       private void instrumentIoTSet(Map.Entry<String,Object> map, String strFieldName) 
+       private void instrumentIoTSet(Map.Entry<String,Object> map, String strFieldName, String strLanguage
                throws IOException, ClassNotFoundException, InterruptedException {
                                
                // Get information from the set
                throws IOException, ClassNotFoundException, InterruptedException {
                                
                // Get information from the set
@@ -1144,7 +1150,7 @@ public class IoTMaster {
                        String strObjID = setInstrumenter.fieldObjectID(iRow);
                        strObjClassName = setInstrumenter.fieldEntryType(strObjID);
                        // Call the method to create an object
                        String strObjID = setInstrumenter.fieldObjectID(iRow);
                        strObjClassName = setInstrumenter.fieldEntryType(strObjID);
                        // Call the method to create an object
-                       instrumentObject(strObjID);
+                       instrumentObject(strObjID, strLanguage);
                        int iNumOfPorts = Integer.parseInt(STR_NUM_CALLBACK_PORTS);
                        objInitHand.addObjectIntoField(strFieldName, strIoTSlaveObjectHostAdd, strObjName,
                                strObjClassName, strObjClassInterfaceName, strObjStubClsIntfaceName, commHan.getRMIRegPort(strObjName), 
                        int iNumOfPorts = Integer.parseInt(STR_NUM_CALLBACK_PORTS);
                        objInitHand.addObjectIntoField(strFieldName, strIoTSlaveObjectHostAdd, strObjName,
                                strObjClassName, strObjClassInterfaceName, strObjStubClsIntfaceName, commHan.getRMIRegPort(strObjName), 
@@ -1158,9 +1164,10 @@ public class IoTMaster {
         *
         * @params  Map.Entry<String,Object>  Entry of map IoTRelation instrumentation
         * @params  strFieldName              String field name
         *
         * @params  Map.Entry<String,Object>  Entry of map IoTRelation instrumentation
         * @params  strFieldName              String field name
+        * @params  strLanguage                           String language
         * @return  void
         */
         * @return  void
         */
-       private void instrumentIoTRelation(Map.Entry<String,Object> map, String strFieldName) 
+       private void instrumentIoTRelation(Map.Entry<String,Object> map, String strFieldName, String strLanguage
                throws IOException, ClassNotFoundException, InterruptedException {
 
                        // Get information from the set
                throws IOException, ClassNotFoundException, InterruptedException {
 
                        // Get information from the set
@@ -1175,7 +1182,7 @@ public class IoTMaster {
                        String strObjID = relationInstrumenter.firstFieldObjectID(iRow);
                        strObjClassName = relationInstrumenter.firstEntryFieldType(strObjID);
                        // Call the method to create an object
                        String strObjID = relationInstrumenter.firstFieldObjectID(iRow);
                        strObjClassName = relationInstrumenter.firstEntryFieldType(strObjID);
                        // Call the method to create an object
-                       instrumentObject(strObjID);
+                       instrumentObject(strObjID, strLanguage);
                        // Get the first object controller host address
                        String strFirstIoTSlaveObjectHostAdd = strIoTSlaveObjectHostAdd;
                        int iNumOfPorts = Integer.parseInt(STR_NUM_CALLBACK_PORTS);
                        // Get the first object controller host address
                        String strFirstIoTSlaveObjectHostAdd = strIoTSlaveObjectHostAdd;
                        int iNumOfPorts = Integer.parseInt(STR_NUM_CALLBACK_PORTS);
@@ -1189,7 +1196,7 @@ public class IoTMaster {
                        strObjID = relationInstrumenter.secondFieldObjectID(iRow);
                        strObjClassName = relationInstrumenter.secondEntryFieldType(strObjID);
                        // Call the method to create an object
                        strObjID = relationInstrumenter.secondFieldObjectID(iRow);
                        strObjClassName = relationInstrumenter.secondEntryFieldType(strObjID);
                        // Call the method to create an object
-                       instrumentObject(strObjID);
+                       instrumentObject(strObjID, strLanguage);
                        // Get the second object controller host address
                        String strSecondIoTSlaveObjectHostAdd = strIoTSlaveObjectHostAdd;
                        objInitHand.addSecondObjectIntoField(strFieldName, strIoTSlaveObjectHostAdd, strObjName,
                        // Get the second object controller host address
                        String strSecondIoTSlaveObjectHostAdd = strIoTSlaveObjectHostAdd;
                        objInitHand.addSecondObjectIntoField(strFieldName, strIoTSlaveObjectHostAdd, strObjName,
@@ -2035,10 +2042,10 @@ public class IoTMaster {
                                                        instrumentIoTSetAddress(strFieldName, strFieldName, inStream, outStream, STR_LANGUAGE_CONTROLLER);
                                                } else {
                                                // Any other cases
                                                        instrumentIoTSetAddress(strFieldName, strFieldName, inStream, outStream, STR_LANGUAGE_CONTROLLER);
                                                } else {
                                                // Any other cases
-                                                       instrumentIoTSet(map, strFieldName);
+                                                       instrumentIoTSet(map, strFieldName, STR_LANGUAGE_CONTROLLER);
                                                }
                                        } else if (strClassName.equals(STR_REL_INSTRUMENTER_CLS)) {
                                                }
                                        } else if (strClassName.equals(STR_REL_INSTRUMENTER_CLS)) {
-                                               instrumentIoTRelation(map, strFieldName);
+                                               instrumentIoTRelation(map, strFieldName, STR_LANGUAGE_CONTROLLER);
                                        }
                                }
                                // PROFILING
                                        }
                                }
                                // PROFILING