SQLObjectFactoryMSServer.java :  » Test-Coverage » salome-tmf » org » objectweb » salome_tmf » databaseSQL » Java Open Source

Java Open Source » Test Coverage » salome tmf 
salome tmf » org » objectweb » salome_tmf » databaseSQL » SQLObjectFactoryMSServer.java

/*
* SalomeTMF is a Test Management Framework
* Copyright (C) 2005 France Telecom R&D
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* @author Marche Mikael
*
* Contact: mikael.marche@rd.francetelecom.com
*/

package org.objectweb.salome_tmf.databaseSQL;

import org.objectweb.salome_tmf.api.IChangeDispatcher;
import org.objectweb.salome_tmf.api.ISafeThread;
import org.objectweb.salome_tmf.api.sql.IDataBase;
import org.objectweb.salome_tmf.api.sql.ISQLAction;
import org.objectweb.salome_tmf.api.sql.ISQLAttachment;
import org.objectweb.salome_tmf.api.sql.ISQLAutomaticTest;
import org.objectweb.salome_tmf.api.sql.ISQLCampaign;
import org.objectweb.salome_tmf.api.sql.ISQLConfig;
import org.objectweb.salome_tmf.api.sql.ISQLDataset;
import org.objectweb.salome_tmf.api.sql.ISQLEngine;
import org.objectweb.salome_tmf.api.sql.ISQLEnvironment;
import org.objectweb.salome_tmf.api.sql.ISQLExecution;
import org.objectweb.salome_tmf.api.sql.ISQLExecutionActionResult;
import org.objectweb.salome_tmf.api.sql.ISQLExecutionResult;
import org.objectweb.salome_tmf.api.sql.ISQLExecutionTestResult;
import org.objectweb.salome_tmf.api.sql.ISQLFamily;
import org.objectweb.salome_tmf.api.sql.ISQLFileAttachment;
import org.objectweb.salome_tmf.api.sql.ISQLGroup;
import org.objectweb.salome_tmf.api.sql.ISQLManualTest;
import org.objectweb.salome_tmf.api.sql.ISQLObjectFactory;
import org.objectweb.salome_tmf.api.sql.ISQLParameter;
import org.objectweb.salome_tmf.api.sql.ISQLPersonne;
import org.objectweb.salome_tmf.api.sql.ISQLProject;
import org.objectweb.salome_tmf.api.sql.ISQLSalomeLock;
import org.objectweb.salome_tmf.api.sql.ISQLScript;
import org.objectweb.salome_tmf.api.sql.ISQLSession;
import org.objectweb.salome_tmf.api.sql.ISQLTest;
import org.objectweb.salome_tmf.api.sql.ISQLTestList;
import org.objectweb.salome_tmf.api.sql.ISQLUrlAttachment;

public class SQLObjectFactoryMSServer implements ISQLObjectFactory {
  
  static SQLManualTest pISQLManualTest = null;
  static SQLAction pISQLAction = null;
  static ISQLParameter pISQLParameter = null;
  static ISQLAttachment pISQLAttachment = null;
  static ISQLUrlAttachment pISQLUrlAttachment = null;
  static ISQLFileAttachment pISQLFileAttachment  = null;
  static ISQLTestList pISQLTestList = null;
  static ISQLAutomaticTest pISQLAutomaticTest = null;
  static ISQLCampaign pISQLCampaign = null;
  static ISQLScript pISQLScript = null;
  static ISQLPersonne pISQLPersonne = null;
  static ISQLFamily pISQLFamily = null;
  static ISQLTest pISQLTest = null;
  static ISQLProject pISQLProject = null;
  static ISQLEnvironment pISQLEnvironment = null;
  static ISQLExecution pISQLExecution = null;
  static ISQLExecutionResult pISQLExecutionResult = null;
  static ISQLExecutionTestResult pISQLExecutionTestResult = null;
  static ISQLExecutionActionResult pISQLExecutionActionResult = null;
  static ISQLDataset pISQLDataset = null;
  static SQLEngine pSQLEngine= null;
  static ChangeListener pChangeListener = null;
  static ISQLSession pISQLSession = null;
  static ISQLGroup pSQLGroup = null;
  protected static ISQLConfig pSQLConfig = null;
  static ISQLSalomeLock pSQLSalomeLock = null;
  
  static int projectID = 0;
  static int personneID = 0;
  DataBase pDB;
  
  
  
