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.spring; 22 23 import org.perfectjpattern.jee.api.integration.dao.*; 24 import org.perfectjpattern.jee.integration.dao.*; 25 26 /** 27 * Extends {@link HibernateDaoFactory} exposing project-local specific 28 * implementations injected via IoC. This implementation was introduced 29 * to support the Spring Generic DAO example implementation. 30 * 31 * @author <a href="mailto:bravegag@hotmail.com">Giovanni Azua</a> 32 * @version $ $Date: Dec 8, 2008 3:35:51 AM $ 33 */ 34 public final 35 class LocalDaoFactory 36 extends HibernateDaoFactory 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 ICustomerDao 59 createCustomerDao() 60 { 61 return theCustomerDao; 62 } 63 64 //------------------------------------------------------------------------ 65 /** 66 * Sets the personDao 67 * 68 * @param aCustomerDao the personDao to set 69 */ 70 public final void 71 setCustomerDao(ICustomerDao aCustomerDao) 72 { 73 theCustomerDao = aCustomerDao; 74 } 75 76 //------------------------------------------------------------------------ 77 // members 78 //------------------------------------------------------------------------ 79 private static final LocalDaoFactory INSTANCE = new LocalDaoFactory(); 80 private ICustomerDao theCustomerDao; 81 }