01: package org.objectweb.salome_tmf.databaseSQL;
02:
03: import org.objectweb.salome_tmf.api.IChangeDispatcher;
04: import org.objectweb.salome_tmf.api.sql.ISQLEngine;
05: import org.objectweb.salome_tmf.api.sql.ISQLProject;
06:
07: public class SQLObjectFactoryGforge extends SQLObjectFactory {
08:
09: public ISQLEngine getInstanceOfSQLEngine(String url,
10: String username, String password,
11: IChangeDispatcher pIChangeDispatcher, int pid,
12: String driverJDBC, int locktype) throws Exception {
13: if (pSQLEngine == null) {
14: pDB = new DataBase(driverJDBC);
15: pDB.open(url, username, password);
16: pSQLEngine = new SQLEngineGForge();
17: SQLEngineGForge.initSQLEngine(pDB, true, locktype);
18: autoUpdateDB();
19: pChangeListener = new ChangeListener(pid,
20: pIChangeDispatcher);
21: } else {
22: pDB = new DataBase(driverJDBC);
23: pDB.open(url, username, password);
24: //System.out.println("INIT DB");
25: ((SQLEngineGForge) pSQLEngine).initDB(pDB);
26: }
27: return pSQLEngine;
28: }
29:
30: public ISQLProject getISQLProject() {
31: return SQLObjectFactoryGforge.getInstanceOfISQLProject();
32: }
33:
34: static ISQLProject getInstanceOfISQLProject() {
35: if (pISQLProject == null) {
36: pISQLProject = new SQLProjectGForge();
37: }
38: return pISQLProject;
39: }
40: }
|