+import iotcloud.*;
+import java.util.*;
+
+class LocalControl {
+
+ public static void main(String[] args) throws Exception {
+
+ String a = "bulb";
+ IoTString ia = new IoTString(a);
+
+ String valueA = "on";
+ IoTString iValueA = new IoTString(valueA);
+
+ String valueB = "off";
+ IoTString iValueB = new IoTString(valueB);
+
+ System.out.println("Starting System");
+ int counter = 0;
+
+
+ Table t1 = null;
+ try {
+ t1 = new Table("http://dc-6.calit2.uci.edu/test.iotcloud/", "reallysecret", 399, 7000);
+ t1.addLocalCommunication(400, "192.168.1.192", 6000);
+ System.out.println("Rebuilding!");
+ t1.rebuild();
+
+ while (true) {
+ t1.update();
+ //IoTString testValA1 = t1.getCommitted(ia);
+ t1.startTransaction();
+ t1.addKV(ia, iValueA);
+ t1.commitTransaction();
+ t1.update();
+ Thread.sleep(1000);
+ System.out.println("Turning on");
+
+ t1.update();
+ //IoTString testValA1 = t1.getCommitted(ia);
+ t1.startTransaction();
+ t1.addKV(ia, iValueB);
+ t1.commitTransaction();
+ t1.update();
+ Thread.sleep(1000);
+ System.out.println("Turning off");
+ }
+ } catch (Error e) {
+
+ e.printStackTrace();
+
+ }
+ }
+}