Salome HOME
updated copyright message
[modules/kernel.git] / src / ResourcesManager / SALOME_ResourcesManager.cxx
index ea88da8f8de8b99f184482e23d9734fc8d62fd65..632a326b651fbe580c212c436365748ea5f9b44f 100644 (file)
@@ -1,29 +1,33 @@
-// Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// 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
-// 
+//
 // 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 
+// License as published by the Free Software Foundation; either
+// 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
+// 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 
+// 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
 //
+
 #include "SALOME_ResourcesManager.hxx" 
 #include "Utils_ExceptHandlers.hxx"
 #include "Utils_CorbaException.hxx"
 #include "OpUtil.hxx"
 
 #include <stdlib.h>
-#ifndef WNT
+#include <stdio.h>
+#ifndef WIN32
 #include <unistd.h>
 #else
 #include <io.h>
@@ -52,25 +56,29 @@ const char *SALOME_ResourcesManager::_ResourcesManagerNameInNS = "/ResourcesMana
  */ 
 //=============================================================================
 
-SALOME_ResourcesManager::
-SALOME_ResourcesManager(CORBA::ORB_ptr orb, 
-                       PortableServer::POA_var poa, 
-                       SALOME_NamingService *ns,
-                        const char *xmlFilePath) :
-    _path_resources(xmlFilePath)
+SALOME_ResourcesManager::SALOME_ResourcesManager(CORBA::ORB_ptr orb,
+                                                 PortableServer::POA_var poa,
+                                                 SALOME_NamingService_Abstract *ns,
+                                                 const char *xmlFilePath)
+: _rm(new ResourcesManager_cpp(xmlFilePath))
 {
-  MESSAGE("constructor");
+  MESSAGE("SALOME_ResourcesManager constructor");
   _NS = ns;
   _orb = CORBA::ORB::_duplicate(orb) ;
-  _poa = PortableServer::POA::_duplicate(poa) ;
+  //
+  PortableServer::POAManager_var pman = poa->the_POAManager();
+  CORBA::PolicyList policies;
+  policies.length(1);
+  PortableServer::ThreadPolicy_var threadPol(poa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL));
+  policies[0] = PortableServer::ThreadPolicy::_duplicate(threadPol);
+  _poa = poa->create_POA("SingleThreadPOA",pman,policies);
+  threadPol->destroy();
+  //
   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);
-
+  Engines::ResourcesManager_var refContMan = Engines::ResourcesManager::_narrow(obj);
   _NS->Register(refContMan,_ResourcesManagerNameInNS);
-  _MpiStarted = false;
-  MESSAGE("constructor end");
+  MESSAGE("SALOME_ResourcesManager constructor end");
 }
 
 //=============================================================================
@@ -85,37 +93,28 @@ SALOME_ResourcesManager(CORBA::ORB_ptr orb,
 //=============================================================================
 
 SALOME_ResourcesManager::SALOME_ResourcesManager(CORBA::ORB_ptr orb, 
-                                                PortableServer::POA_var poa, 
-                                                SALOME_NamingService *ns)
+                                                 PortableServer::POA_var poa, 
+                                                 SALOME_NamingService_Abstract *ns) : _rm(new ResourcesManager_cpp())
 {
-  MESSAGE("constructor");
+  MESSAGE("SALOME_ResourcesManager constructor");
   _NS = ns;
   _orb = CORBA::ORB::_duplicate(orb) ;
-  _poa = PortableServer::POA::_duplicate(poa) ;
+  //
+  PortableServer::POAManager_var pman = poa->the_POAManager();
+  CORBA::PolicyList policies;
+  policies.length(1);
+  PortableServer::ThreadPolicy_var threadPol(poa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL));
+  policies[0] = PortableServer::ThreadPolicy::_duplicate(threadPol);
+  _poa = poa->create_POA("SingleThreadPOA",pman,policies);
+  threadPol->destroy();
+  //
   PortableServer::ObjectId_var id = _poa->activate_object(this);
   CORBA::Object_var obj = _poa->id_to_reference(id);
   Engines::ResourcesManager_var refContMan = Engines::ResourcesManager::_narrow(obj);
-  _NS->Register(refContMan,_ResourcesManagerNameInNS);
-
-  _isAppliSalomeDefined = (getenv("APPLI") != 0);
-  _MpiStarted = false;
-
-  if (_isAppliSalomeDefined)
-    {
-      _path_resources = getenv("HOME");
-      _path_resources += "/";
-      _path_resources += getenv("APPLI");
-      _path_resources += "/CatalogResources.xml";
-    }
+  if(_NS)
+    _NS->Register(refContMan,_ResourcesManagerNameInNS);
 
-  else
-    {
-      _path_resources = getenv("KERNEL_ROOT_DIR");
-      _path_resources += "/share/salome/resources/kernel/CatalogResources.xml";
-    }
-
-  ParseXmlFile();
-  MESSAGE("constructor end");
+  MESSAGE("SALOME_ResourcesManager constructor end");
 }
 
 //=============================================================================
