org.logicalcobwebs.proxool
Class ProxyDatabaseMetaData

java.lang.Object
  extended by org.logicalcobwebs.proxool.ProxyDatabaseMetaData
All Implemented Interfaces:
Callback, MethodInterceptor

 class ProxyDatabaseMetaData
extends java.lang.Object
implements MethodInterceptor

Delegates to a normal Coonection for everything but the close() method (when it puts itself back into the pool instead).

Version:
$Revision: 1.8 $, $Date: 2004/06/02 20:50:47 $
Author:
billhorsman, $Author: billhorsman $ (current maintainer)

Field Summary
private  java.sql.DatabaseMetaData databaseMetaData
           
private static java.lang.String EQUALS_METHOD
           
private static java.lang.String FINALIZE_METHOD
           
private static java.lang.String GET_CONNECTION_METHOD
           
private static Log LOG
           
private  java.sql.Connection wrappedConnection
           
 
Constructor Summary
ProxyDatabaseMetaData(java.sql.DatabaseMetaData databaseMetaData, java.sql.Connection wrappedConnection)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
          Whether the underlying databaseMetaData are equal
 java.sql.Connection getConnection()
          We don't want to ask the DatabaseMetaData object for the connection or we will get the delegate instead of the Proxool one.
protected  java.sql.DatabaseMetaData getDatabaseMetaData()
          Get the DatabaseMetaData from the connection
 java.lang.Object intercept(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args, MethodProxy methodProxy)
          All generated proxied methods call this method instead of the original method.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOG

private static final Log LOG

GET_CONNECTION_METHOD

private static final java.lang.String GET_CONNECTION_METHOD
See Also:
Constant Field Values

EQUALS_METHOD

private static final java.lang.String EQUALS_METHOD
See Also:
Constant Field Values

FINALIZE_METHOD

private static final java.lang.String FINALIZE_METHOD
See Also:
Constant Field Values

databaseMetaData

private java.sql.DatabaseMetaData databaseMetaData

wrappedConnection

private java.sql.Connection wrappedConnection
Constructor Detail

ProxyDatabaseMetaData

public ProxyDatabaseMetaData(java.sql.DatabaseMetaData databaseMetaData,
                             java.sql.Connection wrappedConnection)
Parameters:
databaseMetaData - the meta data we use to delegate all calls to (except getConnection())
wrappedConnection - the connection we return if asked for the connection
Method Detail

intercept

public java.lang.Object intercept(java.lang.Object proxy,
                                  java.lang.reflect.Method method,
                                  java.lang.Object[] args,
                                  MethodProxy methodProxy)
                           throws java.lang.Throwable
Description copied from interface: MethodInterceptor
All generated proxied methods call this method instead of the original method. The original method may either be invoked by normal reflection using the Method object, or by using the MethodProxy (faster).

Specified by:
intercept in interface MethodInterceptor
Parameters:
proxy - "this", the enhanced object
method - intercepted Method
args - argument array; primitive types are wrapped
methodProxy - used to invoke super (non-intercepted method); may be called as many times as needed
Returns:
any value compatible with the signature of the proxied method. Method returning void will ignore this value.
Throws:
java.lang.Throwable - any exception may be thrown; if so, super method will not be invoked
See Also:
MethodProxy

equals

public boolean equals(java.lang.Object obj)
Whether the underlying databaseMetaData are equal

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object (probably another databaseMetaData) that we are being compared to
Returns:
whether they are the same

getConnection

public java.sql.Connection getConnection()
We don't want to ask the DatabaseMetaData object for the connection or we will get the delegate instead of the Proxool one.

See Also:
DatabaseMetaData.getConnection()

getDatabaseMetaData

protected java.sql.DatabaseMetaData getDatabaseMetaData()
Get the DatabaseMetaData from the connection

Returns:
databaseMetaData

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()