01: /*
02: * UserDAOFactory.java
03: *
04: * Created on 28 de marzo de 2005, 13:53
05: */
06:
07: package org.manentia.kasai.authobject;
08:
09: import java.util.ResourceBundle;
10:
11: import org.manentia.kasai.Constants;
12:
13: /**
14: *
15: * @author rzuasti
16: */
17: public class AuthObjectDAOFactory {
18:
19: private static AuthObjectDAOFactory instance;
20:
21: private AuthObjectDAO dao;
22:
23: /** Creates a new instance of UserDAOFactory */
24: private AuthObjectDAOFactory() {
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 JDBCMySQLAuthObjectDAO();
31: } else if (res.getString("db.kasai.engine").equalsIgnoreCase(
32: Constants.DATABASE_SQLSERVER)) {
33: dao = new JDBCSQLServerAuthObjectDAO();
34: } else if (res.getString("db.kasai.engine").equalsIgnoreCase(
35: Constants.DATABASE_PGSQL)) {
36: dao = new JDBCPGSQLAuthObjectDAO();
37: }
38: }
39:
40: public static synchronized AuthObjectDAOFactory getInstance() {
41: if (instance == null) {
42: instance = new AuthObjectDAOFactory();
43: }
44:
45: return instance;
46: }
47:
48: public AuthObjectDAO createDAO() {
49: return dao;
50: }
51: }
|