From d5127f687402e9fca737f7ef8f989a2770c65f15 Mon Sep 17 00:00:00 2001 From: prabathabey Date: Tue, 17 Mar 2015 21:04:25 +0530 Subject: [PATCH] Code cleanup and fixing build failures --- .../internal/DeviceManagementServiceComponent.java | 2 +- .../mgt/core/operation/mgt/OperationManagerImpl.java | 2 +- .../mgt/dao/OperationManagementDAOFactory.java | 6 +++--- .../operation/mgt/dao/impl/AbstractOperationDAO.java | 10 ---------- .../mgt/dao/impl/CommandOperationDAOImpl.java | 4 ---- .../operation/mgt/dao/impl/ConfigOperationDAOImpl.java | 4 ---- .../operation/mgt/dao/impl/SimpleOperationDAOImpl.java | 4 ---- 7 files changed, 5 insertions(+), 27 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementServiceComponent.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementServiceComponent.java index ac3a7b832ef..cee59d9d1da 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementServiceComponent.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementServiceComponent.java @@ -125,7 +125,7 @@ public class DeviceManagementServiceComponent { } /* Registering Device Management Service */ BundleContext bundleContext = componentContext.getBundleContext(); - bundleContext.registerService(DeviceManagementServiceImpl.class.getName(), + bundleContext.registerService(DeviceManagementService.class.getName(), new DeviceManagementServiceImpl(), 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 13946eb07ea..b3ba04cffb7 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 @@ -66,7 +66,7 @@ public class OperationManagerImpl implements OperationManager { try { OperationManagementDAOFactory.rollbackTransaction(); } catch (OperationManagementDAOException e1) { - log.warn("Error occurred while roll-backing the transaction", e); + log.warn("Error occurred while roll-backing the transaction", e1); } throw new OperationManagementException("Error occurred while adding operation", e); } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/OperationManagementDAOFactory.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/OperationManagementDAOFactory.java index 20c1aa2d80d..8600b00e96d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/OperationManagementDAOFactory.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/OperationManagementDAOFactory.java @@ -41,15 +41,15 @@ public class OperationManagementDAOFactory { private static ThreadLocal currentConnection = new ThreadLocal(); public static OperationDAO getCommandOperationDAO() { - return new CommandOperationDAOImpl(dataSource); + return new CommandOperationDAOImpl(); } public static OperationDAO getConfigOperationDAO() { - return new ConfigOperationDAOImpl(dataSource); + return new ConfigOperationDAOImpl(); } public static OperationDAO getSimpleOperationDAO() { - return new SimpleOperationDAOImpl(dataSource); + return new SimpleOperationDAOImpl(); } public static OperationMappingDAO getOperationMappingDAO() { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/AbstractOperationDAO.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/AbstractOperationDAO.java index fa7e907f26f..2467a72c331 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/AbstractOperationDAO.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/AbstractOperationDAO.java @@ -31,16 +31,6 @@ import java.sql.SQLException; public abstract class AbstractOperationDAO implements OperationDAO { - private DataSource dataSource; - - public AbstractOperationDAO(DataSource dataSource) { - this.dataSource = dataSource; - } - - public DataSource getDataSource() { - return dataSource; - } - public int addOperation(Operation operation) throws OperationManagementDAOException { PreparedStatement stmt = null; ResultSet rs = null; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/CommandOperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/CommandOperationDAOImpl.java index ba3880daee2..80936c73dbe 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/CommandOperationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/CommandOperationDAOImpl.java @@ -33,10 +33,6 @@ import java.util.List; public class CommandOperationDAOImpl extends AbstractOperationDAO { - public CommandOperationDAOImpl(DataSource dataSource) { - super(dataSource); - } - @Override public int addOperation(Operation operation) throws OperationManagementDAOException { int operationId = super.addOperation(operation); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ConfigOperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ConfigOperationDAOImpl.java index 1cc87e76a9e..b2dac4ea697 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ConfigOperationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/ConfigOperationDAOImpl.java @@ -27,10 +27,6 @@ import java.util.List; public class ConfigOperationDAOImpl extends AbstractOperationDAO { - public ConfigOperationDAOImpl(DataSource dataSource) { - super(dataSource); - } - @Override public int addOperation(Operation operation) throws OperationManagementDAOException { return 0; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/SimpleOperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/SimpleOperationDAOImpl.java index 43ba5878896..ab59e9c8f88 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/SimpleOperationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/SimpleOperationDAOImpl.java @@ -26,10 +26,6 @@ import java.util.List; public class SimpleOperationDAOImpl extends AbstractOperationDAO { - public SimpleOperationDAOImpl(DataSource dataSource) { - super(dataSource); - } - @Override public int updateOperation(Operation operation) throws OperationManagementDAOException { return 0;