// Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
// 
//     protected String propertyFile;
//     protected Properties properties;
// 
//     public Configuration(String propertyFile) throws IOException {
//         this.propertyFile = propertyFile;
//         this.properties = new Properties();
//         properties.load(new FileReader(propertyFile));
//     }
// 
//     public String getProperty(String key) {
//         return properties.getProperty(key);
//     }
// 
//     public void setProperty(String key, String value) {
//         properties.setProperty(key, value);
//     }
// 
//     public Properties getProperties() {
//         return properties;
//     }
// 
//     public void setProperties(Properties properties) {
//         this.properties = properties;
//     }
// 
//     public void setPropertyFile(String propertyFile) {
//         this.propertyFile = propertyFile;
//     }
// 
//     public String getPropertyFile() {
//         return propertyFile;
//     }
// 
//     public void reload() throws IOException {
//         properties.clear();
//         properties.load(new FileReader(propertyFile));
//         System.out.println("=>" + properties);
//     }
// }
// 
// Path: src/main/java/edu/sjsu/mithai/config/MithaiProperties.java
// public interface MithaiProperties {
// 
//     // Self node properties
//     String IP = "IP";
//     String ID = "ID";
//     String CONNECTED_DEVICE_IDS = "CONNECTED_DEVICE_IDS";
//     String LOCAL_GRAPH = "LOCAL_GRAPH";
// 
//     // Sensor & Data generation related properties
//     String NUMBER_OF_SENSORS = "NUMBER_OF_SENSORS";
//     String DATA_GENERATION_INTERVAL = "DATA_GENERATION_INTERVAL";
//     String META_DATA_GENERATION_INTERVAL = "META_DATA_GENERATION_INTERVAL";
//     String QUIESCE_TIMEOUT = "QUIESCE_TIMEOUT";
//     String RESEND_COUNT = "RESEND_COUNT";
//     String STARTUP_THRESHOLD = "STARTUP_THRESHOLD";
// 
//     // INJECTOR PROPERTIES
//     String MQTT_BROKER = "MQTT_BROKER";
//     String MQTT_TOPIC = "MQTT_TOPIC";
// 
//     // Visualization System Properties
//     String VISUALIZATION_SYSTEM_EXPORTER_URL = "VISUALIZATION_SYSTEM_EXPORTER_URL";
// 
//     // EXPORTER PROPERTIES
//     String EXPORTER_TYPE = "EXPORTER_TYPE";
//     String EXPORTER_REMOTE_URI = "EXPORTER_REMOTE_IP";
//     String EXPORTER_KAFKA_TOPIC = "EXPORTER_KAFKA_TOPIC";
//     String EXPORTER_TIME_INTERVAL = "EXPORTER_TIME_INTERVAL";
// 
//     // Graphite exporter properties
//     String GRAPHITE_HOSTNAME = "GRAPHITE_HOSTNAME";
//     String GRAPHITE_PORT = "GRAPHITE_PORT";
// 
//     //Graph Processor Tasks
//     String ENTRY = "ENTRY";
//     String TASK_LIST = "TASK_LIST";
//     String FUNCTION_LIST = "FUNCTION_LIST";
// 
//     //Store Properties
//     String MESSAGE_STORE_QUEUE_SIZE = "MESSAGE_STORE_QUEUE_SIZE";
//     String MQTT_MESSAGE_STORE_QUEUE_SIZE = "MQTT_MESSAGE_STORE_QUEUE_SIZE";
//     String SPARKCONTEXT_INTERVAL = "SPARKCONTEXT_INTERVAL";
// 
// }
// 
// Path: src/main/scala/edu/sjsu/mithai/mqtt/MqttService.java
// public class MqttService {
//     private static MQTTPublisher publisher;
// 
//     private MqttService() {
//     }
// 
//     public static MQTTPublisher getPublisher(Configuration configuration) {
// 
//         if (publisher == null) {
//             publisher = new MQTTPublisher(configuration.getProperty(MithaiProperties.MQTT_BROKER));
//         }
// 
//         return publisher;
//     }
// }
// 
// Path: src/main/java/edu/sjsu/mithai/sensors/IDevice.java
// public interface IDevice {
// 
//     public double sense();
// 
//     public String getId();
// 
// }
// 
// Path: src/main/java/edu/sjsu/mithai/util/StoppableExecutableTask.java
// public abstract class StoppableExecutableTask implements Runnable, Executable, Stoppable {
// 
//     protected boolean stop;
// 
//     public StoppableExecutableTask() {
//         this.stop = false;
//     }
// 
//     @Override
//     public void run() {
//         do {
//             execute();
//         } while (!stop);
//     }
// 
//     @Override
//     public void stop() {
//         stop = true;
//     }
// 
// }


import edu.sjsu.mithai.config.Configuration;
import edu.sjsu.mithai.config.MithaiProperties;
import edu.sjsu.mithai.mqtt.MQTTPublisher;
import edu.sjsu.mithai.mqtt.MqttService;
import edu.sjsu.mithai.sensors.IDevice;
import edu.sjsu.mithai.util.StoppableExecutableTask;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
package edu.sjsu.mithai.data;



public class DataGenerationTask extends StoppableExecutableTask {

    private static final Logger logger = LoggerFactory.getLogger(DataGenerationTask.class);

