package auction.dao; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Defines all DAOs and the concrete factories to get the conrecte DAOs. *

* To get a concrete DAOFactory, call instance() with one of the * classes that extend this factory. *

* Implementation: If you write a new DAO, this class has to know about it. * If you add a new persistence mechanism, add an additional concrete factory * for it as a constant, like HIBERNATE. * * @author Christian Bauer */ public abstract class DAOFactory { private static Log log = LogFactory.getLog(DAOFactory.class); /** * Creates a standalone DAOFactory that returns unmanaged DAO * beans for use in any environment Hibernate has been configured * for. Uses HibernateUtil/SessionFactory and Hibernate context * propagation (CurrentSessionContext), thread-bound or transaction-bound, * and transaction scoped. */ public static final Class HIBERNATE = auction.dao.hibernate.HibernateDAOFactory.class; /** * Factory method for instantiation of concrete factories. */ public static DAOFactory instance(Class factory) { try { log.debug("Creating concrete DAO factory: " + factory); return (DAOFactory)factory.newInstance(); } catch (Exception ex) { throw new RuntimeException("Couldn't create DAOFactory: " + factory); } } // Add your DAO interfaces here public abstract ItemDAO getItemDAO(); public abstract CategoryDAO getCategoryDAO(); public abstract CommentDAO getCommentDAO(); public abstract UserDAO getUserDAO(); public abstract CategorizedItemDAO getCategorizedItemDAO(); public abstract BillingDetailsDAO getBillingDetailsDAO(); public abstract ShipmentDAO getShipmentDAO(); }