org.objectweb.jonas.resource
Class JonasSQLWrapper

java.lang.Object
  extended byorg.objectweb.jonas.resource.JonasSQLWrapper
All Implemented Interfaces:
java.lang.reflect.InvocationHandler

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

SQL Connection Wrapper

Author:
Eric Hardesty Contributor(s):

Constructor Summary
JonasSQLWrapper(java.lang.Object pConn, MCInfo pMci, SQLManager pConman, org.objectweb.util.monolog.api.Logger pTrace)
          PreparedStatement wrapper
 
Method Summary
static java.lang.Object createSQLWrapper(java.lang.Object pConn, MCInfo pMci, SQLManager pConman, org.objectweb.util.monolog.api.Logger pTrace)
          Returns a proxy for the sql Connection
 java.lang.Object invoke(java.lang.Object obj, java.lang.reflect.Method method, java.lang.Object[] aobj)
          Invoke call on the proxy
 java.lang.Object prepareStatement(java.lang.Class[] pTypes, java.lang.Object[] pValues)
          Invoke correct preparedStatement
 java.lang.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

JonasSQLWrapper

public JonasSQLWrapper(java.lang.Object pConn,
                       MCInfo pMci,
                       SQLManager pConman,
                       org.objectweb.util.monolog.api.Logger pTrace)
                throws java.lang.Exception
PreparedStatement wrapper

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

createSQLWrapper

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

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

invoke

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

Specified by:
invoke in interface java.lang.reflect.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:
java.lang.Throwable - if an error occurs

prepareStatement

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

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

toString

public java.lang.String toString()
Return a string describing this object

Returns:
String representing this object