diff --git a/modules/samples/watertank/component/analytics/build.xml b/modules/samples/watertank/component/analytics/build.xml index 28ff77c7..3464a310 100644 --- a/modules/samples/watertank/component/analytics/build.xml +++ b/modules/samples/watertank/component/analytics/build.xml @@ -23,6 +23,7 @@ + @@ -37,6 +38,9 @@ + + + diff --git a/modules/samples/watertank/component/analytics/src/main/resources/carbonapps/waterlevel_summary/artifacts.xml b/modules/samples/watertank/component/analytics/src/main/resources/carbonapps/waterlevel_summary/artifacts.xml new file mode 100644 index 00000000..cffe3fce --- /dev/null +++ b/modules/samples/watertank/component/analytics/src/main/resources/carbonapps/waterlevel_summary/artifacts.xml @@ -0,0 +1,26 @@ + + + + + + + + + + diff --git a/modules/samples/watertank/component/analytics/src/main/resources/carbonapps/waterlevel_summary/waterlevel_summary_execution_pain/artifact.xml b/modules/samples/watertank/component/analytics/src/main/resources/carbonapps/waterlevel_summary/waterlevel_summary_execution_pain/artifact.xml new file mode 100644 index 00000000..17d808f9 --- /dev/null +++ b/modules/samples/watertank/component/analytics/src/main/resources/carbonapps/waterlevel_summary/waterlevel_summary_execution_pain/artifact.xml @@ -0,0 +1,22 @@ + + + + + org_wso2_iot_devices_waterlevel_summary.siddhiql + diff --git a/modules/samples/watertank/component/analytics/src/main/resources/carbonapps/waterlevel_summary/waterlevel_summary_execution_pain/org_wso2_iot_devices_waterlevel_summary.siddhiql b/modules/samples/watertank/component/analytics/src/main/resources/carbonapps/waterlevel_summary/waterlevel_summary_execution_pain/org_wso2_iot_devices_waterlevel_summary.siddhiql new file mode 100644 index 00000000..71926d7b --- /dev/null +++ b/modules/samples/watertank/component/analytics/src/main/resources/carbonapps/waterlevel_summary/waterlevel_summary_execution_pain/org_wso2_iot_devices_waterlevel_summary.siddhiql @@ -0,0 +1,18 @@ +/* Enter a unique ExecutionPlan */ +@Plan:name('waterflow_sensor_execution_plan') + +/* Enter a unique description for ExecutionPlan */ +-- @Plan:description('ExecutionPlan') + +/* define streams/tables and write queries here ... */ + +@Import('org.wso2.iot.devices.waterlevel:1.0.0') +define stream waterLevelInputMapper (meta_owner string, meta_deviceType string, meta_deviceId string, meta_time long, waterlevel float); + +@Export('org.wso2.iot.devices.waterlevel.stats:1.0.0') +define stream waterLevelOutputMapper (meta_owner string, meta_deviceType string, meta_deviceId string, meta_time long, waterlevel float, waterLevelMargin double, averageValue double); + +from waterLevelInputMapper#window.timeBatch(1 min) +select meta_owner, meta_deviceType, meta_deviceId, meta_time, waterlevel, 0.0 as waterLevelMargin, avg(waterlevel) as averageValue +group by meta_owner, meta_deviceType, meta_deviceId, meta_time +insert into waterLevelOutputMapper; \ No newline at end of file diff --git a/modules/samples/watertank/component/analytics/src/main/resources/carbonapps/waterlevel_summary/waterlevel_summary_store/artifact.xml b/modules/samples/watertank/component/analytics/src/main/resources/carbonapps/waterlevel_summary/waterlevel_summary_store/artifact.xml new file mode 100644 index 00000000..7434da32 --- /dev/null +++ b/modules/samples/watertank/component/analytics/src/main/resources/carbonapps/waterlevel_summary/waterlevel_summary_store/artifact.xml @@ -0,0 +1,22 @@ + + + + + org_wso2_iot_devices_waterlevel_summary.xml + diff --git a/modules/samples/watertank/component/analytics/src/main/resources/carbonapps/waterlevel_summary/waterlevel_summary_store/org_wso2_iot_devices_waterlevel_summary.xml b/modules/samples/watertank/component/analytics/src/main/resources/carbonapps/waterlevel_summary/waterlevel_summary_store/org_wso2_iot_devices_waterlevel_summary.xml new file mode 100644 index 00000000..c2d3ba3b --- /dev/null +++ b/modules/samples/watertank/component/analytics/src/main/resources/carbonapps/waterlevel_summary/waterlevel_summary_store/org_wso2_iot_devices_waterlevel_summary.xml @@ -0,0 +1,77 @@ + + + + + + + meta_owner + true + true + false + STRING + + + meta_deviceType + true + true + false + STRING + + + meta_deviceId + true + true + false + STRING + + + meta_time + true + true + false + LONG + + + waterlevel + true + true + false + FLOAT + + + waterLevelMargin + true + true + false + DOUBLE + + + averageValue + true + true + false + DOUBLE + + + + org.wso2.iot.devices.waterlevel.stats:1.0.0 + + false + EVENT_STORE + \ No newline at end of file diff --git a/modules/samples/watertank/component/analytics/src/main/resources/carbonapps/waterlevel_summary/waterlevel_summary_stream/artifact.xml b/modules/samples/watertank/component/analytics/src/main/resources/carbonapps/waterlevel_summary/waterlevel_summary_stream/artifact.xml new file mode 100644 index 00000000..156063eb --- /dev/null +++ b/modules/samples/watertank/component/analytics/src/main/resources/carbonapps/waterlevel_summary/waterlevel_summary_stream/artifact.xml @@ -0,0 +1,23 @@ + + + + + org.wso2.iot.devices.waterlevel.stats_1.0.0.json + + diff --git a/modules/samples/watertank/component/analytics/src/main/resources/carbonapps/waterlevel_summary/waterlevel_summary_stream/org.wso2.iot.devices.waterlevel.stats_1.0.0.json b/modules/samples/watertank/component/analytics/src/main/resources/carbonapps/waterlevel_summary/waterlevel_summary_stream/org.wso2.iot.devices.waterlevel.stats_1.0.0.json new file mode 100644 index 00000000..83c3ca45 --- /dev/null +++ b/modules/samples/watertank/component/analytics/src/main/resources/carbonapps/waterlevel_summary/waterlevel_summary_stream/org.wso2.iot.devices.waterlevel.stats_1.0.0.json @@ -0,0 +1,38 @@ +{ + "name": "org.wso2.iot.devices.waterlevel.stats", + "version": "1.0.0", + "nickName": "", + "description": "", + "metaData": [ + { + "name": "owner", + "type": "STRING" + }, + { + "name": "deviceType", + "type": "STRING" + }, + { + "name": "deviceId", + "type": "STRING" + }, + { + "name": "time", + "type": "LONG" + } + ], + "payloadData": [ + { + "name": "waterlevel", + "type": "FLOAT" + }, + { + "name": "waterLevelMargin", + "type": "DOUBLE" + }, + { + "name": "averageValue", + "type": "DOUBLE" + } + ] +}