org.logicalcobwebs.proxool

Class WrappedConnection

Implemented Interfaces:
MethodInterceptor

public class WrappedConnection
extends java.lang.Object
implements MethodInterceptor

Wraps up a ProxyConnection. It is proxied as a java.sql.Connection
Version:
$Revision: 1.6 $, $Date: 2006/01/18 14:40:02 $
Authors:
Bill Horsman
$Author: billhorsman $ (current maintainer)
Since:
Proxool 0.9

Constructor Summary

WrappedConnection(ProxyConnection proxyConnection)
Construct this wrapper around the proxy connection

Method Summary

boolean
equals(Object obj)
If the object passed to this method is actually a proxied version of this class then compare the real class with this one.
String
getAlias()
Get the alias of the connection pool this connection belongs to
long
getId()
The ID for the encapsulated ProxyConnection.
ProxyConnection
getProxyConnection()
Get the encapsulated proxy connection
Object
intercept(Object obj, Method method, Object[] args, MethodProxy proxy)
Delegates to invoke
Object
invoke(Object proxy, Method method, Object[] args)
Delegates all operations to the encapsulated ProxyConnection except for:
  • close()
  • equals()
  • hashCode()
  • isClosed()
  • getMetaData()
  • finalize()
It also spots mutators and remembers that the property has been changed so that it can be reset.
String
toString()

Constructor Details

WrappedConnection

public WrappedConnection(ProxyConnection proxyConnection)
Construct this wrapper around the proxy connection
Parameters:
proxyConnection - to wrap

Method Details

equals

public boolean equals(Object obj)
If the object passed to this method is actually a proxied version of this class then compare the real class with this one.
Parameters:
obj - the object to compare
Returns:
true if the object is a proxy of "this"

getAlias

public String getAlias()
Get the alias of the connection pool this connection belongs to

getId

public long getId()
The ID for the encapsulated ProxyConnection. This will still return the correct value after the connection is closed.
Returns:
the ID

getProxyConnection

public ProxyConnection getProxyConnection()
Get the encapsulated proxy connection
Returns:
the proxy connection

intercept

public Object intercept(Object obj,
                        Method method,
                        Object[] args,
                        MethodProxy proxy)
            throws Throwable
Delegates to invoke
See Also:
MethodInterceptor.intercept(java.lang.Object, java.lang.reflect.Method, java.lang.Object[], org.logicalcobwebs.cglib.proxy.MethodProxy)

invoke

public Object invoke(Object proxy,
                     Method method,
                     Object[] args)
            throws Throwable
Delegates all operations to the encapsulated ProxyConnection except for:
  • close()
  • equals()
  • hashCode()
  • isClosed()
  • getMetaData()
  • finalize()
It also spots mutators and remembers that the property has been changed so that it can be reset. And any statements that are returned are remembered so that we can track whether all statements have been closed properly when the connection is returned to the pool.
See Also:
InvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[])

toString

public String toString()
See Also:
Object.toString()