Preparing Makefiles, stub, skeleton, config files, etc. for porting LifxLightBulb...
authorrtrimana <rtrimana@uci.edu>
Mon, 12 Dec 2016 19:46:59 +0000 (11:46 -0800)
committerrtrimana <rtrimana@uci.edu>
Mon, 12 Dec 2016 19:46:59 +0000 (11:46 -0800)
129 files changed:
benchmarks/Lifxtest/Lifxtest.config [new file with mode: 0644]
benchmarks/Lifxtest/Lifxtest.java [new file with mode: 0644]
benchmarks/Lifxtest/LightBulbTest_Stub.java [new file with mode: 0644]
benchmarks/Lifxtest/Makefile [new file with mode: 0755]
benchmarks/Makefile
benchmarks/annotation/config.java [new file with mode: 0644]
benchmarks/annotation/constraint.java [new file with mode: 0644]
benchmarks/drivers/LifxLightBulb/LifxLightBulb.java
benchmarks/drivers/LifxLightBulb/LightBulb_Skeleton.java [new file with mode: 0644]
benchmarks/drivers/Makefile [new file with mode: 0644]
benchmarks/interfaces/LightBulb.java [new file with mode: 0644]
benchmarks/interfaces/LightBulbTest.java [new file with mode: 0644]
benchmarks/interfaces/Makefile [new file with mode: 0755]
benchmarks/original_interfaces/Camera.java [new file with mode: 0644]
benchmarks/original_interfaces/CameraCallback.java [new file with mode: 0644]
benchmarks/original_interfaces/GPSGateway.java [new file with mode: 0644]
benchmarks/original_interfaces/GPSGatewayCallback.java [new file with mode: 0644]
benchmarks/original_interfaces/LEDFlasher.java [new file with mode: 0644]
benchmarks/original_interfaces/Lawn.java [new file with mode: 0644]
benchmarks/original_interfaces/LightBulb.java [new file with mode: 0644]
benchmarks/original_interfaces/Makefile [new file with mode: 0755]
benchmarks/original_interfaces/MoistureSensor.java [new file with mode: 0644]
benchmarks/original_interfaces/MoistureSensorCallback.java [new file with mode: 0644]
benchmarks/original_interfaces/Room.java [new file with mode: 0644]
benchmarks/original_interfaces/Speaker.java [new file with mode: 0644]
benchmarks/original_interfaces/SpeakerCallback.java [new file with mode: 0644]
benchmarks/original_interfaces/Sprinkler.java [new file with mode: 0644]
benchmarks/original_interfaces/WeatherGateway.java [new file with mode: 0644]
benchmarks/original_interfaces/WeatherGatewayCallback.java [new file with mode: 0644]
benchmarks/original_interfaces/ZoneState.java [new file with mode: 0644]
config/iotpolicy/callbackpolicy.pol [deleted file]
config/iotpolicy/callbackrequires.pol [deleted file]
config/iotpolicy/camerapolicy.pol [deleted file]
config/iotpolicy/camerarequires.pol [deleted file]
config/iotpolicy/enum.pol [deleted file]
config/iotpolicy/lightbulbpolicy.pol [deleted file]
config/iotpolicy/lightbulbrequires.pol [deleted file]
config/iotpolicy/struct.pol [deleted file]
config/iotpolicy/testclasspolicy.pol [deleted file]
config/iotpolicy/testclasspolicy_advanced.pol [deleted file]
config/iotpolicy/testclassrequires.pol [deleted file]
config/iotpolicy/testclassrequires_advanced.pol [deleted file]
iotjava/Makefile
iotjava/gmon.out [new file with mode: 0644]
iotjava/iotpolicy/IoTCompiler.java
iotjava/iotruntime/brillo/IoTBrilloWeave.java [deleted file]
iotjava/iotruntime/brillo/IoTBrilloWeaveCloudConnection.java [deleted file]
iotjava/iotruntime/brillo/IoTBrilloWeaveCodeGenerator.java [deleted file]
iotjava/iotruntime/brillo/credentials_cache.json [deleted file]
iotjava/iotruntime/master/ClassRuntimeInstrumenterMaster.java
jars/asm-all-5.0.3.jar [new file with mode: 0644]
jars/checker.jar [new file with mode: 0644]
jars/java-json.jar [new file with mode: 0644]
jars/javac.jar [new file with mode: 0644]
jars/mysql.jar [new file with mode: 0644]
jars/zip4j_1.3.2.jar [new file with mode: 0644]
localconfig/iotinstaller/Comm_Lawn_Camera.config [new file with mode: 0644]
localconfig/iotinstaller/Comm_Lawn_Moisture.config [new file with mode: 0644]
localconfig/iotinstaller/Comm_Lawn_Sprinkler.config [new file with mode: 0644]
localconfig/iotinstaller/Comm_Room_Camera.config [new file with mode: 0644]
localconfig/iotinstaller/Comm_Room_LightBulb.config [new file with mode: 0644]
localconfig/iotinstaller/Comm_Room_Speaker.config [new file with mode: 0644]
localconfig/iotinstaller/Install_Addresses.config [new file with mode: 0644]
localconfig/iotinstaller/Install_AmcrestCamera.config [new file with mode: 0644]
localconfig/iotinstaller/Install_AudioRoom.config [new file with mode: 0644]
localconfig/iotinstaller/Install_Brillo_LEDFlasher.config [new file with mode: 0644]
localconfig/iotinstaller/Install_DeviceAddresses.config [new file with mode: 0644]
localconfig/iotinstaller/Install_DeviceAddresses_Wildcard.config [new file with mode: 0644]
localconfig/iotinstaller/Install_Host.config [new file with mode: 0644]
localconfig/iotinstaller/Install_Lawn.config [new file with mode: 0644]
localconfig/iotinstaller/Install_LightBulb.config [new file with mode: 0644]
localconfig/iotinstaller/Install_PhoneGateway_Empty_Constructor.config [new file with mode: 0644]
localconfig/iotinstaller/Install_Room_Empty_Constructor.config [new file with mode: 0644]
localconfig/iotinstaller/Install_Speaker_Empty_Constructor.config [new file with mode: 0644]
localconfig/iotinstaller/Install_Sprinkler.config [new file with mode: 0644]
localconfig/iotinstaller/Install_SpruceSensor.config [new file with mode: 0644]
localconfig/iotinstaller/Install_ZigbeeAddresses.config [new file with mode: 0644]
localconfig/iotpolicy/LifxLightBulb/lifxlightbulb.pol [new file with mode: 0644]
localconfig/iotpolicy/LifxLightBulb/lifxtest.req [new file with mode: 0644]
localconfig/iotpolicy/development/callbackpolicy.pol [new file with mode: 0644]
localconfig/iotpolicy/development/callbackrequires.pol [new file with mode: 0644]
localconfig/iotpolicy/development/camerapolicy.pol [new file with mode: 0644]
localconfig/iotpolicy/development/camerarequires.pol [new file with mode: 0644]
localconfig/iotpolicy/development/enum.pol [new file with mode: 0644]
localconfig/iotpolicy/development/lightbulbpolicy.pol [new file with mode: 0644]
localconfig/iotpolicy/development/lightbulbrequires.pol [new file with mode: 0644]
localconfig/iotpolicy/development/struct.pol [new file with mode: 0644]
localconfig/iotpolicy/development/testclasspolicy.pol [new file with mode: 0644]
localconfig/iotpolicy/development/testclasspolicy_advanced.pol [new file with mode: 0644]
localconfig/iotpolicy/development/testclassrequires.pol [new file with mode: 0644]
localconfig/iotpolicy/development/testclassrequires_advanced.pol [new file with mode: 0644]
localconfig/iotruntime/IoTMaster.config [new file with mode: 0644]
localconfig/iotruntime/IoTSlave.config [new file with mode: 0644]
localconfig/iotruntime/MySQLInterface.config [new file with mode: 0644]
localconfig/mysql/AcmeProximity_query_results [new file with mode: 0644]
localconfig/mysql/AcmeVentControl_query_results [new file with mode: 0644]
localconfig/mysql/GoogleAPIsAddress.config [new file with mode: 0644]
localconfig/mysql/GoogleAccountAddress.config [new file with mode: 0644]
localconfig/mysql/audioRooms.config [new file with mode: 0644]
localconfig/mysql/blossomSprAddressSet.config [new file with mode: 0644]
localconfig/mysql/cam_addresses.config [new file with mode: 0644]
localconfig/mysql/cameraSet.config [new file with mode: 0644]
localconfig/mysql/cameras.config [new file with mode: 0644]
localconfig/mysql/devUdpAddress.config [new file with mode: 0644]
localconfig/mysql/devZigbeeAddress.config [new file with mode: 0644]
localconfig/mysql/gpsSet.config [new file with mode: 0644]
localconfig/mysql/gps_address.config [new file with mode: 0644]
localconfig/mysql/gwSet.config [new file with mode: 0644]
localconfig/mysql/lawnCameraRelation.config [new file with mode: 0644]
localconfig/mysql/lawnMoistureSensorRelation.config [new file with mode: 0644]
localconfig/mysql/lawnSet.config [new file with mode: 0644]
localconfig/mysql/lawnSprinklerRelation.config [new file with mode: 0644]
localconfig/mysql/lb_addresses.config [new file with mode: 0644]
localconfig/mysql/led_flasher.config [new file with mode: 0644]
localconfig/mysql/lifx_light_bulb.config [new file with mode: 0644]
localconfig/mysql/light_bulbs.config [new file with mode: 0644]
localconfig/mysql/localAddressSet.config [new file with mode: 0644]
localconfig/mysql/mainRoomLightBulbs.config [new file with mode: 0644]
localconfig/mysql/moistureSensorsSet.config [new file with mode: 0644]
localconfig/mysql/ph_address.config [new file with mode: 0644]
localconfig/mysql/roomCameraRel.config [new file with mode: 0644]
localconfig/mysql/roomMainBulbRel.config [new file with mode: 0644]
localconfig/mysql/roomSpeakerRel.config [new file with mode: 0644]
localconfig/mysql/rooms.config [new file with mode: 0644]
localconfig/mysql/speakerAddresses.config [new file with mode: 0644]
localconfig/mysql/speakerSet.config [new file with mode: 0644]
localconfig/mysql/spr_Addresses.config [new file with mode: 0644]
localconfig/mysql/weatherDataAddressMain.config [new file with mode: 0644]
localconfig/mysql/weatherDataAddresses.config [new file with mode: 0644]

diff --git a/benchmarks/Lifxtest/Lifxtest.config b/benchmarks/Lifxtest/Lifxtest.config
new file mode 100644 (file)
index 0000000..5a44766
--- /dev/null
@@ -0,0 +1 @@
+ADDITIONAL_ZIP_FILE=No
diff --git a/benchmarks/Lifxtest/Lifxtest.java b/benchmarks/Lifxtest/Lifxtest.java
new file mode 100644 (file)
index 0000000..df95114
--- /dev/null
@@ -0,0 +1,74 @@
+package Lifxtest;
+
+import iotruntime.slave.IoTSet;
+import iotruntime.slave.IoTRelation;
+import iotruntime.slave.IoTDeviceAddress;
+import iotruntime.IoTUDP;
+
+import java.io.IOException;
+import java.net.*;
+import iotcode.interfaces.LightBulbTest;
+import iotcode.annotation.*;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.Map;
+
+import java.rmi.*;
+import java.rmi.server.UnicastRemoteObject;
+
+import iotcode.interfaces.LightBulbTest;
+
+public class Lifxtest {
+
+       @config private IoTSet<LightBulbTest> lifx_light_bulb;
+
+       public void init() throws InterruptedException {
+
+               for(LightBulbTest lifx : lifx_light_bulb.values()) {
+                       Thread thread = new Thread(new Runnable() {
+                               public void run() {
+                                       lifx.init();
+                               }
+                       });
+                       thread.start();
+                       Thread.sleep(1000);
+
+                       for (int i = 0; i < 5; i++) {
+                               lifx.turnOff();
+                               System.out.println("Turning off!");
+                               Thread.sleep(1000);
+                               lifx.turnOn();
+                               System.out.println("Turning on!");
+                               Thread.sleep(1000);
+                       }
+
+                       for (int i = 2500; i < 9000; i += 100) {
+                               System.out.println("Adjusting Temp: " + Integer.toString(i));
+                               lifx.setTemperature(i);
+                               Thread.sleep(100);
+                       }
+
+                       for (int i = 9000; i > 2500; i -= 100) {
+                               System.out.println("Adjusting Temp: " + Integer.toString(i));
+                               lifx.setTemperature(i);
+                               Thread.sleep(100);
+                       }
+
+                       for (int i = 100; i > 0; i -= 10) {
+                               System.out.println("Adjusting Brightness: " + Integer.toString(i));
+                               lifx.setColor(lifx.getHue(), lifx.getSaturation(), i);
+                               Thread.sleep(500);
+                       }
+
+                       for (int i = 0; i < 100; i += 10) {
+                               System.out.println("Adjusting Brightness: " + Integer.toString(i));
+                               lifx.setColor(lifx.getHue(), lifx.getSaturation(), i);
+                               Thread.sleep(500);
+                       }
+
+                       thread.join();
+               }
+       }
+}
diff --git a/benchmarks/Lifxtest/LightBulbTest_Stub.java b/benchmarks/Lifxtest/LightBulbTest_Stub.java
new file mode 100644 (file)
index 0000000..2a697ce
--- /dev/null
@@ -0,0 +1,112 @@
+package Lifxtest;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Arrays;
+import iotrmi.Java.IoTRMICall;
+import iotrmi.Java.IoTRMIObject;
+
+import iotcode.interfaces.LightBulbTest;
+
+public class LightBulbTest_Stub implements LightBulbTest {
+
+       private IoTRMICall rmiCall;
+       private String callbackAddress;
+       private int[] ports;
+
+       private final static int objectId = 0;
+       
+
+       public LightBulbTest_Stub(int _port, String _skeletonAddress, String _callbackAddress, int _rev, int[] _ports) throws Exception {
+               callbackAddress = _callbackAddress;
+               ports = _ports;
+               rmiCall = new IoTRMICall(_port, _skeletonAddress, _rev);
+       }
+
+       public void turnOn() {
+               int methodId = 2;
+               Class<?> retType = void.class;
+               Class<?>[] paramCls = new Class<?>[] {  };
+               Object[] paramObj = new Object[] {  };
+               rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+       }
+
+       public double getBrightness() {
+               int methodId = 6;
+               Class<?> retType = double.class;
+               Class<?>[] paramCls = new Class<?>[] {  };
+               Object[] paramObj = new Object[] {  };
+               Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+               return (double)retObj;
+       }
+
+       public void turnOff() {
+               int methodId = 1;
+               Class<?> retType = void.class;
+               Class<?>[] paramCls = new Class<?>[] {  };
+               Object[] paramObj = new Object[] {  };
+               rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+       }
+
+       public boolean getState() {
+               int methodId = 3;
+               Class<?> retType = boolean.class;
+               Class<?>[] paramCls = new Class<?>[] {  };
+               Object[] paramObj = new Object[] {  };
+               Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+               return (boolean)retObj;
+       }
+
+       public void setColor(double _hue, double _saturation, double _brightness) {
+               int methodId = 4;
+               Class<?> retType = void.class;
+               Class<?>[] paramCls = new Class<?>[] { double.class, double.class, double.class };
+               Object[] paramObj = new Object[] { _hue, _saturation, _brightness };
+               rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+       }
+
+       public double getSaturation() {
+               int methodId = 8;
+               Class<?> retType = double.class;
+               Class<?>[] paramCls = new Class<?>[] {  };
+               Object[] paramObj = new Object[] {  };
+               Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+               return (double)retObj;
+       }
+
+       public void init() {
+               int methodId = 0;
+               Class<?> retType = void.class;
+               Class<?>[] paramCls = new Class<?>[] {  };
+               Object[] paramObj = new Object[] {  };
+               rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+       }
+
+       public void setTemperature(int _temperature) {
+               int methodId = 5;
+               Class<?> retType = void.class;
+               Class<?>[] paramCls = new Class<?>[] { int.class };
+               Object[] paramObj = new Object[] { _temperature };
+               rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+       }
+
+       public double getHue() {
+               int methodId = 7;
+               Class<?> retType = double.class;
+               Class<?>[] paramCls = new Class<?>[] {  };
+               Object[] paramObj = new Object[] {  };
+               Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+               return (double)retObj;
+       }
+
+       public int getTemperature() {
+               int methodId = 9;
+               Class<?> retType = int.class;
+               Class<?>[] paramCls = new Class<?>[] {  };
+               Object[] paramObj = new Object[] {  };
+               Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);
+               return (int)retObj;
+       }
+
+}
diff --git a/benchmarks/Lifxtest/Makefile b/benchmarks/Lifxtest/Makefile
new file mode 100755 (executable)
index 0000000..9a4eb32
--- /dev/null
@@ -0,0 +1,17 @@
+BASE = ../..
+
+include $(BASE)/common.mk
+
+JFLAGS = -d $(BIN_DIR) -cp $(BIN_DIR):.
+JARFLAGS = cf 
+JARFLAGS_SMARTLIGHTS = cf Lifxtest.jar
+
+all: lifxtest
+
+PHONY += lifxtest
+lifxtest:
+       $(JAVAC) $(JFLAGS) *.java
+       cp Lifxtest.config $(BIN_DIR)/Lifxtest
+       cd $(BIN_DIR)/Lifxtest; $(JAR) $(JARFLAGS) Lifxtest.jar ../Lifxtest/Lifxtest*.class ../Lifxtest/LightBulb*.class ../iotcode/LifxLightBulb/*.class ../iotcode/interfaces/LightBulb*.class
+
+.PHONY: $(PHONY)
index dac207c6758073f8e1cd4b17cb9f58c6b383b978..0c49d348827e08b8e73cfaf4aa0599eb0d578348 100644 (file)
@@ -4,9 +4,7 @@ BOOFJARS := $(BOOFDIR)/BoofCV-feature-0.21.jar:$(BOOFDIR)/BoofCV-io-0.21.jar:$(B
 
 include $(BASE)/common.mk
 
 
 include $(BASE)/common.mk
 
-all: interfaces annotation drivers Lifxtest SmartLights Irrigation Speaker
-
-nocheck: interfaces annotation nocheckdrivers nocheckLifxtest nocheckSmartLights nocheckIrrigation nocheckSpeaker nocheckBrillotest
+all: interfaces annotation drivers Lifxtest
 
 PHONY += interfaces
 interfaces:
 
 PHONY += interfaces
 interfaces:
diff --git a/benchmarks/annotation/config.java b/benchmarks/annotation/config.java
new file mode 100644 (file)
index 0000000..de85890
--- /dev/null
@@ -0,0 +1,15 @@
+package iotcode.annotation;
+
+import java.lang.annotation.*;
+
+/** @config annotation
+ *  This annotation is for the runtime system to instrument IoTSet and IoTRelation
+ *  Re-instated on 12/12/2016
+ *
+ * @author      Rahmadi Trimananda <rahmadi.trimananda @ uci.edu>
+ * @version     1.0
+ * @since       2016-12-12
+ */
+@Retention(RetentionPolicy.RUNTIME)
+public @interface config {
+}
diff --git a/benchmarks/annotation/constraint.java b/benchmarks/annotation/constraint.java
new file mode 100644 (file)
index 0000000..6e8fe10
--- /dev/null
@@ -0,0 +1,14 @@
+package iotcode.annotation;
+
+import java.lang.annotation.*;
+
+/** @constraint annotation
+ *  This annotation is for the runtime system to instrument IoTSet and IoTRelation
+ *
+ * @author      Rahmadi Trimananda <rahmadi.trimananda @ uci.edu>
+ * @version     1.0
+ * @since       2015-12-01
+ */
+@Retention(RetentionPolicy.RUNTIME)
+public @interface constraint {
+}
index 021e749beef220623750705b128a8a7ea81f7c2a..cbc0ca9b5cddcbc2e8f5100b2f4f4a3ffdf600ec 100644 (file)
@@ -9,9 +9,8 @@ import java.util.Date;
 import java.util.Iterator;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import java.util.Iterator;
 import java.util.concurrent.atomic.AtomicBoolean;
 
-
 // IoT Packages
 // IoT Packages
