Class AbstractCreateStatementInterceptor
- java.lang.Object
- 
- org.apache.tomcat.jdbc.pool.JdbcInterceptor
- 
- org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor
 
 
- 
- All Implemented Interfaces:
- java.lang.reflect.InvocationHandler
 - Direct Known Subclasses:
- AbstractQueryReport,- QueryTimeoutInterceptor,- StatementDecoratorInterceptor,- StatementFacade,- StatementFinalizer
 
 public abstract class AbstractCreateStatementInterceptor extends JdbcInterceptor Abstraction interceptor. This component intercepts all calls to create some type of SQL statement. By extending this class, one can intercept queries and update statements by overriding thecreateStatement(Object, Method, Object[], Object, long)method.
- 
- 
Field SummaryFields Modifier and Type Field Description protected static java.lang.reflect.Constructor<?>[]constructorsthe constructors that are used to create statement proxiesprotected static java.lang.StringCREATE_STATEMENTprotected static intCREATE_STATEMENT_IDXprotected static java.lang.StringEXECUTEprotected static java.lang.StringEXECUTE_BATCHprotected static java.lang.StringEXECUTE_QUERYprotected static java.lang.String[]EXECUTE_TYPESprotected static java.lang.StringEXECUTE_UPDATEprotected static java.lang.StringPREPARE_CALLprotected static intPREPARE_CALL_IDXprotected static java.lang.StringPREPARE_STATEMENTprotected static intPREPARE_STATEMENT_IDXprotected static intSTATEMENT_TYPE_COUNTprotected static java.lang.String[]STATEMENT_TYPES- 
Fields inherited from class org.apache.tomcat.jdbc.pool.JdbcInterceptorCLOSE_VAL, EQUALS_VAL, GETCONNECTION_VAL, HASHCODE_VAL, ISCLOSED_VAL, ISVALID_VAL, ISWRAPPERFOR_VAL, properties, TOSTRING_VAL, UNWRAP_VAL
 
- 
 - 
Constructor SummaryConstructors Constructor Description AbstractCreateStatementInterceptor()
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidcloseInvoked()Method invoked when the operationConnection.close()is invoked.abstract java.lang.ObjectcreateStatement(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args, java.lang.Object statement, long time)This method will be invoked after a successful statement creation.protected java.lang.reflect.Constructor<?>getConstructor(int idx, java.lang.Class<?> clazz)Creates a constructor for a proxy class, if one doesn't already existjava.lang.Objectinvoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)Gets invoked each time an operation onConnectionis invoked.protected booleanisExecute(java.lang.reflect.Method method, boolean process)Returns true if the method that is being invoked matches one of the execute types.protected booleanisStatement(java.lang.reflect.Method method, boolean process)Returns true if the method that is being invoked matches one of the statement types.protected booleanprocess(java.lang.String[] names, java.lang.reflect.Method method, boolean process)voidreset(ConnectionPool parent, PooledConnection con)no-op for this interceptor. no state is stored.- 
Methods inherited from class org.apache.tomcat.jdbc.pool.JdbcInterceptorcompare, compare, disconnected, getNext, getProperties, isUseEquals, poolClosed, poolStarted, setNext, setProperties, setUseEquals
 
- 
 
- 
- 
- 
Field Detail- 
CREATE_STATEMENTprotected static final java.lang.String CREATE_STATEMENT - See Also:
- Constant Field Values
 
 - 
CREATE_STATEMENT_IDXprotected static final int CREATE_STATEMENT_IDX - See Also:
- Constant Field Values
 
 - 
PREPARE_STATEMENTprotected static final java.lang.String PREPARE_STATEMENT - See Also:
- Constant Field Values
 
 - 
PREPARE_STATEMENT_IDXprotected static final int PREPARE_STATEMENT_IDX - See Also:
- Constant Field Values
 
 - 
PREPARE_CALLprotected static final java.lang.String PREPARE_CALL - See Also:
- Constant Field Values
 
 - 
PREPARE_CALL_IDXprotected static final int PREPARE_CALL_IDX - See Also:
- Constant Field Values
 
 - 
STATEMENT_TYPESprotected static final java.lang.String[] STATEMENT_TYPES 
 - 
STATEMENT_TYPE_COUNTprotected static final int STATEMENT_TYPE_COUNT 
 - 
EXECUTEprotected static final java.lang.String EXECUTE - See Also:
- Constant Field Values
 
 - 
EXECUTE_QUERYprotected static final java.lang.String EXECUTE_QUERY - See Also:
- Constant Field Values
 
 - 
EXECUTE_UPDATEprotected static final java.lang.String EXECUTE_UPDATE - See Also:
- Constant Field Values
 
 - 
EXECUTE_BATCHprotected static final java.lang.String EXECUTE_BATCH - See Also:
- Constant Field Values
 
 - 
EXECUTE_TYPESprotected static final java.lang.String[] EXECUTE_TYPES 
 - 
constructorsprotected static final java.lang.reflect.Constructor<?>[] constructors the constructors that are used to create statement proxies
 
- 
 - 
Method Detail- 
invokepublic java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.ThrowableDescription copied from class:JdbcInterceptorGets invoked each time an operation onConnectionis invoked.- Specified by:
- invokein interface- java.lang.reflect.InvocationHandler
- Overrides:
- invokein class- JdbcInterceptor
- Throws:
- java.lang.Throwable
 
 - 
getConstructorprotected java.lang.reflect.Constructor<?> getConstructor(int idx, java.lang.Class<?> clazz) throws java.lang.NoSuchMethodExceptionCreates a constructor for a proxy class, if one doesn't already exist- Parameters:
- idx- - the index of the constructor
- clazz- - the interface that the proxy will implement
- Returns:
- - returns a constructor used to create new instances
- Throws:
- java.lang.NoSuchMethodException- Constructor not found
 
 - 
createStatementpublic abstract java.lang.Object createStatement(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args, java.lang.Object statement, long time)This method will be invoked after a successful statement creation. This method can choose to return a wrapper around the statement or return the statement itself. If this method returns a wrapper then it should return a wrapper object that implements one of the following interfaces.Statement,PreparedStatementorCallableStatement- Parameters:
- proxy- the actual proxy object
- method- the method that was called. It will be one of the methods defined in- STATEMENT_TYPES
- args- the arguments to the method
- statement- the statement that the underlying connection created
- time- Elapsed time
- Returns:
- a Statementobject
 
 - 
closeInvokedpublic abstract void closeInvoked() Method invoked when the operationConnection.close()is invoked.
 - 
isStatementprotected boolean isStatement(java.lang.reflect.Method method, boolean process)Returns true if the method that is being invoked matches one of the statement types.- Parameters:
- method- the method being invoked on the proxy
- process- boolean result used for recursion
- Returns:
- returns true if the method name matched
 
 - 
isExecuteprotected boolean isExecute(java.lang.reflect.Method method, boolean process)Returns true if the method that is being invoked matches one of the execute types.- Parameters:
- method- the method being invoked on the proxy
- process- boolean result used for recursion
- Returns:
- returns true if the method name matched
 
 - 
processprotected boolean process(java.lang.String[] names, java.lang.reflect.Method method, boolean process)
 - 
resetpublic void reset(ConnectionPool parent, PooledConnection con) no-op for this interceptor. no state is stored.- Specified by:
- resetin class- JdbcInterceptor
- Parameters:
- parent- - the connection pool owning the connection
- con- - the pooled connection
 
 
- 
 
-