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

java.lang.Object
  extended by org.ow2.jonas.jndi.interceptors.impl.datasource.ConnectionProxy
All Implemented Interfaces:
InvocationHandler

public class ConnectionProxy
extends Object
implements InvocationHandler

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

Author:
Florent Benoit

Constructor Summary
ConnectionProxy(Long id, DatasourceWrapper datasourceWrapper, Connection wrappedConnection, StackTraceElement[] stackTraceElements)
          Constructor of the handler of the proxy.
 
Method Summary
protected  Long getId()
           
protected  StackTraceElement[] getStackTraceElements()
           
protected  Connection getWrappedConnection()
           
 Object invoke(Object proxy, Method method, 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(Long id,
                       DatasourceWrapper datasourceWrapper,
                       Connection wrappedConnection,
                       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 Object invoke(Object proxy,
                     Method method,
                     Object[] args)
              throws SQLException,
                     Throwable
Intercept methods called on the connection object.

Specified by:
invoke in interface 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:
Throwable - the exception to throw from the method invocation on the proxy instance.
SQLException

getId

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

getStackTraceElements

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

getWrappedConnection

protected Connection getWrappedConnection()
Returns:
wrapped connection.


Copyright © 2010 OW2 Consortium. All Rights Reserved.