refactored analytics scripts

revert-dabc3590
ayyoob 9 years ago
parent 3d583cd39b
commit 3974ec7753

@ -17,13 +17,14 @@
~ under the License.
-->
<project name="create-sample-sensor-capps" default="zip" basedir=".">
<project name="create-android-sense-capps" default="zip" basedir=".">
<property name="project-name" value="${ant.project.name}"/>
<property name="target-dir" value="target/carbonapps"/>
<property name="src-dir" value="src/main/resources/carbonapps"/>
<property name="Android_Sense_dir" value="Android_Sense"/>
<property name="Android_Sense_dir" value="androidsense"/>
<property name="Wordcounter_dir" value="word_count"/>
<target name="clean">
<delete dir="${target-dir}" />
@ -34,5 +35,8 @@
<zip destfile="${target-dir}/${Android_Sense_dir}.car">
<zipfileset dir="${src-dir}/${Android_Sense_dir}"/>
</zip>
<zip destfile="${target-dir}/${Wordcounter_dir}.car">
<zipfileset dir="${src-dir}/${Wordcounter_dir}"/>
</zip>
</target>
</project>

@ -17,13 +17,13 @@
~ under the License.
-->
<project name="create-sample-sensor-capps" default="zip" basedir=".">
<project name="create-arduino-capps" default="zip" basedir=".">
<property name="project-name" value="${ant.project.name}"/>
<property name="target-dir" value="target/carbonapps"/>
<property name="src-dir" value="src/main/resources/carbonapps"/>
<property name="Android_Sense_dir" value="Android_Sense"/>
<property name="Arduino_dir" value="arduino"/>
<target name="clean">
<delete dir="${target-dir}" />
@ -31,8 +31,8 @@
<target name="zip" depends="clean">
<mkdir dir="${target-dir}"/>
<zip destfile="${target-dir}/${Android_Sense_dir}.car">
<zipfileset dir="${src-dir}/${Android_Sense_dir}"/>
<zip destfile="${target-dir}/${Arduino_dir}.car">
<zipfileset dir="${src-dir}/${Arduino_dir}"/>
</zip>
</target>
</project>

@ -21,15 +21,15 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>androidsense-plugin</artifactId>
<artifactId>arduino-plugin</artifactId>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<version>2.1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.iot.androidsense.analytics</artifactId>
<name>WSO2 Carbon - IoT Server Android Sense Analytics capp</name>
<artifactId>org.wso2.carbon.device.mgt.iot.arduino.analytics</artifactId>
<name>WSO2 Carbon - IoT Server Arduino Analytics capp</name>
<packaging>pom</packaging>
<build>

@ -6,12 +6,12 @@
/* define streams/tables and write queries here ... */
@Import('org.wso2.iot.arduino:1.0.0')
define stream arduino (meta_owner string, meta_deviceId string, temperature float);
@Export('org.wso2.iot.devices.temperature:1.0.0')
define stream temperature (meta_owner string, meta_deviceType string, meta_deviceId string, meta_time long, temperature float);
@Import('org.wso2.iot.arduino:1.0.0')
define stream arduino (meta_owner string, string, meta_deviceId string, temperature float);
from arduino
select meta_owner, 'arduino' as meta_deviceType, meta_deviceId, timestampInMilliseconds () as meta_time, temperature
select meta_owner, 'arduino' as meta_deviceType, meta_deviceId, time:timestampInMilliseconds() as meta_time, temperature
insert into temperature;