@@ -126,7 +125,7 @@ SALOME_ResourcesManager::SALOME_ResourcesManager(CORBA::ORB_ptr orb,
 
 SALOME_ResourcesManager::~SALOME_ResourcesManager()
 {
-  MESSAGE("destructor");
+  MESSAGE("SALOME_ResourcesManager destructor");
 }
 
 
@@ -139,1052 +138,327 @@ SALOME_ResourcesManager::~SALOME_ResourcesManager()
 void SALOME_ResourcesManager::Shutdown()
 {
   MESSAGE("Shutdown");
+  if(!_NS)
+    return ;
   _NS->Destroy_Name(_ResourcesManagerNameInNS);
   PortableServer::ObjectId_var oid = _poa->servant_to_id(this);
   _poa->deactivate_object(oid);
-  //_remove_ref();
 }
 
-//=============================================================================
 /*!
- *  get the list of name of ressources fitting for the specified module.
- *  If hostname specified, check it is local or known in resources catalog.
- *
- *  Else
- *  - select first machines with corresponding OS (all machines if
- *    parameter OS empty),
- *  - then select the sublist of machines on witch the module is known
- *    (if the result is empty, that probably means that the inventory of
- *    modules is probably not done, so give complete list from previous step)
- */ 
-//=============================================================================
-
-Engines::MachineList *
-SALOME_ResourcesManager::GetFittingResources(const Engines::MachineParameters& params,
-                                            const Engines::CompoList& componentList)
-//throw(SALOME_Exception)
-{
-//   MESSAGE("ResourcesManager::GetFittingResources");
-  vector <std::string> vec;
-  Engines::MachineList *ret=new Engines::MachineList;
-
-  try{
-    // --- To be sure that we search in a correct list.
-    ParseXmlFile();
-
-    const char *hostname = (const char *)params.hostname;
-    MESSAGE("GetFittingResources " << hostname << " " << GetHostname().c_str());
-
-    if (hostname[0] != '\0')
-      {
-//       MESSAGE("ResourcesManager::GetFittingResources : hostname specified" );
-
-       if ( strcmp(hostname, "localhost") == 0 ||
-            strcmp(hostname, GetHostname().c_str()) == 0 )
-         {
-           //           MESSAGE("ResourcesManager::GetFittingResources : localhost" );
-           vec.push_back(GetHostname().c_str());
-           //    MESSAGE("ResourcesManager::GetFittingResources : " << vec.size());
-         }
-       
-       else if (_resourcesList.find(hostname) != _resourcesList.end())
-         {
-           // --- params.hostname is in the list of resources so return it.
-           vec.push_back(hostname);
-         }
-       
-       else
-         {
-           // Cas d'un cluster: nombre de noeuds > 1
-           int cpt=0;
-           for (map<string, ParserResourcesType>::const_iterator iter = _resourcesList.begin(); iter != _resourcesList.end(); iter++){
-             if( (*iter).second.DataForSort._nbOfNodes > 1 ){
-               if( strncmp(hostname,(*iter).first.c_str(),strlen(hostname)) == 0 ){
-                 vec.push_back((*iter).first.c_str());
-                 //cout << "SALOME_ResourcesManager::GetFittingResources vector["
-                 //     << cpt << "] = " << (*iter).first.c_str() << endl ;
-                 cpt++;
-               }
-             }
-           }
-           if(cpt==0){
-             // --- user specified an unknown hostame so notify him.
-             MESSAGE("ResourcesManager::GetFittingResources : SALOME_Exception");
-             throw SALOME_Exception("unknown host");
-           }
-         }
-      }
-    
-    else
-      // --- Search for available resources sorted by priority
-      {
-       SelectOnlyResourcesWithOS(vec, params.OS);
-       
-       KeepOnlyResourcesWithModule(vec, componentList);
-       
-       if (vec.size() == 0)
-         SelectOnlyResourcesWithOS(vec, params.OS);
-       
-       // --- set wanted parameters
-       ResourceDataToSort::_nbOfNodesWanted = params.nb_node;
-       
-       ResourceDataToSort::_nbOfProcPerNodeWanted = params.nb_proc_per_node;
-       
-       ResourceDataToSort::_CPUFreqMHzWanted = params.cpu_clock;
-       
-       ResourceDataToSort::_memInMBWanted = params.mem_mb;
-       
-       // --- end of set
-       
-       list<ResourceDataToSort> li;
-       
-       for (vector<string>::iterator iter = vec.begin();
-           iter != vec.end();
-            iter++)
-         li.push_back(_resourcesList[(*iter)].DataForSort);
-       
-       li.sort();
-       
-       unsigned int i = 0;
-       
-       for (list<ResourceDataToSort>::iterator iter2 = li.begin();
-            iter2 != li.end();
-            iter2++)
-         vec[i++] = (*iter2)._hostName;
-      }
-    
-    //  MESSAGE("ResourcesManager::GetFittingResources : return" << ret.size());
-    ret->length(vec.size());
-    for(unsigned int i=0;i<vec.size();i++)
-      (*ret)[i]=(vec[i]).c_str();
-
-  }
-  catch(const SALOME_Exception &ex)
-    {
-      INFOS("Caught exception.");
-      THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::BAD_PARAM);
-      //return ret;
-    }  
-
-  return ret;
-}
-
-//=============================================================================
-/*!
- *  add an entry in the ressources catalog  xml file.
- *  Return 0 if OK (KERNEL found in new resources modules) else throw exception
- */ 
-//=============================================================================
-
-int
-SALOME_ResourcesManager::
-AddResourceInCatalog(const Engines::MachineParameters& paramsOfNewResources,
-                     const vector<string>& modulesOnNewResources,
-                     const char *alias,
-                     const char *userName,
-                     AccessModeType mode,
-                     AccessProtocolType prot)
-throw(SALOME_Exception)
+ * Return list of resources available (regarding content of CatalogResources.xml) but select only those with canRunContainers attribute set to true.
+ * And for each resource the number of proc available of it.
+ * 
+ * \sa SALOME_ResourcesManager::ListAllResourcesInCatalog
+ */
+void SALOME_ResourcesManager::ListAllAvailableResources(Engines::ResourceList_out machines, Engines::IntegerList_out nbProcsOfMachines)
 {
-  vector<string>::const_iterator iter = find(modulesOnNewResources.begin(),
-                                            modulesOnNewResources.end(),
-                                            "KERNEL");
-
-  if (iter != modulesOnNewResources.end())
+  const MapOfParserResourcesType& zeList(_rm->GetList());
+  std::vector<std::string> ret0;
+  std::vector<int> ret1;
+  for(MapOfParserResourcesType::const_iterator it=zeList.begin();it!=zeList.end();it++)
+  {
+    const ParserResourcesType& elt((*it).second);
+    if(elt.can_run_containers)
     {
-      ParserResourcesType newElt;
-      newElt.DataForSort._hostName = paramsOfNewResources.hostname;
-      newElt.Alias = alias;
-      newElt.Protocol = prot;
-      newElt.Mode = mode;
-      newElt.UserName = userName;
-      newElt.ModulesList = modulesOnNewResources;
-      newElt.OS = paramsOfNewResources.OS;
-      newElt.DataForSort._memInMB = paramsOfNewResources.mem_mb;
-      newElt.DataForSort._CPUFreqMHz = paramsOfNewResources.cpu_clock;
-      newElt.DataForSort._nbOfNodes = paramsOfNewResources.nb_node;
-      newElt.DataForSort._nbOfProcPerNode =
-        paramsOfNewResources.nb_proc_per_node;
-      _resourcesList[newElt.DataForSort._hostName] = newElt;
-      return 0;
+      ret0.push_back(elt.HostName);
+      ret1.push_back(elt.DataForSort._nbOfNodes*elt.DataForSort._nbOfProcPerNode);
     }
-
-  else
-    throw SALOME_Exception("KERNEL is not present in this resource");
-}
-
-//=============================================================================
-/*!
- *  Deletes a resource from the catalog
- */ 
-//=============================================================================
-
-void SALOME_ResourcesManager::DeleteResourceInCatalog(const char *hostname)
-{
-  _resourcesList.erase(hostname);
-}
-
-//=============================================================================
-/*!
- *  write the current data in memory in file.
- */ 
-//=============================================================================
-
-void SALOME_ResourcesManager::WriteInXmlFile()
-{
-  const char* aFilePath = _path_resources.c_str();
-  
-  FILE* aFile = fopen(aFilePath, "w");
-
-  if (aFile == NULL)
+  }
+  machines=new Engines::ResourceList;
+  nbProcsOfMachines=new Engines::IntegerList;
+  std::size_t sz(ret0.size());
+  machines->length((CORBA::ULong)sz); nbProcsOfMachines->length((CORBA::ULong)sz);
+  for(std::size_t j=0;j<sz;j++)
     {
-      INFOS("Error opening file !");
-      return;
+      (*machines)[(CORBA::ULong)j]=CORBA::string_dup(ret0[j].c_str());
+      (*nbProcsOfMachines)[(CORBA::ULong)j]=ret1[j];
     }
-  
-  xmlDocPtr aDoc = xmlNewDoc(BAD_CAST "1.0");
-  xmlNewDocComment(aDoc, BAD_CAST "ResourcesCatalog");
-
-  SALOME_ResourcesCatalog_Handler* handler =
-    new SALOME_ResourcesCatalog_Handler(_resourcesList);
-  handler->PrepareDocToXmlFile(aDoc);
-  delete handler;
-
-  int isOk = xmlSaveFile(aFilePath, aDoc);
-  
-  if (!isOk)
-    INFOS("Error while XML file saving.");
-  
-  // Free the document
-  xmlFreeDoc(aDoc);
-
-  fclose(aFile);
-  
-  MESSAGE("WRITING DONE!");
 }
 
