--- /dev/null
+import iotcloud.*;
+
+class Controller {
+ public static void main(String[] args) throws Exception {
+
+
+ Table t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 399, -1);
+ // t1.initTable();
+ t1.rebuild();
+
+ String a = "bulb";
+ IoTString ia = new IoTString(a);
+ t1.createNewKey(ia, 399);
+
+ t1.update();
+
+
+
+ String valueA = "on";
+ IoTString iValueA = new IoTString(valueA);
+
+
+ IoTString testValA1 = t1.getCommitted(ia);
+
+ if ((testValA1 != null) && (testValA1.equals(iValueA) == true)) {
+ System.out.println("Is True");
+ } else {
+ System.out.println("Is False or Null");
+ }
+
+
+
+ t1.startTransaction();
+ t1.addKV(ia, iValueA);
+ t1.commitTransaction();
+
+ t1.update();
+ testValA1 = t1.getCommitted(ia);
+
+ if ((testValA1 != null) && (testValA1.equals(iValueA) == true)) {
+ System.out.println("Is True");
+ } else {
+ System.out.println("Is False or Null");
+ }
+
+ }
+
+}
\ No newline at end of file
--- /dev/null
+First build using:
+ ./build.bash
+
+To run this example run:
+
+ # Starts the light bulb controller
+ ./run1.bash
+
+ # Starts the fan controller
+ ./run3.bash
+
+
+ # For each switch you need to run (can launch as many of these as desired as long as input number is different)
+ ./run2.bash <a unique integer not equal to 321 or 351>
+
+
+Dont forget to clear the cloud server directory
\ No newline at end of file