org.j2ee.dao
Interface DAOActionProcessor

All Known Implementing Classes:
DAOHibernateActionProcessorImpl, DAOJdbcActionProcessorImpl

public interface DAOActionProcessor


Based on an example of book Code Notes for J2EE, Edited by GREGORY BRILL, e-ISBN 0-679-64727-9
Last modified $Date: 2004/05/18 10:50:12 $

Version:
$Revision: 1.1.1.1 $
Author:
jvlio (jvlio@users.sourceforge.net)

Method Summary
 void beginTransaction()
          Start a new DAO transaction.
 void closeSession()
          close a started session
 void commitTransaction()
          commit a started transaction.
 java.sql.Connection getConnection()
          Returns the JDBC Connection associated to this processor
 org.j2ee.dao.errors.ErrorMapper getErrorMapper()
          Return an ErrorMapper object to translate SQLException or other kind of exception to a common error list code
 void getSession()
          get/start a DAO Session object to be used for external controled action.
 void process(org.j2ee.dao.DAOAction cmd)
           
 void rollbackTransaction()
          rollback a started transaction.
 void setConnection(java.sql.Connection connection)
          Set a JDBC Connection to this processor
 

Method Detail

process

public void process(org.j2ee.dao.DAOAction cmd)
             throws DAOException
Parameters:
cmd - An action to execute
Throws:
DAOException - if the action is not of the type espected, for example JdbcDAOAction

getConnection

public java.sql.Connection getConnection()
Returns the JDBC Connection associated to this processor

Returns:
Connection

setConnection

public void setConnection(java.sql.Connection connection)
Set a JDBC Connection to this processor

Parameters:
connection - Connection

getErrorMapper

public org.j2ee.dao.errors.ErrorMapper getErrorMapper()
Return an ErrorMapper object to translate SQLException or other kind of exception to a common error list code

Returns:
ErrorMapper

getSession

public void getSession()
                throws DAOException
get/start a DAO Session object to be used for external controled action. The processor object hold the internal representation for a session. Toplink and Hibernta will hold the Session object, JDBC will use a Connection

Throws:
DAOException - if there are errors open the session

beginTransaction

public void beginTransaction()
                      throws DAOException
Start a new DAO transaction. This method is usefull when you need to manage Macro Actions. The first action takes the session and the transaction a pass it to the others. The processor instance will hold the Transaction object, - Toplink implementation will use UnitOfWork object. - Hibernate implementation will use Transaction object. - JDBC will use his internal JDBC Connection

Throws:
DAOException

commitTransaction

public void commitTransaction()
                       throws DAOException
commit a started transaction.

Throws:
DAOException

rollbackTransaction

public void rollbackTransaction()
                         throws DAOException
rollback a started transaction.

Throws:
DAOException

closeSession

public void closeSession()
                  throws DAOException
close a started session

Throws:
DAOException


Copyright © 2004 DAO Action Patterm. All Rights Reserved.