-//=============================================================================
 /*!
- *  parse the data type catalog
- */ 
-//=============================================================================
-
-const MapOfParserResourcesType& SALOME_ResourcesManager::ParseXmlFile()
+ * Return list of resources available (regarding content of CatalogResources.xml) whatever canRunContainers attribute value.
+ * 
+ * \sa SALOME_ResourcesManager::ListAllAvailableResources
+ */
+Engines::ResourceList *SALOME_ResourcesManager::ListAllResourcesInCatalog()
 {
-  SALOME_ResourcesCatalog_Handler* handler =
-    new SALOME_ResourcesCatalog_Handler(_resourcesList);
-
-  const char* aFilePath = _path_resources.c_str();
-  FILE* aFile = fopen(aFilePath, "r");
-  
-  if (aFile != NULL)
-    {
-      xmlDocPtr aDoc = xmlReadFile(aFilePath, NULL, 0);
-      
-      if (aDoc != NULL)
-       handler->ProcessXmlDocument(aDoc);
-      else
-       INFOS("ResourcesManager: could not parse file "<<aFilePath);
-      
-      // Free the document
-      xmlFreeDoc(aDoc);
-
-      fclose(aFile);
-    }
-  else
-    INFOS("ResourcesManager: file "<<aFilePath<<" is not readable.");
-  
-  delete handler;
-
-  return _resourcesList;
-}
-
-//=============================================================================
-/*!
- *   consult the content of the list
- */ 
-//=============================================================================
-
-const MapOfParserResourcesType& SALOME_ResourcesManager::GetList() const
+  const MapOfParserResourcesType& zeList(_rm->GetList());
+  auto sz = zeList.size();
+  Engines::ResourceList *ret(new Engines::ResourceList);
+  ret->length( sz );
+  CORBA::ULong i(0);
+  for(auto it : zeList)
   {
-    return _resourcesList;
+    (*ret)[i++] = CORBA::string_dup( it.second.HostName.c_str() );
   }
-
-
-//=============================================================================
-/*!
- *  dynamically obtains the first machines
- */ 
-//=============================================================================
-
-char *
-SALOME_ResourcesManager::FindFirst(const Engines::MachineList& listOfMachines)
-{
-  return CORBA::string_dup(_dynamicResourcesSelecter.FindFirst(listOfMachines).c_str());
-}
-
-//=============================================================================
-/*!
- *  dynamically obtains the best machines
- */ 
-//=============================================================================
-
-string
-SALOME_ResourcesManager::FindNext(const Engines::MachineList& listOfMachines)
-{
-  return _dynamicResourcesSelecter.FindNext(listOfMachines,_resourcesList,_NS);
-}
-//=============================================================================
-/*!
- *  dynamically obtains the best machines
- */ 
-//=============================================================================
-
-string
-SALOME_ResourcesManager::FindBest(const Engines::MachineList& listOfMachines)
-{
-  return _dynamicResourcesSelecter.FindBest(listOfMachines);
-}
-
-//=============================================================================
-/*!
- *  This is no longer valid (C++ container are also python containers)
- */ 
-//=============================================================================
-
-bool isPythonContainer(const char* ContainerName)
-{
-  bool ret = false;
-  int len = strlen(ContainerName);
-
-  if (len >= 2)
-    if (strcmp(ContainerName + len - 2, "Py") == 0)
-      ret = true;
-
   return ret;
 }
 
-
 //=============================================================================
+//! get the name of resources fitting the specified constraints (params)
 /*!
- *  Builds the script to be launched
- *
- *  If SALOME Application not defined ($APPLI),
- *  see BuildTempFileToLaunchRemoteContainer()
+ *  If hostname specified, check it is local or known in resources catalog.
  *
- *  Else rely on distant configuration. Command is under the form (example):
- *  ssh user@machine distantPath/runRemote.sh hostNS portNS workingdir \
- *                   SALOME_Container containerName &"
-
- *  - where user is ommited if not specified in CatalogResources,
- *  - where distant path is always relative to user@machine $HOME, and
- *    equal to $APPLI if not specified in CatalogResources,
- *  - where hostNS is the hostname of CORBA naming server (set by scripts to
- *    use to launch SALOME and servers in $APPLI: runAppli.sh, runRemote.sh)
- *  - where portNS is the port used by CORBA naming server (set by scripts to
- *    use to launch SALOME and servers in $APPLI: runAppli.sh, runRemote.sh)
- *  - where workingdir is the requested working directory for the container
+ *  Else
+ *  - select first machines with corresponding OS (all machines if
+ *    parameter OS empty),
+ *  - then select the sublist of machines on which the component is known
+ *    (if the result is empty, that probably means that the inventory of
+ *    components is probably not done, so give complete list from previous step)
  */ 
 //=============================================================================
 