-//import iotcode.annotation.*;
+import iotcode.annotation.*;
 import iotcode.interfaces.LightBulb;
 import iotruntime.IoTUDP;
 import iotruntime.slave.IoTDeviceAddress;
 import iotcode.interfaces.LightBulb;
 import iotruntime.IoTUDP;
 import iotruntime.slave.IoTDeviceAddress;
@@ -20,8 +19,6 @@ import iotruntime.slave.IoTSet;
 // String to byte conversion
 import javax.xml.bind.DatatypeConverter;
 
 // String to byte conversion
 import javax.xml.bind.DatatypeConverter;
 
-import iotchecker.qual.*;
-
 public class LifxLightBulb implements LightBulb {
 
        /*******************************************************************************************************************************************
 public class LifxLightBulb implements LightBulb {
 
        /*******************************************************************************************************************************************
diff --git a/benchmarks/drivers/LifxLightBulb/LightBulb_Skeleton.java b/benchmarks/drivers/LifxLightBulb/LightBulb_Skeleton.java
new file mode 100644 (file)
index 0000000..17b1381
--- /dev/null
@@ -0,0 +1,260 @@
+package iotcode.LifxLightBulb;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Arrays;
+import iotrmi.Java.IoTRMICall;
+import iotrmi.Java.IoTRMIObject;
+
+import iotcode.interfaces.LightBulb;
+
+public class LightBulb_Skeleton implements LightBulb {
+
+       private LightBulb mainObj;
+       private IoTRMIObject rmiObj;
+
+       private final static int object0Id = 0; //LightBulbTest
+       private static Integer[] object0Permission = { 2, 1, 3, 4, 0, 5 };
+       private static List<Integer> set0Allowed;
+       
+
+       public LightBulb_Skeleton(LightBulb _mainObj, int _port) throws Exception {
+               mainObj = _mainObj;
+               rmiObj = new IoTRMIObject(_port);
+               set0Allowed = new ArrayList<Integer>(Arrays.asList(object0Permission));
+               ___waitRequestInvokeMethod();
+       }
+
+       public void init() {
+               mainObj.init();
+       }
+
+       public void turnOff() {
+               mainObj.turnOff();
+       }
+
+       public void turnOn() {
+               mainObj.turnOn();
+       }
+
+       public boolean getState() {
+               return mainObj.getState();
+       }
+
+       public void setColor(double _hue, double _saturation, double _brightness) {
+               mainObj.setColor(_hue, _saturation, _brightness);
+       }
+
+       public void setTemperature(int _temperature) {
+               mainObj.setTemperature(_temperature);
+       }
+
+       public double getBrightness() {
+               return mainObj.getBrightness();
+       }
+
+       public double getHue() {
+               return mainObj.getHue();
+       }
+
+       public double getSaturation() {
+               return mainObj.getSaturation();
+       }
+
+       public int getTemperature() {
+               return mainObj.getTemperature();
+       }
+
+       public double getBrightnessRangeLowerBound() {
+               return mainObj.getBrightnessRangeLowerBound();
+       }
+
+       public double getBrightnessRangeUpperBound() {
+               return mainObj.getBrightnessRangeUpperBound();
+       }
+
+       public double getHueRangeLowerBound() {
+               return mainObj.getHueRangeLowerBound();
+       }
+
+       public double getHueRangeUpperBound() {
+               return mainObj.getHueRangeUpperBound();
+       }
+
+       public double getSaturationRangeLowerBound() {
+               return mainObj.getSaturationRangeLowerBound();
+       }
+
+       public double getSaturationRangeUpperBound() {
+               return mainObj.getSaturationRangeUpperBound();
+       }
+
+       public int getTemperatureRangeLowerBound() {
+               return mainObj.getTemperatureRangeLowerBound();
+       }
+
+       public int getTemperatureRangeUpperBound() {
+               return mainObj.getTemperatureRangeUpperBound();
+       }
+
+       public void ___init() {
+               Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] {  }, 
+               new Class<?>[] {  });
+               init();
+       }
+
+       public void ___turnOff() {
+               Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] {  }, 
+               new Class<?>[] {  });
+               turnOff();
+       }
+
+       public void ___turnOn() {
+               Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] {  }, 
+               new Class<?>[] {  });
+               turnOn();
+       }
+
+       public void ___getState() throws IOException {
+               Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] {  }, 
+               new Class<?>[] {  });
+               Object retObj = getState();
+               rmiObj.sendReturnObj(retObj);
+       }
+
+       public void ___setColor() {
+               Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { double.class, double.class, double.class }, 
+               new Class<?>[] { null, null, null });
+               setColor((double) paramObj[0], (double) paramObj[1], (double) paramObj[2]);
+       }
+
+       public void ___setTemperature() {
+               Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { int.class }, 
+               new Class<?>[] { null });
+               setTemperature((int) paramObj[0]);
+       }
+
+       public void ___getBrightness() throws IOException {
+               Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] {  }, 
+               new Class<?>[] {  });
+               Object retObj = getBrightness();
+               rmiObj.sendReturnObj(retObj);
+       }
+
+       public void ___getHue() throws IOException {
+               Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] {  }, 
+               new Class<?>[] {  });
+               Object retObj = getHue();
+               rmiObj.sendReturnObj(retObj);
+       }
+
+       public void ___getSaturation() throws IOException {
+               Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] {  }, 
+               new Class<?>[] {  });
+               Object retObj = getSaturation();
+               rmiObj.sendReturnObj(retObj);
+       }
+
+       public void ___getTemperature() throws IOException {
+               Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] {  }, 
+               new Class<?>[] {  });
+               Object retObj = getTemperature();
+               rmiObj.sendReturnObj(retObj);
+       }
+
+       public void ___getBrightnessRangeLowerBound() throws IOException {
+               Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] {  }, 
+               new Class<?>[] {  });
+               Object retObj = getBrightnessRangeLowerBound();
+               rmiObj.sendReturnObj(retObj);
+       }
+
+       public void ___getBrightnessRangeUpperBound() throws IOException {
+               Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] {  }, 
+               new Class<?>[] {  });
+               Object retObj = getBrightnessRangeUpperBound();
+               rmiObj.sendReturnObj(retObj);
+       }
+
+       public void ___getHueRangeLowerBound() throws IOException {
+               Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] {  }, 
+               new Class<?>[] {  });
+               Object retObj = getHueRangeLowerBound();
+               rmiObj.sendReturnObj(retObj);
+       }
+
+       public void ___getHueRangeUpperBound() throws IOException {
+               Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] {  }, 
+               new Class<?>[] {  });
+               Object retObj = getHueRangeUpperBound();
+               rmiObj.sendReturnObj(retObj);
+       }
+
+       public void ___getSaturationRangeLowerBound() throws IOException {
+               Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] {  }, 
+               new Class<?>[] {  });
+               Object retObj = getSaturationRangeLowerBound();
+               rmiObj.sendReturnObj(retObj);
+       }
+
+       public void ___getSaturationRangeUpperBound() throws IOException {
+               Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] {  }, 
+               new Class<?>[] {  });
+               Object retObj = getSaturationRangeUpperBound();
+               rmiObj.sendReturnObj(retObj);
+       }
+
+       public void ___getTemperatureRangeLowerBound() throws IOException {
+               Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] {  }, 
+               new Class<?>[] {  });
+               Object retObj = getTemperatureRangeLowerBound();
+               rmiObj.sendReturnObj(retObj);
+       }
+
+       public void ___getTemperatureRangeUpperBound() throws IOException {
+               Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] {  }, 
+               new Class<?>[] {  });
+               Object retObj = getTemperatureRangeUpperBound();
+               rmiObj.sendReturnObj(retObj);
+       }
+
+       private void ___waitRequestInvokeMethod() throws IOException {
+               while (true) {
+                       rmiObj.getMethodBytes();
+                       int _objectId = rmiObj.getObjectId();
+                       int methodId = rmiObj.getMethodId();
+                       if (_objectId == object0Id) {
+                               if (!set0Allowed.contains(methodId)) {
+                                       throw new Error("Object with object Id: " + _objectId + "  is not allowed to access method: " + methodId);
+                               }
+                       }
+                       else {
+                               throw new Error("Object Id: " + _objectId + " not recognized!");
+                       }
+                       switch (methodId) {
+                               case 0: ___init(); break;
+                               case 1: ___turnOff(); break;
+                               case 2: ___turnOn(); break;
+                               case 3: ___getState(); break;
+                               case 4: ___setColor(); break;
+                               case 5: ___setTemperature(); break;
+                               case 6: ___getBrightness(); break;
+                               case 7: ___getHue(); break;
+                               case 8: ___getSaturation(); break;
+                               case 9: ___getTemperature(); break;
+                               case 10: ___getBrightnessRangeLowerBound(); break;
+                               case 11: ___getBrightnessRangeUpperBound(); break;
+                               case 12: ___getHueRangeLowerBound(); break;
+                               case 13: ___getHueRangeUpperBound(); break;
+                               case 14: ___getSaturationRangeLowerBound(); break;
+                               case 15: ___getSaturationRangeUpperBound(); break;
+                               case 16: ___getTemperatureRangeLowerBound(); break;
+                               case 17: ___getTemperatureRangeUpperBound(); break;
+                               default: 
+                               throw new Error("Method Id " + methodId + " not recognized!");
+                       }
+               }
+       }
+
+}
diff --git a/benchmarks/drivers/Makefile b/benchmarks/drivers/Makefile
new file mode 100644 (file)
index 0000000..1a1a0a0
--- /dev/null
@@ -0,0 +1,23 @@
+BASE = ../..
+
+include $(BASE)/common.mk
+
+BOOFDIR := ../libs/boofcv_libs
+BOOFJARS := $(BOOFDIR)/BoofCV-feature-0.21.jar:$(BOOFDIR)/BoofCV-io-0.21.jar:$(BOOFDIR)/BoofCV-visualize-0.21.jar:$(BOOFDIR)/BoofCV-ip-0.21.jar
+JLAYERDIR := ../libs/jlayer_libs
+JLAYERJARS := $(JLAYERDIR)/jl1.0.1.jar
+JFLAGS = -d $(BIN_DIR) -cp $(BIN_DIR):$(PHONEJARS):$(BOOFJARS):$(JLAYERJARS)
+JARFLAGS = cf
+INTFACE_DIR = iotcode/interfaces
+
+all: light
+
+# Compile
+#
+PHONY += light
+light:
+       $(JAVAC) $(JFLAGS) LifxLightBulb/*.java
+       cp LifxLightBulb/LifxLightBulb.config $(BIN_DIR)/iotcode/LifxLightBulb
+       cd $(BIN_DIR)/iotcode/LifxLightBulb; $(JAR) $(JARFLAGS) LifxLightBulb.jar ../../iotcode/LifxLightBulb/*.class ../../iotcode/interfaces/LightBulb*.class
+
+.PHONY: $(PHONY)
diff --git a/benchmarks/interfaces/LightBulb.java b/benchmarks/interfaces/LightBulb.java
new file mode 100644 (file)
index 0000000..2d7c928
--- /dev/null
@@ -0,0 +1,25 @@
+package iotcode.interfaces;
+
+import java.util.List;
+import java.util.ArrayList;
+
+public interface LightBulb {
+       public void init();
+       public void turnOff();
+       public void turnOn();
+       public boolean getState();
+       public void setColor(double _hue, double _saturation, double _brightness);
+       public void setTemperature(int _temperature);
+       public double getBrightness();
+       public double getHue();
+       public double getSaturation();
+       public int getTemperature();
+       public double getBrightnessRangeLowerBound();
+       public double getBrightnessRangeUpperBound();
+       public double getHueRangeLowerBound();
+       public double getHueRangeUpperBound();
+       public double getSaturationRangeLowerBound();
+       public double getSaturationRangeUpperBound();
+       public int getTemperatureRangeLowerBound();
+       public int getTemperatureRangeUpperBound();
+}
diff --git a/benchmarks/interfaces/LightBulbTest.java b/benchmarks/interfaces/LightBulbTest.java
new file mode 100644 (file)
index 0000000..2d19f6e
--- /dev/null
@@ -0,0 +1,18 @@
+package iotcode.interfaces;
+
+import java.util.List;
+import java.util.ArrayList;
+
+public interface LightBulbTest {
+
+       public void turnOn();
+       public double getBrightness();
+       public void turnOff();
+       public boolean getState();
+       public void setColor(double _hue, double _saturation, double _brightness);
+       public double getSaturation();
+       public void init();
+       public void setTemperature(int _temperature);
+       public double getHue();
+       public int getTemperature();
+}
diff --git a/benchmarks/interfaces/Makefile b/benchmarks/interfaces/Makefile
new file mode 100755 (executable)
index 0000000..53c2b9c
--- /dev/null
@@ -0,0 +1,13 @@
+BASE = ../..
+
+include $(BASE)/common.mk
+
+JFLAGS = -d $(BIN_DIR) -cp $(BIN_DIR):.
+
+all: interfaces
+
+PHONY += interfaces
+interfaces:
+       $(JAVAC) $(JFLAGS) *.java
+
+.PHONY: $(PHONY)
diff --git a/benchmarks/original_interfaces/Camera.java b/benchmarks/original_interfaces/Camera.java
new file mode 100644 (file)
index 0000000..cc5cfb4
--- /dev/null
@@ -0,0 +1,145 @@
+package iotcode.interfaces;
+
+// Standard Java Packages
+import java.util.ArrayList;
+import java.awt.image.BufferedImage;
+import java.util.Date;
+import java.util.List;
+import java.util.ArrayList;
+
+//RMI packages
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+// Checker annotations
+import iotchecker.qual.NonLocalRemote;
+
+/** Class Camera interface for camera devices.
+ *  This Interface supports single lens cameras, can only produce 1 frame at a time
+ *
+ * @author      Ali Younis <ayounis @ uci.edu>
+ * @version     1.0
+ * @since       2016-01-27
+ */
+
+public interface Camera extends Remote {
+
+       /** Enumeration of the standard resolutions supported by general cameras
+        *
+        */
+       public enum Resolution {
+               RES_1080P,
+               RES_720P,
+               RES_VGA
+       };
+
+
+       /** Method to get the latest image frame data of the camera.
+        *
+        *   @param None.
+        *
+        *   @return [byte[]] Image frame byte data of buffered image.
+        */
+       public byte[] getLatestFrame() throws RemoteException;
+
+
+       /** Method to get the time-stamp of when the image was taken.
+        *
+        *   @param None.
+        *
+        *   @return [Date] Time-stamp of when the image was taken.
+        */
+       public Date getTimestamp() throws RemoteException;
+
+       /** Method to start the camera.
+        *
+        *   @param None.
+        *
+        *   @return None
+        */
+       public void start() throws RemoteException;
+
+
+       /** Method to stop the camera.
+        *
+        *   @param None.
+        *
+        *   @return None
+        */
+       public void stop() throws RemoteException;
+
+       /** Method to set the resolution of the camera.
+        *
+        *   @param _res [Camera.Resolution]: the new resolution of the camera
+        *
+        *   @return true if the resolution was set
+        */
+       public boolean setResolution(Camera.Resolution _res) throws RemoteException;
+
+
+       /** Method to set the frames per second of the camera.
+        *
+        *   @param _fps [int]: the new frames per second of the camera
+        *
+        *   @return true if the frames per second was set
+        */
+       public boolean setFPS(int _fps) throws RemoteException;
+
+
+       /** Method to get the max supported frames per second by the camera.
+        *
+        *   @param None.
+        *
+        *   @return [int] the max frames per second supported by the camera.
+        */
+       public int getMaxFPS() throws RemoteException;
+
+
+       /** Method to get the min supported frames per second by the camera.
+        *
+        *   @param None.
+        *
+        *   @return [int] the min frames per second supported by the camera.
+        */
+       public int getMinFPS() throws RemoteException;
+
+
+       /** Method to get the supported resolutions of the camera.
+        *
+        *   @param None.
+        *
+        *   @return [List<Camera.Resolution>] the supported resolutions of the camera.
+        */
+       public List<Camera.Resolution> getSupportedResolutions() throws RemoteException;
+
+
+       /** Register an object to retrieve callbacks when new camera data is available.
+        *
+        *   @param _callbackTo [CameraCallback].
+        *
+        *   @return [void] None.
+        */
+       public void registerCallback(@NonLocalRemote CameraCallback _callbackTo) throws RemoteException;
+
+
+       /** Method to initialize the camera, if the bulb needs to be camera.
+        *
+        *   @return [void] None.
+        */
+       public void init() throws RemoteException;
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/benchmarks/original_interfaces/CameraCallback.java b/benchmarks/original_interfaces/CameraCallback.java
new file mode 100644 (file)
index 0000000..19bcf3d
--- /dev/null
@@ -0,0 +1,28 @@
+package iotcode.interfaces;
+
+// RMI Packages
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+// Checker annotations
+import iotchecker.qual.NonLocalRemote;
+
+/** Camera Callback for when a camera changes state (new frame available).
+ *
+ * @author      Ali Younis <ayounis @ uci.edu>
+ * @version     1.0
+ * @since       2016-01-27
+ */
+
+public interface CameraCallback extends Remote {
+
+       /** Callback method for when a new camera frame is available.
+        *   Called when a new frame is ready by the camera and the camera
+        *   can be checked for the frame data.
+        *
+        *   @param _camera [Camera] .
+        *
+        *   @return [void] None.
+        */
+       public void newCameraFrameAvailable(@NonLocalRemote Camera _camera) throws RemoteException;
+}
diff --git a/benchmarks/original_interfaces/GPSGateway.java b/benchmarks/original_interfaces/GPSGateway.java
new file mode 100644 (file)
index 0000000..007f856
--- /dev/null
@@ -0,0 +1,99 @@
+package iotcode.interfaces;
+
+//RMI packages
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+// Checker annotations
+import iotchecker.qual.NonLocalRemote;
+
+/** Gateway public interface, e.g. for PhoneGateway
+ *
+ * @author      Rahmadi Trimananda <rahmadi.trimananda @ uci.edu>
+ * @version     1.0                
+ * @since       2016-04-27
+ */
+
+public interface GPSGateway extends Remote {
+
+       /** Method to start the gateway.
+        *
+        *   @param None.
+        *
+        *   @return None
+        */
+       public void start() throws RemoteException;
+
+
+       /** Method to stop the gateway.
+        *
+        *   @param None.
+        *
+        *   @return None
+        */
+       public void stop() throws RemoteException;
+
+
+       /** Method to initialize the gateway.
+        *
+        *   @return [void] None.
+        */
+       public void init() throws RemoteException;
+
+
+       /** Register an object to retrieve callbacks when new data is available.
+        *
+        *   @param _callbackTo [PhoneGatewayCallback].
+        *
+        *   @return [void] None.
+        */
+       public void registerCallback(@NonLocalRemote GPSGatewayCallback _callbackTo) throws RemoteException;
+
+
+       /** Get room identifier
+        *
+        *   @param None.
+        *
+        *   @return [int] Room identifier.
+        */
+       public int getRoomID() throws RemoteException;
+
+
+       /** Get ring status
+        *
+        *   @param None.
+        *
+        *   @return [boolean] Ring status (true/false).
+        */
+       public boolean getRingStatus() throws RemoteException;
+
+       /** Set boolean of new room identifier availability
+        *
+        *   @param [boolean] Room identifier availability (true if there is new room ID)
+        *
+        *   @return [void] None.
+        */
+       public void setNewRoomIDAvailable(boolean bValue) throws RemoteException;
+
+       /** Set boolean of new ring status availability
+        *
+        *   @param [boolean] Ring status availability (true if there is new ring status)
+        *
+        *   @return [void] None.
+        */
+       public void setNewRingStatusAvailable(boolean bValue) throws RemoteException;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/benchmarks/original_interfaces/GPSGatewayCallback.java b/benchmarks/original_interfaces/GPSGatewayCallback.java
new file mode 100644 (file)
index 0000000..52f4a7c
--- /dev/null
@@ -0,0 +1,32 @@
+package iotcode.interfaces;
+
+// RMI Packages
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+// Checker annotations
+import iotchecker.qual.NonLocalRemote;
+
+/** Interface GPSGatewayCallback for allowing callbacks from the GPSGateway class.
+ *
+ * @author      Rahmadi Trimananda <rahmadi.trimananda @ uci.edu>
+ * @version     1.0                
+ * @since       2016-04-28
+ */
+
+public interface GPSGatewayCallback extends Remote {
+
+       /** Callback method for when room ID is retrieved.
+        *
+        * @param _wgw [GPSGateway].
+        * @return [void] None.
+        */
+       public void newRoomIDRetrieved(@NonLocalRemote GPSGateway _wgw) throws RemoteException;
+
+       /** Callback method for when ring status is retrieved.
+        *
+        * @param _wgw [GPSGateway].
+        * @return [void] None.
+        */
+       public void newRingStatusRetrieved(@NonLocalRemote GPSGateway _wgw) throws RemoteException;
+}
diff --git a/benchmarks/original_interfaces/LEDFlasher.java b/benchmarks/original_interfaces/LEDFlasher.java
new file mode 100644 (file)
index 0000000..7647f8f
--- /dev/null
@@ -0,0 +1,32 @@
+package iotcode.interfaces;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/** Class LEDFlasher interface for LEDFlasher Brillo devices.
+ *  <p>
+ *  This interface is generated by IoTBrilloWeaveCodeGenerator.
+ *  These comments were added after code generation.
+ *
+ * @author      Rahmadi Trimananda <rtrimana @ uci.edu>
+ * @version     1.0
+ * @since       2016-06-13
+ */
+public interface LEDFlasher extends Remote {
+
+       public void init() throws RemoteException;
+       public void _accessControlBlackList_block(String applicationId, Integer expirationTimeoutSec, String userId) throws RemoteException;
+       public void _accessControlBlackList_list() throws RemoteException;
+       public void _accessControlBlackList_unblock(String applicationId, String userId) throws RemoteException;
+       public void _ledflasher_animate(Float duration, String type) throws RemoteException;
+       public void _metrics_disableAnalyticsReporting() throws RemoteException;
+       public void _metrics_enableAnalyticsReporting() throws RemoteException;
+       public void _updater_checkForUpdates() throws RemoteException;
+       public void _updater_trackChannel(String channel) throws RemoteException;
+       public void base_identify() throws RemoteException;
+       public void base_reboot() throws RemoteException;
+       public void base_updateBaseConfiguration(String localAnonymousAccessMaxRole, Boolean localDiscoveryEnabled, Boolean localPairingEnabled) throws RemoteException;
+       public void base_updateDeviceInfo(String description, String location, String name) throws RemoteException;
+       public void onOff_setConfig(String state) throws RemoteException;
+       
+}
diff --git a/benchmarks/original_interfaces/Lawn.java b/benchmarks/original_interfaces/Lawn.java
new file mode 100644 (file)
index 0000000..3f2eeb7
--- /dev/null
@@ -0,0 +1,8 @@
+package iotcode.interfaces;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+public interface Lawn extends Remote {
+
+}
diff --git a/benchmarks/original_interfaces/LightBulb.java b/benchmarks/original_interfaces/LightBulb.java
new file mode 100644 (file)
index 0000000..368696e
--- /dev/null
@@ -0,0 +1,165 @@
+package iotcode.interfaces;
+
+// RMI Packages
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/** Class LightBulb interface for the light bulb devices.
+ *
+ * @author      Ali Younis <ayounis @ uci.edu>
+ * @version     1.0
+ * @since       2016-01-27
+ */
+
+
+public interface LightBulb extends Remote {
+
+       /** Method to turn the light bulb on (Physically illuminate the area).
+        *
+        *   @param None.
+        *
+        *   @return [void] None.
+        */
+
+       public void turnOff() throws RemoteException;
+
+       /** Method to turn the light bulb off.
+        *
+        *   @return [void] None.
+        */
+       public void turnOn() throws RemoteException;
+
+
+       /** Method to get the current on/off state of the light bulb.
+        *
+        *   @return [boolean] True means bulb on.
+        */
+       public boolean getState() throws RemoteException;
+
+
+       /** Method to set the light bulb color using Standard Hue, Saturation and Brightness
+        * conventions. See "http://www.tydac.ch/color/" for reference.
+        *
+        *   @param _hue [double]: Hue value (in degrees).
+        *   @param _saturation [double]: Saturation value (percentage).
+        *   @param _brightness [double]: Brightness value (percentage).
+        *
+        *   @return [void] None.
+        */
+       public void setColor(double _hue, double _saturation, double _brightness) throws RemoteException;
+
+
+       /** Method to set the color temperature.
+        *
+        *   @param _temperature [int]: Color temperature in degrees kelvin.
+        *
+        *   @return [void] None.
+        */
+       public void setTemperature(int _temperature) throws RemoteException;
+
+
+       /** Method to get the current hue value of the bulb.
+        *
+        *   @return [double] Current hue value of the bulb in degrees.
+        */
+       public double getHue() throws RemoteException;
+
+
+       /** Method to get the current saturation value of the bulb.
+        *
+        *   @return [double] Current saturation value of the bulb as a percentage.
+        */
+       public double getSaturation() throws RemoteException;
+
+
+       /** Method to get the current brightness value of the bulb.
+        *
+        *   @return [double] Current brightness value of the bulb as a percentage.
+        */
+       public double getBrightness() throws RemoteException;
+
+
+       /** Method to get the current color temperature value of the bulb.
+        *
+        *   @return [double] Current color temperature value of the bulb in kelvin.
+        */
+       public int getTemperature() throws RemoteException;
+
+
+       /** Method to get the hue range lower bound supported by the bulb.
+        *
+        *   @return [double] Hue lower bound in degrees.
+        */
+       public double getHueRangeLowerBound() throws RemoteException;
+
+
+       /** Method to get the hue range upper bound supported by the bulb.
+        *
+        *   @return [double] Hue upper bound in degrees.
+        */
+       public double getHueRangeUpperBound() throws RemoteException;
+
+
+       /** Method to get the saturation range lower bound supported by the bulb.
+        *
+        *   @return [double] Saturation lower bound as a percentage.
+        */
+       public double getSaturationRangeLowerBound() throws RemoteException;
+
+
+       /** Method to get the saturation range upper bound supported by the bulb.
+        *
+        *   @return [double] Saturation upper bound as a percentage.
+        */
+       public double getSaturationRangeUpperBound() throws RemoteException;
+
+
+       /** Method to get the brightness range lower bound supported by the bulb.
+        *
+        *   @return [double] Brightness lower bound as a percentage.
+        */
+       public double getBrightnessRangeLowerBound() throws RemoteException;
+
+
+       /** Method to get the brightness range upper bound supported by the bulb.
+        *
+        *   @return [double] Brightness upper bound as a percentage.
+        */
+       public double getBrightnessRangeUpperBound() throws RemoteException;
+
+
+       /** Method to get the temperature range lower bound supported by the bulb.
+        *
+        *   @return [int] Temperature lower bound as a percentage.
+        */
+       public int getTemperatureRangeLowerBound() throws RemoteException;
+
+
+       /** Method to get the temperature range upper bound supported by the bulb.
+        *
+        *   @return [int] Temperature upper bound as a percentage.
+        */
+       public int getTemperatureRangeUpperBound() throws RemoteException;
+
+
+       /** Method to initialize the bulb, if the bulb needs to be initialized.
+        *
+        *   @return [void] None.
+        */
+       public void init() throws RemoteException;
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/benchmarks/original_interfaces/Makefile b/benchmarks/original_interfaces/Makefile
new file mode 100755 (executable)
index 0000000..e03361e
--- /dev/null
@@ -0,0 +1,23 @@
+BASE = ../..
+
+include $(BASE)/common.mk
+
+JFLAGS = -d $(BIN_DIR) -cp $(BIN_DIR):$(CHECKERJARS):.
+
+# checker option
+#
+CHECKER_OPT = -processor iotchecker.IoTJavaChecker
+
+ASTUBS = -Astubs=../../checker/astubs/ 
+
+all: check
+
+PHONY += check
+check:
+       $(JAVAC) $(JFLAGS) $(CHECKER_OPT) $(ASTUBS) *.java
+
+PHONY += nocheck
+nocheck:
+       $(JAVAC) $(JFLAGS) *.java
+
+.PHONY: $(PHONY)
diff --git a/benchmarks/original_interfaces/MoistureSensor.java b/benchmarks/original_interfaces/MoistureSensor.java
new file mode 100644 (file)
index 0000000..d2879e1
--- /dev/null
@@ -0,0 +1,66 @@
+package iotcode.interfaces;
+
+// Standard Java Packages
+import java.util.Date;
+
+//RMI packages
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+// Checker annotations
+import iotchecker.qual.*;
+
+
+/** Class Moisture sensor interface for Moisture sensor devices.
+ *
+ * @author      Ali Younis <ayounis @ uci.edu>
+ * @version     1.0
+ * @since       2016-04-19
+ */
+public interface MoistureSensor extends Remote {
+
+       /** Method to get the latests moisture reading from the sensor
+        *
+        *   @return [float] Moisture as a percentage.
+        */
+       public float getMoisture() throws RemoteException;
+
+
+       /** Method to get the latests moisture reading timestamp from the sensor
+        *
+        *   @return [Date] timestamp of latest moisture reading, null if no reading occurred yet.
+        */
+       public Date getTimestampOfLastReading() throws RemoteException;
+
+
+       /** Method to initialize the moisture sensor.
+        *
+        *   @param None.
+        *
+        *   @return [void] None.
+        */
+       public void init() throws RemoteException;
+
+
+       /** Register an object to retrieve callbacks when new sensor reading is available
+        *
+        *   @param _callbackTo [MoistureSensorCallback].
+        *
+        *   @return [void] None.
+        */
+       public void registerCallback(@NonLocalRemote MoistureSensorCallback _callbackTo) throws RemoteException;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/benchmarks/original_interfaces/MoistureSensorCallback.java b/benchmarks/original_interfaces/MoistureSensorCallback.java
new file mode 100644 (file)
index 0000000..6a9d21e
--- /dev/null
@@ -0,0 +1,29 @@
+package iotcode.interfaces;
+
+// RMI Packages
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+// Checker annotations
+import iotchecker.qual.*;
+
+
+/** Camera Callback for when a camera changes state (new frame available).
+ *
+ * @author      Ali Younis <ayounis @ uci.edu>
+ * @version     1.0
+ * @since       2016-01-27
+ */
+
+public interface MoistureSensorCallback extends Remote {
+
+       /** Callback method for when a new moisture reading is available.
+        *   Called when a new reading is ready by the sensor and the sensor
+        *   can be checked for the frame data.
+        *
+        *   @param _sensor [MoistureSensor] .
+        *
+        *   @return [void] None.
+        */
+       public void newReadingAvailable(@NonLocalRemote MoistureSensor _sensor) throws RemoteException;
+}
diff --git a/benchmarks/original_interfaces/Room.java b/benchmarks/original_interfaces/Room.java
new file mode 100644 (file)
index 0000000..e907c8e
--- /dev/null
@@ -0,0 +1,21 @@
+package iotcode.interfaces;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/** Interface Room for all room implementations
+ *
+ * @author      Ali Younis <ayounis @ uci.edu>
+ * @version     1.0                
+ * @since       2016-01-27
+ */
+public interface Room extends Remote {
+
+       /** Method to return room ID.
+        *
+        *   @param None.
+        *
+        *   @return [int] Room identifier.
+        */
+       public int getRoomID() throws RemoteException;
+}
diff --git a/benchmarks/original_interfaces/Speaker.java b/benchmarks/original_interfaces/Speaker.java
new file mode 100644 (file)
index 0000000..891e722
--- /dev/null
@@ -0,0 +1,109 @@
+package iotcode.interfaces;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+// Checker annotations
+import iotchecker.qual.NonLocalRemote;
+
+/** Speaker Interface Class
+ *
+ * @author      Rahmadi Trimananda <rahmadi.trimananda @ uci.edu>
+ * @version     1.0
+ * @since       2016-04-29
+ */
+public interface Speaker extends Remote {
+
+       /** Init method
+        *
+        *   @param None.
+        *
+        *   @return [void] None.
+        */
+    public void init() throws RemoteException;
+
+       /** Method to start playback
+        *
+        *   @param None.
+        *
+        *   @return [boolean] True/false to start playback.
+        */
+    public boolean startPlayback() throws RemoteException;
+
+       /** Method to stop playback
+        *
+        *   @param None.
+        *
+        *   @return [boolean] True/false to stop playback.
+        */
+    public boolean stopPlayback() throws RemoteException;
+
+
+       /** Method to getPlaybackState
+        *
+        *   @param None.
+        *
+        *   @return [boolean] True/false of playback state
+        */
+    public boolean getPlaybackState() throws RemoteException;
+
+       /** Method to set volume
+        *
+        *   @param [float] Volume percentage.
+        *
+        *   @return [boolean] True/false to set volume.
+        */
+    public boolean setVolume(float _percent) throws RemoteException;
+
+       /** Method to get volume
+        *
+        *   @param None.
+        *
+        *   @return [float] Volume percentage.
+        */
+    public float getVolume() throws RemoteException;
+
+       /** Method to get position in the song
+        *
+        *   @param None.
+        *
+        *   @return [int] Position in the song when playing music.
+        */
+    public int getPosition()throws RemoteException;
+
+       /** Method to set position
+        *
+        *   @param [int] Position to set (in milliseconds)
+        *
+        *   @return [void] None.
+        */
+    public void setPosition(int _mSec) throws RemoteException;
+
+       /** Method to set position
+        *
+        *   @param [short[]] Sample packets from music file
+        *   @param [int] Offset
+        *   @param [int] Length
+        *
+        *   @return [void] None.
+        */
+    public void loadData(short[] _samples, int _offs, int _len) throws RemoteException;
+
+
+       /** Method to clear all pcm data
+        *
+        *   @param None
+        *
+        *   @return [void] None.
+        */
+    public void clearData() throws RemoteException;
+
+
+       /** Method to register callbacks
+        *
+        *   @param [SpeakerCallback] Callback object
+        *
+        *   @return [void] None.
+        */
+    public void registerCallback(@NonLocalRemote SpeakerCallback _cb) throws RemoteException;
+}
diff --git a/benchmarks/original_interfaces/SpeakerCallback.java b/benchmarks/original_interfaces/SpeakerCallback.java
new file mode 100644 (file)
index 0000000..e1ffedb
--- /dev/null
@@ -0,0 +1,26 @@
+package iotcode.interfaces;
+
+// RMI Packages
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+// Checker annotations
+import iotchecker.qual.NonLocalRemote;
+
+/** speaker Callback for when a speaker changes state (sound ends).
+ *
+ * @author      Ali Younis <ayounis @ uci.edu>
+ * @version     1.0
+ * @since       2016-01-27
+ */
+
+public interface SpeakerCallback extends Remote {
+
+       /** Callback method for when speaker music ends.
+        *
+        *   @param _speaker [speaker] .
+        *
+        *   @return [void] None.
+        */
+       public void speakerDone(@NonLocalRemote Speaker _speaker) throws RemoteException;
+}
diff --git a/benchmarks/original_interfaces/Sprinkler.java b/benchmarks/original_interfaces/Sprinkler.java
new file mode 100644 (file)
index 0000000..0a21905
--- /dev/null
@@ -0,0 +1,84 @@
+package iotcode.interfaces;
+
+
+// Standard Java Packages
+import java.util.ArrayList;
+import java.awt.image.BufferedImage;
+import java.util.Date;
+import java.util.List;
+import java.util.ArrayList;
+
+//RMI packages
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+
+
+/** Class Sprinkler interface for sprinkler devices.
+ *
+ * @author      Ali Younis <ayounis @ uci.edu>
+ * @version     1.0
+ * @since       2016-03-31
+ */
+public interface Sprinkler extends Remote {
+
+       /** Method to set the state of a specified zone
+        *
+        *   @param _zone [int]             : zone number to set.
+        *   @param _onOff [boolean]        : the state to set the zone to, on or off.
+        *   @param _onDurationSeconds [int]: the duration to set the state on to, if -1 then infinite.
+        *
+        *   @return [void] None.
+        */
+       public void setZone(int _zone, boolean _onOff, int _onDurationSeconds) throws RemoteException;
+
+
+       /** Method to get the current state of all the zones.
+        *
+        *   @param None.
+        *
+        *   @return [List<ZoneState>] list of the states for the zones.
+        */
+       public List<ZoneState> getZoneStates() throws RemoteException;
+
+
+       /** Method to get the number of zones this sprinkler can control.
+        *
+        *   @param None.
+        *
+        *   @return [int] number of zones that can be controlled.
+        */
+       public int getNumberOfZones() throws RemoteException;
+
+
+       /** Method to get whether or not this sprinkler can control durations.
+        *
+        *   @param None.
+        *
+        *   @return [boolean] boolean if this sprinkler can do durations.
+        */
+       public boolean doesHaveZoneTimers() throws RemoteException;
+
+
+       /** Method to initialize the sprinkler.
+        *
+        *   @param None.
+        *
+        *   @return [void] None.
+        */
+       public void init() throws RemoteException;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/benchmarks/original_interfaces/WeatherGateway.java b/benchmarks/original_interfaces/WeatherGateway.java
new file mode 100644 (file)
index 0000000..247cf96
--- /dev/null
@@ -0,0 +1,101 @@
+package iotcode.interfaces;
+
+//RMI packages
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+// Checker annotations
+import iotchecker.qual.NonLocalRemote;
+
+/** Gateway public interface, e.g. for PhoneGateway
+ *
+ * @author      Rahmadi Trimananda <rahmadi.trimananda @ uci.edu>
+ * @version     1.0                
+ * @since       2016-04-26
+ */
+
+public interface WeatherGateway extends Remote {
+
+       /** Method to start the gateway.
+        *
+        *   @param None.
+        *
+        *   @return None
+        */
+       public void start() throws RemoteException;
+
+
+       /** Method to stop the gateway.
+        *
+        *   @param None.
+        *
+        *   @return None
+        */
+       public void stop() throws RemoteException;
+
+
+       /** Method to initialize the gateway.
+        *
+        *   @return [void] None.
+        */
+       public void init() throws RemoteException;
+
+
+       /** Register an object to retrieve callbacks when new data is available.
+        *
+        *   @param _callbackTo [WeatherGatewayCallback].
+        *
+        *   @return [void] None.
+        */
+       public void registerCallback(@NonLocalRemote WeatherGatewayCallback _callbackTo) throws RemoteException;
+
+
+       /** Get inches per week data
+        *
+        *   @param None.
+        *
+        *   @return [double] Rainfall (inches per week).
+        */
+       public double getInchesPerWeek() throws RemoteException;
+
+
+       /** Get weather area zip code
+        *
+        *   @param None.
+        *
+        *   @return [int] Area zipcode.
+        */
+       public int getWeatherZipCode() throws RemoteException;
+
+
+       /** Days to keep watering the lawns
+        *
+        *   @param None.
+        *
+        *   @return [int] Number of days.
+        */
+       public int getDaysToWaterOn() throws RemoteException;
+
+
+       /** Get inches per minute data
+        *
+        *   @param None.
+        *
+        *   @return [double] Rainfall (inches per minute).
+        */
+       public double getInchesPerMinute() throws RemoteException;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/benchmarks/original_interfaces/WeatherGatewayCallback.java b/benchmarks/original_interfaces/WeatherGatewayCallback.java
new file mode 100644 (file)
index 0000000..0ffc3ff
--- /dev/null
@@ -0,0 +1,25 @@
+package iotcode.interfaces;
+
+// RMI Packages
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+// Checker annotations
+import iotchecker.qual.NonLocalRemote;
+
+/** Interface WeatherGatewayCallback for allowing callbacks from the PhoneGateway class.
+ *
+ * @author      Rahmadi Trimananda <rahmadi.trimananda @ uci.edu>
+ * @version     1.0                
+ * @since       2016-04-26
+ */
+
+public interface WeatherGatewayCallback extends Remote {
+
+       /** Callback method for when the information is retrieved.
+        *
+        * @param _wgw [WeatherGateway].
+        * @return [void] None.
+        */
+       public void informationRetrieved(@NonLocalRemote WeatherGateway _wgw) throws RemoteException;
+}
diff --git a/benchmarks/original_interfaces/ZoneState.java b/benchmarks/original_interfaces/ZoneState.java
new file mode 100644 (file)
index 0000000..85894e3
--- /dev/null
@@ -0,0 +1,51 @@
+package iotcode.interfaces;
+
+public class ZoneState {
+       private int zoneNumber = 0;
+       private boolean onOffState = false;
+       private int duration = -1;
+
+       public ZoneState(int _zoneNumber, boolean _onOffState, int _duration) {
+               zoneNumber = _zoneNumber;
+               onOffState = _onOffState;
+               duration = _duration;
+       }
+
+       public int getZoneNumber() {
+               return zoneNumber;
+       }
+
+       public boolean getOnOffState() {
+               return onOffState;
+       }
+
+       public int getDuration() {
+               return duration;
+       }
+
+       public void setOnOffState(boolean _onOffState) {
+               onOffState = _onOffState;
+       }
+
+       public void setDuration(int _duration) {
+               duration = _duration;
+       }
+
+
+
+       public String toString() {
+               String retString = "Zone Number: ";
+               retString += Integer.toString(zoneNumber);
+               retString += "\t On/Off State: ";
+
+               if (onOffState) {
+                       retString += "On";
+               } else {
+                       retString += "Off";
+               }
+               retString += "\t Duration: ";
+               retString += Integer.toString(duration);
+
+               return retString;
+       }
+}
diff --git a/config/iotpolicy/callbackpolicy.pol b/config/iotpolicy/callbackpolicy.pol
deleted file mode 100644 (file)
index 947b899..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-public interface CallBackInterface {
-
-    public int printInt();
-    public void setInt(int _i);
-
-       capability CallBack {
-               description = "The quick brown fox jumps over the smart dog";
-               description = "Another description";
-               method = "printInt()";
-               method = "setInt(int _i)";
-       }
-}
-
-
diff --git a/config/iotpolicy/callbackrequires.pol b/config/iotpolicy/callbackrequires.pol
deleted file mode 100644 (file)
index 96126d3..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-requires CallBackInterface with CallBack as interface CallBackInterfaceWithCallBack;
-
diff --git a/config/iotpolicy/camerapolicy.pol b/config/iotpolicy/camerapolicy.pol
deleted file mode 100644 (file)
index ca807b6..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-public interface Camera {
-
-    public List<Float> MethodA(int A, int B);
-    public void MethodA(int A, int B, int AB);
-    public int MethodB(int C, String D[]);
-    public String MethodC(String E, List<Integer> F);
-    public float MethodD(List<String> G, float H);
-    public boolean MethodE(String I, boolean J);
-       public void MethodF(LightBulb K);
-       public Enum MethodG(Enum L);
-       public Struct MethodH(Struct M, int N);
-
-       capability ImageCapture {
-               description = "The quick brown fox jumps over the smart dog";
-               description = "Another description";
-               method = "MethodA(int A, int B)";
-               method = "MethodB(int C, String D[])";
-               method = "MethodC(String E, List<Integer> F)";
-               method = "MethodF(LightBulb K)";
-               method = "MethodG(Enum L)";
-               method = "MethodH(Struct M, int N)";
-       }
-
-       capability VideoRecording {
-               description = "The quick brown fox jumps over the cool dog";
-               method = "MethodA(int A, int B)";
-               method = "MethodA(int A, int B, int AB)";
-               method = "MethodD(List<String> G, float H)";
-       }
-
-       capability BackupData {
-               description = "The quick brown fox jumps over the clever dog";
-               method = "MethodE(String I, boolean J)";
-       }
-
-       struct Struct {
-
-               string  name;
-               float   value;
-               int     year;
-       } 
-}
-
-
diff --git a/config/iotpolicy/camerarequires.pol b/config/iotpolicy/camerarequires.pol
deleted file mode 100644 (file)
index 90049de..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-requires Camera with ImageCapture, BackupData as interface CameraWithCaptureAndData;
-
diff --git a/config/iotpolicy/enum.pol b/config/iotpolicy/enum.pol
deleted file mode 100644 (file)
index c9e85b6..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-
-enum Enum {
-
-       APPLE,
-       ORANGE,
-       GRAPE
-} 
diff --git a/config/iotpolicy/lightbulbpolicy.pol b/config/iotpolicy/lightbulbpolicy.pol
deleted file mode 100644 (file)
index b879626..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-public interface LightBulb {
-
-    public void MethodA(int A, float B);
-    public void MethodA(int A, float B, int AB);
-    public int MethodB(String C, String D);
-    public byte MethodC(String E, List<Integer> F);
-
-       capability Flicker {
-               description = "The quick brown fox jumps over the smart dog";
-               description = "Another description";
-               method = "MethodA(int A, float B)";
-               method = "MethodB(String C, String D)";
-               method = "MethodC(String E, List<Integer> F)";
-       }
-
-       capability AutoOnOff {
-               description = "The quick brown fox jumps over the cool dog";
-               method = "MethodA(int A, float B)";
-               method = "MethodA(int A, float B, int AB)";
-               method = "MethodC(String E, List<Integer> F)";
-       }
-
-       enum Enum {
-
-               APPLE,
-               ORANGE,
-               GRAPE,
-               MANGO
-       }
-}
-
-
diff --git a/config/iotpolicy/lightbulbrequires.pol b/config/iotpolicy/lightbulbrequires.pol
deleted file mode 100644 (file)
index 24a7ca1..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-requires LightBulb with Flicker as interface LightBulbWithFlicker;
-
diff --git a/config/iotpolicy/struct.pol b/config/iotpolicy/struct.pol
deleted file mode 100644 (file)
index 9b38ad1..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-
-struct Struct {
-
-       string  name;
-       float   value;
-       int     year;
-} 
diff --git a/config/iotpolicy/testclasspolicy.pol b/config/iotpolicy/testclasspolicy.pol
deleted file mode 100644 (file)
index e7cdc3b..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-public interface TestClassInterface {
-
-       public byte getByte(byte in);
-       public short getShort(short in);
-       public long getLong(long in);
-       public float getFloat(float in);
-       public double getDouble(double in);
-       public boolean getBoolean(boolean in);
-       public char getChar(char in);
-
-       public byte[] getByteArray(byte in[]);
-       public short[] getShortArray(short in[]);
-       public long[] getLongArray(long in[]);
-       public float[] getFloatArray(float in[]);
-       public double[] getDoubleArray(double in[]);
-       public boolean[] getBooleanArray(boolean in[]);
-       public char[] getCharArray(char in[]);
-
-       public List<Byte> getByteList(List<Byte> in);
-       public List<Short> getShortList(List<Short> in);
-       public List<Long> getLongList(List<Long> in);
-       public List<Float> getFloatList(List<Float> in);
-       public List<Double> getDoubleList(List<Double> in);
-       public List<Boolean> getBooleanList(List<Boolean> in);
-       public List<Character> getCharList(List<Character> in);
-
-       public Enum handleEnum(Enum en);
-       public Enum[] handleEnumArray(Enum en[]);
-       public List<Enum> handleEnumList(List<Enum> en);
-       public Enum handleEnumComplex(Enum en, int i, char c);
-
-       public Struct handleStruct(Struct str);
-       public Struct[] handleStructArray(Struct str[]);
-       public List<Struct> handleStructList(List<Struct> str);
-
-       public void registerCallback(CallBackInterface _cb);
-       public void registerCallbackArray(CallBackInterface _cb[]);
-       public void registerCallbackList(List<CallBackInterface> _cb);
-       public int callBack();
-
-       public int getA();
-       public void setA(int _int);
-       public void setB(float _float);
-       public void setC(String _string);
-       public String sumArray(String newA[]);
-       public int setAndGetA(int newA);
-       public int setACAndGetA(String newC, int newA);
-
-       capability Setters {
-               description = "All the set methods";
-               method = "getByte(byte in)";
-               method = "getShort(short in)";
-               method = "getLong(long in)";
-               method = "getFloat(float in)";
-               method = "getDouble(double in)";
-               method = "getBoolean(boolean in)";
-               method = "getChar(char in)";
-               method = "getByteArray(byte in[])";
-               method = "getShortArray(short in[])";
-               method = "getLongArray(long in[])";
-               method = "getFloatArray(float in[])";
-               method = "getDoubleArray(double in[])";
-               method = "getBooleanArray(boolean in[])";
-               method = "getCharArray(char in[])";
-               method = "getByteList(List<Byte> in)";
-               method = "getShortList(List<Short> in)";
-               method = "getLongList(List<Long> in)";
-               method = "getFloatList(List<Float> in)";
-               method = "getDoubleList(List<Double> in)";
-               method = "getBooleanList(List<Boolean> in)";
-               method = "getCharList(List<Character> in)";
-
-               method = "handleEnum(Enum en)";
-               method = "handleEnumArray(Enum en[])";
-               method = "handleEnumList(List<Enum> en)";
-               method = "handleEnumComplex(Enum en, int i, char c)";
-
-               method = "handleStruct(Struct str)";
-               method = "handleStructArray(Struct str[])";
-               method = "handleStructList(List<Struct> str)";
-
-               method = "registerCallback(CallBackInterface _cb)";
-               method = "registerCallbackArray(CallBackInterface _cb[])";
-               method = "registerCallbackList(List<CallBackInterface> _cb)";
-               method = "callBack()";
-
-               method = "getA()";
-               method = "setA(int _int)";
-               method = "setB(float _float)";
-               method = "setC(String _string)";
-       }
-
-       capability SetAndGets {
-               description = "All the set-and-get methods";
-               method = "sumArray(String newA[])";
-               method = "setAndGetA(int newA)";
-               method = "setACAndGetA(String newC, int newA)";
-       }
-
-       enum Enum {
-
-               APPLE,
-               ORANGE,
-               GRAPE
-       }
-
-       struct Struct {
-
-               string  name;
-               float   value;
-               int     year;
-       }
-}
-
-
diff --git a/config/iotpolicy/testclasspolicy_advanced.pol b/config/iotpolicy/testclasspolicy_advanced.pol
deleted file mode 100644 (file)
index b7899df..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-public interface TestClassInterface {
-
-       public Enum handleEnum(Enum en);
-       public Enum[] handleEnumArray(Enum en[]);
-       public List<Enum> handleEnumList(List<Enum> en);
-       public Enum handleEnumComplex(Enum en, int i, char c);
-       public Enum[] handleEnumComplex2(Enum en[], int in, char c);
-       public Enum[] handleEnumTwo(Enum en1[], Enum en2[]);
-
-       public Struct handleStruct(Struct str);
-       public Struct[] handleStructArray(Struct str[]);
-       public List<Struct> handleStructList(List<Struct> str);
-       public Struct handleStructComplex(int in, char c, Struct str);
-       public List<Struct> handleStructTwo(List<Struct> str1, List<Struct> str2);
-       public List<Struct> handleStructThree(List<Struct> str1, List<Struct> str2, List<Struct> str3);
-       public List<Struct> handleStructComplex2(int in, char c, Struct str[]);
-
-       public Enum[] handleEnumStruct(Enum en[], List<Struct> str, char c);
-
-       public void registerCallback(CallBackInterface _cb);
-       public void registerCallbackArray(CallBackInterface _cb[]);
-       public void registerCallbackList(List<CallBackInterface> _cb);
-       public void registerCallbackComplex(int in, List<CallBackInterface> _cb, double db);
-       public int callBack();
-       public Enum[] handleCallbackEnum(Enum en[], char c, List<CallBackInterface> _cb);
-
-
-       public Enum[] handleAll(Enum en[], List<Struct> str, char c, List<CallBackInterface> _cb);
-       public Enum[] handleAllTwo(Enum en1[], Enum en2[], List<Struct> str1, List<Struct> str2, char c, List<CallBackInterface> _cb1, List<CallBackInterface> _cb2);
-       public Enum[] handleEnumThree(Enum en1[], Enum en2[], List<Struct> str1, List<Struct> str2);
-
-       capability EnumsStructs {
-               description = "All the set methods";
-
-               method = "handleEnum(Enum en)";
-               method = "handleEnumArray(Enum en[])";
-               method = "handleEnumList(List<Enum> en)";
-               method = "handleEnumComplex(Enum en, int i, char c)";
-               method = "handleEnumComplex2(Enum en[], int in, char c)";
-               method = "handleEnumTwo(Enum en1[], Enum en2[])";
-               method = "handleEnumThree(Enum en1[], Enum en2[], List<Struct> str1, List<Struct> str2)";
-
-               method = "handleStruct(Struct str)";
-               method = "handleStructArray(Struct str[])";
-               method = "handleStructList(List<Struct> str)";
-               method = "handleStructComplex(int in, char c, Struct str)";
-               method = "handleStructComplex2(int in, char c, Struct str[])";
-               method = "handleStructTwo(List<Struct> str1, List<Struct> str2)";
-               method = "handleStructThree(List<Struct> str1, List<Struct> str2, List<Struct> str3)";
-
-               method = "handleEnumStruct(Enum en[], List<Struct> str, char c)";
-               method = "handleCallbackEnum(Enum en[], char c, List<CallBackInterface> _cb)";
-               method = "handleAll(Enum en[], List<Struct> str, char c, List<CallBackInterface> _cb)";
-               method = "handleAllTwo(Enum en1[], Enum en2[], List<Struct> str1, List<Struct> str2, char c, List<CallBackInterface> _cb1, List<CallBackInterface> _cb2)";
-       }
-
-       capability Callbacks {
-               description = "All the set-and-get methods";
-
-               method = "registerCallback(CallBackInterface _cb)";
-               method = "registerCallbackArray(CallBackInterface _cb[])";
-               method = "registerCallbackList(List<CallBackInterface> _cb)";
-               method = "registerCallbackComplex(int in, List<CallBackInterface> _cb, double db)";
-               method = "callBack()";
-       }
-
-       enum Enum {
-
-               APPLE,
-               ORANGE,
-               GRAPE
-       }
-
-       struct Struct {
-
-               string  name;
-               float   value;
-               int     year;
-       }
-}
-
-
diff --git a/config/iotpolicy/testclassrequires.pol b/config/iotpolicy/testclassrequires.pol
deleted file mode 100644 (file)
index 713fb4e..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-requires TestClassInterface with Setters, SetAndGets as interface TestClassComplete;
-
diff --git a/config/iotpolicy/testclassrequires_advanced.pol b/config/iotpolicy/testclassrequires_advanced.pol
deleted file mode 100644 (file)
index b00b4cf..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-requires TestClassInterface with EnumsStructs, Callbacks as interface TestClassComplete;
-
index 1a4d49c9a94cc0f561dc8f025adfce7f9bb0beb5..4d1d32152c8f8a53af6ddbd141d7fc1804938076 100644 (file)
@@ -2,7 +2,9 @@ BASE := ..
 
 include $(BASE)/common.mk
 
 
 include $(BASE)/common.mk
 
-all: tree parser compiler rmi
+all: tree parser compiler rmi runtime installer
+
+infra: runtime installer
 
 # Parser compilation and run
 PHONY += tree
 
 # Parser compilation and run
 PHONY += tree
@@ -16,18 +18,18 @@ parser:
 PHONY += compiler
 compiler:
        $(JAVAC) -cp .:$(PARSERJARS) -d $(BIN_DIR) iotpolicy/*.java
 PHONY += compiler
 compiler:
        $(JAVAC) -cp .:$(PARSERJARS) -d $(BIN_DIR) iotpolicy/*.java
-       cp ../config/iotpolicy/*.pol $(BIN_DIR)/iotpolicy/
 
 
-PHONY += run-compiler
-run-compiler:
-       #cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler camerapolicy.pol camerarequires.pol lightbulbpolicy.pol lightbulbrequires.pol -cplus Cplus -java Java
-       #cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler testclasspolicy.pol testclassrequires.pol callbackpolicy.pol callbackrequires.pol -cplus Cplus -java Java
+PHONY += run-compiler-dev
+run-compiler-dev:
+       cp ../localconfig/iotpolicy/development/*.pol $(BIN_DIR)/iotpolicy/
+       cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler testclasspolicy.pol testclassrequires.pol callbackpolicy.pol callbackrequires.pol -cplus Cplus -java Java
        cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler callbackpolicy.pol callbackrequires.pol testclasspolicy_advanced.pol testclassrequires_advanced.pol -cplus Cplus -java Java
 
        cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler callbackpolicy.pol callbackrequires.pol testclasspolicy_advanced.pol testclassrequires_advanced.pol -cplus Cplus -java Java
 
-# Runtime system compilation
-PHONY += runtime
-runtime:
-       $(JAVAC) -classpath . iotruntime/master/*.java -d $(BIN_DIR)
+PHONY += run-compiler-lifx
+run-compiler-lifx:
+       cp ../localconfig/iotpolicy/LifxLightBulb/*.pol $(BIN_DIR)/iotpolicy/
+       cp ../localconfig/iotpolicy/LifxLightBulb/*.req $(BIN_DIR)/iotpolicy/
+       cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler lifxlightbulb.pol lifxtest.req -java Java
 
 # TODO: Can remove this later - just to test-compile the resulted files from the compiler
 PHONY += compile
 
 # TODO: Can remove this later - just to test-compile the resulted files from the compiler
 PHONY += compile
@@ -36,10 +38,10 @@ compile:
        cp ./iotrmi/C++/basics/* $(BIN_DIR)/iotpolicy/output_files/Cplus
        cd $(BIN_DIR)/iotpolicy/output_files; cp *.java ./Java
        cd $(BIN_DIR)/iotpolicy/output_files; cp *.hpp ./Cplus
        cp ./iotrmi/C++/basics/* $(BIN_DIR)/iotpolicy/output_files/Cplus
        cd $(BIN_DIR)/iotpolicy/output_files; cp *.java ./Java
        cd $(BIN_DIR)/iotpolicy/output_files; cp *.hpp ./Cplus
-#      cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClass_Skeleton.java
-#      cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClassAdvanced_Stub.java
-#      cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClass_Skeleton.cpp -o ./TestClass_Skeleton.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
-#      cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClassAdvanced_Stub.cpp -o ./TestClassAdvanced_Stub.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
+       cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClass_Skeleton.java
+       cd $(BIN_DIR)/iotpolicy/output_files/Java; $(JAVAC) -cp .:..:../../../$(BIN_DIR) TestClassAdvanced_Stub.java
+       cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClass_Skeleton.cpp -o ./TestClass_Skeleton.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
+       cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(G++) ./TestClassAdvanced_Stub.cpp -o ./TestClassAdvanced_Stub.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
        cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(ARM_G++) ./TestClassInterface_Skeleton.cpp -o ./TestClassInterface_Skeleton.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
 
 PHONY += run-java-skeleton
        cd $(BIN_DIR)/iotpolicy/output_files/Cplus; $(ARM_G++) ./TestClassInterface_Skeleton.cpp -o ./TestClassInterface_Skeleton.out --std=c++11 -pthread -pg -I../../../../iotjava/iotrmi/C++/
 
 PHONY += run-java-skeleton
@@ -76,27 +78,10 @@ PHONY += rmi
 rmi:
        mkdir -p $(BIN_DIR)
        $(JAVAC) -cp .:../$(BIN_DIR) -d $(BIN_DIR) iotrmi/Java/*.java
 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
-#      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
+       $(JAVAC) -cp .:../$(BIN_DIR) -d $(BIN_DIR) iotrmi/Java/sample/*.java
        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/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 -pg
-#      $(G++) iotrmi/C++/sample/TestClass_Skeleton.cpp -o $(BIN_DIR)/iotrmi/C++/sample/TestClass_Skeleton.out --std=c++11 -pthread -pg
-       #$(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
-#      $(G++) iotrmi/C++/sample/EnumC.cpp -o ../bin/iotrmi/C++/sample/EnumC.out --std=c++11
-
+       $(G++) iotrmi/C++/sample/TestClass_Stub.cpp -o $(BIN_DIR)/iotrmi/C++/sample/TestClass_Stub.out --std=c++11 -pthread -pg
+       $(G++) iotrmi/C++/sample/TestClass_Skeleton.cpp -o $(BIN_DIR)/iotrmi/C++/sample/TestClass_Skeleton.out --std=c++11 -pthread -pg
 
 PHONY += run-rmiserver
 run-rmiserver:
 
 PHONY += run-rmiserver
 run-rmiserver:
@@ -106,8 +91,21 @@ PHONY += run-rmiclient
 run-rmiclient:
        $(JAVA) -cp .:$(BIN_DIR) iotrmi.Java.sample.TestClass_Stub
 
 run-rmiclient:
        $(JAVA) -cp .:$(BIN_DIR) iotrmi.Java.sample.TestClass_Stub
 
+PHONY += installer
+installer:
+       $(JAVAC)  -d $(BIN_DIR) iotinstaller/*.java
+       cp ../localconfig/iotruntime/MySQLInterface.config $(BIN_DIR)/iotruntime/
+       cp ../localconfig/iotruntime/MySQLInterface.config $(BIN_DIR)/iotinstaller/
+
+PHONY += runtime
+runtime:
+       $(JAVAC) -classpath .:$(RUNTIMEJARS):$(PHONEJARS):$(ZIPJARS) iotruntime/*.java iotruntime/master/*.java iotruntime/slave/*.java iotruntime/messages/*.java iotruntime/stub/*.java iotruntime/zigbee/*.java -d $(BIN_DIR)
+       cp ../localconfig/iotruntime/IoTMaster.config $(BIN_DIR)/iotruntime/
+       cp ../localconfig/iotruntime/IoTSlave.config $(BIN_DIR)/iotruntime/
+       cp -r ../localconfig/mysql $(BIN_DIR)/iotruntime/
+
 PHONY += doc
 PHONY += doc
-doc: iotruntime iotinstaller
-       $(JAVADOC) -d $(DOCS_DIR) iotpolicy/*.java
+doc: runtime installer rmi compiler
+       $(JAVADOC) -d $(DOCS_DIR) iotinstaller/*.java iotruntime/*.java iotrmi/*.java iotcompiler/*.java
 
 .PHONY: $(PHONY)
 
 .PHONY: $(PHONY)
diff --git a/iotjava/gmon.out b/iotjava/gmon.out
new file mode 100644 (file)
index 0000000..42a3312
Binary files /dev/null and b/iotjava/gmon.out differ
index a5a6781293882ba2fdf854085b8f8b6b87abd466..0f696bec03967f6d72355335e4c41cdaaa68d1fb 100644 (file)
@@ -361,7 +361,7 @@ public class IoTCompiler {
                                DeclarationHandler decHandler = mapIntDeclHand.get(intface);
                                InterfaceDecl intDecl = (InterfaceDecl) decHandler.getInterfaceDecl(intface);
                                // Pass in set of methods and get import classes
                                DeclarationHandler decHandler = mapIntDeclHand.get(intface);
                                InterfaceDecl intDecl = (InterfaceDecl) decHandler.getInterfaceDecl(intface);
                                // Pass in set of methods and get import classes
-                               List<String> methods = intDecl.getMethods();
+                               Set<String> methods = intMeth.getValue();
                                Set<String> importClasses = getImportClasses(methods, intDecl);
                                List<String> stdImportClasses = getStandardJavaIntfaceImportClasses();
                                List<String> allImportClasses = getAllLibClasses(stdImportClasses, importClasses);
                                Set<String> importClasses = getImportClasses(methods, intDecl);
                                List<String> stdImportClasses = getStandardJavaIntfaceImportClasses();
                                List<String> allImportClasses = getAllLibClasses(stdImportClasses, importClasses);
@@ -2543,7 +2543,8 @@ public class IoTCompiler {
                                println("#define _" + newIntface.toUpperCase() + "_HPP__");
                                println("#include <iostream>");
                                // Pass in set of methods and get import classes
                                println("#define _" + newIntface.toUpperCase() + "_HPP__");
                                println("#include <iostream>");
                                // Pass in set of methods and get import classes
-                               Set<String> includeClasses = getIncludeClasses(intMeth.getValue(), intDecl, intface, false);
+                               Set<String> methods = intMeth.getValue();
+                               Set<String> includeClasses = getIncludeClasses(methods, intDecl, intface, false);
                                List<String> stdIncludeClasses = getStandardCplusIncludeClasses();
                                List<String> allIncludeClasses = getAllLibClasses(stdIncludeClasses, includeClasses);
                                printIncludeStatements(allIncludeClasses); println("");                 
                                List<String> stdIncludeClasses = getStandardCplusIncludeClasses();
                                List<String> allIncludeClasses = getAllLibClasses(stdIncludeClasses, includeClasses);
                                printIncludeStatements(allIncludeClasses); println("");                 
@@ -2552,7 +2553,7 @@ public class IoTCompiler {
                                println("{");
                                println("public:");
                                // Write methods
                                println("{");
                                println("public:");
                                // Write methods
-                               writeMethodCplusInterface(intMeth.getValue(), intDecl);
+                               writeMethodCplusInterface(methods, intDecl);
                                println("};");
                                println("#endif");
                                pw.close();
                                println("};");
                                println("#endif");
                                pw.close();
diff --git a/iotjava/iotruntime/brillo/IoTBrilloWeave.java b/iotjava/iotruntime/brillo/IoTBrilloWeave.java
deleted file mode 100644 (file)
index 8a1e743..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-package iotruntime.brillo;
-
-// Google APIs
-import com.google.api.client.json.jackson2.JacksonFactory;
-import com.google.api.services.clouddevices.CloudDevices;
-import com.google.api.services.clouddevices.model.Device;
-
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-
-/** Abstract class IoTBrilloWeave that is the base of all
- *  Brillo/Weave-communication-based class
- *
- * @author      Rahmadi Trimananda <rtrimana @ uci.edu>
- * @version     1.0
- * @since       2016-06-08
- */
-public abstract class IoTBrilloWeave implements Remote {
-
-       /** 
-     * Class IoTBrilloWeave properties
-        */
-       protected IoTBrilloWeaveCloudConnection iotCloudConnection;
-       protected CloudDevices apiClient;
-       protected Device device;
-
-       /** 
-     * Class IoTBrilloWeave constants
-        */
-       protected final JacksonFactory jsonFactory = new JacksonFactory();
-
-       /** 
-     * Class IoTBrilloWeave constructor
-        */
-       protected IoTBrilloWeave(String _clientId, String _clientSecret, String _apiKey, String _deviceId) {
-
-               iotCloudConnection = new IoTBrilloWeaveCloudConnection(_clientId, _clientSecret, _apiKey);
-               iotCloudConnection.connectionSetup(_deviceId);
-               apiClient = iotCloudConnection.getApiClientObject();
-               device = iotCloudConnection.getDeviceObject();
-       }
-
-       /**
-        * setAuthScope() method to set authentication scope
-        *
-        * @return  void
-        */
-       protected void setAuthScope(String _authScopeAddress) {
-               iotCloudConnection.setAuthScope(_authScopeAddress);
-       }       
-}
diff --git a/iotjava/iotruntime/brillo/IoTBrilloWeaveCloudConnection.java b/iotjava/iotruntime/brillo/IoTBrilloWeaveCloudConnection.java
deleted file mode 100644 (file)
index 0fa3a18..0000000
+++ /dev/null
@@ -1,246 +0,0 @@
-package iotruntime.brillo;
-
-import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeRequestUrl;
-import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeTokenRequest;
-import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
-import com.google.api.client.googleapis.auth.oauth2.GoogleTokenResponse;
-import com.google.api.client.googleapis.services.CommonGoogleClientRequestInitializer;
-import com.google.api.client.http.javanet.NetHttpTransport;
-import com.google.api.client.json.GenericJson;
-import com.google.api.client.json.jackson2.JacksonFactory;
-import com.google.api.services.clouddevices.CloudDevices;
-import com.google.api.services.clouddevices.model.CloudDeviceChannel;
-import com.google.api.services.clouddevices.model.Command;
-import com.google.api.services.clouddevices.model.CommandDefNew;
-import com.google.api.services.clouddevices.model.Device;
-import com.google.api.services.clouddevices.model.DevicesListResponse;
-import com.google.api.services.clouddevices.model.RegistrationTicket;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.nio.charset.Charset;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/** Class IoTBrilloWeaveCloudConnection provides basic APIs for
- *  authorization on Google Brillo/Weave server
- *
- * @author      Rahmadi Trimananda <rtrimana @ uci.edu>
- * @version     1.0
- * @since       2016-06-08
- */
-
-public class IoTBrilloWeaveCloudConnection {
-
-       /** 
-     * Class LEDFlasherImplementation constants
-        */
-       private static final String AUTH_SCOPE = "https://www.googleapis.com/auth/clouddevices";
-       private static final String REDIRECT_URL = "urn:ietf:wg:oauth:2.0:oob";
-       private static final File CREDENTIALS_CACHE_FILE = new File("credentials_cache.json");
-       private final NetHttpTransport httpTransport = new NetHttpTransport();
-       private final JacksonFactory jsonFactory = new JacksonFactory();
-
-       /** 
-     * Class LEDFlasherImplementation properties
-        */
-       private static String authScope;
-       private static String clientID;
-       private static String clientSecret;
-       private static String apiKey;
-       private CloudDevices apiClient;
-       private Device device;
-
-       /** 
-     * Class LEDFlasherImplementation constructor
-        */
-       public IoTBrilloWeaveCloudConnection(String _clientId, String _clientSecret, String _apiKey) {
-               clientID = _clientId;
-               clientSecret = _clientSecret;
-               apiKey = _apiKey;
-               authScope = AUTH_SCOPE;
-               apiClient = null;
-               device = null;
-       }
-
-       /**
-        * setAuthScope() method to set authentication scope
-        *
-        * @return  void
-        */
-       public void setAuthScope(String _authScopeAddress) {
-               authScope = "https://" + _authScopeAddress + "/auth/clouddevices";
-       }       
-
-       /**
-        * getApiClient() method to authorize and get access to client API
-        *
-        * @return  CloudDevices
-        */
-       private CloudDevices getApiClient() throws IOException {
-               // Try to load cached credentials.
-               GoogleCredential credential = getCachedCredential();
-               if (credential == null) {
-                       System.out.println("Did not find cached credentials");
-                       credential = authorize();
-               }
-               return new CloudDevices.Builder(httpTransport, jsonFactory, credential)
-                       .setApplicationName("Weave Sample")
-                       .setServicePath("clouddevices/v1")
-                       .setGoogleClientRequestInitializer(new CommonGoogleClientRequestInitializer(apiKey))
-                       .build();
-       }
-
-       /**
-        * authorize() to authorize client access
-        * <p>
-        * This function checks credential file and create one if there isn't any yet
-        *
-        * @return  GoogleCredential
-        */
-       private GoogleCredential authorize() throws IOException {
-               String authorizationUrl = new GoogleAuthorizationCodeRequestUrl(
-                       clientID, REDIRECT_URL, Collections.singleton(authScope)).build();
-               // Direct user to the authorization URI.
-               System.out.println("Go to the following link in your browser:");
-               System.out.println(authorizationUrl);
-               // Get authorization code from user.
-       BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
-               System.out.println("What is the authorization code?");
-               String authorizationCode = in.readLine();
-
-               // Use the authorization code to get an access token and a refresh token.
-               GoogleTokenResponse response = new GoogleAuthorizationCodeTokenRequest(
-                       httpTransport, jsonFactory, clientID, clientSecret, authorizationCode,
-                       REDIRECT_URL).execute();
-               cacheCredential(response.getRefreshToken());
-               // Use the access and refresh tokens to set up credentials.
-               GoogleCredential credential = new GoogleCredential.Builder()
-                       .setJsonFactory(jsonFactory)
-                       .setTransport(httpTransport)
-                       .setClientSecrets(clientID, clientSecret)
-                       .build()
-                       .setFromTokenResponse(response);
-               return credential;
-       }
-
-       /**
-        * getCachedCredential() to try to read credential from file
-        *
-        * @return  GoogleCredential
-        */
-       private GoogleCredential getCachedCredential() {
-               try {
-                       return GoogleCredential.fromStream(new FileInputStream(CREDENTIALS_CACHE_FILE));
-               } catch (IOException e) {
-                       return null;
-               }
-       }
-
-       /**
-        * cacheCredential() to create a cache credential file
-        * <p>
-        * This function checks credential file and create one if there isn't any yet
-        *
-        * @param       refreshToken    String value for refresh_token field
-        * @return  GoogleCredential
-        */
-       private void cacheCredential(String refreshToken) {
-               GenericJson json = new GenericJson();
-               json.setFactory(jsonFactory);
-               json.put("client_id", clientID);
-               json.put("client_secret", clientSecret);
-               json.put("refresh_token", refreshToken);
-               json.put("type", "authorized_user");
-               FileOutputStream out = null;
-               try {
-                       out = new FileOutputStream(CREDENTIALS_CACHE_FILE);
-                       out.write(json.toPrettyString().getBytes(Charset.defaultCharset()));
-               } catch (IOException e) {
-                       System.err.println("Error caching credentials");
-                       e.printStackTrace();
-               } finally {
-                       if (out != null) {
-                               try { out.close(); } catch (IOException e) { /* Ignore. */ }
-                       }
-               }
-       }
-
-       /**
-        * authorize() to authorize client access
-        * <p>
-        * This function checks credential file and create one if there isn't any yet
-        *
-        * @param       deviceId        String value device ID for connection setup
-        * @return  void
-        */
-       public void connectionSetup(String deviceId) {
-
-               //CloudDevices apiClient;
-               try {
-                       apiClient = getApiClient();
-               } catch (IOException ex) { throw new RuntimeException("Could not get API client", ex); }
-
-               DevicesListResponse devicesListResponse;
-               try {
-                       devicesListResponse = apiClient.devices().list().execute();
-               } catch (IOException e) { throw new RuntimeException("Could not list devices", e); }
-               List<Device> devices = devicesListResponse.getDevices();
-               //Device device;
-               if (devices == null || devices.isEmpty()) {
-                       throw new Error("List of device is empty! Please register your device on Google Weave Developers website!");
-               } else {
-               // Choose device based on device ID
-                       for (Device dev : devices) {
-                               if (dev.getId().equals(deviceId)) {
-                                       device = dev;
-                                       break;
-                               }                                       
-                       }
-                       //device = devices.get(0);
-               }
-
-               System.out.println("Available device: " + device.getId());
-
-               try {
-                       System.out.println("Command definitions:\n" + jsonFactory.toPrettyString(device.getCommandDefs()));
-               } catch (IOException e) { throw new RuntimeException(e); }
-       }
-
-
-       /**
-        * getApiClientObject() to return API client object
-        *
-        * @return  void
-        */
-       public CloudDevices getApiClientObject() {
-               return apiClient;
-       }
-
-
-       /**
-        * getDeviceObject() to return device object
-        *
-        * @return  void
-        */
-       public Device getDeviceObject() {
-               return device;
-       }
-
-
-       public static void main(String[] args) {
-
-               String clientId = "627170482755-4l2gd5m3lf6ej674vqr8sdc14gmeva3e.apps.googleusercontent.com";
-               String clientSecret = "Yhj6QzCxeO2B0i25JHqYShsi";
-               String apiKey = "AIzaSyDcYp9RQAV2ELZWxVIjPBAzIPGiXAAORs0";
-
-               IoTBrilloWeaveCloudConnection iotBrillo = new IoTBrilloWeaveCloudConnection(clientId, clientSecret, apiKey);
-               iotBrillo.connectionSetup("77173ed5-3303-4c54-f852-b8f51fb7b31f");
-       }
-}
diff --git a/iotjava/iotruntime/brillo/IoTBrilloWeaveCodeGenerator.java b/iotjava/iotruntime/brillo/IoTBrilloWeaveCodeGenerator.java
deleted file mode 100644 (file)
index cd6b0f7..0000000
+++ /dev/null
@@ -1,461 +0,0 @@
-package iotruntime.brillo;
-
-// Java libraries
-import java.io.BufferedWriter;
-import java.io.PrintWriter;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.ProtocolException;
-import java.net.URL;
-import java.lang.Class;
-import java.lang.reflect.*;
-import java.util.Map;
-
-// Google APIs
-import com.google.api.services.clouddevices.model.CommandDefNew;
-import com.google.api.services.clouddevices.model.Device;
-
-
-/** IoTBrilloWeaveCodeGenerator class that connects to
- *  Google Brillo/Weave server based on user's credentials
- *  and creates user's class and interface
- *  <p>
- *  Steps:
- *  0) Compile iotruntime
- *  1) Run this code generator
- *     - go to $(IOTJAVA_CLASSPATH)/iot/bin/iotruntime/brillo/
- *     - run this class with this command line: 
- *       java -cp .:../../:../../../jars/brillo/*:../../../jars/brillo/libs/* iotruntime.brillo.IoTBrilloWeaveCodeGenerator -help
- *     - follow the instructions to generate codes
- *  2) If credentials_cache.json hasn't been created then one will be created
- *  3) Both interface and implementation java API source files will be created
- *  4) We can move them to the right directories with the credentials_cache.json
- *     - move the interface java file into folder "interfaces"
- *     - create a folder in "iot/benchmarks/drivers" with the class name and put
- *       the class java file there; don't forget to create <class>.config file
- *       and modify the Makefile
- *  5) A device driver can be created based on the created API's
- *
- * @author      Rahmadi Trimananda <rahmadi.trimananda @ uci.edu>
- * @version     1.0
- * @since       2016-06-09
- */
-public class IoTBrilloWeaveCodeGenerator {
-
-       /**
-        * IoTBrilloWeaveCodeGenerator properties
-        */
-       private PrintWriter pw;
-       private String strInterfaceName;
-       private String strClassName;
-       private IoTBrilloWeaveCloudConnection iotBrillo;
-
-       /**
-        * Constructor
-        */
-       public IoTBrilloWeaveCodeGenerator(String[] strArgs) {
-
-               this.strInterfaceName = strArgs[0];
-               this.strClassName = strArgs[1];
-               this.iotBrillo = new IoTBrilloWeaveCloudConnection(strArgs[2], strArgs[3], strArgs[4]);
-               this.iotBrillo.connectionSetup(strArgs[5]);
-       }
-
-
-       /**
-        * Generate interface
-        *
-        * @return      void
-        */
-       public void generateInterface() throws IOException {
-
-               // Initialize FileWriter and PrintWriter
-               FileWriter fwInterface = new FileWriter(strInterfaceName + ".java");
-               this.pw = new PrintWriter(new BufferedWriter(fwInterface));
-               // Write the interface header
-               generateInterfaceImports();
-               println("");
-               println("public interface " + strInterfaceName + " extends Remote {");
-               println("");
-               generateInterfaceBody(this.iotBrillo.getDeviceObject());
-               println("");
-               //Close interface
-               println("}");
-               pw.close();
-       }
-
-
-       /**
-        * Generate interface import statements
-        *
-        * @return      void
-        */
-       public void generateInterfaceInit() {
-               println("public void init() throws RemoteException;");
-       }
-
-
-       /**
-        * Generate interface init method
-        *
-        * @return      void
-        */
-       public void generateInterfaceImports() {
-               println("package iotcode.interfaces;");
-               println("");    
-               println("import java.rmi.Remote;");
-               println("import java.rmi.RemoteException;");
-       }
-
-
-       /**
-        * Generate interface body
-        *
-        * @param       device  Device object that contains JSON parameters
-        * @return      void
-        */
-       private void generateInterfaceBody(Device device) {
-
-               generateInterfaceInit();
-               Map<String,Map<String,CommandDefNew>> mapCommand = device.getCommandDefs();
-               for(String strCmd : mapCommand.keySet()) {
-                       Map<String,CommandDefNew> mapSubCommand = mapCommand.get(strCmd);
-                       for(String strSubCmd : mapSubCommand.keySet()) {
-                               print("public void " + strCmd + "_" + strSubCmd + "(");
-                               CommandDefNew cmd = mapSubCommand.get(strSubCmd);
-                               if (cmd.getParameters() != null) {
-                               // If we have parameters ...
-                                       int iParamCount = 0;
-                                       Map<String,Map<String,Object>> mapParam = cmd.getParameters();
-                                       for (String strParamName : mapParam.keySet()) {
-                                               iParamCount++;
-                                               Map<String,Object> mapParamProp = mapParam.get(strParamName);
-                                               for (String strParamProp : mapParamProp.keySet()) {
-                                                       if (strParamProp.equals("type")) {
-                                                               print(getJavaType(mapParamProp.get(strParamProp).toString()) + " ");
-                                                               if (iParamCount == mapParam.size())
-                                                                       println(strParamName + ") throws RemoteException;");
-                                                               else
-                                                                       print(strParamName + ", ");
-                                                       }
-                                               }
-                                       }
-                               } else {
-                               // If we don't have parameters ...
-                                       println(") throws RemoteException;");
-                               }
-                       }
-               }
-       }
-
-
-       /**
-        * Type translator from JSON syntax to Java
-        *
-        * @return      String
-        */
-       private String getJavaType(String strJsonType) {
-
-               if (strJsonType.equals("string")) {
-                       return "String";
-               } else if (strJsonType.equals("integer")) {
-                       return "Integer";
-               } else if (strJsonType.equals("boolean")) {
-                       return "Boolean";
-               } else if (strJsonType.equals("number")) {
-                       return "Float";
-               } else { // NULL is returned when type is not recognized
-                       return null;
-               }
-       }
-
-
-       /**
-        * Generate class
-        *
-        * @return      void
-        */
-       public void generateClass() throws IOException {
-
-               // Initialize FileWriter and PrintWriter
-               FileWriter fwClass = new FileWriter(strClassName + ".java");
-               this.pw = new PrintWriter(new BufferedWriter(fwClass));
-               // Write the import statements
-               generateImports();
-               println("");
-               println("public class " + strClassName + 
-                               " extends IoTBrilloWeave" +
-                               " implements " + strInterfaceName + " {");
-               println("");
-               generateAtConfigs();            
-               println("");
-               generateConstructor();
-               println("");
-               generateInit();
-               println("");
-               generateClassAPIs(this.iotBrillo.getDeviceObject());
-               //Close class
-               println("}");
-               pw.close();
-       }
-
-
-       /**
-        * Generate @config statements for IoTDeviceAddress
-        *
-        * @return      void
-        */
-       public void generateAtConfigs() {
-
-               println("@config private IoTSet<IoTAddress> GoogleAccountAddress;");
-               println("@config private IoTSet<IoTAddress> GoogleAPIsAddress;");
-       }
-
-
-       /**
-        * Generate init method
-        *
-        * @return      void
-        */
-       public void generateInit() {
-
-               println("public void init() {");
-               println("Iterator itr = GoogleAccountAddress.iterator();");
-               println("IoTAddress address = (IoTAddress)itr.next();");
-               println("super.setAuthScope(address.getHostName());");
-               println("}");
-       }
-
-
-       /**
-        * Generate class APIs
-        *
-        * @param       device  Device object that contains JSON parameters
-        * @return      void
-        */
-       private void generateClassAPIs(Device device) {
-
-               // Generate method header
-               Map<String,Map<String,CommandDefNew>> mapCommand = device.getCommandDefs();
-               for(String strCmd : mapCommand.keySet()) {
-                       Map<String,CommandDefNew> mapSubCommand = mapCommand.get(strCmd);
-                       for(String strSubCmd : mapSubCommand.keySet()) {
-                               print("public void " + strCmd + "_" + strSubCmd + "(");
-                               CommandDefNew cmd = mapSubCommand.get(strSubCmd);
-                               boolean doesParamExist = false;
-                               if (cmd.getParameters() != null) {
-                               // If we have parameters ...
-                                       doesParamExist = true;
-                                       int iParamCount = 0;
-                                       Map<String,Map<String,Object>> mapParam = cmd.getParameters();
-                                       for (String strParamName : mapParam.keySet()) {
-                                               iParamCount++;
-                                               Map<String,Object> mapParamProp = mapParam.get(strParamName);
-                                               for (String strParamProp : mapParamProp.keySet()) {
-                                                       if (strParamProp.equals("type")) {
-                                                               print(getJavaType(mapParamProp.get(strParamProp).toString()) + " ");
-                                                               if (iParamCount == mapParam.size())
-                                                                       println(strParamName + ") {");
-                                                               else
-                                                                       print(strParamName + ", ");
-                                                       }
-                                               }
-                                       }
-                               } else {
-                               // If we don't have parameters ...
-                                       println(") {");
-                               }
-                               generateMethodBody(cmd, doesParamExist, strCmd, strSubCmd);
-                               generateCommandInsertionAndException();
-                               println("}");
-                               println("");
-                       }
-               }
-       }
-
-
-       /**
-        * Generate method body
-        *
-        * @param       cmd                     Object CommandDefNew that contains information about the command
-        * @param       doesParamExist  Boolean that tracks if the method has parameters
-        * @param       strCmd                  String that contains the main command name
-        * @param       strSubCmd               String that contains the sub command name
-        * @return      void
-        */
-       private void generateMethodBody(CommandDefNew cmd, boolean doesParamExist, String strCmd, String strSubCmd) {
-
-               if (doesParamExist) {
-               // If we have parameters ...
-                       //int iParamCount = 0;
-                       println("Map<String, Object> parameters = new HashMap<String, Object>();");
-                       Map<String,Map<String,Object>> mapParam = cmd.getParameters();
-                       for (String strParamName : mapParam.keySet()) {
-                               //iParamCount++;
-                               Map<String,Object> mapParamProp = mapParam.get(strParamName);
-                               for (String strParamProp : mapParamProp.keySet()) {
-                                       if (strParamProp.equals("type")) {
-                                               //print(getJavaType(mapParamProp.get(strParamProp).toString()) + " ");
-                                               println("parameters.put(\"" + strParamName + "\", " + strParamName + ");");
-                                       }
-                               }
-                       }
-               }
-               println("Command command = new Command()");
-               println("\t.setName(\"" + strCmd + "." + strSubCmd + "\")");
-               if (doesParamExist)
-                       println("\t.setParameters(parameters)");
-               println("\t.setDeviceId(device.getId());");
-       }
-
-
-       /**
-        * Generate command insertion and exception statements
-        *
-        * @return      void
-        */
-       private void generateCommandInsertionAndException() {
-               println("try {");
-               println("command = apiClient.commands().insert(command).execute(); }");
-               println("catch (IOException e) {");
-               println("throw new RuntimeException(\"Could not insert command\", e); }");
-               println("");
-               println("try {");
-               println("System.out.println(\"Sent command to the device:\" + jsonFactory.toPrettyString(command)); }");
-               println("catch (IOException e) {");
-               println("throw new RuntimeException(e); }");
-       }
-
-
-       /**
-        * Generate import statements
-        *
-        * @return      void
-        */
-       private void generateImports() {
-
-               println("package iotcode." + strClassName + ";");
-               println("");    
-               println("import com.google.api.client.json.jackson2.JacksonFactory;");
-               println("import com.google.api.services.clouddevices.CloudDevices;");
-               println("import com.google.api.services.clouddevices.model.Command;");
-               println("import com.google.api.services.clouddevices.model.Device;");
-               println("");
-               println("import java.io.IOException;");
-               println("import java.util.HashMap;");
-               println("import java.util.Iterator;");
-               println("import java.util.Map;");
-               println("");
-               println("import iotcode.interfaces.LEDFlasher;");
-               println("import iotruntime.brillo.IoTBrilloWeave;");
-               println("import iotruntime.brillo.IoTBrilloWeaveCloudConnection;");
-               println("import iotruntime.slave.IoTAddress;");
-               println("import iotruntime.slave.IoTSet;");
-               println("import iotchecker.qual.*;");
-       }
-
-
-       /**
-        * Generate constructor
-        *
-        * @return      void
-        */
-       private void generateConstructor() {
-               // Write the constructor
-               println("public " + strClassName + 
-                       "(String _clientId, String _clientSecret, String _apiKey, String _deviceId) {");
-               println("super(_clientId, _clientSecret, _apiKey, _deviceId);");
-               println("}");
-       }
-
-
-       /**
-        * Display help message
-        *
-        * @return      void
-        */
-       public static void displayHelpMessage() {
-               System.out.println();
-               System.out.println("Please use this code generator in the following syntax:");
-               System.out.print("java -cp <classpath> IoTBrilloWeaveCodeGenerator <interface_name> ");
-               System.out.println("<class_name> <client_id> <client_secret> <api_key> <device_id>");
-               System.out.println("e.g.");
-               System.out.print("java -cp .:../clouddevices/*:../clouddevices/libs/* IoTBrilloWeaveCodeGenerator ");
-               System.out.print("LEDFlasherTest LEDFlasherTestImplementation 627170482755-4l2gd5m3lf6ej674vqr8sdc14gmeva3e.apps.googleusercontent.com ");
-               System.out.println("Yhj6QzCxeO2B0i25JHqYShsi AIzaSyDcYp9RQAV2ELZWxVIjPBAzIPGiXAAORs0 77173ed5-3303-4c54-f852-b8f51fb7b31f");
-               System.out.println();
-               System.out.println("To show this help message: java IoTBrilloWeaveCodeGenerator --help");
-               System.out.println();
-       }
-
-
-       /**
-        * Helper functions that help print to files
-        */
-       boolean newline=true;
-       int tablevel=0;
-
-       private void print(String str) {
-               if (newline) {
-                       int tab=tablevel;
-                       if (str.equals("}"))
-                               tab--;
-                       for(int i=0; i<tab; i++)
-                               pw.print("\t");
-               }
-               pw.print(str);
-               updatetabbing(str);
-               newline=false;
-       }
-
-       private void println(String str) {
-               if (newline) {
-                       int tab = tablevel;
-                       if (str.equals("}"))
-                               tab--;
-                       for(int i=0; i<tab; i++)
-                               pw.print("\t");
-               }
-               pw.println(str);
-               updatetabbing(str);
-               newline = true;
-       }
-
-       private void updatetabbing(String str) {
-               tablevel += count(str,'{') - count(str,'}');
-       }
-
-       private int count(String str, char key) {
-               char[] array = str.toCharArray();
-               int count = 0;
-               for(int i=0; i<array.length; i++) {
-                       if (array[i] == key)
-                               count++;
-               }
-               return count;
-       }
-
-
-       /**
-        * Call main function for file generations
-        * 
-        * @param       args[0]         Interface name
-        * @param       args[1]         Class name
-        * @param       args[2]         Client ID
-        * @param       args[3]         Client secret
-        * @param       args[4]         API key
-        * @param       args[5]         Device ID
-        */
-       public static void main(String[] args) throws IOException {
-
-               if(args.length < 6 || args[0].contains("help")) {
-                       displayHelpMessage();
-               } else {
-                       IoTBrilloWeaveCodeGenerator iotBrilloCodeGen = new IoTBrilloWeaveCodeGenerator(args);
-                       iotBrilloCodeGen.generateInterface();
-                       iotBrilloCodeGen.generateClass();
-               }
-       }
-}
diff --git a/iotjava/iotruntime/brillo/credentials_cache.json b/iotjava/iotruntime/brillo/credentials_cache.json
deleted file mode 100644 (file)
index 08fb6fe..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-{
-  "client_id" : "627170482755-mu1kmvsm0d5tmnjgnuafi0ju9aoc5ke3.apps.googleusercontent.com",
-  "client_secret" : "ffUz8PygD7pwus_4wjwS6x2Z",
-  "refresh_token" : "1/YcIkx5DxvT0YKpvmdKW6mlyGn5HenpbqgJRQ7AH2xVY",
-  "type" : "authorized_user"
-}
\ No newline at end of file
index 5c453e92dc5551e8f2f725dd29735355dcd0478c..154505795c0dac5a0bb39e297dd8f73fadacc445 100644 (file)
@@ -229,8 +229,6 @@ public class ClassRuntimeInstrumenterMaster extends ClassVisitor implements Opco
                 *  5) Initialize the field of the instrumented class objects with actual field objects
                 *  6) Run the init() function of the instrumented class
                 *
                 *  5) Initialize the field of the instrumented class objects with actual field objects
                 *  6) Run the init() function of the instrumented class
                 *
-                * @param  typeRef  int
-                * @param  typePath TypePath
                 * @param  desc     String
                 * @param  visible  boolean
                 * @return          AnnotationVisitor
                 * @param  desc     String
                 * @param  visible  boolean
                 * @return          AnnotationVisitor
@@ -239,10 +237,10 @@ public class ClassRuntimeInstrumenterMaster extends ClassVisitor implements Opco
                 *  This method visits annotation that is meta-annotated as TYPE_USE, so we can instrument @config here
                 */
                @Override
                 *  This method visits annotation that is meta-annotated as TYPE_USE, so we can instrument @config here
                 */
                @Override
-               public AnnotationVisitor visitTypeAnnotation(int typeRef, TypePath typePath, 
-                       String desc, boolean visible) {
+               public AnnotationVisitor visitAnnotation(String desc,
+                       boolean visible) {
 
 
-                       //RuntimeOutput.print("ClassRuntimeInstrumenterMaster@AnnotationTypeVisitor: " + desc, bVerbose);
+                       //RuntimeOutput.print("ClassRuntimeInstrumenterMaster@AnnotationVisitor: " + desc, bVerbose);
 
                        // Check annotation description @config
                        if(desc.equals(STR_IOT_ANNOTATION_SIGNATURE)) {
 
                        // Check annotation description @config
                        if(desc.equals(STR_IOT_ANNOTATION_SIGNATURE)) {
@@ -271,7 +269,7 @@ public class ClassRuntimeInstrumenterMaster extends ClassVisitor implements Opco
                                        throw new Error("ClassRuntimeInstrumenterMaster@AnnotationTypeVisitor: " + strFieldDesc + " not recognized!");
                                }
                        }
                                        throw new Error("ClassRuntimeInstrumenterMaster@AnnotationTypeVisitor: " + strFieldDesc + " not recognized!");
                                }
                        }
-                       return super.visitTypeAnnotation(typeRef, typePath, desc, visible);
+                       return super.visitAnnotation(desc, visible);
                }
        }
 
                }
        }
 
