From 08b78cff13dc1e86983c5ce449302c5dd09f7a06 Mon Sep 17 00:00:00 2001 From: prabathabey Date: Thu, 4 Dec 2014 10:36:14 +0530 Subject: [PATCH] further cleaning up SPIs --- .../wso2/carbon/device/mgt/common/Device.java | 2 +- .../mgt/common/DeviceManagementConstants.java | 2 +- .../carbon/device/mgt/common/Feature.java | 2 +- .../mgt/common/spi/DeviceManagerService.java | 74 ++++++++++++++++--- 4 files changed, 66 insertions(+), 14 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/Device.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/Device.java index 6c6d0f50651..208d009326b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/Device.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/Device.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2012, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceManagementConstants.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceManagementConstants.java index 4af0069f6cf..3edae67527e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceManagementConstants.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceManagementConstants.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2012, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/Feature.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/Feature.java index 084b4fba568..388edbb402d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/Feature.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/Feature.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2012, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceManagerService.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceManagerService.java index c8690f82087..e73a0af7666 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceManagerService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceManagerService.java @@ -16,6 +16,7 @@ package org.wso2.carbon.device.mgt.common.spi; import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.device.mgt.common.DeviceManagementException; import java.util.List; @@ -25,25 +26,76 @@ import java.util.List; */ public interface DeviceManagerService { - /* - Method corresponding to enrolling a particular device of type mobile, IoT, etc within CDM + /** + * Method to enrolling a particular device of type mobile, IoT, etc within CDM. + * @param device Metadata corresponding to the device being enrolled + * @throws DeviceManagementException If some unusual behaviour is observed while enrolling a device */ - void enrolDevice(Device device); + void enrolDevice(Device device) throws DeviceManagementException; - void modifyEnrolment(Device device); + /** + * Method to modify the metadata corresponding to device enrollment + * @param device Modified device enrollment related metadata + * @throws DeviceManagementException If some unusual behaviour is observed while modify the enrollment of a + * device + */ + void modifyEnrolment(Device device) throws DeviceManagementException; - void disEnrollDevice(String type, String deviceId); + /** + * Method to disenroll a particular device from CDM. + * @param type Device Type + * @param deviceId Device Identifier + * @throws DeviceManagementException + */ + void disEnrollDevice(String type, String deviceId) throws DeviceManagementException; - boolean isRegistered(); + /** + * Method to retrieve the status of the registration process of a particular device. + * @param type Device Type + * @param deviceId Device Identifier + * @return Status of enrollment + * @throws DeviceManagementException If some unusual behaviour is observed while enrolling a device + */ + boolean isRegistered(String type, String deviceId) throws DeviceManagementException; - boolean isActive(); + /** + * Method to retrieve the status of a particular device. + * @param type Device Type + * @param deviceId Device Identifier + * @return Returns if the device is active + * @throws DeviceManagementException If some unusual behaviour is observed while enrolling a device + */ + boolean isActive(String type, String deviceId) throws DeviceManagementException; - void setActive(boolean status); + /** + * Method to set the status indicating whether a particular device registered within CDM is enabled at a given + * moment. + * @param status Indicates whether the device is active + * @throws DeviceManagementException If some unusual behaviour is observed while enrolling a device + */ + void setActive(boolean status) throws DeviceManagementException; - List getAllDeviceInfo(String type); + /** + * Method to retrieve metadata of all devices registered within CDM corresponding to a particular device type. + * @param type Device Type + * @return List of metadata corresponding to all devices registered within CDM + */ + List getAllDeviceInfo(String type) throws DeviceManagementException; - Device getDeviceInfo(String type, String deviceId); + /** + * Method to retrieve metadata of a device corresponding to a particular type that carries a specific identifier. + * @param type Device Type + * @param deviceId Device Identifier + * @return Metadata corresponding to a particular device + * @throws DeviceManagementException If some unusual behaviour is observed while enrolling a device + */ + Device getDeviceInfo(String type, String deviceId) throws DeviceManagementException; - void setOwnership(String ownershipType); + /** + * Method to set the ownership type of a particular device. i.e. BYOD, COPE + * @param ownershipType Type of ownership + * @throws DeviceManagementException If some unusual behaviour is observed while enrolling a device + */ + void setOwnership(String ownershipType) throws DeviceManagementException; }