|
|
|
@ -69,15 +69,9 @@ public class SidhdhiQuery implements Runnable {
|
|
|
|
|
//Start the execution plan with pre-defined or previously persisted Siddhi query
|
|
|
|
|
File f = new File(sidhdhiQueryPath);
|
|
|
|
|
while (true) {
|
|
|
|
|
|
|
|
|
|
if (f.exists()) {
|
|
|
|
|
//AgentUtilOperations.writeToFile("", sidhdhiQueryPath);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StartExecutionPlan startExecutionPlan = new StartExecutionPlan().invoke();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Check if there is new policy update available
|
|
|
|
|
if (AgentManager.isUpdated()) {
|
|
|
|
|
System.out.print("### Policy Update Detected!");
|
|
|
|
@ -86,7 +80,6 @@ public class SidhdhiQuery implements Runnable {
|
|
|
|
|
startExecutionPlan = new StartExecutionPlan().invoke();
|
|
|
|
|
}
|
|
|
|
|
InputHandler inputHandler = startExecutionPlan.getInputHandler();
|
|
|
|
|
|
|
|
|
|
//Sending events to Siddhi
|
|
|
|
|
try {
|
|
|
|
|
int humidityReading = AgentManager.getInstance().getTemperature();
|
|
|
|
@ -119,7 +112,7 @@ public class SidhdhiQuery implements Runnable {
|
|
|
|
|
public static String readFile(String path, Charset encoding) {
|
|
|
|
|
byte[] encoded = new byte[0];
|
|
|
|
|
try {
|
|
|
|
|
if(new File(sidhdhiQueryPath).exists()){
|
|
|
|
|
if (new File(sidhdhiQueryPath).exists()) {
|
|
|
|
|
encoded = Files.readAllBytes(Paths.get(path));
|
|
|
|
|
}
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
@ -197,10 +190,8 @@ public class SidhdhiQuery implements Runnable {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//Retrieving InputHandler to push events into Siddhi
|
|
|
|
|
inputHandler = siddhiManager.getInputHandler("fireAlarmEventStream");
|
|
|
|
|
|
|
|
|
|
//Starting event processing
|
|
|
|
|
// System.out.println("Execution Plan Started!");
|
|
|
|
|
return this;
|
|
|
|
|