-string
-SALOME_ResourcesManager::BuildCommandToLaunchRemoteContainer
-(const string& machine,
- const Engines::MachineParameters& params, const long id)
+Engines::ResourceList *
+SALOME_ResourcesManager::GetFittingResources(const Engines::ResourceParameters& params)
 {
-  string command;
-  int nbproc;
-  char idc[3*sizeof(long)];
-         
-  if ( ! _isAppliSalomeDefined )
-    command = BuildTempFileToLaunchRemoteContainer(machine, params);
-
-  else
-    {
-      const ParserResourcesType& resInfo = _resourcesList[machine];
-
-      if (params.isMPI)
-        {
-          if ( (params.nb_node <= 0) && (params.nb_proc_per_node <= 0) )
-            nbproc = 1;
-          else if ( params.nb_node == 0 )
-            nbproc = params.nb_proc_per_node;
-          else if ( params.nb_proc_per_node == 0 )
-            nbproc = params.nb_node;
-          else
-            nbproc = params.nb_node * params.nb_proc_per_node;
-        }
-
-      // "ssh user@machine distantPath/runRemote.sh hostNS portNS workingdir \
-      //  SALOME_Container containerName &"
-
-      if (resInfo.Protocol == rsh)
-        command = "rsh ";
-      else if (resInfo.Protocol == ssh)
-        command = "ssh ";
-      else
-        throw SALOME_Exception("Unknown protocol");
-
-      if (resInfo.UserName != "")
-       {
-         command += resInfo.UserName;
-         command += "@";
-       }
+  //MESSAGE("ResourcesManager::GetFittingResources");
+  Engines::ResourceList_var ret;
 
-      command += machine;
-      command += " ";
+  // CORBA -> C++
+  resourceParams p = resourceParameters_CORBAtoCPP(params);
 
-      if (resInfo.AppliPath != "")
-       command += resInfo.AppliPath; // path relative to user@machine $HOME
-      else
-       {
-         ASSERT(getenv("APPLI"));
-         command += getenv("APPLI"); // path relative to user@machine $HOME
-       }
-
-      command += "/runRemote.sh ";
-
-      ASSERT(getenv("NSHOST")); 
-      command += getenv("NSHOST"); // hostname of CORBA name server
-
-      command += " ";
-      ASSERT(getenv("NSPORT"));
-      command += getenv("NSPORT"); // port of CORBA name server
-
-      command += " '";
-      std::string wdir=params.workingdir.in();
-      if(wdir == "$TEMPDIR")
-        wdir="\\$TEMPDIR";
-      command += wdir; // requested working directory
-      command += "'"; 
-
-      if(params.isMPI)
-       {
-         command += " mpirun -np ";
-         std::ostringstream o;
-         o << nbproc << " ";
-         command += o.str();
-#ifdef WITHLAM
-         command += "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace ";
-#endif 
-         command += " SALOME_MPIContainer ";
-       }
-      else
-       command += " SALOME_Container ";
-
-      command += _NS->ContainerName(params);
-      command += " -id ";
-      sprintf(idc,"%ld",id);
-      command += idc;
-      command += " -";
-      AddOmninamesParams(command);
+  try
+  {
+    // Call C++ ResourceManager
+    std::vector <std::string> vec = _rm->GetFittingResources(p);
 
-      MESSAGE("command =" << command);
-    }
+    // C++ -> CORBA
+    ret = resourceList_CPPtoCORBA(vec);
+  }
+  catch(const ResourcesException &ex)
+  {
+    INFOS("Caught exception in GetFittingResources C++:  " << ex.msg);
+    THROW_SALOME_CORBA_EXCEPTION(ex.msg.c_str(),SALOME::BAD_PARAM);
+  }  
 
-  return command;
+  return ret._retn();
 }
 
 //=============================================================================
 /*!
- *  builds the command to be launched.
+ *  dynamically obtains the first machines
  */ 
 //=============================================================================
 
-string
-SALOME_ResourcesManager::BuildCommandToLaunchLocalContainer
-(const Engines::MachineParameters& params, const long id)
+char *
+SALOME_ResourcesManager::FindFirst(const Engines::ResourceList& listOfResources)
 {
-  _TmpFileName = "";
-  string command;
-  int nbproc = 0;
-  char idc[3*sizeof(long)];
-
-  if (params.isMPI)
-    {
-      command = "mpirun -np ";
-
-      if ( (params.nb_node <= 0) && (params.nb_proc_per_node <= 0) )
-        nbproc = 1;
-      else if ( params.nb_node == 0 )
-        nbproc = params.nb_proc_per_node;
-      else if ( params.nb_proc_per_node == 0 )
-        nbproc = params.nb_node;
-      else
-        nbproc = params.nb_node * params.nb_proc_per_node;
-
-      std::ostringstream o;
-
-      o << nbproc << " ";
-
-      command += o.str();
-#ifdef WITHLAM
-      command += "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace ";
-#endif
-
-      if (isPythonContainer(params.container_name))
-        command += "pyMPI SALOME_ContainerPy.py ";
-      else
-        command += "SALOME_MPIContainer ";
-    }
-
-  else
-    {
-      command="";
-      std::string wdir=params.workingdir.in();
-      std::cerr << wdir << std::endl;
-      if(wdir != "")
-        {
-          // a working directory is requested
-          if(wdir == "$TEMPDIR")
-            {
-              // a new temporary directory is requested
-              char dir[]="/tmp/salomeXXXXXX";
-              char* mdir=mkdtemp(dir);
-              if(mdir==NULL)
-                std::cerr << "Problem in mkdtemp " << dir << " " << mdir << std::endl;
-              else
-                command="cd "+std::string(dir)+";";
-            }
-          else
-            {
-              // a permanent directory is requested use it or create it
-              command="mkdir -p " + wdir + " && cd " + wdir + ";";
-            }
-        }
-      if (isPythonContainer(params.container_name))
-        command += "SALOME_ContainerPy.py ";
-      else
-        command += "SALOME_Container ";
-    }
-
-  command += _NS->ContainerName(params);
-  command += " -id ";
-  sprintf(idc,"%ld",id);
-  command += idc;
-  command += " -";
-  AddOmninamesParams(command);
+  // CORBA -> C++
+  std::vector<std::string> rl = resourceList_CORBAtoCPP(listOfResources);
 
-  MESSAGE("Command is ... " << command);
-  return command;
+  return CORBA::string_dup(_rm->Find("first", rl).c_str());
 }
 
