com.mtgi.analytics.sql
Class BehaviorTrackingDataSource

java.lang.Object
  extended by org.springframework.jdbc.datasource.DelegatingDataSource
      extended by com.mtgi.analytics.sql.BehaviorTrackingDataSource
All Implemented Interfaces:
Wrapper, CommonDataSource, DataSource, org.springframework.beans.factory.InitializingBean

public class BehaviorTrackingDataSource
extends org.springframework.jdbc.datasource.DelegatingDataSource

A datasource which adds SQL event logging to the behavior tracking database. Events are persisted to the required BehaviorTrackingManager. Events are of type "jdbc" unless overridden with a call to setEventType(String). Event names are the Statement API call that executed the SQL (e.g. "execute", "executeQuery", "executeUpdate"), with event data containing the exact SQL and parameter values logged.


Nested Class Summary
protected  class BehaviorTrackingDataSource.ConnectionHandler
          Delegates all method calls to a target connection, wrapping returned Statement instances with behavior tracking instrumentation.
protected  class BehaviorTrackingDataSource.DynamicStatementHandler
          Behavior tracking logic for dynamic (not prepared or callable) sql statements.
protected static class BehaviorTrackingDataSource.HandlerStub
          base class for proxy invocation handlers, which provides a typical implementation for "equals" and "hashcode"
protected  class BehaviorTrackingDataSource.PreparedStatementHandler
          Behavior tracking logic for prepared and callable statements.
protected  class BehaviorTrackingDataSource.StatementHandler
          Base invocation handler for instrumenting Statement objects with behavior tracking events.
 
Constructor Summary
BehaviorTrackingDataSource()
           
 
Method Summary
 Connection getConnection()
           
 Connection getConnection(String username, String password)
           
 void setEventType(String eventType)
           
 void setTrackingManager(BehaviorTrackingManager trackingManager)
           
 
Methods inherited from class org.springframework.jdbc.datasource.DelegatingDataSource
afterPropertiesSet, getLoginTimeout, getLogWriter, getTargetDataSource, setLoginTimeout, setLogWriter, setTargetDataSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
 

Constructor Detail

BehaviorTrackingDataSource

public BehaviorTrackingDataSource()
Method Detail

setEventType

public void setEventType(String eventType)

setTrackingManager

public void setTrackingManager(BehaviorTrackingManager trackingManager)

getConnection

public Connection getConnection()
                         throws SQLException
Specified by:
getConnection in interface DataSource
Overrides:
getConnection in class org.springframework.jdbc.datasource.DelegatingDataSource
Throws:
SQLException

getConnection

public Connection getConnection(String username,
                                String password)
                         throws SQLException
Specified by:
getConnection in interface DataSource
Overrides:
getConnection in class org.springframework.jdbc.datasource.DelegatingDataSource
Throws:
SQLException