Salome HOME
Build SALOME on win32 platform.
[modules/kernel.git] / src / Launcher / SALOME_Launcher.cxx
index be953f9017fa783001e990061cbd0735499a4282..afca47cd499eb7d734d6a9007b1ae5055e43737c 100644 (file)
@@ -1,23 +1,23 @@
-//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  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.1 of the License.
+// 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.1 of the License.
 //
-//  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.
+// 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
+// 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
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "SALOME_Launcher.hxx"
@@ -276,6 +276,23 @@ SALOME_Launcher::removeJob(CORBA::Long job_id)
   }
 }
 
+void 
+SALOME_Launcher::stopJob(CORBA::Long job_id)
+{
+  try
+  {
+    _l.stopJob(job_id);
+    std::ostringstream job_id_str;
+    job_id_str << job_id;
+    notifyObservers("UPDATE_JOB_STATE", job_id_str.str());
+  }
+  catch(const LauncherException &ex)
+  {
+    INFOS(ex.msg.c_str());
+    THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::BAD_PARAM);
+  }
+}
+
 //=============================================================================
 /*! CORBA Method:
  *  Create a job in the launcher with a file
@@ -859,7 +876,6 @@ SALOME_Launcher::loadJobs(const char* jobs_file)
           try
           {
             _l.createJob(new_job);
-
             std::ostringstream job_id;
             job_id << new_job->getNumber();
             notifyObservers("NEW_JOB", job_id.str());
@@ -876,15 +892,7 @@ SALOME_Launcher::loadJobs(const char* jobs_file)
         {
           try
           {
-            // Step 1: Add the resource to the launcher C++ map
-            _l.checkFactoryForResource(resource_choosed_name);
-
-            // Step 2: We add run_part informations
             new_job->setState(job_state);
-
-            // Step 3: We add the job to the launcher
-            ParserResourcesType resource_definition = _l._ResManager->GetResourcesDescr(resource_choosed_name);
-            new_job->setResourceDefinition(resource_definition);
             _l.addJobDirectlyToMap(new_job, job_reference);
 
             // Step 4: We check that the BatchManager could resume
@@ -912,17 +920,9 @@ SALOME_Launcher::loadJobs(const char* jobs_file)
         {
           try
           {
-            // Step 1: Add the resource to the launcher C++ map
-            _l.checkFactoryForResource(resource_choosed_name);
-
             // Step 2: We add run_part informations
             new_job->setState(job_state);
-
-            // Step 3: We add the job to the launcher
-            ParserResourcesType resource_definition = _l._ResManager->GetResourcesDescr(resource_choosed_name);
-            new_job->setResourceDefinition(resource_definition);
             _l.addJobDirectlyToMap(new_job, job_reference);
-
             std::ostringstream job_id;
             job_id << new_job->getNumber();
             notifyObservers("NEW_JOB", job_id.str());