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 87e500eee..512124153 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());
@@ -134,7 +138,6 @@ SpatialObject.prototype.update = function (geoJSON) {
if (selectedSpatialObject == this.id) {
this.updatePath([geoJSON.geometry.coordinates[1], geoJSON.geometry.coordinates[0]]);
chart.load({columns: [this.speedHistory.getArray()]});
- map.setView([this.latitude, this.longitude]);
}
// TODO: use general popup DOM
@@ -707,7 +710,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 5a994a161..15dc85a5a 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 000000000..b14a66967
--- /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 000000000..78c873a55
--- /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 000000000..f1886dd63
--- /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 000000000..7bc66478c
--- /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 000000000..9cfd6c307
--- /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 000000000..96c79e944
--- /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 000000000..39b9741fe
--- /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 000000000..c0daeaa1e
--- /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 000000000..15bdf3bff
--- /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 000000000..a5a375010
--- /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 000000000..977e9a38c
--- /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 000000000..078b058df
--- /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 000000000..a7b469131
--- /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 000000000..20093a25f
--- /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 000000000..61741f7c0
--- /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 000000000..4e4a65625
--- /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 000000000..ed17c58f2
--- /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 cf6677189..a11c678d0 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 3349f4b2a..3c67bfde6 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/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/pom.xml b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/pom.xml
new file mode 100644
index 000000000..88e473897
--- /dev/null
+++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/pom.xml
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+ mobile-base-plugin
+ org.wso2.carbon.devicemgt-plugins
+ 2.2.8-SNAPSHOT
+ ../pom.xml
+
+
+ 4.0.0
+ org.wso2.carbon.device.mgt.mobile.ui
+ WSO2 Carbon - EMM Server UI
+ pom
+
+
+
+
+ maven-assembly-plugin
+ 2.5.5
+
+ ${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/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/app-conf.json b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/app-conf.json
new file mode 100644
index 000000000..d3e82ad57
--- /dev/null
+++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/app-conf.json
@@ -0,0 +1,53 @@
+{
+ "appName": "WSO2 Enterprise Mobility Manager",
+ "cachingEnabled": true,
+ "debuggingEnabled": false,
+ "permissionRoot": "/",
+ "loginPage": "cdmf.page.sign-in",
+ "adminServicesUrl": "https://${server.ip}:${server.https_port}/admin/services/",
+ "authModule": {
+ "enabled": true,
+ "login": {
+ "onSuccess": {
+ "script": "/app/modules/login.js",
+ "page": "mdm.page.dashboard"
+ },
+ "onFail": {
+ "script": "/app/modules/login.js",
+ "page": "cdmf.page.sign-in"
+ }
+ },
+ "logout": {
+ "onSuccess": {
+ "page": "cdmf.page.sign-in"
+ },
+ "onFail": {
+ "page": "mdm.page.dashboard"
+ }
+ },
+ "sso": {
+ "enabled": false,
+ "issuer" : "emm",
+ "appName" : "emm",
+ "identityProviderUrl" : "https://localhost:9443/samlsso",
+ "acs": "https://localhost:9443/emm/uuf/sso/acs",
+ "identityAlias": "wso2carbon",
+ "responseSigningEnabled" : true,
+ "validateAssertionValidityPeriod": true,
+ "validateAudienceRestriction": true,
+ "assertionSigningEnabled": true
+ }
+ },
+ "generalConfig" : {
+ "host" : "https://localhost:9443",
+ "companyName" : "WSO2 Enterprise Mobility Manager",
+ "browserTitle" : "WSO2 EMM",
+ "copyrightPrefix" : "\u00A9 %date-year%, ",
+ "copyrightOwner" : "WSO2 Inc.",
+ "copyrightOwnersSite" : "http://www.wso2.org",
+ "copyrightSuffix" : ""
+ },
+ "errorPages": {
+ "default": "uuf.page.error"
+ }
+}
diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json
new file mode 100644
index 000000000..434db0a38
--- /dev/null
+++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json
@@ -0,0 +1,124 @@
+{
+ "appContext": "/emm/",
+ "webAgentContext" : "/emm-web-agent/",
+ "apiContext": "api",
+ "httpsURL" : "%https.ip%",
+ "httpURL" : "%http.ip%",
+ "httpsWebURL" : "%https.ip%",
+ "wssURL" : "%https.ip%",
+ "wsURL" : "%http.ip%",
+ "enrollmentDir": "/emm-web-agent/enrollment",
+ "iOSConfigRoot" : "%https.ip%/ios-enrollment/",
+ "iOSAPIRoot" : "%https.ip%/ios/",
+ "adminService": "%https.ip%",
+ "oauthProvider": {
+ "appRegistration": {
+ "appType": "webapp",
+ "clientName": "emm",
+ "owner": "admin@carbon.super",
+ "dynamicClientAppRegistrationServiceURL": "%https.ip%/dynamic-client-web/register",
+ "apiManagerClientAppRegistrationServiceURL": "%https.ip%/api-application-registration/register/tenants",
+ "grantType": "password refresh_token urn:ietf:params:oauth:grant-type:saml2-bearer urn:ietf:params:oauth:grant-type:jwt-bearer",
+ "tokenScope": "admin",
+ "callbackUrl": "%https.ip%/api/device-mgt/v1.0"
+ },
+ "tokenServiceURL": "%https.ip%/oauth2/token"
+ },
+ "adminUser": "admin@carbon.super",
+ "adminRole": "admin",
+ "usernameLength": 30,
+ "pageSize":10,
+ "ssoConfiguration" : {
+ "enabled" : false,
+ "issuer" : "devicemgt",
+ "appName" : "devicemgt",
+ "identityProviderURL" : "%https.ip%/sso/samlsso.jag",
+ "responseSigningEnabled" : "true",
+ "keyStorePassword" : "wso2carbon",
+ "identityAlias" : "wso2carbon",
+ "keyStoreName" : "/repository/resources/security/wso2carbon.jks"
+ },
+ "userValidationConfig" : {
+ "usernameJSRegEx" : "^[\\S]{3,30}$",
+ "usernameRegExViolationErrorMsg" : "Provided username is invalid.",
+ "usernameHelpMsg" : "Should be in minimum 3 characters long and do not include any whitespaces.",
+ "firstnameJSRegEx" : "^[\\S]{3,30}$",
+ "firstnameRegExViolationErrorMsg" : "Provided first name is invalid.",
+ "lastnameJSRegEx" : "^[\\S]{3,30}$",
+ "lastnameRegExViolationErrorMsg" : "Provided last name is invalid.",
+ "emailJSRegEx" : "/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/",
+ "emailRegExViolationErrorMsg" : "Provided email is invalid."
+ },
+ "groupValidationConfig": {
+ "groupNameJSRegEx": "^[\\S]{3,30}$",
+ "groupNameRegExViolationErrorMsg": "Provided group name is invalid.",
+ "groupNameHelpMsg": "Should be in minimum 3 characters long and should not include any whitespaces."
+ },
+ "roleValidationConfig" : {
+ "roleNameJSRegEx" : "^[\\S]{3,30}$",
+ "roleNameRegExViolationErrorMsg" : "Provided role name is invalid.",
+ "roleNameHelpMsg" : "should be in minimum 3 characters long and do not include any whitespaces."
+ },
+ "generalConfig" : {
+ "host" : "%https.ip%",
+ "companyName" : "WSO2 Carbon Device Manager",
+ "browserTitle" : "WSO2 Device Manager",
+ "copyrightPrefix" : "\u00A9 %date-year%, ",
+ "copyrightOwner" : "WSO2 Inc.",
+ "copyrightOwnersSite" : "http://www.wso2.org",
+ "copyrightSuffix" : " All Rights Reserved."
+ },
+ "scopes" : [
+ "user:manage",
+ "user:view",
+ "device-type:admin:view",
+ "device:view",
+ "notification:view",
+ "device:admin:view",
+ "application:manage",
+ "activity:view",
+ "user:admin:reset-password",
+ "policy:manage",
+ "policy:view",
+ "role:manage",
+ "role:view",
+ "configuration:view",
+ "configuration:modify",
+ "device:android:operation:reboot",
+ "device:android:operation:camera",
+ "device:android:operation:vpn",
+ "device:android:operation:lock",
+ "device:android:operation:ring",
+ "device:android:operation:update-app",
+ "device:android:operation:wipe",
+ "device:android:operation:encrypt",
+ "device:android:operation:blacklist-app",
+ "device:android:operation:applications",
+ "device:android:operation:enterprise-wipe",
+ "device:android:operation:info",
+ "device:android:operation:wifi",
+ "device:android:operation:uninstall-app",
+ "device:android:operation:change-lock",
+ "device:android:operation:notification",
+ "device:android:operation:upgrade",
+ "device:android:operation:unlock",
+ "device:android:operation:mute",
+ "device:android:operation:location",
+ "device:android:operation:webclip",
+ "device:android:operation:clear-password",
+ "device:android:operation:password-policy",
+ "device:android:operation:install-app",
+ "device:android:event:write",
+ "device:android:event:read",
+ "device:android:enroll",
+ "configuration:manage",
+ "configuration:view",
+ "device:android:enroll",
+ "certificate:view",
+ "certificate:manage"
+ ],
+ "isOAuthEnabled" : true,
+ "backendRestEndpoints" : {
+ "deviceMgt" : "/api/device-mgt/v1.0"
+ }
+}
\ No newline at end of file
diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/operation-bar.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/operation-bar.js
new file mode 100644
index 000000000..f777ea9af
--- /dev/null
+++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/operation-bar.js
@@ -0,0 +1,106 @@
+/*
+ * 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.
+ */
+
+function onRequest(context) {
+ var log = new Log("mdm.unit.device.operation-bar");
+ var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
+ var viewModel = {};
+ var permissions = {};
+
+ // adding android operations related permission checks
+ permissions["android"] = [];
+ if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/ring")) {
+ permissions["android"].push("DEVICE_RING");
+ }
+ if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/lock")) {
+ permissions["android"].push("DEVICE_LOCK");
+ }
+ if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/unlock")) {
+ permissions["android"].push("DEVICE_UNLOCK");
+ }
+ if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/location")) {
+ permissions["android"].push("DEVICE_LOCATION");
+ }
+ if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/clear-password")) {
+ permissions["android"].push("CLEAR_PASSWORD");
+ }
+ if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/reboot")) {
+ permissions["android"].push("DEVICE_REBOOT");
+ }
+ if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/upgrade-firmware")) {
+ permissions["android"].push("UPGRADE_FIRMWARE");
+ }
+ if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/mute")) {
+ permissions["android"].push("DEVICE_MUTE");
+ }
+ if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/send-notification")) {
+ permissions["android"].push("NOTIFICATION");
+ }
+ if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/change-lock-code")) {
+ permissions["android"].push("CHANGE_LOCK_CODE");
+ }
+ if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/enterprise-wipe")) {
+ permissions["android"].push("ENTERPRISE_WIPE");
+ }
+ if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/wipe")) {
+ permissions["android"].push("WIPE_DATA");
+ }
+
+ // adding ios operations related permission checks
+ permissions["ios"] = [];
+ if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/ios/lock")) {
+ permissions["ios"].push("DEVICE_LOCK");
+ }
+ if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/ios/location")) {
+ permissions["ios"].push("LOCATION");
+ }
+ if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/ios/enterprise-wipe")) {
+ permissions["ios"].push("ENTERPRISE_WIPE");
+ }
+ if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/ios/notification")) {
+ permissions["ios"].push("NOTIFICATION");
+ }
+ if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/ios/ring")) {
+ permissions["ios"].push("RING");
+ }
+
+ // adding windows operations related permission checks
+ permissions["windows"] = [];
+ if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/windows/lock")) {
+ permissions["windows"].push("DEVICE_LOCK");
+ }
+ if (userModule.isAuthorized("/permission/admin/device-mgt/devices/disenroll/windows")) {
+ permissions["windows"].push("DISENROLL");
+ }
+ if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/windows/wipe")) {
+ permissions["windows"].push("WIPE_DATA");
+ }
+ if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/windows/ring")) {
+ permissions["windows"].push("DEVICE_RING");
+ }
+ if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/windows/lock-reset")) {
+ permissions["windows"].push("LOCK_RESET");
+ }
+
+ viewModel["permissions"] = stringify(permissions);
+
+ viewModel["deviceType"] = context.unit.params.deviceType;
+ viewModel["ownership"] = context.unit.params.ownership;
+
+ return viewModel;
+}
\ No newline at end of file
diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.hbs
new file mode 100644
index 000000000..1965d4dce
--- /dev/null
+++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.hbs
@@ -0,0 +1,119 @@
+{{!
+ 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.
+}}
+{{#zone "navMenu-icon"}}
+
+
+
+{{/zone}}
+
+{{#zone "navMenu-items"}}
+ {{#if permissions.LIST_DEVICES}}
+
+
+
+
+ Device Management
+
+
+ {{/if}}
+ {{#if permissions.VIEW_DASHBOARD}}
+
+
+ Device Statistics
+
+
+ {{/if}}
+ {{#if permissions.LIST_POLICIES}}
+
+ Policy Management
+ {{/if}}
+ {{#if permissions.USER_MGT_PERMITTED}}
+ User Management
+
+ {{#if permissions.LIST_USERS}}
+ -
+ Users
+ {{/if}}
+ {{#if permissions.LIST_ROLES}}
+ -
+ Roles
+ {{/if}}
+
+
+ {{/if}}
+ {{#if permissions.CONFIG_MGT_PERMITTED}}
+ Configuration Management
+
+
+ {{/if}}
+{{/zone}}
+
+{{#zone "navbarCollapsableRightItems"}}
+
+{{/zone}}
+{{#zone "sidePanes"}}
+
+
+{{/zone}}
+{{#zone "bottomJs"}}
+
+
+ {{js "js/nav-menu.js"}}
+{{/zone}}
diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.js b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.js
new file mode 100644
index 000000000..f5f450c35
--- /dev/null
+++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.ui.navbar.nav-menu/nav-menu.js
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+function onRequest(context) {
+ var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
+ var mdmProps = require("/app/modules/conf-reader/main.js")["conf"];
+ var constants = require("/app/modules/constants.js");
+
+ context.handlebars.registerHelper('equal', function (lvalue, rvalue, options) {
+ if (arguments.length < 3) {
+ throw new Error("Handlebars Helper equal needs 2 parameters");
+ }
+ if (lvalue != rvalue) {
+ return options.inverse(this);
+ } else {
+ return options.fn(this);
+ }
+ });
+
+ var links = {
+ "user-mgt": [],
+ "role-mgt": [],
+ "policy-mgt": [],
+ "device-mgt": []
+ };
+ var viewModel = {};
+
+ // following viewModel.link value comes here based on the value passed at the point
+ // where units are attached to a page zone.
+ // eg: {{unit "app-bar" pageLink="users" title="User Management"}}
+ viewModel["currentActions"] = links[viewModel["pageLink"]];
+ viewModel["enrollmentURL"] = mdmProps["generalConfig"]["host"] + mdmProps["enrollmentDir"];
+ viewModel["currentUser"] = session.get(constants["USER_SESSION_KEY"]);
+
+ var permissions = {};
+ permissions["LIST_DEVICES"] = userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/view");
+ permissions["LIST_POLICIES"] = userModule.isAuthorized("/permission/admin/device-mgt/policies/view");
+ permissions["LIST_USERS"] = userModule.isAuthorized("/permission/admin/device-mgt/users/view");
+ permissions["LIST_ROLES"] = userModule.isAuthorized("/permission/admin/device-mgt/roles/view");
+ permissions["USER_MGT_PERMITTED"] = (permissions["LIST_USERS"] || permissions["LIST_ROLES"]);
+ permissions["LIST_PLATFORM_CONFIGURATIONS"] = userModule.isAuthorized("/permission/admin/device-mgt/platform-configurations/view");
+ permissions["LIST_CERTIFICATES"] = userModule.isAuthorized("/permission/admin/device-mgt/certificates/view");
+ permissions["CONFIG_MGT_PERMITTED"] = (permissions["LIST_PLATFORM_CONFIGURATIONS"] || permissions["LIST_CERTIFICATES"]);
+ permissions["LIST_NOTIFICATIONS"] = userModule.isAuthorized("/permission/admin/device-mgt/notifications/view");
+ permissions["VIEW_DASHBOARD"] = userModule.isAuthorized("/permission/admin/device-mgt/dashboard/view");
+
+ viewModel["permissions"] = permissions;
+ viewModel["appContext"] = mdmProps["appContext"];
+ viewModel["serverURL"] = mdmProps["httpsWebURL"];
+
+ return viewModel;
+}
\ No newline at end of file
diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/emm-web-agent/app/pages/mdm.page.enrollments.android.download-agent/public/asset/android-agent.apk b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/emm-web-agent/app/pages/mdm.page.enrollments.android.download-agent/public/asset/android-agent.apk
new file mode 100644
index 000000000..b5a58494c
Binary files /dev/null and b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/emm-web-agent/app/pages/mdm.page.enrollments.android.download-agent/public/asset/android-agent.apk differ
diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/emm-web-agent/jaggery.conf b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/emm-web-agent/jaggery.conf
new file mode 100644
index 000000000..0c0285ee2
--- /dev/null
+++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/emm-web-agent/jaggery.conf
@@ -0,0 +1,148 @@
+{
+ "displayName": "EMM Web Agent",
+ "logLevel": "error",
+ "initScripts": ["/app/modules/init.js"],
+ "urlMappings": [
+ {
+ "url": "/enrollment",
+ "path": "/lib/pages.jag"
+ },
+ {
+ "url": "/enrollment/windows/login",
+ "path": "/app/modules/enrollments/windows/agent-controller.jag"
+ },
+ {
+ "url": "/enrollment/windows/enroll",
+ "path": "/app/modules/enrollments/windows/agent-enroll.jag"
+ },
+ {
+ "url": "/enrollment/ios/download-certificate",
+ "path": "/app/modules/enrollments/ios/certificate.jag"
+ },
+ {
+ "url": "/enrollment/ios/download-agent",
+ "path": "/app/modules/enrollments/ios/agent.jag"
+ },
+ {
+ "url": "/enrollment/ios/login",
+ "path": "/app/modules/enrollments/ios/agent-controller.jag"
+ },
+ {
+ "url": "/enrollment/ios/enroll",
+ "path": "/app/modules/enrollments/ios/agent-enroll.jag"
+ },
+ {
+ "url": "/enrollment/ios/check",
+ "path": "/app/modules/enrollments/ios/agent-check.jag"
+ },
+ {
+ "url": "/api/invoker/*",
+ "path": "/api/invoker-api.jag"
+ },
+ {
+ "url": "/uuf/login",
+ "path": "/lib/modules/auth/login.jag"
+ },
+ {
+ "url": "/uuf/logout",
+ "path": "/lib/modules/auth/logout.jag"
+ },
+ {
+ "url": "/uuf/sso/acs",
+ "path": "/lib/modules/auth/acs.jag"
+ },
+ {
+ "url": "/public/*",
+ "path": "/lib/static-files.jag"
+ },
+ {
+ "url": "/unit/*",
+ "path": "/lib/units.jag"
+ },
+ {
+ "url": "/*",
+ "path": "/lib/pages.jag"
+ }
+ ],
+ "securityConstraints": [
+ {
+ "securityConstraint": {
+ "webResourceCollection": {
+ "name": "EMM-WEB-AGENT",
+ "urlPatterns": [
+ "/*"
+ ]
+ },
+ "userDataConstraint": {
+ "transportGuarantee": "CONFIDENTIAL"
+ }
+ }
+ },
+ {
+ "securityConstraint": {
+ "webResourceCollection": {
+ "name": "EMM-WEB-AGENT-http",
+ "urlPatterns": [
+ "/public/*",
+ "/enrollments/windows/*",
+ "/enrollment/windows/*"
+ ]
+ },
+ "userDataConstraint": {
+ "transportGuarantee": "NONE"
+ }
+ }
+ }
+ ],
+ "filters": [
+ {
+ "name": "URLBasedCachePreventionFilter",
+ "class": "org.wso2.carbon.ui.filters.cache.URLBasedCachePreventionFilter"
+ },
+ {
+ "name":"HttpHeaderSecurityFilter",
+ "class":"org.apache.catalina.filters.HttpHeaderSecurityFilter",
+ "params" : [{"name" : "hstsEnabled", "value" : "false"}]
+ }
+ ],
+ "filterMappings": [
+ {
+ "name": "URLBasedCachePreventionFilter",
+ "url": "/api/*"
+ },
+ {
+ "name": "URLBasedCachePreventionFilter",
+ "url": "/enrollment/*"
+ },
+ {
+ "name":"HttpHeaderSecurityFilter",
+ "url":"*"
+ }
+ ],
+ "listeners" : [
+ {
+ "class" : "org.owasp.csrfguard.CsrfGuardServletContextListener"
+ },
+ {
+ "class" : "org.owasp.csrfguard.CsrfGuardHttpSessionListener"
+ }
+ ],
+ "servlets" : [
+ {
+ "name" : "JavaScriptServlet",
+ "class" : "org.owasp.csrfguard.servlet.JavaScriptServlet"
+ }
+ ],
+ "servletMappings" : [
+ {
+ "name" : "JavaScriptServlet",
+ "url" : "/csrf.js"
+ }
+ ],
+ "contextParams" : [
+ {
+ "name" : "Owasp.CsrfGuard.Config",
+ "value" : "/repository/conf/security/Owasp.CsrfGuard.dashboard.properties"
+ }
+ ]
+}
diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.url.printer/pom.xml b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.url.printer/pom.xml
new file mode 100644
index 000000000..00126db35
--- /dev/null
+++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.url.printer/pom.xml
@@ -0,0 +1,81 @@
+
+
+
+
+ mobile-base-plugin
+ org.wso2.carbon.devicemgt-plugins
+ 2.2.8-SNAPSHOT
+ ../pom.xml
+
+
+ 4.0.0
+ org.wso2.carbon.device.mgt.mobile.url.printer
+ bundle
+ WSO2 Carbon - Startup Handler That Prints MDM End-User Web-App URL
+ WSO2 Carbon - Startup Handler That Prints MDM End-User Web-App URL
+ http://wso2.org
+
+
+
+
+ org.apache.felix
+ maven-scr-plugin
+
+
+ org.apache.felix
+ maven-bundle-plugin
+ 1.4.0
+ true
+
+
+ ${project.artifactId}
+ ${project.artifactId}
+ ${carbon.devicemgt.plugins.version}
+ Bundle Containing The Startup Handler That Prints MDM End-User Web-App URL
+ org.wso2.carbon.device.mgt.mobile.url.printer.internal
+
+ org.osgi.framework,
+ org.osgi.service.component,
+ org.apache.commons.logging,
+ org.apache.axis2.*;version="${axis2.osgi.version.range}",
+ org.wso2.carbon.core,
+ org.wso2.carbon.utils.*,
+
+
+ !org.wso2.carbon.device.mgt.mobile.url.printer.internal,
+ org.wso2.carbon.device.mgt.mobile.url.printer,
+
+
+
+
+
+
+
+
+
+ org.eclipse.osgi
+ org.eclipse.osgi
+
+
+ org.eclipse.osgi
+ org.eclipse.osgi.services
+
+
+ org.wso2.carbon
+ org.wso2.carbon.core
+
+
+ org.wso2.carbon
+ org.wso2.carbon.logging
+
+
+ org.wso2.carbon
+ org.wso2.carbon.utils
+
+
+ org.apache.axis2.wso2
+ axis2
+
+
+
+
\ No newline at end of file
diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/pom.xml b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/pom.xml
new file mode 100644
index 000000000..19ee23a96
--- /dev/null
+++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/pom.xml
@@ -0,0 +1,171 @@
+
+
+
+
+
+
+ mobile-base-plugin
+ org.wso2.carbon.devicemgt-plugins
+ 2.2.8-SNAPSHOT
+ ../pom.xml
+
+
+ 4.0.0
+ org.wso2.carbon.device.mgt.mobile
+ bundle
+ WSO2 Carbon - Mobile Device Management Impl
+ WSO2 Carbon - Mobile Device Management Implementation
+ http://wso2.org
+
+
+
+
+ org.apache.felix
+ maven-scr-plugin
+
+
+ org.apache.felix
+ maven-bundle-plugin
+ 1.4.0
+ true
+
+
+ ${project.artifactId}
+ ${project.artifactId}
+ ${carbon.devicemgt.plugins.version}
+ Device Management Mobile Impl Bundle
+ org.wso2.carbon.device.mgt.mobile.internal
+
+ org.osgi.framework,
+ org.osgi.service.component,
+ org.apache.commons.logging,
+ javax.xml.*; !javax.xml.parsers,
+ javax.xml.parsers; version="${javax.xml.parsers.import.pkg.version}",
+ javax.naming,
+ javax.sql,
+ org.w3c.dom,
+ org.wso2.carbon.context,
+ org.wso2.carbon.utils.*,
+ org.wso2.carbon.device.mgt.common.*,
+ org.wso2.carbon.ndatasource.core,
+ org.wso2.carbon.policy.mgt.common.*,
+ org.wso2.carbon.registry.core,
+ org.wso2.carbon.registry.core.service,
+ org.wso2.carbon.registry.core.session,
+ org.wso2.carbon.registry.api,
+ org.wso2.carbon.device.mgt.extensions.license.mgt.registry,
+ com.google.gson.*
+
+
+ !org.wso2.carbon.device.mgt.mobile.internal,
+ !org.wso2.carbon.device.mgt.mobile.impl,
+ org.wso2.carbon.device.mgt.mobile.*,
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.18
+
+
+ file:src/test/resources/log4j.properties
+
+
+
+ src/test/resources/testng.xml
+
+
+
+
+
+
+
+
+ org.eclipse.osgi
+ org.eclipse.osgi
+
+
+ org.eclipse.osgi
+ org.eclipse.osgi.services
+
+
+ org.wso2.carbon
+ org.wso2.carbon.core
+
+
+ org.wso2.carbon
+ org.wso2.carbon.logging
+
+
+ org.wso2.carbon
+ org.wso2.carbon.utils
+
+
+ org.wso2.carbon.devicemgt
+ org.wso2.carbon.device.mgt.common
+
+
+ org.wso2.carbon.devicemgt
+ org.wso2.carbon.device.mgt.extensions
+
+
+ org.wso2.carbon
+ org.wso2.carbon.ndatasource.core
+
+
+ org.wso2.carbon.devicemgt
+ org.wso2.carbon.policy.mgt.common
+
+
+ org.wso2.carbon.devicemgt
+ org.wso2.carbon.policy.mgt.core
+
+
+ org.wso2.carbon
+ org.wso2.carbon.registry.api
+
+
+ org.wso2.carbon
+ org.wso2.carbon.registry.core
+
+
+ org.testng
+ testng
+
+
+ org.apache.tomcat.wso2
+ jdbc-pool
+
+
+ com.h2database.wso2
+ h2-database-engine
+ test
+
+
+ com.google.code.gson
+ gson
+
+
+ com.google.android.gcm
+ gcm-server
+
+
+
diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/util/MobileDeviceManagementUtil.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/util/MobileDeviceManagementUtil.java
new file mode 100644
index 000000000..e9fb47ccd
--- /dev/null
+++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/util/MobileDeviceManagementUtil.java
@@ -0,0 +1,332 @@
+/*
+ * 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.
+ */
+
+package org.wso2.carbon.device.mgt.mobile.util;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.w3c.dom.Document;
+import org.wso2.carbon.context.PrivilegedCarbonContext;
+import org.wso2.carbon.device.mgt.common.Device;
+import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
+import org.wso2.carbon.device.mgt.common.DeviceManagementException;
+import org.wso2.carbon.device.mgt.common.Feature;
+import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
+import org.wso2.carbon.device.mgt.mobile.common.MobileDeviceMgtPluginException;
+import org.wso2.carbon.device.mgt.mobile.common.MobilePluginConstants;
+import org.wso2.carbon.device.mgt.mobile.dto.*;
+import org.wso2.carbon.device.mgt.mobile.internal.MobileDeviceManagementDataHolder;
+import org.wso2.carbon.registry.api.RegistryException;
+import org.wso2.carbon.registry.api.Resource;
+import org.wso2.carbon.registry.core.Registry;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import java.io.File;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+/**
+ * Provides utility methods required by the mobile device management bundle.
+ */
+public class MobileDeviceManagementUtil {
+
+ private static final Log log = LogFactory.getLog(MobileDeviceManagementUtil.class);
+ private static final String MOBILE_DEVICE_IMEI = "IMEI";
+ private static final String MOBILE_DEVICE_IMSI = "IMSI";
+ private static final String MOBILE_DEVICE_VENDOR = "VENDOR";
+ private static final String MOBILE_DEVICE_OS_VERSION = "OS_VERSION";
+ private static final String MOBILE_DEVICE_MODEL = "DEVICE_MODEL";
+ private static final String MOBILE_DEVICE_LATITUDE = "LATITUDE";
+ private static final String MOBILE_DEVICE_LONGITUDE = "LONGITUDE";
+ private static final String MOBILE_DEVICE_SERIAL = "SERIAL";
+ private static final String MOBILE_DEVICE_OS_BUILD_DATE = "OS_BUILD_DATE";
+
+ public static Document convertToDocument(File file) throws DeviceManagementException {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+ return docBuilder.parse(file);
+ } catch (Exception e) {
+ throw new DeviceManagementException(
+ "Error occurred while parsing file, while converting " +
+ "to a org.w3c.dom.Document : " + e.getMessage(), e);
+ }
+ }
+
+ private static String getPropertyValue(Device device, String property) {
+ if (device != null && device.getProperties() != null) {
+ for (Device.Property prop : device.getProperties()) {
+ if (property.equals(prop.getName())) {
+ return prop.getValue();
+ }
+ }
+ }
+ return null;
+ }
+
+ private static Device.Property getProperty(String property, String value) {
+ if (property != null) {
+ Device.Property prop = new Device.Property();
+ prop.setName(property);
+ prop.setValue(value);
+ return prop;
+ }
+ return null;
+ }
+
+ public static MobileDevice convertToMobileDevice(Device device) {
+ MobileDevice mobileDevice = null;
+ if (device != null) {
+ mobileDevice = new MobileDevice();
+ mobileDevice.setMobileDeviceId(device.getDeviceIdentifier());
+ mobileDevice.setImei(getPropertyValue(device, MOBILE_DEVICE_IMEI));
+ mobileDevice.setImsi(getPropertyValue(device, MOBILE_DEVICE_IMSI));
+ mobileDevice.setModel(getPropertyValue(device, MOBILE_DEVICE_MODEL));
+ mobileDevice.setOsVersion(getPropertyValue(device, MOBILE_DEVICE_OS_VERSION));
+ mobileDevice.setVendor(getPropertyValue(device, MOBILE_DEVICE_VENDOR));
+ mobileDevice.setLatitude(getPropertyValue(device, MOBILE_DEVICE_LATITUDE));
+ mobileDevice.setLongitude(getPropertyValue(device, MOBILE_DEVICE_LONGITUDE));
+ mobileDevice.setSerial(getPropertyValue(device, MOBILE_DEVICE_SERIAL));
+ mobileDevice.setOsBuildDate(getPropertyValue(device, MOBILE_DEVICE_OS_BUILD_DATE));
+
+ if (device.getProperties() != null) {
+ Map deviceProperties = new HashMap();
+ for (Device.Property deviceProperty : device.getProperties()) {
+ deviceProperties.put(deviceProperty.getName(), deviceProperty.getValue());
+ }
+
+ mobileDevice.setDeviceProperties(deviceProperties);
+ } else {
+ mobileDevice.setDeviceProperties(new HashMap());
+ }
+ }
+ return mobileDevice;
+ }
+
+ public static Device convertToDevice(MobileDevice mobileDevice) {
+ Device device = null;
+ if (mobileDevice != null) {
+ device = new Device();
+ List propertyList = new ArrayList();
+ propertyList.add(getProperty(MOBILE_DEVICE_IMEI, mobileDevice.getImei()));
+ propertyList.add(getProperty(MOBILE_DEVICE_IMSI, mobileDevice.getImsi()));
+ propertyList.add(getProperty(MOBILE_DEVICE_MODEL, mobileDevice.getModel()));
+ propertyList.add(getProperty(MOBILE_DEVICE_OS_VERSION, mobileDevice.getOsVersion()));
+ propertyList.add(getProperty(MOBILE_DEVICE_OS_BUILD_DATE, mobileDevice.getOsBuildDate()));
+ propertyList.add(getProperty(MOBILE_DEVICE_VENDOR, mobileDevice.getVendor()));
+ if(mobileDevice.getLatitude() != null) {
+ propertyList.add(getProperty(MOBILE_DEVICE_LATITUDE, mobileDevice.getLatitude()));
+ }
+ if(mobileDevice.getLongitude() != null) {
+ propertyList.add(getProperty(MOBILE_DEVICE_LONGITUDE, mobileDevice.getLongitude()));
+ }
+ propertyList.add(getProperty(MOBILE_DEVICE_SERIAL, mobileDevice.getSerial()));
+
+ if (mobileDevice.getDeviceProperties() != null) {
+ for (Map.Entry deviceProperty : mobileDevice.getDeviceProperties()
+ .entrySet()) {
+ propertyList
+ .add(getProperty(deviceProperty.getKey(), deviceProperty.getValue()));
+ }
+ }
+
+ device.setProperties(propertyList);
+ device.setDeviceIdentifier(mobileDevice.getMobileDeviceId());
+ }
+ return device;
+ }
+
+ public static MobileOperation convertToMobileOperation(Operation operation) {
+ MobileOperation mobileOperation = new MobileOperation();
+ MobileOperationProperty operationProperty;
+ List properties = new LinkedList();
+ mobileOperation.setFeatureCode(operation.getCode());
+ mobileOperation.setCreatedDate(new Date().getTime());
+ Properties operationProperties = operation.getProperties();
+ for (String key : operationProperties.stringPropertyNames()) {
+ operationProperty = new MobileOperationProperty();
+ operationProperty.setProperty(key);
+ operationProperty.setValue(operationProperties.getProperty(key));
+ properties.add(operationProperty);
+ }
+ mobileOperation.setProperties(properties);
+ return mobileOperation;
+ }
+
+ public static List getMobileOperationIdsFromMobileDeviceOperations(
+ List mobileDeviceOperationMappings) {
+ List mobileOperationIds = new ArrayList(mobileDeviceOperationMappings.size());
+ for (MobileDeviceOperationMapping mobileDeviceOperationMapping : mobileDeviceOperationMappings) {
+ mobileOperationIds.add(mobileDeviceOperationMapping.getOperationId());
+ }
+ return mobileOperationIds;
+ }
+
+ public static Operation convertMobileOperationToOperation(MobileOperation mobileOperation) {
+ Operation operation = new Operation();
+ Properties properties = new Properties();
+ operation.setCode(mobileOperation.getFeatureCode());
+ for (MobileOperationProperty mobileOperationProperty : mobileOperation.getProperties()) {
+ properties
+ .put(mobileOperationProperty.getProperty(), mobileOperationProperty.getValue());
+ }
+ operation.setProperties(properties);
+ return operation;
+ }
+
+ public static MobileFeature convertToMobileFeature(Feature feature) {
+ MobileFeature mobileFeature = new MobileFeature();
+ mobileFeature.setName(feature.getName());
+ mobileFeature.setCode(feature.getCode());
+ mobileFeature.setDescription(feature.getDescription());
+ mobileFeature.setDeviceType(feature.getDeviceType());
+ return mobileFeature;
+ }
+
+ public static Feature convertToFeature(MobileFeature mobileFeature) {
+ Feature feature = new Feature();
+ feature.setDescription(mobileFeature.getDescription());
+ feature.setDeviceType(mobileFeature.getDeviceType());
+ feature.setCode(mobileFeature.getCode());
+ feature.setName(mobileFeature.getName());
+ return feature;
+ }
+
+ public static Registry getConfigurationRegistry() throws MobileDeviceMgtPluginException {
+ try {
+ int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
+ return MobileDeviceManagementDataHolder.getInstance().getRegistryService()
+ .getConfigSystemRegistry(
+ tenantId);
+ } catch (RegistryException e) {
+ throw new MobileDeviceMgtPluginException(
+ "Error in retrieving conf registry instance: " +
+ e.getMessage(), e);
+ }
+ }
+
+ public static Resource getRegistryResource(String path) throws MobileDeviceMgtPluginException {
+ try {
+ if(MobileDeviceManagementUtil.getConfigurationRegistry().resourceExists(path)){
+ return MobileDeviceManagementUtil.getConfigurationRegistry().get(path);
+ }
+ return null;
+ } catch (RegistryException e) {
+ throw new MobileDeviceMgtPluginException("Error in retrieving registry resource : " +
+ e.getMessage(), e);
+ }
+ }
+
+ public static boolean putRegistryResource(String path,
+ Resource resource)
+ throws MobileDeviceMgtPluginException {
+ boolean status;
+ try {
+ MobileDeviceManagementUtil.getConfigurationRegistry().beginTransaction();
+ MobileDeviceManagementUtil.getConfigurationRegistry().put(path, resource);
+ MobileDeviceManagementUtil.getConfigurationRegistry().commitTransaction();
+ status = true;
+ } catch (RegistryException e) {
+ throw new MobileDeviceMgtPluginException(
+ "Error occurred while persisting registry resource : " +
+ e.getMessage(), e);
+ }
+ return status;
+ }
+
+ public static String getResourcePath(String resourceName, String platform) {
+ String regPath = "";
+ switch (platform) {
+ case DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID:
+ regPath = MobilePluginConstants.MOBILE_CONFIG_REGISTRY_ROOT + "/" +
+ DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID +
+ "/" + resourceName;
+ break;
+ case DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS:
+ regPath = MobilePluginConstants.MOBILE_CONFIG_REGISTRY_ROOT + "/" +
+ DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS +
+ "/" + resourceName;
+ break;
+ case DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS:
+ regPath = MobilePluginConstants.MOBILE_CONFIG_REGISTRY_ROOT + "/" +
+ DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS +
+ "/" + resourceName;
+ break;
+ }
+ return regPath;
+ }
+
+ public static String getPlatformConfigPath(String platform) {
+ String regPath = "";
+ switch (platform) {
+ case DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID:
+ regPath = DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID;
+ break;
+ case DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS:
+ regPath = DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS;
+ break;
+ case DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS:
+ regPath = DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS;
+ break;
+ }
+ return regPath;
+ }
+
+ public static boolean createRegistryCollection(String path)
+ throws MobileDeviceMgtPluginException {
+ try {
+ if (! MobileDeviceManagementUtil.getConfigurationRegistry().resourceExists(path)) {
+ Resource resource = MobileDeviceManagementUtil.getConfigurationRegistry().newCollection();
+ MobileDeviceManagementUtil.getConfigurationRegistry().beginTransaction();
+ MobileDeviceManagementUtil.getConfigurationRegistry().put(path, resource);
+ MobileDeviceManagementUtil.getConfigurationRegistry().commitTransaction();
+ }
+ return true;
+ } catch (MobileDeviceMgtPluginException e) {
+ throw new MobileDeviceMgtPluginException(
+ "Error occurred while creating a registry collection : " +
+ e.getMessage(), e);
+ } catch (RegistryException e) {
+ throw new MobileDeviceMgtPluginException(
+ "Error occurred while creating a registry collection : " +
+ e.getMessage(), e);
+ }
+ }
+
+ public static List getMissingFeatures(List supportedFeatures, List existingFeatures) {
+ HashMap featureHashMap = new HashMap();
+ for (Feature feature: existingFeatures) {
+ featureHashMap.put(feature.getCode(),feature);
+ }
+ List missingFeatures = new ArrayList();
+ for (Feature supportedFeature : supportedFeatures) {
+ if (featureHashMap.get(supportedFeature.getCode()) != null) {
+ continue;
+ }
+ missingFeatures.add(supportedFeature);
+ }
+ return missingFeatures;
+ }
+}
diff --git a/components/mobile-plugins/mobile-base-plugin/pom.xml b/components/mobile-plugins/mobile-base-plugin/pom.xml
new file mode 100644
index 000000000..16cb41331
--- /dev/null
+++ b/components/mobile-plugins/mobile-base-plugin/pom.xml
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+ org.wso2.carbon.devicemgt-plugins
+ mobile-plugins
+ 2.2.8-SNAPSHOT
+ ../pom.xml
+
+
+ 4.0.0
+ mobile-base-plugin
+ pom
+ WSO2 Carbon - Mobile Plugins
+ http://wso2.org
+
+
+ org.wso2.carbon.device.mgt.mobile
+ org.wso2.carbon.device.mgt.mobile.ui
+ org.wso2.carbon.device.mgt.mobile.url.printer
+
+
+
+
+
+
+ org.apache.felix
+ maven-scr-plugin
+ 1.7.2
+
+
+ generate-scr-scrdescriptor
+
+ scr
+
+
+
+
+
+
+
+
+
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 000000000..5c572f2c2
--- /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 b6afa7982..3df828060 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 5b79edefd..97b167450 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 2b8eaf5dd..3ef182348 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 7d938215f..877d85a10 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