-
-//=============================================================================
-/*!
- *  removes the generated temporary file in case of a remote launch.
- */ 
-//=============================================================================
-
-void SALOME_ResourcesManager::RmTmpFile()
+char *
+SALOME_ResourcesManager::Find(const char* policy, const Engines::ResourceList& listOfResources)
 {
-  if (_TmpFileName != "")
-    {
-#ifndef WNT
-      string command = "rm ";
-#else
-      string command = "del /F ";
-#endif
-      command += _TmpFileName;
-      char *temp = strdup(command.c_str());
-      int lgthTemp = strlen(temp);
-      temp[lgthTemp - 3] = '*';
-      temp[lgthTemp - 2] = '\0';
-      system(temp);
-      free(temp);
-    }
-}
+  // CORBA -> C++
+  std::vector<std::string> rl = resourceList_CORBAtoCPP(listOfResources);
 
+  return CORBA::string_dup(_rm->Find(policy, rl).c_str());
+}
 
-//=============================================================================
-/*!
- *  builds the script to be launched
- */ 
-//=============================================================================
-
-string
-SALOME_ResourcesManager::BuildCommand
-(const string& machine,
- const char *containerName)
+Engines::ResourceDefinition*
+SALOME_ResourcesManager::GetResourceDefinition(const char * name)
 {
-  // rsh -n ikkyo /export/home/rahuel/SALOME_ROOT/bin/runSession SALOME_Container -ORBInitRef NameService=corbaname::dm2s0017:1515 &
-  const ParserResourcesType& resInfo = _resourcesList[machine];
-  bool pyCont = isPythonContainer(containerName);
-
-  string command;
-
-  if (resInfo.Protocol == rsh)
-    command = "rsh -n " ;
-  else if (resInfo.Protocol == ssh)
-    command = "ssh -f -n ";
-  else
-    throw SALOME_Exception("Not implemented yet...");
-
-  command += machine;
-  command += " ";
-  string path = getenv("KERNEL_ROOT_DIR");
-  command += path;
-  command += "/bin/salome/";
-
-  if ( pyCont )
-    command += "SALOME_ContainerPy.py ";
-  else
-    command += "SALOME_Container ";
-
-  command += containerName;
-  command += " -";
-  AddOmninamesParams(command);
+  Engines::ResourceDefinition_var resDef;
+  try {
+    ParserResourcesType resource = _rm->GetResourcesDescr(name);
+    resDef = resourceDefinition_CPPtoCORBA(resource);
+  } catch (const exception & ex) {
+    INFOS("Caught exception in GetResourceDefinition: " << ex.what());
+    THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::BAD_PARAM);
+  }
 
-  SCRUTE( command );
-  return command;
+  return resDef._retn();
 }
 
-//=============================================================================
-/*!
- *  Gives a sublist of machines with matching OS.
- *  If parameter OS is empty, gives the complete list of machines
- */ 
-//=============================================================================
-
-// Warning need an updated parsed list : _resourcesList
-void
-SALOME_ResourcesManager::SelectOnlyResourcesWithOS
-( vector<string>& hosts,
-  const char *OS) const
-throw(SALOME_Exception)
+void 
+SALOME_ResourcesManager::AddResource(const Engines::ResourceDefinition& new_resource,
+                                     CORBA::Boolean write,
+                                     const char * xml_file)
 {
-  string base(OS);
+  try
+  {
+    ParserResourcesType resource = resourceDefinition_CORBAtoCPP(new_resource);
+    _rm->AddResourceInCatalog(resource);
 
-  for (map<string, ParserResourcesType>::const_iterator iter =
-         _resourcesList.begin();
-       iter != _resourcesList.end();
-       iter++)
+    if (write)
     {
-      if ( (*iter).second.OS == base || base.size() == 0)
-        hosts.push_back((*iter).first);
+      _rm->WriteInXmlFile(std::string(xml_file));
+      _rm->ParseXmlFiles();
     }
+  }
+  catch (const SALOME_Exception & e)
+  {
+    INFOS("Error in AddResourceInCatalog: " << e);
+    THROW_SALOME_CORBA_EXCEPTION(e.what(), SALOME::BAD_PARAM);
+  }
+  catch (const ResourcesException & e)
+  {
+    INFOS("Error in AddResourceInCatalog: " << e.msg);
+    THROW_SALOME_CORBA_EXCEPTION(e.msg.c_str(), SALOME::BAD_PARAM);
+  }
 }
 
-
-//=============================================================================
-/*!
- *  Gives a sublist of machines on which the module is known.
- */ 
-//=============================================================================
-
-//Warning need an updated parsed list : _resourcesList
 void
-SALOME_ResourcesManager::KeepOnlyResourcesWithModule
-( vector<string>& hosts,
-  const Engines::CompoList& componentList) const
-throw(SALOME_Exception)
+SALOME_ResourcesManager::RemoveResource(const char * resource_name,
+                                        CORBA::Boolean write,
+                                        const char * xml_file)
 {
-  for (vector<string>::iterator iter = hosts.begin(); iter != hosts.end();)
-    {
-      MapOfParserResourcesType::const_iterator it = _resourcesList.find(*iter);
-      const vector<string>& mapOfModulesOfCurrentHost = (((*it).second).ModulesList);
-
-      bool erasedHost = false;
-      if( mapOfModulesOfCurrentHost.size() > 0 ){
-       for(int i=0;i<componentList.length();i++){
-          const char* compoi = componentList[i];
-         vector<string>::const_iterator itt = find(mapOfModulesOfCurrentHost.begin(),
-                                             mapOfModulesOfCurrentHost.end(),
-                                             compoi);
-//                                           componentList[i]);
-         if (itt == mapOfModulesOfCurrentHost.end()){
-           erasedHost = true;
-           break;
-         }
-       }
-      }
-      if(erasedHost)
-        hosts.erase(iter);
-      else
-        iter++;
-    }
-}
-
-
-//=============================================================================
-/*!
- *   add to command all options relative to naming service.
- */ 
-//=============================================================================
-
-void SALOME_ResourcesManager::AddOmninamesParams(string& command) const
+  try
   {
-    // If env variable OMNIORB_CONFIG is not defined or the file is more complex than one line
-    // does not work
-    // Even if we use it we have to check if env variable exists
-    //string omniORBcfg( getenv( "OMNIORB_CONFIG" ) ) ;
-    //ifstream omniORBfile( omniORBcfg.c_str() ) ;
-    //char ORBInitRef[11] ;
-    //char egal[3] ;
-    //char nameservice[132] ;
-    //omniORBfile >> ORBInitRef ;
-    //command += "ORBInitRef " ;
-    //omniORBfile >> egal ;
-    //omniORBfile >> nameservice ;
-    //omniORBfile.close() ;
-    //char * bsn = strchr( nameservice , '\n' ) ;
-    //if ( bsn ) {
-    //bsn[ 0 ] = '\0' ;
-    //}
-    //command += nameservice ;
-
-    CORBA::String_var iorstr = _NS->getIORaddr();
-    command += "ORBInitRef NameService=";
-    command += iorstr;
+    _rm->DeleteResourceInCatalog(resource_name);
   }
