Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.ibatis.sqlmap.engine.impl
Class SqlMapExecutorDelegate  view SqlMapExecutorDelegate download SqlMapExecutorDelegate.java

java.lang.Object
  extended bycom.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate

public class SqlMapExecutorDelegate
extends java.lang.Object

The workhorse that really runs the SQL


Field Summary
private  java.util.HashMap cacheModels
           
private  boolean cacheModelsEnabled
           
private  com.ibatis.sqlmap.engine.exchange.DataExchangeFactory dataExchangeFactory
           
static int DEFAULT_MAX_REQUESTS
          The default maximum number of requests
static int DEFAULT_MAX_SESSIONS
          The default maximum number of sessions
static int DEFAULT_MAX_TRANSACTIONS
          The default maximum number of transactions
private  boolean enhancementEnabled
           
private  boolean lazyLoadingEnabled
           
private  java.util.HashMap mappedStatements
           
private  int maxRequests
           
private  int maxSessions
           
private  int maxTransactions
           
private  java.util.HashMap parameterMaps
           
private static com.ibatis.common.beans.Probe PROBE
           
private  com.ibatis.common.util.ThrottledPool requestPool
           
private  java.util.HashMap resultMaps
           
private  com.ibatis.common.util.ThrottledPool sessionPool
           
private  com.ibatis.sqlmap.engine.execution.SqlExecutor sqlExecutor
           
private  com.ibatis.sqlmap.engine.transaction.TransactionManager txManager
           
private  com.ibatis.sqlmap.engine.type.TypeHandlerFactory typeHandlerFactory
           
 
Constructor Summary
SqlMapExecutorDelegate()
          Default constructor
 
Method Summary
 void addCacheModel(com.ibatis.sqlmap.engine.cache.CacheModel model)
          Add a cache model
 void addMappedStatement(com.ibatis.sqlmap.engine.mapping.statement.MappedStatement ms)
          Add a mapped statement
 void addParameterMap(com.ibatis.sqlmap.engine.mapping.parameter.ParameterMap map)
          Add a parameter map
 void addResultMap(com.ibatis.sqlmap.engine.mapping.result.ResultMap map)
          Add a result map
private  void autoCommitTransaction(com.ibatis.sqlmap.engine.scope.SessionScope session, boolean autoStart)
           
private  void autoEndTransaction(com.ibatis.sqlmap.engine.scope.SessionScope session, boolean autoStart)
           
private  com.ibatis.sqlmap.engine.transaction.Transaction autoStartTransaction(com.ibatis.sqlmap.engine.scope.SessionScope session, boolean autoStart, com.ibatis.sqlmap.engine.transaction.Transaction trans)
           
 void commitTransaction(com.ibatis.sqlmap.engine.scope.SessionScope session)
          Commit the transaction on a session
 int delete(com.ibatis.sqlmap.engine.scope.SessionScope session, java.lang.String id, java.lang.Object param)
          Execute a delete statement
 void endTransaction(com.ibatis.sqlmap.engine.scope.SessionScope session)
          End the transaction on a session
 boolean equals(java.lang.Object obj)
          Determine whether this Object is semantically equal to another Object.
 int executeBatch(com.ibatis.sqlmap.engine.scope.SessionScope session)
          Execute a batch for a session
