1 //----------------------------------------------------------------------
2 //
3 // PerfectJPattern: "Design patterns are good but components are better!"
4 // LocalDaoFactory.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.integration.dao;
22
23 import org.perfectjpattern.core.api.creational.singleton.*;
24 import org.perfectjpattern.jee.api.integration.dao.*;
25
26 /**
27 * Extends {@link HibernateDaoFactory} exposing project-local specific DAO
28 * implementations injected via IoC
29 *
30 * @author <a href="mailto:bravegag@hotmail.com">Giovanni Azua</a>
31 * @version $ $Date: Dec 8, 2008 3:35:51 AM $
32 */
33 public final
34 class LocalDaoFactory
35 extends HibernateDaoFactory
36 implements ISingleton
37 {
38 //------------------------------------------------------------------------
39 // public
40 //------------------------------------------------------------------------
41 /**
42 * Returns Singleton instance of {@link LocalDaoFactory}
43 *
44 * @return Singleton instance of {@link LocalDaoFactory}
45 */
46 public static LocalDaoFactory
47 getInstance()
48 {
49 return INSTANCE;
50 }
51
52 //------------------------------------------------------------------------
53 /**
54 * Returns the personDao
55 *
56 * @return the personDao
57 */
58 public final IPersonDao
59 createPersonDao()
60 {
61 return thePersonDao;
62 }
63
64 //------------------------------------------------------------------------
65 /**
66 * Sets the personDao
67 *
68 * @param aPersonDao the personDao to set
69 */
70 public final void
71 setPersonDao(IPersonDao aPersonDao)
72 {
73 thePersonDao = aPersonDao;
74 }
75
76 //------------------------------------------------------------------------
77 // members
78 //------------------------------------------------------------------------
79 private static final LocalDaoFactory INSTANCE = new LocalDaoFactory();
80 private IPersonDao thePersonDao;
81 }