commit
f535b1d9cc
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<eventReceiver name="EventReceiver_accelerometer" 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.accelerometer" version="1.0.0"/>
|
||||
</eventReceiver>
|
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<artifact name="Eventreceiver_accelerometer" version="1.0.0" type="event/receiver" serverRole="DataAnalyticsServer">
|
||||
<file>EventReceiver_accelerometer.xml</file>
|
||||
</artifact>
|
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<artifact name="Eventstore_accelerometer" version="1.0.0" type="analytics/eventstore" serverRole="DataAnalyticsServer">
|
||||
<file>org_wso2_iot_devices_accelerometer.xml</file>
|
||||
</artifact>
|
@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<EventStoreConfiguration>
|
||||
<Source>
|
||||
<StreamId>org.wso2.iot.devices.accelerometer: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>battery</Name>
|
||||
<EnableIndexing>false</EnableIndexing>
|
||||
<IsPrimaryKey>false</IsPrimaryKey>
|
||||
<EnableScoreParam>false</EnableScoreParam>
|
||||
<Type>FLOAT</Type>
|
||||
</ColumnDefinition>
|
||||
</TableSchema>
|
||||
</EventStoreConfiguration>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<artifact name="Eventstream_accelerometer" version="1.0.0" type="event/stream" serverRole="DataAnalyticsServer">
|
||||
<file>org.wso2.iot.devices.accelerometer_1.0.0.json</file>
|
||||
</artifact>
|
||||
|
@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "org.wso2.iot.devices.accelerometer",
|
||||
"version": "1.0.0",
|
||||
"nickName": "accelerometer Data",
|
||||
"description": "accelerometer data received from the Device",
|
||||
"metaData": [
|
||||
{"name":"owner","type":"STRING"},
|
||||
{"name":"deviceType","type":"STRING"},
|
||||
{"name":"deviceId","type":"STRING"},
|
||||
{"name":"time","type":"LONG"}
|
||||
],
|
||||
"payloadData": [
|
||||
{
|
||||
"name": "accelerometer","type": "FLOAT"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<Analytics>
|
||||
<Name>Accelerometer_Sensor_Script</Name>
|
||||
<Script>
|
||||
CREATE TEMPORARY TABLE DeviceAccelerometerData USING CarbonAnalytics OPTIONS(tableName "ORG_WSO2_IOT_DEVICES_ACCELEROMETER");
|
||||
|
||||
CREATE TEMPORARY TABLE DeviceAccelerometerSummaryData USING CarbonAnalytics OPTIONS (tableName "DEVICE_ACCELEROMETER_SUMMARY", schema "accelerometer FLOAT, deviceType STRING -i, deviceId STRING -i, owner STRING -i, time LONG -i",primaryKeys "deviceType, deviceId, owner, time");
|
||||
|
||||
|
||||
insert overwrite table DeviceAccelerometerSummaryData select accelerometer, meta_deviceType as deviceType, meta_deviceId as deviceId, meta_owner as owner, cast(meta_time/1000 as BIGINT)as time from DeviceAccelerometerData group by battery, meta_deviceType, meta_deviceId, meta_owner, cast(meta_time/1000 as BIGINT);
|
||||
</Script>
|
||||
<CronExpression>0 * * * * ?</CronExpression>
|
||||
</Analytics>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<artifact name="Sparkscripts" version="1.0.0" type="analytics/spark" serverRole="DataAnalyticsServer">
|
||||
<file>Accelerometer_Sensor_Script.xml</file>
|
||||
</artifact>
|
||||
|
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<artifacts>
|
||||
<artifact name="Accelerometer_CAPP" version="1.0.0" type="carbon/application">
|
||||
|
||||
<dependency artifact="Eventstream_accelerometer" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
|
||||
<dependency artifact="Eventstore_accelerometer" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
|
||||
<dependency artifact="Eventreceiver_accelerometer" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
|
||||
|
||||
<dependency artifact="Sparkscripts" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
|
||||
</artifact>
|
||||
</artifacts>
|
Loading…
Reference in new issue