private  java.lang.Object executeSelectKey(com.ibatis.sqlmap.engine.scope.SessionScope session, com.ibatis.sqlmap.engine.transaction.Transaction trans, com.ibatis.sqlmap.engine.mapping.statement.MappedStatement ms, java.lang.Object param)
           
 void flushDataCache()
          Flush all of the data caches
 void flushDataCache(java.lang.String id)
          Flush a single cache by ID
 com.ibatis.sqlmap.engine.cache.CacheModel getCacheModel(java.lang.String id)
          Get a cache model by ID
 java.util.Iterator getCacheModelNames()
          Get an iterator of the cache models
 com.ibatis.sqlmap.engine.exchange.DataExchangeFactory getDataExchangeFactory()
          Getter for the DataExchangeFactory
 javax.sql.DataSource getDataSource()
          Get the DataSource for the session
 com.ibatis.sqlmap.engine.mapping.statement.MappedStatement getMappedStatement(java.lang.String id)
          Get a mappedstatement by its ID
 java.util.Iterator getMappedStatementNames()
          Get an iterator of the mapped statements
 int getMaxRequests()
          Getter for the maximum number of requests
 int getMaxSessions()
          Getter for the maximum number of sessions
 int getMaxTransactions()
          Getter for the the maximum number of transactions
 com.ibatis.sqlmap.engine.mapping.parameter.ParameterMap getParameterMap(java.lang.String id)
          Get a parameter map by ID
 java.util.Iterator getParameterMapNames()
          Get an iterator of all of the parameter maps
 com.ibatis.sqlmap.engine.mapping.result.ResultMap getResultMap(java.lang.String id)
          Get a result map by ID
 java.util.Iterator getResultMapNames()
          Get an iterator of the result maps
 com.ibatis.sqlmap.engine.execution.SqlExecutor getSqlExecutor()
          Getter for the SqlExecutor
 com.ibatis.sqlmap.engine.transaction.Transaction getTransaction(com.ibatis.sqlmap.engine.scope.SessionScope session)
          Get a transaction for the session
 com.ibatis.sqlmap.engine.transaction.TransactionManager getTxManager()
          Getter for the transaction manager
 com.ibatis.sqlmap.engine.type.TypeHandlerFactory getTypeHandlerFactory()
          Getter for the TypeHandlerFactory
 int hashCode()
          Get a value that represents this Object, as uniquely as possible within the confines of an int.
 java.lang.Object insert(com.ibatis.sqlmap.engine.scope.SessionScope session, java.lang.String id, java.lang.Object param)
          Call an insert statement by ID
 boolean isCacheModelsEnabled()
          Getter for the status of caching
 boolean isEnhancementEnabled()
          Getter for the status of CGLib enhancements
 boolean isLazyLoadingEnabled()
          Getter for the status of lazy loading
protected  com.ibatis.sqlmap.engine.scope.RequestScope popRequest(com.ibatis.sqlmap.engine.scope.SessionScope session, com.ibatis.sqlmap.engine.mapping.statement.MappedStatement mappedStatement)
           
protected  com.ibatis.sqlmap.engine.scope.SessionScope popSession()
           
protected  void pushRequest(com.ibatis.sqlmap.engine.scope.RequestScope request)
           
