Source Code Cross Referenced for SQLObjectFactory.java in  » Test-Coverage » salome-tmf » org » objectweb » salome_tmf » databaseSQL » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Test Coverage » salome tmf » org.objectweb.salome_tmf.databaseSQL 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * SalomeTMF is a Test Management Framework
003:         * Copyright (C) 2005 France Telecom R&D
004:         *
005:         * This library is free software; you can redistribute it and/or
006:         * modify it under the terms of the GNU Lesser General Public
007:         * License as published by the Free Software Foundation; either
008:         * version 2 of the License, or (at your option) any later version.
009:         *
010:         * This library is distributed in the hope that it will be useful,
011:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
012:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013:         * Lesser General Public License for more details.
014:         *
015:         * You should have received a copy of the GNU Lesser General Public
016:         * License along with this library; if not, write to the Free Software
017:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018:         *
019:         * @author Marche Mikael
020:         *
021:         * Contact: mikael.marche@rd.francetelecom.com
022:         */
023:
024:        package org.objectweb.salome_tmf.databaseSQL;
025:
026:        import java.sql.PreparedStatement;
027:
028:        import org.objectweb.salome_tmf.api.IChangeDispatcher;
029:        import org.objectweb.salome_tmf.api.ISafeThread;
030:        import org.objectweb.salome_tmf.api.sql.IDataBase;
031:        import org.objectweb.salome_tmf.api.sql.ISQLAction;
032:        import org.objectweb.salome_tmf.api.sql.ISQLAttachment;
033:        import org.objectweb.salome_tmf.api.sql.ISQLAutomaticTest;
034:        import org.objectweb.salome_tmf.api.sql.ISQLCampaign;
035:        import org.objectweb.salome_tmf.api.sql.ISQLConfig;
036:        import org.objectweb.salome_tmf.api.sql.ISQLDataset;
037:        import org.objectweb.salome_tmf.api.sql.ISQLEngine;
038:        import org.objectweb.salome_tmf.api.sql.ISQLEnvironment;
039:        import org.objectweb.salome_tmf.api.sql.ISQLExecution;
040:        import org.objectweb.salome_tmf.api.sql.ISQLExecutionActionResult;
041:        import org.objectweb.salome_tmf.api.sql.ISQLExecutionResult;
042:        import org.objectweb.salome_tmf.api.sql.ISQLExecutionTestResult;
043:        import org.objectweb.salome_tmf.api.sql.ISQLFamily;
044:        import org.objectweb.salome_tmf.api.sql.ISQLFileAttachment;
045:        import org.objectweb.salome_tmf.api.sql.ISQLGroup;
046:        import org.objectweb.salome_tmf.api.sql.ISQLManualTest;
047:        import org.objectweb.salome_tmf.api.sql.ISQLObjectFactory;
048:        import org.objectweb.salome_tmf.api.sql.ISQLParameter;
049:        import org.objectweb.salome_tmf.api.sql.ISQLPersonne;
050:        import org.objectweb.salome_tmf.api.sql.ISQLProject;
051:        import org.objectweb.salome_tmf.api.sql.ISQLSalomeLock;
052:        import org.objectweb.salome_tmf.api.sql.ISQLScript;
053:        import org.objectweb.salome_tmf.api.sql.ISQLSession;
054:        import org.objectweb.salome_tmf.api.sql.ISQLTest;
055:        import org.objectweb.salome_tmf.api.sql.ISQLTestList;
056:        import org.objectweb.salome_tmf.api.sql.ISQLUrlAttachment;
057:
058:        public class SQLObjectFactory implements  ISQLObjectFactory {
059:
060:            static SQLManualTest pISQLManualTest = null;
061:            static SQLAction pISQLAction = null;
062:            static ISQLParameter pISQLParameter = null;
063:            static ISQLAttachment pISQLAttachment = null;
064:            static ISQLUrlAttachment pISQLUrlAttachment = null;
065:            static ISQLFileAttachment pISQLFileAttachment = null;
066:            static ISQLTestList pISQLTestList = null;
067:            static ISQLAutomaticTest pISQLAutomaticTest = null;
068:            static ISQLCampaign pISQLCampaign = null;
069:            static ISQLScript pISQLScript = null;
070:            static ISQLPersonne pISQLPersonne = null;
071:            static ISQLFamily pISQLFamily = null;
072:            static ISQLTest pISQLTest = null;
073:            static ISQLProject pISQLProject = null;
074:            static ISQLEnvironment pISQLEnvironment = null;
075:            static ISQLExecution pISQLExecution = null;
076:            static ISQLExecutionResult pISQLExecutionResult = null;
077:            static ISQLExecutionTestResult pISQLExecutionTestResult = null;
078:            static ISQLExecutionActionResult pISQLExecutionActionResult = null;
079:            static ISQLDataset pISQLDataset = null;
080:            static SQLEngine pSQLEngine = null;
081:            static ChangeListener pChangeListener = null;
082:            static ISQLSession pISQLSession = null;
083:            protected static ISQLGroup pSQLGroup = null;
084:            static ISQLConfig pSQLConfig = null;
085:            static ISQLSalomeLock pSQLSalomeLock = null;
086:
087:            static int projectID = 0;
088:            static int personneID = 0;
089:            DataBase pDB;
090:
091:            static String version = "3.0";
092:
093:            public ISQLEngine getInstanceOfSQLEngine(String url,
094:                    String username, String password,
095:                    IChangeDispatcher pIChangeDispatcher, int pid,
096:                    String driverJDBC, int locktype) throws Exception {
097:                if (pSQLEngine == null) {
098:                    pDB = new DataBase(driverJDBC);
099:                    pDB.open(url, username, password);
100:                    pSQLEngine = new SQLEngine();
101:                    SQLEngine.initSQLEngine(pDB, true, null, locktype);
102:                    autoUpdateDB();
103:                    pChangeListener = new ChangeListener(pid,
104:                            pIChangeDispatcher);
105:                } else {
106:                    pDB = new DataBase(driverJDBC);
107:                    pDB.open(url, username, password);
108:                    pSQLEngine.initDB(pDB);
109:                }
110:                return pSQLEngine;
111:            }
112:
113:            void autoUpdateDB() throws Exception {
114:                getInstanceOfISQLConfig();
115:                String salome_version = pSQLConfig.getSalomeConf("VERSION");
116:                if (salome_version != null) {
117:                    //Float floatVersion = Float.valueOf("salome_version");
118:                    version = salome_version;
119:                } else {
120:                    pSQLConfig.insertSalomeConf("VERSION", version);
121:                    //Update DataBase 2.3 -> 3.0
122:                    PreparedStatement statement = pSQLEngine
123:                            .getSQLCommonQuery("addAssignedField");
124:                    pSQLEngine.runUpdateQuery(statement);
125:                }
126:            }
127:
128:            public String getSalomeVersion() {
129:                return version + "[JDBC]";
130:            }
131:
132:            public ISQLEngine getCurrentSQLEngine() {
133:                return pSQLEngine;
134:            }
135:
136:            public IDataBase getInstanceOfDataBase(String driver)
137:                    throws Exception {
138:                DataBase db = new DataBase(driver);
139:                return (IDataBase) db;
140:            }
141:
142:            public IDataBase getInstanceOfSalomeDataBase() throws Exception {
143:                return (IDataBase) pDB;
144:            }
145:
146:            public ISafeThread getChangeListener(String projet) {
147:                pChangeListener.setProjet(projet);
148:                return pChangeListener;
149:            }
150:
151:            public void changeListenerProject(String projet) {
152:                pChangeListener.setProjet(projet);
153:            }
154:
155:            public ISQLSalomeLock getISQLSalomeLock() {
156:                return getInstanceOfISQLSalomeLock();
157:            }
158:
159:            static ISQLSalomeLock getInstanceOfISQLSalomeLock() {
160:                if (pSQLSalomeLock == null) {
161:                    pSQLSalomeLock = new SQLSalomeLock();
162:                }
163:                return pSQLSalomeLock;
164:            }
165:
166:            public ISQLConfig getISQLConfig() {
167:                return getInstanceOfISQLConfig();
168:            }
169:
170:            static ISQLConfig getInstanceOfISQLConfig() {
171:                if (pSQLConfig == null) {
172:                    pSQLConfig = new SQLConfig();
173:                }
174:                return pSQLConfig;
175:            }
176:
177:            public ISQLGroup getISQLGroup() {
178:                return getInstanceOfISQLGroup();
179:            }
180:
181:            static ISQLGroup getInstanceOfISQLGroup() {
182:                if (pSQLGroup == null) {
183:                    pSQLGroup = new SQLGroup();
184:                }
185:                return pSQLGroup;
186:            }
187:
188:            public ISQLSession getISQLSession() {
189:                return getInstanceOfISQLSession();
190:            }
191:
192:            static ISQLSession getInstanceOfISQLSession() {
193:                if (pISQLSession == null) {
194:                    pISQLSession = new SQLSession();
195:                }
196:                return pISQLSession;
197:            }
198:
199:            public ISQLDataset getISQLDataset() {
200:                return getInstanceOfISQLDataset();
201:            }
202:
203:            static ISQLDataset getInstanceOfISQLDataset() {
204:                if (pISQLDataset == null) {
205:                    pISQLDataset = new SQLDataset();
206:                }
207:                return pISQLDataset;
208:            }
209:
210:            public ISQLExecutionActionResult getISQLExecutionActionResult() {
211:                return getInstanceOfISQLExecutionActionResult();
212:            }
213:
214:            static ISQLExecutionActionResult getInstanceOfISQLExecutionActionResult() {
215:                if (pISQLExecutionActionResult == null) {
216:                    pISQLExecutionActionResult = new SQLExecutionActionResult();
217:                }
218:                return pISQLExecutionActionResult;
219:            }
220:
221:            public ISQLExecutionTestResult getISQLExecutionTestResult() {
222:                return getInstanceOfISQLExecutionTestResult();
223:            }
224:
225:            static ISQLExecutionTestResult getInstanceOfISQLExecutionTestResult() {
226:                if (pISQLExecutionTestResult == null) {
227:                    pISQLExecutionTestResult = new SQLExecutionTestResult();
228:                }
229:                return pISQLExecutionTestResult;
230:            }
231:
232:            public ISQLExecutionResult getISQLExecutionResult() {
233:                return getInstanceOfISQLExecutionResult();
234:            }
235:
236:            static ISQLExecutionResult getInstanceOfISQLExecutionResult() {
237:                if (pISQLExecutionResult == null) {
238:                    pISQLExecutionResult = new SQLExecutionResult();
239:                }
240:                return pISQLExecutionResult;
241:            }
242:
243:            public ISQLExecution getISQLExecution() {
244:                return getInstanceOfISQLExecution();
245:            }
246:
247:            static ISQLExecution getInstanceOfISQLExecution() {
248:                if (pISQLExecution == null) {
249:                    pISQLExecution = new SQLExecution();
250:                }
251:                return pISQLExecution;
252:            }
253:
254:            public ISQLEnvironment getISQLEnvironment() {
255:                return getInstanceOfISQLEnvironment();
256:            }
257:
258:            static ISQLEnvironment getInstanceOfISQLEnvironment() {
259:                if (pISQLEnvironment == null) {
260:                    pISQLEnvironment = new SQLEnvironment();
261:                }
262:                return pISQLEnvironment;
263:            }
264:
265:            public ISQLProject getISQLProject() {
266:                return getInstanceOfISQLProject();
267:            }
268:
269:            static ISQLProject getInstanceOfISQLProject() {
270:                if (pISQLProject == null) {
271:                    pISQLProject = new SQLProject();
272:                }
273:                return pISQLProject;
274:            }
275:
276:            public ISQLTest getISQLTest() {
277:                return getInstanceOfISQLTest();
278:            }
279:
280:            static ISQLTest getInstanceOfISQLTest() {
281:                if (pISQLTest == null) {
282:                    pISQLTest = new SQLTest();
283:                }
284:                return pISQLTest;
285:            }
286:
287:            public ISQLFamily getISQLFamily() {
288:                return getInstanceOfISQLFamily();
289:            }
290:
291:            static ISQLFamily getInstanceOfISQLFamily() {
292:                if (pISQLFamily == null) {
293:                    pISQLFamily = new SQLFamily();
294:                }
295:                return pISQLFamily;
296:            }
297:
298:            public ISQLPersonne getISQLPersonne() {
299:                return getInstanceOfISQLPersonne();
300:            }
301:
302:            static ISQLPersonne getInstanceOfISQLPersonne() {
303:                if (pISQLPersonne == null) {
304:                    pISQLPersonne = new SQLPersonne();
305:                }
306:                return pISQLPersonne;
307:            }
308:
309:            public ISQLScript getISQLScript() {
310:                return getInstanceOfISQLScript();
311:            }
312:
313:            static ISQLScript getInstanceOfISQLScript() {
314:                if (pISQLScript == null) {
315:                    pISQLScript = new SQLScript();
316:                }
317:                return pISQLScript;
318:            }
319:
320:            public ISQLCampaign getISQLCampaign() {
321:                return getInstanceOfISQLCampaign();
322:            }
323:
324:            static ISQLCampaign getInstanceOfISQLCampaign() {
325:                if (pISQLCampaign == null) {
326:                    pISQLCampaign = new SQLCampaign();
327:                }
328:                return pISQLCampaign;
329:            }
330:
331:            public ISQLAutomaticTest getISQLAutomaticTest() {
332:                return getInstanceOfISQLAutomaticTest();
333:            }
334:
335:            static ISQLAutomaticTest getInstanceOfISQLAutomaticTest() {
336:                if (pISQLAutomaticTest == null) {
337:                    pISQLAutomaticTest = new SQLAutomaticTest();
338:                }
339:                return pISQLAutomaticTest;
340:            }
341:
342:            public ISQLTestList getISQLTestList() {
343:                return getInstanceOfISQLTestList();
344:            }
345:
346:            static ISQLTestList getInstanceOfISQLTestList() {
347:                if (pISQLTestList == null) {
348:                    pISQLTestList = new SQLTestList();
349:                }
350:                return pISQLTestList;
351:            }
352:
353:            public ISQLFileAttachment getISQLFileAttachment() {
354:                return getInstanceOfISQLFileAttachment();
355:            }
356:
357:            static ISQLFileAttachment getInstanceOfISQLFileAttachment() {
358:                if (pISQLFileAttachment == null) {
359:                    pISQLFileAttachment = new SQLFileAttachment();
360:                }
361:                return pISQLFileAttachment;
362:            }
363:
364:            public ISQLUrlAttachment getISQLUrlAttachment() {
365:                return getInstanceOfISQLUrlAttachment();
366:            }
367:
368:            static ISQLUrlAttachment getInstanceOfISQLUrlAttachment() {
369:                if (pISQLUrlAttachment == null) {
370:                    pISQLUrlAttachment = new SQLUrlAttachment();
371:                }
372:                return pISQLUrlAttachment;
373:            }
374:
375:            public ISQLAttachment getISQLAttachment() {
376:                return getInstanceOfISQLAttachment();
377:            }
378:
379:            static ISQLAttachment getInstanceOfISQLAttachment() {
380:                if (pISQLAttachment == null) {
381:                    pISQLAttachment = new SQLAttachment();
382:                }
383:                return pISQLAttachment;
384:            }
385:
386:            public ISQLParameter getISQLParameter() {
387:                return getInstanceOfISQLParameter();
388:            }
389:
390:            static ISQLParameter getInstanceOfISQLParameter() {
391:                if (pISQLParameter == null) {
392:                    pISQLParameter = new SQLParameter();
393:                }
394:                return pISQLParameter;
395:            }
396:
397:            public ISQLAction getISQLAction() {
398:                return getInstanceOfISQLAction();
399:            }
400:
401:            static public ISQLAction getInstanceOfISQLAction() {
402:                if (pISQLAction == null) {
403:                    pISQLAction = new SQLAction();
404:                }
405:                return pISQLAction;
406:            }
407:
408:            public ISQLManualTest getISQLManualTest() {
409:                return getInstanceOfISQLManualTest();
410:            }
411:
412:            static public ISQLManualTest getInstanceOfISQLManualTest() {
413:                if (pISQLManualTest == null) {
414:                    pISQLManualTest = new SQLManualTest();
415:                }
416:                return pISQLManualTest;
417:            }
418:
419:            public void setConnexionInfo(int _projectID, int _personneID) {
420:                projectID = _projectID;
421:                personneID = _personneID;
422:                pSQLEngine.setConnexionInfo(projectID, personneID);
423:            }
424:
425:            public int getProjectID() {
426:                return projectID;
427:            }
428:
429:            public int getPersonneID() {
430:                return personneID;
431:            }
432:
433:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.