parent
cfd1497ecc
commit
fd2e7c3ed2
Binary file not shown.
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<eventReceiver name="EventReceiver_temperature" 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.temperature" version="1.0.0"/>
|
||||||
|
</eventReceiver>
|
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<artifact name="Eventreceiver_temperature" version="1.0.0" type="event/receiver" serverRole="DataAnalyticsServer">
|
||||||
|
<file>EventReceiver_temperature.xml</file>
|
||||||
|
</artifact>
|
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<artifact name="Eventstore_temperature" version="1.0.0" type="analytics/eventstore" serverRole="DataAnalyticsServer">
|
||||||
|
<file>org_wso2_iot_devices_temperature.xml</file>
|
||||||
|
</artifact>
|
@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<EventStoreConfiguration>
|
||||||
|
<Source>
|
||||||
|
<StreamId>org.wso2.iot.devices.temperature: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>temperature</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_temperature" version="1.0.0" type="event/stream" serverRole="DataAnalyticsServer">
|
||||||
|
<file>org.wso2.iot.devices.temperature_1.0.0.json</file>
|
||||||
|
</artifact>
|
||||||
|
|
@ -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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<Analytics>
|
||||||
|
<Name>IoTServer_Sensor_Script</Name>
|
||||||
|
<Script>
|
||||||
|
CREATE TEMPORARY TABLE DeviceTemperatureData USING CarbonAnalytics OPTIONS(tableName "ORG_WSO2_IOT_DEVICES_TEMPERATURE");
|
||||||
|
|
||||||
|
CREATE TEMPORARY TABLE DeviceTemperatureSummaryData USING CarbonAnalytics OPTIONS (tableName "DEVICE_TEMPERATURE_SUMMARY", schema "temperature FLOAT, deviceType STRING -i, deviceId STRING -i, owner STRING -i, time LONG -i",primaryKeys "deviceType, deviceId, owner, time");
|
||||||
|
|
||||||
|
|
||||||
|
insert overwrite table DeviceTemperatureSummaryData select temperature, meta_deviceType as deviceType, meta_deviceId as deviceId, meta_owner as owner, cast(meta_time/1000 as BIGINT)as time from DeviceTemperatureData group by temperature, meta_deviceType, meta_deviceId, meta_owner, cast(meta_time/1000 as BIGINT);
|
||||||
|
</Script>
|
||||||
|
<CronExpression>0 * * * * ?</CronExpression>
|
||||||
|
</Analytics>
|
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<artifact name="Sparkscripts" version="1.0.0" type="analytics/spark" serverRole="DataAnalyticsServer">
|
||||||
|
<file>Temperature_Sensor_Script.xml</file>
|
||||||
|
</artifact>
|
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<artifacts>
|
||||||
|
<artifact name="IoTServer_Sensors_CAPP" version="1.0.0" type="carbon/application">
|
||||||
|
|
||||||
|
<dependency artifact="Eventstream_temperature" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
|
||||||
|
<dependency artifact="Eventstore_temperature" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
|
||||||
|
<dependency artifact="Eventreceiver_temperature" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
|
||||||
|
|
||||||
|
<dependency artifact="Sparkscripts" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
|
||||||
|
</artifact>
|
||||||
|
</artifacts>
|
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project name="create-sample-sensor-capps" default="zip" basedir=".">
|
||||||
|
|
||||||
|
<property name="project-name" value="${ant.project.name}"/>
|
||||||
|
<property name="target-dir" value="target"/>
|
||||||
|
|
||||||
|
<property name="Temperature_Sensor_dir" value="Temperature_Sensor"/>
|
||||||
|
<target name="clean">
|
||||||
|
<delete dir="${target-dir}"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="zip" depends="clean">
|
||||||
|
<zip destfile="${target-dir}/${Temperature_Sensor_dir}.car">
|
||||||
|
<zipfileset dir="${Temperature_Sensor_dir}"/>
|
||||||
|
</zip>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,68 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
# Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
#
|
||||||
|
# Licensed 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.
|
||||||
|
-->
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.wso2.iot</groupId>
|
||||||
|
<artifactId>wso2iot-parent</artifactId>
|
||||||
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
|
<relativePath>../../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>iot-sample-capps</artifactId>
|
||||||
|
<name>WSO2 iot server sample capp</name>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-clean-plugin</artifactId>
|
||||||
|
<version>2.4.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>auto-clean</id>
|
||||||
|
<phase>initialize</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>clean</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-antrun-plugin</artifactId>
|
||||||
|
<version>1.7</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>process-resources</phase>
|
||||||
|
<configuration>
|
||||||
|
<target>
|
||||||
|
<ant antfile="build.xml" target="zip"/>
|
||||||
|
</target>
|
||||||
|
</configuration>
|
||||||
|
<goals>
|
||||||
|
<goal>run</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
Loading…
Reference in new issue