protected  void pushSession(com.ibatis.sqlmap.engine.scope.SessionScope session)
           
 java.util.List queryForList(com.ibatis.sqlmap.engine.scope.SessionScope session, java.lang.String id, java.lang.Object paramObject)
          Execute a query for a list
 java.util.List queryForList(com.ibatis.sqlmap.engine.scope.SessionScope session, java.lang.String id, java.lang.Object paramObject, int skip, int max)
          Execute a query for a list
 java.util.Map queryForMap(com.ibatis.sqlmap.engine.scope.SessionScope session, java.lang.String id, java.lang.Object paramObject, java.lang.String keyProp)
          Execute a query for a map.
 java.util.Map queryForMap(com.ibatis.sqlmap.engine.scope.SessionScope session, java.lang.String id, java.lang.Object paramObject, java.lang.String keyProp, java.lang.String valueProp)
          Execute a query for a map.
 java.lang.Object queryForObject(com.ibatis.sqlmap.engine.scope.SessionScope session, java.lang.String id, java.lang.Object paramObject)
          Execute a select for a single object
 java.lang.Object queryForObject(com.ibatis.sqlmap.engine.scope.SessionScope session, java.lang.String id, java.lang.Object paramObject, java.lang.Object resultObject)
          Execute a select for a single object
 com.ibatis.common.util.PaginatedList queryForPaginatedList(com.ibatis.sqlmap.engine.scope.SessionScope session, java.lang.String id, java.lang.Object paramObject, int pageSize)
          Execute a query and return a paginated list
 void queryWithRowHandler(com.ibatis.sqlmap.engine.scope.SessionScope session, java.lang.String id, java.lang.Object paramObject, com.ibatis.sqlmap.client.event.RowHandler rowHandler)
          Execute a query with a row handler.
 void setCacheModelsEnabled(boolean cacheModelsEnabled)
          Turn on or off caching
 void setEnhancementEnabled(boolean enhancementEnabled)
          Turn on or off CGLib enhancements
 void setLazyLoadingEnabled(boolean lazyLoadingEnabled)
          Turn on or off lazy loading
 void setMaxRequests(int maxRequests)
          Setter for the maximum number of requests
 void setMaxSessions(int maxSessions)
          Setter for the maximum number of sessions
 void setMaxTransactions(int maxTransactions)
          Setter for the maximum number of transactions
 void setTxManager(com.ibatis.sqlmap.engine.transaction.TransactionManager txManager)
          Setter for the transaction manager
 void setUserProvidedTransaction(com.ibatis.sqlmap.engine.scope.SessionScope session, java.sql.Connection userConnection)
          Use a user-provided transaction for a session
 void startBatch(com.ibatis.sqlmap.engine.scope.SessionScope session)
          Start a batch for a session
 void startTransaction(com.ibatis.sqlmap.engine.scope.SessionScope session)
          Start a transaction on the session
 void startTransaction(com.ibatis.sqlmap.engine.scope.SessionScope session, int transactionIsolation)
          Start a transaction on the session with the specified isolation level.
 int update(com.ibatis.sqlmap.engine.scope.SessionScope session, java.lang.String id, java.lang.Object param)
          Execute an update statement
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROBE

private static final com.ibatis.common.beans.Probe PROBE

DEFAULT_MAX_REQUESTS

public static final int DEFAULT_MAX_REQUESTS
The default maximum number of requests

See Also:
Constant Field Values

DEFAULT_MAX_SESSIONS

public static final int DEFAULT_MAX_SESSIONS
The default maximum number of sessions

See Also:
Constant Field Values

DEFAULT_MAX_TRANSACTIONS

public static final int DEFAULT_MAX_TRANSACTIONS
The default maximum number of transactions

See Also:
Constant Field Values

lazyLoadingEnabled

private boolean lazyLoadingEnabled

cacheModelsEnabled

private boolean cacheModelsEnabled

enhancementEnabled

private boolean enhancementEnabled

maxRequests

private int maxRequests

maxSessions

private int maxSessions

maxTransactions

private int maxTransactions

txManager

private com.ibatis.sqlmap.engine.transaction.TransactionManager txManager

mappedStatements

private java.util.HashMap mappedStatements

cacheModels

private java.util.HashMap cacheModels

resultMaps

private java.util.HashMap resultMaps

parameterMaps

private java.util.HashMap parameterMaps

requestPool

private com.ibatis.common.util.ThrottledPool requestPool

sessionPool

private com.ibatis.common.util.ThrottledPool sessionPool

sqlExecutor

private com.ibatis.sqlmap.engine.execution.SqlExecutor sqlExecutor

typeHandlerFactory

private com.ibatis.sqlmap.engine.type.TypeHandlerFactory typeHandlerFactory

dataExchangeFactory

private com.ibatis.sqlmap.engine.exchange.DataExchangeFactory dataExchangeFactory
Constructor Detail

SqlMapExecutorDelegate

public SqlMapExecutorDelegate()
Default constructor

Method Detail

getDataExchangeFactory

public com.ibatis.sqlmap.engine.exchange.DataExchangeFactory getDataExchangeFactory()
Getter for the DataExchangeFactory


getTypeHandlerFactory

public com.ibatis.sqlmap.engine.type.TypeHandlerFactory getTypeHandlerFactory()
Getter for the TypeHandlerFactory


