View Javadoc

1   //----------------------------------------------------------------------
2   // 
3   // PerfectJPattern: "Design patterns are good but components are better!" 
4   // IGenericDaoFactory.java Copyright (c) 2009 Giovanni Azua Garcia
5   // bravegag@hotmail.com
6   //  
7   // This program is free software; you can redistribute it and/or
8   // modify it under the terms of the GNU General Public License
9   // as published by the Free Software Foundation; either version 3
10  // of the License, or (at your option) any later version.
11  //
12  // This program is distributed in the hope that it will be useful,
13  // but WITHOUT ANY WARRANTY; without even the implied warranty of
14  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  // GNU General Public License for more details.
16  //
17  // You should have received a copy of the GNU General Public License
18  // along with this program; if not, see <http://www.gnu.org/licenses/>.
19  //
20  //----------------------------------------------------------------------
21  package org.perfectjpattern.jee.api.integration.dao;
22  
23  import java.io.*;
24  
25  import org.perfectjpattern.core.api.creational.abstractfactory.*;
26  
27  /**
28   * Abstract Factory for creating instances of {@link IBaseReadOnlyDao} and 
29   * {@link IBaseDao} types
30   * 
31   * @author <a href="mailto:bravegag@hotmail.com">Giovanni Azua</a>
32   * @version $ $Date: Dec 5, 2008 5:26:23 PM $
33   */
34  public 
35  interface IBaseDaoFactory
36  extends IAbstractFactory
37  {
38      //------------------------------------------------------------------------
39      // public
40      //------------------------------------------------------------------------
41      /**
42       * Returns the Base Read-Only DAO implementation corresponding to the 
43       * given model class type. Provides a generic and reusable means to 
44       * create cached DAO instances. 
45       * 
46       * @param <Id> Id type    
47       * @param <Element> Element type
48       * @param aPersistentClass Data model class type
49       * @return Base DAO implementation corresponding to the given  
50       *         model class type
51       * @throws IllegalArgumentException 'aPersistentClass' must not be null
52       * @throws IllegalArgumentException 'aPersistentClass' must be a class type
53       */
54      public <Id extends Serializable, Element> IBaseReadOnlyDao<Id, Element>
55      createReadOnlyDao(Class<Element> aPersistentClass)
56      throws IllegalArgumentException;
57      
58      //------------------------------------------------------------------------
59      /**
60       * Returns the Base DAO implementation corresponding to the given 
61       * model class type. Provides a generic and reusable means to create 
62       * cached DAO instances. 
63       * 
64       * @param <Id> Id type    
65       * @param <Element> Element type
66       * @param aPersistentClass Data model class type
67       * @return Base DAO implementation corresponding to the given  
68       *         model class type
69       * @throws IllegalArgumentException 'aPersistentClass' must not be null
70       * @throws IllegalArgumentException 'aPersistentClass' must be a class type
71       */
72      public <Id extends Serializable, Element> IBaseDao<Id, Element>
73      createDao(Class<Element> aPersistentClass)
74      throws IllegalArgumentException;  
75      
76      //------------------------------------------------------------------------
77      /**
78       * Sets the DaoSessionStrategy
79       * 
80       * @param aDaoSessionStrategy {@link ISessionStrategy} to set
81       * @throws IllegalArgumentException 'aDaoSessionStrategy' must not be null
82       */
83      public void
84      setDaoSessionStrategy(ISessionStrategy aDaoSessionStrategy)
85      throws IllegalArgumentException;
86      
87      //------------------------------------------------------------------------
88      /**
89       * Sets the DaoTransactionStrategy
90       * 
91       * @param aDaoTransactionStrategy {@link ITransactionStrategy} to set
92       * @throws IllegalArgumentException 'aDaoTransactionStrategy' must not be 
93       *         null
94       */
95      public void
96      setDaoTransactionStrategy(ITransactionStrategy 
97          aDaoTransactionStrategy)
98      throws IllegalArgumentException;
99  
100     //------------------------------------------------------------------------
101     /**
102      * Shuts down all DAO services, does all the necessary clean up
103      * 
104      * @throws DaoException 
105      */
106     public void 
107     shutdown() 
108     throws DaoException;    
109 }