  public ISQLEngine getInstanceOfSQLEngine(String url, String username, String password, IChangeDispatcher pIChangeDispatcher, int pid, String driverJDBC, int locktype) throws Exception {
    if (pSQLEngine == null){
      pDB = new DataBase(driverJDBC);
      pDB.open(url, username, password);
      pSQLEngine = new SQLEngine();
      SQLEngine.initSQLEngine(pDB, true, "/org/objectweb/salome_tmf/databaseSQL/mssql/", locktype);
      pChangeListener = new ChangeListener(pid, pIChangeDispatcher);
    } else {
      pDB = new DataBase(driverJDBC);
      pDB.open(url, username, password);
      pSQLEngine.initDB(pDB);
    }
    return pSQLEngine;
  }
  
  public ISQLEngine getCurrentSQLEngine() {
    return pSQLEngine;
  }
  public String getSalomeVersion() {
    return "INVALID";
  }
  
  public IDataBase getInstanceOfDataBase(String driver) throws Exception{
    DataBase db =  new DataBase(driver);
    return (IDataBase)db;
  }
  
  public IDataBase getInstanceOfSalomeDataBase()throws Exception{    
    return (IDataBase) pDB;
  }
  
  public ISafeThread getChangeListener(String projet) {
    pChangeListener.setProjet(projet);
    return pChangeListener;
  }
  
  public void changeListenerProject(String projet){
    pChangeListener.setProjet(projet);
  }
  
  public ISQLSalomeLock getISQLSalomeLock(){
    return getInstanceOfISQLSalomeLock();
  }
  
  static  ISQLSalomeLock getInstanceOfISQLSalomeLock() {
    if (pSQLSalomeLock == null){
      pSQLSalomeLock = new SQLSalomeLock();
    }
    return pSQLSalomeLock;
  }
  
  public ISQLConfig getISQLConfig(){
    return getInstanceOfISQLConfig();
  }
  static  ISQLConfig getInstanceOfISQLConfig() {
    if (pSQLConfig == null){
      pSQLConfig = new SQLConfig();
    }
    return pSQLConfig;
  }
  
  public ISQLGroup getISQLGroup(){
    return getInstanceOfISQLGroup();
  }
  static  ISQLGroup getInstanceOfISQLGroup() {
    if (pSQLGroup == null){
      pSQLGroup = new SQLGroup();
    }
    return pSQLGroup;
  }
  
  public ISQLSession getISQLSession(){
    return getInstanceOfISQLSession();
  }
  static  ISQLSession getInstanceOfISQLSession() {
    if (pISQLSession == null){
      pISQLSession = new SQLSession();
    }
    return pISQLSession;
  }
  
  
  
  public ISQLDataset getISQLDataset(){
    return getInstanceOfISQLDataset();
  }
  static  ISQLDataset getInstanceOfISQLDataset() {
    if (pISQLDataset == null){
      pISQLDataset = new SQLDataset();
    }
    return pISQLDataset;
  }
  
  
  public ISQLExecutionActionResult getISQLExecutionActionResult() {
    return getInstanceOfISQLExecutionActionResult();
  }
  static  ISQLExecutionActionResult getInstanceOfISQLExecutionActionResult() {
    if (pISQLExecutionActionResult == null){
      pISQLExecutionActionResult = new SQLExecutionActionResult();
    }
    return pISQLExecutionActionResult;
  }
  
  
  public ISQLExecutionTestResult getISQLExecutionTestResult() {
    return getInstanceOfISQLExecutionTestResult();
  }
  static  ISQLExecutionTestResult getInstanceOfISQLExecutionTestResult() {
    if (pISQLExecutionTestResult == null){
      pISQLExecutionTestResult = new SQLExecutionTestResult();
    }
    return pISQLExecutionTestResult;
  }
  
  
  public ISQLExecutionResult getISQLExecutionResult() {
    return getInstanceOfISQLExecutionResult();
  }
  static ISQLExecutionResult getInstanceOfISQLExecutionResult() {
    if (pISQLExecutionResult == null){
      pISQLExecutionResult = new SQLExecutionResult();
    }
    return pISQLExecutionResult;
  }
  
  public ISQLExecution getISQLExecution() {
    return getInstanceOfISQLExecution();
  }
  static ISQLExecution getInstanceOfISQLExecution() {
    if (pISQLExecution == null){
      pISQLExecution = new SQLExecution();
    }
    return pISQLExecution;
  }
  
  public ISQLEnvironment getISQLEnvironment() {
    return getInstanceOfISQLEnvironment();
  }
  static ISQLEnvironment getInstanceOfISQLEnvironment() {
    if (pISQLEnvironment == null){
      pISQLEnvironment = new SQLEnvironment();
    }
    return pISQLEnvironment;
  }
  
