refactored analytics scripts

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

@ -17,13 +17,14 @@
~ under the License. ~ 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="project-name" value="${ant.project.name}"/>
<property name="target-dir" value="target/carbonapps"/> <property name="target-dir" value="target/carbonapps"/>
<property name="src-dir" value="src/main/resources/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"> <target name="clean">
<delete dir="${target-dir}" /> <delete dir="${target-dir}" />
@ -34,5 +35,8 @@
<zip destfile="${target-dir}/${Android_Sense_dir}.car"> <zip destfile="${target-dir}/${Android_Sense_dir}.car">
<zipfileset dir="${src-dir}/${Android_Sense_dir}"/> <zipfileset dir="${src-dir}/${Android_Sense_dir}"/>
</zip> </zip>
<zip destfile="${target-dir}/${Wordcounter_dir}.car">
<zipfileset dir="${src-dir}/${Wordcounter_dir}"/>
</zip>
</target> </target>
</project> </project>

@ -17,13 +17,13 @@
~ under the License. ~ 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="project-name" value="${ant.project.name}"/>
<property name="target-dir" value="target/carbonapps"/> <property name="target-dir" value="target/carbonapps"/>
<property name="src-dir" value="src/main/resources/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"> <target name="clean">
<delete dir="${target-dir}" /> <delete dir="${target-dir}" />
@ -31,8 +31,8 @@
<target name="zip" depends="clean"> <target name="zip" depends="clean">
<mkdir dir="${target-dir}"/> <mkdir dir="${target-dir}"/>
<zip destfile="${target-dir}/${Android_Sense_dir}.car"> <zip destfile="${target-dir}/${Arduino_dir}.car">
<zipfileset dir="${src-dir}/${Android_Sense_dir}"/> <zipfileset dir="${src-dir}/${Arduino_dir}"/>
</zip> </zip>
</target> </target>
</project> </project>

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