-
-
-//=============================================================================
-/*!
- *  add to command all options relative to naming service.
- */ 
-//=============================================================================
-
-void SALOME_ResourcesManager::AddOmninamesParams(ofstream& fileStream) const
+  catch (const SALOME_Exception & e)
   {
-    CORBA::String_var iorstr = _NS->getIORaddr();
-    fileStream << "ORBInitRef NameService=";
-    fileStream << iorstr;
+    INFOS("Error in DeleteResourceInCatalog: " << e);
+    THROW_SALOME_CORBA_EXCEPTION(e.what(), SALOME::BAD_PARAM);
   }
 
-
-//=============================================================================
-/*!
- *  generate a file name in /tmp directory
- */ 
-//=============================================================================
-
-string SALOME_ResourcesManager::BuildTemporaryFileName() const
+  if (write)
   {
-    //build more complex file name to support multiple salome session
-    char *temp = new char[19];
-    strcpy(temp, "/tmp/command");
-    strcat(temp, "XXXXXX");
-#ifndef WNT
-
-    mkstemp(temp);
-#else
-
-    char aPID[80];
-    itoa(getpid(), aPID, 10);
-    strcat(temp, aPID);
-#endif
-
-    string command(temp);
-    delete [] temp;
-    command += ".sh";
-    return command;
+    _rm->WriteInXmlFile(std::string(xml_file));
+    _rm->ParseXmlFiles();
   }
+}
 
