From ef9407859aff87532d4e7d3798809f72d5936cf2 Mon Sep 17 00:00:00 2001 From: prabathabey Date: Tue, 28 Jul 2015 20:38:33 +0530 Subject: [PATCH] Incorporating changes done upon RegistryBasedLicenseManager implementation --- .../impl/android/AndroidDeviceManager.java | 17 ++++------------- .../impl/windows/WindowsDeviceManager.java | 13 ++----------- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManager.java index eb4d116cd3..2671fd6ac4 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManager.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManager.java @@ -32,12 +32,10 @@ import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException; import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory; import org.wso2.carbon.device.mgt.mobile.dto.MobileDevice; import org.wso2.carbon.device.mgt.mobile.impl.android.dao.AndroidDAOFactory; -import org.wso2.carbon.device.mgt.mobile.internal.MobileDeviceManagementDataHolder; import org.wso2.carbon.device.mgt.mobile.util.MobileDeviceManagementUtil; import org.wso2.carbon.registry.api.Collection; -import org.wso2.carbon.registry.api.Registry; -import org.wso2.carbon.registry.api.Resource; import org.wso2.carbon.registry.api.RegistryException; +import org.wso2.carbon.registry.api.Resource; import java.util.ArrayList; import java.util.List; @@ -51,14 +49,7 @@ public class AndroidDeviceManager implements DeviceManager { public AndroidDeviceManager() { this.mobileDeviceManagementDAOFactory = new AndroidDAOFactory(); - try { - Registry registry = - MobileDeviceManagementDataHolder.getInstance().getRegistryService().getConfigSystemRegistry(); - this.licenseManager = new RegistryBasedLicenseManager(registry); - } catch (org.wso2.carbon.registry.core.exceptions.RegistryException e) { - throw new IllegalStateException("Error occurred while retrieving config system registry of the tenant, " + - "which in turns fails the initialization of Android Device Manager", e); - } + this.licenseManager = new RegistryBasedLicenseManager(); } @Override @@ -69,7 +60,7 @@ public class AndroidDeviceManager implements DeviceManager { @Override public boolean saveConfiguration(TenantConfiguration tenantConfiguration) throws DeviceManagementException { - boolean status = false; + boolean status; Resource resource; try { if (log.isDebugEnabled()) { @@ -105,7 +96,7 @@ public class AndroidDeviceManager implements DeviceManager { try { String androidRegPath = MobileDeviceManagementUtil.getPlatformConfigPath(DeviceManagementConstants. - MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); + MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); dsCollection = (Collection) MobileDeviceManagementUtil.getRegistryResource(androidRegPath); String[] dsmPaths = dsCollection.getChildren(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManager.java index 25d8c2bac8..9dc3014d50 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManager.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManager.java @@ -30,9 +30,7 @@ import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException; import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory; import org.wso2.carbon.device.mgt.mobile.dto.MobileDevice; import org.wso2.carbon.device.mgt.mobile.impl.windows.dao.WindowsDAOFactory; -import org.wso2.carbon.device.mgt.mobile.internal.MobileDeviceManagementDataHolder; import org.wso2.carbon.device.mgt.mobile.util.MobileDeviceManagementUtil; -import org.wso2.carbon.registry.api.Registry; import java.util.List; @@ -44,15 +42,8 @@ public class WindowsDeviceManager implements DeviceManager { private static final Log log = LogFactory.getLog(WindowsDeviceManagementService.class); public WindowsDeviceManager() { - daoFactory = new WindowsDAOFactory(); - try { - Registry registry = - MobileDeviceManagementDataHolder.getInstance().getRegistryService().getConfigSystemRegistry(); - this.licenseManager = new RegistryBasedLicenseManager(registry); - } catch (org.wso2.carbon.registry.core.exceptions.RegistryException e) { - throw new IllegalStateException("Error occurred while retrieving config system registry of the tenant, " + - "which in turns fails the initialization of Android Device Manager", e); - } + this.daoFactory = new WindowsDAOFactory(); + this.licenseManager = new RegistryBasedLicenseManager(); } @Override