From b06f608c8f7e93fcc1745e890c27b51730146545 Mon Sep 17 00:00:00 2001 From: charitha Date: Fri, 10 Aug 2018 19:36:17 +0530 Subject: [PATCH] Add execution plans for operation and notification publishing --- ...SO2IoT-DeviceOperation-Publisher_1.0.0.xml | 42 ------------------- .../WSO2IoT-Operation-ExecutionPlan.siddhiql | 16 +++++++ .../artifact.xml | 23 ++++++++++ .../carbonapps/device_analytics/artifacts.xml | 2 +- .../WSO2IoT-GeoAlerts-ExecutionPlan.siddhiql | 16 +++++++ .../artifact.xml | 13 +++--- .../main/resources/carbonapps/artifacts.xml | 1 + 7 files changed, 64 insertions(+), 49 deletions(-) delete mode 100644 components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/device_analytics/WSO2IoT-DeviceOperation-Publisher_1.0.0/WSO2IoT-DeviceOperation-Publisher_1.0.0.xml create mode 100644 components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/device_analytics/WSO2IoT-Operation-ExecutionPlan_1.0.0/WSO2IoT-Operation-ExecutionPlan.siddhiql create mode 100644 components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/device_analytics/WSO2IoT-Operation-ExecutionPlan_1.0.0/artifact.xml create mode 100644 components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/WSO2IoT-GeoAlerts-ExecutionPlan_1.0.0/WSO2IoT-GeoAlerts-ExecutionPlan.siddhiql rename components/analytics/iot-analytics/{org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/device_analytics/WSO2IoT-DeviceOperation-Publisher_1.0.0 => org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/WSO2IoT-GeoAlerts-ExecutionPlan_1.0.0}/artifact.xml (62%) diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/device_analytics/WSO2IoT-DeviceOperation-Publisher_1.0.0/WSO2IoT-DeviceOperation-Publisher_1.0.0.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/device_analytics/WSO2IoT-DeviceOperation-Publisher_1.0.0/WSO2IoT-DeviceOperation-Publisher_1.0.0.xml deleted file mode 100644 index 7d52806b57..0000000000 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/device_analytics/WSO2IoT-DeviceOperation-Publisher_1.0.0/WSO2IoT-DeviceOperation-Publisher_1.0.0.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - { - "deviceIdentifiers": {{meta_deviceIdentifiers}}, - "deviceType": "{{meta_deviceType}}", - "operation": { - "code": "{{code}}", - "type": "{{type}}", - "status": "PENDING", - "isEnabled": "{{isEnabled}}", - "payLoad": "{{payLoad}}" - } - } - - - - HttpPost - https://localhost:9443/api/device-mgt/v1.0/devices/{deviceType}/operations - true - - diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/device_analytics/WSO2IoT-Operation-ExecutionPlan_1.0.0/WSO2IoT-Operation-ExecutionPlan.siddhiql b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/device_analytics/WSO2IoT-Operation-ExecutionPlan_1.0.0/WSO2IoT-Operation-ExecutionPlan.siddhiql new file mode 100644 index 0000000000..a6030d9b97 --- /dev/null +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/device_analytics/WSO2IoT-Operation-ExecutionPlan_1.0.0/WSO2IoT-Operation-ExecutionPlan.siddhiql @@ -0,0 +1,16 @@ +/* Enter a unique ExecutionPlan */ +@Plan:name('WSO2IoT-Operation-ExecutionPlan') + +/* Enter a unique description for ExecutionPlan */ +@Plan:description('Publish operations to devices coming from org.wso2.iot.operation stream') + +/* define streams/tables and write queries here ... */ + +@Plan:trace('false') + +@Import('org.wso2.iot.operation:1.0.0') +define stream dataIn (meta_deviceIdentifiers string, meta_deviceType string, code string, type string, isEnabled bool, payLoad string); + +from dataIn#device:addOperation(meta_deviceIdentifiers, meta_deviceType, code, type, isEnabled, payLoad) +select * +insert into drop; \ No newline at end of file diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/device_analytics/WSO2IoT-Operation-ExecutionPlan_1.0.0/artifact.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/device_analytics/WSO2IoT-Operation-ExecutionPlan_1.0.0/artifact.xml new file mode 100644 index 0000000000..ae461dddfd --- /dev/null +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/device_analytics/WSO2IoT-Operation-ExecutionPlan_1.0.0/artifact.xml @@ -0,0 +1,23 @@ + + + + + WSO2IoT-Operation-ExecutionPlan.siddhiql + + diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/device_analytics/artifacts.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/device_analytics/artifacts.xml index 0fcdbe5b10..baddee4b43 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/device_analytics/artifacts.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/device_analytics/artifacts.xml @@ -30,7 +30,7 @@ serverRole="DataAnalyticsServer"/> - diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/WSO2IoT-GeoAlerts-ExecutionPlan_1.0.0/WSO2IoT-GeoAlerts-ExecutionPlan.siddhiql b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/WSO2IoT-GeoAlerts-ExecutionPlan_1.0.0/WSO2IoT-GeoAlerts-ExecutionPlan.siddhiql new file mode 100644 index 0000000000..7274dc4c58 --- /dev/null +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/WSO2IoT-GeoAlerts-ExecutionPlan_1.0.0/WSO2IoT-GeoAlerts-ExecutionPlan.siddhiql @@ -0,0 +1,16 @@ +/* Enter a unique ExecutionPlan */ +@Plan:name('WSO2IoT-GeoAlerts-ExecutionPlan') + +/* Enter a unique description for ExecutionPlan */ +@Plan:description('To convert the WSO2 IoT event incoming stream to relavant streams') + +/* define streams/tables and write queries here ... */ + +@Plan:trace('false') + +@Import('iot.per.device.stream.geo.AlertNotifications:1.0.0') +define stream dataIn (id string, owner string, state string, information string, timeStamp long, latitude double, longitude double, type string); + +from dataIn#device:addNotification(id, type, information) +select * +insert into ignore; \ No newline at end of file diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/device_analytics/WSO2IoT-DeviceOperation-Publisher_1.0.0/artifact.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/WSO2IoT-GeoAlerts-ExecutionPlan_1.0.0/artifact.xml similarity index 62% rename from components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/device_analytics/WSO2IoT-DeviceOperation-Publisher_1.0.0/artifact.xml rename to components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/WSO2IoT-GeoAlerts-ExecutionPlan_1.0.0/artifact.xml index 674c730be6..e725857dc0 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/device_analytics/WSO2IoT-DeviceOperation-Publisher_1.0.0/artifact.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/WSO2IoT-GeoAlerts-ExecutionPlan_1.0.0/artifact.xml @@ -1,4 +1,5 @@ - - - WSO2IoT-DeviceOperation-Publisher_1.0.0.xml + + WSO2IoT-GeoAlerts-ExecutionPlan.siddhiql + diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/artifacts.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/artifacts.xml index 9c2354b2fb..1e0e888f88 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/artifacts.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/artifacts.xml @@ -24,6 +24,7 @@ +