isLazyLoadingEnabled

public boolean isLazyLoadingEnabled()
Getter for the status of lazy loading


setLazyLoadingEnabled

public void setLazyLoadingEnabled(boolean lazyLoadingEnabled)
Turn on or off lazy loading


isCacheModelsEnabled

public boolean isCacheModelsEnabled()
Getter for the status of caching


setCacheModelsEnabled

public void setCacheModelsEnabled(boolean cacheModelsEnabled)
Turn on or off caching


isEnhancementEnabled

public boolean isEnhancementEnabled()
Getter for the status of CGLib enhancements


setEnhancementEnabled

public void setEnhancementEnabled(boolean enhancementEnabled)
Turn on or off CGLib enhancements


getMaxRequests

public int getMaxRequests()
Getter for the maximum number of requests


setMaxRequests

public void setMaxRequests(int maxRequests)
Setter for the maximum number of requests


getMaxSessions

public int getMaxSessions()
Getter for the maximum number of sessions


setMaxSessions

public void setMaxSessions(int maxSessions)
Setter for the maximum number of sessions


getMaxTransactions

public int getMaxTransactions()
Getter for the the maximum number of transactions


setMaxTransactions

public void setMaxTransactions(int maxTransactions)
Setter for the maximum number of transactions


getTxManager

public com.ibatis.sqlmap.engine.transaction.TransactionManager getTxManager()
Getter for the transaction manager


setTxManager

public void setTxManager(com.ibatis.sqlmap.engine.transaction.TransactionManager txManager)
Setter for the transaction manager


addMappedStatement

public void addMappedStatement(com.ibatis.sqlmap.engine.mapping.statement.MappedStatement ms)
Add a mapped statement


getMappedStatementNames

public java.util.Iterator getMappedStatementNames()
Get an iterator of the mapped statements


getMappedStatement

public com.ibatis.sqlmap.engine.mapping.statement.MappedStatement getMappedStatement(java.lang.String id)
Get a mappedstatement by its ID


addCacheModel

public void addCacheModel(com.ibatis.sqlmap.engine.cache.CacheModel model)
Add a cache model


getCacheModelNames

public java.util.Iterator getCacheModelNames()
Get an iterator of the cache models


getCacheModel

public com.ibatis.sqlmap.engine.cache.CacheModel getCacheModel(java.lang.String id)
Get a cache model by ID


addResultMap

public void addResultMap(com.ibatis.sqlmap.engine.mapping.result.ResultMap map)
Add a result map


getResultMapNames

public java.util.Iterator getResultMapNames()
Get an iterator of the result maps


getResultMap

public com.ibatis.sqlmap.engine.mapping.result.ResultMap getResultMap(java.lang.String id)
Get a result map by ID


addParameterMap

public void addParameterMap(com.ibatis.sqlmap.engine.mapping.parameter.ParameterMap map)
Add a parameter map


getParameterMapNames

public java.util.Iterator getParameterMapNames()
Get an iterator of all of the parameter maps


getParameterMap

public com.ibatis.sqlmap.engine.mapping.parameter.ParameterMap getParameterMap(java.lang.String id)
Get a parameter map by ID


flushDataCache

public void flushDataCache()
Flush all of the data caches


flushDataCache

public void flushDataCache(java.lang.String id)
Flush a single cache by ID


insert

public java.lang.Object insert(com.ibatis.sqlmap.engine.scope.SessionScope session,
                               java.lang.String id,
                               java.lang.Object param)
                        throws java.sql.SQLException
Call an insert statement by ID


executeSelectKey

private java.lang.Object executeSelectKey(com.ibatis.sqlmap.engine.scope.SessionScope session,
                                          com.ibatis.sqlmap.engine.transaction.Transaction trans,
                                          com.ibatis.sqlmap.engine.mapping.statement.MappedStatement ms,
                                          java.lang.Object param)
                                   throws java.sql.SQLException

update