  public ISQLProject getISQLProject() {
    return getInstanceOfISQLProject();
  }
  
  static ISQLProject getInstanceOfISQLProject() {
    if (pISQLProject == null){
      pISQLProject = new SQLProject();
    }
    return pISQLProject;
  }
  
  public ISQLTest getISQLTest() {
    return getInstanceOfISQLTest();
  }
  static ISQLTest getInstanceOfISQLTest() {
    if (pISQLTest == null){
      pISQLTest = new SQLTest();
    }
    return pISQLTest;
  }
  
  public ISQLFamily getISQLFamily() {
    return getInstanceOfISQLFamily();
  }
  static ISQLFamily getInstanceOfISQLFamily() {
    if (pISQLFamily == null){
      pISQLFamily = new SQLFamily();
    }
    return pISQLFamily;
  }
  
  public ISQLPersonne getISQLPersonne() {
    return getInstanceOfISQLPersonne();
  }
  static ISQLPersonne getInstanceOfISQLPersonne() {
    if (pISQLPersonne == null){
      pISQLPersonne = new SQLPersonne();
    }
    return pISQLPersonne;
  }
  
  public ISQLScript getISQLScript() {
    return getInstanceOfISQLScript();
  }
  static ISQLScript getInstanceOfISQLScript() {
    if (pISQLScript == null){
      pISQLScript = new SQLScript();
    }
    return pISQLScript;
  }
  
  public ISQLCampaign getISQLCampaign() {
    return getInstanceOfISQLCampaign();
  }
  static ISQLCampaign getInstanceOfISQLCampaign() {
    if (pISQLCampaign == null){
      pISQLCampaign = new SQLCampaign();
    }
    return pISQLCampaign;
  }
  
  public ISQLAutomaticTest getISQLAutomaticTest() {
    return getInstanceOfISQLAutomaticTest();
  }
  static ISQLAutomaticTest getInstanceOfISQLAutomaticTest() {
    if (pISQLAutomaticTest == null){
      pISQLAutomaticTest = new SQLAutomaticTest();
    }
    return pISQLAutomaticTest;
  }
  
  public ISQLTestList getISQLTestList() {
    return getInstanceOfISQLTestList();
  }
  static ISQLTestList getInstanceOfISQLTestList() {
    if (pISQLTestList == null){
      pISQLTestList = new SQLTestList();
    }
    return pISQLTestList;
  }
  
  public ISQLFileAttachment getISQLFileAttachment() {
    return getInstanceOfISQLFileAttachment();
  }
  static ISQLFileAttachment getInstanceOfISQLFileAttachment() {
    if (pISQLFileAttachment == null){
      pISQLFileAttachment = new SQLFileAttachment();
    }
    return pISQLFileAttachment;
  }
  
  public ISQLUrlAttachment getISQLUrlAttachment() {
    return getInstanceOfISQLUrlAttachment();
  }
  static ISQLUrlAttachment getInstanceOfISQLUrlAttachment() {
    if (pISQLUrlAttachment == null){
      pISQLUrlAttachment = new SQLUrlAttachment();
    }
    return pISQLUrlAttachment;
  }
  
  public ISQLAttachment getISQLAttachment() {
    return getInstanceOfISQLAttachment();
  }
  static ISQLAttachment getInstanceOfISQLAttachment() {
    if (pISQLAttachment == null){
      pISQLAttachment = new SQLAttachment();
    }
    return pISQLAttachment;
  }
  
  public ISQLParameter getISQLParameter() {
    return getInstanceOfISQLParameter();
  }
  static ISQLParameter getInstanceOfISQLParameter(){
    if (pISQLParameter == null){
      pISQLParameter = new SQLParameter();
    }
    return pISQLParameter;
  }
  
  public ISQLAction getISQLAction() {
    return getInstanceOfISQLAction();
  }
  static public ISQLAction getInstanceOfISQLAction() {
    if (pISQLAction == null) {
      pISQLAction = new SQLAction();
    }
    return pISQLAction;
  }
  
  public ISQLManualTest getISQLManualTest() {
    return getInstanceOfISQLManualTest();
  }
  static public ISQLManualTest getInstanceOfISQLManualTest() {
    if (pISQLManualTest == null){
      pISQLManualTest = new SQLManualTest();
    }
    return pISQLManualTest;
  }
  
  public void setConnexionInfo(int _projectID, int _personneID){
    projectID = _projectID;
    personneID = _personneID;
  }
  
  public int getProjectID(){
    return projectID;
  }
  
  public int getPersonneID(){
    return personneID;
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.