Incorporating changes done upon RegistryBasedLicenseManager implementation

revert-dabc3590
prabathabey 9 years ago
parent e8b6cd1830
commit ef9407859a

@ -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.dao.MobileDeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.mobile.dto.MobileDevice; 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.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.device.mgt.mobile.util.MobileDeviceManagementUtil;
import org.wso2.carbon.registry.api.Collection; 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.RegistryException;
import org.wso2.carbon.registry.api.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -51,14 +49,7 @@ public class AndroidDeviceManager implements DeviceManager {
public AndroidDeviceManager() { public AndroidDeviceManager() {
this.mobileDeviceManagementDAOFactory = new AndroidDAOFactory(); this.mobileDeviceManagementDAOFactory = new AndroidDAOFactory();
try { this.licenseManager = new RegistryBasedLicenseManager();
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);
}
} }
@Override @Override
@ -69,7 +60,7 @@ public class AndroidDeviceManager implements DeviceManager {
@Override @Override
public boolean saveConfiguration(TenantConfiguration tenantConfiguration) public boolean saveConfiguration(TenantConfiguration tenantConfiguration)
throws DeviceManagementException { throws DeviceManagementException {
boolean status = false; boolean status;
Resource resource; Resource resource;
try { try {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
@ -105,7 +96,7 @@ public class AndroidDeviceManager implements DeviceManager {
try { try {
String androidRegPath = String androidRegPath =
MobileDeviceManagementUtil.getPlatformConfigPath(DeviceManagementConstants. MobileDeviceManagementUtil.getPlatformConfigPath(DeviceManagementConstants.
MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
dsCollection = dsCollection =
(Collection) MobileDeviceManagementUtil.getRegistryResource(androidRegPath); (Collection) MobileDeviceManagementUtil.getRegistryResource(androidRegPath);
String[] dsmPaths = dsCollection.getChildren(); String[] dsmPaths = dsCollection.getChildren();

@ -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.dao.MobileDeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.mobile.dto.MobileDevice; 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.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.device.mgt.mobile.util.MobileDeviceManagementUtil;
import org.wso2.carbon.registry.api.Registry;
import java.util.List; import java.util.List;
@ -44,15 +42,8 @@ public class WindowsDeviceManager implements DeviceManager {
private static final Log log = LogFactory.getLog(WindowsDeviceManagementService.class); private static final Log log = LogFactory.getLog(WindowsDeviceManagementService.class);
public WindowsDeviceManager() { public WindowsDeviceManager() {
daoFactory = new WindowsDAOFactory(); this.daoFactory = new WindowsDAOFactory();
try { this.licenseManager = new RegistryBasedLicenseManager();
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);
}
} }
@Override @Override

Loading…
Cancel
Save