01: /*
02: * UserDAOFactory.java
03: *
04: * Created on 28 de marzo de 2005, 13:53
05: */
06:
07: package org.manentia.kasai.group;
08:
09: import java.util.ResourceBundle;
10:
11: import org.manentia.kasai.Constants;
12:
13: /**
14: *
15: * @author rzuasti
16: */
17: public class GroupDAOFactory {
18:
19: private static GroupDAOFactory instance;
20:
21: private GroupDAO dao;
22:
23: /** Creates a new instance of UserDAOFactory */
24: private GroupDAOFactory() {
25: ResourceBundle res = ResourceBundle
26: .getBundle(Constants.CONFIG_PROPERTY_FILE);
27:
28: if (res.getString("db.kasai.engine").equalsIgnoreCase(
29: Constants.DATABASE_MYSQL)) {
30: dao = new JDBCMySQLGroupDAO();
31: } else if (res.getString("db.kasai.engine").equalsIgnoreCase(
32: Constants.DATABASE_SQLSERVER)) {
33: dao = new JDBCSQLServerGroupDAO();
34: } else if (res.getString("db.kasai.engine").equalsIgnoreCase(
35: Constants.DATABASE_PGSQL)) {
36: dao = new JDBCPGSQLGroupDAO();
37: }
38: }
39:
40: public static synchronized GroupDAOFactory getInstance() {
41: if (instance == null) {
42: instance = new GroupDAOFactory();
43: }
44:
45: return instance;
46: }
47:
48: public GroupDAO createDAO() {
49: return dao;
50: }
51: }
|