@ -20,8 +20,8 @@
<from eventAdapterType="oauth-http">
<property name="maximumHttpConnectionPerHost">2</property>
<property name="username">admin</property>
<property name="contentValidationParams">device_id_json_path:event.metaData.deviceId</property>
<property name="contentValidation">org.wso2.carbon.device.mgt.iot.input.adapter.http.util.HTTPContentValidator</property>
<property name="contentValidatorParams">device_id_json_path:event.metaData.deviceId</property>
<property name="contentValidator">org.wso2.carbon.device.mgt.iot.input.adapter.http.util.HTTPContentValidator</property>
<property name="contentTransformer">default</property>
<property name="transports">all</property>
<property name="maximumTotalHttpConnection">100</property>
@ -29,5 +29,5 @@
<property name="password">admin</property>
</from>
<mapping customMapping="disable" type="json"/>
<to streamName="org.wso2.iot.devices.arduino" version="1.0.0"/>
<to streamName="org.wso2.iot.arduino" version="1.0.0"/>
</eventReceiver>

@ -17,7 +17,7 @@
~ under the License.
-->
<artifact name= "stream" version="1.0.0" type="event/stream" serverRole="DataAnalyticsServer">
<artifact name= "arduino_stream" version="1.0.0" type="event/stream" serverRole="DataAnalyticsServer">
<file>org.wso2.iot.arduino_1.0.0.json</file>
</artifact>

@ -1,7 +1,7 @@
{
"name": "org.wso2.iot.arduino",
"version": "1.0.0",
"nickName": "Arduino Data",
"nickName": "Arduino",
"description": "Temperature data received from the Arduino",
"metaData": [
{"name":"owner","type":"STRING"},
@ -13,6 +13,3 @@
}
]
}

@ -18,10 +18,9 @@
-->
<artifacts>
<artifact name="AndroidSense_CAPP" version="1.0.0" type="carbon/application">
<dependency artifact="EventStream_AndroidSense" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="android_sense_mqtt" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="EventPublisher_AndroidSense" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="EventExecution_AndroidSense" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<artifact name="arduino" version="1.0.0" type="carbon/application">
<dependency artifact="arduino_stream" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="arduino_execution" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="arduino_receiver" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
</artifact>
</artifacts>

@ -37,6 +37,7 @@
<module>org.wso2.carbon.device.mgt.iot.arduino.api</module>
<module>org.wso2.carbon.device.mgt.iot.arduino.plugin</module>
<module>org.wso2.carbon.device.mgt.iot.arduino.ui</module>
<module>org.wso2.carbon.device.mgt.iot.arduino.analytics</module>
</modules>
<build>

@ -17,24 +17,23 @@
~ under the License.
-->
<project name="create-sample-sensor-capps" default="zip" basedir=".">
<project name="create-sensors-capps" default="zip" basedir=".">
<property name="project-name" value="${ant.project.name}"/>
<property name="target-dir" value="target/carbonapps"/>
<property name="src-dir" value="src/main/resources/carbonapps"/>
<property name="GPS_dir" value="GPS"/>
<property name="Light_dir" value="Light"/>
<property name="Battery_dir" value="Battery"/>
<property name="Magnetic_dir" value="Magnetic"/>
<property name="Accelerometer_dir" value="Accelerometer"/>
<property name="Gravity_dir" value="Gravity"/>
<property name="Gyroscope_dir" value="Gyroscope"/>
<property name="Proximity_dir" value="Proximity"/>
<property name="Pressure_dir" value="Pressure"/>
<property name="Rotation_dir" value="Rotation"/>
<property name="Wordcounter_dir" value="WordCount"/>
<property name="Temperature_dir" value="Temperature"/>
<property name="GPS_dir" value="gps_sensor"/>
<property name="Light_dir" value="light_sensor"/>
<property name="Battery_dir" value="battery_sensor"/>
<property name="Magnetic_dir" value="magnetic_sensor"/>
<property name="Accelerometer_dir" value="accelerometer_sensor"/>
<property name="Gravity_dir" value="gravity_sensor"/>
<property name="Gyroscope_dir" value="gyroscope_sensor"/>
<property name="Proximity_dir" value="proximity_sensor"/>
<property name="Pressure_dir" value="pressure_sensor"/>
<property name="Rotation_dir" value="rotation_sensor"/>
<property name="Temperature_dir" value="temperature_sensor"/>
<target name="clean">
<delete dir="${target-dir}" />
@ -72,9 +71,6 @@
<zip destfile="${target-dir}/${Proximity_dir}.car">
<zipfileset dir="${src-dir}/${Proximity_dir}"/>
</zip>
<zip destfile="${target-dir}/${Wordcounter_dir}.car">
<zipfileset dir="${src-dir}/${Wordcounter_dir}"/>
</zip>
<zip destfile="${target-dir}/${Temperature_dir}.car">
<zipfileset dir="${src-dir}/${Temperature_dir}"/>
</zip>

