it.imolinfo.jbi4cics.connection.jdbc.util
Class CallableStatementInvocationHandler

java.lang.Object
  extended by it.imolinfo.jbi4cics.connection.jdbc.util.CallableStatementInvocationHandler
All Implemented Interfaces:
java.lang.reflect.InvocationHandler

public class CallableStatementInvocationHandler
extends java.lang.Object

Author:
raffaele

Field Summary
protected  int autoGeneratedKeys
           
protected  int[] columnIndexes
           
protected  java.lang.String[] columnNames
           
protected  int resultSetConcurrency
           
protected  int resultSetHoldability
           
protected  int resultSetType
           
protected  java.lang.String sql
           
 
Constructor Summary
CallableStatementInvocationHandler(java.lang.String sql)
           
CallableStatementInvocationHandler(java.lang.String sql, int resultSetType, int resultSetConcurrency)
           
CallableStatementInvocationHandler(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
           
 
Method Summary
protected  java.sql.Statement createStatement()
          Metodo un po' complicato per capire quale era il costruttore e riprodure esattamente il comportamento desiderato.
 java.sql.Connection getConnection()
           
 java.sql.Statement getUnderlyingStatement()
           
 java.lang.Object handleExecute(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
           
 java.lang.Object handleGet(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
           
 java.lang.Object handleOtherMethods(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
           
 java.lang.Object handleSet(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
           
 java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
          La gestione e' simile a quella degli altri statement, ma in questo caso bisogna aggiungere la gestione dei parametri della stored procedur.
protected  java.lang.Object invokeMethod(java.lang.reflect.Method method, java.lang.Object[] args)
           
 boolean isConnected()
           
 void setConnected(boolean connected)
           
 void setConnection(java.sql.Connection conn)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sql

protected java.lang.String sql

autoGeneratedKeys

protected int autoGeneratedKeys

columnIndexes

protected int[] columnIndexes

columnNames

protected java.lang.String[] columnNames

resultSetType

protected int resultSetType

resultSetConcurrency

protected int resultSetConcurrency

resultSetHoldability

protected int resultSetHoldability
Constructor Detail

CallableStatementInvocationHandler

public CallableStatementInvocationHandler(java.lang.String sql)
Parameters:
sql - The SQL

CallableStatementInvocationHandler

public CallableStatementInvocationHandler(java.lang.String sql,
                                          int resultSetType,
                                          int resultSetConcurrency)
Parameters:
sql - The SQL
resultSetType - The result set type
resultSetConcurrency - The result set Councurrency

CallableStatementInvocationHandler

public CallableStatementInvocationHandler(java.lang.String sql,
                                          int resultSetType,
                                          int resultSetConcurrency,
                                          int resultSetHoldability)
Parameters:
sql - The SQL
resultSetType - The result set type
resultSetConcurrency - The result set Councurrency
resultSetHoldability - The result set Holdability
Method Detail

createStatement

protected java.sql.Statement createStatement()
                                      throws java.sql.SQLException
Metodo un po' complicato per capire quale era il costruttore e riprodure esattamente il comportamento desiderato.

Returns:
The create statement
Throws:
java.sql.SQLException - The SQL exception

invoke

public java.lang.Object invoke(java.lang.Object proxy,
                               java.lang.reflect.Method method,
                               java.lang.Object[] args)
                        throws java.lang.Throwable
La gestione e' simile a quella degli altri statement, ma in questo caso bisogna aggiungere la gestione dei parametri della stored procedur. In particolare e' importante gestire gli outparameter.

Specified by:
invoke in interface java.lang.reflect.InvocationHandler
Parameters:
proxy - The proxy
method - The method
args - The args
Returns:
object The invoked object
Throws:
java.lang.Throwable - The Throwable

handleGet

public java.lang.Object handleGet(java.lang.Object proxy,
                                  java.lang.reflect.Method method,
                                  java.lang.Object[] args)
                           throws java.sql.SQLException
Throws:
java.sql.SQLException

handleSet

public java.lang.Object handleSet(java.lang.Object proxy,
                                  java.lang.reflect.Method method,
                                  java.lang.Object[] args)
                           throws java.sql.SQLException
Throws:
java.sql.SQLException

handleExecute

public java.lang.Object handleExecute(java.lang.Object proxy,
                                      java.lang.reflect.Method method,
                                      java.lang.Object[] args)
                               throws java.sql.SQLException
Throws:
java.sql.SQLException

handleOtherMethods

public java.lang.Object handleOtherMethods(java.lang.Object proxy,
                                           java.lang.reflect.Method method,
                                           java.lang.Object[] args)
                                    throws java.sql.SQLException
Throws:
java.sql.SQLException

getConnection

public java.sql.Connection getConnection()
Returns:
Returns the connection.

setConnection

public void setConnection(java.sql.Connection conn)
Parameters:
conn - The connection to set.

isConnected

public boolean isConnected()
Returns:
Returns the connected.

setConnected

public void setConnected(boolean connected)
                  throws java.sql.SQLException
Parameters:
connected - The connected to set.
Throws:
java.sql.SQLException - The SQL exception

invokeMethod

protected java.lang.Object invokeMethod(java.lang.reflect.Method method,
                                        java.lang.Object[] args)
                                 throws java.sql.SQLException
Parameters:
method - The method
args - The args
Returns:
Object The invoked method
Throws:
java.sql.SQLException - The SQL Exception

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
A string

getUnderlyingStatement

public java.sql.Statement getUnderlyingStatement()
Returns:
Returns the underlyingStatement.


Copyright © 2005-2008 Imola Informatica. All Rights Reserved.