From a3028b06833308cda6f80934eb0116bdcdebecf9 Mon Sep 17 00:00:00 2001 From: manoj Date: Fri, 5 Dec 2014 11:03:28 +0530 Subject: [PATCH] DAO Layer Implementation --- .../mgt/common/DeviceManagementConstants.java | 9 ++++++ .../org.wso2.carbon.device.mgt.core/pom.xml | 28 +++++++++++++++++++ .../device/mgt/core/dao/DeviceMgtDAO.java | 14 +++++----- .../device/mgt/core/dao/DeviceTypeMgtDAO.java | 10 +++---- 4 files changed, 49 insertions(+), 12 deletions(-) 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 3edae6752..5ffe6b97c 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 @@ -17,4 +17,13 @@ package org.wso2.carbon.device.mgt.common; public final class DeviceManagementConstants { + /*DEVICE Manager operations*/ + public static final String ADD_DEVICE_ENTRY = "Add device entry"; + + /*Data Source Configurations */ + + public static final class DataSourceProperties { + public static final String DB_CHECK_QUERY = "SELECT * FROM DM_DEVICE"; + public static final String SECURE_VAULT_NS = "http://org.wso2.securevault/configuration"; + } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml index aa5f4e9a5..7ad55a378 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml @@ -92,6 +92,34 @@ org.wso2.carbon.logging ${carbon.kernel.version} + + + org.wso2.carbon + org.wso2.carbon.utils + ${carbon.platform.version} + + + + org.wso2.carbon + org.wso2.carbon.ndatasource.core + ${carbon.platform.version} + + + org.wso2.carbon + org.wso2.carbon.ndatasource.rdbms + ${carbon.platform.version} + + + org.wso2.carbon + org.wso2.carbon.transaction.manager + ${carbon.platform.version} + + + + org.jboss.spec.javax.transaction + jboss-transaction-api_1.1_spec + ${jboss-transaction-api.version} + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceMgtDAO.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceMgtDAO.java index ba9a49fdd..d3369b617 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceMgtDAO.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceMgtDAO.java @@ -18,8 +18,8 @@ package org.wso2.carbon.device.mgt.core.dao; -import org.wso2.carbon.device.mgt.core.dao.exception.CDMDAOException; -import org.wso2.carbon.device.mgt.core.dao.exception.CDMDatabaseConnectionException; +import org.wso2.carbon.device.mgt.core.dao.exception.DeviceDAOException; +import org.wso2.carbon.device.mgt.core.dao.exception.DeviceDatabaseConnectionException; import org.wso2.carbon.device.mgt.core.dto.Device; import org.wso2.carbon.device.mgt.core.dto.Status; @@ -27,14 +27,14 @@ import java.util.List; public interface DeviceMgtDAO { - void addDevice(Device device) throws CDMDAOException, CDMDatabaseConnectionException; + void addDevice(Device device) throws DeviceDAOException, DeviceDatabaseConnectionException; - void updateDevice(Device device) throws CDMDAOException, CDMDatabaseConnectionException; + void updateDevice(Device device) throws DeviceDAOException, DeviceDatabaseConnectionException; - void updateDeviceStatus(Long deviceId, Status status) throws CDMDAOException, CDMDatabaseConnectionException; + void updateDeviceStatus(Long deviceId, Status status) throws DeviceDAOException, DeviceDatabaseConnectionException; - void deleteDevice(Long deviceId) throws CDMDAOException, CDMDatabaseConnectionException; + void deleteDevice(Long deviceId) throws DeviceDAOException, DeviceDatabaseConnectionException; - List getDeviceByDeviceId(Long deviceId) throws CDMDAOException, CDMDatabaseConnectionException; + List getDeviceByDeviceId(Long deviceId) throws DeviceDAOException, DeviceDatabaseConnectionException; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceTypeMgtDAO.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceTypeMgtDAO.java index 4d076e3e6..69dbde3b0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceTypeMgtDAO.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/DeviceTypeMgtDAO.java @@ -18,17 +18,17 @@ package org.wso2.carbon.device.mgt.core.dao; -import org.wso2.carbon.device.mgt.core.dao.exception.CDMDAOException; -import org.wso2.carbon.device.mgt.core.dao.exception.CDMDatabaseConnectionException; +import org.wso2.carbon.device.mgt.core.dao.exception.DeviceDAOException; +import org.wso2.carbon.device.mgt.core.dao.exception.DeviceDatabaseConnectionException; import org.wso2.carbon.device.mgt.core.dto.DeviceType; import java.util.List; public interface DeviceTypeMgtDAO { - void addDeviceType(DeviceType deviceType) throws CDMDAOException, CDMDatabaseConnectionException; + void addDeviceType(DeviceType deviceType) throws DeviceDAOException, DeviceDatabaseConnectionException; - void updateDeviceType(DeviceType deviceType) throws CDMDAOException, CDMDatabaseConnectionException; + void updateDeviceType(DeviceType deviceType) throws DeviceDAOException, DeviceDatabaseConnectionException; - List getDeviceTypes() throws CDMDAOException, CDMDatabaseConnectionException; + List getDeviceTypes() throws DeviceDAOException, DeviceDatabaseConnectionException; }