From b2d283eb8f04648f4c95a4fab759c486a779e698 Mon Sep 17 00:00:00 2001 From: GDLMadushanka Date: Thu, 15 Jun 2017 11:49:53 +0530 Subject: [PATCH 1/3] Virtual fire alarm streams changed --- .../build.xml | 4 --- .../temperature_sensor/artifacts.xml | 28 ----------------- .../temperature_receiver/artifact.xml | 22 -------------- .../temperature_receiver.xml | 26 ---------------- .../temperature_script/artifact.xml | 22 -------------- .../temperature_script/temperature_script.xml | 30 ------------------- .../carbonapps/virtualfirealarm/artifacts.xml | 3 ++ .../temperature_publisher/artifact.xml | 0 .../temperature_publisher.xml | 2 +- .../temperature_store/artifact.xml | 2 +- ...e_stream_virtualfirealarm_temperature.xml} | 2 +- .../temperature_stream/artifact.xml | 3 +- ...m.virtualfirealarm.temperature_1.0.0.json} | 4 +-- .../virtualfirealarm_execution.siddhiql | 4 +-- .../impl/VirtualFireAlarmServiceImpl.java | 10 +++---- .../constants/VirtualFireAlarmConstants.java | 2 +- .../public/js/virtual_firealarm.js | 2 +- .../analytics-view.js | 4 +-- ...virtualfirealarm_receiver-carbon.super.xml | 2 +- ...device.stream.virtualfirealarm_1.0.0.json} | 2 +- 20 files changed, 22 insertions(+), 152 deletions(-) delete mode 100644 components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/artifacts.xml delete mode 100644 components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_receiver/artifact.xml delete mode 100644 components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_receiver/temperature_receiver.xml delete mode 100644 components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_script/artifact.xml delete mode 100644 components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_script/temperature_script.xml rename components/{analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor => device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm}/temperature_publisher/artifact.xml (100%) rename components/{analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor => device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm}/temperature_publisher/temperature_publisher.xml (91%) rename components/{analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor => device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm}/temperature_store/artifact.xml (92%) rename components/{analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_store/org_wso2_iot_devices_temperature.xml => device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/temperature_store/iot_per_device_stream_virtualfirealarm_temperature.xml} (94%) rename components/{analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor => device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm}/temperature_stream/artifact.xml (91%) rename components/{analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_stream/org.wso2.iot.devices.temperature_1.0.0.json => device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/temperature_stream/iot.per.device.stream.virtualfirealarm.temperature_1.0.0.json} (73%) rename features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/src/main/resources/streams/{org.wso2.iot.virtualfirealarm_1.0.0.json => iot.per.device.stream.virtualfirealarm_1.0.0.json} (86%) diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/build.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/build.xml index 2582b2686..871253304 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/build.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/build.xml @@ -33,7 +33,6 @@ - @@ -73,9 +72,6 @@ - - - diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/artifacts.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/artifacts.xml deleted file mode 100644 index fb4685ebd..000000000 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/artifacts.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_receiver/artifact.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_receiver/artifact.xml deleted file mode 100644 index f858a2efa..000000000 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_receiver/artifact.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - temperature_receiver.xml - diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_receiver/temperature_receiver.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_receiver/temperature_receiver.xml deleted file mode 100644 index 771c545df..000000000 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_receiver/temperature_receiver.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - false - - - - diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_script/artifact.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_script/artifact.xml deleted file mode 100644 index 5d7cdee19..000000000 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_script/artifact.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - temperature_script.xml - diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_script/temperature_script.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_script/temperature_script.xml deleted file mode 100644 index 7175df39b..000000000 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_script/temperature_script.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - temperature_script - - 0 0/5 * * * ? - diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/artifacts.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/artifacts.xml index 72bbcab2a..97f0428d9 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/artifacts.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/artifacts.xml @@ -20,5 +20,8 @@ + + + diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_publisher/artifact.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/temperature_publisher/artifact.xml similarity index 100% rename from components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_publisher/artifact.xml rename to components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/temperature_publisher/artifact.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_publisher/temperature_publisher.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/temperature_publisher/temperature_publisher.xml similarity index 91% rename from components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_publisher/temperature_publisher.xml rename to components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/temperature_publisher/temperature_publisher.xml index 94aa0c49f..d78d38407 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_publisher/temperature_publisher.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/temperature_publisher/temperature_publisher.xml @@ -18,7 +18,7 @@ --> - + diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_store/artifact.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/temperature_store/artifact.xml similarity index 92% rename from components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_store/artifact.xml rename to components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/temperature_store/artifact.xml index 4863a47e9..7d347dcf2 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_store/artifact.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/temperature_store/artifact.xml @@ -18,5 +18,5 @@ --> - org_wso2_iot_devices_temperature.xml + iot_per_device_stream_virtualfirealarm_temperature.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_store/org_wso2_iot_devices_temperature.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/temperature_store/iot_per_device_stream_virtualfirealarm_temperature.xml similarity index 94% rename from components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_store/org_wso2_iot_devices_temperature.xml rename to components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/temperature_store/iot_per_device_stream_virtualfirealarm_temperature.xml index d06f73b14..a1ec962b0 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_store/org_wso2_iot_devices_temperature.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/temperature_store/iot_per_device_stream_virtualfirealarm_temperature.xml @@ -19,7 +19,7 @@ - org.wso2.iot.devices.temperature:1.0.0 + iot.per.device.stream.virtualfirealarm.temperature:1.0.0 EVENT_STORE diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_stream/artifact.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/temperature_stream/artifact.xml similarity index 91% rename from components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_stream/artifact.xml rename to components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/temperature_stream/artifact.xml index cc733b792..d23136082 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_stream/artifact.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/temperature_stream/artifact.xml @@ -18,6 +18,5 @@ --> - org.wso2.iot.devices.temperature_1.0.0.json + iot.per.device.stream.virtualfirealarm.temperature_1.0.0.json - diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_stream/org.wso2.iot.devices.temperature_1.0.0.json b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/temperature_stream/iot.per.device.stream.virtualfirealarm.temperature_1.0.0.json similarity index 73% rename from components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_stream/org.wso2.iot.devices.temperature_1.0.0.json rename to components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/temperature_stream/iot.per.device.stream.virtualfirealarm.temperature_1.0.0.json index 5d94b9821..d3de6454d 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_stream/org.wso2.iot.devices.temperature_1.0.0.json +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/temperature_stream/iot.per.device.stream.virtualfirealarm.temperature_1.0.0.json @@ -1,8 +1,8 @@ { - "name": "org.wso2.iot.devices.temperature", + "name": "iot.per.device.stream.virtualfirealarm.temperature", "version": "1.0.0", "nickName": "Temperature Data", - "description": "Temperature data received from the Device", + "description": "Temperature data received from Virtual Fire Alarm", "metaData": [ {"name":"owner","type":"STRING"}, {"name":"deviceType","type":"STRING"}, diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_execution/virtualfirealarm_execution.siddhiql b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_execution/virtualfirealarm_execution.siddhiql index 4346a6199..42f9ce8fd 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_execution/virtualfirealarm_execution.siddhiql +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/src/main/resources/carbonapps/virtualfirealarm/virtualfirealarm_execution/virtualfirealarm_execution.siddhiql @@ -6,10 +6,10 @@ /* define streams/tables and write queries here ... */ -@Import('org.wso2.iot.virtualfirealarm:1.0.0') +@Import('iot.per.device.stream.virtualfirealarm:1.0.0') define stream virtualfirealarm (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.virtualfirealarm.temperature:1.0.0') define stream temperature (meta_owner string, meta_deviceType string, meta_deviceId string, meta_time long, temperature float); from virtualfirealarm diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/VirtualFireAlarmServiceImpl.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/VirtualFireAlarmServiceImpl.java index faec317e0..f04922d58 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/VirtualFireAlarmServiceImpl.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/VirtualFireAlarmServiceImpl.java @@ -136,10 +136,10 @@ public class VirtualFireAlarmServiceImpl implements VirtualFireAlarmService { @Produces("application/json") public Response getVirtualFirealarmStats(@PathParam("deviceId") String deviceId, @QueryParam("from") long from, @QueryParam("to") long to) { - String fromDate = String.valueOf(from); - String toDate = String.valueOf(to); - String query = "deviceId:" + deviceId + " AND deviceType:" + - VirtualFireAlarmConstants.DEVICE_TYPE + " AND time : [" + fromDate + " TO " + toDate + "]"; + String fromDate = String.valueOf(from*1000); // converting time to ms + String toDate = String.valueOf(to*1000); // converting time to ms + String query = "meta_deviceId:" + deviceId + " AND meta_deviceType:" + + VirtualFireAlarmConstants.DEVICE_TYPE + " AND meta_time : [" + fromDate + " TO " + toDate + "]"; String sensorTableName = VirtualFireAlarmConstants.TEMPERATURE_EVENT_TABLE; try { if (!APIUtil.getDeviceAccessAuthorizationService().isUserAuthorized( @@ -148,7 +148,7 @@ public class VirtualFireAlarmServiceImpl implements VirtualFireAlarmService { return Response.status(Response.Status.UNAUTHORIZED.getStatusCode()).build(); } List sortByFields = new ArrayList<>(); - SortByField sortByField = new SortByField("time", SortType.ASC); + SortByField sortByField = new SortByField("meta_time", SortType.ASC); sortByFields.add(sortByField); List sensorRecords = APIUtil.getAllEventsForDevice(sensorTableName, query, sortByFields); return Response.status(Response.Status.OK.getStatusCode()).entity(sensorRecords).build(); diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/constants/VirtualFireAlarmConstants.java b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/constants/VirtualFireAlarmConstants.java index 31a140efe..6c3186104 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/constants/VirtualFireAlarmConstants.java +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/constants/VirtualFireAlarmConstants.java @@ -30,7 +30,7 @@ public class VirtualFireAlarmConstants { public static final String POLICY_CONTEXT = "POLICY"; //sensor events sumerized table name for temperature - public static final String TEMPERATURE_EVENT_TABLE = "DEVICE_TEMPERATURE_SUMMARY"; + public static final String TEMPERATURE_EVENT_TABLE = "IOT_PER_DEVICE_STREAM_VIRTUALFIREALARM_TEMPERATURE"; public final static String DEVICE_TYPE_PROVIDER_DOMAIN = "carbon.super"; //mqtt tranport related constants diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.analytics-view/public/js/virtual_firealarm.js b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.analytics-view/public/js/virtual_firealarm.js index 25cee0cf8..c999583fe 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.analytics-view/public/js/virtual_firealarm.js +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.analytics-view/public/js/virtual_firealarm.js @@ -168,7 +168,7 @@ function drawGraph_virtual_firealarm(from, to) { for (var i = 0; i < data.length; i++) { chartData.push( { - x: parseInt(data[i].values.time) - tzOffset, + x: parseInt(data[i].values.meta_time/1000) - tzOffset, //converting time back to (s) y: parseInt(data[i].values.temperature) } ); diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.realtime.analytics-view/analytics-view.js b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.realtime.analytics-view/analytics-view.js index 40e36dd96..c144cf39d 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.realtime.analytics-view/analytics-view.js +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.virtual_firealarm.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.virtualfirealarm.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.virtualfirealarm.temperature/1.0.0?" + "deviceId=" + device.deviceIdentifier + "&deviceType=" + device.type + "&websocketToken=" + token; } } diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/src/main/resources/receiver/virtualfirealarm_receiver-carbon.super.xml b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/src/main/resources/receiver/virtualfirealarm_receiver-carbon.super.xml index efd5dde7b..e581067d9 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/src/main/resources/receiver/virtualfirealarm_receiver-carbon.super.xml +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/src/main/resources/receiver/virtualfirealarm_receiver-carbon.super.xml @@ -22,5 +22,5 @@ virtualfirealarm_receiver-carbon.super - + diff --git a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/src/main/resources/streams/org.wso2.iot.virtualfirealarm_1.0.0.json b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/src/main/resources/streams/iot.per.device.stream.virtualfirealarm_1.0.0.json similarity index 86% rename from features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/src/main/resources/streams/org.wso2.iot.virtualfirealarm_1.0.0.json rename to features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/src/main/resources/streams/iot.per.device.stream.virtualfirealarm_1.0.0.json index 0ba70911e..74d11eb70 100644 --- a/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/src/main/resources/streams/org.wso2.iot.virtualfirealarm_1.0.0.json +++ b/features/device-types-feature/virtual-fire-alarm-plugin-feature/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics.feature/src/main/resources/streams/iot.per.device.stream.virtualfirealarm_1.0.0.json @@ -1,5 +1,5 @@ { - "name": "org.wso2.iot.virtualfirealarm", + "name": "iot.per.device.stream.virtualfirealarm", "version": "1.0.0", "nickName": "virtual_firealarm", "description": "Temperature data received from the virtual_firealarm", From a089caf14e91ce10bdff17d3d639095c2b2c5d5a Mon Sep 17 00:00:00 2001 From: GDLMadushanka Date: Thu, 15 Jun 2017 15:02:42 +0530 Subject: [PATCH 2/3] temperature stream added back --- .../temperature_sensor/artifacts.xml | 28 +++++++++ .../temperature_publisher/artifact.xml | 22 +++++++ .../temperature_publisher.xml | 25 ++++++++ .../temperature_receiver/artifact.xml | 22 +++++++ .../temperature_receiver.xml | 26 ++++++++ .../temperature_script/artifact.xml | 22 +++++++ .../temperature_script/temperature_script.xml | 30 +++++++++ .../temperature_store/artifact.xml | 22 +++++++ .../org_wso2_iot_devices_temperature.xml | 62 +++++++++++++++++++ .../temperature_stream/artifact.xml | 23 +++++++ ...rg.wso2.iot.devices.temperature_1.0.0.json | 20 ++++++ 11 files changed, 302 insertions(+) create mode 100644 components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/artifacts.xml create mode 100644 components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_publisher/artifact.xml create mode 100644 components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_publisher/temperature_publisher.xml create mode 100644 components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_receiver/artifact.xml create mode 100644 components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_receiver/temperature_receiver.xml create mode 100644 components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_script/artifact.xml create mode 100644 components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_script/temperature_script.xml create mode 100644 components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_store/artifact.xml create mode 100644 components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_store/org_wso2_iot_devices_temperature.xml create mode 100644 components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_stream/artifact.xml create mode 100644 components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_stream/org.wso2.iot.devices.temperature_1.0.0.json diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/artifacts.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/artifacts.xml new file mode 100644 index 000000000..fb4685ebd --- /dev/null +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/artifacts.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_publisher/artifact.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_publisher/artifact.xml new file mode 100644 index 000000000..752cb8c41 --- /dev/null +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_publisher/artifact.xml @@ -0,0 +1,22 @@ + + + + + temperature_publisher.xml + diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_publisher/temperature_publisher.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_publisher/temperature_publisher.xml new file mode 100644 index 000000000..94aa0c49f --- /dev/null +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_publisher/temperature_publisher.xml @@ -0,0 +1,25 @@ + + + + + + + + + diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_receiver/artifact.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_receiver/artifact.xml new file mode 100644 index 000000000..f858a2efa --- /dev/null +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_receiver/artifact.xml @@ -0,0 +1,22 @@ + + + + + temperature_receiver.xml + diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_receiver/temperature_receiver.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_receiver/temperature_receiver.xml new file mode 100644 index 000000000..771c545df --- /dev/null +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_receiver/temperature_receiver.xml @@ -0,0 +1,26 @@ + + + + + + false + + + + diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_script/artifact.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_script/artifact.xml new file mode 100644 index 000000000..5d7cdee19 --- /dev/null +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_script/artifact.xml @@ -0,0 +1,22 @@ + + + + + temperature_script.xml + diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_script/temperature_script.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_script/temperature_script.xml new file mode 100644 index 000000000..7175df39b --- /dev/null +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_script/temperature_script.xml @@ -0,0 +1,30 @@ + + + + + temperature_script + + 0 0/5 * * * ? + diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_store/artifact.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_store/artifact.xml new file mode 100644 index 000000000..4863a47e9 --- /dev/null +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_store/artifact.xml @@ -0,0 +1,22 @@ + + + + + org_wso2_iot_devices_temperature.xml + diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_store/org_wso2_iot_devices_temperature.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_store/org_wso2_iot_devices_temperature.xml new file mode 100644 index 000000000..d06f73b14 --- /dev/null +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_store/org_wso2_iot_devices_temperature.xml @@ -0,0 +1,62 @@ + + + + + + org.wso2.iot.devices.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/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_stream/artifact.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_stream/artifact.xml new file mode 100644 index 000000000..cc733b792 --- /dev/null +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_stream/artifact.xml @@ -0,0 +1,23 @@ + + + + + org.wso2.iot.devices.temperature_1.0.0.json + + diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_stream/org.wso2.iot.devices.temperature_1.0.0.json b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_stream/org.wso2.iot.devices.temperature_1.0.0.json new file mode 100644 index 000000000..5d94b9821 --- /dev/null +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/src/main/resources/carbonapps/temperature_sensor/temperature_stream/org.wso2.iot.devices.temperature_1.0.0.json @@ -0,0 +1,20 @@ +{ + "name": "org.wso2.iot.devices.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" + } + ] +} + + + From 4397451cddeb509f2ec962058f2bb3b3c3e715b9 Mon Sep 17 00:00:00 2001 From: GDLMadushanka Date: Thu, 15 Jun 2017 15:06:53 +0530 Subject: [PATCH 3/3] adding the temp stream back --- .../org.wso2.carbon.device.mgt.iot.analytics/build.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/build.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/build.xml index 871253304..f1a1e85a5 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/build.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/build.xml @@ -33,6 +33,7 @@ + @@ -72,6 +73,9 @@ + + +