@ -18,12 +18,11 @@
-->
<artifacts>
<artifact name="Temperature_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="Eventreceiver_mqtt_temperature" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="Eventpublisher_temperature" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="Sparkscripts" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<artifact name="temperature" version="1.0.0" type="carbon/application">
<dependency artifact="temperature_stream" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="temperature_store" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="temperature_receiver" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="temperature_publisher" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="temperature_script" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
</artifact>
</artifacts>

@ -17,6 +17,6 @@
~ under the License.
-->
<artifact name="Eventpublisher_temperature" version="1.0.0" type="event/publisher" serverRole="DataAnalyticsServer">
<file>EventPublisher_temperature.xml</file>
<artifact name="temperature_publisher" version="1.0.0" type="event/publisher" serverRole="DataAnalyticsServer">
<file>temperature_publisher.xml</file>
</artifact>

@ -17,7 +17,7 @@
~ under the License.
-->
<eventPublisher name="EventPublisher_temperature" statistics="disable" trace="disable" xmlns="http://wso2.org/carbon/eventpublisher">
<eventPublisher name="temperature_publisher" statistics="disable" trace="disable" xmlns="http://wso2.org/carbon/eventpublisher">
<from streamName="org.wso2.iot.devices.temperature" version="1.0.0"/>
<mapping customMapping="disable" type="wso2event"/>
<to eventAdapterType="iot-ui"/>

@ -17,6 +17,6 @@
~ under the License.
-->
<artifact name="Eventreceiver_temperature" version="1.0.0" type="event/receiver" serverRole="DataAnalyticsServer">
<file>EventReceiver_temperature.xml</file>
<artifact name="temperature_receiver" version="1.0.0" type="event/receiver" serverRole="DataAnalyticsServer">
<file>temperature_receiver.xml</file>
</artifact>

@ -17,6 +17,6 @@
~ under the License.
-->
<artifact name="Sparkscripts" version="1.0.0" type="analytics/spark" serverRole="DataAnalyticsServer">
<file>Temperature_Sensor_Script.xml</file>
<artifact name="temperature_script" version="1.0.0" type="analytics/spark" serverRole="DataAnalyticsServer">
<file>temperature_script.xml</file>
</artifact>

@ -17,6 +17,6 @@
~ under the License.
-->
<artifact name="Eventstore_temperature" version="1.0.0" type="analytics/eventstore" serverRole="DataAnalyticsServer">
<artifact name="temperature_store" version="1.0.0" type="analytics/eventstore" serverRole="DataAnalyticsServer">
<file>org_wso2_iot_devices_temperature.xml</file>
</artifact>

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

@ -25,9 +25,9 @@ import java.util.Map;
*/
public interface ContentValidator {
/**
* @param contentValidationParams that related to input adapter.
* @param contentValidatorParams that related to input adapter.
* @param dynamicParameter that message.
* @return ContentInfo.
*/
ContentInfo validate(Object message, Map<String, String> contentValidationParams, Map<String, String> dynamicParameter);
ContentInfo validate(Object message, Map<String, String> contentValidatorParams, Map<String, String> dynamicParameter);
}

