diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot/pom.xml b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot/pom.xml index 27ad2fed1..fcfda42f8 100644 --- a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot/pom.xml +++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot/pom.xml @@ -1,7 +1,7 @@ + @@ -78,8 +79,6 @@ javax.xml.bind.annotation.*;resolution:=optional, javax.xml.parsers.*;resolution:=optional, javax.crypto, - javax.ws.rs.core, - javax.xml, org.apache.tomcat.util.codec.binary, org.w3c.dom;resolution:=optional, org.wso2.carbon.core;version="${carbon.kernel.version.range}", diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.agent/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml similarity index 97% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.agent/pom.xml rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml index 0da2c6395..867cac00e 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.agent/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml @@ -1,5 +1,5 @@ diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.agent/src/main/webapp/META-INF/webapp-classloading.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/META-INF/webapp-classloading.xml similarity index 91% rename from components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.agent/src/main/webapp/META-INF/webapp-classloading.xml rename to components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/META-INF/webapp-classloading.xml index 46c211bb2..185de22d4 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.agent/src/main/webapp/META-INF/webapp-classloading.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/META-INF/webapp-classloading.xml @@ -1,7 +1,7 @@ + --> + --> + + + + + android-plugin + org.wso2.carbon.devicemgt-plugins + 2.1.0-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon.device.mgt.mobile.android.ui + 2.1.0-SNAPSHOT + WSO2 Carbon - Mobile Android UI + pom + + + + + maven-assembly-plugin + 2.5.5 + + ${project.artifactId}-${carbon.device.mgt.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.ui/src/assembly/src.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/assembly/src.xml new file mode 100644 index 000000000..2797034e0 --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/assembly/src.xml @@ -0,0 +1,36 @@ + + + + src + + zip + + false + ${basedir}/src + + + ${basedir}/src/main/resources/jaggeryapps/devicemgt + / + true + + + \ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs new file mode 100644 index 000000000..bba71218c --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs @@ -0,0 +1,174 @@ +{{#zone "device-opetations"}} +
+ Operations +
+
+ {{unit "mdm.unit.device.operation-bar"}} +
+{{/zone}} + +{{#zone "device-detail-properties"}} +
+ +
+
+ +
+ {{unit "cdmf.unit.device.details" device=device}} +
+
+
Policies
+
+ +
+
+ No policies found +
+
+
+
+ + + + + Add device specific policy +
+
+
Policy Compliance
+
+ +
+
+ Not available yet +
+
+
+
+
+
+
Device Location
+
+
+
+
+ Not available yet +
+
+
+
+
+
Installed Applications
+
+ +
+
+ Not available yet +
+
+
+
+
+
+
Operations Log
+
+ +
+
+ Not available yet +
+
+
+
+
+
+
+
+{{/zone}} + +{{#zone "bottomJs"}} + {{js "js/device-detail.js"}} + + {{js "js/load-map.js"}} +{{/zone}} \ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.js new file mode 100644 index 000000000..da9c9809f --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.js @@ -0,0 +1,66 @@ +/* + * 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("detail.js"); + var deviceType = context.uriParams.deviceType; + var deviceId = request.getParameter("id"); + + if (deviceType != null && deviceType != undefined && deviceId != null && deviceId != undefined) { + var deviceModule = require("/app/modules/device.js").deviceModule; + var device = deviceModule.viewDevice(deviceType, deviceId); + + if (device) { + var viewModel = {}; + var deviceInfo = device.properties.DEVICE_INFO; + if (deviceInfo != undefined && String(deviceInfo.toString()).length > 0) { + deviceInfo = parse(stringify(deviceInfo)); + viewModel.imei = device.properties.IMEI; + viewModel.model = device.properties.DEVICE_MODEL; + viewModel.vendor = device.properties.VENDOR; + viewModel.internal_memory = {}; + viewModel.external_memory = {}; + viewModel.location = { + latitude: device.properties.LATITUDE, + longitude: device.properties.LONGITUDE + }; + var info = {}; + var infoList = parse(deviceInfo); + if (infoList != null && infoList != undefined) { + for (var j = 0; j < infoList.length; j++) { + info[infoList[j].name] = infoList[j].value; + } + } + deviceInfo = info; + viewModel.BatteryLevel = deviceInfo.BATTERY_LEVEL; + viewModel.internal_memory.FreeCapacity = Math.round(deviceInfo.INTERNAL_AVAILABLE_MEMORY * 100) / 100; + viewModel.internal_memory.DeviceCapacityPercentage = Math.round(deviceInfo.INTERNAL_AVAILABLE_MEMORY + / deviceInfo.INTERNAL_TOTAL_MEMORY * 10000) / 100; + viewModel.external_memory.FreeCapacity = Math.round(deviceInfo.EXTERNAL_AVAILABLE_MEMORY * 100) / 100; + viewModel.external_memory.DeviceCapacityPercentage = Math.round(deviceInfo.EXTERNAL_AVAILABLE_MEMORY + / deviceInfo.EXTERNAL_TOTAL_MEMORY * 10000) / 100; + device.viewModel = viewModel; + } + } + + log.info(device); + var utility = require("/app/modules/utility.js").utility; + var configs = utility.getDeviceTypeConfig(deviceType); + return {"device": device, "label": configs["deviceType"]["label"]}; + } +} \ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.json b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.json new file mode 100644 index 000000000..9eecd8f5b --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.json @@ -0,0 +1,3 @@ +{ + "version": "1.0.0" +} \ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/device-detail.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/device-detail.js new file mode 100644 index 000000000..49c3512b9 --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/device-detail.js @@ -0,0 +1,77 @@ +/* + * 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 () { + var deviceId = $(".device-id"); + var deviceIdentifier = deviceId.data("deviceid"); + var deviceType = deviceId.data("type"); + var payload = [deviceIdentifier]; + var serviceUrl = "/mdm-android-agent/operation/device-info"; + invokerUtil.post(serviceUrl, payload, + function (message) { + console.log(message); + }, function (message) { + console.log(message); + }); + $(document).ready(function () { + $(".panel-body").removeClass("hidden"); + $("#loading-content").remove(); + loadApplicationsList(); + + $("#refresh-apps").click(function () { + $('#apps-spinner').removeClass('hidden'); + loadApplicationsList(); + }); + loadOperationBar(deviceType); + }); + + function loadApplicationsList() { + var applicationsList = $("#applications-list"); + var deviceListingSrc = applicationsList.attr("src"); + var deviceId = applicationsList.data("device-id"); + var deviceType = applicationsList.data("device-type"); + + $.template("application-list", deviceListingSrc, function (template) { + var serviceURL = "/devicemgt_admin/operations/" + deviceType + "/" + deviceId + "/apps"; + + var successCallback = function (data) { + data = JSON.parse(data); + $('#apps-spinner').addClass('hidden'); + var viewModel = {}; + if (data != null && data.length > 0) { + for (var i = 0; i < data.length; i++) { + data[i].name = data[i].name.replace(/[^\w\s]/gi, ' '); + data[i].name = data[i].name.replace(/[0-9]/g, ' '); + } + } + viewModel.applications = data; + viewModel.deviceType = deviceType; + if (data.length > 0) { + var content = template(viewModel); + $("#applications-list-container").html(content); + } + + }; + invokerUtil.get(serviceURL, + successCallback, function (message) { + console.log(message); + }); + }); + } + +}()); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/load-map.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/load-map.js new file mode 100644 index 000000000..a2a322f8c --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/load-map.js @@ -0,0 +1,56 @@ +/* + * 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. + */ + +$(document).ready(function () { + if (document.getElementById('device-location')) { + loadMap(); + } +}); + +function loadMap() { + var map; + + function initialize() { + var mapOptions = { + zoom: 18 + }; + var lat = $("#device-location").data("lat"); + var long = $("#device-location").data("long"); + + if (lat != null && lat != undefined && lat != "" && long != null && long != undefined && long != "") { + $("#map-error").hide(); + $("#device-location").show(); + map = new google.maps.Map(document.getElementById('device-location'), + mapOptions); + + var pos = new google.maps.LatLng(lat, long); + var marker = new google.maps.Marker({ + position: pos, + map: map + }); + + map.setCenter(pos); + } else { + $("#device-location").hide(); + $("#map-error").show(); + } + + } + + google.maps.event.addDomListener(window, 'load', initialize); +} \ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/policy-edit.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/policy-edit.hbs new file mode 100644 index 000000000..c4bb415a1 --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/policy-edit.hbs @@ -0,0 +1 @@ +{{unit "mdm.unit.policy.edit"}} \ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/policy-edit.json b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/policy-edit.json new file mode 100644 index 000000000..9eecd8f5b --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/policy-edit.json @@ -0,0 +1,3 @@ +{ + "version": "1.0.0" +} \ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-view/policy-view.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-view/policy-view.hbs new file mode 100644 index 000000000..12cffe6bd --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-view/policy-view.hbs @@ -0,0 +1 @@ +{{unit "mdm.unit.policy.view"}} \ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-view/policy-view.json b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-view/policy-view.json new file mode 100644 index 000000000..9eecd8f5b --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-view/policy-view.json @@ -0,0 +1,3 @@ +{ + "version": "1.0.0" +} \ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/policy-wizard.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/policy-wizard.hbs new file mode 100644 index 000000000..0669d1ca6 --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/policy-wizard.hbs @@ -0,0 +1 @@ +{{unit "mdm.unit.policy.wizard"}} \ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/policy-wizard.json b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/policy-wizard.json new file mode 100644 index 000000000..9eecd8f5b --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-wizard/policy-wizard.json @@ -0,0 +1,3 @@ +{ + "version": "1.0.0" +} \ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/public/asset/android-agent.apk b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/public/asset/android-agent.apk new file mode 100644 index 000000000..a1d4ebfdb Binary files /dev/null and b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/public/asset/android-agent.apk differ diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/public/images/android-icon.png b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/public/images/android-icon.png new file mode 100644 index 000000000..580a92410 Binary files /dev/null and b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/public/images/android-icon.png differ diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/public/images/android_device.png b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/public/images/android_device.png new file mode 100644 index 000000000..c4c37b641 Binary files /dev/null and b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/public/images/android_device.png differ diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/public/images/thumb.png b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/public/images/thumb.png new file mode 100644 index 000000000..851000178 Binary files /dev/null and b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/public/images/thumb.png differ diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/type-view.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/type-view.hbs new file mode 100644 index 000000000..09c98431b --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/type-view.hbs @@ -0,0 +1,146 @@ +
+

Android Mobile

+
+
+
+ +
+ +
+ +
+ +
+ +

What it Does

+
+

Connect and manage your Android device with WSO2 IoT Server.

+
+ +

What You Need

+
+
    +
  • STEP 01   Android + Mobile. +
  • +
  • STEP 02   Go ahead + and click [Enroll Device]. +
  • +
  • STEP 03   Proceed + to the [Prepare] section. +
  • +
+
+ + Enroll Device + +

+
+ +
+

Prepare


+
    +
  • 01 Download Device Agent into your Android Mobile.
  • +
  • 02 Install Agent APK file.
  • +
  • 03 Configure Agent App
  • +
+
+ +
+ +
+

Click on the image to zoom

+
+ + + +
+
+ +
+ + + +{{#zone "topCss"}} + +{{/zone}} + +{{#zone "bottomJs"}} + +{{/zone}} \ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/type-view.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/type-view.js new file mode 100644 index 000000000..ad4f0ec9c --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/type-view.js @@ -0,0 +1,24 @@ +/* + * 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 viewModel = {}; + var devicemgtProps = require('/app/conf/devicemgt-props.js').config(); + viewModel.hostName = devicemgtProps["httpsURL"]; + return viewModel; +} \ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/type-view.json b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/type-view.json new file mode 100644 index 000000000..9eecd8f5b --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.type-view/type-view.json @@ -0,0 +1,3 @@ +{ + "version": "1.0.0" +} \ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/public/templates/hidden-operations-android.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/public/templates/hidden-operations-android.hbs new file mode 100644 index 000000000..8e1900d48 --- /dev/null +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/mdm.unit.device.operation-bar/public/templates/hidden-operations-android.hbs @@ -0,0 +1,246 @@ +
+ +
+ + +
+
+ +
+
+ +
+ Configure +
+
+
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +
+ +
+ +
+ +
+ + Configure +
+
+
+ + + +
+
+ + +
+ +
+ + + +
+ +
+ Configure +
+ +
+ + +
+
+ +
+ + +
+ +
+
+ +
+ + +
+ +
+ Install +
+
+
+ +
+ + +
+ +
+ + +
+ +
+ Install +
+
+
+ +
+ + +
+ +
+ Uninstall +
+
+
+ + + +
+
+ +
+
+ +
+ Configure +
+
+
+ +
+
\ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidDeviceManagementService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidDeviceManagementService.java index 60c29fec9..9949b69ae 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidDeviceManagementService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidDeviceManagementService.java @@ -1,17 +1,17 @@ /* - * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * 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 + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -36,23 +36,12 @@ public class AndroidDeviceManagementService implements DeviceManagementService { private DeviceManager deviceManager; public static final String DEVICE_TYPE_ANDROID = "android"; - public static final String DEVICE_TYPE_TENANT = "carbon.super"; @Override public String getType() { return AndroidDeviceManagementService.DEVICE_TYPE_ANDROID; } - @Override - public String getProviderTenantDomain() { - return DEVICE_TYPE_TENANT; - } - - @Override - public boolean isSharedWithAllTenants() { - return true; - } - @Override public void init() throws DeviceManagementException { this.deviceManager = new AndroidDeviceManager(); diff --git a/components/mobile-plugins/android-plugin/pom.xml b/components/mobile-plugins/android-plugin/pom.xml index 0dbcdff77..788433cf8 100644 --- a/components/mobile-plugins/android-plugin/pom.xml +++ b/components/mobile-plugins/android-plugin/pom.xml @@ -1,21 +1,21 @@ + ~ 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. + --> @@ -34,7 +34,8 @@ org.wso2.carbon.device.mgt.mobile.android - org.wso2.carbon.device.mgt.mobile.android.agent + org.wso2.carbon.device.mgt.mobile.android.api + org.wso2.carbon.device.mgt.mobile.android.ui diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/pom.xml b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/pom.xml index bd997683e..ec1bca777 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/pom.xml +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/pom.xml @@ -1,18 +1,20 @@ commons-codec provided + + org.wso2.carbon.devicemgt + org.wso2.carbon.certificate.mgt.core + provided + diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/Certificate.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/Certificate.java new file mode 100644 index 000000000..c637252a5 --- /dev/null +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/Certificate.java @@ -0,0 +1,197 @@ +/* + * 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.carbon.mdm.api; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.certificate.mgt.core.dao.CertificateManagementDAOException; +import org.wso2.carbon.certificate.mgt.core.dto.CertificateResponse; +import org.wso2.carbon.certificate.mgt.core.exception.KeystoreException; +import org.wso2.carbon.certificate.mgt.core.service.CertificateManagementService; +import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.device.mgt.common.PaginationRequest; +import org.wso2.carbon.device.mgt.common.PaginationResult; +import org.wso2.carbon.mdm.api.common.MDMAPIException; +import org.wso2.carbon.mdm.api.util.MDMAPIUtils; +import org.wso2.carbon.mdm.beans.EnrollmentCertificate; +import org.wso2.carbon.mdm.exception.BadRequestException; +import org.wso2.carbon.mdm.exception.Message; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import java.util.ArrayList; +import java.util.List; + +/** + * All the certificate related tasks such as saving certificates, can be done through this endpoint. + */ +@SuppressWarnings("NonJaxWsWebServices") +@Produces({"application/json", "application/xml" }) +@Consumes({ "application/json", "application/xml" }) +public class Certificate { + + private static Log log = LogFactory.getLog(Operation.class); + + /** + * Save a list of certificates and relevant information in the database. + * + * @param enrollmentCertificates List of all the certificates which includes the tenant id, certificate as + * a pem and a serial number. + * @return Status of the data persist operation. + * @throws MDMAPIException + */ + @POST + @Path("saveCertificate") + public Response saveCertificate(@HeaderParam("Accept") String acceptHeader, + EnrollmentCertificate[] enrollmentCertificates) throws MDMAPIException { + MediaType responseMediaType = MDMAPIUtils.getResponseMediaType(acceptHeader); + CertificateManagementService certificateService; + List certificates = new ArrayList<>(); + org.wso2.carbon.certificate.mgt.core.bean.Certificate certificate; + certificateService = MDMAPIUtils.getCertificateManagementService(); + try { + for (EnrollmentCertificate enrollmentCertificate : enrollmentCertificates) { + certificate = new org.wso2.carbon.certificate.mgt.core.bean.Certificate(); + certificate.setTenantId(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId()); + certificate.setSerial(enrollmentCertificate.getSerial()); + certificate.setCertificate(certificateService.pemToX509Certificate(enrollmentCertificate.getPem())); + certificates.add(certificate); + } + certificateService.saveCertificate(certificates); + return Response.status(Response.Status.CREATED).entity("Added successfully."). + type(responseMediaType).build(); + } catch (KeystoreException e) { + String msg = "Error occurred while converting PEM file to X509Certificate."; + log.error(msg, e); + throw new MDMAPIException(msg, e); + } + } + + /** + * Get a certificate when the serial number is given. + * + * @param serialNumber serial of the certificate needed. + * @return certificate response. + * @throws MDMAPIException + */ + @GET + @Path("{serialNumber}") + public Response getCertificate(@HeaderParam("Accept") String acceptHeader, + @PathParam("serialNumber") String serialNumber) throws MDMAPIException { + MediaType responseMediaType = MDMAPIUtils.getResponseMediaType(acceptHeader); + Message message = new Message(); + + if (serialNumber == null || serialNumber.isEmpty()) { + message.setErrorMessage("Invalid serial number"); + message.setDiscription("Serial number is missing or invalid."); + throw new BadRequestException(message, responseMediaType); + } + + CertificateManagementService certificateService = MDMAPIUtils.getCertificateManagementService(); + CertificateResponse certificateResponse; + try { + certificateResponse = certificateService.getCertificateBySerial(serialNumber); + if(certificateResponse != null) { + certificateResponse.setCertificate(null); //avoid sending byte array in response. + } + return Response.status(Response.Status.OK).entity(certificateResponse).type(responseMediaType).build(); + } catch (KeystoreException e) { + String msg = "Error occurred while converting PEM file to X509Certificate"; + log.error(msg, e); + return Response.serverError().build(); + } + } + + /** + * Get all certificates in a paginated manner. + * + * @param startIndex index of the first record to be fetched + * @param length number of records to be fetched starting from the start index. + * @return paginated result of certificate. + * @throws MDMAPIException + */ + @GET + @Path("paginate") + public Response getAllCertificates(@HeaderParam("Accept") String acceptHeader, + @QueryParam("start") int startIndex, + @QueryParam("length") int length) + throws MDMAPIException { + MediaType responseMediaType = MDMAPIUtils.getResponseMediaType(acceptHeader); + Message message = new Message(); + + if (startIndex < 0) { + message.setErrorMessage("Invalid start index."); + message.setDiscription("Start index cannot be less that 0."); + throw new BadRequestException(message, responseMediaType); + } else if (length <= 0) { + message.setErrorMessage("Invalid length value."); + message.setDiscription("Length should be a positive integer."); + throw new BadRequestException(message, responseMediaType); + } + + CertificateManagementService certificateService = MDMAPIUtils.getCertificateManagementService(); + PaginationRequest paginationRequest = new PaginationRequest(startIndex, length); + try { + PaginationResult certificates = certificateService.getAllCertificates(paginationRequest); + return Response.status(Response.Status.OK).entity(certificates).type(responseMediaType).build(); + } catch (CertificateManagementDAOException e) { + String msg = "Error occurred while fetching all certificates."; + log.error(msg, e); + throw new MDMAPIException(msg, e); + } + } + + @DELETE + @Path("{serialNumber}") + public Response removeCertificate(@HeaderParam("Accept") String acceptHeader, + @PathParam("serialNumber") String serialNumber) throws MDMAPIException { + MediaType responseMediaType = MDMAPIUtils.getResponseMediaType(acceptHeader); + Message message = new Message(); + + if (serialNumber == null || serialNumber.isEmpty()) { + message.setErrorMessage("Invalid serial number"); + message.setDiscription("Serial number is missing or invalid."); + throw new BadRequestException(message, responseMediaType); + } + + CertificateManagementService certificateService = MDMAPIUtils.getCertificateManagementService(); + boolean deleted; + try { + deleted = certificateService.removeCertificate(serialNumber); + if(deleted){ + return Response.status(Response.Status.OK).entity(true).type(responseMediaType).build(); + } else { + return Response.status(Response.Status.GONE).entity(false).type(responseMediaType).build(); + } + } catch (CertificateManagementDAOException e) { + String msg = "Error occurred while converting PEM file to X509Certificate"; + log.error(msg, e); + return Response.serverError().build(); + } + } +} diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/Configuration.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/Configuration.java index 8acf4efe9..6fd806f33 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/Configuration.java +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/Configuration.java @@ -21,16 +21,20 @@ package org.wso2.carbon.mdm.api; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationManagementException; import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration; import org.wso2.carbon.mdm.api.common.MDMAPIException; import org.wso2.carbon.mdm.api.util.MDMAPIUtils; import org.wso2.carbon.mdm.api.util.MDMAppConstants; import org.wso2.carbon.mdm.api.util.ResponsePayload; +import org.wso2.carbon.policy.mgt.core.util.PolicyManagerUtil; import javax.jws.WebService; import javax.ws.rs.*; import javax.ws.rs.core.Response; +import java.util.ArrayList; +import java.util.List; /** * General Tenant Configuration REST-API implementation. @@ -67,8 +71,19 @@ public class Configuration { public TenantConfiguration getConfiguration() throws MDMAPIException { String msg; try { - return MDMAPIUtils.getTenantConfigurationManagementService().getConfiguration(MDMAppConstants. - RegistryConstants.GENERAL_CONFIG_RESOURCE_PATH); + TenantConfiguration tenantConfiguration = MDMAPIUtils.getTenantConfigurationManagementService(). + getConfiguration(MDMAppConstants.RegistryConstants.GENERAL_CONFIG_RESOURCE_PATH); + ConfigurationEntry configurationEntry = new ConfigurationEntry(); + configurationEntry.setContentType("text"); + configurationEntry.setName("notifierFrequency"); + configurationEntry.setValue(PolicyManagerUtil.getMonitoringFequency()); + List configList = tenantConfiguration.getConfiguration(); + if (configList == null) { + configList = new ArrayList<>(); + } + configList.add(configurationEntry); + tenantConfiguration.setConfiguration(configList); + return tenantConfiguration; } catch (ConfigurationManagementException e) { msg = "Error occurred while retrieving the tenant configuration."; log.error(msg, e); diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/Operation.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/Operation.java index a775318dd..84e88c92a 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/Operation.java +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/Operation.java @@ -54,7 +54,7 @@ import java.util.List; public class Operation { private static Log log = LogFactory.getLog(Operation.class); - + /* @deprecated */ @GET public List getAllOperations() throws MDMAPIException { @@ -115,6 +115,7 @@ public class Operation { return operations; } + /* @deprecated */ @POST public ResponsePayload addOperation(DeviceOperationContext operationContext) throws MDMAPIException { DeviceManagementProviderService dmService; @@ -182,6 +183,8 @@ public class Operation { } appManagerConnector.installApplicationForDevices(operation, applicationWrapper.getDeviceIdentifiers()); } + Response.status(HttpStatus.SC_CREATED); + responseMsg.setMessageFromServer("Application installation request has been sent to the device."); return responseMsg; } catch (ApplicationManagementException e) { String msg = "Error occurred while saving the operation"; @@ -215,6 +218,8 @@ public class Operation { } appManagerConnector.installApplicationForDevices(operation, applicationWrapper.getDeviceIdentifiers()); } + Response.status(HttpStatus.SC_CREATED); + responseMsg.setMessageFromServer("Application removal request has been sent to the device."); return responseMsg; } catch (ApplicationManagementException e) { String msg = "Error occurred while saving the operation"; diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/Policy.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/Policy.java index dea04d31b..c0dd24d14 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/Policy.java +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/Policy.java @@ -173,24 +173,6 @@ public class Policy { @Path("{id}") public ResponsePayload updatePolicy(PolicyWrapper policyWrapper, @PathParam("id") int policyId) throws MDMAPIException { -// PolicyManagerService policyManagementService = MDMAPIUtils.getPolicyManagementService(); -// ResponsePayload responseMsg = new ResponsePayload(); -// try { -// PolicyAdministratorPoint pap = policyManagementService.getPAP(); -// org.wso2.carbon.policy.mgt.common.Policy previousPolicy = pap.getPolicy(policyId); -// policy.setProfile(pap.getProfile(previousPolicy.getProfileId())); -// policy.setId(previousPolicy.getId()); -// pap.updatePolicy(policy); -// Response.status(HttpStatus.SC_OK); -// responseMsg.setMessageFromServer("Policy has been updated successfully."); -// return responseMsg; -// } catch (PolicyManagementException e) { -// String error = "Policy Management related exception"; -// log.error(error, e); -// throw new MDMAPIException(error, e); -// } - - PolicyManagerService policyManagementService = MDMAPIUtils.getPolicyManagementService(); ResponsePayload responseMsg = new ResponsePayload(); @@ -205,16 +187,12 @@ public class Policy { policy.setUsers(policyWrapper.getUsers()); policy.setTenantId(policyWrapper.getTenantId()); policy.setCompliance(policyWrapper.getCompliance()); - // policy.setActive(true); try { PolicyAdministratorPoint pap = policyManagementService.getPAP(); -// pap.addPolicy(policy); pap.updatePolicy(policy); -// Response.status(HttpStatus.SC_CREATED); Response.status(HttpStatus.SC_OK); responseMsg.setStatusCode(HttpStatus.SC_CREATED); -// responseMsg.setMessageFromServer("Policy has been added successfully."); responseMsg.setMessageFromServer("Policy has been updated successfully."); return responseMsg; } catch (PolicyManagementException e) { @@ -293,23 +271,6 @@ public class Policy { } } -// @GET -// @Path("task/{mf}") -// public int taskService(@PathParam("mf") int monitoringFrequency) throws MDMAPIException { -// int policyCount = 0; -// PolicyManagerService policyManagementService = MDMAPIUtils.getPolicyManagementService(); -// try { -// TaskScheduleService taskScheduleService = policyManagementService.getTaskScheduleService(); -// taskScheduleService.startTask(monitoringFrequency); -// return policyCount; -// } catch (PolicyMonitoringTaskException e) { -// String error = "Policy Management related exception"; -// log.error(error, e); -// throw new MDMAPIException(error, e); -// } -// } - - @PUT @Produces("application/json") @Path("activate") @@ -333,7 +294,6 @@ public class Policy { } - @PUT @Produces("application/json") @Path("inactivate") @@ -356,7 +316,6 @@ public class Policy { return Response.status(HttpStatus.SC_OK).entity(responsePayload).build(); } - @PUT @Produces("application/json") @Path("apply-changes") @@ -400,7 +359,6 @@ public class Policy { return Response.status(HttpStatus.SC_OK).entity(responsePayload).build(); } - @GET @Path("update-task/{milliseconds}") public Response updateTaskService(@PathParam("milliseconds") int monitoringFrequency) throws MDMAPIException { @@ -421,7 +379,6 @@ public class Policy { return Response.status(HttpStatus.SC_OK).entity(responsePayload).build(); } - @GET @Path("stop-task") public Response stopTaskService() throws MDMAPIException { @@ -442,7 +399,6 @@ public class Policy { return Response.status(HttpStatus.SC_OK).entity(responsePayload).build(); } - @GET @Path("{type}/{id}") public ComplianceData getComplianceDataOfDevice(@PathParam("type") String type, @PathParam("id") String id) throws diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/Role.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/Role.java index a0adeed6a..dda4f243f 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/Role.java +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/Role.java @@ -419,4 +419,36 @@ public class Role { } return list; } + + /** + * This method is used to retrieve the role count of the system. + * + * @return returns the count. + * @throws MDMAPIException + */ + @GET + @Path("count") + public int getRoleCount() throws MDMAPIException { + UserStoreManager userStoreManager = MDMAPIUtils.getUserStoreManager(); + String[] roles; + try { + if (log.isDebugEnabled()) { + log.debug("Getting the list of user roles"); + } + roles = userStoreManager.getRoleNames(); + + } catch (UserStoreException e) { + String msg = "Error occurred while retrieving the list of user roles."; + log.error(msg, e); + throw new MDMAPIException(msg, e); + } + // removing all internal roles and roles created for Service-providers + List filteredRoles = new ArrayList(); + for (String role : roles) { + if (!(role.startsWith("Internal/") || role.startsWith("Application/"))) { + filteredRoles.add(role); + } + } + return filteredRoles.size(); + } } diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/User.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/User.java index 16c9ee7ca..e1e065c1b 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/User.java +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/User.java @@ -25,10 +25,11 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.device.mgt.common.DeviceManagementException; -import org.wso2.carbon.device.mgt.common.EmailMessageProperties; import org.wso2.carbon.device.mgt.common.PaginationRequest; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; +import org.wso2.carbon.device.mgt.core.service.EmailMetaInfo; import org.wso2.carbon.mdm.api.common.MDMAPIException; +import org.wso2.carbon.mdm.api.util.CredentialManagementResponseBuilder; import org.wso2.carbon.mdm.api.util.MDMAPIUtils; import org.wso2.carbon.mdm.api.util.ResponsePayload; import org.wso2.carbon.mdm.beans.UserCredentialWrapper; @@ -37,6 +38,7 @@ import org.wso2.carbon.mdm.util.Constants; import org.wso2.carbon.mdm.util.SetReferenceTransformer; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.api.UserStoreManager; +import org.wso2.carbon.utils.multitenancy.MultitenantConstants; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -50,14 +52,7 @@ import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.TreeSet; +import java.util.*; /** * This class represents the JAX-RS services of User related functionality. @@ -65,7 +60,7 @@ import java.util.TreeSet; public class User { private static Log log = LogFactory.getLog(User.class); - private String ROLE_EVERYONE = "Internal/everyone"; + private static final String ROLE_EVERYONE = "Internal/everyone"; /** * Method to add user to emm-user-store. @@ -85,22 +80,22 @@ public class User { // if user already exists if (log.isDebugEnabled()) { log.debug("User by username: " + userWrapper.getUsername() + - " already exists. Therefore, request made to add user was refused."); + " already exists. Therefore, request made to add user was refused."); } // returning response with bad request state responsePayload.setStatusCode(HttpStatus.SC_CONFLICT); responsePayload. setMessageFromServer("User by username: " + userWrapper.getUsername() + - " already exists. Therefore, request made to add user was refused."); + " already exists. Therefore, request made to add user was refused."); return Response.status(HttpStatus.SC_CONFLICT).entity(responsePayload).build(); } else { String initialUserPassword = generateInitialUserPassword(); Map defaultUserClaims = buildDefaultUserClaims(userWrapper.getFirstname(), userWrapper.getLastname(), - userWrapper.getEmailAddress()); + userWrapper.getEmailAddress()); // calling addUser method of carbon user api userStoreManager.addUser(userWrapper.getUsername(), initialUserPassword, - userWrapper.getRoles(), defaultUserClaims, null); + userWrapper.getRoles(), defaultUserClaims, null); // invite newly added user to enroll device inviteNewlyAddedUserToEnrollDevice(userWrapper.getUsername(), initialUserPassword); // Outputting debug message upon successful addition of user @@ -110,17 +105,13 @@ public class User { // returning response with success state responsePayload.setStatusCode(HttpStatus.SC_CREATED); responsePayload.setMessageFromServer("User by username: " + userWrapper.getUsername() + - " was successfully added."); + " was successfully added."); return Response.status(HttpStatus.SC_CREATED).entity(responsePayload).build(); } } catch (UserStoreException e) { - String errorMsg = "Exception in trying to add user by username: " + userWrapper.getUsername(); - log.error(errorMsg, e); - throw new MDMAPIException(errorMsg, e); - } catch (DeviceManagementException e) { - String errorMsg = "Exception in trying to add user by username: " + userWrapper.getUsername(); - log.error(errorMsg, e); - throw new MDMAPIException(errorMsg, e); + String msg = "Exception in trying to add user by username: " + userWrapper.getUsername(); + log.error(msg, e); + throw new MDMAPIException(msg, e); } } @@ -164,9 +155,9 @@ public class User { return Response.status(HttpStatus.SC_NOT_FOUND).entity(responsePayload).build(); } } catch (UserStoreException e) { - String errorMsg = "Exception in trying to retrieve user by username: " + username; - log.error(errorMsg, e); - throw new MDMAPIException(errorMsg, e); + String msg = "Exception in trying to retrieve user by username: " + username; + log.error(msg, e); + throw new MDMAPIException(msg, e); } } @@ -188,12 +179,12 @@ public class User { if (userStoreManager.isExistingUser(userWrapper.getUsername())) { Map defaultUserClaims = buildDefaultUserClaims(userWrapper.getFirstname(), userWrapper.getLastname(), - userWrapper.getEmailAddress()); + userWrapper.getEmailAddress()); if (StringUtils.isNotEmpty(userWrapper.getPassword())) { // Decoding Base64 encoded password byte[] decodedBytes = Base64.decodeBase64(userWrapper.getPassword()); userStoreManager.updateCredentialByAdmin(userWrapper.getUsername(), - new String(decodedBytes, "UTF-8")); + new String(decodedBytes, "UTF-8")); log.debug("User credential of username: " + userWrapper.getUsername() + " has been changed"); } List listofFilteredRoles = getFilteredRoles(userStoreManager, userWrapper.getUsername()); @@ -204,16 +195,16 @@ public class User { The difference of roles in existingRolesSet and newRolesSet needed to be deleted new roles to add = newRolesSet - The intersection of roles in existingRolesSet and newRolesSet */ - final TreeSet existingRolesSet = new TreeSet(); + final TreeSet existingRolesSet = new TreeSet<>(); Collections.addAll(existingRolesSet, existingRoles); - final TreeSet newRolesSet = new TreeSet(); + final TreeSet newRolesSet = new TreeSet<>(); Collections.addAll(newRolesSet, userWrapper.getRoles()); existingRolesSet.removeAll(newRolesSet); // Now we have the roles to delete String[] rolesToDelete = existingRolesSet.toArray(new String[existingRolesSet.size()]); - List roles = new ArrayList(Arrays.asList(rolesToDelete)); + List roles = new ArrayList<>(Arrays.asList(rolesToDelete)); roles.remove(ROLE_EVERYONE); - rolesToDelete = roles.toArray(new String[0]); + rolesToDelete = new String[0]; // Clearing and re-initializing the set existingRolesSet.clear(); Collections.addAll(existingRolesSet, existingRoles); @@ -229,28 +220,24 @@ public class User { // returning response with success state responsePayload.setStatusCode(HttpStatus.SC_CREATED); responsePayload.setMessageFromServer("User by username: " + userWrapper.getUsername() + - " was successfully updated."); + " was successfully updated."); return Response.status(HttpStatus.SC_CREATED).entity(responsePayload).build(); } else { if (log.isDebugEnabled()) { log.debug("User by username: " + userWrapper.getUsername() + - " doesn't exists. Therefore, request made to update user was refused."); + " doesn't exists. Therefore, request made to update user was refused."); } // returning response with bad request state responsePayload.setStatusCode(HttpStatus.SC_CONFLICT); responsePayload. setMessageFromServer("User by username: " + userWrapper.getUsername() + - " doesn't exists. Therefore, request made to update user was refused."); + " doesn't exists. Therefore, request made to update user was refused."); return Response.status(HttpStatus.SC_CONFLICT).entity(responsePayload).build(); } - } catch (UserStoreException e) { - String errorMsg = "Exception in trying to update user by username: " + userWrapper.getUsername(); - log.error(errorMsg, e); - throw new MDMAPIException(errorMsg, e); - } catch (UnsupportedEncodingException e) { - String errorMsg = "Exception in trying to update user by username: " + userWrapper.getUsername(); - log.error(errorMsg, e); - throw new MDMAPIException(errorMsg, e); + } catch (UserStoreException | UnsupportedEncodingException e) { + String msg = "Exception in trying to update user by username: " + userWrapper.getUsername(); + log.error(msg, e); + throw new MDMAPIException(msg, e); } } @@ -270,7 +257,7 @@ public class User { Random randomGenerator = new Random(); String totalCharset = lowerCaseCharset + upperCaseCharset + numericCharset; int totalCharsetLength = totalCharset.length(); - StringBuffer initialUserPassword = new StringBuffer(); + StringBuilder initialUserPassword = new StringBuilder(); for (int i = 0; i < passwordLength; i++) { initialUserPassword .append(totalCharset.charAt(randomGenerator.nextInt(totalCharsetLength))); @@ -290,7 +277,7 @@ public class User { * @return {Object} Default user claims to be provided */ private Map buildDefaultUserClaims(String firstname, String lastname, String emailAddress) { - Map defaultUserClaims = new HashMap(); + Map defaultUserClaims = new HashMap<>(); defaultUserClaims.put(Constants.USER_CLAIM_FIRST_NAME, firstname); defaultUserClaims.put(Constants.USER_CLAIM_LAST_NAME, lastname); defaultUserClaims.put(Constants.USER_CLAIM_EMAIL_ADDRESS, emailAddress); @@ -337,24 +324,24 @@ public class User { return Response.status(HttpStatus.SC_BAD_REQUEST).entity(responsePayload).build(); } } catch (UserStoreException e) { - String errorMsg = "Exception in trying to remove user by username: " + username; - log.error(errorMsg, e); - throw new MDMAPIException(errorMsg, e); + String msg = "Exception in trying to remove user by username: " + username; + log.error(msg, e); + throw new MDMAPIException(msg, e); } } /** * get all the roles except for the internal/xxx and application/xxx * - * @param userStoreManager - * @param username + * @param userStoreManager User Store Manager associated with the currently logged in user + * @param username Username of the currently logged in user * @return the list of filtered roles * @throws UserStoreException */ private List getFilteredRoles(UserStoreManager userStoreManager, String username) throws UserStoreException { String[] roleListOfUser = userStoreManager.getRoleListOfUser(username); - List filteredRoles = new ArrayList(); + List filteredRoles = new ArrayList<>(); for (String role : roleListOfUser) { if (!(role.startsWith("Internal/") || role.startsWith("Application/"))) { filteredRoles.add(role); @@ -400,9 +387,9 @@ public class User { return Response.status(HttpStatus.SC_BAD_REQUEST).entity(responsePayload).build(); } } catch (UserStoreException e) { - String errorMsg = "Exception in trying to retrieve roles for user by username: " + username; - log.error(errorMsg, e); - throw new MDMAPIException(errorMsg, e); + String msg = "Exception in trying to retrieve roles for user by username: " + username; + log.error(msg, e); + throw new MDMAPIException(msg, e); } } @@ -419,10 +406,10 @@ public class User { log.debug("Getting the list of users with all user-related information"); } UserStoreManager userStoreManager = MDMAPIUtils.getUserStoreManager(); - ArrayList userList; + List userList; try { String[] users = userStoreManager.listUsers("*", -1); - userList = new ArrayList(users.length); + userList = new ArrayList<>(users.length); UserWrapper user; for (String username : users) { user = new UserWrapper(); @@ -439,12 +426,10 @@ public class User { } ResponsePayload responsePayload = new ResponsePayload(); responsePayload.setStatusCode(HttpStatus.SC_OK); - int count = 0; - if (userList != null) { - count = userList.size(); - } + int count; + count = userList.size(); responsePayload.setMessageFromServer("All users were successfully retrieved. " + - "Obtained user count: " + count); + "Obtained user count: " + count); responsePayload.setResponseContent(userList); return Response.status(HttpStatus.SC_OK).entity(responsePayload).build(); } @@ -463,10 +448,10 @@ public class User { log.debug("Getting the list of users with all user-related information using the filter : " + filter); } UserStoreManager userStoreManager = MDMAPIUtils.getUserStoreManager(); - ArrayList userList; + List userList; try { String[] users = userStoreManager.listUsers(filter + "*", -1); - userList = new ArrayList(users.length); + userList = new ArrayList<>(users.length); UserWrapper user; for (String username : users) { user = new UserWrapper(); @@ -483,12 +468,10 @@ public class User { } ResponsePayload responsePayload = new ResponsePayload(); responsePayload.setStatusCode(HttpStatus.SC_OK); - int count = 0; - if (userList != null) { - count = userList.size(); - } + int count; + count = userList.size(); responsePayload.setMessageFromServer("All users were successfully retrieved. " + - "Obtained user count: " + count); + "Obtained user count: " + count); responsePayload.setResponseContent(userList); return Response.status(HttpStatus.SC_OK).entity(responsePayload).build(); } @@ -506,10 +489,10 @@ public class User { log.debug("Getting the list of users by name"); } UserStoreManager userStoreManager = MDMAPIUtils.getUserStoreManager(); - ArrayList userList; + List userList; try { String[] users = userStoreManager.listUsers("*" + userName + "*", -1); - userList = new ArrayList(users.length); + userList = new ArrayList<>(users.length); UserWrapper user; for (String username : users) { user = new UserWrapper(); @@ -526,12 +509,10 @@ public class User { } ResponsePayload responsePayload = new ResponsePayload(); responsePayload.setStatusCode(HttpStatus.SC_OK); - int count = 0; - if (userList != null) { - count = userList.size(); - } + int count; + count = userList.size(); responsePayload.setMessageFromServer("All users by username were successfully retrieved. " + - "Obtained user count: " + count); + "Obtained user count: " + count); responsePayload.setResponseContent(userList); return Response.status(HttpStatus.SC_OK).entity(responsePayload).build(); } @@ -549,14 +530,11 @@ public class User { log.debug("Getting the list of users by name"); } UserStoreManager userStoreManager = MDMAPIUtils.getUserStoreManager(); - ArrayList userList; + List userList; try { String[] users = userStoreManager.listUsers("*" + userName + "*", -1); - userList = new ArrayList(users.length); - UserWrapper user; - for (String username : users) { - userList.add(username); - } + userList = new ArrayList<>(users.length); + Collections.addAll(userList, users); } catch (UserStoreException e) { String msg = "Error occurred while retrieving the list of users"; log.error(msg, e); @@ -564,12 +542,10 @@ public class User { } ResponsePayload responsePayload = new ResponsePayload(); responsePayload.setStatusCode(HttpStatus.SC_OK); - int count = 0; - if (userList != null) { - count = userList.size(); - } + int count; + count = userList.size(); responsePayload.setMessageFromServer("All users by username were successfully retrieved. " + - "Obtained user count: " + count); + "Obtained user count: " + count); responsePayload.setResponseContent(userList); return Response.status(HttpStatus.SC_OK).entity(responsePayload).build(); } @@ -582,9 +558,14 @@ public class User { * @return A list of usernames * @throws MDMAPIException, UserStoreException */ - private String getClaimValue(String username, String claimUri) throws MDMAPIException, UserStoreException { + private String getClaimValue(String username, String claimUri) throws MDMAPIException { UserStoreManager userStoreManager = MDMAPIUtils.getUserStoreManager(); - return userStoreManager.getUserClaimValue(username, claimUri, null); + try { + return userStoreManager.getUserClaimValue(username, claimUri, null); + } catch (UserStoreException e) { + throw new MDMAPIException("Error occurred while retrieving value assigned to the claim '" + + claimUri + "'", e); + } } /** @@ -593,31 +574,37 @@ public class User { * @param username Username of the user * @throws MDMAPIException, UserStoreException, DeviceManagementException */ - private void inviteNewlyAddedUserToEnrollDevice(String username, String password) throws - MDMAPIException, - UserStoreException, - DeviceManagementException { + private void inviteNewlyAddedUserToEnrollDevice( + String username, String password) throws MDMAPIException { if (log.isDebugEnabled()) { log.debug("Sending invitation mail to user by username: " + username); } - String tennentDomain = CarbonContext.getThreadLocalCarbonContext().getTenantDomain(); - if (tennentDomain.equalsIgnoreCase("carbon.super")) { - tennentDomain = ""; + String tenantDomain = CarbonContext.getThreadLocalCarbonContext().getTenantDomain(); + if (MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equalsIgnoreCase(tenantDomain)) { + tenantDomain = ""; } if (!username.contains("/")) { username = "/" + username; } String[] usernameBits = username.split("/"); DeviceManagementProviderService deviceManagementProviderService = MDMAPIUtils.getDeviceManagementService(); - EmailMessageProperties emailMessageProperties = new EmailMessageProperties(); - emailMessageProperties.setUserName(usernameBits[1]); - emailMessageProperties.setDomainName(tennentDomain); - emailMessageProperties.setFirstName(getClaimValue(username, Constants.USER_CLAIM_FIRST_NAME)); - emailMessageProperties.setPassword(password); - String[] mailAddress = new String[1]; - mailAddress[0] = getClaimValue(username, Constants.USER_CLAIM_EMAIL_ADDRESS); - emailMessageProperties.setMailTo(mailAddress); - deviceManagementProviderService.sendRegistrationEmail(emailMessageProperties); + + Properties props = new Properties(); + props.setProperty("username", usernameBits[1]); + props.setProperty("domain-name", tenantDomain); + props.setProperty("first-name", getClaimValue(username, Constants.USER_CLAIM_FIRST_NAME)); + props.setProperty("password", password); + + String recipient = getClaimValue(username, Constants.USER_CLAIM_EMAIL_ADDRESS); + + EmailMetaInfo metaInfo = new EmailMetaInfo(recipient, props); + try { + deviceManagementProviderService.sendRegistrationEmail(metaInfo); + } catch (DeviceManagementException e) { + String msg = "Error occurred while sending registration email to user '" + username + "'"; + log.error(msg, e); + throw new MDMAPIException(msg, e); + } } /** @@ -635,26 +622,20 @@ public class User { } DeviceManagementProviderService deviceManagementProviderService = MDMAPIUtils.getDeviceManagementService(); try { - for (int i = 0; i < usernames.size(); i++) { - EmailMessageProperties emailMessageProperties = new EmailMessageProperties(); - emailMessageProperties - .setFirstName(getClaimValue(usernames.get(i), Constants.USER_CLAIM_FIRST_NAME)); - emailMessageProperties.setUserName(usernames.get(i)); - String[] mailAddress = new String[1]; - mailAddress[0] = getClaimValue(usernames.get(i), Constants.USER_CLAIM_EMAIL_ADDRESS); - if (StringUtils.isNotEmpty(mailAddress[0])) { - emailMessageProperties.setMailTo(mailAddress); - deviceManagementProviderService.sendEnrolmentInvitation(emailMessageProperties); - } + for (String username : usernames) { + String recipient = getClaimValue(username, Constants.USER_CLAIM_EMAIL_ADDRESS); + + Properties props = new Properties(); + props.setProperty("first-name", getClaimValue(username, Constants.USER_CLAIM_FIRST_NAME)); + props.setProperty("username", username); + + EmailMetaInfo metaInfo = new EmailMetaInfo(recipient, props); + deviceManagementProviderService.sendEnrolmentInvitation(metaInfo); } - } catch (UserStoreException e) { - String errorMsg = "Exception in trying to invite user."; - log.error(errorMsg, e); - throw new MDMAPIException(errorMsg, e); } catch (DeviceManagementException e) { - String errorMsg = "Exception in trying to invite user."; - log.error(errorMsg, e); - throw new MDMAPIException(errorMsg, e); + String msg = "Error occurred while inviting user to enrol their device"; + log.error(msg, e); + throw new MDMAPIException(msg, e); } ResponsePayload responsePayload = new ResponsePayload(); responsePayload.setStatusCode(HttpStatus.SC_OK); @@ -685,9 +666,9 @@ public class User { } return dmService.getDevicesOfUser(username); } catch (DeviceManagementException e) { - String errorMsg = "Device management error"; - log.error(errorMsg, e); - throw new MDMAPIException(errorMsg, e); + String msg = "Device management error"; + log.error(msg, e); + throw new MDMAPIException(msg, e); } } @@ -734,7 +715,7 @@ public class User { } SetReferenceTransformer transformer = new SetReferenceTransformer(); transformer.transform(Arrays.asList(userStoreManager.getRoleListOfUser(username)), - userList); + userList); final String[] rolesToAdd = (String[]) transformer.getObjectsToAdd().toArray(new String[transformer.getObjectsToAdd().size()]); final String[] rolesToDelete = (String[]) @@ -757,30 +738,26 @@ public class User { * @throws MDMAPIException */ @POST - @Path("reset-password") + @Path("change-password") @Consumes({MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_JSON}) public Response resetPassword(UserCredentialWrapper credentials) throws MDMAPIException { - UserStoreManager userStoreManager = MDMAPIUtils.getUserStoreManager(); - ResponsePayload responsePayload = new ResponsePayload(); - try { - byte[] decodedNewPassword = Base64.decodeBase64(credentials.getNewPassword()); - userStoreManager.updateCredentialByAdmin(credentials.getUsername(), new String( - decodedNewPassword, "UTF-8")); - responsePayload.setStatusCode(HttpStatus.SC_CREATED); - responsePayload.setMessageFromServer("User password by username: " + credentials.getUsername() + - " was successfully changed."); - return Response.status(HttpStatus.SC_CREATED).entity(responsePayload).build(); - } catch (UserStoreException e) { - String errorMsg = "Exception in trying to change the password by username: " + credentials.getUsername(); - log.error(errorMsg, e); - responsePayload.setStatusCode(HttpStatus.SC_BAD_REQUEST); - responsePayload.setMessageFromServer("Old password does not match."); - return Response.status(HttpStatus.SC_BAD_REQUEST).entity(responsePayload).build(); - } catch (UnsupportedEncodingException e) { - String errorMsg = "Exception in trying to change the password by username: " + credentials.getUsername(); - log.error(errorMsg, e); - throw new MDMAPIException(errorMsg, e); - } + return CredentialManagementResponseBuilder.buildChangePasswordResponse(credentials); } -} + + /** + * Method to change the user password. + * + * @param credentials Wrapper object representing user credentials. + * @return {Response} Status of the request wrapped inside Response object. + * @throws MDMAPIException + */ + @POST + @Path("reset-password") + @Consumes({MediaType.APPLICATION_JSON}) + @Produces({MediaType.APPLICATION_JSON}) + public Response resetPasswordByAdmin(UserCredentialWrapper credentials) throws MDMAPIException { + return CredentialManagementResponseBuilder.buildResetPasswordResponse(credentials); + } + +} \ No newline at end of file diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/util/CredentialManagementResponseBuilder.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/util/CredentialManagementResponseBuilder.java new file mode 100644 index 000000000..640036758 --- /dev/null +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/util/CredentialManagementResponseBuilder.java @@ -0,0 +1,105 @@ +/* + * 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.carbon.mdm.api.util; + +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.httpclient.HttpStatus; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.mdm.api.common.MDMAPIException; +import org.wso2.carbon.mdm.beans.UserCredentialWrapper; +import org.wso2.carbon.user.api.UserStoreException; +import org.wso2.carbon.user.api.UserStoreManager; + +import javax.ws.rs.core.Response; +import java.io.UnsupportedEncodingException; + +/** + * This class builds Credential modification related Responses + */ +public class CredentialManagementResponseBuilder { + + private static Log log = LogFactory.getLog(CredentialManagementResponseBuilder.class); + + private ResponsePayload responsePayload; + + /** + * Builds the response to change the password of a user + * @param credentials - User credentials + * @return Response Object + * @throws MDMAPIException + */ + public static Response buildChangePasswordResponse(UserCredentialWrapper credentials) throws MDMAPIException { + UserStoreManager userStoreManager = MDMAPIUtils.getUserStoreManager(); + ResponsePayload responsePayload = new ResponsePayload(); + + try { + byte[] decodedNewPassword = Base64.decodeBase64(credentials.getNewPassword()); + byte[] decodedOldPassword = Base64.decodeBase64(credentials.getOldPassword()); + userStoreManager.updateCredential(credentials.getUsername(), new String( + decodedNewPassword, "UTF-8"), new String(decodedOldPassword, "UTF-8")); + responsePayload.setStatusCode(HttpStatus.SC_CREATED); + responsePayload.setMessageFromServer("User password by username: " + credentials.getUsername() + + " was successfully changed."); + return Response.status(HttpStatus.SC_CREATED).entity(responsePayload).build(); + } catch (UserStoreException e) { + log.error(e.getMessage(), e); + responsePayload.setStatusCode(HttpStatus.SC_BAD_REQUEST); + responsePayload.setMessageFromServer("Old password does not match."); + return Response.status(HttpStatus.SC_BAD_REQUEST).entity(responsePayload).build(); + } catch (UnsupportedEncodingException e) { + String errorMsg = "Could not change the password of the user: " + credentials.getUsername() + + ". The Character Encoding is not supported."; + log.error(errorMsg, e); + throw new MDMAPIException(errorMsg, e); + } + + } + + /** + * Builds the response to reset the password of a user + * @param credentials - User credentials + * @return Response Object + * @throws MDMAPIException + */ + public static Response buildResetPasswordResponse(UserCredentialWrapper credentials) throws MDMAPIException { + UserStoreManager userStoreManager = MDMAPIUtils.getUserStoreManager(); + ResponsePayload responsePayload = new ResponsePayload(); + try { + byte[] decodedNewPassword = Base64.decodeBase64(credentials.getNewPassword()); + userStoreManager.updateCredentialByAdmin(credentials.getUsername(), new String( + decodedNewPassword, "UTF-8")); + responsePayload.setStatusCode(HttpStatus.SC_CREATED); + responsePayload.setMessageFromServer("User password by username: " + credentials.getUsername() + + " was successfully changed."); + return Response.status(HttpStatus.SC_CREATED).entity(responsePayload).build(); + } catch (UserStoreException e) { + log.error(e.getMessage(), e); + responsePayload.setStatusCode(HttpStatus.SC_BAD_REQUEST); + responsePayload.setMessageFromServer("Could not change the password."); + return Response.status(HttpStatus.SC_BAD_REQUEST).entity(responsePayload).build(); + } catch (UnsupportedEncodingException e) { + String errorMsg = "Could not change the password of the user: " + credentials.getUsername() + + ". The Character Encoding is not supported."; + log.error(errorMsg, e); + throw new MDMAPIException(errorMsg, e); + } + } + +} diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/util/MDMAPIUtils.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/util/MDMAPIUtils.java index 0c474818a..6b7cbab59 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/util/MDMAPIUtils.java +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/api/util/MDMAPIUtils.java @@ -20,6 +20,7 @@ package org.wso2.carbon.mdm.api.util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.certificate.mgt.core.service.CertificateManagementService; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; @@ -43,6 +44,7 @@ import org.wso2.carbon.user.api.UserStoreManager; import org.wso2.carbon.user.core.service.RealmService; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; +import javax.ws.rs.core.MediaType; import java.util.List; /** @@ -51,6 +53,7 @@ import java.util.List; public class MDMAPIUtils { private static final String NOTIFIER_FREQUENCY = "notifierFrequency"; + public static final MediaType DEFAULT_CONTENT_TYPE = MediaType.APPLICATION_JSON_TYPE; private static Log log = LogFactory.getLog(MDMAPIUtils.class); @@ -252,4 +255,31 @@ public class MDMAPIUtils { pagingResponse.setData(data); return pagingResponse; } + + public static CertificateManagementService getCertificateManagementService() { + + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); + CertificateManagementService certificateManagementService = (CertificateManagementService) + ctx.getOSGiService(CertificateManagementService.class, null); + + if (certificateManagementService == null) { + String msg = "Certificate Management service not initialized."; + log.error(msg); + throw new IllegalStateException(msg); + } + + return certificateManagementService; + } + + + public static MediaType getResponseMediaType(String acceptHeader) { + MediaType responseMediaType; + if (acceptHeader == null || MediaType.WILDCARD.equals(acceptHeader)) { + responseMediaType = DEFAULT_CONTENT_TYPE; + } else { + responseMediaType = MediaType.valueOf(acceptHeader); + } + + return responseMediaType; + } } diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/beans/EnrollmentCertificate.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/beans/EnrollmentCertificate.java new file mode 100644 index 000000000..bde1cf1a7 --- /dev/null +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/beans/EnrollmentCertificate.java @@ -0,0 +1,50 @@ +/* + * 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.carbon.mdm.beans; + +public class EnrollmentCertificate { + String serial; + String pem; + int tenantId; + + public int getTenantId() { + return tenantId; + } + + public void setTenantId(int tenantId) { + this.tenantId = tenantId; + } + + public String getSerial() { + return serial; + } + + public void setSerial(String serial) { + this.serial = serial; + } + + public String getPem() { + return pem; + } + + public void setPem(String pem) { + this.pem = pem; + } + +} diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/beans/UserWrapper.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/beans/UserWrapper.java index 0e4778d23..acdb9efca 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/beans/UserWrapper.java +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/beans/UserWrapper.java @@ -1,17 +1,17 @@ /* - * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * 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 + * 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 + * "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. */ @@ -84,4 +84,4 @@ public class UserWrapper { public void setPassword(String password) { this.password = password; } -} +} \ No newline at end of file diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/exception/BadRequestException.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/exception/BadRequestException.java new file mode 100644 index 000000000..adbe78069 --- /dev/null +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/exception/BadRequestException.java @@ -0,0 +1,31 @@ +/* + * 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.carbon.mdm.exception; + +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +public class BadRequestException extends WebApplicationException { + + public BadRequestException(Message message, MediaType mediaType) { + super(Response.status(Response.Status.BAD_REQUEST).entity(message).type(mediaType).build()); + } + +} \ No newline at end of file diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/exception/Message.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/exception/Message.java new file mode 100644 index 000000000..4d5ee2ded --- /dev/null +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/java/org/wso2/carbon/mdm/exception/Message.java @@ -0,0 +1,41 @@ +/* + * 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.carbon.mdm.exception; + +public class Message { + + private String errorMessage; + private String discription; + + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + public String getDiscription() { + return discription; + } + + public void setDiscription(String discription) { + this.discription = discription; + } +} \ No newline at end of file diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/webapp/META-INF/permissions.xml b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/webapp/META-INF/permissions.xml index 0e11fe9ba..0d5ae5347 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/webapp/META-INF/permissions.xml +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/webapp/META-INF/permissions.xml @@ -30,165 +30,305 @@ + + + Device Management + /device-mgt + / + GET + + + + Device Management Admin + /device-mgt/emm-admin + / + GET + + + + Device Management User + /device-mgt/user + / + GET + + + + Devices + /device-mgt/emm-admin/devices + / + GET + + + + Policies + /device-mgt/emm-admin/policies + / + GET + + + + Notifications + /device-mgt/emm-admin/notifications + / + GET + + + + Users + /device-mgt/emm-admin/users + / + GET + + + + Operations + /device-mgt/emm-admin/operations + / + GET + + + + Applications + /device-mgt/emm-admin/operations/applications + / + GET + + - Get all devices - /device-mgt/devices/list + Roles + /device-mgt/emm-admin/roles + / + GET + + + + Configurations + /device-mgt/emm-admin/platform-configs + / + GET + + + + View Dashboard + /device-mgt/emm-admin/dashboard + / + GET + + + + List devices + /device-mgt/emm-admin/devices/list /devices GET - emm_admin - Get all device types - /device-mgt/devices/types + List devices + /device-mgt/emm-admin/devices/list + /devices/types + GET + + + + Add policy + /device-mgt/emm-admin/policies/add + /devices/types + GET + + + + Edit policy + /device-mgt/emm-admin/policies/update /devices/types GET - emm_admin View device - /device-mgt/devices/view + /device-mgt/emm-admin/devices/view /devices/view GET - emm_admin - Get device - /device-mgt/devices/view - /devices/*/* + View device + /device-mgt/user/devices/view + /devices/view GET - emm_admin,emm_user + + + + + + + + - Get users' devices - /device-mgt/devices/view + View device + /device-mgt/emm-admin/devices/view /devices/user/*/* GET - emm_admin,emm_user - Get device count - /device-mgt/devices/count + List devices + /device-mgt/emm-admin/devices/list /devices/count GET - emm_admin - Get all users' devices - /device-mgt/devices/list + List devices + /device-mgt/emm-admin/devices/list /devices/name/*/* GET - emm_admin,emm_user - Get all notifications - /device-mgt/notifications/view + View notifications + /device-mgt/emm-admin/notifications/view /notifications GET - emm_admin Add notification - /device-mgt/notifications/add + /device-mgt/emm-admin/notifications/add /notifications POST - emm_admin Update notification - /device-mgt/notifications/view + /device-mgt/emm-admin/notifications/update /notifications/*/* PUT - emm_admin - Get new notifications - /device-mgt/notifications/view + View notifications + /device-mgt/emm-admin/notifications/view /notifications/* GET - emm_admin - Get all operations - /device-mgt/operations/view + View user + /device-mgt/emm-admin/users/view /operations GET - emm_admin - Add Operation - /device-mgt/operations/add + Install application + /device-mgt/emm-admin/operations/applications/install-applications /operations POST - emm_admin - Install Application - /device-mgt/operations/application/install + Install application + /device-mgt/emm-admin/operations/applications/install-applications /operations/installApp/* POST - emm_admin,emm_user - Uninstall Application - /device-mgt/operations/application/uninstall + Uninstall application + /device-mgt/emm-admin/operations/applications/uninstall-applications /operations/uninstallApp/* POST - emm_admin,emm_user - Get Applications For Devices - /device-mgt/operations/application/view + View application + /device-mgt/emm-admin/operations/applications/view-applications /operations/*/*/* GET - emm_admin,emm_user + - Get Device Operations - /device-mgt/operations/view + View devices + /device-mgt/user/devices/view + /operations/*/*/* + GET + + + + View device + /device-mgt/emm-admin/devices/view + /operations/*/*/* + GET + + + + View device + /device-mgt/emm-admin/devices/view /operations/*/* GET - emm_admin,emm_user - Get Applications For Device Type - /device-mgt/operations/application/view - /operations/* + View device + /device-mgt/emm-admin/devices/view + /operations/paginate/*/* + GET + + + + View device + /device-mgt/user/devices/view + /operations/*/* GET - emm_admin,emm_user + + + View device + /device-mgt/user/devices/view + /operations/paginate/*/* + GET + + + + + + + + + - Get features - /device-mgt/features/view + List policies + /device-mgt/emm-admin/policies/list /features/* GET - emm_admin + - Get all features - /device-mgt/features/view + View device + /device-mgt/emm-admin/devices/view + /features/* + GET + + + + View device + /device-mgt/user/devices/view + /features/* + GET + + + + View device + /device-mgt/user/devices/view /features GET emm_admin @@ -197,328 +337,438 @@ - Get all roles - /device-mgt/roles + List roles + /device-mgt/emm-admin/roles/list /roles GET - emm_admin + - Get role permissions - /device-mgt/roles - /roles/permissions + View user + /device-mgt/emm-admin/users/view + /roles GET - emm_admin + - Get User roles - /device-mgt/roles - /roles/* + Add policy + /device-mgt/emm-admin/policies/add + /roles GET - emm_admin + - Update User roles - /device-mgt/roles/update + Update policy + /device-mgt/emm-admin/policies/update /roles - PUT - emm_admin + GET + + + + List roles + /device-mgt/emm-admin/roles/list + /roles/permissions + GET + - Update a specific role - /device-mgt/roles/update + List roles + /device-mgt/emm-admin/roles/list /roles/* + GET + + + + Add user + /device-mgt/emm-admin/users/add + /roles/* + GET + + + + Update role + /device-mgt/emm-admin/roles/update + /roles PUT - emm_admin + + + + + + + + + - Update User roles - /device-mgt/roles - /roles/*/users + Update role + /device-mgt/emm-admin/roles/update + /roles/users PUT - emm_admin + - Save User roles - /device-mgt/roles/add + Add role + /device-mgt/emm-admin/roles/add /roles POST - emm_admin + - Delete User roles - /device-mgt/roles/delete + Remove role + /device-mgt/emm-admin/roles/remove /roles DELETE - emm_admin + + + + List roles + /device-mgt/emm-admin/roles/list + /roles/count + GET - Get all users - /device-mgt/users/view + List users + /device-mgt/emm-admin/users/list /users GET - emm_admin + Add user - /device-mgt/users/add + /device-mgt/emm-admin/users/add /users POST - emm_admin + - Get user - /device-mgt/users/view + View user + /device-mgt/emm-admin/users/view /users/view GET - emm_admin + Update user - /device-mgt/users/update + /device-mgt/emm-admin/users/update /users PUT - emm_admin + Change user password - /device-mgt/users/reset-password - /users/reset-password + /login + /users/change-password POST emm_admin + + + Reset password + /device-mgt/emm-admin/users/password-reset + /users/reset-password + POST + + - Delete user - /device-mgt/users/delete + Remove user + /device-mgt/emm-admin/users/remove /users DELETE - emm_admin + - Get user roles by name - /device-mgt/users/roles + View user + /device-mgt/emm-admin/users/view /users/roles GET - emm_admin + + + + + + + + - Get user roles by name - /device-mgt/users/roles + Add user + /device-mgt/emm-admin/users/add /roles - GET - emm_admin + POST + - Save Roles - /device-mgt/users/roles - /roles - POST - emm_admin + List devices + /device-mgt/user/devices/list + /users/devices + GET + - Get all devices of user - /device-mgt/users/devices + List devices + /device-mgt/emm-admin/devices/list /users/devices GET - emm_admin + - Get user roles - /device-mgt/users/roles + View user + /device-mgt/emm-admin/users/view /users/*/* GET - emm_admin + - Get user count - /device-mgt/users/view + List users + /device-mgt/emm-admin/users/list /users/count GET - emm_admin + - Get all user names - /device-mgt/users/view + List users + /device-mgt/emm-admin/users/list + /users/view-users + GET + + + + Add role + /device-mgt/emm-admin/roles/add + /users/view-users + GET + + + + Update role + /device-mgt/emm-admin/roles/update /users/view-users GET - emm_admin + - Get all usernames - /device-mgt/users/view + Add policy + /device-mgt/emm-admin/policies/add + /users/view-users + GET + + + + Update policy + /device-mgt/emm-admin/policies/update + /users/view-users + GET + + + + List users + /device-mgt/emm-admin/users/list /users/users-by-username GET - emm_admin + - Get filtered usernames - /device-mgt/users/view + List users + /device-mgt/emm-admin/users/list /users/users-by-username/* GET - emm_admin + - Send invitation - /device-mgt/users/invite + Invite user + /device-mgt/emm-admin/users/invite /users/email-invitation POST - emm_admin + + + + Authorize user + /login + /users/authorize + POST Add Policy - /device-mgt/policies/add + /device-mgt/emm-admin/policies/add /policies/inactive-policy POST - emm_admin + - Get Policy For Device - /device-mgt/policies/view + List policies + /device-mgt/emm-admin/policies/list /policies/*/* POST - emm_admin + - Get Policy For Device By Type - /device-mgt/policies/view + List policies + /device-mgt/emm-admin/policies/list + /policies/*/*/* + GET + + + + View device + /device-mgt/emm-admin/devices/view + /policies/*/*/* + GET + + + + View device + /device-mgt/user/devices/view /policies/*/*/* GET - emm_admin + - Add Active Policy - /device-mgt/policies/add + Add policy + /device-mgt/emm-admin/policies/add /policies/active-policy POST - emm_admin + - Bulk Policy Removal - /device-mgt/policies/bulk-remove + Remove policy + /device-mgt/emm-admin/policies/remove /policies/bulk-remove POST - emm_admin + - Get Policies - /device-mgt/policies/view + List policies + /device-mgt/emm-admin/policies/list /policies GET - emm_admin + - Get Policy - /device-mgt/policies/view + List policies + /device-mgt/emm-admin/policies/list /policies/* GET - emm_admin + - Update Policy - /device-mgt/policies/update + Update policy + /device-mgt/emm-admin/policies/update /policies/* PUT - emm_admin + - Delete Policy - /device-mgt/policies/delete + Remove policy + /device-mgt/emm-admin/policies/remove /policies DELETE - emm_admin + - Policy Count - /device-mgt/policies/view + List policies + /device-mgt/emm-admin/policies/list /policies/count GET - emm_admin + - Policy priorities - /device-mgt/policies/update + Edit policy + /device-mgt/emm-admin/policies/update /policies/priorities PUT - emm_admin + - Activate Policy - /device-mgt/policies/update + Edit policy + /device-mgt/emm-admin/policies/update /policies/activate PUT - emm_admin + - Inactivate Policy - /device-mgt/policies/update + Add policy + /device-mgt/emm-admin/policies/add + /policies/activate + PUT + + + + Edit policy + /device-mgt/emm-admin/policies/update /policies/inactivate PUT - emm_admin + + + Add policy + /device-mgt/emm-admin/policies/add + /policies/inactivate + PUT + + - Apply Policy changes - /device-mgt/policies/update + Edit policy + /device-mgt/emm-admin/policies/update /policies/apply-changes PUT - emm_admin + - Start Task - /device-mgt/policies/task + Add policy + /device-mgt/emm-admin/policies/add /policies/start-task/* GET - emm_admin + - Update Task - /device-mgt/policies/task + Add policy + /device-mgt/emm-admin/policies/add /policies/update-task/* GET - emm_admin + - Stop Task - /device-mgt/policies/task + Add policy + /device-mgt/emm-admin/policies/add /policies/stop-task GET - emm_admin + - Get Policy Compliance - /device-mgt/policies/compliance + List policies + /device-mgt/emm-admin/policies/list /policies/*/* GET - emm_admin - Add profile - /device-mgt/profiles/add + Add policy + /device-mgt/emm-admin/policies/add /profiles POST - emm_admin + - Update profile - /device-mgt/profiles/update + Edit policy + /device-mgt/emm-admin/policies/update /profiles/* PUT - emm_admin + - Add profile - /device-mgt/profiles/delete + Remove policy + /device-mgt/emm-admin/policies/remove /profiles/* DELETE - emm_admin @@ -541,25 +791,49 @@ - Get configuration - /device-mgt/tenant/configuration/view + View configuration + /device-mgt/emm-admin/platform-configs/view /configuration GET - emm_admin + Add configuration - /device-mgt/tenant/configuration/modify + /device-mgt/emm-admin/platform-configs/add /configuration POST - emm_admin + Update configuration - /device-mgt/tenant/configuration/modify + /device-mgt/emm-admin/platform-configs/modify /configuration PUT - emm_admin + + + + + Save certificate in the database + /device-mgt/android/certificate/save + /certificates/saveCertificate + POST + emm_admin + + + get certificate in the database + /device-mgt/android/certificate/Get + /certificates/* + GET + emm_admin + + + get certificate in the database + /device-mgt/android/certificate/Get + /certificates/* + DELETE + emm_admin + + \ No newline at end of file diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/webapp/WEB-INF/cxf-servlet.xml index dc53a029b..5db3ba522 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.api/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -1,6 +1,6 @@ @@ -105,6 +105,15 @@ + + + + + + + + + @@ -133,6 +142,7 @@ + diff --git a/components/mobile-plugins/mobile-base-plugin/pom.xml b/components/mobile-plugins/mobile-base-plugin/pom.xml index 94ae0d56a..212c8f78b 100644 --- a/components/mobile-plugins/mobile-base-plugin/pom.xml +++ b/components/mobile-plugins/mobile-base-plugin/pom.xml @@ -1,21 +1,21 @@ + ~ 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. + --> @@ -34,8 +34,8 @@ org.wso2.carbon.device.mgt.mobile - - + org.wso2.carbon.device.mgt.mobile.api + org.wso2.carbon.device.mgt.mobile.ui org.wso2.carbon.device.mgt.mobile.url.printer diff --git a/components/mobile-plugins/pom.xml b/components/mobile-plugins/pom.xml index 898aded05..fd8749a3e 100644 --- a/components/mobile-plugins/pom.xml +++ b/components/mobile-plugins/pom.xml @@ -1,21 +1,21 @@ + ~ 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. + --> @@ -33,8 +33,8 @@ http://wso2.org - - + android-plugin + windows-plugin mobile-base-plugin diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.agent/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/discovery/beans/package-info.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.agent/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/discovery/beans/package-info.java deleted file mode 100644 index df5d15392..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.agent/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/discovery/beans/package-info.java +++ /dev/null @@ -1,22 +0,0 @@ -/* -* 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. -*/ - -@javax.xml.bind.annotation.XmlSchema(namespace = - "http://schemas.microsoft.com/windows/management/2012/01/enrollment", - elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) -package org.wso2.carbon.mdm.mobileservices.windows.services.discovery.beans; diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.agent/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/wstep/beans/package-info.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.agent/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/wstep/beans/package-info.java deleted file mode 100644 index 47dd02949..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.agent/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/wstep/beans/package-info.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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. - */ - -@XmlSchema(namespace = "http://www.w3.org/2003/05/soap-envelope", - xmlns = { - @XmlNs(prefix = "", namespaceURI = "http://www.w3.org/2003/05/soap-envelope") - }, elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) - -package org.wso2.carbon.mdm.mobileservices.windows.services.wstep.beans; - -import javax.xml.bind.annotation.XmlNs; -import javax.xml.bind.annotation.XmlSchema; \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.agent/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/xcep/beans/package-info.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.agent/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/xcep/beans/package-info.java deleted file mode 100644 index f3c0f5b58..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.agent/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/xcep/beans/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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. - */ - -@javax.xml.bind.annotation.XmlSchema(namespace = "http://schemas.microsoft" + - ".com/windows/pki/2009/01/enrollmentpolicy", - elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) - -package org.wso2.carbon.mdm.mobileservices.windows.services.xcep.beans; diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.agent/src/main/resources/properties.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.agent/src/main/resources/properties.xml deleted file mode 100644 index 7df287f68..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.agent/src/main/resources/properties.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - Federated - wso2carbon - cacert - CN=mdmcn - 3 - 300 - wso2.com - \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.agent/pom.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml similarity index 98% rename from components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.agent/pom.xml rename to components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml index 8ee9a2c23..f5f7dcabd 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.agent/pom.xml +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml @@ -1,5 +1,5 @@ + + Federated + wso2carbon + cacert + CN=mdmcn + 3 + 300 + wso2.com + \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.agent/src/main/resources/wap-provisioning.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/resources/wap-provisioning.xml similarity index 85% rename from components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.agent/src/main/resources/wap-provisioning.xml rename to components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/resources/wap-provisioning.xml index e6729e0f4..9a6561b45 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.agent/src/main/resources/wap-provisioning.xml +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/resources/wap-provisioning.xml @@ -1,19 +1,19 @@ diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.agent/src/main/resources/wso2mdm.jks b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/resources/wso2mdm.jks similarity index 100% rename from components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.agent/src/main/resources/wso2mdm.jks rename to components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/resources/wso2mdm.jks diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.agent/src/main/webapp/META-INF/permissions.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/META-INF/permissions.xml similarity index 95% rename from components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.agent/src/main/webapp/META-INF/permissions.xml rename to components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/META-INF/permissions.xml index feb34b098..1a69d570d 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.agent/src/main/webapp/META-INF/permissions.xml +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/META-INF/permissions.xml @@ -1,18 +1,18 @@ diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.agent/src/main/webapp/META-INF/webapp-classloading.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/META-INF/webapp-classloading.xml similarity index 55% rename from components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.agent/src/main/webapp/META-INF/webapp-classloading.xml rename to components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/META-INF/webapp-classloading.xml index 0371f7c29..c90403cc6 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.agent/src/main/webapp/META-INF/webapp-classloading.xml +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/META-INF/webapp-classloading.xml @@ -1,21 +1,21 @@ + + + + + + + windows-plugin + org.wso2.carbon.devicemgt-plugins + 2.1.0-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon.device.mgt.mobile.windows.ui + 2.1.0-SNAPSHOT + WSO2 Carbon - Mobile Windows UI + pom + + + + + maven-assembly-plugin + 2.5.5 + + ${project.artifactId}-${carbon.device.mgt.version} + false + + src/assembly/src.xml + + + + + create-archive + package + + single + + + + + + + + \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/assembly/src.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/assembly/src.xml new file mode 100644 index 000000000..2797034e0 --- /dev/null +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/assembly/src.xml @@ -0,0 +1,36 @@ + + + + src + + zip + + false + ${basedir}/src + + + ${basedir}/src/main/resources/jaggeryapps/devicemgt + / + true + + + \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.hbs new file mode 100644 index 000000000..cfdb0ed54 --- /dev/null +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.hbs @@ -0,0 +1,14 @@ +{{#zone "device-opetations"}} +
+ Operations +
+
+ {{unit "mdm.unit.device.operation-bar"}} +
+{{/zone}} + +{{#zone "bottomJs"}} + {{js "js/device-detail.js"}} + + {{js "js/load-map.js"}} +{{/zone}} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.json new file mode 100644 index 000000000..9eecd8f5b --- /dev/null +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.json @@ -0,0 +1,3 @@ +{ + "version": "1.0.0" +} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/js/device-detail.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/js/device-detail.js new file mode 100644 index 000000000..aa2384fc3 --- /dev/null +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/js/device-detail.js @@ -0,0 +1,197 @@ +/* + * 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 () { + var deviceId = $(".device-id"); + var deviceIdentifier = deviceId.data("deviceid"); + var deviceType = deviceId.data("type"); + var payload = [deviceIdentifier]; + var operationTable; + if (deviceType == "ios") { + var serviceUrl = "/ios/operation/deviceinfo"; + } else if (deviceType == "android") { + var serviceUrl = "/mdm-android-agent/operation/device-info"; + } + if (serviceUrl) { + invokerUtil.post(serviceUrl, payload, + function (message) { + console.log(message); + }, function (message) { + console.log(message); + }); + } + $(document).ready(function () { + $(".panel-body").removeClass("hidden"); + $("#loading-content").remove(); + + loadOperationsLog(); + loadApplicationsList(); + loadPolicyCompliance(); + + $("#refresh-policy").click(function () { + $('#policy-spinner').removeClass('hidden'); + loadPolicyCompliance(); + }); + + $("#refresh-apps").click(function () { + $('#apps-spinner').removeClass('hidden'); + loadApplicationsList(); + }); + + $("#refresh-operations").click(function () { + $('#operations-spinner').removeClass('hidden'); + loadOperationsLog(true); + }); + loadOperationBar(deviceType); + }); + + function loadOperationsLog(update) { + var operationsLog = $("#operations-log"); + var deviceListingSrc = operationsLog.attr("src"); + var deviceId = operationsLog.data("device-id"); + var deviceType = operationsLog.data("device-type"); + + $.template("operations-log", deviceListingSrc, function (template) { + var serviceURL = "/devicemgt_admin/operations/" + deviceType + "/" + deviceId; + + var successCallback = function (data) { + data = JSON.parse(data); + $('#operations-spinner').addClass('hidden'); + var viewModel = {}; + viewModel.operations = data; + if (data.length > 0) { + var content = template(viewModel); + if (!update) { + $("#operations-log-container").html(content); + operationTable = $('#operations-log-table').datatables_extended(); + } else { + $('#operations-log-table').dataTable().fnClearTable(); + for (var i = 0; i < data.length; i++) { + var status; + if (data[i].status == "COMPLETED") { + status = " Completed"; + } else if (data[i].status == "PENDING") { + status = " Pending"; + } else if (data[i].status == "ERROR") { + status = " Error"; + } else if (data[i].status == "IN_PROGRESS") { + status = " In Progress"; + } + + $('#operations-log-table').dataTable().fnAddData([ + data[i].code, + status, + data[i].createdTimeStamp + ]); + } + } + } + + }; + invokerUtil.get(serviceURL, + successCallback, function (message) { + console.log(message); + }); + }); + + } + + function loadApplicationsList() { + var applicationsList = $("#applications-list"); + var deviceListingSrc = applicationsList.attr("src"); + var deviceId = applicationsList.data("device-id"); + var deviceType = applicationsList.data("device-type"); + + $.template("application-list", deviceListingSrc, function (template) { + var serviceURL = "/devicemgt_admin/operations/" + deviceType + "/" + deviceId + "/apps"; + + var successCallback = function (data) { + data = JSON.parse(data); + $('#apps-spinner').addClass('hidden'); + var viewModel = {}; + if (data != null && data.length > 0) { + for (var i = 0; i < data.length; i++) { + data[i].name = data[i].name.replace(/[^\w\s]/gi, ' '); + data[i].name = data[i].name.replace(/[0-9]/g, ' '); + } + } + viewModel.applications = data; + viewModel.deviceType = deviceType; + if (data.length > 0) { + var content = template(viewModel); + $("#applications-list-container").html(content); + } + + }; + invokerUtil.get(serviceURL, + successCallback, function (message) { + console.log(message); + }); + }); + } + + function loadPolicyCompliance() { + var policyCompliance = $("#policy-view"); + var policySrc = policyCompliance.attr("src"); + var deviceId = policyCompliance.data("device-id"); + var deviceType = policyCompliance.data("device-type"); + var activePolicy = null; + + $.template("policy-view", policySrc, function (template) { + var serviceURLPolicy = "/devicemgt_admin/policies/" + deviceType + "/" + deviceId + "/active-policy" + var serviceURLCompliance = "/devicemgt_admin/policies/" + deviceType + "/" + deviceId; + + var successCallbackCompliance = function (data) { + var viewModel = {}; + viewModel.policy = activePolicy; + viewModel.deviceType = deviceType; + if (data != null && data.complianceFeatures != null && data.complianceFeatures != undefined && data.complianceFeatures.length > 0) { + viewModel.compliance = "NON-COMPLIANT"; + viewModel.complianceFeatures = data.complianceFeatures; + var content = template(viewModel); + $("#policy-list-container").html(content); + } else { + viewModel.compliance = "COMPLIANT"; + var content = template(viewModel); + $("#policy-list-container").html(content); + $("#policy-compliance-table").addClass("hidden"); + } + + }; + + var successCallbackPolicy = function (data) { + data = JSON.parse(data); + $('#policy-spinner').addClass('hidden'); + if (data != null && data.active == true) { + activePolicy = data; + invokerUtil.get(serviceURLCompliance, + successCallbackCompliance, function (message) { + console.log(message); + }); + } + }; + + invokerUtil.get(serviceURLPolicy, + successCallbackPolicy, function (message) { + console.log(message); + }); + }); + + } + +}()); diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/js/load-map.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/js/load-map.js new file mode 100644 index 000000000..a2a322f8c --- /dev/null +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/js/load-map.js @@ -0,0 +1,56 @@ +/* + * 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. + */ + +$(document).ready(function () { + if (document.getElementById('device-location')) { + loadMap(); + } +}); + +function loadMap() { + var map; + + function initialize() { + var mapOptions = { + zoom: 18 + }; + var lat = $("#device-location").data("lat"); + var long = $("#device-location").data("long"); + + if (lat != null && lat != undefined && lat != "" && long != null && long != undefined && long != "") { + $("#map-error").hide(); + $("#device-location").show(); + map = new google.maps.Map(document.getElementById('device-location'), + mapOptions); + + var pos = new google.maps.LatLng(lat, long); + var marker = new google.maps.Marker({ + position: pos, + map: map + }); + + map.setCenter(pos); + } else { + $("#device-location").hide(); + $("#map-error").show(); + } + + } + + google.maps.event.addDomListener(window, 'load', initialize); +} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-edit/policy-edit.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-edit/policy-edit.hbs new file mode 100644 index 000000000..c4bb415a1 --- /dev/null +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-edit/policy-edit.hbs @@ -0,0 +1 @@ +{{unit "mdm.unit.policy.edit"}} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-edit/policy-edit.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-edit/policy-edit.json new file mode 100644 index 000000000..9eecd8f5b --- /dev/null +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-edit/policy-edit.json @@ -0,0 +1,3 @@ +{ + "version": "1.0.0" +} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-view/policy-view.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-view/policy-view.hbs new file mode 100644 index 000000000..12cffe6bd --- /dev/null +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-view/policy-view.hbs @@ -0,0 +1 @@ +{{unit "mdm.unit.policy.view"}} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-view/policy-view.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-view/policy-view.json new file mode 100644 index 000000000..9eecd8f5b --- /dev/null +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-view/policy-view.json @@ -0,0 +1,3 @@ +{ + "version": "1.0.0" +} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-wizard/policy-wizard.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-wizard/policy-wizard.hbs new file mode 100644 index 000000000..0669d1ca6 --- /dev/null +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-wizard/policy-wizard.hbs @@ -0,0 +1 @@ +{{unit "mdm.unit.policy.wizard"}} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-wizard/policy-wizard.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-wizard/policy-wizard.json new file mode 100644 index 000000000..9eecd8f5b --- /dev/null +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-wizard/policy-wizard.json @@ -0,0 +1,3 @@ +{ + "version": "1.0.0" +} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/public/images/thumb.png b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/public/images/thumb.png new file mode 100644 index 000000000..f4541a6ec Binary files /dev/null and b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/public/images/thumb.png differ diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/public/images/windows-icon.png b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/public/images/windows-icon.png new file mode 100644 index 000000000..d7cd5ecef Binary files /dev/null and b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/public/images/windows-icon.png differ diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/public/images/windows_enrollment.png b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/public/images/windows_enrollment.png new file mode 100644 index 000000000..17b2102e3 Binary files /dev/null and b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/public/images/windows_enrollment.png differ diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/type-view.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/type-view.hbs new file mode 100644 index 000000000..ad002615c --- /dev/null +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/type-view.hbs @@ -0,0 +1,151 @@ +
+

Windows Mobile

+
+
+
+ +
+ +
+ +
+ +
+ +

What it Does

+
+

Connect and manage your Windows device with WSO2 IoT Server.

+
+ +

What You Need

+
+
    +
  • STEP 01   Windows + Mobile. +
  • +
  • STEP 02   Go ahead + and click [Enroll Device]. +
  • +
  • STEP 03   Proceed + to [Prepare] section. +
  • +
+
+ + + Enroll Device + +

+
+ +
+

Prepare

+
+
    +
  • 01 Scan QR code.
  • +
  • 02 Follow instructions in wizard. +
  • +
  • 03 Configure your workspace + account +
  • +
+
+ +
+ +
+

Click on the image to zoom

+
+ + + +
+
+ +
+ + + +{{#zone "topCss"}} + +{{/zone}} + +{{#zone "bottomJs"}} + +{{/zone}} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/type-view.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/type-view.js new file mode 100644 index 000000000..ad4f0ec9c --- /dev/null +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/type-view.js @@ -0,0 +1,24 @@ +/* + * 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 viewModel = {}; + var devicemgtProps = require('/app/conf/devicemgt-props.js').config(); + viewModel.hostName = devicemgtProps["httpsURL"]; + return viewModel; +} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/type-view.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/type-view.json new file mode 100644 index 000000000..9eecd8f5b --- /dev/null +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/type-view.json @@ -0,0 +1,3 @@ +{ + "version": "1.0.0" +} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/impl/WindowsDeviceManagementService.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/impl/WindowsDeviceManagementService.java index 36d3bb963..366fda747 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/impl/WindowsDeviceManagementService.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/impl/WindowsDeviceManagementService.java @@ -1,17 +1,17 @@ /* - * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * 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 + * 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 + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -36,23 +36,12 @@ public class WindowsDeviceManagementService implements DeviceManagementService { private DeviceManager deviceManager; public static final String DEVICE_TYPE_WINDOWS = "windows"; - public static final String DEVICE_TYPE_TENANT = "carbon.super"; @Override public String getType() { return WindowsDeviceManagementService.DEVICE_TYPE_WINDOWS; } - @Override - public String getProviderTenantDomain() { - return DEVICE_TYPE_TENANT; - } - - @Override - public boolean isSharedWithAllTenants() { - return true; - } - @Override public void init() throws DeviceManagementException { this.deviceManager = new WindowsDeviceManager(); diff --git a/components/mobile-plugins/windows-plugin/pom.xml b/components/mobile-plugins/windows-plugin/pom.xml index e5de76e61..17507c4ca 100644 --- a/components/mobile-plugins/windows-plugin/pom.xml +++ b/components/mobile-plugins/windows-plugin/pom.xml @@ -1,21 +1,21 @@ + ~ 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. + --> @@ -27,7 +27,6 @@ 4.0.0 - org.wso2.carbon.devicemgt-plugins windows-plugin pom WSO2 Carbon - Mobile Plugins @@ -35,7 +34,8 @@ org.wso2.carbon.device.mgt.mobile.windows - org.wso2.carbon.device.mgt.mobile.windows.agent + org.wso2.carbon.device.mgt.mobile.windows.api + org.wso2.carbon.device.mgt.mobile.windows.ui diff --git a/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/pom.xml b/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/pom.xml new file mode 100644 index 000000000..7d94f16e3 --- /dev/null +++ b/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/pom.xml @@ -0,0 +1,192 @@ + + + + + + + + org.wso2.carbon.devicemgt-plugins + iot-base-plugin-feature + 2.1.0-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon.device.mgt.iot.feature + pom + 2.1.0-SNAPSHOT + WSO2 Carbon - IoT Device Management Feature + http://wso2.org + This feature contains the core bundles required for IoT Server + + + + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.device.mgt.iot + + + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.device.mgt.iot.api + war + + + org.json.wso2 + json + + + + org.igniterealtime.smack.wso2 + smack + + + org.igniterealtime.smack.wso2 + smackx + + + net.sf.ehcache.wso2 + ehcache + 1.5.0.wso2v3 + + + + + + + maven-resources-plugin + + + copy-resources + generate-resources + + copy-resources + + + src/main/resources + + + resources + + build.properties + p2.inf + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack + package + + unpack + + + + + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.device.mgt.iot.ui + + ${project.version} + zip + true + + ${project.build.directory}/maven-shared-archive-resources/jaggeryapps/devicemgt + + **/* + + + + + + copy + package + + copy + + + + + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.device.mgt.iot.api + war + true + ${project.build.directory}/maven-shared-archive-resources/webapps/ + common.war + + + + + + + + org.wso2.maven + carbon-p2-plugin + ${carbon.p2.plugin.version} + + + p2-feature-generation + package + + p2-feature-gen + + + org.wso2.carbon.device.mgt.iot + ../../../features/etc/feature.properties + + + org.wso2.carbon.p2.category.type:server + org.eclipse.equinox.p2.type.group:false + + + + + org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.iot:${carbon.devicemgt.plugins.version} + + + org.json.wso2:json:${commons-json.version} + + + org.eclipse.paho:org.eclipse.paho.client.mqttv3:${eclipse.paho.version} + + + org.igniterealtime.smack.wso2:smack:${smack.wso2.version} + + + org.igniterealtime.smack.wso2:smackx:${smackx.wso2.version} + + + + org.wso2.carbon.core.server:${carbon.kernel.version} + + org.wso2.carbon.device.mgt.server:${carbon.device.mgt.version} + + + + + + + + + diff --git a/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/build.properties b/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/build.properties new file mode 100644 index 000000000..33bb0980d --- /dev/null +++ b/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/build.properties @@ -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. +# + +custom = true diff --git a/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/conf/devicemgt-config.xml b/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/conf/devicemgt-config.xml new file mode 100644 index 000000000..b245214be --- /dev/null +++ b/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/conf/devicemgt-config.xml @@ -0,0 +1,45 @@ + + + + + + + MQTT + true + org.wso2.carbon.device.mgt.iot.controlqueue.mqtt.MqttControlPublisher + MQTT + + tcp://localhost + 1883 + admin + admin + + + + XMPP + false + org.wso2.carbon.device.mgt.iot.controlqueue.xmpp.XmppServerClient + XMPP + http://204.232.188.215 + 9090 + admin + wso2iot123 + + + diff --git a/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/conf/devicemgt-config.xsd b/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/conf/devicemgt-config.xsd new file mode 100644 index 000000000..99b00269e --- /dev/null +++ b/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/conf/devicemgt-config.xsd @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/p2.inf b/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/p2.inf new file mode 100644 index 000000000..77c750196 --- /dev/null +++ b/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/p2.inf @@ -0,0 +1,8 @@ +instructions.configure = \ +org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/webapps/);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot_${feature.version}/webapps/,target:${installFolder}/../../deployment/server/webapps/,overwrite:true);\ +org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/jaggeryapps/);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot_${feature.version}/jaggeryapps/,target:${installFolder}/../../deployment/server/jaggeryapps/,overwrite:true);\ +org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../conf/iot/);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot_${feature.version}/conf/devicemgt-config.xml,target:${installFolder}/../../conf/iot/devicemgt-config.xml,overwrite:true);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot_${feature.version}/conf/devicemgt-config.xsd,target:${installFolder}/../../conf/iot/devicemgt-config.xsd,overwrite:true);\ \ No newline at end of file diff --git a/features/iot-plugins-feature/iot-base-plugin-feature/pom.xml b/features/iot-plugins-feature/iot-base-plugin-feature/pom.xml new file mode 100644 index 000000000..040202a90 --- /dev/null +++ b/features/iot-plugins-feature/iot-base-plugin-feature/pom.xml @@ -0,0 +1,40 @@ + + + + + + + org.wso2.carbon.devicemgt-plugins + iot-plugins-feature + 2.1.0-SNAPSHOT + ../pom.xml + + + 4.0.0 + iot-base-plugin-feature + 2.1.0-SNAPSHOT + pom + WSO2 Carbon - Device Management IoT Base Plugin Feature + http://wso2.org + + + org.wso2.carbon.device.mgt.iot.feature + + + diff --git a/features/iot-plugins-feature/pom.xml b/features/iot-plugins-feature/pom.xml new file mode 100644 index 000000000..c1ebe4604 --- /dev/null +++ b/features/iot-plugins-feature/pom.xml @@ -0,0 +1,40 @@ + + + + + + + org.wso2.carbon.devicemgt-plugins + carbon-device-mgt-plugins-parent + 2.1.0-SNAPSHOT + ../../pom.xml + + + 4.0.0 + iot-plugins-feature + 2.1.0-SNAPSHOT + pom + WSO2 Carbon - Device Management IoT Plugins Feature + http://wso2.org + + + iot-base-plugin-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 new file mode 100644 index 000000000..364d32830 --- /dev/null +++ b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/pom.xml @@ -0,0 +1,213 @@ + + + + + + + org.wso2.carbon.devicemgt-plugins + android-plugin-feature + 2.1.0-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon.device.mgt.mobile.android.feature + pom + 2.1.0-SNAPSHOT + WSO2 Carbon - Android Device Management Feature + http://wso2.org + This feature contains the core bundles required for Android Device Management + functionality + + + + + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.device.mgt.mobile.android + + + com.h2database.wso2 + h2-database-engine + + + + + + + maven-resources-plugin + 2.6 + + + copy-resources + generate-resources + + copy-resources + + + src/main/resources + + + resources + + build.properties + p2.inf + + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack + package + + unpack + + + + + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.device.mgt.mobile.android.ui + + ${project.version} + zip + true + + ${project.build.directory}/maven-shared-archive-resources/jaggeryapps/devicemgt + + **/* + + + + + + copy-jaxrs-war + package + + copy + + + + + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.device.mgt.mobile.android.api + + war + true + ${project.build.directory}/maven-shared-archive-resources/webapps/ + + mdm-android-agent.war + + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + + + + create-android-mobile-plugin-mgt-schema + package + + run + + + + + + + + + + + + + + + + + + + + + + + + + + + org.wso2.maven + carbon-p2-plugin + ${carbon.p2.plugin.version} + + + p2-feature-generation + package + + p2-feature-gen + + + org.wso2.carbon.device.mgt.mobile.android + ../../../../features/etc/feature.properties + + + + org.wso2.carbon.p2.category.type:server + + org.eclipse.equinox.p2.type.group:false + + + + + + org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.mobile.android:${carbon.mobile.device.mgt.version} + + + + + org.wso2.carbon.core.server:${carbon.kernel.version} + + + org.wso2.carbon.device.mgt.server:${carbon.device.mgt.version} + + + + + + + + + + diff --git a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/build.properties b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/build.properties new file mode 100644 index 000000000..33bb0980d --- /dev/null +++ b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/build.properties @@ -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. +# + +custom = true diff --git a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/conf/mobile-config.xml b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/conf/mobile-config.xml new file mode 100644 index 000000000..39abe6e01 --- /dev/null +++ b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/conf/mobile-config.xml @@ -0,0 +1,71 @@ + + + + + + + + + jdbc/MobileAndroidDM_DS + + + + + jdbc/MobileWindowsDM_DS + + + + + + + + appmanager + admin + /devices + 1.0.0 + http://localhost:9763/test/app + http,https + + + enrol + admin + /enroll + 1.0.0 + http://localhost:9763/mdm-android-agent/enrollment + http,https + + + license + admin + /license + 1.0.0 + http://localhost:9763/mdm-android-agent/devices/license + http,https + + + operation + admin + /operation + 1.0.0 + http://localhost:9763/mdm-android-agent/operations + http,https + + + + diff --git a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/configs/android.json b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/configs/android.json new file mode 100644 index 000000000..3601ecb51 --- /dev/null +++ b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/configs/android.json @@ -0,0 +1,6 @@ +{ + "deviceType": { + "label": "Android", + "category" : "mobile" + } +} diff --git a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/dbscripts/plugins/h2.sql b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/dbscripts/plugins/h2.sql new file mode 100644 index 000000000..3673fd122 --- /dev/null +++ b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/dbscripts/plugins/h2.sql @@ -0,0 +1,30 @@ + +-- ----------------------------------------------------- +-- Table `AD_DEVICE` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `AD_DEVICE` ( + `DEVICE_ID` VARCHAR(45) NOT NULL, + `GCM_TOKEN` VARCHAR(1000) NULL DEFAULT NULL, + `DEVICE_INFO` VARCHAR(8000) NULL DEFAULT NULL, + `IMEI` VARCHAR(45) NULL DEFAULT NULL, + `IMSI` VARCHAR(45) NULL DEFAULT NULL, + `OS_VERSION` VARCHAR(45) NULL DEFAULT NULL, + `DEVICE_MODEL` VARCHAR(45) NULL DEFAULT NULL, + `VENDOR` VARCHAR(45) NULL DEFAULT NULL, + `LATITUDE` VARCHAR(45) NULL DEFAULT NULL, + `LONGITUDE` VARCHAR(45) NULL DEFAULT NULL, + `SERIAL` VARCHAR(45) NULL DEFAULT NULL, + `MAC_ADDRESS` VARCHAR(45) NULL DEFAULT NULL, + `DEVICE_NAME` VARCHAR(100) NULL DEFAULT NULL, + PRIMARY KEY (`DEVICE_ID`)); + +-- ----------------------------------------------------- +-- Table `AD_FEATURE` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `AD_FEATURE` ( + `ID` INT NOT NULL AUTO_INCREMENT, + `CODE` VARCHAR(45) NOT NULL, + `NAME` VARCHAR(100) NULL, + `DESCRIPTION` VARCHAR(200) NULL, + PRIMARY KEY (`ID`)); + diff --git a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/dbscripts/plugins/mssql.sql b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/dbscripts/plugins/mssql.sql new file mode 100644 index 000000000..be8caf6c4 --- /dev/null +++ b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/dbscripts/plugins/mssql.sql @@ -0,0 +1,29 @@ +-- ----------------------------------------------------- +-- Table `AD_DEVICE` +-- ----------------------------------------------------- +CREATE TABLE AD_DEVICE ( + DEVICE_ID VARCHAR(45) NOT NULL, + GCM_TOKEN VARCHAR(1000) NULL DEFAULT NULL, + DEVICE_INFO VARCHAR(8000) NULL DEFAULT NULL, + IMEI VARCHAR(45) NULL DEFAULT NULL, + IMSI VARCHAR(45) NULL DEFAULT NULL, + OS_VERSION VARCHAR(45) NULL DEFAULT NULL, + DEVICE_MODEL VARCHAR(45) NULL DEFAULT NULL, + VENDOR VARCHAR(45) NULL DEFAULT NULL, + LATITUDE VARCHAR(45) NULL DEFAULT NULL, + LONGITUDE VARCHAR(45) NULL DEFAULT NULL, + SERIAL VARCHAR(45) NULL DEFAULT NULL, + MAC_ADDRESS VARCHAR(45) NULL DEFAULT NULL, + DEVICE_NAME VARCHAR(100) NULL DEFAULT NULL, + PRIMARY KEY (DEVICE_ID)); + +-- ----------------------------------------------------- +-- Table `AD_FEATURE` +-- ----------------------------------------------------- +CREATE TABLE AD_FEATURE ( + ID INT NOT NULL IDENTITY, + CODE VARCHAR(45) NOT NULL, + NAME VARCHAR(100) NULL, + DESCRIPTION VARCHAR(200) NULL, + PRIMARY KEY (ID) +); diff --git a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/dbscripts/plugins/mysql.sql b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/dbscripts/plugins/mysql.sql new file mode 100644 index 000000000..8e85b92c2 --- /dev/null +++ b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/dbscripts/plugins/mysql.sql @@ -0,0 +1,31 @@ +-- ----------------------------------------------------- +-- Table `AD_DEVICE` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `AD_DEVICE` ( + `DEVICE_ID` VARCHAR(45) NOT NULL, + `GCM_TOKEN` VARCHAR(1000) NULL DEFAULT NULL, + `DEVICE_INFO` VARCHAR(8000) NULL DEFAULT NULL, + `IMEI` VARCHAR(45) NULL DEFAULT NULL, + `IMSI` VARCHAR(45) NULL DEFAULT NULL, + `OS_VERSION` VARCHAR(45) NULL DEFAULT NULL, + `DEVICE_MODEL` VARCHAR(45) NULL DEFAULT NULL, + `VENDOR` VARCHAR(45) NULL DEFAULT NULL, + `LATITUDE` VARCHAR(45) NULL DEFAULT NULL, + `LONGITUDE` VARCHAR(45) NULL DEFAULT NULL, + `SERIAL` VARCHAR(45) NULL DEFAULT NULL, + `MAC_ADDRESS` VARCHAR(45) NULL DEFAULT NULL, + `DEVICE_NAME` VARCHAR(100) NULL DEFAULT NULL, + PRIMARY KEY (`DEVICE_ID`)) + ENGINE = InnoDB; + +-- ----------------------------------------------------- +-- Table `AD_FEATURE` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `AD_FEATURE` ( + `ID` INT NOT NULL AUTO_INCREMENT, + `CODE` VARCHAR(45) NOT NULL, + `NAME` VARCHAR(100) NULL, + `DESCRIPTION` VARCHAR(200) NULL, + PRIMARY KEY (`ID`) + ) ENGINE = InnoDB; + diff --git a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/dbscripts/plugins/oracle.sql b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/dbscripts/plugins/oracle.sql new file mode 100644 index 000000000..1331581e7 --- /dev/null +++ b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/dbscripts/plugins/oracle.sql @@ -0,0 +1,50 @@ +-- ----------------------------------------------------- +-- Table `AD_DEVICE` +-- ----------------------------------------------------- +CREATE TABLE AD_DEVICE ( + DEVICE_ID VARCHAR(45) NOT NULL , + DEVICE_INFO VARCHAR(4000) DEFAULT NULL, + GCM_TOKEN VARCHAR(1000) DEFAULT NULL, + IMEI VARCHAR(45) DEFAULT NULL, + IMSI VARCHAR(45) DEFAULT NULL, + OS_VERSION VARCHAR(45) DEFAULT NULL, + DEVICE_MODEL VARCHAR(45) DEFAULT NULL, + VENDOR VARCHAR(45) DEFAULT NULL, + LATITUDE VARCHAR(45) DEFAULT NULL, + LONGITUDE VARCHAR(45) DEFAULT NULL, + SERIAL VARCHAR(45) DEFAULT NULL, + MAC_ADDRESS VARCHAR(45) DEFAULT NULL, + DEVICE_NAME VARCHAR(100) DEFAULT NULL, + CONSTRAINT PK_AD_DEVICE PRIMARY KEY (DEVICE_ID) +) +/ + +-- ----------------------------------------------------- +-- Table `AD_FEATURE` +-- ----------------------------------------------------- +CREATE TABLE AD_FEATURE ( + ID INT NOT NULL, + CODE VARCHAR(45) NOT NULL, + NAME VARCHAR(100) NOT NULL, + DESCRIPTION VARCHAR(200) DEFAULT NULL, + CONSTRAINT AD_FEATURE PRIMARY KEY (ID) +) +/ + +-- ----------------------------------------------------- +-- Sequence `AD_FEATURE_ID_INC_SEQ` +-- ----------------------------------------------------- +CREATE SEQUENCE AD_FEATURE_ID_INC_SEQ START WITH 1 INCREMENT BY 1 NOCACHE +/ +-- ----------------------------------------------------- +-- Trigger `AD_FEATURE_ID_INC_TRIG` +-- ----------------------------------------------------- +CREATE OR REPLACE TRIGGER AD_FEATURE_ID_INC_TRIG +BEFORE INSERT +ON AD_FEATURE +REFERENCING NEW AS NEW +FOR EACH ROW + BEGIN + SELECT AD_FEATURE_ID_INC_SEQ.NEXTVAL INTO :NEW.ID FROM DUAL; + END; +/ \ No newline at end of file diff --git a/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/dbscripts/plugins/postgresql.sql b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/dbscripts/plugins/postgresql.sql new file mode 100644 index 000000000..e4512c53f --- /dev/null +++ b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/dbscripts/plugins/postgresql.sql @@ -0,0 +1,29 @@ +-- ----------------------------------------------------- +-- Table AD_DEVICE +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS AD_DEVICE ( + DEVICE_ID VARCHAR(45) NOT NULL , + DEVICE_INFO TEXT NULL DEFAULT NULL, + GCM_TOKEN VARCHAR(1000) NULL DEFAULT NULL, + IMEI VARCHAR(45) NULL DEFAULT NULL, + IMSI VARCHAR(45) NULL DEFAULT NULL, + OS_VERSION VARCHAR(45) NULL DEFAULT NULL, + DEVICE_MODEL VARCHAR(45) NULL DEFAULT NULL, + VENDOR VARCHAR(45) NULL DEFAULT NULL, + LATITUDE VARCHAR(45) NULL DEFAULT NULL, + LONGITUDE VARCHAR(45) NULL DEFAULT NULL, + SERIAL VARCHAR(45) NULL DEFAULT NULL, + MAC_ADDRESS VARCHAR(45) NULL DEFAULT NULL, + DEVICE_NAME VARCHAR(100) NULL DEFAULT NULL, + PRIMARY KEY (DEVICE_ID) + ); + +-- ----------------------------------------------------- +-- Table AD_FEATURE +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS AD_FEATURE ( + ID BIGSERIAL NOT NULL PRIMARY KEY, + CODE VARCHAR(45) NOT NULL, + NAME VARCHAR(100) NULL, + DESCRIPTION VARCHAR(200) NULL +); 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 new file mode 100644 index 000000000..e22961638 --- /dev/null +++ b/features/mobile-plugins-feature/android-plugin-feature/org.wso2.carbon.device.mgt.mobile.android.feature/src/main/resources/p2.inf @@ -0,0 +1,10 @@ +instructions.configure = \ +org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../conf/device-types/);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/configs/,target:${installFolder}/../../conf/device-types/,overwrite:true);\ +org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/webapps/);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/webapps/,target:${installFolder}/../../deployment/server/webapps/,overwrite:true);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/jaggeryapps/,target:${installFolder}/../../deployment/server/jaggeryapps/,overwrite:true);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/conf/mobile-config.xml,target:${installFolder}/../../conf/mobile-config.xml,overwrite:true);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/dbscripts/plugins/,target:${installFolder}/../../../dbscripts/cdm/plugins/android,overwrite:true);\ +org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../database/);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.android_${feature.version}/database/,target:${installFolder}/../../database/,overwrite:true);\ diff --git a/features/mobile-plugins-feature/android-plugin-feature/pom.xml b/features/mobile-plugins-feature/android-plugin-feature/pom.xml new file mode 100644 index 000000000..ec8d6fab3 --- /dev/null +++ b/features/mobile-plugins-feature/android-plugin-feature/pom.xml @@ -0,0 +1,40 @@ + + + + + + + org.wso2.carbon.devicemgt-plugins + mobile-plugins-feature + 2.1.0-SNAPSHOT + ../pom.xml + + + 4.0.0 + android-plugin-feature + 2.1.0-SNAPSHOT + pom + WSO2 Carbon - Device Management Android Plugin Feature + http://wso2.org + + + org.wso2.carbon.device.mgt.mobile.android.feature + + + diff --git a/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/pom.xml b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/pom.xml index 26b491a65..04a5dff15 100644 --- a/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/pom.xml +++ b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/pom.xml @@ -1,21 +1,21 @@ + ~ 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. + --> @@ -91,6 +91,55 @@ + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack + package + + unpack + + + + + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.device.mgt.mobile.ui + + ${project.version} + zip + true + + ${project.build.directory}/maven-shared-archive-resources/jaggeryapps/devicemgt + + **/* + + + + + + copy + package + + copy + + + + + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.device.mgt.mobile.api + war + true + ${project.build.directory}/maven-shared-archive-resources/webapps/ + + mdm-admin.war + + + + + + org.wso2.maven carbon-p2-plugin diff --git a/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/p2.inf b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/p2.inf index 0dab9e7d2..3beddd74a 100644 --- a/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/p2.inf +++ b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/p2.inf @@ -1,3 +1,7 @@ instructions.configure = \ +org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/webapps/);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile_${feature.version}/webapps/,target:${installFolder}/../../deployment/server/webapps/,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile_${feature.version}/conf/mobile-config.xml,target:${installFolder}/../../conf/mobile-config.xml,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile_${feature.version}/dbscripts/plugins/,target:${installFolder}/../../../dbscripts/cdm/plugins,overwrite:true);\ +org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/jaggeryapps/);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile_${feature.version}/jaggeryapps/,target:${installFolder}/../../deployment/server/jaggeryapps/,overwrite:true);\ diff --git a/features/mobile-plugins-feature/mobile-base-plugin-feature/pom.xml b/features/mobile-plugins-feature/mobile-base-plugin-feature/pom.xml index 8b0d196e5..d259b41c9 100644 --- a/features/mobile-plugins-feature/mobile-base-plugin-feature/pom.xml +++ b/features/mobile-plugins-feature/mobile-base-plugin-feature/pom.xml @@ -1,21 +1,21 @@ + ~ 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. + --> @@ -30,7 +30,7 @@ mobile-base-plugin-feature 2.1.0-SNAPSHOT pom - WSO2 Carbon - Device Management Feature + WSO2 Carbon - Device Management EMM Base Plugin Feature http://wso2.org diff --git a/features/mobile-plugins-feature/pom.xml b/features/mobile-plugins-feature/pom.xml index 852a9f91e..4a8b51c32 100644 --- a/features/mobile-plugins-feature/pom.xml +++ b/features/mobile-plugins-feature/pom.xml @@ -1,21 +1,21 @@ + ~ 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. + --> @@ -30,11 +30,13 @@ mobile-plugins-feature 2.1.0-SNAPSHOT pom - WSO2 Carbon - Device Management Feature + WSO2 Carbon - Device Management EMM Plugins Feature http://wso2.org mobile-base-plugin-feature + android-plugin-feature + windows-plugin-feature diff --git a/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/pom.xml b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/pom.xml new file mode 100644 index 000000000..27feffe58 --- /dev/null +++ b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/pom.xml @@ -0,0 +1,213 @@ + + + + + + + org.wso2.carbon.devicemgt-plugins + windows-plugin-feature + 2.1.0-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon.device.mgt.mobile.windows.feature + pom + 2.1.0-SNAPSHOT + WSO2 Carbon - Windows Device Management Feature + http://wso2.org + This feature contains the core bundles required for Windows Device Management + functionality + + + + + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.device.mgt.mobile.windows + + + com.h2database.wso2 + h2-database-engine + + + + + + + maven-resources-plugin + 2.6 + + + copy-resources + generate-resources + + copy-resources + + + src/main/resources + + + resources + + build.properties + p2.inf + + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack + package + + unpack + + + + + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.device.mgt.mobile.windows.ui + + ${project.version} + zip + true + + ${project.build.directory}/maven-shared-archive-resources/jaggeryapps/devicemgt + + **/* + + + + + + copy-jaxrs-war + package + + copy + + + + + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.device.mgt.mobile.windows.api + + war + true + ${project.build.directory}/maven-shared-archive-resources/webapps/ + + mdm-windows-agent.war + + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + + + + create-windows-mobile-plugin-mgt-schema + package + + run + + + + + + + + + + + + + + + + + + + + + + + + + + + org.wso2.maven + carbon-p2-plugin + ${carbon.p2.plugin.version} + + + p2-feature-generation + package + + p2-feature-gen + + + org.wso2.carbon.device.mgt.mobile.windows + ../../../../features/etc/feature.properties + + + + org.wso2.carbon.p2.category.type:server + + org.eclipse.equinox.p2.type.group:false + + + + + + org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.mobile.windows:${carbon.mobile.device.mgt.version} + + + + + org.wso2.carbon.core.server:${carbon.kernel.version} + + + org.wso2.carbon.device.mgt.server:${carbon.device.mgt.version} + + + + + + + + + + diff --git a/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/build.properties b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/build.properties new file mode 100644 index 000000000..33bb0980d --- /dev/null +++ b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/build.properties @@ -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. +# + +custom = true diff --git a/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/configs/windows.json b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/configs/windows.json new file mode 100644 index 000000000..33823e665 --- /dev/null +++ b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/configs/windows.json @@ -0,0 +1,6 @@ +{ + "deviceType": { + "label": "Windows", + "category" : "mobile" + } +} diff --git a/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/dbscripts/plugins/h2.sql b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/dbscripts/plugins/h2.sql new file mode 100644 index 000000000..f1749a8a8 --- /dev/null +++ b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/dbscripts/plugins/h2.sql @@ -0,0 +1,30 @@ +-- ----------------------------------------------------- +-- Table `WIN_DEVICE` +-- ----------------------------------------------------- + CREATE TABLE IF NOT EXISTS `WIN_DEVICE` ( + `DEVICE_ID` VARCHAR(45) NOT NULL, + `CHANNEL_URI` VARCHAR(100) NULL DEFAULT NULL, + `DEVICE_INFO` TEXT NULL DEFAULT NULL, + `IMEI` VARCHAR(45) NULL DEFAULT NULL, + `IMSI` VARCHAR(45) NULL DEFAULT NULL, + `OS_VERSION` VARCHAR(45) NULL DEFAULT NULL, + `DEVICE_MODEL` VARCHAR(45) NULL DEFAULT NULL, + `VENDOR` VARCHAR(45) NULL DEFAULT NULL, + `LATITUDE` VARCHAR(45) NULL DEFAULT NULL, + `LONGITUDE` VARCHAR(45) NULL DEFAULT NULL, + `SERIAL` VARCHAR(45) NULL DEFAULT NULL, + `MAC_ADDRESS` VARCHAR(45) NULL DEFAULT NULL, + `DEVICE_NAME` VARCHAR(100) NULL DEFAULT NULL, + PRIMARY KEY (`DEVICE_ID`) +); + +-- ----------------------------------------------------- +-- Table `WIN_FEATURE` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `WIN_FEATURE` ( + `ID` INT NOT NULL AUTO_INCREMENT, + `CODE` VARCHAR(45) NOT NULL, + `NAME` VARCHAR(100) NULL, + `DESCRIPTION` VARCHAR(200) NULL, + PRIMARY KEY (`ID`) +); diff --git a/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/dbscripts/plugins/mssql.sql b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/dbscripts/plugins/mssql.sql new file mode 100644 index 000000000..593515185 --- /dev/null +++ b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/dbscripts/plugins/mssql.sql @@ -0,0 +1,30 @@ +-- ----------------------------------------------------- +-- Table `WINDOWS_FEATURE` +-- ----------------------------------------------------- +CREATE TABLE WIN_FEATURE ( + ID INT NOT NULL IDENTITY, + CODE VARCHAR(45) NOT NULL, + NAME VARCHAR(100) NULL, + DESCRIPTION VARCHAR(200) NULL, + PRIMARY KEY (ID) +); + +-- ----------------------------------------------------- +-- Table `WINDOWS_DEVICE` +-- ----------------------------------------------------- + CREATE TABLE WIN_DEVICE ( + DEVICE_ID VARCHAR(45) NOT NULL, + CHANNEL_URI VARCHAR(100) NULL DEFAULT NULL, + DEVICE_INFO TEXT NULL DEFAULT NULL, + IMEI VARCHAR(45) NULL DEFAULT NULL, + IMSI VARCHAR(45) NULL DEFAULT NULL, + OS_VERSION VARCHAR(45) NULL DEFAULT NULL, + DEVICE_MODEL VARCHAR(45) NULL DEFAULT NULL, + VENDOR VARCHAR(45) NULL DEFAULT NULL, + LATITUDE VARCHAR(45) NULL DEFAULT NULL, + LONGITUDE VARCHAR(45) NULL DEFAULT NULL, + SERIAL VARCHAR(45) NULL DEFAULT NULL, + MAC_ADDRESS VARCHAR(45) NULL DEFAULT NULL, + DEVICE_NAME VARCHAR(100) NULL DEFAULT NULL, + PRIMARY KEY (DEVICE_ID) +); diff --git a/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/dbscripts/plugins/mysql.sql b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/dbscripts/plugins/mysql.sql new file mode 100644 index 000000000..2ebcc80f7 --- /dev/null +++ b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/dbscripts/plugins/mysql.sql @@ -0,0 +1,34 @@ +-- ----------------------------------------------------- +-- Table `WIN_DEVICE` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `WIN_DEVICE` ( + `DEVICE_ID` VARCHAR(45) NOT NULL, + `CHANNEL_URI` VARCHAR(100) NULL DEFAULT NULL, + `DEVICE_INFO` TEXT NULL DEFAULT NULL, + `IMEI` VARCHAR(45) NULL DEFAULT NULL, + `IMSI` VARCHAR(45) NULL DEFAULT NULL, + `OS_VERSION` VARCHAR(45) NULL DEFAULT NULL, + `DEVICE_MODEL` VARCHAR(45) NULL DEFAULT NULL, + `VENDOR` VARCHAR(45) NULL DEFAULT NULL, + `LATITUDE` VARCHAR(45) NULL DEFAULT NULL, + `LONGITUDE` VARCHAR(45) NULL DEFAULT NULL, + `SERIAL` VARCHAR(45) NULL DEFAULT NULL, + `MAC_ADDRESS` VARCHAR(45) NULL DEFAULT NULL, + `DEVICE_NAME` VARCHAR(100) NULL DEFAULT NULL, + PRIMARY KEY (`DEVICE_ID`)) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `WIN_FEATURE` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `WIN_FEATURE` ( + `ID` INT NOT NULL AUTO_INCREMENT, + `CODE` VARCHAR(45) NULL, + `NAME` VARCHAR(100) NULL, + `DESCRIPTION` VARCHAR(200) NULL, + PRIMARY KEY (`ID`)) +ENGINE = InnoDB; + + + diff --git a/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/dbscripts/plugins/oracle.sql b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/dbscripts/plugins/oracle.sql new file mode 100644 index 000000000..a7a389264 --- /dev/null +++ b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/dbscripts/plugins/oracle.sql @@ -0,0 +1,51 @@ +-- ----------------------------------------------------- +-- Table `WIN_DEVICE` +-- ----------------------------------------------------- +CREATE TABLE WIN_DEVICE ( + DEVICE_ID VARCHAR(45) NOT NULL, + CHANNEL_URI VARCHAR(100) DEFAULT NULL, + DEVICE_INFO VARCHAR2(4000) DEFAULT NULL, + IMEI VARCHAR(45) DEFAULT NULL, + IMSI VARCHAR(45) DEFAULT NULL, + OS_VERSION VARCHAR(45) DEFAULT NULL, + DEVICE_MODEL VARCHAR(45) DEFAULT NULL, + VENDOR VARCHAR(45) DEFAULT NULL, + LATITUDE VARCHAR(45) DEFAULT NULL, + LONGITUDE VARCHAR(45) DEFAULT NULL, + SERIAL VARCHAR(45) DEFAULT NULL, + MAC_ADDRESS VARCHAR(45) DEFAULT NULL, + DEVICE_NAME VARCHAR(100) DEFAULT NULL, + CONSTRAINT PK_WIN_DEVICE PRIMARY KEY (DEVICE_ID) +) +/ + +-- ----------------------------------------------------- +-- Table `WIN_FEATURE` +-- ----------------------------------------------------- +CREATE TABLE WIN_FEATURE ( + ID INT NOT NULL, + CODE VARCHAR(45) NOT NULL, + NAME VARCHAR(100) NOT NULL, + DESCRIPTION VARCHAR(200) NULL, + PRIMARY KEY (ID) +) +/ + +-- ----------------------------------------------------- +-- Sequence `WIN_FEATURE_ID_INC_SEQ` +-- ----------------------------------------------------- +CREATE SEQUENCE WIN_FEATURE_ID_INC_SEQ START WITH 1 INCREMENT BY 1 NOCACHE +/ + +-- ----------------------------------------------------- +-- Trigger `WIN_FEATURE_ID_INC_TRIG` +-- ----------------------------------------------------- +CREATE OR REPLACE TRIGGER WIN_FEATURE_ID_INC_TRIG +BEFORE INSERT +ON WIN_FEATURE +REFERENCING NEW AS NEW +FOR EACH ROW + BEGIN + SELECT WIN_FEATURE_ID_INC_SEQ.NEXTVAL INTO :NEW.ID FROM DUAL; + END; +/ \ No newline at end of file diff --git a/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/dbscripts/plugins/postgresql.sql b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/dbscripts/plugins/postgresql.sql new file mode 100644 index 000000000..d7444757d --- /dev/null +++ b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/dbscripts/plugins/postgresql.sql @@ -0,0 +1,31 @@ +-- ----------------------------------------------------- +-- Table WIN_DEVICE +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS WIN_DEVICE ( + DEVICE_ID VARCHAR(45) NOT NULL, + CHANNEL_URI VARCHAR(100) NULL DEFAULT NULL, + DEVICE_INFO TEXT NULL DEFAULT NULL, + IMEI VARCHAR(45) NULL DEFAULT NULL, + IMSI VARCHAR(45) NULL DEFAULT NULL, + OS_VERSION VARCHAR(45) NULL DEFAULT NULL, + DEVICE_MODEL VARCHAR(45) NULL DEFAULT NULL, + VENDOR VARCHAR(45) NULL DEFAULT NULL, + LATITUDE VARCHAR(45) NULL DEFAULT NULL, + LONGITUDE VARCHAR(45) NULL DEFAULT NULL, + SERIAL VARCHAR(45) NULL DEFAULT NULL, + MAC_ADDRESS VARCHAR(45) NULL DEFAULT NULL, + DEVICE_NAME VARCHAR(100) NULL DEFAULT NULL, + PRIMARY KEY (DEVICE_ID) + ); + +-- ----------------------------------------------------- +-- Table WIN_FEATURE +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS WIN_FEATURE ( + ID SERIAL NOT NULL, + CODE VARCHAR(45) NULL, + NAME VARCHAR(100) NULL, + DESCRIPTION VARCHAR(200) NULL, + PRIMARY KEY (ID) + ); + diff --git a/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/p2.inf b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/p2.inf new file mode 100644 index 000000000..09f27767d --- /dev/null +++ b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/p2.inf @@ -0,0 +1,9 @@ +instructions.configure = \ +org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../conf/device-types/);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.windows_${feature.version}/configs/,target:${installFolder}/../../conf/device-types/,overwrite:true);\ +org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/webapps/);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.windows_${feature.version}/jaggeryapps/,target:${installFolder}/../../deployment/server/jaggeryapps/,overwrite:true);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.windows_${feature.version}/webapps/,target:${installFolder}/../../deployment/server/webapps/,overwrite:true);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.windows_${feature.version}/dbscripts/plugins/,target:${installFolder}/../../../dbscripts/cdm/plugins/windows,overwrite:true);\ +org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../database/);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.windows_${feature.version}/database/,target:${installFolder}/../../database/,overwrite:true);\ diff --git a/features/mobile-plugins-feature/windows-plugin-feature/pom.xml b/features/mobile-plugins-feature/windows-plugin-feature/pom.xml new file mode 100644 index 000000000..f00b2874a --- /dev/null +++ b/features/mobile-plugins-feature/windows-plugin-feature/pom.xml @@ -0,0 +1,40 @@ + + + + + + + org.wso2.carbon.devicemgt-plugins + mobile-plugins-feature + 2.1.0-SNAPSHOT + ../pom.xml + + + 4.0.0 + windows-plugin-feature + 2.1.0-SNAPSHOT + pom + WSO2 Carbon - Device Management Windows Plugin Feature + http://wso2.org + + + org.wso2.carbon.device.mgt.mobile.windows.feature + + + diff --git a/pom.xml b/pom.xml index c31949282..bcaf766c7 100644 --- a/pom.xml +++ b/pom.xml @@ -1,22 +1,21 @@ - + ~ 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. + --> @@ -40,6 +39,7 @@ components/mobile-plugins components/iot-plugins features/mobile-plugins-feature + features/iot-plugins-feature @@ -498,6 +498,11 @@ org.wso2.carbon.device.mgt.mobile.impl ${carbon.mobile.device.mgt.version} + + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.device.mgt.mobile.api + ${carbon.mobile.device.mgt.version} + org.wso2.carbon.devicemgt-plugins org.wso2.carbon.device.mgt.mobile.url.printer @@ -508,11 +513,30 @@ org.wso2.carbon.device.mgt.mobile ${carbon.mobile.device.mgt.version} + + org.wso2.carbon.devicemgt-plugins org.wso2.carbon.device.mgt.mobile.android ${carbon.mobile.device.mgt.version} + + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.device.mgt.mobile.android.api + ${carbon.mobile.device.mgt.version} + + + + + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.device.mgt.mobile.windows + ${carbon.mobile.device.mgt.version} + + + org.wso2.carbon.devicemgt-plugins + org.wso2.carbon.device.mgt.mobile.windows.api + ${carbon.mobile.device.mgt.version} +