public int update(com.ibatis.sqlmap.engine.scope.SessionScope session,
                  java.lang.String id,
                  java.lang.Object param)
           throws java.sql.SQLException
Execute an update statement


delete

public int delete(com.ibatis.sqlmap.engine.scope.SessionScope session,
                  java.lang.String id,
                  java.lang.Object param)
           throws java.sql.SQLException
Execute a delete statement


queryForObject

public java.lang.Object queryForObject(com.ibatis.sqlmap.engine.scope.SessionScope session,
                                       java.lang.String id,
                                       java.lang.Object paramObject)
                                throws java.sql.SQLException
Execute a select for a single object


queryForObject

public java.lang.Object queryForObject(com.ibatis.sqlmap.engine.scope.SessionScope session,
                                       java.lang.String id,
                                       java.lang.Object paramObject,
                                       java.lang.Object resultObject)
                                throws java.sql.SQLException
Execute a select for a single object


queryForList

public java.util.List queryForList(com.ibatis.sqlmap.engine.scope.SessionScope session,
                                   java.lang.String id,
                                   java.lang.Object paramObject)
                            throws java.sql.SQLException
Execute a query for a list


queryForList

public java.util.List queryForList(com.ibatis.sqlmap.engine.scope.SessionScope session,
                                   java.lang.String id,
                                   java.lang.Object paramObject,
                                   int skip,
                                   int max)
                            throws java.sql.SQLException
Execute a query for a list


queryWithRowHandler

public void queryWithRowHandler(com.ibatis.sqlmap.engine.scope.SessionScope session,
                                java.lang.String id,
                                java.lang.Object paramObject,
                                com.ibatis.sqlmap.client.event.RowHandler rowHandler)
                         throws java.sql.SQLException
Execute a query with a row handler. The row handler is called once per row in the query results.


queryForPaginatedList

public com.ibatis.common.util.PaginatedList queryForPaginatedList(com.ibatis.sqlmap.engine.scope.SessionScope session,
                                                                  java.lang.String id,
                                                                  java.lang.Object paramObject,
                                                                  int pageSize)
                                                           throws java.sql.SQLException
Execute a query and return a paginated list


queryForMap

public java.util.Map queryForMap(com.ibatis.sqlmap.engine.scope.SessionScope session,
                                 java.lang.String id,
                                 java.lang.Object paramObject,
                                 java.lang.String keyProp)
                          throws java.sql.SQLException
Execute a query for a map. The map has the table key as the key, and the results as the map data


queryForMap

public java.util.Map queryForMap(com.ibatis.sqlmap.engine.scope.SessionScope session,
                                 java.lang.String id,
                                 java.lang.Object paramObject,
                                 java.lang.String keyProp,
                                 java.lang.String valueProp)
                          throws java.sql.SQLException
Execute a query for a map. The map has the table key as the key, and a property from the results as the map data


startTransaction

public void startTransaction(com.ibatis.sqlmap.engine.scope.SessionScope session)
                      throws java.sql.SQLException
Start a transaction on the session


startTransaction

public void startTransaction(com.ibatis.sqlmap.engine.scope.SessionScope session,
                             int transactionIsolation)
                      throws java.sql.SQLException
Start a transaction on the session with the specified isolation level.


commitTransaction

public void commitTransaction(com.ibatis.sqlmap.engine.scope.SessionScope session)
                       throws java.sql.SQLException
Commit the transaction on a session


endTransaction

public void endTransaction(com.ibatis.sqlmap.engine.scope.SessionScope session)
                    throws java.sql.SQLException
End the transaction on a session


startBatch

public void startBatch(com.ibatis.sqlmap.engine.scope.SessionScope session)
Start a batch for a session


executeBatch

public int executeBatch(com.ibatis.sqlmap.engine.scope.SessionScope session)
                 throws java.sql.SQLException
Execute a batch for a session


setUserProvidedTransaction

public void setUserProvidedTransaction(com.ibatis.sqlmap.engine.scope.SessionScope session,
                                       java.sql.Connection userConnection)
