refactored Windows Device Manager

revert-dabc3590
hasuniea 9 years ago
parent 1a777941fc
commit 023d019864

@ -25,7 +25,6 @@ import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration;
import org.wso2.carbon.device.mgt.common.license.mgt.License; import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException; import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager; import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager;
import org.wso2.carbon.device.mgt.extensions.license.mgt.registry.RegistryBasedLicenseManager;
import org.wso2.carbon.device.mgt.mobile.common.MobileDeviceMgtPluginException; import org.wso2.carbon.device.mgt.mobile.common.MobileDeviceMgtPluginException;
import org.wso2.carbon.device.mgt.mobile.common.MobilePluginConstants; import org.wso2.carbon.device.mgt.mobile.common.MobilePluginConstants;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException; import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
@ -55,7 +54,13 @@ public class WindowsDeviceManager implements DeviceManager {
public WindowsDeviceManager() { public WindowsDeviceManager() {
this.daoFactory = new WindowsDAOFactory(); this.daoFactory = new WindowsDAOFactory();
this.licenseManager = new RegistryBasedLicenseManager(); //this.licenseManager = new RegistryBasedLicenseManager();
// License defaultLicense = WindowsPluginUtils.getDefaultLicense();
// try {
// licenseManager.addLicense(WindowsDeviceManagementService.DEVICE_TYPE_WINDOWS, defaultLicense);
// } catch (LicenseManagementException e) {
// log.error("Error occurred while adding default license for Windows devices", e);
// }
} }
@Override @Override
@ -66,7 +71,7 @@ public class WindowsDeviceManager 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()) {
@ -240,7 +245,8 @@ public class WindowsDeviceManager implements DeviceManager {
@Override @Override
public License getLicense(String languageCode) throws LicenseManagementException { public License getLicense(String languageCode) throws LicenseManagementException {
return licenseManager.getLicense(WindowsDeviceManagementService.DEVICE_TYPE_WINDOWS, languageCode); // return licenseManager.getLicense(WindowsDeviceManagementService.DEVICE_TYPE_WINDOWS, languageCode);
return null;
} }
@Override @Override

@ -55,10 +55,10 @@ public class WindowsPolicyMonitoringService implements PolicyMonitoringService {
return complianceData; return complianceData;
} }
for (ComplianceFeature cf : complianceFeatures) { for (ComplianceFeature complianceFeature : complianceFeatures) {
if (!cf.isCompliant()) { if (!complianceFeature.isCompliant()) {
complianceData.setStatus(false); complianceData.setStatus(false);
nonComplianceFeatures.add(cf); nonComplianceFeatures.add(complianceFeature);
break; break;
} }
} }

@ -0,0 +1,39 @@
package org.wso2.carbon.device.mgt.mobile.impl.windows.util;
import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.mobile.impl.windows.WindowsDeviceManagementService;
/**
* Contains utility method used by Windows plugin.
*/
public class WindowsPluginUtils {
public static License getDefaultLicense() {
License license = new License();
license.setName(WindowsDeviceManagementService.DEVICE_TYPE_WINDOWS);
license.setLanguage("en_US");
license.setVersion("1.0.0");
license.setText("This End User License Agreement (“Agreement”) is a legal agreement between you (“You”) " +
"and WSO2, Inc., regarding the enrollment of Your personal mobile device (“Device”) in SoRs " +
"mobile device management program, and the loading to and removal from Your Device and Your use " +
"of certain applications and any associated software and user documentation, whether provided in " +
"“online” or electronic format, used in connection with the operation of or provision of services " +
"to WSO2, Inc., BY SELECTING “I ACCEPT” DURING INSTALLATION, YOU ARE ENROLLING YOUR DEVICE, AND " +
"THEREBY AUTHORIZING SOR OR ITS AGENTS TO INSTALL, UPDATE AND REMOVE THE APPS FROM YOUR DEVICE AS " +
"DESCRIBED IN THIS AGREEMENT. YOU ARE ALSO EXPLICITLY ACKNOWLEDGING AND AGREEING THAT (1) THIS IS " +
"A BINDING CONTRACT AND (2) YOU HAVE READ AND AGREE TO THE TERMS OF THIS AGREEMENT.\n" +
"\n" +
"IF YOU DO NOT ACCEPT THESE TERMS, DO NOT ENROLL YOUR DEVICE AND DO NOT PROCEED ANY FURTHER.\n" +
"\n" +
"You agree that: (1) You understand and agree to be bound by the terms and conditions contained " +
"in this Agreement, and (2) You are at least 21 years old and have the legal capacity to enter " +
"into this Agreement as defined by the laws of Your jurisdiction. SoR shall have the right, " +
"without prior notice, to terminate or suspend (i) this Agreement, (ii) the enrollment of Your " +
"Device, or (iii) the functioning of the Apps in the event of a violation of this Agreement or " +
"the cessation of Your relationship with SoR (including termination of Your employment if You are " +
"an employee or expiration or termination of Your applicable franchise or supply agreement if You " +
"are a franchisee of or supplier to the WSO2 WSO2, Inc., system). SoR expressly reserves all " +
"rights not expressly granted herein.");
return license;
}
}
Loading…
Cancel
Save