From 76b34b3229d24ae9f8af9396d78f938b1fa46360 Mon Sep 17 00:00:00 2001 From: Saad Sahibjan Date: Thu, 6 Jun 2019 22:11:34 +0530 Subject: [PATCH 1/3] Add gson dependency to commons --- .../device-mgt/org.wso2.carbon.device.mgt.common/pom.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml index eb7b99a2a4..0782c24070 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml @@ -51,7 +51,8 @@ javax.xml.bind.annotation; version="${javax.xml.bind.imp.pkg.version}", com.fasterxml.jackson.annotation;version="${jackson-annotations.version}", org.wso2.carbon.analytics.datasource.commons;version="${carbon.analytics.version.range}", - io.swagger.annotations; version="${swagger.annotations.version}"; resolution:=optional + io.swagger.annotations; version="${swagger.annotations.version}"; resolution:=optional, + com.google.gson @@ -103,6 +104,10 @@ org.wso2.carbon.analytics org.wso2.carbon.analytics.datasource.commons + + com.google.code.gson + gson + From c9c4d7a64b0df4ea1ecd52a75a66f8b414cf2da8 Mon Sep 17 00:00:00 2001 From: Saad Sahibjan Date: Thu, 6 Jun 2019 22:12:06 +0530 Subject: [PATCH 2/3] Android enterpise app install payload creation --- .../src/main/webapp/WEB-INF/web.xml | 19 ++++++++++--------- .../core/impl/SubscriptionManagerImpl.java | 3 +++ .../core/util/MDMAndroidOperationUtil.java | 4 +++- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/web.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/web.xml index 63d4e111fc..15677f5277 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/web.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/web.xml @@ -47,15 +47,16 @@ - - - ApplicationMgt-Admin - /* - - - CONFIDENTIAL - - + + + + + + + + + + diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java index 13a7b2336c..8d0b07e007 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java @@ -50,6 +50,7 @@ import org.wso2.carbon.device.application.mgt.core.util.HelperUtil; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.app.mgt.MobileApp; +import org.wso2.carbon.device.mgt.common.app.mgt.MobileAppTypes; import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException; import org.wso2.carbon.device.mgt.common.exceptions.UnknownApplicationTypeException; @@ -460,6 +461,8 @@ public class SubscriptionManagerImpl implements SubscriptionManager { MobileApp mobileApp = new MobileApp(); if (DeviceTypes.ANDROID.toString().equalsIgnoreCase(deviceType)) { if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) { + mobileApp.setType(MobileAppTypes.ENTERPRISE); + mobileApp.setLocation(application.getApplicationReleases().get(0).getInstallerPath()); return MDMAndroidOperationUtil.createInstallAppOperation(mobileApp); } else if (SubAction.UNINSTALL.toString().equalsIgnoreCase(action)) { return MDMAndroidOperationUtil.createAppUninstallOperation(mobileApp); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMAndroidOperationUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMAndroidOperationUtil.java index 85d3cb573d..2f73db6357 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMAndroidOperationUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMAndroidOperationUtil.java @@ -51,7 +51,9 @@ public class MDMAndroidOperationUtil { EnterpriseApplication enterpriseApplication = new EnterpriseApplication(); enterpriseApplication.setType(application.getType().toString()); - enterpriseApplication.setUrl(application.getLocation()); + //TODO: replace needs to be removed after doing the proper config update in application-mgt.xml + enterpriseApplication.setUrl(application.getLocation().replace("https://localhost:9443", + "http://192.168.8.6:9763")); operation.setPayLoad(enterpriseApplication.toJSON()); break; case PUBLIC: From 857f9057d328be60a2ed13e5c0ef669205486d90 Mon Sep 17 00:00:00 2001 From: Saad Sahibjan Date: Fri, 7 Jun 2019 11:18:07 +0530 Subject: [PATCH 3/3] Modify setting app type --- .../application/mgt/core/impl/SubscriptionManagerImpl.java | 3 ++- .../device/mgt/core/util/MDMAndroidOperationUtil.java | 7 ++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java index 8d0b07e007..479d809d36 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java @@ -459,9 +459,10 @@ public class SubscriptionManagerImpl implements SubscriptionManager { //todo rethink and modify the {@link MobileApp} usage MobileApp mobileApp = new MobileApp(); + MobileAppTypes mobileAppType = MobileAppTypes.valueOf(application.getType()); if (DeviceTypes.ANDROID.toString().equalsIgnoreCase(deviceType)) { if (SubAction.INSTALL.toString().equalsIgnoreCase(action)) { - mobileApp.setType(MobileAppTypes.ENTERPRISE); + mobileApp.setType(mobileAppType); mobileApp.setLocation(application.getApplicationReleases().get(0).getInstallerPath()); return MDMAndroidOperationUtil.createInstallAppOperation(mobileApp); } else if (SubAction.UNINSTALL.toString().equalsIgnoreCase(action)) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMAndroidOperationUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMAndroidOperationUtil.java index 2f73db6357..cce871d009 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMAndroidOperationUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMAndroidOperationUtil.java @@ -48,12 +48,9 @@ public class MDMAndroidOperationUtil { switch (application.getType()) { case ENTERPRISE: - EnterpriseApplication enterpriseApplication = - new EnterpriseApplication(); + EnterpriseApplication enterpriseApplication = new EnterpriseApplication(); enterpriseApplication.setType(application.getType().toString()); - //TODO: replace needs to be removed after doing the proper config update in application-mgt.xml - enterpriseApplication.setUrl(application.getLocation().replace("https://localhost:9443", - "http://192.168.8.6:9763")); + enterpriseApplication.setUrl(application.getLocation()); operation.setPayLoad(enterpriseApplication.toJSON()); break; case PUBLIC: