Merge pull request #2 from asokaravinda/master

Adding windows device enrolment
This commit is contained in:
Ashok Aravinda 2015-03-12 18:56:02 +05:30
commit b07b8cc7df

View File

@ -18,8 +18,14 @@
package org.wso2.carbon.device.mgt.mobile.impl.windows; package org.wso2.carbon.device.mgt.mobile.impl.windows;
import org.apache.commons.logging.Log;
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.spi.DeviceManagerService; import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService;
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.util.MobileDeviceManagementUtil;
import java.util.List; import java.util.List;
@ -28,65 +34,78 @@ import java.util.List;
*/ */
public class WindowsDeviceManagerService implements DeviceManagerService { public class WindowsDeviceManagerService implements DeviceManagerService {
@Override private static final Log log = LogFactory.getLog(WindowsDeviceManagerService.class);
public String getProviderType() {
return DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS;
}
@Override @Override
public boolean enrollDevice(Device device) throws DeviceManagementException { public String getProviderType() {
return true; return DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS;
} }
@Override @Override
public boolean modifyEnrollment(Device device) throws DeviceManagementException { public boolean enrollDevice(Device device) throws DeviceManagementException {
return true; boolean status;
} MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device);
try {
status = MobileDeviceManagementDAOFactory.getMobileDeviceDAO().addMobileDevice(
mobileDevice);
} catch (MobileDeviceManagementDAOException e) {
String msg = "Error while enrolling the Windows device : " +
device.getDeviceIdentifier();
log.error(msg, e);
throw new DeviceManagementException(msg, e);
}
return status;
}
@Override @Override
public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException { public boolean modifyEnrollment(Device device) throws DeviceManagementException {
return true; return false;
} }
@Override @Override
public boolean isEnrolled(DeviceIdentifier deviceId) throws DeviceManagementException { public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
return true; return false;
} }
@Override @Override
public boolean isActive(DeviceIdentifier deviceId) throws DeviceManagementException { public boolean isEnrolled(DeviceIdentifier deviceId) throws DeviceManagementException {
return true; return false;
} }
@Override @Override
public boolean setActive(DeviceIdentifier deviceId, boolean status) public boolean isActive(DeviceIdentifier deviceId) throws DeviceManagementException {
throws DeviceManagementException { return false;
return true; }
}
public List<Device> getAllDevices() throws DeviceManagementException { @Override
return null; public boolean setActive(DeviceIdentifier deviceId, boolean status)
} throws DeviceManagementException {
return false;
}
@Override public List<Device> getAllDevices() throws DeviceManagementException {
public Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException { return null;
return null; }
}
@Override @Override
public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType) public Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
throws DeviceManagementException { return null;
return true; }
}
@Override @Override
public OperationManager getOperationManager() throws DeviceManagementException { public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType)
return null; throws DeviceManagementException {
} return false;
}
@Override @Override
public boolean updateDeviceInfo(Device device) throws DeviceManagementException { public OperationManager getOperationManager() throws DeviceManagementException {
return true; return null;
} }
@Override
public boolean updateDeviceInfo(Device device) throws DeviceManagementException {
return false;
}
} }