adding carbon app

merge-requests/1/head
GPrathap 9 years ago
parent db60cb9690
commit 140e1c7571

@ -23,6 +23,7 @@
<property name="relay_sensor_dir" value="relay_sensor"/> <property name="relay_sensor_dir" value="relay_sensor"/>
<property name="waterlevel_sensor_dir" value="waterlevel_sensor"/> <property name="waterlevel_sensor_dir" value="waterlevel_sensor"/>
<property name="devicetype_dir" value="watertank"/> <property name="devicetype_dir" value="watertank"/>
<property name="waterlevel_summary_dir" value="waterlevel_summary"/>
<target name="clean"> <target name="clean">
<delete dir="${target-dir}"/> <delete dir="${target-dir}"/>
</target> </target>
@ -37,6 +38,9 @@
<zip destfile="${target-dir}/${devicetype_dir}.car"> <zip destfile="${target-dir}/${devicetype_dir}.car">
<zipfileset dir="${src-dir}/${devicetype_dir}"/> <zipfileset dir="${src-dir}/${devicetype_dir}"/>
</zip> </zip>
<zip destfile="${target-dir}/${waterlevel_summary_dir}.car">
<zipfileset dir="${src-dir}/${waterlevel_summary_dir}"/>
</zip>
</target> </target>
</project> </project>

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<artifacts>
<artifact name="waterlevel_summary" version="1.0.0" type="carbon/application">
<dependency artifact="waterlevel_summary_stream" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="waterlevel_summary_store" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="waterlevel_summary_execution_pain" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
</artifact>
</artifacts>

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<artifact name="org_wso2_iot_devices_waterlevel_summary" version="1.0.0" type="analytics/eventstore" serverRole="DataAnalyticsServer">
<file>org_wso2_iot_devices_waterlevel_summary.siddhiql</file>
</artifact>

@ -0,0 +1,18 @@
/* Enter a unique ExecutionPlan */
@Plan:name('waterflow_sensor_execution_plan')
/* Enter a unique description for ExecutionPlan */
-- @Plan:description('ExecutionPlan')
/* define streams/tables and write queries here ... */
@Import('org.wso2.iot.devices.waterlevel:1.0.0')
define stream waterLevelInputMapper (meta_owner string, meta_deviceType string, meta_deviceId string, meta_time long, waterlevel float);
@Export('org.wso2.iot.devices.waterlevel.stats:1.0.0')
define stream waterLevelOutputMapper (meta_owner string, meta_deviceType string, meta_deviceId string, meta_time long, waterlevel float, waterLevelMargin double, averageValue double);
from waterLevelInputMapper#window.timeBatch(1 min)
select meta_owner, meta_deviceType, meta_deviceId, meta_time, waterlevel, 0.0 as waterLevelMargin, avg(waterlevel) as averageValue
group by meta_owner, meta_deviceType, meta_deviceId, meta_time
insert into waterLevelOutputMapper;

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<artifact name="waterlevel_summary_store" version="1.0.0" type="analytics/eventstore" serverRole="DataAnalyticsServer">
<file>org_wso2_iot_devices_waterlevel_summary.xml</file>
</artifact>

@ -0,0 +1,77 @@
<?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>
<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>waterlevel</Name>
<EnableIndexing>true</EnableIndexing>
<IsPrimaryKey>true</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>FLOAT</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>waterLevelMargin</Name>
<EnableIndexing>true</EnableIndexing>
<IsPrimaryKey>true</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>DOUBLE</Type>
</ColumnDefinition>
<ColumnDefinition>
<Name>averageValue</Name>
<EnableIndexing>true</EnableIndexing>
<IsPrimaryKey>true</IsPrimaryKey>
<EnableScoreParam>false</EnableScoreParam>
<Type>DOUBLE</Type>
</ColumnDefinition>
</TableSchema>
<Source>
<StreamId>org.wso2.iot.devices.waterlevel.stats:1.0.0</StreamId>
</Source>
<MergeSchema>false</MergeSchema>
<RecordStoreName>EVENT_STORE</RecordStoreName>
</EventStoreConfiguration>

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<artifact name="org.wso2.iot.devices.waterlevel.stats" version="1.0.0" type="event/stream" serverRole="DataAnalyticsServer">
<file>org.wso2.iot.devices.waterlevel.stats_1.0.0.json</file>
</artifact>

@ -0,0 +1,38 @@
{
"name": "org.wso2.iot.devices.waterlevel.stats",
"version": "1.0.0",
"nickName": "",
"description": "",
"metaData": [
{
"name": "owner",
"type": "STRING"
},
{
"name": "deviceType",
"type": "STRING"
},
{
"name": "deviceId",
"type": "STRING"
},
{
"name": "time",
"type": "LONG"
}
],
"payloadData": [
{
"name": "waterlevel",
"type": "FLOAT"
},
{
"name": "waterLevelMargin",
"type": "DOUBLE"
},
{
"name": "averageValue",
"type": "DOUBLE"
}
]
}
Loading…
Cancel
Save