diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileFeaturePropertyDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileFeaturePropertyDAOImpl.java deleted file mode 100644 index a71db74ab..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileFeaturePropertyDAOImpl.java +++ /dev/null @@ -1,250 +0,0 @@ -///* -// * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. -// * -// * WSO2 Inc. licenses this file to you under the Apache License, -// * Version 2.0 (the "License"); you may not use this file except -// * in compliance with the License. -// * you may obtain a copy of the License at -// * -// * http://www.apache.org/licenses/LICENSE-2.0 -// * -// * Unless required by applicable law or agreed to in writing, -// * software distributed under the License is distributed on an -// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// * KIND, either express or implied. See the License for the -// * specific language governing permissions and limitations -// * under the License. -// */ -// -//package org.wso2.carbon.device.mgt.mobile.dao.impl; -// -//import org.apache.commons.logging.Log; -//import org.apache.commons.logging.LogFactory; -//import org.wso2.carbon.device.mgt.mobile.dao.MobileFeaturePropertyDAO; -//import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException; -//import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil; -//import org.wso2.carbon.device.mgt.mobile.dto.MobileFeatureProperty; -// -//import javax.sql.DataSource; -//import java.sql.Connection; -//import java.sql.PreparedStatement; -//import java.sql.ResultSet; -//import java.sql.SQLException; -//import java.util.ArrayList; -//import java.util.List; -// -///** -// * Implementation of MobileFeaturePropertyDAO. -// */ -//public class MobileFeaturePropertyDAOImpl implements MobileFeaturePropertyDAO { -// -// private DataSource dataSource; -// private static final Log log = LogFactory.getLog(MobileFeaturePropertyDAOImpl.class); -// -// public MobileFeaturePropertyDAOImpl(DataSource dataSource) { -// this.dataSource = dataSource; -// } -// -// @Override -// public boolean addMobileFeatureProperty(MobileFeatureProperty mblFeatureProperty) -// throws MobileDeviceManagementDAOException { -// boolean status = false; -// Connection conn = null; -// PreparedStatement stmt = null; -// try { -// conn = this.getConnection(); -// String createDBQuery = -// "INSERT INTO AD_FEATURE_PROPERTY(PROPERTY, FEATURE_ID) VALUES (?, ?)"; -// -// stmt = conn.prepareStatement(createDBQuery); -// stmt.setString(1, mblFeatureProperty.getProperty()); -// stmt.setInt(2, mblFeatureProperty.getFeatureID()); -// int rows = stmt.executeUpdate(); -// if (rows > 0) { -// status = true; -// if (log.isDebugEnabled()) { -// log.debug("Added MobileFeatureProperty " + mblFeatureProperty.getProperty() + -// " to the MDM database."); -// } -// } -// } catch (SQLException e) { -// String msg = "Error occurred while adding property id - '" + -// mblFeatureProperty.getFeatureID() + "'"; -// log.error(msg, e); -// throw new MobileDeviceManagementDAOException(msg, e); -// } finally { -// MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null); -// } -// return status; -// } -// -// @Override -// public boolean updateMobileFeatureProperty(MobileFeatureProperty mblFeatureProperty) -// throws MobileDeviceManagementDAOException { -// boolean status = false; -// Connection conn = null; -// PreparedStatement stmt = null; -// try { -// conn = this.getConnection(); -// String updateDBQuery = -// "UPDATE AD_FEATURE_PROPERTY SET FEATURE_ID = ? WHERE PROPERTY = ?"; -// stmt = conn.prepareStatement(updateDBQuery); -// stmt.setInt(1, mblFeatureProperty.getFeatureID()); -// stmt.setString(2, mblFeatureProperty.getProperty()); -// int rows = stmt.executeUpdate(); -// if (rows > 0) { -// status = true; -// if (log.isDebugEnabled()) { -// log.debug("Updated MobileFeatureProperty " + mblFeatureProperty.getProperty()); -// } -// } -// } catch (SQLException e) { -// String msg = "Error occurred while updating the feature property with property - '" + -// mblFeatureProperty.getProperty() + "'"; -// log.error(msg, e); -// throw new MobileDeviceManagementDAOException(msg, e); -// } finally { -// MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null); -// } -// return status; -// } -// -// @Override -// public boolean deleteMobileFeatureProperty(String property) -// throws MobileDeviceManagementDAOException { -// boolean status = false; -// Connection conn = null; -// PreparedStatement stmt = null; -// try { -// conn = this.getConnection(); -// String deleteDBQuery = -// "DELETE FROM AD_FEATURE_PROPERTY WHERE PROPERTY = ?"; -// stmt = conn.prepareStatement(deleteDBQuery); -// stmt.setString(1, property); -// int rows = stmt.executeUpdate(); -// if (rows > 0) { -// status = true; -// if (log.isDebugEnabled()) { -// log.debug("Deleted MobileFeatureProperty " + property + " from MDM database."); -// } -// } -// } catch (SQLException e) { -// String msg = "Error occurred while deleting feature property with property - " + -// property; -// log.error(msg, e); -// throw new MobileDeviceManagementDAOException(msg, e); -// } finally { -// MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null); -// } -// return status; -// } -// -// @Override -// public boolean deleteMobileFeaturePropertiesOfFeature(Integer mblFeatureId) -// throws MobileDeviceManagementDAOException { -// boolean status = false; -// Connection conn = null; -// PreparedStatement stmt = null; -// try { -// conn = this.getConnection(); -// String deleteDBQuery = -// "DELETE FROM AD_FEATURE_PROPERTY WHERE FEATURE_ID = ?"; -// stmt = conn.prepareStatement(deleteDBQuery); -// stmt.setInt(1, mblFeatureId); -// int rows = stmt.executeUpdate(); -// if (rows > 0) { -// status = true; -// if (log.isDebugEnabled()) { -// log.debug("Deleted all MobileFeatureProperties of FeatureId " + mblFeatureId + -// " from MDM database."); -// } -// } -// } catch (SQLException e) { -// String msg = "Error occurred while deleting feature properties of feature - " + -// mblFeatureId; -// log.error(msg, e); -// throw new MobileDeviceManagementDAOException(msg, e); -// } finally { -// MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null); -// } -// return status; -// } -// -// @Override -// public MobileFeatureProperty getMobileFeatureProperty(String property) -// throws MobileDeviceManagementDAOException { -// Connection conn = null; -// PreparedStatement stmt = null; -// MobileFeatureProperty mobileFeatureProperty = null; -// try { -// conn = this.getConnection(); -// String selectDBQuery = -// "SELECT PROPERTY, FEATURE_ID FROM AD_FEATURE_PROPERTY WHERE PROPERTY = ?"; -// stmt = conn.prepareStatement(selectDBQuery); -// stmt.setString(1, property); -// ResultSet resultSet = stmt.executeQuery(); -// if (resultSet.next()) { -// mobileFeatureProperty = new MobileFeatureProperty(); -// mobileFeatureProperty.setProperty(resultSet.getString(1)); -// mobileFeatureProperty.setFeatureID(resultSet.getInt(2)); -// if (log.isDebugEnabled()) { -// log.debug("Fetched MobileFeatureProperty " + mobileFeatureProperty.getProperty() + -// " from MDM database."); -// } -// } -// } catch (SQLException e) { -// String msg = "Error occurred while fetching property - '" + -// property + "'"; -// log.error(msg, e); -// throw new MobileDeviceManagementDAOException(msg, e); -// } finally { -// MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null); -// } -// return mobileFeatureProperty; -// } -// -// @Override -// public List getFeaturePropertiesOfFeature(Integer mblFeatureId) -// throws MobileDeviceManagementDAOException { -// Connection conn = null; -// PreparedStatement stmt = null; -// MobileFeatureProperty mobileFeatureProperty; -// List FeatureProperties = new ArrayList(); -// try { -// conn = this.getConnection(); -// String selectDBQuery = -// "SELECT PROPERTY, FEATURE_ID FROM AD_FEATURE_PROPERTY WHERE FEATURE_ID = ?"; -// stmt = conn.prepareStatement(selectDBQuery); -// stmt.setInt(1, mblFeatureId); -// ResultSet resultSet = stmt.executeQuery(); -// while (resultSet.next()) { -// mobileFeatureProperty = new MobileFeatureProperty(); -// mobileFeatureProperty.setProperty(resultSet.getString(1)); -// mobileFeatureProperty.setFeatureID(resultSet.getInt(2)); -// FeatureProperties.add(mobileFeatureProperty); -// } -// if (log.isDebugEnabled()) { -// log.debug("Fetched all MobileFeatureProperties of featureId " + mblFeatureId + -// " from MDM database."); -// } -// return FeatureProperties; -// } catch (SQLException e) { -// String msg = "Error occurred while fetching all feature property.'"; -// log.error(msg, e); -// throw new MobileDeviceManagementDAOException(msg, e); -// } finally { -// MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null); -// } -// } -// -// private Connection getConnection() throws MobileDeviceManagementDAOException { -// try { -// return dataSource.getConnection(); -// } catch (SQLException e) { -// String msg = "Error occurred while obtaining a connection from the mobile device " + -// "management metadata repository datasource."; -// log.error(msg, e); -// throw new MobileDeviceManagementDAOException(msg, e); -// } -// } -//} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/AndroidDAOFactory.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/AndroidDAOFactory.java index 3a9e52758..c96bbf437 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/AndroidDAOFactory.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/AndroidDAOFactory.java @@ -47,7 +47,7 @@ public class AndroidDAOFactory extends AbstractMobileDeviceManagementDAOFactory public MobileFeatureDAO getMobileFeatureDAO() { return new AndroidFeatureDAOImpl(); } - + public static void beginTransaction() throws MobileDeviceManagementDAOException { try { Connection conn = dataSource.getConnection();