@ -6,12 +6,12 @@
/* define streams/tables and write queries here ... */ /* 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') @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); 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 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; insert into temperature;

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

@ -17,7 +17,7 @@
~ under the License. ~ 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> <file>org.wso2.iot.arduino_1.0.0.json</file>
</artifact> </artifact>

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

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

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

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

@ -18,12 +18,11 @@
--> -->
<artifacts> <artifacts>
<artifact name="Temperature_CAPP" version="1.0.0" type="carbon/application"> <artifact name="temperature" version="1.0.0" type="carbon/application">
<dependency artifact="Eventstream_temperature" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/> <dependency artifact="temperature_stream" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="Eventstore_temperature" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/> <dependency artifact="temperature_store" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="Eventreceiver_temperature" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/> <dependency artifact="temperature_receiver" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="Eventreceiver_mqtt_temperature" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/> <dependency artifact="temperature_publisher" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="Eventpublisher_temperature" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/> <dependency artifact="temperature_script" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
<dependency artifact="Sparkscripts" version="1.0.0" include="true" serverRole="DataAnalyticsServer"/>
</artifact> </artifact>
</artifacts> </artifacts>

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

@ -17,7 +17,7 @@
~ under the License. ~ 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"/> <from streamName="org.wso2.iot.devices.temperature" version="1.0.0"/>
<mapping customMapping="disable" type="wso2event"/> <mapping customMapping="disable" type="wso2event"/>
<to eventAdapterType="iot-ui"/> <to eventAdapterType="iot-ui"/>

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

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

@ -17,6 +17,6 @@
~ under the License. ~ 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> <file>org_wso2_iot_devices_temperature.xml</file>
</artifact> </artifact>

@ -17,7 +17,7 @@
~ under the License. ~ 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> <file>org.wso2.iot.devices.temperature_1.0.0.json</file>
</artifact> </artifact>

@ -25,9 +25,9 @@ import java.util.Map;
*/ */
public interface ContentValidator { public interface ContentValidator {
/** /**
* @param contentValidationParams that related to input adapter. * @param contentValidatorParams that related to input adapter.
* @param dynamicParameter that message. * @param dynamicParameter that message.
* @return ContentInfo. * @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 USERNAME_TAG = "username";
public static final String PAYLOAD_TAG = "payload"; public static final String PAYLOAD_TAG = "payload";
public static final String DEVICE_ID_JSON_PATH = "device_id_json_path"; 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 = "contentValidator";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_CLASSNAME_HINT = "contentValidation.hint"; public static final String ADAPTER_CONF_CONTENT_VALIDATOR_CLASSNAME_HINT = "contentValidator.hint";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_PARAMS = "contentValidationParams"; public static final String ADAPTER_CONF_CONTENT_VALIDATOR_PARAMS = "contentValidatorParams";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_PARAMS_HINT = "contentValidationParams.hint"; public static final String ADAPTER_CONF_CONTENT_VALIDATOR_PARAMS_HINT = "contentValidatorParams.hint";
public static final String DEFAULT = "default"; public static final String DEFAULT = "default";
public static final String HTTP_CONTENT_VALIDATION_DEFAULT_PARAMETERS = ""; public static final String HTTP_CONTENT_VALIDATION_DEFAULT_PARAMETERS = "";
public static final String ADAPTER_CONF_CONTENT_TRANSFORMER_CLASSNAME = "contentTransformer"; 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 maximumTotalHttpConnection.hint=Maximum Total connection to be made with the endpoint
maximumHttpConnectionPerHost=maximumHttpConnectionPerHost maximumHttpConnectionPerHost=maximumHttpConnectionPerHost
maximumHttpConnectionPerHost.hint=Maximum Http connection per host. maximumHttpConnectionPerHost.hint=Maximum Http connection per host.
contentValidation=contentValidation contentValidator=contentValidator
contentValidation.hint=Class Name of the content Validation or 'default' to set default class, required to implement (if required) contentValidator.hint=Class Name of the content Validation or 'default' to set default class, required to implement (if required)
contentValidationParams=contentValidationParams contentValidatorParams=contentValidationParams
contentValidationParams.hint=ContentValidationParams, comma seperated. (if required) contentValidatorParams.hint=ContentValidationParams, comma seperated. (if required)
contentTransformer=contentTransformer contentTransformer=contentTransformer
contentTransformer.hint=Class Name of the content transformer or 'default' to set default class, required to implement (if required) 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 { try {
MQTTEventAdapterConstants.initialReconnectDuration = MQTTEventAdapterConstants.initialReconnectDuration MQTTEventAdapterConstants.initialReconnectDuration = MQTTEventAdapterConstants.initialReconnectDuration
* MQTTEventAdapterConstants.reconnectionProgressionFactor; * MQTTEventAdapterConstants.reconnectionProgressionFactor;
startListener();
Thread.sleep(MQTTEventAdapterConstants.initialReconnectDuration); Thread.sleep(MQTTEventAdapterConstants.initialReconnectDuration);
startListener();
connectionSucceeded = true; connectionSucceeded = true;
log.info("MQTT Connection successful"); log.info("MQTT Connection successful");
} catch (InterruptedException e) { } 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_URL_HINT = "url.hint";
public static final String ADAPTER_CONF_DCR_URL = "dcrUrl"; 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_DCR_URL_HINT = "dcrUrl.hint";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_CLASSNAME = "contentValidation"; public static final String ADAPTER_CONF_CONTENT_VALIDATOR_CLASSNAME = "contentValidator";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_CLASSNAME_HINT = "contentValidation.hint"; public static final String ADAPTER_CONF_CONTENT_VALIDATOR_CLASSNAME_HINT = "contentValidator.hint";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_PARAMS = "contentValidationParams"; public static final String ADAPTER_CONF_CONTENT_VALIDATOR_PARAMS = "contentValidatorParams";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_PARAMS_HINT = "contentValidationParams.hint"; 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 = "contentTransformer";
public static final String ADAPTER_CONF_CONTENT_TRANSFORMER_CLASSNAME_HINT = "contentTransformer.hint"; public static final String ADAPTER_CONF_CONTENT_TRANSFORMER_CLASSNAME_HINT = "contentTransformer.hint";
public static final String ADAPTER_MESSAGE_TOPIC = "topic"; 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 String ADAPTER_CONF_KEEP_ALIVE = "keepAlive";
public static final int ADAPTER_CONF_DEFAULT_KEEP_ALIVE = 60000; 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 int reconnectionProgressionFactor = 2;
public static final String EMPTY_STRING = ""; public static final String EMPTY_STRING = "";

@ -27,10 +27,10 @@ scopes=Scopes
scopes.hint=Scopes required to connect to broker (if required) scopes.hint=Scopes required to connect to broker (if required)
dcrUrl=dcrUrl dcrUrl=dcrUrl
dcrUrl.hint=dynamic client registration endpoint URL to create application (if required) eg: https://localhost:9443/dynamic-client-web/register dcrUrl.hint=dynamic client registration endpoint URL to create application (if required) eg: https://localhost:9443/dynamic-client-web/register
contentValidation=contentValidation contentValidator=contentValidation
contentValidation.hint=Class Name of the content Validation or 'default' to set default class, required to implement (if required) contentValidator.hint=Class Name of the content Validation or 'default' to set default class, required to implement (if required)
contentValidationParams=contentValidationParams contentValidatorParams=contentValidationParams
contentValidationParams.hint=ContentValidationParams, comma seperated. (if required) contentValidatorParams.hint=ContentValidationParams, comma seperated. (if required)
url.hint=MQTT broker url tcp://localhost:1883 url.hint=MQTT broker url tcp://localhost:1883
cleanSession=Clean Session cleanSession=Clean Session
cleanSession.hint=Persist topic subscriptions and ack positions across client sessions 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_RESOURCE_HINT = "resource.hint";
public static final String ADAPTER_CONF_TIMEOUT_INTERVAL = "timeoutInterval"; 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_TIMEOUT_INTERVAL_HINT = "timeoutInterval.hint";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_CLASSNAME = "contentValidation"; public static final String ADAPTER_CONF_CONTENT_VALIDATOR_CLASSNAME = "contentValidator";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_CLASSNAME_HINT = "contentValidation.hint"; public static final String ADAPTER_CONF_CONTENT_VALIDATOR_CLASSNAME_HINT = "contentValidator.hint";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_PARAMS = "contentValidationParams"; public static final String ADAPTER_CONF_CONTENT_VALIDATOR_PARAMS = "contentValidatorParams";
public static final String ADAPTER_CONF_CONTENT_VALIDATOR_PARAMS_HINT = "contentValidationParams.hint"; 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 = "contentTransformer";
public static final String ADAPTER_CONF_CONTENT_TRANSFORMER_CLASSNAME_HINT = "contentTransformer.hint"; public static final String ADAPTER_CONF_CONTENT_TRANSFORMER_CLASSNAME_HINT = "contentTransformer.hint";
public static final String ADAPTER_CONF_RECIEVER_JID = "jid"; 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. timeoutInterval.hint=used by listeners to the server and for reconnection schedules.
resource=Resource resource=Resource
resource.hint=specific to the XMPP-Account to which the login is made to. resource.hint=specific to the XMPP-Account to which the login is made to.
contentValidation=contentValidation contentValidator=contentValidation
contentValidation.hint=Class Name of the content Validation or 'default' to set default class, required to implement (if required) contentValidator.hint=Class Name of the content Validation or 'default' to set default class, required to implement (if required)
contentValidationParams=contentValidationParams contentValidatorParams=contentValidationParams
contentValidationParams.hint=ContentValidationParams, comma seperated. (if required) contentValidatorParams.hint=ContentValidationParams, comma seperated. (if required)
jid=jid jid=jid
jid.hint=JID - XMPP Account Name. jid.hint=JID - XMPP Account Name.
contentTransformer=contentTransformer contentTransformer=contentTransformer

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

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

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

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

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

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

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

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

@ -68,7 +68,7 @@ public class VirtualFireAlarmConstants {
public static final String TOPIC = "topic"; public static final String TOPIC = "topic";
public static final String SUBSCRIBED_TOPIC = "carbon.super/virtual_firealarm/+/publisher"; 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 CONTENT_TRANSFORMATION = "contentTransformer";
public static final String RESOURCE = "resource"; 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}/../../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.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/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> </goals>
<configuration> <configuration>
<artifactItems> <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> <artifactItem>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>org.wso2.carbon.device.mgt.iot.arduino.ui <artifactId>org.wso2.carbon.device.mgt.iot.arduino.ui

@ -100,12 +100,8 @@ void setupResource(){
jsonPayLoad = "{\"event\":{\"metaData\":"; jsonPayLoad = "{\"event\":{\"metaData\":";
jsonPayLoad += "{\"owner\":\""; jsonPayLoad += "{\"owner\":\"";
jsonPayLoad += String(DEVICE_OWNER); jsonPayLoad += String(DEVICE_OWNER);
jsonPayLoad += "\",\"deviceType\":\"";
jsonPayLoad += String(DEVICE_TYPE);
jsonPayLoad += "\",\"deviceId\":\""; jsonPayLoad += "\",\"deviceId\":\"";
jsonPayLoad += String(DEVICE_ID); jsonPayLoad += String(DEVICE_ID);
jsonPayLoad += "\",\"time\":";
jsonPayLoad += String(TIME);
jsonPayLoad += "}, \"payloadData\":{"; jsonPayLoad += "}, \"payloadData\":{";
if(DEBUG) { 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.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.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.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 = \ instructions.unconfigure = \
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/webapps/arduino.war);\ 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}/../../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.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/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> </goals>
<configuration> <configuration>
<artifactItems> <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> <artifactItem>
<groupId>org.wso2.carbon.devicemgt-plugins</groupId> <groupId>org.wso2.carbon.devicemgt-plugins</groupId>
<artifactId>org.wso2.carbon.device.mgt.iot.raspberrypi.ui <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.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.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.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 = \ instructions.unconfigure = \
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/webapps/raspberrypi.war);\ 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}/../../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.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/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