Salome HOME
updated copyright message
[modules/kernel.git] / src / Launcher / SALOME_Launcher.cxx
index a0eb7e5f6f3d1c0d74dc3d29cb7e6c0575497e45..5f19212fe0b88a05b710e2a01369bafff5df8c3f 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -6,7 +6,7 @@
 // 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.
+// version 2.1 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
 #include "BatchTest.hxx"
 #include "OpUtil.hxx"
 #include "SALOME_ContainerManager.hxx"
+#include "SALOME_NamingService.hxx"
+#include "SALOME_ResourcesManager.hxx"
 #include "Utils_CorbaException.hxx"
 
 
 #include "Launcher_Job_Command.hxx"
 #include "Launcher_Job_YACSFile.hxx"
 #include "Launcher_Job_PythonSALOME.hxx"
+#include "Launcher_Job_CommandSALOME.hxx"
+
+#include "utilities.h"
 
 #ifdef WIN32
 # include <process.h>
 #endif
 #include <sys/types.h>
 #include <vector>
+#include <list>
 
-#include <libxml/parser.h>
 #include <stdio.h>
 #include <sstream>
 
+using namespace std;
+
 const char *SALOME_Launcher::_LauncherNameInNS = "/SalomeLauncher";
 
 //=============================================================================
-/*! 
+/*!
  *  Constructor
  *  \param orb
  */
 //=============================================================================
-SALOME_Launcher::SALOME_Launcher(CORBA::ORB_ptr orb, PortableServer::POA_var poa) : _l()
+SALOME_Launcher::SALOME_Launcher(CORBA::ORB_ptr orb, PortableServer::POA_var poa)
 {
   MESSAGE("SALOME_Launcher constructor");
   _NS = new SALOME_NamingService(orb);
+  init(orb,poa);
+  MESSAGE("SALOME_Launcher constructor end");
+}
+
+SALOME_Launcher::SALOME_Launcher(CORBA::ORB_ptr orb, PortableServer::POA_var poa, SALOME_NamingService_Abstract *externalNS):_NS(externalNS)
+{
+  init(orb,poa);
+}
+
+void SALOME_Launcher::init(CORBA::ORB_ptr orb, PortableServer::POA_var poa)
+{
   _ResManager = new SALOME_ResourcesManager(orb,poa,_NS);
   _l.SetResourcesManager(_ResManager->GetImpl());
-  _ContManager = new SALOME_ContainerManager(orb,poa,_ResManager,_NS);
+  _ContManager = new SALOME_ContainerManager(orb,poa,_NS);
   _ResManager->_remove_ref();
   _ContManager->_remove_ref();
 
@@ -66,13 +84,11 @@ SALOME_Launcher::SALOME_Launcher(CORBA::ORB_ptr orb, PortableServer::POA_var poa
   PortableServer::ObjectId_var id = _poa->activate_object(this);
   CORBA::Object_var obj = _poa->id_to_reference(id);
   Engines::SalomeLauncher_var refContMan = Engines::SalomeLauncher::_narrow(obj);
-
   _NS->Register(refContMan,_LauncherNameInNS);
-  MESSAGE("SALOME_Launcher constructor end");
 }
 
 //=============================================================================
-/*! 
+/*!
  * destructor
  */
 //=============================================================================
@@ -84,136 +100,79 @@ SALOME_Launcher::~SALOME_Launcher()
 }
 
 
-CORBA::Long 
+CORBA::Long
 SALOME_Launcher::createJob(const Engines::JobParameters & job_parameters)
 {
-  std::string job_type = job_parameters.job_type.in();
-
-  if (job_type != "command" && job_type != "yacs_file" && job_type != "python_salome")
-  {
-    std::string message("SALOME_Launcher::createJob: bad job type: ");
-    message += job_type;
-    THROW_SALOME_CORBA_EXCEPTION(message.c_str(), SALOME::INTERNAL_ERROR);
-  }
-
-  Launcher::Job * new_job; // It is Launcher_cpp that is going to destroy it
-
-  if (job_type == "command")
-    new_job = new Launcher::Job_Command();
-  else if (job_type == "yacs_file")
-    new_job = new Launcher::Job_YACSFile();
-  else if (job_type == "python_salome")
-    new_job = new Launcher::Job_PythonSALOME();
-
-  // Name
-  new_job->setJobName(job_parameters.job_name.in());
-
-  // Directories
-  std::string work_directory = job_parameters.work_directory.in();
-  std::string local_directory = job_parameters.local_directory.in();
-  std::string result_directory = job_parameters.result_directory.in();
-  new_job->setWorkDirectory(work_directory);
-  new_job->setLocalDirectory(local_directory);
-  new_job->setResultDirectory(result_directory);
-
-  // Parameters for COORM
-  std::string launcher_file = job_parameters.launcher_file.in();
-  std::string launcher_args = job_parameters.launcher_args.in();
-  new_job->setLauncherFile(launcher_file);
-  new_job->setLauncherArgs(launcher_args);
-
-  // Job File
-  std::string job_file = job_parameters.job_file.in();
+  JobParameters_cpp cpp_parameters = JobParameters_CORBA2CPP(job_parameters);
+  CORBA::Long jobNumber = -1;
   try
   {
-    new_job->setJobFile(job_file);
+    jobNumber = _l.createJob(cpp_parameters);
+    std::ostringstream job_id;
+    job_id << jobNumber;
+    notifyObservers("NEW_JOB", job_id.str());
   }
   catch(const LauncherException &ex)
   {
     INFOS(ex.msg.c_str());
-    THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::INTERNAL_ERROR);
+    THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::BAD_PARAM);
   }
+  return jobNumber;
+}
 
-  // Files
-  std::string env_file = job_parameters.env_file.in();
-  new_job->setEnvFile(env_file);
-  for (CORBA::ULong i = 0; i < job_parameters.in_files.length(); i++)
-    new_job->add_in_file(job_parameters.in_files[i].in());
-  for (CORBA::ULong i = 0; i < job_parameters.out_files.length(); i++)
-    new_job->add_out_file(job_parameters.out_files[i].in());
-
-  // Expected During Time
+void
+SALOME_Launcher::launchJob(CORBA::Long job_id)
+{
   try
   {
-    std::string maximum_duration = job_parameters.maximum_duration.in();
-    new_job->setMaximumDuration(maximum_duration);
-  }
-  catch(const LauncherException &ex){
-    INFOS(ex.msg.c_str());
-    THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::INTERNAL_ERROR);
+    _l.launchJob(job_id);
   }
