From 5755d5bbe35bcdf0d0ebb44eadd7eb45b842ba3d Mon Sep 17 00:00:00 2001 From: savidude Date: Wed, 21 Jun 2017 19:45:23 +0530 Subject: [PATCH] Restructuring RaspberryPi analytics --- .../carbonapps/raspberrypi/artifacts.xml | 3 + .../raspberrypi_execution.siddhiql | 4 +- .../temperature_publisher/artifact.xml | 22 +++++++ .../temperature_publisher.xml | 25 ++++++++ .../temperature_store/artifact.xml | 22 +++++++ ..._device_stream_raspberrypi_temperature.xml | 62 +++++++++++++++++++ .../temperature_stream/artifact.xml | 23 +++++++ ....stream.raspberrypi.temperature_1.0.0.json | 20 ++++++ .../analytics-view.js | 4 +- .../raspberrypi_receiver-carbon.super.xml | 2 +- ....per.device.stream.raspberrypi_1.0.0.json} | 2 +- 11 files changed, 183 insertions(+), 6 deletions(-) create mode 100644 components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_publisher/artifact.xml create mode 100644 components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_publisher/temperature_publisher.xml create mode 100644 components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_store/artifact.xml create mode 100644 components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_store/iot_per_device_stream_raspberrypi_temperature.xml create mode 100644 components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_stream/artifact.xml create mode 100644 components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_stream/iot.per.device.stream.raspberrypi.temperature_1.0.0.json rename features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/src/main/resources/streams/{org.wso2.iot.raspberrypi_1.0.0.json => iot.per.device.stream.raspberrypi_1.0.0.json} (87%) diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/artifacts.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/artifacts.xml index eb937c243..b54801592 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/artifacts.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/artifacts.xml @@ -20,5 +20,8 @@ + + + diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/raspberrypi_execution/raspberrypi_execution.siddhiql b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/raspberrypi_execution/raspberrypi_execution.siddhiql index a6808ef14..e20970b98 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/raspberrypi_execution/raspberrypi_execution.siddhiql +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/raspberrypi_execution/raspberrypi_execution.siddhiql @@ -6,10 +6,10 @@ /* define streams/tables and write queries here ... */ -@Import('org.wso2.iot.raspberrypi:1.0.0') +@Import('iot.per.device.stream.raspberrypi:1.0.0') define stream raspberrypi (meta_owner string, meta_deviceId string, meta_time long, temperature float); -@Export('org.wso2.iot.devices.temperature:1.0.0') +@Export('iot.per.device.stream.raspberrypi.temperature:1.0.0') define stream temperature (meta_owner string, meta_deviceType string, meta_deviceId string, meta_time long, temperature float); from raspberrypi diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_publisher/artifact.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_publisher/artifact.xml new file mode 100644 index 000000000..7002e5f4d --- /dev/null +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_publisher/artifact.xml @@ -0,0 +1,22 @@ + + + + + temperature_publisher.xml + diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_publisher/temperature_publisher.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_publisher/temperature_publisher.xml new file mode 100644 index 000000000..5f8afc4f1 --- /dev/null +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_publisher/temperature_publisher.xml @@ -0,0 +1,25 @@ + + + + + + + + + diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_store/artifact.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_store/artifact.xml new file mode 100644 index 000000000..b3d58b879 --- /dev/null +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_store/artifact.xml @@ -0,0 +1,22 @@ + + + + + iot_per_device_stream_raspberrypi_temperature.xml + diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_store/iot_per_device_stream_raspberrypi_temperature.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_store/iot_per_device_stream_raspberrypi_temperature.xml new file mode 100644 index 000000000..9d3d2621c --- /dev/null +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_store/iot_per_device_stream_raspberrypi_temperature.xml @@ -0,0 +1,62 @@ + + + + + + iot.per.device.stream.raspberrypi.temperature:1.0.0 + + EVENT_STORE + + + meta_owner + true + true + false + STRING + + + meta_deviceType + true + true + false + STRING + + + meta_deviceId + true + true + false + STRING + + + meta_time + true + true + false + LONG + + + temperature + false + false + false + FLOAT + + + \ No newline at end of file diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_stream/artifact.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_stream/artifact.xml new file mode 100644 index 000000000..4526dfd73 --- /dev/null +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_stream/artifact.xml @@ -0,0 +1,23 @@ + + + + + iot.per.device.stream.raspberrypi.temperature_1.0.0.json + + diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_stream/iot.per.device.stream.raspberrypi.temperature_1.0.0.json b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_stream/iot.per.device.stream.raspberrypi.temperature_1.0.0.json new file mode 100644 index 000000000..212705222 --- /dev/null +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/temperature_stream/iot.per.device.stream.raspberrypi.temperature_1.0.0.json @@ -0,0 +1,20 @@ +{ + "name": "iot.per.device.stream.raspberrypi.temperature", + "version": "1.0.0", + "nickName": "Temperature Data", + "description": "Temperature data received from the Device", + "metaData": [ + {"name":"owner","type":"STRING"}, + {"name":"deviceType","type":"STRING"}, + {"name":"deviceId","type":"STRING"}, + {"name":"time","type":"LONG"} + ], + "payloadData": [ + { + "name": "temperature","type": "FLOAT" + } + ] +} + + + diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.realtime.analytics-view/analytics-view.js b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.realtime.analytics-view/analytics-view.js index 674dd8a59..29416c5af 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.realtime.analytics-view/analytics-view.js +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.realtime.analytics-view/analytics-view.js @@ -42,7 +42,7 @@ function onRequest(context) { if (tokenPair) { token = tokenPair.accessToken; } - websocketEndpoint = websocketEndpoint + "/secured-websocket/org.wso2.iot.devices.temperature/1.0.0?" + websocketEndpoint = websocketEndpoint + "/secured-websocket/iot.per.device.stream.raspberrypi.temperature/1.0.0?" + "deviceId=" + device.deviceIdentifier + "&deviceType=" + device.type + "&websocketToken=" + token; } else { var tokenPair = jwtClient.getAccessToken(resp[0], resp[1], context.user.username + "@" + user.domain @@ -50,7 +50,7 @@ function onRequest(context) { if (tokenPair) { token = tokenPair.accessToken; } - websocketEndpoint = websocketEndpoint + "/secured-websocket/t/" + user.domain + "/org.wso2.iot.devices.temperature/1.0.0?" + websocketEndpoint = websocketEndpoint + "/secured-websocket/t/" + user.domain + "/iot.per.device.stream.raspberrypi.temperature/1.0.0?" + "deviceId=" + device.deviceIdentifier + "&deviceType=" + device.type + "&websocketToken=" + token; } diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/src/main/resources/receiver/raspberrypi_receiver-carbon.super.xml b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/src/main/resources/receiver/raspberrypi_receiver-carbon.super.xml index 11cc1d962..498f70f4b 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/src/main/resources/receiver/raspberrypi_receiver-carbon.super.xml +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/src/main/resources/receiver/raspberrypi_receiver-carbon.super.xml @@ -21,5 +21,5 @@ carbon.super/raspberrypi/+/temperature - + diff --git a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/src/main/resources/streams/org.wso2.iot.raspberrypi_1.0.0.json b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/src/main/resources/streams/iot.per.device.stream.raspberrypi_1.0.0.json similarity index 87% rename from features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/src/main/resources/streams/org.wso2.iot.raspberrypi_1.0.0.json rename to features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/src/main/resources/streams/iot.per.device.stream.raspberrypi_1.0.0.json index 225db3d1c..c2210f50b 100644 --- a/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/src/main/resources/streams/org.wso2.iot.raspberrypi_1.0.0.json +++ b/features/device-types-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics.feature/src/main/resources/streams/iot.per.device.stream.raspberrypi_1.0.0.json @@ -1,5 +1,5 @@ { - "name": "org.wso2.iot.raspberrypi", + "name": "iot.per.device.stream.raspberrypi", "version": "1.0.0", "nickName": "raspberrypi", "description": "Temperature data received from the raspberrypi",