01: /*
02: * Created on May 2, 2003
03: *
04: * Dbmjui is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU General Public License version 2 as
06: * published by the Free Software Foundation.
07: *
08: * Dbmjui is distributed in the hope that it will be useful,
09: * but WITHOUT ANY WARRANTY; without even the implied warranty of
10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11: * General Public License for more details.
12: *
13: * You should have received a copy of the GNU General Public
14: * License along with dbmjui; see the file COPYING. If not,
15: * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16: * Boston, MA 02111-1307, USA.
17: *
18: */
19: package fr.aliacom.dbmjui.driver;
20:
21: import java.util.ArrayList;
22: import java.util.Iterator;
23:
24: import org.apache.log4j.Logger;
25:
26: /**
27: * @author tom
28: *
29: * (c) 2001, 2003 Thomas Cataldo
30: */
31: public class DbmJuiDriverManager {
32:
33: private static DbmJuiDriverManager singleton;
34: static {
35: singleton = new DbmJuiDriverManager();
36: }
37:
38: public static DbmJuiDriverManager getInstance() {
39: return singleton;
40: }
41:
42: private ArrayList driverClasses;
43: private Logger log;
44:
45: private DbmJuiDriverManager() {
46: log = Logger.getLogger(DbmJuiDriverManager.class);
47: driverClasses = new ArrayList();
48: addExternalDriverClasses();
49: addInternalDriverClasses();
50: }
51:
52: private void addExternalDriverClasses() {
53: // load driver classes from a file
54: }
55:
56: private void addInternalDriverClasses() {
57: driverClasses
58: .add("fr.aliacom.dbmjui.driver.DefaultDbmJuiDriver");
59: }
60:
61: /**
62: * @return an iterator on the available drivers.
63: */
64: public Iterator getDrivers() {
65: return new DriverIterator(driverClasses.iterator(), log);
66: }
67:
68: }
|