Use a user-provided transaction for a session


getDataSource

public javax.sql.DataSource getDataSource()
Get the DataSource for the session


getSqlExecutor

public com.ibatis.sqlmap.engine.execution.SqlExecutor getSqlExecutor()
Getter for the SqlExecutor


getTransaction

public com.ibatis.sqlmap.engine.transaction.Transaction getTransaction(com.ibatis.sqlmap.engine.scope.SessionScope session)
Get a transaction for the session


autoEndTransaction

private void autoEndTransaction(com.ibatis.sqlmap.engine.scope.SessionScope session,
                                boolean autoStart)
                         throws java.sql.SQLException

autoCommitTransaction

private void autoCommitTransaction(com.ibatis.sqlmap.engine.scope.SessionScope session,
                                   boolean autoStart)
                            throws java.sql.SQLException

autoStartTransaction

private com.ibatis.sqlmap.engine.transaction.Transaction autoStartTransaction(com.ibatis.sqlmap.engine.scope.SessionScope session,
                                                                              boolean autoStart,
                                                                              com.ibatis.sqlmap.engine.transaction.Transaction trans)
                                                                       throws java.sql.SQLException

equals

public boolean equals(java.lang.Object obj)
Description copied from class: java.lang.Object
Determine whether this Object is semantically equal to another Object.

There are some fairly strict requirements on this method which subclasses must follow:

  • It must be transitive. If a.equals(b) and b.equals(c), then a.equals(c) must be true as well.
  • It must be symmetric. a.equals(b) and b.equals(a) must have the same value.
  • It must be reflexive. a.equals(a) must always be true.
  • It must be consistent. Whichever value a.equals(b) returns on the first invocation must be the value returned on all later invocations.
  • a.equals(null) must be false.
  • It must be consistent with hashCode(). That is, a.equals(b) must imply a.hashCode() == b.hashCode(). The reverse is not true; two objects that are not equal may have the same hashcode, but that has the potential to harm hashing performance.

This is typically overridden to throw a java.lang.ClassCastException if the argument is not comparable to the class performing the comparison, but that is not a requirement. It is legal for a.equals(b) to be true even though a.getClass() != b.getClass(). Also, it is typical to never cause a java.lang.NullPointerException.

In general, the Collections API (java.util) use the equals method rather than the == operator to compare objects. However, java.util.IdentityHashMap is an exception to this rule, for its own good reasons.

The default implementation returns this == o.


hashCode

public int hashCode()
Description copied from class: java.lang.Object
Get a value that represents this Object, as uniquely as possible within the confines of an int.

There are some requirements on this method which subclasses must follow:

  • Semantic equality implies identical hashcodes. In other words, if a.equals(b) is true, then a.hashCode() == b.hashCode() must be as well. However, the reverse is not necessarily true, and two objects may have the same hashcode without being equal.
  • It must be consistent. Whichever value o.hashCode() returns on the first invocation must be the value returned on all later invocations as long as the object exists. Notice, however, that the result of hashCode may change between separate executions of a Virtual Machine, because it is not invoked on the same object.

Notice that since hashCode is used in java.util.Hashtable and other hashing classes, a poor implementation will degrade the performance of hashing (so don't blindly implement it as returning a constant!). Also, if calculating the hash is time-consuming, a class may consider caching the results.

The default implementation returns System.identityHashCode(this)


popRequest

protected com.ibatis.sqlmap.engine.scope.RequestScope popRequest(com.ibatis.sqlmap.engine.scope.SessionScope session,
                                                                 com.ibatis.sqlmap.engine.mapping.statement.MappedStatement mappedStatement)

pushRequest

protected void pushRequest(com.ibatis.sqlmap.engine.scope.RequestScope request)

popSession

protected com.ibatis.sqlmap.engine.scope.SessionScope popSession()

pushSession

protected void pushSession(com.ibatis.sqlmap.engine.scope.SessionScope session)