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.soap;
025:
026: import javax.xml.rpc.ServiceException;
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 ISQLManualTest pISQLManualTest = null;
062: // static SQLAction pISQLAction = null;
063: static ISQLAction pISQLAction = null;
064: static ISQLParameter pISQLParameter = null;
065: static ISQLAttachment pISQLAttachment = null;
066: static ISQLUrlAttachment pISQLUrlAttachment = null;
067: static ISQLFileAttachment pISQLFileAttachment = null;
068: static ISQLTestList pISQLTestList = null;
069: static ISQLAutomaticTest pISQLAutomaticTest = null;
070: static ISQLCampaign pISQLCampaign = null;
071: static ISQLScript pISQLScript = null;
072: static ISQLPersonne pISQLPersonne = null;
073: static ISQLFamily pISQLFamily = null;
074: static ISQLTest pISQLTest = null;
075: static ISQLProject pISQLProject = null;
076: static ISQLEnvironment pISQLEnvironment = null;
077: static ISQLExecution pISQLExecution = null;
078: static ISQLExecutionResult pISQLExecutionResult = null;
079: static ISQLExecutionTestResult pISQLExecutionTestResult = null;
080: static ISQLExecutionActionResult pISQLExecutionActionResult = null;
081: static ISQLDataset pISQLDataset = null;
082: // static SQLEngine pSQLEngine= null;
083: static ISQLEngine pISQLEngine = null;
084: // static ChangeListener pChangeListener = null;
085: static ISQLSession pISQLSession = null;
086: protected static ISQLGroup pSQLGroup = null;
087: static ISQLConfig pSQLConfig = null;
088: static ISQLSalomeLock pSQLSalomeLock = null;
089:
090: // static int projectID = 0;
091: // static int personneID = 0;
092: // DataBase pDB;
093:
094: static String version = "3.0";
095:
096: public ISQLEngine getInstanceOfSQLEngine(String url,
097: String username, String password,
098: IChangeDispatcher pIChangeDispatcher, int pid,
099: String driverJDBC, int locktype) throws Exception {
100: // if (pSQLEngine == null){
101: // pDB = new DataBase(driverJDBC);
102: // pDB.open(url, username, password);
103: // pSQLEngine = new SQLEngine();
104: // SQLEngine.initSQLEngine(pDB, true, null, locktype);
105: // autoUpdateDB();
106: // pChangeListener = new ChangeListener(pid, pIChangeDispatcher);
107: // } else {
108: // pDB = new DataBase(driverJDBC);
109: // pDB.open(url, username, password);
110: // pSQLEngine.initDB(pDB);
111: // }
112: // return pSQLEngine;
113: if (pISQLEngine == null) {
114: try {
115: pISQLEngine = new ISQLEngineServiceLocator()
116: .getSQLEngine();
117: } catch (ServiceException e) {
118: }
119: }
120: return pISQLEngine;
121: // return null;
122: }
123:
124: void autoUpdateDB() throws Exception {
125: // getInstanceOfISQLConfig();
126: // String salome_version = pSQLConfig.getSalomeConf("VERSION");
127: // if (salome_version != null ){
128: // //Float floatVersion = Float.valueOf("salome_version");
129: // version = salome_version;
130: // } else {
131: // pSQLConfig.insertSalomeConf("VERSION", version);
132: // //Update DataBase 2.3 -> 3.0
133: // PreparedStatement statement = pSQLEngine.getSQLCommonQuery("addAssignedField");
134: // pSQLEngine.runUpdateQuery(statement);
135: // }
136: }
137:
138: public String getSalomeVersion() {
139: try {
140: version = pSQLConfig.getSalomeConf("VERSION");
141: } catch (Exception e) {
142: e.printStackTrace();
143: }
144: return version + "[SOAP]";
145: }
146:
147: public ISQLEngine getCurrentSQLEngine() {
148: return pISQLEngine;
149: // return null;
150: }
151:
152: public IDataBase getInstanceOfDataBase(String driver)
153: throws Exception {
154: // DataBase db = new DataBase(driver);
155: // return (IDataBase)db;
156: return null;
157: }
158:
159: public IDataBase getInstanceOfSalomeDataBase() throws Exception {
160: // return (IDataBase) pDB;
161: return null;
162: }
163:
164: public ISafeThread getChangeListener(String projet) {
165: // pChangeListener.setProjet(projet);
166: // return pChangeListener;
167: return null;
168: }
169:
170: public void changeListenerProject(String projet) {
171: // pChangeListener.setProjet(projet);
172: }
173:
174: public ISQLAction getISQLAction() {
175: return getInstanceOfISQLAction();
176: }
177:
178: static public ISQLAction getInstanceOfISQLAction() {
179: if (pISQLAction == null) {
180: try {
181: pISQLAction = new ISQLActionServiceLocator()
182: .getSQLAction();
183: } catch (ServiceException e) {
184: }
185: }
186: return pISQLAction;
187: }
188:
189: public ISQLAttachment getISQLAttachment() {
190: return getInstanceOfISQLAttachment();
191: }
192:
193: static ISQLAttachment getInstanceOfISQLAttachment() {
194: if (pISQLAttachment == null) {
195: try {
196: pISQLAttachment = new ISQLAttachmentServiceLocator()
197: .getSQLAttachment();
198: } catch (ServiceException e) {
199: }
200: }
201: return pISQLAttachment;
202: }
203:
204: public ISQLAutomaticTest getISQLAutomaticTest() {
205: return getInstanceOfISQLAutomaticTest();
206: }
207:
208: static ISQLAutomaticTest getInstanceOfISQLAutomaticTest() {
209: if (pISQLAutomaticTest == null) {
210: try {
211: pISQLAutomaticTest = new ISQLAutomaticTestServiceLocator()
212: .getSQLAutomaticTest();
213: } catch (ServiceException e) {
214: }
215: }
216: return pISQLAutomaticTest;
217: }
218:
219: public ISQLCampaign getISQLCampaign() {
220: return getInstanceOfISQLCampaign();
221: }
222:
223: static ISQLCampaign getInstanceOfISQLCampaign() {
224: if (pISQLCampaign == null) {
225: try {
226: pISQLCampaign = new ISQLCampaignServiceLocator()
227: .getSQLCampaign();
228: } catch (ServiceException e) {
229: }
230: }
231: return pISQLCampaign;
232: }
233:
234: public ISQLConfig getISQLConfig() {
235: return getInstanceOfISQLConfig();
236: }
237:
238: static ISQLConfig getInstanceOfISQLConfig() {
239: if (pSQLConfig == null) {
240: try {
241: pSQLConfig = new ISQLConfigServiceLocator()
242: .getSQLConfig();
243: } catch (ServiceException e) {
244: }
245: }
246: return pSQLConfig;
247: }
248:
249: public ISQLDataset getISQLDataset() {
250: return getInstanceOfISQLDataset();
251: }
252:
253: static ISQLDataset getInstanceOfISQLDataset() {
254: if (pISQLDataset == null) {
255: try {
256: pISQLDataset = new ISQLDatasetServiceLocator()
257: .getSQLDataset();
258: } catch (ServiceException e) {
259: }
260: }
261: return pISQLDataset;
262: }
263:
264: public ISQLEnvironment getISQLEnvironment() {
265: return getInstanceOfISQLEnvironment();
266: }
267:
268: static ISQLEnvironment getInstanceOfISQLEnvironment() {
269: if (pISQLEnvironment == null) {
270: try {
271: pISQLEnvironment = new ISQLEnvironmentServiceLocator()
272: .getSQLEnvironment();
273: } catch (ServiceException e) {
274: }
275: }
276: return pISQLEnvironment;
277: }
278:
279: public ISQLExecution getISQLExecution() {
280: return getInstanceOfISQLExecution();
281: }
282:
283: static ISQLExecution getInstanceOfISQLExecution() {
284: if (pISQLExecution == null) {
285: try {
286: pISQLExecution = new ISQLExecutionServiceLocator()
287: .getSQLExecution();
288: } catch (ServiceException e) {
289: }
290: }
291: return pISQLExecution;
292: }
293:
294: public ISQLExecutionActionResult getISQLExecutionActionResult() {
295: return getInstanceOfISQLExecutionActionResult();
296: }
297:
298: static ISQLExecutionActionResult getInstanceOfISQLExecutionActionResult() {
299: if (pISQLExecutionActionResult == null) {
300: try {
301: pISQLExecutionActionResult = new ISQLExecutionActionResultServiceLocator()
302: .getSQLExecutionActionResult();
303: } catch (ServiceException e) {
304: }
305: }
306: return pISQLExecutionActionResult;
307: }
308:
309: public ISQLExecutionResult getISQLExecutionResult() {
310: return getInstanceOfISQLExecutionResult();
311: }
312:
313: static ISQLExecutionResult getInstanceOfISQLExecutionResult() {
314: if (pISQLExecutionResult == null) {
315: try {
316: pISQLExecutionResult = new ISQLExecutionResultServiceLocator()
317: .getSQLExecutionResult();
318: } catch (ServiceException e) {
319: }
320: }
321: return pISQLExecutionResult;
322: }
323:
324: public ISQLExecutionTestResult getISQLExecutionTestResult() {
325: return getInstanceOfISQLExecutionTestResult();
326: }
327:
328: static ISQLExecutionTestResult getInstanceOfISQLExecutionTestResult() {
329: if (pISQLExecutionTestResult == null) {
330: try {
331: pISQLExecutionTestResult = new ISQLExecutionTestResultServiceLocator()
332: .getSQLExecutionTestResult();
333: } catch (ServiceException e) {
334: }
335: }
336: return pISQLExecutionTestResult;
337: }
338:
339: public ISQLFamily getISQLFamily() {
340: return getInstanceOfISQLFamily();
341: }
342:
343: static ISQLFamily getInstanceOfISQLFamily() {
344: if (pISQLFamily == null) {
345: try {
346: pISQLFamily = new ISQLFamilyServiceLocator()
347: .getSQLFamily();
348: } catch (ServiceException e) {
349: }
350: }
351: return pISQLFamily;
352: }
353:
354: public ISQLFileAttachment getISQLFileAttachment() {
355: return getInstanceOfISQLFileAttachment();
356: }
357:
358: static ISQLFileAttachment getInstanceOfISQLFileAttachment() {
359: if (pISQLFileAttachment == null) {
360: try {
361: pISQLFileAttachment = new ISQLFileAttachmentServiceLocator()
362: .getSQLFileAttachment();
363: } catch (ServiceException e) {
364: }
365: }
366: return pISQLFileAttachment;
367: }
368:
369: public ISQLGroup getISQLGroup() {
370: return getInstanceOfISQLGroup();
371: }
372:
373: static ISQLGroup getInstanceOfISQLGroup() {
374: if (pSQLGroup == null) {
375: try {
376: pSQLGroup = new ISQLGroupServiceLocator().getSQLGroup();
377: } catch (ServiceException e) {
378: }
379: }
380: return pSQLGroup;
381: }
382:
383: public ISQLManualTest getISQLManualTest() {
384: return getInstanceOfISQLManualTest();
385: }
386:
387: static public ISQLManualTest getInstanceOfISQLManualTest() {
388: if (pISQLManualTest == null) {
389: try {
390: pISQLManualTest = new ISQLManualTestServiceLocator()
391: .getSQLManualTest();
392: } catch (ServiceException e) {
393: }
394: }
395: return pISQLManualTest;
396: }
397:
398: public ISQLParameter getISQLParameter() {
399: return getInstanceOfISQLParameter();
400: }
401:
402: static ISQLParameter getInstanceOfISQLParameter() {
403: if (pISQLParameter == null) {
404: try {
405: pISQLParameter = new ISQLParameterServiceLocator()
406: .getSQLParameter();
407: } catch (ServiceException e) {
408: }
409: }
410: return pISQLParameter;
411: }
412:
413: public ISQLPersonne getISQLPersonne() {
414: return getInstanceOfISQLPersonne();
415: }
416:
417: static ISQLPersonne getInstanceOfISQLPersonne() {
418: if (pISQLPersonne == null) {
419: try {
420: pISQLPersonne = new ISQLPersonneServiceLocator()
421: .getSQLPersonne();
422: } catch (ServiceException e) {
423: }
424: }
425: return pISQLPersonne;
426: }
427:
428: public ISQLProject getISQLProject() {
429: return getInstanceOfISQLProject();
430: }
431:
432: static ISQLProject getInstanceOfISQLProject() {
433: if (pISQLProject == null) {
434: try {
435: pISQLProject = new ISQLProjectServiceLocator()
436: .getSQLProject();
437: } catch (ServiceException e) {
438: }
439: }
440: return pISQLProject;
441: }
442:
443: public ISQLSalomeLock getISQLSalomeLock() {
444: return getInstanceOfISQLSalomeLock();
445: }
446:
447: static ISQLSalomeLock getInstanceOfISQLSalomeLock() {
448: if (pSQLSalomeLock == null) {
449: try {
450: pSQLSalomeLock = new ISQLSalomeLockServiceLocator()
451: .getSQLSalomeLock();
452: } catch (ServiceException e) {
453: }
454: }
455: return pSQLSalomeLock;
456: }
457:
458: public ISQLScript getISQLScript() {
459: return getInstanceOfISQLScript();
460: }
461:
462: static ISQLScript getInstanceOfISQLScript() {
463: if (pISQLScript == null) {
464: try {
465: pISQLScript = new ISQLScriptServiceLocator()
466: .getSQLScript();
467: } catch (ServiceException e) {
468: }
469: }
470: return pISQLScript;
471: }
472:
473: public ISQLSession getISQLSession() {
474: return getInstanceOfISQLSession();
475: }
476:
477: static ISQLSession getInstanceOfISQLSession() {
478: if (pISQLSession == null) {
479: try {
480: pISQLSession = new ISQLSessionServiceLocator()
481: .getSQLSession();
482: } catch (ServiceException e) {
483: }
484: }
485: return pISQLSession;
486: }
487:
488: public ISQLTest getISQLTest() {
489: return getInstanceOfISQLTest();
490: }
491:
492: static ISQLTest getInstanceOfISQLTest() {
493: if (pISQLTest == null) {
494: try {
495: pISQLTest = new ISQLTestServiceLocator().getSQLTest();
496: } catch (ServiceException e) {
497: }
498: }
499: return pISQLTest;
500: }
501:
502: public ISQLTestList getISQLTestList() {
503: return getInstanceOfISQLTestList();
504: }
505:
506: static ISQLTestList getInstanceOfISQLTestList() {
507: if (pISQLTestList == null) {
508: try {
509: pISQLTestList = new ISQLTestListServiceLocator()
510: .getSQLTestList();
511: } catch (ServiceException e) {
512: }
513: }
514: return pISQLTestList;
515: }
516:
517: public ISQLUrlAttachment getISQLUrlAttachment() {
518: return getInstanceOfISQLUrlAttachment();
519: }
520:
521: static ISQLUrlAttachment getInstanceOfISQLUrlAttachment() {
522: if (pISQLUrlAttachment == null) {
523: try {
524: pISQLUrlAttachment = new ISQLUrlAttachmentServiceLocator()
525: .getSQLUrlAttachment();
526: } catch (ServiceException e) {
527: }
528: }
529: return pISQLUrlAttachment;
530: }
531:
532: public void setConnexionInfo(int _projectID, int _personneID) {
533: // projectID = _projectID;
534: // personneID = _personneID;
535: // pSQLEngine.setConnexionInfo(projectID, personneID);
536: }
537:
538: public int getProjectID() {
539: // return projectID;
540: return -1;
541: }
542:
543: public int getPersonneID() {
544: // return personneID;
545: return -1;
546: }
547:
548: }
|