org.ow2.jonas.resource.internal.cm.sql
Class SQLConnectionInvocationHandler

java.lang.Object
  extended by org.ow2.jonas.resource.internal.cm.sql.SQLConnectionInvocationHandler
All Implemented Interfaces:
InvocationHandler

public class SQLConnectionInvocationHandler
extends Object
implements InvocationHandler

SQL Connection Wrapper

Author:
Eric Hardesty Contributor(s):

Constructor Summary
SQLConnectionInvocationHandler(Object pConn, ManagedConnectionInfo pMci, SQLManager pConman, org.objectweb.util.monolog.api.Logger pTrace)
          PreparedStatement wrapper
 
Method Summary
static Object createSQLWrapper(Object pConn, ManagedConnectionInfo pMci, SQLManager pConman, org.objectweb.util.monolog.api.Logger pTrace)
          Returns a proxy for the sql Connection
 Object invoke(Object obj, Method method, Object[] aobj)
          Invoke call on the proxy
 Object prepareStatement(Class[] pTypes, Object[] pValues)
          Invoke correct preparedStatement
 String toString()
          Return a string describing this object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SQLConnectionInvocationHandler

public SQLConnectionInvocationHandler(Object pConn,
                                      ManagedConnectionInfo pMci,
                                      SQLManager pConman,
                                      org.objectweb.util.monolog.api.Logger pTrace)
                               throws Exception
PreparedStatement wrapper

Parameters:
pConn - JDBC connection object
pMci - ManagedConnectionInfo object associated with the connection
pConman - SQLManager object holding PreparedStatement cache
pTrace - Logger object to use
Throws:
Exception - if an error occurs
Method Detail

createSQLWrapper

public static Object createSQLWrapper(Object pConn,
                                      ManagedConnectionInfo pMci,
                                      SQLManager pConman,
                                      org.objectweb.util.monolog.api.Logger pTrace)
                               throws Exception
Returns a proxy for the sql Connection

Parameters:
pConn - JDBC connection object
pMci - ManagedConnectionInfo object associated with the connection
pConman - SQLManager object holding PreparedStatement cache
pTrace - Logger object to use
Returns:
Object of the preparedStatement proxy
Throws:
Exception - if an error occurs

invoke

public Object invoke(Object obj,
                     Method method,
                     Object[] aobj)
              throws Throwable
Invoke call on the proxy

Specified by:
invoke in interface InvocationHandler
Parameters:
obj - the proxy instance that the method was invoked on
method - the Method instance
aobj - an array of objects containing the values of the arguments
Returns:
Object the returned from the method invocation on the proxy instance
Throws:
Throwable - if an error occurs

prepareStatement

public Object prepareStatement(Class[] pTypes,
                               Object[] pValues)
                        throws Exception
Invoke correct preparedStatement

Parameters:
pTypes - Class [] of parameter types
pValues - Class [] of parameter values
Returns:
Object the result of invoking the preparedStatement
Throws:
Exception - if any Exception occurs

toString

public String toString()
Return a string describing this object

Overrides:
toString in class Object
Returns:
String representing this object


Copyright © 2010 OW2 Consortium. All Rights Reserved.