-
-  // Queue
-  std::string queue = job_parameters.queue.in();
-  new_job->setQueue(queue);
-
-  // Exclusive
-  new_job->setExclusive(job_parameters.exclusive);
-
-  // Resources requirements
-  try
+  catch(const LauncherException &ex)
   {
-    resourceParams p;
-    p.name = job_parameters.resource_required.name;
-    p.hostname = job_parameters.resource_required.hostname;
-    p.OS = job_parameters.resource_required.OS;
-    p.nb_proc = job_parameters.resource_required.nb_proc;
-    p.nb_node = job_parameters.resource_required.nb_node;
-    p.nb_proc_per_node = job_parameters.resource_required.nb_proc_per_node;
-    p.cpu_clock = job_parameters.resource_required.cpu_clock;
-    p.mem_mb = job_parameters.resource_required.mem_mb;
-    new_job->setResourceRequiredParams(p);
-  }
-  catch(const LauncherException &ex){
     INFOS(ex.msg.c_str());
-    THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::INTERNAL_ERROR);
+    THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::BAD_PARAM);
   }
+}
 
-  // Adding specific parameters to the job
-  for (CORBA::ULong i = 0; i < job_parameters.specific_parameters.length(); i++)
-    new_job->addSpecificParameter(job_parameters.specific_parameters[i].name.in(),
-                                  job_parameters.specific_parameters[i].value.in());
+char *
+SALOME_Launcher::getJobState(CORBA::Long job_id)
+{
+  std::string result;
   try
   {
-    new_job->checkSpecificParameters();
+    result = _l.getJobState(job_id);
   }
   catch(const LauncherException &ex)
   {
     INFOS(ex.msg.c_str());
-    THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::INTERNAL_ERROR);
+    THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::BAD_PARAM);
   }
+  return CORBA::string_dup(result.c_str());
+}
 
+// Get names or ids of hosts assigned to the job
+char *
+SALOME_Launcher::getAssignedHostnames(CORBA::Long job_id)
+{
+  std::string result;
   try
   {
-    _l.createJob(new_job);
-    std::ostringstream job_id;
-    job_id << new_job->getNumber();
-    notifyObservers("NEW_JOB", job_id.str());
+    result = _l.getAssignedHostnames(job_id);
   }
   catch(const LauncherException &ex)
   {
     INFOS(ex.msg.c_str());
     THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::BAD_PARAM);
   }
-  return new_job->getNumber();
+  return CORBA::string_dup(result.c_str());
 }
 
-void 
-SALOME_Launcher::launchJob(CORBA::Long job_id)
+void
+SALOME_Launcher::exportInputFiles(CORBA::Long job_id)
 {
   try
   {
-    _l.launchJob(job_id);
+    _l.exportInputFiles(job_id);
   }
   catch(const LauncherException &ex)
   {
@@ -222,60 +181,57 @@ SALOME_Launcher::launchJob(CORBA::Long job_id)
   }
 }
 
-char *
-SALOME_Launcher::getJobState(CORBA::Long job_id)
+void
+SALOME_Launcher::getJobResults(CORBA::Long job_id, const char * directory)
 {
-  std::string result;
   try
   {
-    result = _l.getJobState(job_id);
+    _l.getJobResults(job_id, directory);
   }
   catch(const LauncherException &ex)
   {
     INFOS(ex.msg.c_str());
     THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::BAD_PARAM);
   }
-  return CORBA::string_dup(result.c_str());
 }
 
-// Get names or ids of hosts assigned to the job
-char *
-SALOME_Launcher::getAssignedHostnames(CORBA::Long job_id)
+void
+SALOME_Launcher::clearJobWorkingDir(CORBA::Long job_id)
 {
-  std::string result;
   try
   {
-    result = _l.getAssignedHostnames(job_id);
+    _l.clearJobWorkingDir(job_id);
   }
   catch(const LauncherException &ex)
   {
     INFOS(ex.msg.c_str());
     THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::BAD_PARAM);
   }
-  return CORBA::string_dup(result.c_str());
 }
 
-void
-SALOME_Launcher::getJobResults(CORBA::Long job_id, const char * directory)
+CORBA::Boolean
+SALOME_Launcher::getJobDumpState(CORBA::Long job_id, const char * directory)
 {
+  CORBA::Boolean rtn = false;
   try
   {
-    _l.getJobResults(job_id, directory);
+    rtn = _l.getJobDumpState(job_id, directory);
   }
   catch(const LauncherException &ex)
   {
     INFOS(ex.msg.c_str());
     THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::BAD_PARAM);
   }
+  return rtn;
 }
 
 CORBA::Boolean
-SALOME_Launcher::getJobDumpState(CORBA::Long job_id, const char * directory)
+SALOME_Launcher::getJobWorkFile(CORBA::Long job_id, const char * work_file, const char * directory)
 {
   CORBA::Boolean rtn = false;
   try
   {
-    rtn = _l.getJobDumpState(job_id, directory);
+    rtn = _l.getJobWorkFile(job_id, work_file, directory);
   }
   catch(const LauncherException &ex)
   {
@@ -285,7 +241,12 @@ SALOME_Launcher::getJobDumpState(CORBA::Long job_id, const char * directory)
   return rtn;
 }
 
-void 
+void SALOME_Launcher::DeclareUsingSalomeSession()
+{
+  this->_ContManager->DeclareUsingSalomeSession();
+}
+
+void
 SALOME_Launcher::removeJob(CORBA::Long job_id)
 {
   try
@@ -302,7 +263,7 @@ SALOME_Launcher::removeJob(CORBA::Long job_id)
   }
 }
 
-void 
+void
 SALOME_Launcher::stopJob(CORBA::Long job_id)
 {
   try
@@ -319,14 +280,51 @@ SALOME_Launcher::stopJob(CORBA::Long job_id)
   }
 }
 
