Salome HOME
updated copyright message
[modules/kernel.git] / src / ResourcesManager / SALOME_ResourcesCatalog_Parser.cxx
index a937d0fe40bbc6afd55c4085d5140152c76edd6f..037297f17830b2f0166b73492098c351894f1b00 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2012  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
@@ -21,7 +21,6 @@
 //
 
 #include "SALOME_ResourcesCatalog_Parser.hxx"
-#include "Utils_SALOME_Exception.hxx"
 #include <iostream>
 #include <sstream>
 
@@ -133,9 +132,9 @@ void ResourceDataToSort::Print() const
 
 
 ParserResourcesType::ParserResourcesType()
-: type(single_machine),
-  Protocol(ssh),
+: Protocol(ssh),
   ClusterInternalProtocol(ssh),
+  type(single_machine),
   Batch(none),
   mpi(nompi),
   nbOfProc(1),
@@ -169,8 +168,10 @@ std::string ParserResourcesType::protocolToString(AccessProtocolType protocol)
     return "pbsdsh";
   case blaunch:
     return "blaunch";
+  case rsync:
+    return "rsync";
   default:
-    throw SALOME_Exception("Unknown protocol");
+    throw ResourcesException("Unknown protocol");
   }
 }
 
@@ -188,8 +189,10 @@ AccessProtocolType ParserResourcesType::stringToProtocol(const std::string & pro
     return pbsdsh;
   else if (protocolStr == "blaunch")
     return blaunch;
+  else if (protocolStr == "rsync")
+    return rsync;
   else
-    throw SALOME_Exception((string("Unknown protocol ") + protocolStr).c_str());
+    throw ResourcesException((string("Unknown protocol ") + protocolStr).c_str());
 }
 
 ostream & operator<<(ostream &os, const ParserResourcesType &prt)
@@ -249,7 +252,7 @@ ParserResourcesType::getResourceTypeStr() const
   case single_machine:
     return "single_machine";
   default:
-    throw SALOME_Exception("Unknown resource type");
+    throw ResourcesException("Unknown resource type");
   }
 }
 
@@ -274,10 +277,12 @@ ParserResourcesType::getBatchTypeStr() const
     return "ll";
   case vishnu:
     return "vishnu";
-  case ssh_batch:
-    return "ssh_batch";
+  case oar:
+    return "oar";
+  case coorm:
+    return "coorm";
   default:
-    throw SALOME_Exception("Unknown batch type");
+    throw ResourcesException("Unknown batch type");
   }
 }
 
@@ -303,7 +308,7 @@ ParserResourcesType::getMpiImplTypeStr() const
   case prun:
     return "prun";
   default:
-    throw SALOME_Exception("Unknown MPI implementation type");
+    throw ResourcesException("Unknown MPI implementation type");
   }
 }
 
@@ -329,7 +334,7 @@ void ParserResourcesType::setResourceTypeStr(const string & resourceTypeStr)
   else if (resourceTypeStr == "single_machine")
     type = single_machine;
   else
-    throw SALOME_Exception((string("Unknown resource type ") + resourceTypeStr).c_str());
+    throw ResourcesException((string("Unknown resource type ") + resourceTypeStr).c_str());
 }
 
 void ParserResourcesType::setBatchTypeStr(const string & batchTypeStr)
@@ -344,16 +349,18 @@ void ParserResourcesType::setBatchTypeStr(const string & batchTypeStr)
     Batch = slurm;
   else if (batchTypeStr == "ccc")
     Batch = ccc;
-  else if (batchTypeStr == "ssh_batch")
-    Batch = ssh_batch;
   else if (batchTypeStr == "ll")
     Batch = ll;
   else if (batchTypeStr == "vishnu")
     Batch = vishnu;
-  else if (batchTypeStr == "")
+  else if (batchTypeStr == "oar")
+    Batch = oar;
+  else if (batchTypeStr == "coorm")
+    Batch = coorm;
+  else if (batchTypeStr == "" || batchTypeStr == "none" || batchTypeStr == "ssh_batch")
     Batch = none;
   else
-    throw SALOME_Exception((string("Unknown batch type ") + batchTypeStr).c_str());
+    throw ResourcesException((string("Unknown batch type ") + batchTypeStr).c_str());
 }
 
 void ParserResourcesType::setMpiImplTypeStr(const string & mpiImplTypeStr)
@@ -375,7 +382,7 @@ void ParserResourcesType::setMpiImplTypeStr(const string & mpiImplTypeStr)
   else if (mpiImplTypeStr == "" || mpiImplTypeStr == "no mpi")
     mpi = nompi;
   else
-    throw SALOME_Exception((string("Unknown MPI implementation type ") + mpiImplTypeStr).c_str());
+    throw ResourcesException((string("Unknown MPI implementation type ") + mpiImplTypeStr).c_str());
 }
 
 void ParserResourcesType::setClusterInternalProtocolStr(const string & internalProtocolTypeStr)
@@ -390,7 +397,7 @@ void ParserResourcesType::setCanLaunchBatchJobsStr(const string & canLaunchBatch
   else if (canLaunchBatchJobsStr == "false")
     can_launch_batch_jobs = false;
   else
-    throw SALOME_Exception((string("Invalid boolean value for can_launch_batch_jobs: ") +
+    throw ResourcesException((string("Invalid boolean value for can_launch_batch_jobs: ") +
                             canLaunchBatchJobsStr).c_str());
 }
 
@@ -401,6 +408,6 @@ void ParserResourcesType::setCanRunContainersStr(const string & canRunContainers
   else if (canRunContainersStr == "false")
     can_run_containers = false;
   else
-    throw SALOME_Exception((string("Invalid boolean value for can_run_containers: ") +
+    throw ResourcesException((string("Invalid boolean value for can_run_containers: ") +
                             canRunContainersStr).c_str());
 }