From dcbfd06075057c651b82e92e2fd169ad6a81da46 Mon Sep 17 00:00:00 2001 From: harshanL Date: Tue, 17 Feb 2015 17:15:51 +0530 Subject: [PATCH] Added debug logs --- .../mgt/mobile/dao/MobileDeviceDAO.java | 4 ++++ .../android/AndroidDeviceManagerService.java | 21 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileDeviceDAO.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileDeviceDAO.java index 1052ef1ab..161594273 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileDeviceDAO.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileDeviceDAO.java @@ -29,6 +29,7 @@ public interface MobileDeviceDAO { /** * Fetches a MobileDevice from MDM database. + * * @param mblDeviceId Id of the Mobile-Device. * @return MobileDevice corresponding to given device-id. * @throws MobileDeviceManagementDAOException @@ -37,6 +38,7 @@ public interface MobileDeviceDAO { /** * Adds a new MobileDevice to the MDM database. + * * @param mobileDevice MobileDevice to be added. * @return The status of the operation. * @throws MobileDeviceManagementDAOException @@ -45,6 +47,7 @@ public interface MobileDeviceDAO { /** * Updates MobileDevice information in MDM database. + * * @param mobileDevice MobileDevice to be updated. * @return The status of the operation. * @throws MobileDeviceManagementDAOException @@ -53,6 +56,7 @@ public interface MobileDeviceDAO { /** * Deletes a given MobileDevice from MDM database. + * * @param mblDeviceId Id of MobileDevice to be deleted. * @return The status of the operation. * @throws MobileDeviceManagementDAOException diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManagerService.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManagerService.java index 0b83e1f8e..8109f1414 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManagerService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManagerService.java @@ -52,6 +52,9 @@ public class AndroidDeviceManagerService implements DeviceManagerService { boolean status; MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device); try { + if (log.isDebugEnabled()) { + log.debug("Enrolling a new Android device : " + device.getDeviceIdentifier()); + } status = MobileDeviceManagementDAOFactory.getMobileDeviceDAO().addMobileDevice( mobileDevice); } catch (MobileDeviceManagementDAOException e) { @@ -68,6 +71,9 @@ public class AndroidDeviceManagerService implements DeviceManagerService { boolean status; MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device); try { + if (log.isDebugEnabled()) { + log.debug("Modifying the Android device enrollment data"); + } status = MobileDeviceManagementDAOFactory.getMobileDeviceDAO() .updateMobileDevice(mobileDevice); } catch (MobileDeviceManagementDAOException e) { @@ -83,6 +89,9 @@ public class AndroidDeviceManagerService implements DeviceManagerService { public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException { boolean status; try { + if (log.isDebugEnabled()) { + log.debug("Dis-enrolling Android device : " + deviceId); + } status = MobileDeviceManagementDAOFactory.getMobileDeviceDAO() .deleteMobileDevice(deviceId.getId()); } catch (MobileDeviceManagementDAOException e) { @@ -97,6 +106,9 @@ public class AndroidDeviceManagerService implements DeviceManagerService { public boolean isEnrolled(DeviceIdentifier deviceId) throws DeviceManagementException { boolean isEnrolled = false; try { + if (log.isDebugEnabled()) { + log.debug("Checking the enrollment of Android device : " + deviceId.getId()); + } MobileDevice mobileDevice = MobileDeviceManagementDAOFactory.getMobileDeviceDAO().getMobileDevice( deviceId.getId()); @@ -127,6 +139,9 @@ public class AndroidDeviceManagerService implements DeviceManagerService { public Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException { Device device; try { + if (log.isDebugEnabled()) { + log.debug("Getting the details of Android device : " + deviceId.getId()); + } MobileDevice mobileDevice = MobileDeviceManagementDAOFactory.getMobileDeviceDAO(). getMobileDevice(deviceId.getId()); device = MobileDeviceManagementUtil.convertToDevice(mobileDevice); @@ -149,6 +164,9 @@ public class AndroidDeviceManagerService implements DeviceManagerService { boolean status; MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device); try { + if (log.isDebugEnabled()) { + log.debug("updating the details of Android device : " + device.getDeviceIdentifier()); + } status = MobileDeviceManagementDAOFactory.getMobileDeviceDAO() .updateMobileDevice(mobileDevice); } catch (MobileDeviceManagementDAOException e) { @@ -163,6 +181,9 @@ public class AndroidDeviceManagerService implements DeviceManagerService { public List getAllDevices() throws DeviceManagementException { List devices = null; try { + if (log.isDebugEnabled()) { + log.debug("Fetching the details of all Android devices"); + } List mobileDevices = MobileDeviceManagementDAOFactory.getMobileDeviceDAO(). getAllMobileDevices();