org.springmodules.orm.orbroker
Class BrokerAccessor

java.lang.Object
  extended by org.springmodules.orm.orbroker.BrokerAccessor
Direct Known Subclasses:
BrokerTemplate

public abstract class BrokerAccessor
extends java.lang.Object

Base class for BrokerTemplate.

Since:
2005.06.02
Author:
Omar Irbouh
See Also:
BrokerTemplate

Field Summary
protected  Log logger
           
 
Constructor Summary
BrokerAccessor()
           
 
Method Summary
 void afterPropertiesSet()
          Eagerly initialize the exception translator, creating a default one for the specified Broker if none set.
protected  DataAccessException convertBrokerException(BrokerException e)
           
 Broker getBroker()
           
 javax.sql.DataSource getDataSource()
           
 SQLExceptionTranslator getExceptionTranslator()
          Return the exception translator for this instance.
 boolean isLazyInit()
          Return whether to lazily initialize the SQLExceptionTranslator for this accessor.
protected  Executable newExecutable(Broker broker, java.sql.Connection connection)
           
protected  void releaseExecutable(Broker broker, Executable executable)
           
 void setBroker(Broker broker)
           
 void setDatabaseProductName(java.lang.String dbName)
          Specify the database product name for the DataSource that this accessor uses.
 void setExceptionTranslator(SQLExceptionTranslator exceptionTranslator)
          Set the exception translator for this instance.
 void setLazyInit(boolean lazyInit)
          Set whether to lazily initialize the SQLExceptionTranslator for this accessor, on first encounter of a SQLException.
protected  DataAccessException translateJdbcException(java.sql.SQLException cause)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final Log logger
Constructor Detail

BrokerAccessor

public BrokerAccessor()
Method Detail

getDataSource

public javax.sql.DataSource getDataSource()

setDatabaseProductName

public void setDatabaseProductName(java.lang.String dbName)
Specify the database product name for the DataSource that this accessor uses. This allows to initialize a SQLErrorCodeSQLExceptionTranslator without obtaining a Connection from the DataSource to get the metadata.

Parameters:
dbName - the database product name that identifies the error codes entry
See Also:
org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator#setDatabaseProductName, DatabaseMetaData.getDatabaseProductName()

setExceptionTranslator

public void setExceptionTranslator(SQLExceptionTranslator exceptionTranslator)
Set the exception translator for this instance.

If no custom translator is provided, a default SQLErrorCodeSQLExceptionTranslator is used which examines the SQLException's vendor-specific error code.

Parameters:
exceptionTranslator - exception translator
See Also:
org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator, org.springframework.jdbc.support.SQLStateSQLExceptionTranslator

getExceptionTranslator

public SQLExceptionTranslator getExceptionTranslator()
Return the exception translator for this instance.

Creates a default SQLErrorCodeSQLExceptionTranslator for the specified DataSource if none set.


setLazyInit

public void setLazyInit(boolean lazyInit)
Set whether to lazily initialize the SQLExceptionTranslator for this accessor, on first encounter of a SQLException. Default is "true"; can be switched to "false" for initialization on startup.

Early initialization only applies if afterPropertiesSet is called.

See Also:
getExceptionTranslator(), afterPropertiesSet()

isLazyInit

public boolean isLazyInit()
Return whether to lazily initialize the SQLExceptionTranslator for this accessor.


setBroker

public void setBroker(Broker broker)

getBroker

public Broker getBroker()

afterPropertiesSet

public void afterPropertiesSet()
Eagerly initialize the exception translator, creating a default one for the specified Broker if none set.


convertBrokerException

protected DataAccessException convertBrokerException(BrokerException e)

translateJdbcException

protected DataAccessException translateJdbcException(java.sql.SQLException cause)

newExecutable

protected Executable newExecutable(Broker broker,
                                   java.sql.Connection connection)
                            throws DataAccessException
Throws:
DataAccessException

releaseExecutable

protected void releaseExecutable(Broker broker,
                                 Executable executable)


Copyright © 2005. All Rights Reserved.