View Javadoc
1 /* 2 * ManagerFactory.java 3 * 4 * Created on February 18, 2003, 8:23 PM 5 */ 6 7 package com.mlw.fps.model.business.dao; 8 9 import java.util.Iterator; 10 11 import javax.sql.DataSource; 12 13 import com.mlw.util.factory.Factory; 14 /*** 15 * 16 * @author Matthew Wilson 17 */ 18 public class DAOFactory 19 { 20 private static Factory factory = new Factory(); 21 private static DataSource dataSource; 22 23 /*** Creates a new instance of ManagerFactory 24 */ 25 public DAOFactory() 26 { 27 } 28 29 public static Object getDAO(String name) 30 { 31 return factory.getObject(name); 32 } 33 34 /*** Setter for property config. 35 * @param config New value of property config. 36 */ 37 public static void setConfig(String config) 38 { 39 factory.setConfig(config); 40 } 41 42 public static void init() throws Exception 43 { 44 factory.init(); 45 46 //execute any startup classes. 47 for(Iterator iter = factory.getKeys(); iter.hasNext();) 48 { 49 Object object = factory.getObject((String)iter.next()); 50 if( object instanceof StartUp ) 51 { 52 ((StartUp)object).init(); 53 } 54 } 55 } 56 57 /*** Getter for property initialized. 58 * @return Value of property initialized. 59 */ 60 public static boolean isInitialized() 61 { 62 return factory.isInitialized(); 63 } 64 65 /*** Getter for property dataSource. 66 * @return Value of property dataSource. 67 */ 68 public static DataSource getDataSource() 69 { 70 return dataSource; 71 } 72 73 /*** Setter for property dataSource. 74 * @param dataSource New value of property dataSource. 75 */ 76 public static void setDataSource(DataSource data) 77 { 78 dataSource = data; 79 } 80 81 }

This page was automatically generated by Maven