added analytics scripts

application-manager-new
GPrathap 9 years ago
parent fa112b28e5
commit e2ce28767e

@ -1,62 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 Inc. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<EventStoreConfiguration>
<Source>
<StreamId>org.wso2.iot.devices.sensor:1.0.0</StreamId>
</Source>
<RecordStoreName>EVENT_STORE</RecordStoreName>
<TableSchema>
<ColumnDefinition>
<Name>meta_owner</Name>
<EnableIndexing>true</EnableIndexing>
<IsPrimaryKey>true</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>STRING</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>meta_deviceType</Name>
<EnableIndexing>true</EnableIndexing>
<IsPrimaryKey>true</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>STRING</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>meta_deviceId</Name>
<EnableIndexing>true</EnableIndexing>
<IsPrimaryKey>true</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>STRING</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>meta_time</Name>
<EnableIndexing>true</EnableIndexing>
<IsPrimaryKey>true</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>LONG</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>sensorValue</Name>
<EnableIndexing>false</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>FLOAT</Type>
</ColumnDefinition>
</TableSchema>
</EventStoreConfiguration>

@ -1,17 +0,0 @@
{
"name": "org.wso2.iot.devices.sensor",
"version": "1.0.0",
"nickName": "Flow Rate Data",
"description": "Sensor data received from the Device",
"metaData": [
{"name":"owner","type":"STRING"},
{"name":"deviceType","type":"STRING"},
{"name":"deviceId","type":"STRING"},
{"name":"time","type":"LONG"}
],
"payloadData": [
{
"name": "sensorValue","type": "FLOAT"
}
]
}

@ -17,11 +17,11 @@
~ under the License.
-->
<eventReceiver name="EventReceiver_sensor" statistics="disable" trace="disable"
<eventReceiver name="EventReceiver_smartLock" statistics="disable" trace="disable"
xmlns="http://wso2.org/carbon/eventreceiver">
<from eventAdapterType="wso2event">
<property name="events.duplicated.in.cluster">false</property>
</from>
<mapping customMapping="disable" type="wso2event"/>
<to streamName="org.wso2.iot.devices.sensor" version="1.0.0"/>
<to streamName="org.wso2.iot.devices.smartLock" version="1.0.0"/>
</eventReceiver>

@ -17,6 +17,6 @@
~ under the License.
-->
<artifact name="Eventreceiver_sensor" version="1.0.0" type="event/receiver" serverRole="DataAnalyticsServer">
<file>EventReceiver_sensor.xml</file>
<artifact name="Eventreceiver_smartLock" version="1.0.0" type="event/receiver" serverRole="DataAnalyticsServer">
<file>EventReceiver_smartLock.xml</file>
</artifact>

@ -17,6 +17,6 @@
~ under the License.
-->
<artifact name="Eventstore_sensor" version="1.0.0" type="analytics/eventstore" serverRole="DataAnalyticsServer">
<file>org_wso2_iot_devices_sensor.xml</file>
<artifact name="Eventstore_smartLock" version="1.0.0" type="analytics/eventstore" serverRole="DataAnalyticsServer">
<file>org_wso2_iot_devices_smartLock.xml</file>
</artifact>

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ WSO2 Inc. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<EventStoreConfiguration>
<Source>
<StreamId>org.wso2.iot.devices.smartLock:1.0.0</StreamId>
</Source>
<RecordStoreName>EVENT_STORE</RecordStoreName>
<TableSchema>
<ColumnDefinition>
<Name>meta_owner</Name>
<EnableIndexing>true</EnableIndexing>
<IsPrimaryKey>true</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>STRING</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>meta_deviceType</Name>
<EnableIndexing>true</EnableIndexing>
<IsPrimaryKey>true</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>STRING</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>meta_deviceId</Name>
<EnableIndexing>true</EnableIndexing>
<IsPrimaryKey>true</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>STRING</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>meta_time</Name>
<EnableIndexing>true</EnableIndexing>
<IsPrimaryKey>true</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>LONG</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>smartLock</Name>
<EnableIndexing>false</EnableIndexing>
<IsPrimaryKey>false</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>FLOAT</Type>
</ColumnDefinition>
</TableSchema>
</EventStoreConfiguration>

