View Javadoc
1 /*** 2 * $Id: DAOActionProcessor.java,v 1.1.1.1 2004/05/18 10:50:12 mochoa Exp $ 3 * */ 4 5 package org.j2ee.dao; 6 7 import java.sql.Connection; 8 import org.j2ee.dao.errors.ErrorMapper; 9 /*** 10 * <br> 11 * Based on an example of book <i>Code Notes for J2EE, Edited by GREGORY BRILL, 12 * e-ISBN 0-679-64727-9</i> 13 * <br> 14 * Last modified $Date: 2004/05/18 10:50:12 $ 15 * @version $Revision: 1.1.1.1 $ 16 * @author jvlio (jvlio@users.sourceforge.net)*/ 17 public abstract interface DAOActionProcessor { 18 19 /*** 20 * 21 * @param cmd 22 * An action to execute 23 * @throws DAOException 24 * if the action is not of the type espected, for example JdbcDAOAction 25 */ 26 void process(DAOAction cmd) throws DAOException; 27 28 /*** 29 * Returns the JDBC Connection associated to this processor 30 * @return Connection 31 */ 32 Connection getConnection(); 33 34 /*** 35 * Set a JDBC Connection to this processor 36 * @param connection Connection 37 */ 38 void setConnection(Connection connection); 39 40 /*** 41 * Return an ErrorMapper object to translate SQLException 42 * or other kind of exception 43 * to a common error list code 44 * @return ErrorMapper 45 */ 46 ErrorMapper getErrorMapper(); 47 48 /*** 49 * get/start a DAO Session object to be used for external controled action. 50 * The processor object hold the internal representation for a session. 51 * Toplink and Hibernta will hold the Session object, 52 * JDBC will use a Connection 53 * @throws DAOException if there are errors open the session 54 */ 55 void getSession() throws DAOException; 56 57 /*** 58 * Start a new DAO transaction. 59 * This method is usefull when you need to manage Macro Actions. 60 * The first action takes the session and the transaction a pass it 61 * to the others. 62 * The processor instance will hold the Transaction object, 63 * - Toplink implementation will use UnitOfWork object. 64 * - Hibernate implementation will use Transaction object. 65 * - JDBC will use his internal JDBC Connection 66 * @throws DAOException 67 */ 68 void beginTransaction() throws DAOException; 69 70 /*** 71 * commit a started transaction. 72 * @throws DAOException 73 */ 74 void commitTransaction() throws DAOException; 75 76 /*** 77 * rollback a started transaction. 78 * @throws DAOException 79 */ 80 void rollbackTransaction() throws DAOException; 81 82 /*** 83 * close a started session 84 * @throws DAOException 85 */ 86 void closeSession() throws DAOException; 87 }

This page was automatically generated by Maven