From: Juergen H. <jho...@us...> - 2007-03-01 23:29:03
|
Update of /cvsroot/springframework/spring/src/org/springframework/jdbc/datasource In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv24691/src/org/springframework/jdbc/datasource Modified Files: Tag: mbranch-1-2 DataSourceUtils.java Log Message: revised javadoc Index: DataSourceUtils.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/jdbc/datasource/DataSourceUtils.java,v retrieving revision 1.40.2.5 retrieving revision 1.40.2.6 diff -C2 -d -r1.40.2.5 -r1.40.2.6 *** DataSourceUtils.java 22 Nov 2006 21:00:03 -0000 1.40.2.5 --- DataSourceUtils.java 1 Mar 2007 23:28:59 -0000 1.40.2.6 *************** *** 1,4 **** /* ! * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2007 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 33,42 **** /** ! * Helper class that provides static methods to obtain JDBC Connections from ! * a DataSource, and to close Connections if necessary. Has special support for ! * Spring-managed connections, e.g. for use with DataSourceTransactionManager. * ! * <p>Used internally by JdbcTemplate, JDBC operation objects and the JDBC ! * DataSourceTransactionManager. Can also be used directly in application code. * * @author Rod Johnson --- 33,44 ---- /** ! * Helper class that provides static methods for obtaining JDBC Connections from ! * a {@link javax.sql.DataSource}. Includes special support for Spring-managed ! * transactional Connections, e.g. managed by {@link DataSourceTransactionManager} ! * or {@link org.springframework.transaction.jta.JtaTransactionManager}. * ! * <p>Used internally by Spring's {@link org.springframework.jdbc.core.JdbcTemplate}, ! * Spring's JDBC operation objects and the JDBC {@link DataSourceTransactionManager}. ! * Can also be used directly in application code. * * @author Rod Johnson *************** *** 45,50 **** * @see #releaseConnection * @see DataSourceTransactionManager ! * @see org.springframework.jdbc.core.JdbcTemplate ! * @see org.springframework.jdbc.object */ public abstract class DataSourceUtils { --- 47,52 ---- * @see #releaseConnection * @see DataSourceTransactionManager ! * @see org.springframework.transaction.jta.JtaTransactionManager ! * @see org.springframework.transaction.support.TransactionSynchronizationManager */ public abstract class DataSourceUtils { *************** *** 60,75 **** /** ! * Get a Connection from the given DataSource. Changes any SQL exception into * the Spring hierarchy of unchecked generic data access exceptions, simplifying * calling code and making any exception that is thrown more meaningful. * <p>Is aware of a corresponding Connection bound to the current thread, for example ! * when using DataSourceTransactionManager. Will bind a Connection to the thread ! * if transaction synchronization is active (e.g. if in a JTA transaction). * @param dataSource DataSource to get Connection from * @return a JDBC Connection from the given DataSource * @throws org.springframework.jdbc.CannotGetJdbcConnectionException * if the attempt to get a Connection failed ! * @see org.springframework.transaction.support.TransactionSynchronizationManager ! * @see DataSourceTransactionManager */ public static Connection getConnection(DataSource dataSource) throws CannotGetJdbcConnectionException { --- 62,77 ---- /** ! * Obtain a Connection from the given DataSource. Translates any SQLException into * the Spring hierarchy of unchecked generic data access exceptions, simplifying * calling code and making any exception that is thrown more meaningful. * <p>Is aware of a corresponding Connection bound to the current thread, for example ! * when using {@link DataSourceTransactionManager}. Will bind a Connection to the ! * thread if transaction synchronization is active, e.g. when running within a ! * {@link org.springframework.transaction.jta.JtaTransactionManager JTA} transaction). * @param dataSource DataSource to get Connection from * @return a JDBC Connection from the given DataSource * @throws org.springframework.jdbc.CannotGetJdbcConnectionException * if the attempt to get a Connection failed ! * @see #releaseConnection */ public static Connection getConnection(DataSource dataSource) throws CannotGetJdbcConnectionException { *************** *** 83,97 **** /** ! * Actually get a JDBC Connection for the given DataSource. ! * Same as <code>getConnection</code>, but throwing the original SQLException. * <p>Is aware of a corresponding Connection bound to the current thread, for example ! * when using DataSourceTransactionManager. Will bind a Connection to the thread * if transaction synchronization is active (e.g. if in a JTA transaction). ! * <p>Directly accessed by TransactionAwareDataSourceProxy. * @param dataSource DataSource to get Connection from * @return a JDBC Connection from the given DataSource * @throws SQLException if thrown by JDBC methods ! * @see #getConnection(DataSource) ! * @see TransactionAwareDataSourceProxy */ public static Connection doGetConnection(DataSource dataSource) throws SQLException { --- 85,98 ---- /** ! * Actually obtain a JDBC Connection for the given DataSource. ! * Same as {@link #getConnection}, but throwing the original SQLException. * <p>Is aware of a corresponding Connection bound to the current thread, for example ! * when using {@link DataSourceTransactionManager}. Will bind a Connection to the thread * if transaction synchronization is active (e.g. if in a JTA transaction). ! * <p>Directly accessed by {@link TransactionAwareDataSourceProxy}. * @param dataSource DataSource to get Connection from * @return a JDBC Connection from the given DataSource * @throws SQLException if thrown by JDBC methods ! * @see #doReleaseConnection */ public static Connection doGetConnection(DataSource dataSource) throws SQLException { *************** *** 214,217 **** --- 215,219 ---- * @param stmt the JDBC Statement object * @param dataSource DataSource that the Connection came from + * @throws SQLException if thrown by JDBC methods * @see java.sql.Statement#setQueryTimeout */ *************** *** 239,247 **** * Close the given Connection, created via the given DataSource, * if it is not managed externally (that is, not bound to the thread). - * Will never close a Connection from a SmartDataSource returning shouldClose=false. * @param con the Connection to close if necessary * (if this is <code>null</code>, the call will be ignored) ! * @param dataSource the DataSource that the Connection came from ! * (can be <code>null</code>) * @see SmartDataSource#shouldClose */ --- 241,249 ---- * Close the given Connection, created via the given DataSource, * if it is not managed externally (that is, not bound to the thread). * @param con the Connection to close if necessary * (if this is <code>null</code>, the call will be ignored) ! * @param dataSource the DataSource that the Connection was obtained from ! * (may be <code>null</code>) ! * @see #getConnection * @see SmartDataSource#shouldClose */ *************** *** 260,271 **** /** * Actually release a JDBC Connection for the given DataSource. ! * Same as <code>releaseConnection</code>, but throwing the original SQLException. * <p>Directly accessed by TransactionAwareDataSourceProxy. * @param con the Connection to close if necessary * (if this is <code>null</code>, the call will be ignored) ! * @param dataSource the DataSource that the Connection came from ! * (can be <code>null</code>) * @throws SQLException if thrown by JDBC methods ! * @see #releaseConnection * @see TransactionAwareDataSourceProxy */ --- 262,273 ---- /** * Actually release a JDBC Connection for the given DataSource. ! * Same as {@link #releaseConnection}, but throwing the original SQLException. * <p>Directly accessed by TransactionAwareDataSourceProxy. * @param con the Connection to close if necessary * (if this is <code>null</code>, the call will be ignored) ! * @param dataSource the DataSource that the Connection was obtained from ! * (may be <code>null</code>) * @throws SQLException if thrown by JDBC methods ! * @see #doGetConnection * @see TransactionAwareDataSourceProxy */ *************** *** 285,289 **** // Leave the Connection open only if the DataSource is our ! // special data source, and it wants the Connection left open. if (!(dataSource instanceof SmartDataSource) || ((SmartDataSource) dataSource).shouldClose(con)) { logger.debug("Returning JDBC Connection to DataSource"); --- 287,291 ---- // Leave the Connection open only if the DataSource is our ! // special SmartDataSoruce and it wants the Connection left open. if (!(dataSource instanceof SmartDataSource) || ((SmartDataSource) dataSource).shouldClose(con)) { logger.debug("Returning JDBC Connection to DataSource"); *************** *** 293,297 **** /** ! * Return whether the given two Connections are equal, asking the target * Connection in case of a proxy. Used to detect equality even if the * user passed in a raw target Connection while the held one is a proxy. --- 295,299 ---- /** ! * Determine whether the given two Connections are equal, asking the target * Connection in case of a proxy. Used to detect equality even if the * user passed in a raw target Connection while the held one is a proxy. *************** *** 299,302 **** --- 301,305 ---- * @param passedInCon the Connection passed-in by the user * (potentially a target Connection without proxy) + * @return whether the given Connections are equal * @see #getTargetConnection */ |