// Path: src/main/java/edu/sjsu/mithai/export/ExportMessage.java
// public class ExportMessage implements Serializable {
// 
//     //TODO in future we may need to add fields to this.
// 
//     protected final String message;
// 
//     public  ExportMessage(String message) {
//         this.message = message;
//     }
// 
//     public String getMessage() {
//         return message;
//     }
// 
//     @Override
//     public String toString() {
//         return "ExportMessage{" +
//                 "message:" + message +
//                 '}';
//     }
// }
// 
// Path: src/main/java/edu/sjsu/mithai/util/Ihandler.java
// public interface Ihandler {
// 
//     void handle(String functionName, String msg);
// }


import com.google.gson.Gson;
import edu.sjsu.mithai.export.ExportMessage;
import edu.sjsu.mithai.spark.Store;
import edu.sjsu.mithai.util.Ihandler;
import java.util.HashMap;
import java.util.Map;
package edu.sjsu.mithai.apps.temperature;



public class TemperatureHandler implements Ihandler {

    private Gson gson;
    public TemperatureHandler() {
        this.gson = new Gson();
    }

    @Override
    public void handle(String functionName, String msg) {

        if (functionName.equals("average")) {
            System.out.println("Average is =>" + msg);

            Map<String, String> data = new HashMap<>();
            data.put("key","temperature.average");
            data.put("value", msg);
            data.put("time", String.valueOf(System.currentTimeMillis()/1_000_000));

// Path: src/main/java/edu/sjsu/mithai/export/ExportMessage.java
// public class ExportMessage implements Serializable {
// 
//     //TODO in future we may need to add fields to this.
// 
//     protected final String message;
// 
//     public  ExportMessage(String message) {
//         this.message = message;
//     }
// 
//     public String getMessage() {
//         return message;
//     }
// 
//     @Override
//     public String toString() {
//         return "ExportMessage{" +
//                 "message:" + message +
//                 '}';
//     }
// }
// 
// Path: src/main/java/edu/sjsu/mithai/util/Ihandler.java
// public interface Ihandler {
// 
//     void handle(String functionName, String msg);
// }


// Path: src/main/java/edu/sjsu/mithai/apps/temperature/TemperatureHandler.java
import com.google.gson.Gson;
import edu.sjsu.mithai.export.ExportMessage;
import edu.sjsu.mithai.spark.Store;
import edu.sjsu.mithai.util.Ihandler;
import java.util.HashMap;
import java.util.Map;

package edu.sjsu.mithai.apps.temperature;



public class TemperatureHandler implements Ihandler {

    private Gson gson;
    public TemperatureHandler() {
        this.gson = new Gson();
    }

    @Override
    public void handle(String functionName, String msg) {

        if (functionName.equals("average")) {
            System.out.println("Average is =>" + msg);

            Map<String, String> data = new HashMap<>();
            data.put("key","temperature.average");
            data.put("value", msg);
            data.put("time", String.valueOf(System.currentTimeMillis()/1_000_000));

            ExportMessage exportMessage = new ExportMessage(gson.toJson(data));