-
-//=============================================================================
-/*!
- *  Builds in a temporary file the script to be launched.
- *  
- *  Used if SALOME Application ($APPLI) is not defined.
- *  The command is build with data from CatalogResources, in which every path
- *  used on remote computer must be defined.
- */ 
-//=============================================================================
-
-string
-SALOME_ResourcesManager::BuildTempFileToLaunchRemoteContainer
-(const string& machine,
- const Engines::MachineParameters& params) throw(SALOME_Exception)
+char *
+SALOME_ResourcesManager::getMachineFile(const char * resource_name,
+                                        CORBA::Long nb_procs, 
+                                        const char * parallelLib)
 {
-  int status;
+  std::string machine_file_name("");
 
-  _TmpFileName = BuildTemporaryFileName();
-  ofstream tempOutputFile;
-  tempOutputFile.open(_TmpFileName.c_str(), ofstream::out );
-  const ParserResourcesType& resInfo = _resourcesList[machine];
-  tempOutputFile << "#! /bin/sh" << endl;
-
-  // --- set env vars
-
-  tempOutputFile << "export SALOME_trace=local" << endl; // mkr : 27.11.2006 : PAL13967 - Distributed supervision graphs - Problem with "SALOME_trace"
-  //tempOutputFile << "source " << resInfo.PreReqFilePath << endl;
-
-  // ! env vars
-
-  if (params.isMPI)
-    {
-      tempOutputFile << "mpirun -np ";
-      int nbproc;
-
-      if ( (params.nb_node <= 0) && (params.nb_proc_per_node <= 0) )
-        nbproc = 1;
-      else if ( params.nb_node == 0 )
-        nbproc = params.nb_proc_per_node;
-      else if ( params.nb_proc_per_node == 0 )
-        nbproc = params.nb_node;
-      else
-        nbproc = params.nb_node * params.nb_proc_per_node;
-
-      std::ostringstream o;
-
-      tempOutputFile << nbproc << " ";
-#ifdef WITHLAM
-      tempOutputFile << "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace ";
-#endif
-    }
-
-  tempOutputFile << getenv("KERNEL_ROOT_DIR") << "/bin/salome/";
-
-  if (params.isMPI)
-    {
-      if (isPythonContainer(params.container_name))
-        tempOutputFile << "pyMPI SALOME_ContainerPy.py ";
-      else
-        tempOutputFile << "SALOME_MPIContainer ";
-    }
-
-  else
+  if (std::string(parallelLib) == "Dummy")
+  {
+    MESSAGE("[getMachineFile] parallelLib is Dummy");
+    MapOfParserResourcesType resourcesList = _rm->GetList();
+    if (resourcesList.find(std::string(resource_name)) != resourcesList.end())
     {
-      if (isPythonContainer(params.container_name))
-        tempOutputFile << "SALOME_ContainerPy.py ";
-      else
-        tempOutputFile << "SALOME_Container ";
-    }
-
-  tempOutputFile << _NS->ContainerName(params) << " -";
-  AddOmninamesParams(tempOutputFile);
-  tempOutputFile << " &" << endl;
-  tempOutputFile.flush();
-  tempOutputFile.close();
-  chmod(_TmpFileName.c_str(), 0x1ED);
+      ParserResourcesType resource = resourcesList[std::string(resource_name)];
 
-  // --- Build command
+      // Check if resource is cluster or not
+      if (resource.ClusterMembersList.empty())
+      {
+        //It is not a cluster so we create a cluster with one machine
+        ParserResourcesType fake_node;
+        fake_node.HostName = resource.HostName;
+        fake_node.Protocol = resource.Protocol;
+        fake_node.ClusterInternalProtocol = resource.ClusterInternalProtocol;
+        fake_node.UserName = resource.UserName;
+        fake_node.AppliPath = resource.AppliPath;
+        fake_node.DataForSort = resource.DataForSort;
+
+        resource.ClusterMembersList.push_front(fake_node);
+      }
 
-  string command;
+      // Creating list of machines for creating the machine file
+      std::list<std::string> list_of_machines;
+      std::list<ParserResourcesType>::iterator cluster_it =
+        resource.ClusterMembersList.begin();
+      while (cluster_it != resource.ClusterMembersList.end())
+      {
+        // For each member of the cluster we add a nbOfNodes * nbOfProcPerNode in the list
+        unsigned int number_of_proc = (*cluster_it).DataForSort._nbOfNodes * 
+                                      (*cluster_it).DataForSort._nbOfProcPerNode;
+        for (unsigned int i = 0; i < number_of_proc; i++)
+          list_of_machines.push_back((*cluster_it).HostName);
+        cluster_it++;
+      }
 
-  if (resInfo.Protocol == rsh)
-    {
-      command = "rsh ";
-      string commandRcp = "rcp ";
-      commandRcp += _TmpFileName;
-      commandRcp += " ";
-      commandRcp += machine;
-      commandRcp += ":";
-      commandRcp += _TmpFileName;
-      status = system(commandRcp.c_str());
-    }
+      // Creating machine file
+      machine_file_name = tmpnam(NULL);
+      std::ofstream machine_file(machine_file_name.c_str(), std::ios_base::out);
 
-  else if (resInfo.Protocol == ssh)
-    {
-      command = "ssh ";
-      string commandRcp = "scp ";
-      commandRcp += _TmpFileName;
-      commandRcp += " ";
-      commandRcp += machine;
-      commandRcp += ":";
-      commandRcp += _TmpFileName;
-      status = system(commandRcp.c_str());
+      CORBA::Long machine_number = 0;
+      std::list<std::string>::iterator it = list_of_machines.begin();
+      while (machine_number != nb_procs)
+      {
+        // Adding a new node to the machine file
+        machine_file << *it << std::endl;
+
+        // counting...
+        it++;
+        if (it == list_of_machines.end())
+          it = list_of_machines.begin();
+        machine_number++;
+      }
     }
-  else
-    throw SALOME_Exception("Unknown protocol");
-
-  if(status)
-    throw SALOME_Exception("Error of connection on remote host");    
-
-  command += machine;
-  _CommandForRemAccess = command;
-  command += " ";
-  command += _TmpFileName;
-
-  SCRUTE(command);
-
-  return command;
-
-}
-
-//=============================================================================
-/*! Creates a command line that the container manager uses to launch
- * a parallel container.
- */ 
-//=============================================================================
-string 
-SALOME_ResourcesManager::BuildCommandToLaunchLocalParallelContainer(const std::string& exe_name,
-                                                                   const Engines::MachineParameters& params,
-                                                                   const std::string& log)
-{
-  // This method knows the differences between the proxy and the nodes.
-  // nb_component_nodes is not used in the same way if it is a proxy or 
-  // a node.
-
-  string command;
-  string parallelLib(CORBA::string_dup(params.parallelLib));
-  string hostname(CORBA::string_dup(params.hostname));
-  int par = exe_name.find("Proxy");
-  int nbproc = params.nb_component_nodes;
-  char buffer [33];
-  sprintf(buffer,"%d",nbproc);
-
-  Engines::MachineParameters_var rtn = new Engines::MachineParameters();
-  rtn->container_name = params.container_name;
-  rtn->hostname = params.hostname;
-  rtn->OS = params.OS;
-  rtn->mem_mb = params.mem_mb;
-  rtn->cpu_clock = params.cpu_clock;
-  rtn->nb_proc_per_node = params.nb_proc_per_node;
-  rtn->nb_node = params.nb_node;
-  rtn->isMPI = params.isMPI;
-
-  string real_exe_name  = exe_name + parallelLib;
-
-  if (parallelLib == "Dummy")
-  {
-    //command = "gdb --args ";
-    //command = "valgrind --tool=memcheck --log-file=val_log ";
-    //command += real_exe_name;
-
-    command = real_exe_name;
-
-    command += " " + _NS->ContainerName(rtn);
-    command += " " + parallelLib;
-    command += " " + hostname;
-    command += " -";
-    AddOmninamesParams(command);
+    else
+      INFOS("[getMachineFile] Error resource_name not found in resourcesList -> " << resource_name);
   }
-
-  else if (parallelLib == "Mpi")
+  else if (std::string(parallelLib) == "Mpi")
   {
-    // Step 1 : check if MPI is started
-    if (_MpiStarted == false)
-    {
-      startMPI();
-    }
+    MESSAGE("[getMachineFile] parallelLib is Mpi");
 
-    if (par < 0)
+    MapOfParserResourcesType resourcesList = _rm->GetList();
+    if (resourcesList.find(std::string(resource_name)) != resourcesList.end())
     {
-      // Nodes case
+      ParserResourcesType resource = resourcesList[std::string(resource_name)];
+      // Check if resource is cluster or not
+      if (resource.ClusterMembersList.empty())
+      {
+        //It is not a cluster so we create a cluster with one machine
+        ParserResourcesType fake_node;
+        fake_node.HostName = resource.HostName;
+        fake_node.Protocol = resource.Protocol;
+        fake_node.ClusterInternalProtocol = resource.ClusterInternalProtocol;
+        fake_node.UserName = resource.UserName;
+        fake_node.AppliPath = resource.AppliPath;
+        fake_node.DataForSort = resource.DataForSort;
+
+        resource.ClusterMembersList.push_front(fake_node);
+      }
 
-      command = "mpiexec -np " + string(buffer) + " ";
-//      command += "gdb --args ";
-      command += real_exe_name;
-      command += " " + _NS->ContainerName(rtn);
-      command += " " + parallelLib;
-      command += " " + hostname;
-      command += " -";
-      AddOmninamesParams(command);
-    }
-    else                                          
-    {
-      // Proxy case
-      command = "mpiexec -np 1 ";
-      command += real_exe_name;
-      command += " " + _NS->ContainerName(rtn);
-      command += " " + string(buffer);
-      command += " " + parallelLib;
-      command += " " + hostname;
-      command += " -";
-      AddOmninamesParams(command);
+      // Choose mpi implementation -> each MPI implementation has is own machinefile...
+      if (resource.mpi == lam)
+      {
+        // Creating machine file
+        machine_file_name = tmpnam(NULL);
+        std::ofstream machine_file(machine_file_name.c_str(), std::ios_base::out);
+
+        // We add all cluster machines to the file
+        std::list<ParserResourcesType>::iterator cluster_it =
+          resource.ClusterMembersList.begin();
+        while (cluster_it != resource.ClusterMembersList.end())
+        {
+          unsigned int number_of_proc = (*cluster_it).DataForSort._nbOfNodes * 
+            (*cluster_it).DataForSort._nbOfProcPerNode;
+          machine_file << (*cluster_it).HostName << " cpu=" << number_of_proc << std::endl;
+          cluster_it++;
+        }
+      }
+      else if ((resource.mpi == openmpi) || (resource.mpi == ompi))
+      {
+        // Creating machine file
+        machine_file_name = tmpnam(NULL);
+        std::ofstream machine_file(machine_file_name.c_str(), std::ios_base::out);
+
+        // We add all cluster machines to the file
+        std::list<ParserResourcesType>::iterator cluster_it =
+          resource.ClusterMembersList.begin();
+        while (cluster_it != resource.ClusterMembersList.end())
+        {
+          unsigned int number_of_proc = (*cluster_it).DataForSort._nbOfNodes *
+            (*cluster_it).DataForSort._nbOfProcPerNode;
+          machine_file << (*cluster_it).HostName << " slots=" << number_of_proc << std::endl;
+          cluster_it++;
+        }
+      }
+      else if (resource.mpi == nompi)
+      {
+        INFOS("[getMachineFile] Error resource_name MPI implementation was defined for " << resource_name);
+      }
+      else
+        INFOS("[getMachineFile] Error resource_name MPI implementation not currently handled for " << resource_name);
     }
+    else
+      INFOS("[getMachineFile] Error resource_name not found in resourcesList -> " << resource_name);
   }
   else
-  {
-    std::string message("Unknown parallelLib" + parallelLib);
-    throw SALOME_Exception(message.c_str());
-  }
-
-  // log choice
-  if (log == "default")
-  {
-    command += " > /tmp/";
-    command += _NS->ContainerName(rtn);
-    command += "_";
-    command += GetHostname();
-    command += "_";
-    command += getenv( "USER" ) ;
-    command += ".log 2>&1 &" ;
-  }
-  if (log == "xterm")
-  {
-    command = "/usr/X11R6/bin/xterm -e \"export LD_LIBRARY_PATH=$LD_LIBRARY_PATH; export PATH=$PATH;  " 
-             + command + " \" &";
-//           + command + "; echo $LD_LIBRARY_PATH; cat \" &";
-  }
-  return command;
-
-/*  if (log == "xterm")
-  {
-    command = "/usr/X11R6/bin/xterm -e \"export LD_LIBRARY_PATH=$LD_LIBRARY_PATH; export PATH=$PATH; echo $LD_LIBRARY_PATH; echo $PATH; " + command + "; cat \" &";
-  }
-*/
-/*  command = "cd ; rm " + fichier_commande + "; touch " + \
-            fichier_commande + "; echo \" export LD_LIBRARY_PATH=$LD_LIBRARY_PATH; " + \
-            command + " >& /tmp/ribes_" + fichier_commande + " & \" > " + fichier_commande + ";";
-  command += "ssh cn01 sh " + fichier_commande + " &";
-  cerr << "La commande : " << command << endl;
-*/
-}
-
-void SALOME_ResourcesManager::startMPI()
-{
-  cerr << "----------------------------------------------" << endl;
-  cerr << "----------------------------------------------" << endl;
-  cerr << "----------------------------------------------" << endl;
-  cerr << "-Only Lam on Localhost is currently supported-" << endl;
-  cerr << "----------------------------------------------" << endl;
-  cerr << "----------------------------------------------" << endl;
-  cerr << "----------------------------------------------" << endl;
-
-  int status = system("lamboot");
-  if (status == -1)
-  {
-    INFOS("lamboot failed : system command status -1");
-  }
-  else if (status == 217)
-  {
-    INFOS("lamboot failed : system command status 217");
-  }
-  else
-  {
-    _MpiStarted = true;
-  }
-}
+    INFOS("[getMachineFile] Error parallelLib is not handled -> " << parallelLib);
 
-Engines::MachineParameters* SALOME_ResourcesManager::GetMachineParameters(const char *hostname)
-{
-  ParserResourcesType resource = _resourcesList[string(hostname)];
-  Engines::MachineParameters *p_ptr = new Engines::MachineParameters;
-  p_ptr->container_name = CORBA::string_dup("");
-  p_ptr->hostname = CORBA::string_dup("hostname");
-  p_ptr->alias = CORBA::string_dup(resource.Alias.c_str());
-  if( resource.Protocol == rsh )
-    p_ptr->protocol = "rsh";
-  else if( resource.Protocol == ssh )
-    p_ptr->protocol = "ssh";
-  p_ptr->username = CORBA::string_dup(resource.UserName.c_str());
-  p_ptr->applipath = CORBA::string_dup(resource.AppliPath.c_str());
-  p_ptr->modList.length(resource.ModulesList.size());
-  for(int i=0;i<resource.ModulesList.size();i++)
-    p_ptr->modList[i] = CORBA::string_dup(resource.ModulesList[i].c_str());
-  p_ptr->OS = CORBA::string_dup(resource.OS.c_str());
-  p_ptr->mem_mb = resource.DataForSort._memInMB;
-  p_ptr->cpu_clock = resource.DataForSort._CPUFreqMHz;
-  p_ptr->nb_proc_per_node = resource.DataForSort._nbOfProcPerNode;
-  p_ptr->nb_node = resource.DataForSort._nbOfNodes;
-  if( resource.mpi == indif )
-    p_ptr->mpiImpl = "indif";
-  else if( resource.mpi == lam )
-    p_ptr->mpiImpl = "lam";
-  else if( resource.mpi == mpich1 )
-    p_ptr->mpiImpl = "mpich1";
-  else if( resource.mpi == mpich2 )
-    p_ptr->mpiImpl = "mpich2";
-  else if( resource.mpi == openmpi )
-    p_ptr->mpiImpl = "openmpi";
-  if( resource.Batch == pbs )
-    p_ptr->batch = "pbs";
-  else if( resource.Batch == lsf )
-    p_ptr->batch = "lsf";
-  else if( resource.Batch == slurm )
-    p_ptr->batch = "slurm";
-  return p_ptr;
+  return CORBA::string_dup(machine_file_name.c_str());
 }