public void registerApplication( String userName, String appName, String hostName, int portNumber, String appContext, String publicResource) throws SQLException { Connection conn = null; boolean defaultAutoCommit = true; try { conn = loginDS.getConnection(); defaultAutoCommit = conn.getAutoCommit(); conn.setAutoCommit(false); int appId = SQLHandler.insertApplicationDetails( conn, appName, hostName, portNumber, appContext, publicResource); SQLHandler.insertUserAppDetail(conn, userName, appId); conn.commit(); } catch (SQLException e) { conn.rollback(); } finally { conn.setAutoCommit(defaultAutoCommit); DBUtil.closeConnectionIgnoreException(conn); } }
public ApplicationData getApplicationDetails(int appId) throws SQLException { Connection conn = null; try { conn = loginDS.getConnection(); return SQLHandler.getApplicationDetails(conn, appId); } finally { DBUtil.closeConnectionIgnoreException(conn); } }
public List<ApplicationData> getUserApplicationsList(String userName) throws SQLException { Connection conn = null; try { conn = loginDS.getConnection(); return SQLHandler.getUserApplicationsList(conn, userName); } catch (SQLException e) { logger.error("Exception occurred while fetching user details", e); throw e; } finally { DBUtil.closeConnectionIgnoreException(conn); } }
public void updateApplicationDetails( int appId, String appName, String hostName, int portNumber, String appContext, String publicResource) throws SQLException { Connection conn = null; try { conn = loginDS.getConnection(); SQLHandler.updateApplicationDetails( conn, appId, appName, hostName, portNumber, appContext, publicResource); } finally { DBUtil.closeConnectionIgnoreException(conn); } }
public void unRegisterApplication(String userName, int appId) throws SQLException { Connection conn = null; boolean defaultAutoCommit = true; try { conn = loginDS.getConnection(); defaultAutoCommit = conn.getAutoCommit(); conn.setAutoCommit(false); SQLHandler.removeApplicationDetails(conn, appId); SQLHandler.removeUserAppDetail(conn, userName, appId); conn.commit(); } catch (SQLException e) { conn.rollback(); throw e; } finally { conn.setAutoCommit(defaultAutoCommit); DBUtil.closeConnectionIgnoreException(conn); } }