org.objectweb.jonas.jndi.interceptors.impl.datasource
Class ConnectionProxy

java.lang.Object
  extended byorg.objectweb.jonas.jndi.interceptors.impl.datasource.ConnectionProxy
All Implemented Interfaces:
java.lang.reflect.InvocationHandler

public class ConnectionProxy
extends java.lang.Object
implements java.lang.reflect.InvocationHandler

Invocation handler that will monitor the calls to the stop() method.

Author:
Florent Benoit

Constructor Summary
ConnectionProxy(java.lang.Long id, DatasourceWrapper datasourceWrapper, java.sql.Connection wrappedConnection, java.lang.StackTraceElement[] stackTraceElements)
          Constructor of the handler of the proxy.
 
Method Summary
protected  java.lang.Long getId()
           
protected  java.lang.StackTraceElement[] getStackTraceElements()
           
protected  java.sql.Connection getWrappedConnection()
           
 java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
          Intercept methods called on the connection object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionProxy

public ConnectionProxy(java.lang.Long id,
                       DatasourceWrapper datasourceWrapper,
                       java.sql.Connection wrappedConnection,
                       java.lang.StackTraceElement[] stackTraceElements)
Constructor of the handler of the proxy.

Parameters:
id - the given id
datasourceWrapper - the wrapped datasource
wrappedConnection - the wrapped connection
stackTraceElements - the stack trace
Method Detail

invoke

public java.lang.Object invoke(java.lang.Object proxy,
                               java.lang.reflect.Method method,
                               java.lang.Object[] args)
                        throws java.lang.Throwable
Intercept methods called on the connection object

Specified by:
invoke in interface java.lang.reflect.InvocationHandler
Parameters:
proxy - the proxy instance that the method was invoked on
method - the Method instance corresponding to the interface method invoked on the proxy instance.
args - an array of objects containing the values of the arguments passed in the method invocation on the proxy instance, or null if interface method takes no arguments.
Returns:
the value to return from the method invocation on the proxy instance.
Throws:
java.lang.Throwable - the exception to throw from the method invocation on the proxy instance.

getId

protected java.lang.Long getId()
Returns:
id of this object.

getStackTraceElements

protected java.lang.StackTraceElement[] getStackTraceElements()
Returns:
stack trace elements.

getWrappedConnection

protected java.sql.Connection getWrappedConnection()
Returns:
wrapped connection.