@ -64,10 +64,10 @@ public final class HTTPEventAdapterConstants {
public static final String USERNAME_TAG = "username";
public static final String PAYLOAD_TAG = "payload";
public static final String DEVICE_ID_JSON_PATH = "device_id_json_path";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_CLASSNAME = "contentValidation";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_CLASSNAME_HINT = "contentValidation.hint";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_PARAMS = "contentValidationParams";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_PARAMS_HINT = "contentValidationParams.hint";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_CLASSNAME = "contentValidator";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_CLASSNAME_HINT = "contentValidator.hint";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_PARAMS = "contentValidatorParams";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_PARAMS_HINT = "contentValidatorParams.hint";
public static final String DEFAULT = "default";
public static final String HTTP_CONTENT_VALIDATION_DEFAULT_PARAMETERS = "";
public static final String ADAPTER_CONF_CONTENT_TRANSFORMER_CLASSNAME = "contentTransformer";

@ -32,9 +32,9 @@ maximumTotalHttpConnection=maximumTotalHttpConnection
maximumTotalHttpConnection.hint=Maximum Total connection to be made with the endpoint
maximumHttpConnectionPerHost=maximumHttpConnectionPerHost
maximumHttpConnectionPerHost.hint=Maximum Http connection per host.
contentValidation=contentValidation
contentValidation.hint=Class Name of the content Validation or 'default' to set default class, required to implement (if required)
contentValidationParams=contentValidationParams
contentValidationParams.hint=ContentValidationParams, comma seperated. (if required)
contentValidator=contentValidator
contentValidator.hint=Class Name of the content Validation or 'default' to set default class, required to implement (if required)
contentValidatorParams=contentValidationParams
contentValidatorParams.hint=ContentValidationParams, comma seperated. (if required)
contentTransformer=contentTransformer
contentTransformer.hint=Class Name of the content transformer or 'default' to set default class, required to implement (if required)

@ -267,8 +267,8 @@ public class MQTTAdapterListener implements MqttCallback, Runnable {
try {
MQTTEventAdapterConstants.initialReconnectDuration = MQTTEventAdapterConstants.initialReconnectDuration
* MQTTEventAdapterConstants.reconnectionProgressionFactor;
startListener();
Thread.sleep(MQTTEventAdapterConstants.initialReconnectDuration);
startListener();
connectionSucceeded = true;
log.info("MQTT Connection successful");
} catch (InterruptedException e) {

@ -32,10 +32,10 @@ public class MQTTEventAdapterConstants {
public static final String ADAPTER_CONF_URL_HINT = "url.hint";
public static final String ADAPTER_CONF_DCR_URL = "dcrUrl";
public static final String ADAPTER_CONF_DCR_URL_HINT = "dcrUrl.hint";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_CLASSNAME = "contentValidation";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_CLASSNAME_HINT = "contentValidation.hint";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_PARAMS = "contentValidationParams";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_PARAMS_HINT = "contentValidationParams.hint";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_CLASSNAME = "contentValidator";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_CLASSNAME_HINT = "contentValidator.hint";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_PARAMS = "contentValidatorParams";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_PARAMS_HINT = "contentValidatorParams.hint";
public static final String ADAPTER_CONF_CONTENT_TRANSFORMER_CLASSNAME = "contentTransformer";
public static final String ADAPTER_CONF_CONTENT_TRANSFORMER_CLASSNAME_HINT = "contentTransformer.hint";
public static final String ADAPTER_MESSAGE_TOPIC = "topic";
@ -47,7 +47,7 @@ public class MQTTEventAdapterConstants {
public static final String ADAPTER_CONF_KEEP_ALIVE = "keepAlive";
public static final int ADAPTER_CONF_DEFAULT_KEEP_ALIVE = 60000;
public static int initialReconnectDuration = 10000;
public static int initialReconnectDuration = 2000;
public static final int reconnectionProgressionFactor = 2;
public static final String EMPTY_STRING = "";

@ -27,10 +27,10 @@ scopes=Scopes
scopes.hint=Scopes required to connect to broker (if required)
dcrUrl=dcrUrl
dcrUrl.hint=dynamic client registration endpoint URL to create application (if required) eg: https://localhost:9443/dynamic-client-web/register
contentValidation=contentValidation
contentValidation.hint=Class Name of the content Validation or 'default' to set default class, required to implement (if required)
contentValidationParams=contentValidationParams
contentValidationParams.hint=ContentValidationParams, comma seperated. (if required)
contentValidator=contentValidation
contentValidator.hint=Class Name of the content Validation or 'default' to set default class, required to implement (if required)
contentValidatorParams=contentValidationParams
contentValidatorParams.hint=ContentValidationParams, comma seperated. (if required)
url.hint=MQTT broker url tcp://localhost:1883
cleanSession=Clean Session
cleanSession.hint=Persist topic subscriptions and ack positions across client sessions

@ -38,10 +38,10 @@ public class XMPPEventAdapterConstants {
public static final String ADAPTER_CONF_RESOURCE_HINT = "resource.hint";
public static final String ADAPTER_CONF_TIMEOUT_INTERVAL = "timeoutInterval";
public static final String ADAPTER_CONF_TIMEOUT_INTERVAL_HINT = "timeoutInterval.hint";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_CLASSNAME = "contentValidation";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_CLASSNAME_HINT = "contentValidation.hint";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_PARAMS = "contentValidationParams";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_PARAMS_HINT = "contentValidationParams.hint";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_CLASSNAME = "contentValidator";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_CLASSNAME_HINT = "contentValidator.hint";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_PARAMS = "contentValidatorParams";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_PARAMS_HINT = "contentValidatorParams.hint";
public static final String ADAPTER_CONF_CONTENT_TRANSFORMER_CLASSNAME = "contentTransformer";
public static final String ADAPTER_CONF_CONTENT_TRANSFORMER_CLASSNAME_HINT = "contentTransformer.hint";
public static final String ADAPTER_CONF_RECIEVER_JID = "jid";

@ -28,10 +28,10 @@ timeoutInterval=Time out Interval
timeoutInterval.hint=used by listeners to the server and for reconnection schedules.
resource=Resource
resource.hint=specific to the XMPP-Account to which the login is made to.
contentValidation=contentValidation
contentValidation.hint=Class Name of the content Validation or 'default' to set default class, required to implement (if required)
contentValidationParams=contentValidationParams
contentValidationParams.hint=ContentValidationParams, comma seperated. (if required)
contentValidator=contentValidation
contentValidator.hint=Class Name of the content Validation or 'default' to set default class, required to implement (if required)
contentValidatorParams=contentValidationParams
contentValidatorParams.hint=ContentValidationParams, comma seperated. (if required)
jid=jid
jid.hint=JID - XMPP Account Name.
contentTransformer=contentTransformer

@ -23,7 +23,7 @@
<property name="target-dir" value="target/carbonapps"/>
<property name="src-dir" value="src/main/resources/carbonapps"/>
<property name="Arduino_dir" value="arduino"/>
<property name="Raspberrypi_dir" value="raspberrypi"/>
<target name="clean">
<delete dir="${target-dir}" />
@ -31,8 +31,8 @@
<target name="zip" depends="clean">
<mkdir dir="${target-dir}"/>
<zip destfile="${target-dir}/${Arduino_dir}.car">
<zipfileset dir="${src-dir}/${Arduino_dir}"/>
<zip destfile="${target-dir}/${Raspberrypi_dir}.car">
<zipfileset dir="${src-dir}/${Raspberrypi_dir}"/>
</zip>
</target>
</project>

@ -18,9 +18,9 @@
-->
<artifacts>
<artifact name="arduino" version="1.0.0" type="carbon/application">
<dependency artifact="arduino_stream" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="arduino_execution" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="arduino_receiver" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<artifact name="raspberrypi" version="1.0.0" type="carbon/application">
<dependency artifact="raspberrypi_stream" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="raspberrypi_receiver" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="raspberrypi_execution" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
</artifact>
</artifacts>

@ -17,7 +17,7 @@
~ under the License.
-->
<artifact name="arduino_execution" version="1.0.0" type="event/execution-plan" serverRole="DataAnalyticsServer">
<file>arduino_execution.siddhiql</file>
<artifact name="raspberrypi_execution" version="1.0.0" type="event/execution-plan" serverRole="DataAnalyticsServer">
<file>raspberrypi_execution.siddhiql</file>
</artifact>

@ -1,17 +1,17 @@
/* Enter a unique ExecutionPlan */
@Plan:name('arduino_execution')
@Plan:name('raspberrypi_execution')
/* Enter a unique description for ExecutionPlan */
-- @Plan:description('arduino_execution')
-- @Plan:description('raspberrypi_execution')
/* define streams/tables and write queries here ... */
@Import('org.wso2.iot.arduino:1.0.0')
define stream arduino (meta_owner string, meta_deviceId string, temperature float);
@Import('org.wso2.iot.raspberrypi:1.0.0')
define stream raspberrypi (meta_owner string, meta_deviceId string, meta_time long, temperature float);
@Export('org.wso2.iot.devices.temperature:1.0.0')
define stream temperature (meta_owner string, meta_deviceType string, meta_deviceId string, meta_time long, temperature float);
from arduino
select meta_owner, 'arduino' as meta_deviceType, meta_deviceId, time:timestampInMilliseconds() as meta_time, temperature
from raspberrypi
select meta_owner, 'raspberrypi' as meta_deviceType, meta_deviceId, meta_time, temperature
insert into temperature;

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

@ -17,17 +17,16 @@
~ under the License.
-->
<eventReceiver name="raspberrypi_receiver" statistics="disable" trace="disable" xmlns="http://wso2.org/carbon/eventreceiver">
<from eventAdapterType="oauth-http">
<property name="maximumHttpConnectionPerHost">2</property>
<from eventAdapterType="oauth-mqtt">
<property name="topic">carbon.super/raspberrypi/+/temperature</property>
<property name="username">admin</property>
<property name="contentValidatorParams">device_id_json_path:event.metaData.deviceId</property>
<property name="contentValidator">org.wso2.carbon.device.mgt.iot.input.adapter.http.util.HTTPContentValidator</property>
<property name="contentValidatorParams">device_id_json_path:event.metaData.deviceId,device_id_topic_hierarchy_index:2</property>
<property name="contentValidator">org.wso2.carbon.device.mgt.iot.input.adapter.mqtt.util.MQTTContentValidator</property>
<property name="contentTransformer">default</property>
<property name="transports">all</property>
<property name="maximumTotalHttpConnection">100</property>
<property name="tokenValidationEndpointUrl">https://localhost:${carbon.https.port}/services/OAuth2TokenValidationService</property>
<property name="password">admin</property>
<property name="dcrUrl">https://localhost:${carbon.https.port}/dynamic-client-web/register</property>
<property name="url">tcp://${mqtt.broker.host}:${mqtt.broker.port}</property>
<property name="cleanSession">true</property>
</from>
<mapping customMapping="disable" type="json"/>
<to streamName="org.wso2.iot.arduino" version="1.0.0"/>
<to streamName="org.wso2.iot.raspberrypi" version="1.0.0"/>
</eventReceiver>

@ -1,11 +1,12 @@
{
"name": "org.wso2.iot.arduino",
"name": "org.wso2.iot.raspberrypi",
"version": "1.0.0",
"nickName": "Arduino",
"description": "Temperature data received from the Arduino",
"nickName": "raspberrypi",
"description": "Temperature data received from the raspberrypi",
"metaData": [
{"name":"owner","type":"STRING"},
{"name":"deviceId","type":"STRING"}
{"name":"deviceId","type":"STRING"},
{"name":"time","type":"LONG"}
],
"payloadData": [
{

@ -36,6 +36,7 @@
<module>org.wso2.carbon.device.mgt.iot.raspberrypi.plugin</module>
<module>org.wso2.carbon.device.mgt.iot.raspberrypi.ui</module>
<module>org.wso2.carbon.device.mgt.iot.raspberrypi.api</module>
<module>org.wso2.carbon.device.mgt.iot.raspberrypi.analytics</module>
</modules>
<build>

@ -68,7 +68,7 @@ public class VirtualFireAlarmConstants {
public static final String TOPIC = "topic";
public static final String SUBSCRIBED_TOPIC = "carbon.super/virtual_firealarm/+/publisher";
public static final String CONTENT_VALIDATION = "contentValidation";
public static final String CONTENT_VALIDATION = "contentValidator";
public static final String CONTENT_TRANSFORMATION = "contentTransformer";
public static final String RESOURCE = "resource";

@ -19,4 +19,4 @@ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../con
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../database/AndroidSenseDM_DB.h2.db);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.device-view);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/carbonapps/Android_Sense.car);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/carbonapps/android_sense.car);\

@ -91,6 +91,18 @@
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>org.wso2.carbon.device.mgt.iot.arduino.analytics
</artifactId>
<version>${project.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>
${project.build.directory}/maven-shared-archive-resources/carbonapps
</outputDirectory>
<includes>**/*</includes>
</artifactItem>
<artifactItem>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>org.wso2.carbon.device.mgt.iot.arduino.ui

@ -100,12 +100,8 @@ void setupResource(){
jsonPayLoad = "{\"event\":{\"metaData\":";
jsonPayLoad += "{\"owner\":\"";
jsonPayLoad += String(DEVICE_OWNER);
jsonPayLoad += "\",\"deviceType\":\"";
jsonPayLoad += String(DEVICE_TYPE);
jsonPayLoad += "\",\"deviceId\":\"";
jsonPayLoad += String(DEVICE_ID);
jsonPayLoad += "\",\"time\":";
jsonPayLoad += String(TIME);
jsonPayLoad += "}, \"payloadData\":{";
if(DEBUG) {

@ -10,6 +10,8 @@ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../featur
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.arduino_${feature.version}/datasources/,target:${installFolder}/../../conf/datasources/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../database/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.arduino_${feature.version}/database/,target:${installFolder}/../../database/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/carbonapps/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.arduino_${feature.version}/carbonapps/,target:${installFolder}/../../deployment/server/carbonapps/,overwrite:true);\
instructions.unconfigure = \
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/webapps/arduino.war);\
@ -20,3 +22,4 @@ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../con
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../database/ArduinoDM_DB.h2.db);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.device-view);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.arduino.type-view);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/carbonapps/arduino.car);\

@ -91,6 +91,18 @@
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>org.wso2.carbon.device.mgt.iot.raspberrypi.analytics
</artifactId>
<version>${project.version}</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>
${project.build.directory}/maven-shared-archive-resources/carbonapps
</outputDirectory>
<includes>**/*</includes>
</artifactItem>
<artifactItem>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>org.wso2.carbon.device.mgt.iot.raspberrypi.ui

@ -10,6 +10,8 @@ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../featur
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.raspberrypi_${feature.version}/datasources/,target:${installFolder}/../../conf/datasources/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../database/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.raspberrypi_${feature.version}/database/,target:${installFolder}/../../database/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/carbonapps/);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.raspberrypi_${feature.version}/carbonapps/,target:${installFolder}/../../deployment/server/carbonapps/,overwrite:true);\
instructions.unconfigure = \
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/webapps/raspberrypi.war);\
@ -20,3 +22,4 @@ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../con
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../database/RaspberryPiDM_DB.h2.db);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.device-view);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.type-view);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/carbonapps/raspberrypi.car);\
Loading…
Cancel
Save