|
|
@ -21,6 +21,7 @@ package org.wso2.carbon.device.mgt.mobile.impl.android;
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
import org.wso2.carbon.device.mgt.common.*;
|
|
|
|
import org.wso2.carbon.device.mgt.common.*;
|
|
|
|
|
|
|
|
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.mobile.dao.MobileDeviceManagementDAOException;
|
|
|
|
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;
|
|
|
@ -47,18 +48,33 @@ public class AndroidDeviceManager implements DeviceManager {
|
|
|
|
return featureManager;
|
|
|
|
return featureManager;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public boolean saveConfiguration(TenantConfiguration tenantConfiguration) throws DeviceManagementException {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public TenantConfiguration getConfiguration() throws DeviceManagementException {
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean enrollDevice(Device device) throws DeviceManagementException {
|
|
|
|
public boolean enrollDevice(Device device) throws DeviceManagementException {
|
|
|
|
boolean status;
|
|
|
|
boolean status = false;
|
|
|
|
MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device);
|
|
|
|
MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
log.debug("Enrolling a new Android device : " + device.getDeviceIdentifier());
|
|
|
|
log.debug("Enrolling a new Android device : " + device.getDeviceIdentifier());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
boolean isEnrolled = this.isEnrolled(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
|
|
|
|
|
|
|
|
if (isEnrolled) {
|
|
|
|
|
|
|
|
this.modifyEnrollment(device);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
AndroidDAOFactory.beginTransaction();
|
|
|
|
AndroidDAOFactory.beginTransaction();
|
|
|
|
status = mobileDeviceManagementDAOFactory.getMobileDeviceDAO().addMobileDevice(
|
|
|
|
status = mobileDeviceManagementDAOFactory.getMobileDeviceDAO().addMobileDevice(
|
|
|
|
mobileDevice);
|
|
|
|
mobileDevice);
|
|
|
|
AndroidDAOFactory.commitTransaction();
|
|
|
|
AndroidDAOFactory.commitTransaction();
|
|
|
|
|
|
|
|
}
|
|
|
|
} catch (MobileDeviceManagementDAOException e) {
|
|
|
|
} catch (MobileDeviceManagementDAOException e) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
AndroidDAOFactory.rollbackTransaction();
|
|
|
|
AndroidDAOFactory.rollbackTransaction();
|
|
|
|