diff --git a/jars/asm-all-5.0.3.jar b/jars/asm-all-5.0.3.jar
new file mode 100644 (file)
index 0000000..da5b23e
Binary files /dev/null and b/jars/asm-all-5.0.3.jar differ
diff --git a/jars/checker.jar b/jars/checker.jar
new file mode 100644 (file)
index 0000000..ca1a665
Binary files /dev/null and b/jars/checker.jar differ
diff --git a/jars/java-json.jar b/jars/java-json.jar
new file mode 100644 (file)
index 0000000..2f211e3
Binary files /dev/null and b/jars/java-json.jar differ
diff --git a/jars/javac.jar b/jars/javac.jar
new file mode 100644 (file)
index 0000000..c9aa973
Binary files /dev/null and b/jars/javac.jar differ
diff --git a/jars/mysql.jar b/jars/mysql.jar
new file mode 100644 (file)
index 0000000..6b5b2ba
Binary files /dev/null and b/jars/mysql.jar differ
diff --git a/jars/zip4j_1.3.2.jar b/jars/zip4j_1.3.2.jar
new file mode 100644 (file)
index 0000000..66a19e4
Binary files /dev/null and b/jars/zip4j_1.3.2.jar differ
diff --git a/localconfig/iotinstaller/Comm_Lawn_Camera.config b/localconfig/iotinstaller/Comm_Lawn_Camera.config
new file mode 100644 (file)
index 0000000..e1032e1
--- /dev/null
@@ -0,0 +1,3 @@
+LW1 GreenLawnLW1
+CM1 AmcrestCameraCM1
+WRITE
diff --git a/localconfig/iotinstaller/Comm_Lawn_Moisture.config b/localconfig/iotinstaller/Comm_Lawn_Moisture.config
new file mode 100644 (file)
index 0000000..cf9e24f
--- /dev/null
@@ -0,0 +1,3 @@
+LW1 GreenLawnLW1 
+SS1 SpruceSensorSS1 
+WRITE
diff --git a/localconfig/iotinstaller/Comm_Lawn_Sprinkler.config b/localconfig/iotinstaller/Comm_Lawn_Sprinkler.config
new file mode 100644 (file)
index 0000000..c9c977c
--- /dev/null
@@ -0,0 +1,3 @@
+LW1 GreenLawnLW1 
+SP1 EspSprinklerSP1 
+WRITE
diff --git a/localconfig/iotinstaller/Comm_Room_Camera.config b/localconfig/iotinstaller/Comm_Room_Camera.config
new file mode 100644 (file)
index 0000000..80250ef
--- /dev/null
@@ -0,0 +1,3 @@
+RM2 RoomTwo
+CM2 AmcrestCameraTwo
+WRITE
diff --git a/localconfig/iotinstaller/Comm_Room_LightBulb.config b/localconfig/iotinstaller/Comm_Room_LightBulb.config
new file mode 100644 (file)
index 0000000..8f56032
--- /dev/null
@@ -0,0 +1,3 @@
+RM2 RoomTwo
+LB2 LifxLightBulbTwo
+WRITE
diff --git a/localconfig/iotinstaller/Comm_Room_Speaker.config b/localconfig/iotinstaller/Comm_Room_Speaker.config
new file mode 100644 (file)
index 0000000..afa6bb9
--- /dev/null
@@ -0,0 +1,3 @@
+RM4 AudioRoomRM4
+SK2 DummySpeakerSK2
+WRITE
diff --git a/localconfig/iotinstaller/Install_Addresses.config b/localconfig/iotinstaller/Install_Addresses.config
new file mode 100644 (file)
index 0000000..76d99dc
--- /dev/null
@@ -0,0 +1,4 @@
+ID=GB2
+ADDRESSFOR=GoogleBrilloWeave
+ADDRESS=www.googleapis.com
+END
diff --git a/localconfig/iotinstaller/Install_AmcrestCamera.config b/localconfig/iotinstaller/Install_AmcrestCamera.config
new file mode 100644 (file)
index 0000000..9930608
--- /dev/null
@@ -0,0 +1,17 @@
+
+IoTMain
+ID CM3
+TYPE Camera
+TYPESPECIFIC AmcrestCamera
+END
+
+Table 2
+USERNAME VARCHAR 20
+PASSWORD VARCHAR 20
+END
+
+Data
+admin
+55779CatSoundz35
+END
+
diff --git a/localconfig/iotinstaller/Install_AudioRoom.config b/localconfig/iotinstaller/Install_AudioRoom.config
new file mode 100644 (file)
index 0000000..1075a62
--- /dev/null
@@ -0,0 +1,16 @@
+
+IoTMain
+ID RM4
+TYPE Room
+TYPESPECIFIC AudioRoom
+END
+
+Table 1
+ROOMID INT 11
+END
+
+Data
+1
+END
+
+
diff --git a/localconfig/iotinstaller/Install_Brillo_LEDFlasher.config b/localconfig/iotinstaller/Install_Brillo_LEDFlasher.config
new file mode 100644 (file)
index 0000000..235b6eb
--- /dev/null
@@ -0,0 +1,21 @@
+
+IoTMain
+ID BW1
+TYPE LEDFlasher
+TYPESPECIFIC BrilloLEDFlasher
+END
+
+Table 4
+CLIENTID VARCHAR 100
+CLIENTSECRET VARCHAR 50
+APIKEY VARCHAR 50
+DEVICEID VARCHAR 50
+END
+
+Data
+627170482755-mu1kmvsm0d5tmnjgnuafi0ju9aoc5ke3.apps.googleusercontent.com
+ffUz8PygD7pwus_4wjwS6x2Z
+AIzaSyCE9-pbnCBYNCvhcsw18Am-Negs6wMiD5Y
+87901f05-7b02-6fc1-a023-66de2a18192a
+END
+
diff --git a/localconfig/iotinstaller/Install_DeviceAddresses.config b/localconfig/iotinstaller/Install_DeviceAddresses.config
new file mode 100644 (file)
index 0000000..14565a0
--- /dev/null
@@ -0,0 +1,6 @@
+ID=SP2
+ADDRESSFOR=BlossomSprinklerAdd2
+DEVICEADDRESS=00:00:00:00:00:00
+PORTNUMBER=80
+PROTOCOL=nopro
+END
diff --git a/localconfig/iotinstaller/Install_DeviceAddresses_Wildcard.config b/localconfig/iotinstaller/Install_DeviceAddresses_Wildcard.config
new file mode 100644 (file)
index 0000000..ca32a6a
--- /dev/null
@@ -0,0 +1,12 @@
+ID=SK2
+ADDRESSFOR=IHomeAdd5
+DEVICEADDRESS=c8:d5:fe:e6:a2:d8
+#DEVICEADDRESS=00:00:00:00:00:00
+# For wildcard we don't put a specific port number
+# Policies are in place to regulate traffic based on just IP addresses
+#      of the driver and the device
+PORTNUMBER=-1
+PROTOCOL=udp
+SOURCEWILDCARD=false
+DESTWILDCARD=true
+END
diff --git a/localconfig/iotinstaller/Install_Host.config b/localconfig/iotinstaller/Install_Host.config
new file mode 100644 (file)
index 0000000..0a19d38
--- /dev/null
@@ -0,0 +1,6 @@
+
+IoTComputeNode
+HOSTADDRESS=dw-2.eecs.uci.edu
+PROCESSOR=3400
+MEMORY=32
+END
diff --git a/localconfig/iotinstaller/Install_Lawn.config b/localconfig/iotinstaller/Install_Lawn.config
new file mode 100644 (file)
index 0000000..6cb1d3f
--- /dev/null
@@ -0,0 +1,15 @@
+
+IoTMain
+ID LW1
+TYPE Lawn
+TYPESPECIFIC GreenLawn
+END
+
+Table 1
+EMPTY VARCHAR 0
+END
+
+Data
+
+END
+
diff --git a/localconfig/iotinstaller/Install_LightBulb.config b/localconfig/iotinstaller/Install_LightBulb.config
new file mode 100644 (file)
index 0000000..0b1c7e3
--- /dev/null
@@ -0,0 +1,15 @@
+
+IoTMain
+ID LB2
+TYPE LightBulb
+TYPESPECIFIC LifxLightBulb
+END
+
+Table 1
+EMPTY VARCHAR 0
+END
+
+Data
+
+END
+
diff --git a/localconfig/iotinstaller/Install_PhoneGateway_Empty_Constructor.config b/localconfig/iotinstaller/Install_PhoneGateway_Empty_Constructor.config
new file mode 100644 (file)
index 0000000..b374261
--- /dev/null
@@ -0,0 +1,15 @@
+
+IoTMain
+ID GG1
+TYPE GPSGateway
+TYPESPECIFIC GPSPhoneGateway
+END
+
+Table 1
+EMPTY VARCHAR 0
+END
+
+Data
+
+END
+
diff --git a/localconfig/iotinstaller/Install_Room_Empty_Constructor.config b/localconfig/iotinstaller/Install_Room_Empty_Constructor.config
new file mode 100644 (file)
index 0000000..9c1db47
--- /dev/null
@@ -0,0 +1,15 @@
+
+IoTMain
+ID RM2
+TYPE Room
+TYPESPECIFIC RoomTwo
+END
+
+Table 1
+EMPTY VARCHAR 0
+END
+
+Data
+
+END
+
diff --git a/localconfig/iotinstaller/Install_Speaker_Empty_Constructor.config b/localconfig/iotinstaller/Install_Speaker_Empty_Constructor.config
new file mode 100644 (file)
index 0000000..616d761
--- /dev/null
@@ -0,0 +1,15 @@
+
+IoTMain
+ID SK2
+TYPE Speaker
+TYPESPECIFIC IHome
+END
+
+Table 1
+EMPTY VARCHAR 0
+END
+
+Data
+
+END
+
diff --git a/localconfig/iotinstaller/Install_Sprinkler.config b/localconfig/iotinstaller/Install_Sprinkler.config
new file mode 100644 (file)
index 0000000..90cc2d8
--- /dev/null
@@ -0,0 +1,15 @@
+
+IoTMain
+ID SP2
+TYPE Sprinkler
+TYPESPECIFIC BlossomSprinkler
+END
+
+Table 1
+CHANNELID VARCHAR 20
+END
+
+Data
+ABCDE
+END
+
diff --git a/localconfig/iotinstaller/Install_SpruceSensor.config b/localconfig/iotinstaller/Install_SpruceSensor.config
new file mode 100644 (file)
index 0000000..f2f4a78
--- /dev/null
@@ -0,0 +1,15 @@
+
+IoTMain
+ID SS1
+TYPE MoistureSensor
+TYPESPECIFIC SpruceSensor
+END
+
+Table 1
+EMPTY VARCHAR 0
+END
+
+Data
+
+END
+
diff --git a/localconfig/iotinstaller/Install_ZigbeeAddresses.config b/localconfig/iotinstaller/Install_ZigbeeAddresses.config
new file mode 100644 (file)
index 0000000..f919715
--- /dev/null
@@ -0,0 +1,4 @@
+ID=SS1
+ADDRESSFOR=SpruceSensorZBAdd
+DEVICEADDRESS=00:0d:6f:00:03:eb:f2:ee
+END
diff --git a/localconfig/iotpolicy/LifxLightBulb/lifxlightbulb.pol b/localconfig/iotpolicy/LifxLightBulb/lifxlightbulb.pol
new file mode 100644 (file)
index 0000000..1aa759e
--- /dev/null
@@ -0,0 +1,62 @@
+public interface LightBulb {
+
+       public void init();
+       public void turnOff();
+       public void turnOn();
+       public boolean getState();
+       public void setColor(double _hue, double _saturation, double _brightness);
+       public void setTemperature(int _temperature);
+       public double getBrightness();
+       public double getHue();
+       public double getSaturation();
+       public int getTemperature();
+       public double getBrightnessRangeLowerBound();
+       public double getBrightnessRangeUpperBound();
+       public double getHueRangeLowerBound();
+       public double getHueRangeUpperBound();
+       public double getSaturationRangeLowerBound();
+       public double getSaturationRangeUpperBound();
+       public int getTemperatureRangeLowerBound();
+       public int getTemperatureRangeUpperBound();
+
+       capability Initialize {
+               description = "Initialize object";
+               method = "init()";
+       }
+
+       capability Power {
+               description = "Turn on/off";
+               method = "turnOff()";
+               method = "turnOn()";
+               method = "getState()";
+       }
+
+       capability SetColorProperties {
+               description = "Get color properties";
+               method = "setColor(double _hue, double _saturation, double _brightness)";
+               method = "setTemperature(int _temperature)";
+       }
+
+       capability GetColorProperties {
+               description = "Set color properties";
+               method = "getBrightness()";
+               method = "getHue()";
+               method = "getSaturation()";
+               method = "getTemperature()";
+       }
+
+       capability GetColorPropertiesRange {
+               description = "Get upper and lower bounds of color properties";
+               method = "setColor(double _hue, double _saturation, double _brightness)";
+               method = "getBrightnessRangeLowerBound()";
+               method = "getBrightnessRangeUpperBound()";
+               method = "getHueRangeLowerBound()";
+               method = "getHueRangeUpperBound()";
+               method = "getSaturationRangeLowerBound()";
+               method = "getSaturationRangeUpperBound()";
+               method = "getTemperatureRangeLowerBound()";
+               method = "getTemperatureRangeUpperBound()";
+       }
+}
+
+
diff --git a/localconfig/iotpolicy/LifxLightBulb/lifxtest.req b/localconfig/iotpolicy/LifxLightBulb/lifxtest.req
new file mode 100644 (file)
index 0000000..f16157f
--- /dev/null
@@ -0,0 +1,3 @@
+
+requires LightBulb with Initialize, Power, SetColorProperties, GetColorProperties as interface LightBulbTest;
+
diff --git a/localconfig/iotpolicy/development/callbackpolicy.pol b/localconfig/iotpolicy/development/callbackpolicy.pol
new file mode 100644 (file)
index 0000000..947b899
--- /dev/null
@@ -0,0 +1,14 @@
+public interface CallBackInterface {
+
+    public int printInt();
+    public void setInt(int _i);
+
+       capability CallBack {
+               description = "The quick brown fox jumps over the smart dog";
+               description = "Another description";
+               method = "printInt()";
+               method = "setInt(int _i)";
+       }
+}
+
+
diff --git a/localconfig/iotpolicy/development/callbackrequires.pol b/localconfig/iotpolicy/development/callbackrequires.pol
new file mode 100644 (file)
index 0000000..96126d3
--- /dev/null
@@ -0,0 +1,3 @@
+
+requires CallBackInterface with CallBack as interface CallBackInterfaceWithCallBack;
+
diff --git a/localconfig/iotpolicy/development/camerapolicy.pol b/localconfig/iotpolicy/development/camerapolicy.pol
new file mode 100644 (file)
index 0000000..ca807b6
--- /dev/null
@@ -0,0 +1,44 @@
+public interface Camera {
+
+    public List<Float> MethodA(int A, int B);
+    public void MethodA(int A, int B, int AB);
+    public int MethodB(int C, String D[]);
+    public String MethodC(String E, List<Integer> F);
+    public float MethodD(List<String> G, float H);
+    public boolean MethodE(String I, boolean J);
+       public void MethodF(LightBulb K);
+       public Enum MethodG(Enum L);
+       public Struct MethodH(Struct M, int N);
+
+       capability ImageCapture {
+               description = "The quick brown fox jumps over the smart dog";
+               description = "Another description";
+               method = "MethodA(int A, int B)";
+               method = "MethodB(int C, String D[])";
+               method = "MethodC(String E, List<Integer> F)";
+               method = "MethodF(LightBulb K)";
+               method = "MethodG(Enum L)";
+               method = "MethodH(Struct M, int N)";
+       }
+
+       capability VideoRecording {
+               description = "The quick brown fox jumps over the cool dog";
+               method = "MethodA(int A, int B)";
+               method = "MethodA(int A, int B, int AB)";
+               method = "MethodD(List<String> G, float H)";
+       }
+
+       capability BackupData {
+               description = "The quick brown fox jumps over the clever dog";
+               method = "MethodE(String I, boolean J)";
+       }
+
+       struct Struct {
+
+               string  name;
+               float   value;
+               int     year;
+       } 
+}
+
+
diff --git a/localconfig/iotpolicy/development/camerarequires.pol b/localconfig/iotpolicy/development/camerarequires.pol
new file mode 100644 (file)
index 0000000..90049de
--- /dev/null
@@ -0,0 +1,3 @@
+
+requires Camera with ImageCapture, BackupData as interface CameraWithCaptureAndData;
+
diff --git a/localconfig/iotpolicy/development/enum.pol b/localconfig/iotpolicy/development/enum.pol
new file mode 100644 (file)
index 0000000..c9e85b6
--- /dev/null
@@ -0,0 +1,7 @@
+
+enum Enum {
+
+       APPLE,
+       ORANGE,
+       GRAPE
+} 
diff --git a/localconfig/iotpolicy/development/lightbulbpolicy.pol b/localconfig/iotpolicy/development/lightbulbpolicy.pol
new file mode 100644 (file)
index 0000000..b879626
--- /dev/null
@@ -0,0 +1,32 @@
+public interface LightBulb {
+
+    public void MethodA(int A, float B);
+    public void MethodA(int A, float B, int AB);
+    public int MethodB(String C, String D);
+    public byte MethodC(String E, List<Integer> F);
+
+       capability Flicker {
+               description = "The quick brown fox jumps over the smart dog";
+               description = "Another description";
+               method = "MethodA(int A, float B)";
+               method = "MethodB(String C, String D)";
+               method = "MethodC(String E, List<Integer> F)";
+       }
+
+       capability AutoOnOff {
+               description = "The quick brown fox jumps over the cool dog";
+               method = "MethodA(int A, float B)";
+               method = "MethodA(int A, float B, int AB)";
+               method = "MethodC(String E, List<Integer> F)";
+       }
+
+       enum Enum {
+
+               APPLE,
+               ORANGE,
+               GRAPE,
+               MANGO
+       }
+}
+
+
diff --git a/localconfig/iotpolicy/development/lightbulbrequires.pol b/localconfig/iotpolicy/development/lightbulbrequires.pol
new file mode 100644 (file)
index 0000000..24a7ca1
--- /dev/null
@@ -0,0 +1,3 @@
+
+requires LightBulb with Flicker as interface LightBulbWithFlicker;
+
diff --git a/localconfig/iotpolicy/development/struct.pol b/localconfig/iotpolicy/development/struct.pol
new file mode 100644 (file)
index 0000000..9b38ad1
--- /dev/null
@@ -0,0 +1,7 @@
+
+struct Struct {
+
+       string  name;
+       float   value;
+       int     year;
+} 
diff --git a/localconfig/iotpolicy/development/testclasspolicy.pol b/localconfig/iotpolicy/development/testclasspolicy.pol
new file mode 100644 (file)
index 0000000..e7cdc3b
--- /dev/null
@@ -0,0 +1,115 @@
+public interface TestClassInterface {
+
+       public byte getByte(byte in);
+       public short getShort(short in);
+       public long getLong(long in);
+       public float getFloat(float in);
+       public double getDouble(double in);
+       public boolean getBoolean(boolean in);
+       public char getChar(char in);
+
+       public byte[] getByteArray(byte in[]);
+       public short[] getShortArray(short in[]);
+       public long[] getLongArray(long in[]);
+       public float[] getFloatArray(float in[]);
+       public double[] getDoubleArray(double in[]);
+       public boolean[] getBooleanArray(boolean in[]);
+       public char[] getCharArray(char in[]);
+
+       public List<Byte> getByteList(List<Byte> in);
+       public List<Short> getShortList(List<Short> in);
+       public List<Long> getLongList(List<Long> in);
+       public List<Float> getFloatList(List<Float> in);
+       public List<Double> getDoubleList(List<Double> in);
+       public List<Boolean> getBooleanList(List<Boolean> in);
+       public List<Character> getCharList(List<Character> in);
+
+       public Enum handleEnum(Enum en);
+       public Enum[] handleEnumArray(Enum en[]);
+       public List<Enum> handleEnumList(List<Enum> en);
+       public Enum handleEnumComplex(Enum en, int i, char c);
+
+       public Struct handleStruct(Struct str);
+       public Struct[] handleStructArray(Struct str[]);
+       public List<Struct> handleStructList(List<Struct> str);
+
+       public void registerCallback(CallBackInterface _cb);
+       public void registerCallbackArray(CallBackInterface _cb[]);
+       public void registerCallbackList(List<CallBackInterface> _cb);
+       public int callBack();
+
+       public int getA();
+       public void setA(int _int);
+       public void setB(float _float);
+       public void setC(String _string);
+       public String sumArray(String newA[]);
+       public int setAndGetA(int newA);
+       public int setACAndGetA(String newC, int newA);
+
+       capability Setters {
+               description = "All the set methods";
+               method = "getByte(byte in)";
+               method = "getShort(short in)";
+               method = "getLong(long in)";
+               method = "getFloat(float in)";
+               method = "getDouble(double in)";
+               method = "getBoolean(boolean in)";
+               method = "getChar(char in)";
+               method = "getByteArray(byte in[])";
+               method = "getShortArray(short in[])";
+               method = "getLongArray(long in[])";
+               method = "getFloatArray(float in[])";
+               method = "getDoubleArray(double in[])";
+               method = "getBooleanArray(boolean in[])";
+               method = "getCharArray(char in[])";
+               method = "getByteList(List<Byte> in)";
+               method = "getShortList(List<Short> in)";
+               method = "getLongList(List<Long> in)";
+               method = "getFloatList(List<Float> in)";
+               method = "getDoubleList(List<Double> in)";
+               method = "getBooleanList(List<Boolean> in)";
+               method = "getCharList(List<Character> in)";
+
+               method = "handleEnum(Enum en)";
+               method = "handleEnumArray(Enum en[])";
+               method = "handleEnumList(List<Enum> en)";
+               method = "handleEnumComplex(Enum en, int i, char c)";
+
+               method = "handleStruct(Struct str)";
+               method = "handleStructArray(Struct str[])";
+               method = "handleStructList(List<Struct> str)";
+
+               method = "registerCallback(CallBackInterface _cb)";
+               method = "registerCallbackArray(CallBackInterface _cb[])";
+               method = "registerCallbackList(List<CallBackInterface> _cb)";
+               method = "callBack()";
+
+               method = "getA()";
+               method = "setA(int _int)";
+               method = "setB(float _float)";
+               method = "setC(String _string)";
+       }
+
+       capability SetAndGets {
+               description = "All the set-and-get methods";
+               method = "sumArray(String newA[])";
+               method = "setAndGetA(int newA)";
+               method = "setACAndGetA(String newC, int newA)";
+       }
+
+       enum Enum {
+
+               APPLE,
+               ORANGE,
+               GRAPE
+       }
+
+       struct Struct {
+
+               string  name;
+               float   value;
+               int     year;
+       }
+}
+
+
diff --git a/localconfig/iotpolicy/development/testclasspolicy_advanced.pol b/localconfig/iotpolicy/development/testclasspolicy_advanced.pol
new file mode 100644 (file)
index 0000000..b7899df
--- /dev/null
@@ -0,0 +1,82 @@
+public interface TestClassInterface {
+
+       public Enum handleEnum(Enum en);
+       public Enum[] handleEnumArray(Enum en[]);
+       public List<Enum> handleEnumList(List<Enum> en);
+       public Enum handleEnumComplex(Enum en, int i, char c);
+       public Enum[] handleEnumComplex2(Enum en[], int in, char c);
+       public Enum[] handleEnumTwo(Enum en1[], Enum en2[]);
+
+       public Struct handleStruct(Struct str);
+       public Struct[] handleStructArray(Struct str[]);
+       public List<Struct> handleStructList(List<Struct> str);
+       public Struct handleStructComplex(int in, char c, Struct str);
+       public List<Struct> handleStructTwo(List<Struct> str1, List<Struct> str2);
+       public List<Struct> handleStructThree(List<Struct> str1, List<Struct> str2, List<Struct> str3);
+       public List<Struct> handleStructComplex2(int in, char c, Struct str[]);
+
+       public Enum[] handleEnumStruct(Enum en[], List<Struct> str, char c);
+
+       public void registerCallback(CallBackInterface _cb);
+       public void registerCallbackArray(CallBackInterface _cb[]);
+       public void registerCallbackList(List<CallBackInterface> _cb);
+       public void registerCallbackComplex(int in, List<CallBackInterface> _cb, double db);
+       public int callBack();
+       public Enum[] handleCallbackEnum(Enum en[], char c, List<CallBackInterface> _cb);
+
+
+       public Enum[] handleAll(Enum en[], List<Struct> str, char c, List<CallBackInterface> _cb);
+       public Enum[] handleAllTwo(Enum en1[], Enum en2[], List<Struct> str1, List<Struct> str2, char c, List<CallBackInterface> _cb1, List<CallBackInterface> _cb2);
+       public Enum[] handleEnumThree(Enum en1[], Enum en2[], List<Struct> str1, List<Struct> str2);
+
+       capability EnumsStructs {
+               description = "All the set methods";
+
+               method = "handleEnum(Enum en)";
+               method = "handleEnumArray(Enum en[])";
+               method = "handleEnumList(List<Enum> en)";
+               method = "handleEnumComplex(Enum en, int i, char c)";
+               method = "handleEnumComplex2(Enum en[], int in, char c)";
+               method = "handleEnumTwo(Enum en1[], Enum en2[])";
+               method = "handleEnumThree(Enum en1[], Enum en2[], List<Struct> str1, List<Struct> str2)";
+
+               method = "handleStruct(Struct str)";
+               method = "handleStructArray(Struct str[])";
+               method = "handleStructList(List<Struct> str)";
+               method = "handleStructComplex(int in, char c, Struct str)";
+               method = "handleStructComplex2(int in, char c, Struct str[])";
+               method = "handleStructTwo(List<Struct> str1, List<Struct> str2)";
+               method = "handleStructThree(List<Struct> str1, List<Struct> str2, List<Struct> str3)";
+
+               method = "handleEnumStruct(Enum en[], List<Struct> str, char c)";
+               method = "handleCallbackEnum(Enum en[], char c, List<CallBackInterface> _cb)";
+               method = "handleAll(Enum en[], List<Struct> str, char c, List<CallBackInterface> _cb)";
+               method = "handleAllTwo(Enum en1[], Enum en2[], List<Struct> str1, List<Struct> str2, char c, List<CallBackInterface> _cb1, List<CallBackInterface> _cb2)";
+       }
+
+       capability Callbacks {
+               description = "All the set-and-get methods";
+
+               method = "registerCallback(CallBackInterface _cb)";
+               method = "registerCallbackArray(CallBackInterface _cb[])";
+               method = "registerCallbackList(List<CallBackInterface> _cb)";
+               method = "registerCallbackComplex(int in, List<CallBackInterface> _cb, double db)";
+               method = "callBack()";
+       }
+
+       enum Enum {
+
+               APPLE,
+               ORANGE,
+               GRAPE
+       }
+
+       struct Struct {
+
+               string  name;
+               float   value;
+               int     year;
+       }
+}
+
+
diff --git a/localconfig/iotpolicy/development/testclassrequires.pol b/localconfig/iotpolicy/development/testclassrequires.pol
new file mode 100644 (file)
index 0000000..713fb4e
--- /dev/null
@@ -0,0 +1,3 @@
+
+requires TestClassInterface with Setters, SetAndGets as interface TestClassComplete;
+
diff --git a/localconfig/iotpolicy/development/testclassrequires_advanced.pol b/localconfig/iotpolicy/development/testclassrequires_advanced.pol
new file mode 100644 (file)
index 0000000..b00b4cf
--- /dev/null
@@ -0,0 +1,3 @@
+
+requires TestClassInterface with EnumsStructs, Callbacks as interface TestClassComplete;
+
diff --git a/localconfig/iotruntime/IoTMaster.config b/localconfig/iotruntime/IoTMaster.config
new file mode 100644 (file)
index 0000000..66e7265
--- /dev/null
@@ -0,0 +1,29 @@
+# IoTMaster configuration
+
+MAC_ADDRESS=74:da:38:68:72:8a
+IOT_CODE_PATH=./../iotcode/
+CONTROLLERS_CODE_PATH=../
+RUNTIME_DIR=~/iotjava/iotruntime;
+#CLASS_PATH=-cp .:/usr/share/java/*:./../../iotjava/:./../../iotjava/iotruntime/:./../../iotjava/iotinstaller/
+CLASS_PATH=-cp .:/usr/share/java/*:./../:./../iotruntime/:./../iotinstaller/
+
+#benchmarks/libs/boofcv_libs/* - we usually put these benchmark codes in /usr/share/java on compute nodes
+#benchmarks/libs/georegression_libs/* - we usually put these benchmark codes in /usr/share/java on compute nodes
+
+RMI_PATH=-Djava.rmi.server.codebase=file:.:/usr/share/java/*
+RMI_HOSTNAME=-Djava.rmi.server.hostname=
+LOG_FILE_PATH=log/
+SSH_USERNAME=ssh iotuser@
+ROUTER_ADD=192.168.2.1
+
+#The only host that SSH is allowed from to the router
+MONITORING_HOST=74:da:38:68:72:8a
+
+#Zigbee gateway information
+ZIGBEE_GATEWAY_ADDRESS=c0:4a:00:10:9c:b3
+ZIGBEE_GATEWAY_PORT=5005
+ZIGBEE_IOTMASTER_PORT=12345
+
+#Verboseness of runtime messages
+VERBOSE=Yes
+
diff --git a/localconfig/iotruntime/IoTSlave.config b/localconfig/iotruntime/IoTSlave.config
new file mode 100644 (file)
index 0000000..293e348
--- /dev/null
@@ -0,0 +1,12 @@
+# IoTSlave configuration
+
+JAR_FILE_PATH=./../iotruntime/
+
+# e.g. iotcode.AmcrestCamera - basically the path of the benchmark class files
+OBJECT_CLASS_PREFIX=iotcode
+
+# e.g. interfaces.Camera - basically the path of the interface class file
+INTERFACE_PREFIX=interfaces
+
+#Verboseness of runtime messages
+VERBOSE=Yes
diff --git a/localconfig/iotruntime/MySQLInterface.config b/localconfig/iotruntime/MySQLInterface.config
new file mode 100644 (file)
index 0000000..749b543
--- /dev/null
@@ -0,0 +1,6 @@
+# MySQLInterface configuration
+
+HOST=128.195.204.105
+DATABASE=IoTMain
+USERNAME=root
+PASSWORD=root
diff --git a/localconfig/mysql/AcmeProximity_query_results b/localconfig/mysql/AcmeProximity_query_results
new file mode 100644 (file)
index 0000000..7b2908d
--- /dev/null
@@ -0,0 +1,48 @@
+mysql> select * from LightBulb where zone=1;
++-------------------+------+-------+
+| ID                | ZONE | POWER |
++-------------------+------+-------+
+| 00:11:00:00:00:02 |    1 |    30 |
++-------------------+------+-------+
+1 row in set (0.00 sec)
+
+mysql> select * from ProximitySensor where zone=2;
++-------------------+------+-------+
+| ID                | ZONE | POWER |
++-------------------+------+-------+
+| 00:10:00:00:00:03 |    2 |   100 |
+| 00:10:00:00:00:07 |    2 |   100 |
++-------------------+------+-------+
+2 rows in set (0.00 sec)
+
+mysql> select * from IoTComm;
++-------------------+-----------------------+-------------------+----------------------+--------+
+| ID_SOURCE         | TYPE_SOURCE           | ID_DESTINATION    | TYPE_DESTINATION     | ACCESS |
++-------------------+-----------------------+-------------------+----------------------+--------+
+| 00:10:00:00:00:01 | ProximitySensorImpl   | 00:11:00:00:00:02 | LightBulbImpl        | WRITE  |
+| 00:10:00:00:00:01 | ProximitySensorImpl   | 00:11:00:00:00:01 | LightBulbImpl        | WRITE  |
+| 00:10:00:00:00:05 | ProximitySensorBrandC | 00:11:00:00:00:01 | LightBulbImpl        | WRITE  |
+| 00:10:00:00:00:07 | ProximitySensorBrandD | 00:11:00:00:00:02 | LightBulbImpl        | WRITE  |
++-------------------+-----------------------+-------------------+----------------------+--------+
+11 rows in set (0.00 sec)
+
++-------------------+-----------------------+-------------------+----------------------+--------+
+| ID_SOURCE         | TYPE_SOURCE           | ID_DESTINATION    | TYPE_DESTINATION     | ACCESS |
++-------------------+-----------------------+-------------------+----------------------+--------+
+| 00:10:00:00:00:01 | ProximitySensorImpl   | 00:11:00:00:00:02 | LightBulbImpl        | WRITE  |
+|                                           | 00:11:00:00:00:01 | LightBulbImpl        | WRITE  |
+| 00:10:00:00:00:05 | ProximitySensorBrandC | 00:11:00:00:00:01 | LightBulbImpl        | WRITE  |
+| 00:10:00:00:00:07 | ProximitySensorBrandD | 00:11:00:00:00:02 | LightBulbImpl        | WRITE  |
++-------------------+-----------------------+-------------------+----------------------+--------+
+
+
+Objects need to be created:
+
+AcmeProximity (dc-8)
+LightBulbImpl 00:11:00:00:00:01 (dc-9)
+LightBulbImpl 00:11:00:00:00:02 (dc-9)
+ProximitySensorImpl 00:10:00:00:00:01 (dc-9)
+ProximitySensorImpl 00:10:00:00:00:03 (dc-9)
+ProximitySensorBrandC 00:10:00:00:00:05 (dc-11)
+ProximitySensorBrandD 00:10:00:00:00:07 (dc-11)
+
diff --git a/localconfig/mysql/AcmeVentControl_query_results b/localconfig/mysql/AcmeVentControl_query_results
new file mode 100644 (file)
index 0000000..b0ed022
--- /dev/null
@@ -0,0 +1,50 @@
+mysql> select * from ProximitySensor where zone=2;
++-------------------+------+-------+
+| ID                | ZONE | POWER |
++-------------------+------+-------+
+| 00:10:00:00:00:03 |    2 |   100 |
+| 00:10:00:00:00:07 |    2 |   100 |
++-------------------+------+-------+
+2 rows in set (0.00 sec)
+
+mysql> select * from Vent where zone=1;
++-------------------+------+
+| ID                | ZONE |
++-------------------+------+
+| 00:14:00:00:00:01 |    1 |
+| 00:14:00:00:00:02 |    1 |
++-------------------+------+
+2 rows in set (0.00 sec)
+
+mysql> select * from IoTComm;
++-------------------+-----------------------+-------------------+----------------------+--------+
+| ID_SOURCE         | TYPE_SOURCE           | ID_DESTINATION    | TYPE_DESTINATION     | ACCESS |
++-------------------+-----------------------+-------------------+----------------------+--------+
+| 00:10:00:00:00:01 | ProximitySensorImpl   | 00:14:00:00:00:01 | VentImpl             | WRITE  |
+| 00:10:00:00:00:02 | ProximitySensorImpl   | 00:14:00:00:00:02 | VentImpl             | WRITE  |
+| 00:10:00:00:00:03 | ProximitySensorImpl   | 00:14:00:00:00:03 | VentImpl             | WRITE  |
+| 00:10:00:00:00:03 | ProximitySensorImpl   | 00:14:00:00:00:04 | VentImpl             | WRITE  |
++-------------------+-----------------------+-------------------+----------------------+--------+
+11 rows in set (0.00 sec)
+
++-------------------+-----------------------+-------------------+----------------------+--------+
+| ID_SOURCE         | TYPE_SOURCE           | ID_DESTINATION    | TYPE_DESTINATION     | ACCESS |
++-------------------+-----------------------+-------------------+----------------------+--------+
+| 00:10:00:00:00:01 | ProximitySensorImpl   | 00:14:00:00:00:01 | VentImpl             | WRITE  |
+| 00:10:00:00:00:02 | ProximitySensorImpl   | 00:14:00:00:00:02 | VentImpl             | WRITE  |
+| 00:10:00:00:00:03 | ProximitySensorImpl   | 00:14:00:00:00:03 | VentImpl             | WRITE  |
+|                                           | 00:14:00:00:00:04 | VentImpl             | WRITE  |
++-------------------+-----------------------+-------------------+----------------------+--------+
+
+Objects need to be created:
+
+AcmeVentControl (dc-8)
+VentImpl 00:14:00:00:00:01 (dc-11)
+VentImpl 00:14:00:00:00:02 (dc-11)
+VentImpl 00:14:00:00:00:03 (dc-11)
+VentImpl 00:14:00:00:00:04 (dc-11)
+ProximitySensorImpl 00:10:00:00:00:01 (dc-9)
+ProximitySensorImpl 00:10:00:00:00:02 (dc-9)
+ProximitySensorImpl 00:10:00:00:00:03 (dc-9)
+ProximitySensorBrandD 00:10:00:00:00:07 (dc-11)
+
diff --git a/localconfig/mysql/GoogleAPIsAddress.config b/localconfig/mysql/GoogleAPIsAddress.config
new file mode 100644 (file)
index 0000000..a5fe158
--- /dev/null
@@ -0,0 +1,5 @@
+SELECT * FROM
+IoTAddress
+WHERE
+TYPE='GoogleBrilloWeave2'
+;
diff --git a/localconfig/mysql/GoogleAccountAddress.config b/localconfig/mysql/GoogleAccountAddress.config
new file mode 100644 (file)
index 0000000..4221828
--- /dev/null
@@ -0,0 +1,5 @@
+SELECT * FROM
+IoTAddress
+WHERE
+TYPE='GoogleBrilloWeave1'
+;
diff --git a/localconfig/mysql/audioRooms.config b/localconfig/mysql/audioRooms.config
new file mode 100644 (file)
index 0000000..61a95ee
--- /dev/null
@@ -0,0 +1,5 @@
+SELECT * FROM
+Room
+WHERE
+TYPE='AudioRoom'
+;
diff --git a/localconfig/mysql/blossomSprAddressSet.config b/localconfig/mysql/blossomSprAddressSet.config
new file mode 100644 (file)
index 0000000..8c41319
--- /dev/null
@@ -0,0 +1,5 @@
+SELECT * FROM
+IoTDeviceAddress
+WHERE
+TYPE='BlossomSprinklerAdd1'
+;
diff --git a/localconfig/mysql/cam_addresses.config b/localconfig/mysql/cam_addresses.config
new file mode 100644 (file)
index 0000000..b15d293
--- /dev/null
@@ -0,0 +1,5 @@
+SELECT * FROM
+IoTDeviceAddress
+WHERE
+TYPE='AmcrestCameraAdd'
+;
diff --git a/localconfig/mysql/cameraSet.config b/localconfig/mysql/cameraSet.config
new file mode 100644 (file)
index 0000000..7e16ba1
--- /dev/null
@@ -0,0 +1,5 @@
+SELECT * FROM\r
+Camera\r
+WHERE\r
+ID='CM1'\r
+;\r
diff --git a/localconfig/mysql/cameras.config b/localconfig/mysql/cameras.config
new file mode 100644 (file)
index 0000000..939eb25
--- /dev/null
@@ -0,0 +1,3 @@
+SELECT * FROM
+Camera
+;
diff --git a/localconfig/mysql/devUdpAddress.config b/localconfig/mysql/devUdpAddress.config
new file mode 100644 (file)
index 0000000..2fa1888
--- /dev/null
@@ -0,0 +1,5 @@
+SELECT * FROM
+IoTDeviceAddress
+WHERE
+TYPE='SpruceSensorAdd'
+;
diff --git a/localconfig/mysql/devZigbeeAddress.config b/localconfig/mysql/devZigbeeAddress.config
new file mode 100644 (file)
index 0000000..befc17a
--- /dev/null
@@ -0,0 +1,5 @@
+SELECT * FROM
+IoTZigbeeAddress
+WHERE
+TYPE='SpruceSensorZBAdd'
+;
diff --git a/localconfig/mysql/gpsSet.config b/localconfig/mysql/gpsSet.config
new file mode 100644 (file)
index 0000000..cde5488
--- /dev/null
@@ -0,0 +1,3 @@
+SELECT * FROM\r
+GPSGateway\r
+;\r
diff --git a/localconfig/mysql/gps_address.config b/localconfig/mysql/gps_address.config
new file mode 100644 (file)
index 0000000..2901c23
--- /dev/null
@@ -0,0 +1,5 @@
+SELECT * FROM
+IoTDeviceAddress
+WHERE
+TYPE='GPSPhoneGatewayAdd'
+;
diff --git a/localconfig/mysql/gwSet.config b/localconfig/mysql/gwSet.config
new file mode 100644 (file)
index 0000000..a506d4c
--- /dev/null
@@ -0,0 +1,3 @@
+SELECT * FROM\r
+WeatherGateway\r
+;\r
diff --git a/localconfig/mysql/lawnCameraRelation.config b/localconfig/mysql/lawnCameraRelation.config
new file mode 100644 (file)
index 0000000..137a132
--- /dev/null
@@ -0,0 +1,6 @@
+SELECT RELATION FROM\r
+FIRST\r
+Lawn\r
+OTHER\r
+Camera\r
+;\r
diff --git a/localconfig/mysql/lawnMoistureSensorRelation.config b/localconfig/mysql/lawnMoistureSensorRelation.config
new file mode 100644 (file)
index 0000000..5a72f79
--- /dev/null
@@ -0,0 +1,6 @@
+SELECT RELATION FROM\r
+FIRST\r
+Lawn\r
+OTHER\r
+MoistureSensor\r
+;\r
diff --git a/localconfig/mysql/lawnSet.config b/localconfig/mysql/lawnSet.config
new file mode 100644 (file)
index 0000000..c507f89
--- /dev/null
@@ -0,0 +1,3 @@
+SELECT * FROM\r
+Lawn\r
+;\r
diff --git a/localconfig/mysql/lawnSprinklerRelation.config b/localconfig/mysql/lawnSprinklerRelation.config
new file mode 100644 (file)
index 0000000..9be34c7
--- /dev/null
@@ -0,0 +1,8 @@
+SELECT RELATION FROM\r
+FIRST\r
+Lawn\r
+OTHER\r
+Sprinkler\r
+WHERE\r
+ID_DESTINATION='SP2'\r
+;\r
diff --git a/localconfig/mysql/lb_addresses.config b/localconfig/mysql/lb_addresses.config
new file mode 100644 (file)
index 0000000..74133dc
--- /dev/null
@@ -0,0 +1,5 @@
+SELECT * FROM
+IoTDeviceAddress
+WHERE
+TYPE='LifxLightBulbAdd'
+;
diff --git a/localconfig/mysql/led_flasher.config b/localconfig/mysql/led_flasher.config
new file mode 100644 (file)
index 0000000..c07542a
--- /dev/null
@@ -0,0 +1,3 @@
+SELECT * FROM
+LEDFlasher
+;
diff --git a/localconfig/mysql/lifx_light_bulb.config b/localconfig/mysql/lifx_light_bulb.config
new file mode 100644 (file)
index 0000000..11171b0
--- /dev/null
@@ -0,0 +1,3 @@
+SELECT * FROM
+LightBulb
+;
diff --git a/localconfig/mysql/light_bulbs.config b/localconfig/mysql/light_bulbs.config
new file mode 100644 (file)
index 0000000..11171b0
--- /dev/null
@@ -0,0 +1,3 @@
+SELECT * FROM
+LightBulb
+;
diff --git a/localconfig/mysql/localAddressSet.config b/localconfig/mysql/localAddressSet.config
new file mode 100644 (file)
index 0000000..f0ee404
--- /dev/null
@@ -0,0 +1,5 @@
+SELECT * FROM
+IoTDeviceAddress
+WHERE
+TYPE='BlossomSprinklerAdd2'
+;
diff --git a/localconfig/mysql/mainRoomLightBulbs.config b/localconfig/mysql/mainRoomLightBulbs.config
new file mode 100644 (file)
index 0000000..11171b0
--- /dev/null
@@ -0,0 +1,3 @@
+SELECT * FROM
+LightBulb
+;
diff --git a/localconfig/mysql/moistureSensorsSet.config b/localconfig/mysql/moistureSensorsSet.config
new file mode 100644 (file)
index 0000000..ef7d5a7
--- /dev/null
@@ -0,0 +1,3 @@
+SELECT * FROM\r
+MoistureSensor\r
+;\r
diff --git a/localconfig/mysql/ph_address.config b/localconfig/mysql/ph_address.config
new file mode 100644 (file)
index 0000000..534acc9
--- /dev/null
@@ -0,0 +1,5 @@
+SELECT * FROM
+IoTDeviceAddress
+WHERE
+TYPE='WeatherPhoneGatewayAdd'
+;
diff --git a/localconfig/mysql/roomCameraRel.config b/localconfig/mysql/roomCameraRel.config
new file mode 100644 (file)
index 0000000..3297815
--- /dev/null
@@ -0,0 +1,6 @@
+SELECT RELATION FROM
+FIRST
+Room
+OTHER
+Camera
+;
diff --git a/localconfig/mysql/roomMainBulbRel.config b/localconfig/mysql/roomMainBulbRel.config
new file mode 100644 (file)
index 0000000..5f82a4b
--- /dev/null
@@ -0,0 +1,6 @@
+SELECT RELATION FROM
+FIRST
+Room
+OTHER
+LightBulb
+;
diff --git a/localconfig/mysql/roomSpeakerRel.config b/localconfig/mysql/roomSpeakerRel.config
new file mode 100644 (file)
index 0000000..3f88688
--- /dev/null
@@ -0,0 +1,6 @@
+SELECT RELATION FROM
+FIRST
+Room
+OTHER
+Speaker
+;
diff --git a/localconfig/mysql/rooms.config b/localconfig/mysql/rooms.config
new file mode 100644 (file)
index 0000000..a085212
--- /dev/null
@@ -0,0 +1,5 @@
+SELECT * FROM
+Room
+WHERE
+TYPE='LabRoom'
+;
diff --git a/localconfig/mysql/speakerAddresses.config b/localconfig/mysql/speakerAddresses.config
new file mode 100644 (file)
index 0000000..1a93655
--- /dev/null
@@ -0,0 +1,5 @@
+SELECT * FROM
+IoTDeviceAddress
+WHERE
+TYPE LIKE 'IHomeAdd%' 
+;
diff --git a/localconfig/mysql/speakerSet.config b/localconfig/mysql/speakerSet.config
new file mode 100644 (file)
index 0000000..7ebde92
--- /dev/null
@@ -0,0 +1,3 @@
+SELECT * FROM\r
+Speaker\r
+;\r
diff --git a/localconfig/mysql/spr_Addresses.config b/localconfig/mysql/spr_Addresses.config
new file mode 100644 (file)
index 0000000..62fcb3c
--- /dev/null
@@ -0,0 +1,5 @@
+SELECT * FROM
+IoTDeviceAddress
+WHERE
+TYPE='EspSprinklerAdd'
+;
diff --git a/localconfig/mysql/weatherDataAddressMain.config b/localconfig/mysql/weatherDataAddressMain.config
new file mode 100644 (file)
index 0000000..b05e947
--- /dev/null
@@ -0,0 +1,5 @@
+SELECT * FROM\r
+IoTAddress\r
+WHERE\r
+ID='WF2'\r
+;\r
diff --git a/localconfig/mysql/weatherDataAddresses.config b/localconfig/mysql/weatherDataAddresses.config
new file mode 100644 (file)
index 0000000..8fc4407
--- /dev/null
@@ -0,0 +1,5 @@
+SELECT * FROM\r
+IoTAddress\r
+WHERE\r
+ID='WF1'\r
+;\r