+char *
+SALOME_Launcher::dumpJob(CORBA::Long job_id)
+{
+  std::string result;
+  try
+  {
+    result = _l.dumpJob(job_id);
+  }
+  catch(const LauncherException &ex)
+  {
+    INFOS(ex.msg.c_str());
+    THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::BAD_PARAM);
+  }
+  return CORBA::string_dup(result.c_str());
+}
+
+CORBA::Long
+SALOME_Launcher::restoreJob(const char * dumpedJob)
+{
+  CORBA::Long jobId;
+  try{
+    jobId = _l.restoreJob(dumpedJob);
+    if(jobId >= 0)
+    {
+      std::ostringstream job_str;
+      job_str << jobId;
+      notifyObservers("NEW_JOB", job_str.str());
+    }
+  }
+  catch(const LauncherException &ex){
+    INFOS(ex.msg.c_str());
+    THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::INTERNAL_ERROR);
+  }
+
+  return jobId;
+}
+
 //=============================================================================
 /*! CORBA Method:
  *  Create a job in the launcher with a file
  *  \param xmlExecuteFile     : .xml to parse that contains job description
- *  \param clusterName        : machine choosed
+ *  \param clusterName        : machine chosen
  */
 //=============================================================================
-CORBA::Long 
+CORBA::Long
 SALOME_Launcher::createJobWithFile(const char * xmlExecuteFile,
                                    const char * clusterName)
 {
@@ -344,11 +342,11 @@ SALOME_Launcher::createJobWithFile(const char * xmlExecuteFile,
 
 //=============================================================================
 /*! CORBA Method:
- *  the test batch configuration 
+ *  the test batch configuration
  *  \param params             : The batch cluster
  */
 //=============================================================================
-CORBA::Boolean 
+CORBA::Boolean
 SALOME_Launcher::testBatch(const Engines::ResourceParameters& params)
 {
   MESSAGE("BEGIN OF SALOME_Launcher::testBatch");
@@ -367,9 +365,9 @@ SALOME_Launcher::testBatch(const Engines::ResourceParameters& params)
     const Engines::ResourceDefinition* p = _ResManager->GetResourceDefinition((*aMachineList)[0]);
         std::string resource_name(p->name);
     INFOS("Choose resource for test: " <<  resource_name);
-    
+
     BatchTest t(*p);
-    if (t.test()) 
+    if (t.test())
     {
       rtn = true;
     }
@@ -389,6 +387,8 @@ SALOME_Launcher::testBatch(const Engines::ResourceParameters& params)
 void SALOME_Launcher::Shutdown()
 {
   MESSAGE("Shutdown");
+  if(!_NS)
+    return;
   _NS->Destroy_Name(_LauncherNameInNS);
   _ContManager->Shutdown();
   _ResManager->Shutdown();
@@ -405,7 +405,7 @@ void SALOME_Launcher::Shutdown()
 //=============================================================================
 CORBA::Long SALOME_Launcher::getPID()
 {
-  return 
+  return
 #ifndef WIN32
     (CORBA::Long)getpid();
 #else
@@ -454,73 +454,16 @@ SALOME_Launcher::getJobsList()
 Engines::JobParameters *
 SALOME_Launcher::getJobParameters(CORBA::Long job_id)
 {
-  std::map<int, Launcher::Job *> cpp_jobs = _l.getJobs();
-  std::map<int, Launcher::Job *>::const_iterator it_job = cpp_jobs.find(job_id);
-  if (it_job == cpp_jobs.end())
-  {
-    INFOS("Cannot find the job, is it created ? job number: " << job_id);
-    THROW_SALOME_CORBA_EXCEPTION("Job does not exist", SALOME::INTERNAL_ERROR);
-  }
-
-  Launcher::Job * job = it_job->second;
-  Engines::JobParameters_var job_parameters = new Engines::JobParameters;
-  job_parameters->job_name         = CORBA::string_dup(job->getJobName().c_str());
-  job_parameters->job_type         = CORBA::string_dup(job->getJobType().c_str());
-  job_parameters->job_file         = CORBA::string_dup(job->getJobFile().c_str());
-  job_parameters->env_file         = CORBA::string_dup(job->getEnvFile().c_str());
-  job_parameters->work_directory   = CORBA::string_dup(job->getWorkDirectory().c_str());
-  job_parameters->local_directory  = CORBA::string_dup(job->getLocalDirectory().c_str());
-  job_parameters->result_directory = CORBA::string_dup(job->getResultDirectory().c_str());
-
-  // Parameters for COORM
-  job_parameters->launcher_file = CORBA::string_dup(job->getLauncherFile().c_str());
-  job_parameters->launcher_args = CORBA::string_dup(job->getLauncherArgs().c_str());
-
-  int i = 0;
-  int j = 0;
-  std::list<std::string> in_files  = job->get_in_files();
-  std::list<std::string> out_files = job->get_out_files();
-  job_parameters->in_files.length(in_files.size());
-  for(std::list<std::string>::iterator it = in_files.begin(); it != in_files.end(); it++)
-  {
-    job_parameters->in_files[i] = CORBA::string_dup((*it).c_str());
-    i++;
-  }
-  job_parameters->out_files.length(out_files.size());
-  for(std::list<std::string>::iterator it = out_files.begin(); it != out_files.end(); it++)
+  Engines::JobParameters_var job_parameters;
+  try
   {
-    job_parameters->out_files[j] = CORBA::string_dup((*it).c_str());
-    j++;
+    JobParameters_cpp cpp_parameters = _l.getJobParameters(job_id);
+    job_parameters = JobParameters_CPP2CORBA(cpp_parameters);
   }
-
-  job_parameters->maximum_duration = CORBA::string_dup(job->getMaximumDuration().c_str());
-  job_parameters->queue            = CORBA::string_dup(job->getQueue().c_str());
-  job_parameters->exclusive        = job->getExclusive();
-
-  resourceParams resource_params = job->getResourceRequiredParams();
-  job_parameters->resource_required.name             = CORBA::string_dup(resource_params.name.c_str());
-  job_parameters->resource_required.hostname         = CORBA::string_dup(resource_params.hostname.c_str());
-  job_parameters->resource_required.OS               = CORBA::string_dup(resource_params.OS.c_str());
-  job_parameters->resource_required.nb_proc          = resource_params.nb_proc;
-  job_parameters->resource_required.nb_node          = resource_params.nb_node;
-  job_parameters->resource_required.nb_proc_per_node = resource_params.nb_proc_per_node;
-  job_parameters->resource_required.cpu_clock        = resource_params.cpu_clock;
-  job_parameters->resource_required.mem_mb           = resource_params.mem_mb;
-
-  std::map<std::string, std::string> specific_parameters = job->getSpecificParameters();
-  if (!specific_parameters.empty())
+  catch(const LauncherException &ex)
   {
-    job_parameters->specific_parameters.length(specific_parameters.size());
-    std::map<std::string, std::string>::const_iterator it_specific;
-    CORBA::ULong i = 0;
-    for (it_specific = specific_parameters.begin() ; it_specific != specific_parameters.end(); it_specific++)
-    {
-      Engines::Parameter_var new_param = new Engines::Parameter;
-      new_param->name  = CORBA::string_dup((it_specific->first).c_str());
-      new_param->value = CORBA::string_dup((it_specific->second).c_str());
-      job_parameters->specific_parameters[i] = new_param;
-      i++;
-    }
+    INFOS(ex.msg.c_str());
+    THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::BAD_PARAM);
   }
 
   return job_parameters._retn();
@@ -534,508 +477,26 @@ SALOME_Launcher::getJobParameters(CORBA::Long job_id)
 void
 SALOME_Launcher::loadJobs(const char* jobs_file)
 {
-  // Step 1: check jobs_file read access
-  FILE* xml_file = fopen(jobs_file, "r");
-  if (xml_file == NULL)
+  list<int> new_jobs_id_list;
+  try
   {
-    std::string error = "Error opening jobs_file in SALOME_Launcher::loadJobs: " + std::string(jobs_file);
-    INFOS(error);
-    THROW_SALOME_CORBA_EXCEPTION(error.c_str(), SALOME::INTERNAL_ERROR);
+    // Load the jobs in Launcher
+    new_jobs_id_list = _l.loadJobs(jobs_file);
   }
-
-  // Step 2: read xml file
-  xmlDocPtr doc = xmlReadFile(jobs_file, NULL, 0);
-  if (doc == NULL)
+  catch (const LauncherException & ex)
   {
-    std::string error = "Error in xmlReadFile in SALOME_Launcher::loadJobs, could not parse file: " + std::string(jobs_file);
-    INFOS(error);
-    fclose(xml_file);
-    THROW_SALOME_CORBA_EXCEPTION(error.c_str(), SALOME::INTERNAL_ERROR);
+    INFOS(ex.msg.c_str());
+    THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(), SALOME::INTERNAL_ERROR);
   }
 
-  // Step 3: Find jobs
-  xmlNodePtr root_node = xmlDocGetRootElement(doc);
-  xmlNodePtr xmlCurrentNode = root_node->xmlChildrenNode;
-  if (!xmlStrcmp(root_node->name, xmlCharStrdup("jobs")))
+  // Notify observers of the new jobs
+  list<int>::const_iterator it_jobs_id;
+  for (it_jobs_id = new_jobs_id_list.begin(); it_jobs_id != new_jobs_id_list.end(); it_jobs_id++)
   {
-    while(xmlCurrentNode != NULL)
-    {
-      if (!xmlStrcmp(xmlCurrentNode->name, xmlCharStrdup("job")))
-      {
-        INFOS("A job is found");
-        Launcher::Job * new_job; // It is Launcher_cpp that is going to destroy it
-        xmlNodePtr job_node = xmlCurrentNode;
-
-        // Begin Job
-        if (!xmlHasProp(job_node, xmlCharStrdup("type"))  ||
-            !xmlHasProp(job_node, xmlCharStrdup("name")))
-        {
-          INFOS("A bad job is found, type or name not found");
-          break;
-        }
-        xmlChar* type = xmlGetProp(job_node, xmlCharStrdup("type"));
-        xmlChar* name = xmlGetProp(job_node, xmlCharStrdup("name"));
-        std::string job_type((const char*) type);
-        if (job_type == "command")
-          new_job = new Launcher::Job_Command();
-        else if (job_type == "yacs_file")
-          new_job = new Launcher::Job_YACSFile();
-        else if (job_type == "python_salome")
-          new_job = new Launcher::Job_PythonSALOME();
-        new_job->setJobName(std::string((const char *)name));
-        xmlFree(type);
-        xmlFree(name);
-
-        xmlNodePtr user_node = xmlFirstElementChild(job_node);
-        xmlNodePtr run_node = xmlNextElementSibling(user_node);
-        if (user_node == NULL || run_node == NULL)
-        {
-          INFOS("A bad job is found, user_part or run_part not found");
-          delete new_job;
-          break;
-        }
-        if (xmlStrcmp(user_node->name, xmlCharStrdup("user_part")) ||
-            xmlStrcmp(run_node->name, xmlCharStrdup("run_part")))
-        {
-          INFOS("A bad job is found, cannot get a correct user_part or run_part node");
-          delete new_job;
-          break;
-        }
-
-        // Add user part
-
-        // Get job_file env_file work_directory local_directory result_directory
-        xmlNodePtr job_file_node         = xmlFirstElementChild(user_node);
-        xmlNodePtr env_file_node         = xmlNextElementSibling(job_file_node);
-        xmlNodePtr work_directory_node   = xmlNextElementSibling(env_file_node);
-        xmlNodePtr local_directory_node  = xmlNextElementSibling(work_directory_node);
-        xmlNodePtr result_directory_node = xmlNextElementSibling(local_directory_node);
-
-               // Parameters for COORM
-        xmlNodePtr launcher_file_node = xmlNextElementSibling(result_directory_node);
-
-        if (job_file_node         == NULL ||
-            env_file_node         == NULL ||
-            work_directory_node   == NULL ||
-            local_directory_node  == NULL ||
-            result_directory_node == NULL ||
-                       // For COORM
-            launcher_file_node    == NULL
-           )
-        {
-          INFOS("A bad job is found, some user_part are not found");
-          delete new_job;
-          break;
-        }
-        if (xmlStrcmp(job_file_node->name,         xmlCharStrdup("job_file"))         ||
-            xmlStrcmp(env_file_node->name,         xmlCharStrdup("env_file"))         ||
-            xmlStrcmp(work_directory_node->name,   xmlCharStrdup("work_directory"))   ||
-            xmlStrcmp(local_directory_node->name,  xmlCharStrdup("local_directory"))  ||
-            xmlStrcmp(result_directory_node->name, xmlCharStrdup("result_directory")) ||
-                       // For COORM
-            xmlStrcmp(launcher_file_node->name, xmlCharStrdup("launcher_file"))
-           )
-        {
-          INFOS("A bad job is found, some user part node are not in the rigth or does not have a correct name");
-          delete new_job;
-          break;
-        }
-        xmlChar* job_file         = xmlNodeGetContent(job_file_node);
-        try
-        {
-          new_job->setJobFile(std::string((const char *)job_file));
-        }
-        catch(const LauncherException &ex)
-        {
-          INFOS("Exception receice for job_file, cannot add the job" << ex.msg.c_str());
-          delete new_job;
-          xmlFree(job_file);
-          break;
-        }
-        xmlChar* env_file         = xmlNodeGetContent(env_file_node);
-        xmlChar* work_directory   = xmlNodeGetContent(work_directory_node);
-        xmlChar* local_directory  = xmlNodeGetContent(local_directory_node);
-        xmlChar* result_directory = xmlNodeGetContent(result_directory_node);
-
-               // Parameters for COORM
-        xmlChar* launcher_file = xmlNodeGetContent(launcher_file_node);
-
-        new_job->setEnvFile(std::string((const char *)env_file));
-        new_job->setWorkDirectory(std::string((const char *)work_directory));
-        new_job->setLocalDirectory(std::string((const char *)local_directory));
-        new_job->setResultDirectory(std::string((const char *)result_directory));
-
-               // Parameters for COORM
-        new_job->setLauncherFile(std::string((const char *)launcher_file));
-
-        xmlFree(job_file);
-        xmlFree(env_file);
-        xmlFree(work_directory);
-        xmlFree(local_directory);
-        xmlFree(result_directory);
-
-               // Parameters for COORM
-               xmlFree(launcher_file);
-
-        // Get in and out files
-        xmlNodePtr files_node = xmlNextElementSibling(launcher_file_node);
-        if (files_node == NULL)
-        {
-          INFOS("A bad job is found, user_part files is not found");
-          delete new_job;
-          break;
-        }
-        if (xmlStrcmp(files_node->name, xmlCharStrdup("files")))
-        {
-          INFOS("A bad job is found, files node are not in the rigth place or does not have a correct name or does not exist");
-          delete new_job;
-          break;
-        }
-        xmlNodePtr file_node = xmlFirstElementChild(files_node);
-        while (file_node != NULL)
-        {
-          if (!xmlStrcmp(file_node->name, xmlCharStrdup("in_file")))
-          {
-            xmlChar* in_file = xmlNodeGetContent(file_node);
-            new_job->add_in_file(std::string((const char *)in_file));
-            xmlFree(in_file);
-          }
-          else if (!xmlStrcmp(file_node->name, xmlCharStrdup("out_file")))
-          {
-            xmlChar* out_file = xmlNodeGetContent(file_node);
-            new_job->add_out_file(std::string((const char *)out_file));
-            xmlFree(out_file);
-          }
-          file_node = xmlNextElementSibling(file_node);
-        }
-
-        // Get resource part
-        xmlNodePtr res_node = xmlNextElementSibling(files_node);
-        xmlNodePtr maximum_duration_node = xmlNextElementSibling(res_node);
-        xmlNodePtr queue_node = xmlNextElementSibling(maximum_duration_node);
-        xmlNodePtr exclusive_node = xmlNextElementSibling(queue_node);
-        xmlNodePtr launcher_args_node = xmlNextElementSibling(exclusive_node);
-        if (res_node              == NULL ||
-            maximum_duration_node == NULL ||
-            queue_node            == NULL ||
-            exclusive_node        == NULL ||
-                       // For COORM
-            launcher_args_node    == NULL
-           )
-        {
-          INFOS("A bad job is found, some user_part are not found");
-          delete new_job;
-          break;
-        }
-        if (xmlStrcmp(res_node->name,              xmlCharStrdup("resource_params"))  ||
-            xmlStrcmp(maximum_duration_node->name, xmlCharStrdup("maximum_duration")) ||
-            xmlStrcmp(queue_node->name,            xmlCharStrdup("queue")) ||
-            xmlStrcmp(exclusive_node->name,        xmlCharStrdup("exclusive")) ||
-                       // For COORM
-            xmlStrcmp(launcher_args_node->name,    xmlCharStrdup("launcher_args"))
-           )
-        {
-          INFOS("A bad job is found, some user part node are not in the rigth or does not have a correct name");
-          delete new_job;
-          break;
-        }
-        xmlChar* maximum_duration = xmlNodeGetContent(maximum_duration_node);
-        try
-        {
-          new_job->setMaximumDuration(std::string((const char *)maximum_duration));
-        }
-        catch(const LauncherException &ex)
-        {
-          INFOS("Exception receice for maximum_duration, cannot add the job" << ex.msg.c_str());
-          delete new_job;
-          xmlFree(maximum_duration);
-          break;
-        }
-        xmlChar* queue            = xmlNodeGetContent(queue_node);
-        new_job->setQueue(std::string((const char *)queue));
-        xmlFree(maximum_duration);
-        xmlFree(queue);
-
-        xmlChar* exclusive = xmlNodeGetContent(exclusive_node);
-        try
-        {
-          new_job->setExclusiveStr(std::string((const char *)exclusive));
-        }
-        catch(const LauncherException &ex)
-        {
-          INFOS("Exception received for exclusive, cannot add the job. " << ex.msg.c_str());
-          delete new_job;
-          xmlFree(exclusive);
-          break;
-        }
-        xmlFree(exclusive);
-
-               // For COORM
-        xmlChar* launcher_args           = xmlNodeGetContent(launcher_args_node);
-        new_job->setLauncherArgs(std::string((const char *)launcher_args));
-        xmlFree(launcher_args);
-
-        xmlNodePtr specific_node = xmlNextElementSibling(launcher_args_node);
-        if (specific_node == NULL)
-        {
-          INFOS("A bad job is found, specific_parameters part is not found");
-          delete new_job;
-          break;
-        }
-        xmlNodePtr parameter_node = xmlFirstElementChild(specific_node);
-        while (parameter_node != NULL)
-        {
-          if (!xmlStrcmp(parameter_node->name, xmlCharStrdup("specific_parameter")))
-          {
-            xmlNodePtr name_node = xmlFirstElementChild(parameter_node);
-            xmlNodePtr value_node = xmlNextElementSibling(name_node);
-            if (name_node == NULL ||
-                value_node == NULL)
-            {
-              INFOS("A bad job is found, specific_parameter parts are not found");
-              delete new_job;
-              break;
-            }
-            if (xmlStrcmp(name_node->name, xmlCharStrdup("name")) ||
-                xmlStrcmp(value_node->name, xmlCharStrdup("value")))
-            {
-              INFOS("A bad job is found, specific_parameter bad parts are found");
-              delete new_job;
-              break;
-            }
-
-            xmlChar* name  = xmlNodeGetContent(name_node);
-            xmlChar* value = xmlNodeGetContent(value_node);
-            try
-            {
-              new_job->addSpecificParameter(std::string((const char*)name), std::string((const char*)value));
-              xmlFree(name);
-              xmlFree(value);
-            }
-            catch(const LauncherException &ex)
-            {
-              INFOS("Exception receice for a specific parameter, cannot add the job" << ex.msg.c_str());
-              delete new_job;
-              xmlFree(name);
-              xmlFree(value);
-              break;
-            }
-          }
-          else
-          {
-            INFOS("A bad job is found, specific_parameters part is bad, a node that is not a specific parameter is found");
-            delete new_job;
-            break;
-          }
-          parameter_node = xmlNextElementSibling(parameter_node);
-        }
-
-        xmlNodePtr res_name_node             = xmlFirstElementChild(res_node);
-        xmlNodePtr res_hostname_node         = xmlNextElementSibling(res_name_node);
-        xmlNodePtr res_os_node               = xmlNextElementSibling(res_hostname_node);
-        xmlNodePtr res_nb_proc_node          = xmlNextElementSibling(res_os_node);
-        xmlNodePtr res_nb_node_node          = xmlNextElementSibling(res_nb_proc_node);
-        xmlNodePtr res_nb_proc_per_node_node = xmlNextElementSibling(res_nb_node_node);
-        xmlNodePtr res_cpu_clock_node        = xmlNextElementSibling(res_nb_proc_per_node_node);
-        xmlNodePtr res_mem_mb_node           = xmlNextElementSibling(res_cpu_clock_node);
-        if (res_name_node             == NULL ||
-            res_hostname_node         == NULL ||
-            res_os_node               == NULL ||
-            res_nb_proc_node          == NULL ||
-            res_nb_node_node          == NULL ||
-            res_nb_proc_per_node_node == NULL ||
-            res_cpu_clock_node        == NULL ||
-            res_mem_mb_node           == NULL
-           )
-        {
-          INFOS("A bad job is found, some resource_params user_part are not found");
-          delete new_job;
-          break;
-        }
-        if (xmlStrcmp(res_name_node->name,             xmlCharStrdup("name"))             ||
-            xmlStrcmp(res_hostname_node->name,         xmlCharStrdup("hostname"))         ||
-            xmlStrcmp(res_os_node->name,               xmlCharStrdup("OS"))               ||
-            xmlStrcmp(res_nb_proc_node->name,          xmlCharStrdup("nb_proc"))          ||
-            xmlStrcmp(res_nb_node_node->name,          xmlCharStrdup("nb_node"))          ||
-            xmlStrcmp(res_nb_proc_per_node_node->name, xmlCharStrdup("nb_proc_per_node")) ||
-            xmlStrcmp(res_cpu_clock_node->name,        xmlCharStrdup("cpu_clock"))        ||
-            xmlStrcmp(res_mem_mb_node->name,           xmlCharStrdup("mem_mb"))
-           )
-        {
-          INFOS("A bad job is found, some resource_params user_part node are not in the rigth or does not have a correct name");
-          delete new_job;
-          break;
-        }
-        xmlChar* res_name     = xmlNodeGetContent(res_name_node);
-        xmlChar* res_hostname = xmlNodeGetContent(res_hostname_node);
-        xmlChar* res_os       = xmlNodeGetContent(res_os_node);
-        resourceParams p;
-        p.name     = std::string((const char*) res_name);
-        p.hostname = std::string((const char*) res_hostname);
-        p.OS       = std::string((const char*) res_os);
-        xmlFree(res_name);
-        xmlFree(res_hostname);
-        xmlFree(res_os);
-        xmlChar* res_nb_proc          = xmlNodeGetContent(res_nb_proc_node);
-        xmlChar* res_nb_node          = xmlNodeGetContent(res_nb_node_node);
-        xmlChar* res_nb_proc_per_node = xmlNodeGetContent(res_nb_proc_per_node_node);
-        xmlChar* res_cpu_clock        = xmlNodeGetContent(res_cpu_clock_node);
-        xmlChar* res_mem_mb           = xmlNodeGetContent(res_mem_mb_node);
-        bool import_value = true;
-        std::istringstream nb_proc_stream((const char *) res_nb_proc);
-        if (!(nb_proc_stream >> p.nb_proc))
-          import_value = false;
-        std::istringstream nb_node_stream((const char *) res_nb_node);
-        if (!(nb_node_stream >> p.nb_node))
-          import_value = false;
-        std::istringstream nb_proc_per_node_stream((const char *) res_nb_proc_per_node);
-        if (!(nb_proc_per_node_stream >> p.nb_proc_per_node))
-          import_value = false;
-        std::istringstream cpu_clock_stream((const char *) res_cpu_clock);
-        if (!(cpu_clock_stream >> p.cpu_clock))
-          import_value = false;
-        std::istringstream mem_mb_stream((const char *) res_mem_mb);
-        if (!(mem_mb_stream >> p.mem_mb))
-          import_value = false;
-        xmlFree(res_nb_proc);
-        xmlFree(res_nb_node);
-        xmlFree(res_nb_proc_per_node);
-        xmlFree(res_cpu_clock);
-        xmlFree(res_mem_mb);
-        if (!import_value)
-        {
-          INFOS("A bad job is found, some resource_params value are not correct");
-          delete new_job;
-          break;
-        }
-        try
-        {
-          new_job->setResourceRequiredParams(p);
-        }
-        catch(const LauncherException &ex)
-        {
-          INFOS("A bad job is found, an error when inserting resource_params:" << ex.msg.c_str());
-          delete new_job;
-          break;
-        }
-
-        // We finally get run part to figure out what to do
-        xmlNodePtr job_state_node             = xmlFirstElementChild(run_node);
-        xmlNodePtr resource_choosed_name_node = xmlNextElementSibling(job_state_node);
-        xmlNodePtr job_reference_node         = xmlNextElementSibling(resource_choosed_name_node);
-        if (job_state_node             == NULL ||
-            resource_choosed_name_node == NULL ||
-            job_reference_node         == NULL
-           )
-        {
-          INFOS("A bad job is found, some run_part are not found");
-          delete new_job;
-          break;
-        }
-        if (xmlStrcmp(job_state_node->name,             xmlCharStrdup("job_state"))             ||
-            xmlStrcmp(resource_choosed_name_node->name, xmlCharStrdup("resource_choosed_name")) ||
-            xmlStrcmp(job_reference_node->name,         xmlCharStrdup("job_reference"))
-           )
-        {
-          INFOS("A bad job is found, some run_part nodes are not in the rigth or does not have a correct name");
-          delete new_job;
-          break;
-        }
-        xmlChar* job_state_xml             = xmlNodeGetContent(job_state_node);
-        xmlChar* resource_choosed_name_xml = xmlNodeGetContent(resource_choosed_name_node);
-        xmlChar* job_reference_xml         = xmlNodeGetContent(job_reference_node);
-        std::string job_state((const char *) job_state_xml);
-        std::string resource_choosed_name((const char *) resource_choosed_name_xml);
-        std::string job_reference((const char *) job_reference_xml);
-        xmlFree(job_state_xml);
-        xmlFree(resource_choosed_name_xml);
-        xmlFree(job_reference_xml);
-
-        if (job_state == "CREATED")
-        {
-          // In this case, we ignore run_part informations
-          try
-          {
-            _l.createJob(new_job);
-            std::ostringstream job_id;
-            job_id << new_job->getNumber();
-            notifyObservers("NEW_JOB", job_id.str());
-          }
-          catch(const LauncherException &ex)
-          {
-            INFOS("Load failed: " << ex.msg.c_str());
-          }
-        }
-        else if (job_state == "QUEUED"     ||
-                 job_state == "RUNNING"    ||
-                 job_state == "IN_PROCESS" ||
-                 job_state == "PAUSED")
-        {
-          try
-          {
-            new_job->setState(job_state);
-            _l.addJobDirectlyToMap(new_job, job_reference);
-
-            // Step 4: We check that the BatchManager could resume
-            // the job
-#ifdef WITH_LIBBATCH
-            if (new_job->getBatchManagerJobId().getReference() != job_reference)
-            {
-              INFOS("BatchManager type cannot resume a job - job state is set to ERROR");
-              new_job->setState("ERROR");
-            }
-#endif
-            std::ostringstream job_id;
-            job_id << new_job->getNumber();
-            notifyObservers("NEW_JOB", job_id.str());
-          }
-          catch(const LauncherException &ex)
-          {
-            INFOS("Cannot load the job! Exception: " << ex.msg.c_str());
-            delete new_job;
-          }
-        }
-        else if (job_state == "FINISHED" ||
-                 job_state == "FAILED"   ||
-                 job_state == "ERROR")
-        {
-          try
-          {
-            // Step 2: We add run_part informations
-            new_job->setState(job_state);
-            _l.addJobDirectlyToMap(new_job, job_reference);
-            std::ostringstream job_id;
-            job_id << new_job->getNumber();
-            notifyObservers("NEW_JOB", job_id.str());
-          }
-          catch(const LauncherException &ex)
-          {
-            INFOS("Cannot load the job! Exception: " << ex.msg.c_str());
-            delete new_job;
-          }
-        }
-        else
-        {
-          INFOS("A bad job is found, state unknown " << job_state);
-          delete new_job;
-        }
-
-      }
-      xmlCurrentNode = xmlCurrentNode->next;
-    }
-  }
-  else
-  {
-    xmlFreeDoc(doc);
-    fclose(xml_file);
-    std::string error = "Error in xml file, could not find root_node named jobs: " + std::string(jobs_file);
-    INFOS(error);
-    THROW_SALOME_CORBA_EXCEPTION(error.c_str(), SALOME::INTERNAL_ERROR);
+    ostringstream job_id_sstr;
+    job_id_sstr << *it_jobs_id;
+    notifyObservers("NEW_JOB", job_id_sstr.str());
   }
-
-  // Clean
-  xmlFreeDoc(doc);
-  fclose(xml_file);
   notifyObservers("LOAD_JOBS", jobs_file);
 }
 
@@ -1047,48 +508,7 @@ SALOME_Launcher::loadJobs(const char* jobs_file)
 void
 SALOME_Launcher::saveJobs(const char* jobs_file)
 {
-
-  // Step 1: check jobs_file write access
-  FILE* xml_file = fopen(jobs_file, "w");
-  if (xml_file == NULL)
-  {
-    std::string error = "Error opening jobs_file in SALOME_Launcher::saveJobs: " + std::string(jobs_file);
-    INFOS(error);
-    THROW_SALOME_CORBA_EXCEPTION(error.c_str(), SALOME::INTERNAL_ERROR);
-  }
-
-  // Step 2: First lines
-  xmlKeepBlanksDefault(0);
-  xmlDocPtr doc = xmlNewDoc(xmlCharStrdup("1.0"));
-  xmlNodePtr root_node = xmlNewNode(NULL, xmlCharStrdup("jobs"));
-  xmlDocSetRootElement(doc, root_node);
-  xmlNodePtr doc_comment = xmlNewDocComment(doc, xmlCharStrdup("SALOME Launcher save jobs file"));
-  xmlAddPrevSibling(root_node, doc_comment);
-
-  // Step 3: For each job write it on the xml document
-  // We could put a mutex but are not foing to do that currently
-  std::map<int, Launcher::Job *> jobs_list = _l.getJobs();
-  std::map<int, Launcher::Job *>::const_iterator it_job;
-  for(it_job = jobs_list.begin(); it_job != jobs_list.end(); it_job++)
-  {
-    it_job->second->addToXmlDocument(root_node);
-  }
-
-  // Final step: write file
-  int isOk = xmlSaveFormatFile(jobs_file, doc, 1);
-  if (!isOk)
-  {
-    std::string error = "Error during xml file saving in SALOME_Launcher::saveJobs: " + std::string(jobs_file);
-    INFOS(error);
-    xmlFreeDoc(doc);
-    fclose(xml_file);
-    THROW_SALOME_CORBA_EXCEPTION(error.c_str(), SALOME::INTERNAL_ERROR);
-  }
-
-  // Clean
-  xmlFreeDoc(doc);
-  fclose(xml_file);
-  MESSAGE("SALOME_Launcher::saveJobs : WRITING DONE!");
+  _l.saveJobs(jobs_file);
   notifyObservers("SAVE_JOBS", jobs_file);
 }
 
@@ -1127,7 +547,7 @@ SALOME_Launcher::addObserver(Engines::SalomeLauncherObserver_ptr observer)
     {
       observer->notify("NEW_JOB", job_id.str().c_str());
     }
-    catch (...) 
+    catch (...)
     {
        MESSAGE("Notify Observer, exception catch");
     }
@@ -1176,7 +596,7 @@ SALOME_Launcher::notifyObservers(const std::string & event_name,
       (*iter)->notify(CORBA::string_dup(event_name.c_str()),
                       CORBA::string_dup(event_data.c_str()));
     }
-    catch (...) 
+    catch (...)
     {
        MESSAGE("Notify Observer, exception catch");
     }
@@ -1184,3 +604,132 @@ SALOME_Launcher::notifyObservers(const std::string & event_name,
   }
 
 }
+
+JobParameters_cpp
+SALOME_Launcher::JobParameters_CORBA2CPP(
+                                   const Engines::JobParameters& job_parameters)
+{
+  JobParameters_cpp result;
+
+  result.job_name = job_parameters.job_name.in();
+  result.job_type = job_parameters.job_type.in();
+  result.job_file = job_parameters.job_file.in();
+  result.pre_command = job_parameters.pre_command.in();
+  result.env_file = job_parameters.env_file.in();
+
+  result.in_files.clear();
+  for (CORBA::ULong i = 0; i < job_parameters.in_files.length(); i++)
+    result.in_files.push_back(job_parameters.in_files[i].in());
+  result.out_files.clear();
+  for (CORBA::ULong i = 0; i < job_parameters.out_files.length(); i++)
+    result.out_files.push_back(job_parameters.out_files[i].in());
+
+  result.work_directory = job_parameters.work_directory.in();
+  result.local_directory = job_parameters.local_directory.in();
+  result.result_directory = job_parameters.result_directory.in();
+  result.maximum_duration = job_parameters.maximum_duration.in();
+
+  result.resource_required = resourceParameters_CORBAtoCPP(job_parameters.resource_required);
+
+  result.queue = job_parameters.queue.in();
+  result.partition = job_parameters.partition.in();
+  result.exclusive = job_parameters.exclusive;
+  result.mem_per_cpu = job_parameters.mem_per_cpu;
+  result.wckey = job_parameters.wckey.in();
+  result.extra_params = job_parameters.extra_params.in();
+
+  result.specific_parameters.clear();
+  for (CORBA::ULong i = 0; i < job_parameters.specific_parameters.length(); i++)
+    result.specific_parameters[job_parameters.specific_parameters[i].name.in()]
+                             = job_parameters.specific_parameters[i].value.in();
+
+  result.launcher_file = job_parameters.launcher_file.in();
+  result.launcher_args = job_parameters.launcher_args.in();
+  return result;
+}
+
+Engines::JobParameters_var
+SALOME_Launcher::JobParameters_CPP2CORBA(const JobParameters_cpp& job_parameters)
+{
+  Engines::JobParameters_var result = new Engines::JobParameters;
+  result->job_name = CORBA::string_dup(job_parameters.job_name.c_str());
+  result->job_type = CORBA::string_dup(job_parameters.job_type.c_str());
+  result->job_file = CORBA::string_dup(job_parameters.job_file.c_str());
+  result->pre_command = CORBA::string_dup(job_parameters.pre_command.c_str());
+  result->env_file = CORBA::string_dup(job_parameters.env_file.c_str());
+  result->in_files.length((CORBA::ULong)job_parameters.in_files.size()); //!< TODO: conversion from size_t to CORBA::ULong
+
+  int i = 0;
+  for(const std::string& it : job_parameters.in_files)
+  {
+    result->in_files[i] = CORBA::string_dup(it.c_str());
+    i++;
+  }
+  result->out_files.length((CORBA::ULong)job_parameters.out_files.size()); //!< TODO: conversion from size_t to CORBA::ULong
+  i = 0;
+  for(const std::string& it : job_parameters.out_files)
+  {
+    result->out_files[i] = CORBA::string_dup(it.c_str());
+    i++;
+  }
+
+  result->work_directory = CORBA::string_dup(job_parameters.work_directory.c_str());
+  result->local_directory = CORBA::string_dup(job_parameters.local_directory.c_str());
+  result->result_directory = CORBA::string_dup(job_parameters.result_directory.c_str());
+  result->maximum_duration = CORBA::string_dup(job_parameters.maximum_duration.c_str());
+
+  result->resource_required = resourceParameters_CPPtoCORBA(job_parameters.resource_required);
+
+  result->queue = CORBA::string_dup(job_parameters.queue.c_str());
+  result->partition = CORBA::string_dup(job_parameters.partition.c_str());
+  result->exclusive = job_parameters.exclusive;
+  result->mem_per_cpu = job_parameters.mem_per_cpu;
+  result->wckey = CORBA::string_dup(job_parameters.wckey.c_str());
+  result->extra_params = CORBA::string_dup(job_parameters.extra_params.c_str());
+
+  const std::map<std::string, std::string>& specific_parameters
+                                       = job_parameters.specific_parameters;
+  if (!specific_parameters.empty())
+  {
+    result->specific_parameters.length((CORBA::ULong)specific_parameters.size()); //!< TODO: conversion from size_t to CORBA::ULong
+    CORBA::ULong i = 0;
+    for (const auto& it_specific : specific_parameters)
+    {
+      Engines::Parameter_var new_param = new Engines::Parameter;
+      new_param->name  = CORBA::string_dup(it_specific.first.c_str());
+      new_param->value = CORBA::string_dup(it_specific.second.c_str());
+      result->specific_parameters[i] = new_param;
+      i++;
+    }
+  }
+
+  result->launcher_file = CORBA::string_dup(job_parameters.launcher_file.c_str());
+  result->launcher_args = CORBA::string_dup(job_parameters.launcher_args.c_str());
+  return result;
+}
+
+static SALOME_Launcher *_launcher_singleton_ssl = nullptr;
+
+#include "SALOME_Fake_NamingService.hxx"
+
+SALOME_Launcher *KERNEL::getLauncherSA()
+{
+  if(!_launcher_singleton_ssl)
+  {
+    CORBA::ORB_var orb = KERNEL::GetRefToORB();
+    //[EDF26673] : do not release the POA object returned by _the_root_poa.
+    PortableServer::POA_ptr root_poa = PortableServer::POA::_the_root_poa();
+    PortableServer::POAManager_var pman = root_poa->the_POAManager();
+    CORBA::PolicyList policies;
+    policies.length(1);
+    PortableServer::ThreadPolicy_var threadPol(root_poa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL));
+    policies[0] = PortableServer::ThreadPolicy::_duplicate(threadPol);
+    PortableServer::POA_var safePOA = root_poa->create_POA("SingleThreadPOA",
+                                                           pman,
+                                                           policies);
+    threadPol->destroy();
+    SALOME_Fake_NamingService *ns=new SALOME_Fake_NamingService(orb);
+    _launcher_singleton_ssl = new SALOME_Launcher(orb,safePOA,ns);//3rd arg is important to skip NS !
+  }
+  return _launcher_singleton_ssl;
+}