    private SensorStore sensorStore;
// Path: src/main/java/edu/sjsu/mithai/config/Configuration.java
// public class Configuration {
// 
//     protected String propertyFile;
//     protected Properties properties;
// 
//     public Configuration(String propertyFile) throws IOException {
//         this.propertyFile = propertyFile;
//         this.properties = new Properties();
//         properties.load(new FileReader(propertyFile));
//     }
// 
//     public String getProperty(String key) {
//         return properties.getProperty(key);
//     }
// 
//     public void setProperty(String key, String value) {
//         properties.setProperty(key, value);
//     }
// 
//     public Properties getProperties() {
//         return properties;
//     }
// 
//     public void setProperties(Properties properties) {
//         this.properties = properties;
//     }
// 
//     public void setPropertyFile(String propertyFile) {
//         this.propertyFile = propertyFile;
//     }
// 
//     public String getPropertyFile() {
//         return propertyFile;
//     }
// 
//     public void reload() throws IOException {
//         properties.clear();
//         properties.load(new FileReader(propertyFile));
//         System.out.println("=>" + properties);
//     }
// }
// 
// Path: src/main/java/edu/sjsu/mithai/config/MithaiProperties.java
// public interface MithaiProperties {
// 
//     // Self node properties
//     String IP = "IP";
//     String ID = "ID";
//     String CONNECTED_DEVICE_IDS = "CONNECTED_DEVICE_IDS";
//     String LOCAL_GRAPH = "LOCAL_GRAPH";
// 
//     // Sensor & Data generation related properties
//     String NUMBER_OF_SENSORS = "NUMBER_OF_SENSORS";
//     String DATA_GENERATION_INTERVAL = "DATA_GENERATION_INTERVAL";
//     String META_DATA_GENERATION_INTERVAL = "META_DATA_GENERATION_INTERVAL";
//     String QUIESCE_TIMEOUT = "QUIESCE_TIMEOUT";
//     String RESEND_COUNT = "RESEND_COUNT";
//     String STARTUP_THRESHOLD = "STARTUP_THRESHOLD";
// 
//     // INJECTOR PROPERTIES
//     String MQTT_BROKER = "MQTT_BROKER";
//     String MQTT_TOPIC = "MQTT_TOPIC";
// 
//     // Visualization System Properties
//     String VISUALIZATION_SYSTEM_EXPORTER_URL = "VISUALIZATION_SYSTEM_EXPORTER_URL";
// 
//     // EXPORTER PROPERTIES
//     String EXPORTER_TYPE = "EXPORTER_TYPE";
//     String EXPORTER_REMOTE_URI = "EXPORTER_REMOTE_IP";
//     String EXPORTER_KAFKA_TOPIC = "EXPORTER_KAFKA_TOPIC";
//     String EXPORTER_TIME_INTERVAL = "EXPORTER_TIME_INTERVAL";
// 
//     // Graphite exporter properties
//     String GRAPHITE_HOSTNAME = "GRAPHITE_HOSTNAME";
//     String GRAPHITE_PORT = "GRAPHITE_PORT";
// 
//     //Graph Processor Tasks
//     String ENTRY = "ENTRY";
//     String TASK_LIST = "TASK_LIST";
//     String FUNCTION_LIST = "FUNCTION_LIST";
// 
//     //Store Properties
//     String MESSAGE_STORE_QUEUE_SIZE = "MESSAGE_STORE_QUEUE_SIZE";
//     String MQTT_MESSAGE_STORE_QUEUE_SIZE = "MQTT_MESSAGE_STORE_QUEUE_SIZE";
//     String SPARKCONTEXT_INTERVAL = "SPARKCONTEXT_INTERVAL";
// 
// }
// 
// Path: src/main/scala/edu/sjsu/mithai/mqtt/MqttService.java
// public class MqttService {
//     private static MQTTPublisher publisher;
// 
//     private MqttService() {
//     }
// 
//     public static MQTTPublisher getPublisher(Configuration configuration) {
// 
//         if (publisher == null) {
//             publisher = new MQTTPublisher(configuration.getProperty(MithaiProperties.MQTT_BROKER));
//         }
// 
//         return publisher;
//     }
// }
// 
// Path: src/main/java/edu/sjsu/mithai/sensors/IDevice.java
// public interface IDevice {
// 
//     public double sense();
// 
//     public String getId();
// 
// }
// 
// Path: src/main/java/edu/sjsu/mithai/util/StoppableExecutableTask.java
// public abstract class StoppableExecutableTask implements Runnable, Executable, Stoppable {
// 
//     protected boolean stop;
// 
//     public StoppableExecutableTask() {
//         this.stop = false;
//     }
// 
//     @Override
//     public void run() {
//         do {
//             execute();
//         } while (!stop);
//     }
// 
//     @Override
//     public void stop() {
//         stop = true;
//     }
// 
// }


// Path: src/main/scala/edu/sjsu/mithai/data/DataGenerationTask.java
import edu.sjsu.mithai.config.Configuration;
import edu.sjsu.mithai.config.MithaiProperties;
import edu.sjsu.mithai.mqtt.MQTTPublisher;
import edu.sjsu.mithai.mqtt.MqttService;
import edu.sjsu.mithai.sensors.IDevice;
import edu.sjsu.mithai.util.StoppableExecutableTask;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

package edu.sjsu.mithai.data;



public class DataGenerationTask extends StoppableExecutableTask {

    private static final Logger logger = LoggerFactory.getLogger(DataGenerationTask.class);

    private SensorStore sensorStore;
    private Configuration configuration;