@ -17,6 +17,7 @@
~ under the License.
-->
<artifact name="Eventstream_sensor" version="1.0.0" type="event/stream" serverRole="DataAnalyticsServer">
<file>org.wso2.iot.devices.sensor_1.0.0.json</file>
<artifact name="Eventstream_smartLock" version="1.0.0" type="event/stream" serverRole="DataAnalyticsServer">
<file>org.wso2.iot.devices.smartLock_1.0.0.json</file>
</artifact>

@ -0,0 +1,33 @@
{
"name": "org.wso2.iot.devices.smartLock",
"version": "1.0.0",
"nickName": "smartLock",
"description": "smartLock data received from the Device",
"metaData": [
{
"name": "owner",
"type": "STRING"
},
{
"name": "deviceType",
"type": "STRING"
},
{
"name": "deviceId",
"type": "STRING"
},
{
"name": "time",
"type": "LONG"
}
],
"payloadData": [
{
"name": "smartLock",
"type": "FLOAT"
}
]
}

@ -18,5 +18,5 @@
-->
<artifact name="Sparkscripts" version="1.0.0" type="analytics/spark" serverRole="DataAnalyticsServer">
<file>Sensor_Script.xml</file>
<file>smartLock_Script.xml</file>
</artifact>

@ -18,13 +18,18 @@
-->
<Analytics>
<Name>Sensor_Script</Name>
<Name>IoTServer_smartLock_Script</Name>
<Script>
CREATE TEMPORARY TABLE DeviceSensorData USING CarbonAnalytics OPTIONS(tableName "ORG_WSO2_IOT_DEVICES_SENSORDATA");
CREATE TEMPORARY TABLE DevicesmartLockData USING CarbonAnalytics OPTIONS(tableName
"ORG_WSO2_IOT_DEVICES_smartLock");
CREATE TEMPORARY TABLE DeviceSensorSummaryData USING CarbonAnalytics OPTIONS (tableName "DEVICE_SENSOR_DATA_SUMMARY", schema "sensorValue FLOAT, deviceType STRING -i, deviceId STRING -i, owner STRING -i, time LONG -i",primaryKeys "deviceType, deviceId, owner, time");
CREATE TEMPORARY TABLE DevicesmartLockSummaryData USING CarbonAnalytics OPTIONS (tableName
"DEVICE_smartLock_SUMMARY", schema "smartLock FLOAT, deviceType STRING -i, deviceId STRING -i, owner STRING -i,
time LONG -i",primaryKeys "deviceType, deviceId, owner, time");
insert overwrite table DeviceSensorSummaryData select sensorValue, meta_deviceType as deviceType, meta_deviceId as deviceId, meta_owner as owner, cast(meta_time/1000 as BIGINT)as time from DeviceSensorData group by sensorValue, meta_deviceType, meta_deviceId, meta_owner, cast(meta_time/1000 as BIGINT);
insert overwrite table DevicesmartLockSummaryData select smartLock, meta_deviceType as deviceType, meta_deviceId
as deviceId, meta_owner as owner, cast(meta_time/1000 as BIGINT)as time from DevicesmartLockData group by
smartLock, meta_deviceType, meta_deviceId, meta_owner, cast(meta_time/1000 as BIGINT);
</Script>
<CronExpression>0 * * * * ?</CronExpression>
</Analytics>

@ -18,11 +18,10 @@
-->
<artifacts>
<artifact name="Sensor_CAPP" version="1.0.0" type="carbon/application">
<dependency artifact="Eventstream_sensor" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="Eventstore_sensor" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="Eventreceiver_sensor" version="1.0.0" include="true"
serverRole="DataAnalyticsServer"/>
<artifact name="smartLock_CAPP" version="1.0.0" type="carbon/application">
<dependency artifact="Eventstream_smartLock" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="Eventstore_smartLock" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="Eventreceiver_smartLock" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="Sparkscripts" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
</artifact>
</artifacts>
Loading…
Cancel
Save