From ab08b835f4818d5e3a03a3552382cdca49bdb5fa Mon Sep 17 00:00:00 2001 From: manoj Date: Thu, 26 Mar 2015 17:20:52 +0530 Subject: [PATCH] Create plugin level databases --- .../mgt/common/operation/mgt/Operation.java | 11 ++++ .../operation/mgt/OperationManager.java | 61 ++++++++++--------- .../DeviceManagementServiceProviderImpl.java | 6 ++ .../operation/mgt/OperationManagerImpl.java | 12 +++- .../service/DeviceManagementServiceImpl.java | 7 +++ 5 files changed, 66 insertions(+), 31 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/operation/mgt/Operation.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/operation/mgt/Operation.java index 0f3d46a473..edbdee5cb5 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/operation/mgt/Operation.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/operation/mgt/Operation.java @@ -32,6 +32,7 @@ public class Operation { private String code; private Properties properties; private Type type; + private Long operationId; @XmlElement public String getCode() { @@ -59,4 +60,14 @@ public class Operation { public void setType(Type type) { this.type = type; } + + public Long getOperationId() { + return operationId; + } + + public void setOperationId(Long operationId) { + this.operationId = operationId; + } + + } \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/operation/mgt/OperationManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/operation/mgt/OperationManager.java index 51a7e0ee1e..df39d00747 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/operation/mgt/OperationManager.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/operation/mgt/OperationManager.java @@ -17,8 +17,7 @@ */ package org.wso2.carbon.device.mgt.common.operation.mgt; -import org.wso2.carbon.device.mgt.common.*; - +import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import java.util.List; /** @@ -27,35 +26,37 @@ import java.util.List; */ public interface OperationManager { - /** - * Method to add a operation to a device or a set of devices. - * - * @param operation Operation to be added - * @param devices List of DeviceIdentifiers to execute the operation - * @throws OperationManagementException If some unusual behaviour is observed while adding the - * operation - */ - public boolean addOperation(Operation operation, - List devices) throws OperationManagementException; - - /** - * Method to retrieve the list of all operations to a device. - * - * @param deviceId DeviceIdentifier of the device - * @throws OperationManagementException If some unusual behaviour is observed while fetching the - * operation list. - */ - public List getOperations(DeviceIdentifier deviceId) throws OperationManagementException; - - /** - * Method to retrieve the list of available operations to a device. - * - * @param deviceId DeviceIdentifier of the device - * @throws OperationManagementException If some unusual behaviour is observed while fetching the - * operation list. - */ - public List getPendingOperations(DeviceIdentifier deviceId) throws OperationManagementException; + /** + * Method to add a operation to a device or a set of devices. + * + * @param operation Operation to be added + * @param devices List of DeviceIdentifiers to execute the operation + * @throws OperationManagementException If some unusual behaviour is observed while adding the + * operation + */ + public boolean addOperation(Operation operation, + List devices) throws OperationManagementException; + + /** + * Method to retrieve the list of all operations to a device. + * + * @param deviceId DeviceIdentifier of the device + * @throws OperationManagementException If some unusual behaviour is observed while fetching the + * operation list. + */ + public List getOperations(DeviceIdentifier deviceId) throws OperationManagementException; + + /** + * Method to retrieve the list of available operations to a device. + * + * @param deviceId DeviceIdentifier of the device + * @throws OperationManagementException If some unusual behaviour is observed while fetching the + * operation list. + */ + public List getPendingOperations(DeviceIdentifier deviceId) throws OperationManagementException; public Operation getPendingOperation(DeviceIdentifier deviceId) throws OperationManagementException; + public Operation updateOperation(Long operationId, DeviceIdentifier deviceIdentifier, String responsePayLoad) + throws OperationManagementException; } \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementServiceProviderImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementServiceProviderImpl.java index 5f0d5fcbb1..4c1b60cd38 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementServiceProviderImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementServiceProviderImpl.java @@ -360,4 +360,10 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ return null; } + @Override + public Operation updateOperation(Long operationId, DeviceIdentifier deviceIdentifier, + String responsePayLoad) throws OperationManagementException { + return null; + } + } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java index 02b664321b..c4685cbf4f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java @@ -91,6 +91,11 @@ public class OperationManagerImpl implements OperationManager { @Override public List getOperations(DeviceIdentifier deviceId) throws OperationManagementException { return null; + try{ + this.lookupOperationDAO(operation) + + + }catch(OperationManagementDAOException ex){} } @Override @@ -103,6 +108,12 @@ public class OperationManagerImpl implements OperationManager { return null; } + @Override + public Operation updateOperation(Long operationId, DeviceIdentifier deviceIdentifier, + String responsePayLoad) throws OperationManagementException { + return null; + } + private OperationDAO lookupOperationDAO(Operation operation) { if (operation instanceof CommandOperation) { return commandOperationDAO; @@ -112,5 +123,4 @@ public class OperationManagerImpl implements OperationManager { return simpleOperationDAO; } } - } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementServiceImpl.java index e7835abaf9..15bdeaa59f 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementServiceImpl.java @@ -135,10 +135,17 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { return null; } + @Override + public Operation updateOperation(Long operationId, DeviceIdentifier deviceIdentifier, + String responsePayLoad) throws OperationManagementException { + return null; + } + @Override public void sendEnrolmentInvitation(EmailMessageProperties emailMessageProperties) throws DeviceManagementException { DeviceManagementDataHolder.getInstance().getDeviceManagementProvider() .sendEnrolmentInvitation(emailMessageProperties); } + }