From 87d47c1d9350cd94831ac3aaec3e1e3d9139380e Mon Sep 17 00:00:00 2001 From: harshanL Date: Mon, 22 Dec 2014 16:55:11 +0530 Subject: [PATCH] Refactored code comments --- .../device/mgt/core/DeviceManagementRepository.java | 2 +- .../carbon/device/mgt/core/util/DeviceManagerUtil.java | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementRepository.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementRepository.java index 1b59cd4a9a..3f3340c1f3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementRepository.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementRepository.java @@ -35,12 +35,12 @@ public class DeviceManagementRepository { public void addDeviceManagementProvider(DeviceManagerService provider) { String deviceType = provider.getProviderType(); + providers.put(deviceType, provider); try { DeviceManagerUtil.registerDeviceType(deviceType); } catch (DeviceManagementException e) { log.error("Exception occured while registering the device type.",e); } - providers.put(deviceType, provider); } public DeviceManagerService getDeviceManagementProvider(String type) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java index 94da96c419..ab71bdc5ca 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java @@ -51,7 +51,7 @@ public final class DeviceManagerUtil { } /** - * Resolve data source from the data source definition + * Resolve data source from the data source definition. * * @param config data source configuration * @return data source resolved from the data source definition @@ -84,6 +84,12 @@ public final class DeviceManagerUtil { return dataSource; } + /** + * Adds a new device type to the database if it does not exists. + * + * @param deviceTypeName device type + * @return status of the operation + */ public static boolean registerDeviceType(String deviceTypeName) throws DeviceManagementException{ boolean status = false; try {