diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/js/websocket.js b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/js/websocket.js
index 87e500eee0..72fb6f7f21 100644
--- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/js/websocket.js
+++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/GadgetGeoDashboard_1.0.0/geo-dashboard/js/websocket.js
@@ -116,6 +116,10 @@ SpatialObject.prototype.update = function (geoJSON) {
// Update the spatial object leaflet marker
this.marker.setLatLng([this.latitude, this.longitude]);
+
+ if (this.latitude, this.longitude) {
+ map.setView([this.latitude, this.longitude]);
+ }
this.marker.setIconAngle(this.heading);
this.marker.setIcon(this.stateIcon());
@@ -707,7 +711,7 @@ intializeWebsocketUrls();
SpatialObject.prototype.stateIcon = function () {
//TODO : Need to add separate icons for each device type
- var iconUrl = "/portal/store/carbon.super/fs/gadget/geo-dashboard/img/markers/object-types/default_icons";
+ var iconUrl = "/portal/store/carbon.super/fs/gadget/geo-dashboard/img/markers/object-types/default";
if (0 < this.speed && (-360 <= this.heading && 360 >= this.heading)) {
iconUrl = iconUrl + "/moving/" + this.state.toLowerCase();
} else {
diff --git a/components/extensions/pom.xml b/components/extensions/pom.xml
index 5a994a1614..15dc85a5ae 100644
--- a/components/extensions/pom.xml
+++ b/components/extensions/pom.xml
@@ -36,6 +36,7 @@
appm-connector
cdmf-transport-adapters
mb-extensions
+ siddhi-extensions
@@ -44,7 +45,7 @@
org.apache.felix
maven-scr-plugin
- 1.7.2
+ ${maven.scr.version}
generate-scr-scrdescriptor
diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml
new file mode 100644
index 0000000000..b14a66967b
--- /dev/null
+++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+ org.wso2.carbon.devicemgt-plugins
+ siddhi-extensions
+ 3.0.3-SNAPSHOT
+ ../pom.xml
+
+
+ 4.0.0
+ org.wso2.extension.siddhi.execution.json
+ bundle
+ WSO2 Siddhi Execution Extension - Json
+ http://wso2.org
+
+
+
+ org.wso2.siddhi
+ siddhi-core
+
+
+ org.wso2.siddhi
+ siddhi-query-api
+
+
+ log4j
+ log4j
+
+
+ org.json.wso2
+ json
+
+
+ junit
+ junit
+ test
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ ${wso2.maven.compiler.target}
+
+
+
+ org.apache.felix
+ maven-bundle-plugin
+ true
+
+
+ ${project.artifactId}
+ ${project.artifactId}
+
+ org.wso2.extension.siddhi.execution.json,
+ org.wso2.extension.siddhi.execution.json.*
+
+
+ org.json,
+ org.wso2.siddhi.core.*,
+ org.wso2.siddhi.query.api.*,
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/src/main/java/org/wso2/extension/siddhi/execution/json/getPropertyFunctionExtension.java b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/src/main/java/org/wso2/extension/siddhi/execution/json/getPropertyFunctionExtension.java
new file mode 100644
index 0000000000..78c873a550
--- /dev/null
+++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/src/main/java/org/wso2/extension/siddhi/execution/json/getPropertyFunctionExtension.java
@@ -0,0 +1,108 @@
+/*
+ * 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.
+ */
+
+package org.wso2.extension.siddhi.execution.json;
+
+import org.json.JSONObject;
+import org.wso2.siddhi.core.config.ExecutionPlanContext;
+import org.wso2.siddhi.core.exception.ExecutionPlanRuntimeException;
+import org.wso2.siddhi.core.executor.ExpressionExecutor;
+import org.wso2.siddhi.core.executor.function.FunctionExecutor;
+import org.wso2.siddhi.query.api.definition.Attribute;
+import org.wso2.siddhi.query.api.exception.ExecutionPlanValidationException;
+
+/**
+ * getProperty(json , propertyName)
+ * Returns the vale of the property from the given json json
+ * Accept Type(s): (STRING, STRING)
+ * Return Type(s): (STRING|INT|DOUBLE|FLOAT|OBJECT)
+ */
+public class getPropertyFunctionExtension extends FunctionExecutor {
+
+ Attribute.Type returnType = Attribute.Type.STRING;
+
+ @Override
+ protected void init(ExpressionExecutor[] attributeExpressionExecutors,
+ ExecutionPlanContext executionPlanContext) {
+ if (attributeExpressionExecutors.length != 2) {
+ throw new ExecutionPlanValidationException(
+ "Invalid no of arguments passed to json:getProperty() function," + " required 2, but found "
+ + attributeExpressionExecutors.length);
+ }
+ if (attributeExpressionExecutors[0].getReturnType() != Attribute.Type.STRING) {
+ throw new ExecutionPlanValidationException(
+ "Invalid parameter type found for the first argument of json:getProperty() function, " + "required "
+ + Attribute.Type.STRING + ", but found " + attributeExpressionExecutors[0].getReturnType()
+ .toString());
+ }
+ if (attributeExpressionExecutors[1].getReturnType() != Attribute.Type.STRING) {
+ throw new ExecutionPlanValidationException(
+ "Invalid parameter type found for the second argument of json:getProperty() function, " + "required "
+ + Attribute.Type.STRING + ", but found " + attributeExpressionExecutors[1].getReturnType()
+ .toString());
+ }
+ }
+
+ @Override
+ protected Object execute(Object[] data) {
+ if (data[0] == null) {
+ throw new ExecutionPlanRuntimeException("Invalid input given to json:getProperty() function. First argument cannot be null");
+ }
+ if (data[1] == null) {
+ throw new ExecutionPlanRuntimeException("Invalid input given to json:getProperty() function. Second argument cannot be null");
+ }
+ String jsonString = (String) data[0];
+ String property = (String) data[1];
+
+ JSONObject jsonObject = new JSONObject(jsonString);
+ Object value = jsonObject.get(property).toString();
+ return value;
+ }
+
+ @Override
+ protected Object execute(Object data) {
+ return null; //Since the getProperty function takes in 2 parameters, this method does not get called. Hence,not implemented.
+ }
+
+ @Override
+ public void start() {
+ //Nothing to start
+ }
+
+ @Override
+ public void stop() {
+ //Nothing to stop
+ }
+
+ @Override
+ public Attribute.Type getReturnType() {
+ return returnType;
+ }
+
+ @Override
+ public Object[] currentState() {
+ return null; //No need to maintain a state.
+ }
+
+ @Override
+ public void restoreState(Object[] state) {
+ //Since there's no need to maintain a state, nothing needs to be done here.
+ }
+}
+
+
diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/src/main/resources/json.siddhiext b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/src/main/resources/json.siddhiext
new file mode 100644
index 0000000000..f1886dd63e
--- /dev/null
+++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/src/main/resources/json.siddhiext
@@ -0,0 +1,19 @@
+#
+# 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.
+#
+
+getProperty=org.wso2.extension.siddhi.execution.json.getPropertyFunctionExtension
diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/src/test/java/org/wso2/extension/siddhi/execution/json/getPropertyFunctionTestCase.java b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/src/test/java/org/wso2/extension/siddhi/execution/json/getPropertyFunctionTestCase.java
new file mode 100644
index 0000000000..7bc66478c2
--- /dev/null
+++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/src/test/java/org/wso2/extension/siddhi/execution/json/getPropertyFunctionTestCase.java
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+
+package org.wso2.extension.siddhi.execution.json;
+
+import junit.framework.Assert;
+import org.apache.log4j.Logger;
+import org.junit.Before;
+import org.junit.Test;
+import org.wso2.siddhi.core.ExecutionPlanRuntime;
+import org.wso2.siddhi.core.SiddhiManager;
+import org.wso2.siddhi.core.event.Event;
+import org.wso2.siddhi.core.query.output.callback.QueryCallback;
+import org.wso2.siddhi.core.stream.input.InputHandler;
+import org.wso2.siddhi.core.util.EventPrinter;
+import org.wso2.extension.siddhi.execution.json.test.util.SiddhiTestHelper;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+public class getPropertyFunctionTestCase {
+ static final Logger log = Logger.getLogger(getPropertyFunctionTestCase.class);
+ private AtomicInteger count = new AtomicInteger(0);
+ private volatile boolean eventArrived;
+
+ @Before
+ public void init() {
+ count.set(0);
+ eventArrived = false;
+ }
+
+ @Test
+ public void testGetPropertyFunctionExtension() throws InterruptedException {
+ log.info("getPropertyFunctionExtension TestCase");
+ SiddhiManager siddhiManager = new SiddhiManager();
+
+ String inStreamDefinition = "define stream inputStream (payload string, id string, volume long);";
+ String query = ("@info(name = 'query1') from inputStream select id, json:getProperty(payload, 'latitude') "
+ + "as latitude insert into outputStream;");
+ ExecutionPlanRuntime executionPlanRuntime = siddhiManager.createExecutionPlanRuntime(inStreamDefinition + query);
+
+ executionPlanRuntime.addCallback("query1", new QueryCallback() {
+ @Override
+ public void receive(long timeStamp, Event[] inEvents, Event[] removeEvents) {
+ EventPrinter.print(timeStamp, inEvents, removeEvents);
+ for (Event event : inEvents) {
+ count.incrementAndGet();
+ if (count.get() == 1) {
+ Assert.assertEquals("1.5", event.getData(1));
+ eventArrived = true;
+ }
+ if (count.get() == 2) {
+ Assert.assertEquals("67.5", event.getData(1));
+ eventArrived = true;
+ }
+ if (count.get() == 3) {
+ Assert.assertEquals("7.5", event.getData(1));
+ eventArrived = true;
+ }
+ }
+ }
+ });
+
+ InputHandler inputHandler = executionPlanRuntime.getInputHandler("inputStream");
+ executionPlanRuntime.start();
+ inputHandler.send(new Object[]{"{'latitude' : 1.5, 'longitude' : 78.5}","IBM",100l});
+ inputHandler.send(new Object[]{"{'latitude' : 67.5, 'longitude' : 34.9}","WSO2", 200l});
+ inputHandler.send(new Object[]{"{'latitude' : 7.5, 'longitude' : 44.9}", "XYZ", 200l});
+ SiddhiTestHelper.waitForEvents(100, 3, count, 60000);
+ Assert.assertEquals(3, count.get());
+ Assert.assertTrue(eventArrived);
+ executionPlanRuntime.shutdown();
+ }
+}
diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/src/test/java/org/wso2/extension/siddhi/execution/json/test/util/SiddhiTestHelper.java b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/src/test/java/org/wso2/extension/siddhi/execution/json/test/util/SiddhiTestHelper.java
new file mode 100644
index 0000000000..9cfd6c307d
--- /dev/null
+++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/src/test/java/org/wso2/extension/siddhi/execution/json/test/util/SiddhiTestHelper.java
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+package org.wso2.extension.siddhi.execution.json.test.util;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+public class SiddhiTestHelper {
+ public static void waitForEvents(long sleepTime, int expectedCount, AtomicInteger actualCount, long timeout) throws InterruptedException {
+ long currentWaitTime = 0;
+ long startTime = System.currentTimeMillis();
+ while ((actualCount.get() < expectedCount) && (currentWaitTime <= timeout)) {
+ Thread.sleep(sleepTime);
+ currentWaitTime = System.currentTimeMillis() - startTime;
+ }
+ }
+}
diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/src/test/resources/log4j.properties b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/src/test/resources/log4j.properties
new file mode 100644
index 0000000000..96c79e9449
--- /dev/null
+++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/src/test/resources/log4j.properties
@@ -0,0 +1,36 @@
+#
+# Copyright (c) 2015, 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.
+#
+
+
+# For the general syntax of property based configuration files see the
+# documenation of org.apache.log4j.PropertyConfigurator.
+
+# The root category uses the appender called A1. Since no priority is
+# specified, the root category assumes the default priority for root
+# which is DEBUG in log4j. The root category is the only category that
+# has a default priority. All other categories need not be assigned a
+# priority in which case they inherit their priority from the
+# hierarchy.
+
+#log4j.rootLogger=DEBUG, stdout
+log4j.rootLogger=INFO, stdout
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%m%n
+#log4j.appender.stdout.layout.ConversionPattern=[%t] %-5p %c %x - %m%n
diff --git a/components/extensions/siddhi-extensions/pom.xml b/components/extensions/siddhi-extensions/pom.xml
new file mode 100644
index 0000000000..39b9741fe3
--- /dev/null
+++ b/components/extensions/siddhi-extensions/pom.xml
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+ org.wso2.carbon.devicemgt-plugins
+ extensions
+ 3.0.3-SNAPSHOT
+ ../pom.xml
+
+
+ 4.0.0
+ siddhi-extensions
+ pom
+ WSO2 Carbon - Siddhi Extension
+ http://wso2.org
+
+
+ org.wso2.extension.siddhi.execution.json
+
+
+
+
+
+
+ org.apache.felix
+ maven-scr-plugin
+ ${maven.scr.version}
+
+
+ generate-scr-scrdescriptor
+
+ scr
+
+
+
+
+
+
+
+
diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/build.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/build.xml
new file mode 100644
index 0000000000..c0daeaa1ef
--- /dev/null
+++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/build.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/pom.xml
new file mode 100644
index 0000000000..15bdf3bff5
--- /dev/null
+++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/pom.xml
@@ -0,0 +1,76 @@
+
+
+
+
+
+ org.wso2.carbon.devicemgt-plugins
+ iot-analytics
+ 3.0.3-SNAPSHOT
+ ../pom.xml
+
+
+ 4.0.0
+ org.wso2.carbon.device.mgt.mobile.android.analytics
+ WSO2 Carbon - IoT Android Stream C-APP
+ http://wso2.org
+ This feature contains the android streams
+ pom
+
+
+
+
+ maven-antrun-plugin
+ ${maven-antrun-plugin.version}
+
+
+ process-resources
+
+
+
+
+
+
+ run
+
+
+
+
+
+ maven-assembly-plugin
+ ${maven.assembly.plugin.version}
+
+ ${project.artifactId}-${carbon.devicemgt.plugins.version}
+ false
+
+ src/assembly/src.xml
+
+
+
+
+ create-archive
+ package
+
+ single
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/assembly/src.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/assembly/src.xml
new file mode 100644
index 0000000000..a5a375010e
--- /dev/null
+++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/assembly/src.xml
@@ -0,0 +1,36 @@
+
+
+
+ src
+
+ zip
+
+ false
+ ${basedir}/src
+
+
+ ${basedir}/target/carbonapps
+ /
+ true
+
+
+
\ No newline at end of file
diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/Android-Agent-Event-Receiver_1.0.0/android_agent_event_receiver.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/Android-Agent-Event-Receiver_1.0.0/android_agent_event_receiver.xml
new file mode 100644
index 0000000000..977e9a38c5
--- /dev/null
+++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/Android-Agent-Event-Receiver_1.0.0/android_agent_event_receiver.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+ false
+
+
+
+
diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/Android-Agent-Event-Receiver_1.0.0/artifact.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/Android-Agent-Event-Receiver_1.0.0/artifact.xml
new file mode 100644
index 0000000000..078b058df1
--- /dev/null
+++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/Android-Agent-Event-Receiver_1.0.0/artifact.xml
@@ -0,0 +1,22 @@
+
+
+
+
+ android_agent_event_receiver.xml
+
diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/Android-Agent-ExecutionPlan/Android-Agent-ExecutionPlan.siddhiql b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/Android-Agent-ExecutionPlan/Android-Agent-ExecutionPlan.siddhiql
new file mode 100644
index 0000000000..a7b4691313
--- /dev/null
+++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/Android-Agent-ExecutionPlan/Android-Agent-ExecutionPlan.siddhiql
@@ -0,0 +1,20 @@
+/* Enter a unique ExecutionPlan */
+@Plan:name('Android-Agent-ExecutionPlan')
+
+/* Enter a unique description for ExecutionPlan */
+@Plan:description('To convert the android agent incoming stream to relvant streams')
+
+/* define streams/tables and write queries here ... */
+
+@Plan:trace('false')
+
+@Import('org.wso2.android.agent.Stream:1.0.0')
+define stream dataIn (deviceId string, payload string, type string);
+
+@Export('org.wso2.geo.LocationStream:1.0.0')
+define stream dataOut (id string, timeStamp long, latitude double, longitude double, type string, speed float, heading float );
+
+from dataIn[type == 'location']
+select deviceId as id, convert(json:getProperty(payload, 'timeStamp'), 'long') as timeStamp, convert(json:getProperty(payload,
+'latitude'), 'double') as latitude, convert(json:getProperty(payload, 'longitude'), 'double') as longitude,
+'android' as type, 0.0f as speed, 0.0f as heading insert into dataOut
\ No newline at end of file
diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/Android-Agent-ExecutionPlan/artifact.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/Android-Agent-ExecutionPlan/artifact.xml
new file mode 100644
index 0000000000..20093a25f3
--- /dev/null
+++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/Android-Agent-ExecutionPlan/artifact.xml
@@ -0,0 +1,23 @@
+
+
+
+
+ Android-Agent-ExecutionPlan.siddhiql
+
+
diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/artifacts.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/artifacts.xml
new file mode 100644
index 0000000000..61741f7c06
--- /dev/null
+++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/artifacts.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/org.wso2.android.agent.Stream_1.0.0/artifact.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/org.wso2.android.agent.Stream_1.0.0/artifact.xml
new file mode 100644
index 0000000000..4e4a656257
--- /dev/null
+++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/org.wso2.android.agent.Stream_1.0.0/artifact.xml
@@ -0,0 +1,23 @@
+
+
+
+
+ org.wso2.android.agent.Stream_1.0.0.json
+
+
diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/org.wso2.android.agent.Stream_1.0.0/org.wso2.android.agent.Stream_1.0.0.json b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/org.wso2.android.agent.Stream_1.0.0/org.wso2.android.agent.Stream_1.0.0.json
new file mode 100755
index 0000000000..ed17c58f23
--- /dev/null
+++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/org.wso2.android.agent.Stream_1.0.0/org.wso2.android.agent.Stream_1.0.0.json
@@ -0,0 +1,20 @@
+{
+ "name": "org.wso2.android.agent.Stream",
+ "version": "1.0.0",
+ "nickName": "",
+ "description": "Stream that receives various types of events from android agent",
+ "payloadData": [
+ {
+ "name": "deviceId",
+ "type": "STRING"
+ },
+ {
+ "name": "payload",
+ "type": "STRING"
+ },
+ {
+ "name": "type",
+ "type": "STRING"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/EventReceiverServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/EventReceiverServiceImpl.java
index cf66771890..a11c678d02 100644
--- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/EventReceiverServiceImpl.java
+++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/EventReceiverServiceImpl.java
@@ -40,8 +40,7 @@ import java.util.List;
@Path("/events")
public class EventReceiverServiceImpl implements EventReceiverService {
-
- private static final String EVENT_STREAM_DEFINITION = "android_agent";
+ private static final String EVENT_STREAM_DEFINITION = "org.wso2.android.agent.Stream";
private static final Log log = LogFactory.getLog(EventReceiverServiceImpl.class);
@POST
diff --git a/components/mobile-plugins/android-plugin/pom.xml b/components/mobile-plugins/android-plugin/pom.xml
index 3349f4b2a4..3c67bfde64 100644
--- a/components/mobile-plugins/android-plugin/pom.xml
+++ b/components/mobile-plugins/android-plugin/pom.xml
@@ -36,6 +36,7 @@
org.wso2.carbon.device.mgt.mobile.android
org.wso2.carbon.device.mgt.mobile.android.api
org.wso2.carbon.device.mgt.mobile.android.ui
+ org.wso2.carbon.device.mgt.mobile.android.analytics
diff --git a/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml b/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml
new file mode 100644
index 0000000000..5c572f2c26
--- /dev/null
+++ b/features/extensions-feature/org.wso2.extension.siddhi.execution.json.feature/pom.xml
@@ -0,0 +1,76 @@
+
+
+
+ 4.0.0
+
+
+ org.wso2.carbon.devicemgt-plugins
+ extensions-feature
+ 3.0.3-SNAPSHOT
+ ../pom.xml
+
+
+ org.wso2.extension.siddhi.execution.json.feature
+ pom
+ 3.0.3-SNAPSHOT
+ WSO2 Siddhi Execution Extension - Json Feature
+ http://wso2.org
+ This feature contains Siddhi extension feature for changing a json string to individual properties.
+
+
+
+ org.wso2.carbon.devicemgt-plugins
+ org.wso2.extension.siddhi.execution.json
+
+
+
+
+
+
+ org.wso2.maven
+ carbon-p2-plugin
+ ${carbon.p2.plugin.version}
+
+
+ p2-feature-generation
+ package
+
+ p2-feature-gen
+
+
+ org.wso2.extension.siddhi.execution.json
+ ../../etc/feature.properties
+
+
+ org.wso2.carbon.p2.category.type:server
+ org.eclipse.equinox.p2.type.group:true
+
+
+
+
+ org.wso2.carbon.devicemgt-plugins:org.wso2.extension.siddhi.execution.json:${carbon.devicemgt.plugins.version}
+
+ org.json.wso2:json:${commons-json.version}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/features/extensions-feature/pom.xml b/features/extensions-feature/pom.xml
index b6afa7982e..3df8280605 100644
--- a/features/extensions-feature/pom.xml
+++ b/features/extensions-feature/pom.xml
@@ -37,6 +37,7 @@
org.wso2.carbon.appmgt.mdm.osgiconnector.feature
org.wso2.carbon.device.mgt.adapter.feature
org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature
+ org.wso2.extension.siddhi.execution.json.feature
diff --git a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/pom.xml b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/pom.xml
index 5b79edefde..97b1674501 100644
--- a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/pom.xml
+++ b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/pom.xml
@@ -117,6 +117,18 @@
**/*
+
+ org.wso2.carbon.devicemgt-plugins
+ org.wso2.carbon.device.mgt.mobile.android.analytics
+
+ ${project.version}
+ zip
+ true
+
+ ${project.build.directory}/maven-shared-archive-resources/carbonapps
+
+ **/*
+
diff --git a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/p2.inf b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/p2.inf
index 2b8eaf5dd0..3ef1823484 100644
--- a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/p2.inf
+++ b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/p2.inf
@@ -1,5 +1,7 @@
instructions.configure = \
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/webapps/api#device-mgt#android#v1.0.war,target:${installFolder}/../../deployment/server/webapps/api#device-mgt#android#v1.0.war,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.mobile.android_${feature.version}/carbonapps/,target:${installFolder}/../../deployment/server/carbonapps/,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/jaggeryapps/devicemgt,target:${installFolder}/../../deployment/server/jaggeryapps/devicemgt,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/jaggeryapps/android-web-agent,target:${installFolder}/../../deployment/server/jaggeryapps/android-web-agent,overwrite:true);\
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/datasources/,target:${installFolder}/../../conf/datasources/,overwrite:true);\
@@ -28,4 +30,5 @@ org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../dep
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../../dbscripts/cdm/plugins/android);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../database/WSO2MobileAndroid_DB.h2.db);\
+org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/carbonapps/android_agent_analytics-1.0.0.car);\
org.eclipse.equinox.p2.touchpoint.natives.remove(path:${installFolder}/../../deployment/server/devicetypes/android.xml);\
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 7d938215f1..877d85a109 100644
--- a/pom.xml
+++ b/pom.xml
@@ -382,6 +382,11 @@
+
+ org.wso2.carbon.devicemgt-plugins
+ org.wso2.extension.siddhi.execution.json
+ ${carbon.devicemgt.plugins.version}
+
org.wso2.carbon.devicemgt-plugins
org.wso2.carbon.device.mgt.output.adapter.mqtt
@@ -1185,6 +1190,24 @@
feign-gson
${io.github.openfeign.version}
+
+
+
+ org.wso2.siddhi
+ siddhi-core
+ ${siddhi.version}
+
+
+ org.wso2.siddhi
+ siddhi-query-api
+ ${siddhi.version}
+
+
+ junit
+ junit
+ ${junit.version}
+ test
+
@@ -1352,6 +1375,9 @@
9.3.1
[1.1.0, 2.0.0)
1.7
+ 3.1.2
+ 1.7.2
+ 2.5.5