org.springframework.jdbc.support.nativejdbc
Class NativeJdbcExtractorAdapter

java.lang.Object
  extended byorg.springframework.jdbc.support.nativejdbc.NativeJdbcExtractorAdapter
All Implemented Interfaces:
NativeJdbcExtractor
Direct Known Subclasses:
CommonsDbcpNativeJdbcExtractor, JBossNativeJdbcExtractor, SimpleNativeJdbcExtractor, WebLogicNativeJdbcExtractor, XAPoolNativeJdbcExtractor

public abstract class NativeJdbcExtractorAdapter
extends java.lang.Object
implements NativeJdbcExtractor

Abstract adapter class for the NativeJdbcExtractor interface, for simplified implementation of basic extractors. Returns the passed-in JDBC objects on all methods.

The getNativeConnectionFromStatement method is implemented to simply delegate to getNativeConnection with the Statement's Connection. This is what most extractor implementations will stick to, unless there's a more efficient version for a specific pool.

Since:
02.06.2004
Author:
Juergen Hoeller
See Also:
getNativeConnectionFromStatement(java.sql.Statement), getNativeConnection(java.sql.Connection)

Constructor Summary
NativeJdbcExtractorAdapter()
           
 
Method Summary
 java.sql.CallableStatement getNativeCallableStatement(java.sql.CallableStatement cs)
          Not able to unwrap: return passed-in CallableStatement.
 java.sql.Connection getNativeConnection(java.sql.Connection con)
          Not able to unwrap: return passed-in Connection.
 java.sql.Connection getNativeConnectionFromStatement(java.sql.Statement stmt)
          Retrieve the Connection via the Statement's Connection.
 java.sql.PreparedStatement getNativePreparedStatement(java.sql.PreparedStatement ps)
          Not able to unwrap: return passed-in PreparedStatement.
 java.sql.ResultSet getNativeResultSet(java.sql.ResultSet rs)
          Not able to unwrap: return passed-in ResultSet.
 java.sql.Statement getNativeStatement(java.sql.Statement stmt)
          Not able to unwrap: return passed-in Statement.
 boolean isNativeConnectionNecessaryForNativeCallableStatements()
          Return false by default.
 boolean isNativeConnectionNecessaryForNativePreparedStatements()
          Return false by default.
 boolean isNativeConnectionNecessaryForNativeStatements()
          Return false by default.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NativeJdbcExtractorAdapter

public NativeJdbcExtractorAdapter()
Method Detail

isNativeConnectionNecessaryForNativeStatements

public boolean isNativeConnectionNecessaryForNativeStatements()
Return false by default.

Specified by:
isNativeConnectionNecessaryForNativeStatements in interface NativeJdbcExtractor

isNativeConnectionNecessaryForNativePreparedStatements

public boolean isNativeConnectionNecessaryForNativePreparedStatements()
Return false by default.

Specified by:
isNativeConnectionNecessaryForNativePreparedStatements in interface NativeJdbcExtractor

isNativeConnectionNecessaryForNativeCallableStatements

public boolean isNativeConnectionNecessaryForNativeCallableStatements()
Return false by default.

Specified by:
isNativeConnectionNecessaryForNativeCallableStatements in interface NativeJdbcExtractor

getNativeConnection

public java.sql.Connection getNativeConnection(java.sql.Connection con)
                                        throws java.sql.SQLException
Not able to unwrap: return passed-in Connection.

Specified by:
getNativeConnection in interface NativeJdbcExtractor
Parameters:
con - the Connection handle, potentially wrapped by a connection pool
Returns:
the underlying native JDBC Connection, if possible; else, the original Connection
Throws:
java.sql.SQLException - if thrown by JDBC methods

getNativeConnectionFromStatement

public java.sql.Connection getNativeConnectionFromStatement(java.sql.Statement stmt)
                                                     throws java.sql.SQLException
Retrieve the Connection via the Statement's Connection.

Specified by:
getNativeConnectionFromStatement in interface NativeJdbcExtractor
Parameters:
stmt - the Statement handle, potentially wrapped by a connection pool
Returns:
the underlying native JDBC Connection, if possible; else, the original Connection
Throws:
java.sql.SQLException - if thrown by JDBC methods
See Also:
getNativeConnection(java.sql.Connection), Statement.getConnection()

getNativeStatement

public java.sql.Statement getNativeStatement(java.sql.Statement stmt)
                                      throws java.sql.SQLException
Not able to unwrap: return passed-in Statement.

Specified by:
getNativeStatement in interface NativeJdbcExtractor
Parameters:
stmt - the Statement handle, potentially wrapped by a connection pool
Returns:
the underlying native JDBC Statement, if possible; else, the original Connection
Throws:
java.sql.SQLException - if thrown by JDBC methods

getNativePreparedStatement

public java.sql.PreparedStatement getNativePreparedStatement(java.sql.PreparedStatement ps)
                                                      throws java.sql.SQLException
Not able to unwrap: return passed-in PreparedStatement.

Specified by:
getNativePreparedStatement in interface NativeJdbcExtractor
Parameters:
ps - the PreparedStatement handle, potentially wrapped by a connection pool
Returns:
the underlying native JDBC PreparedStatement, if possible; else, the original Connection
Throws:
java.sql.SQLException - if thrown by JDBC methods

getNativeCallableStatement

public java.sql.CallableStatement getNativeCallableStatement(java.sql.CallableStatement cs)
                                                      throws java.sql.SQLException
Not able to unwrap: return passed-in CallableStatement.

Specified by:
getNativeCallableStatement in interface NativeJdbcExtractor
Parameters:
cs - the CallableStatement handle, potentially wrapped by a connection pool
Returns:
the underlying native JDBC CallableStatement, if possible; else, the original Connection
Throws:
java.sql.SQLException - if thrown by JDBC methods

getNativeResultSet

public java.sql.ResultSet getNativeResultSet(java.sql.ResultSet rs)
                                      throws java.sql.SQLException
Not able to unwrap: return passed-in ResultSet.

Specified by:
getNativeResultSet in interface NativeJdbcExtractor
Parameters:
rs - the ResultSet handle, potentially wrapped by a connection pool
Returns:
the underlying native JDBC ResultSet, if possible; else, the original Connection
Throws:
java.sql.SQLException - if thrown by JDBC methods


Copyright (C) 2003-2004 The Spring Framework Project.