]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
CCAR: add default resource in Resource Mananger (localhost) V5_1_4a1
authorcaremoli <caremoli>
Thu, 15 Apr 2010 08:45:58 +0000 (08:45 +0000)
committercaremoli <caremoli>
Thu, 15 Apr 2010 08:45:58 +0000 (08:45 +0000)
and catch salome_exception in LifeCycle

src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx
src/ResourcesManager/ResourcesManager.cxx
src/ResourcesManager/SALOME_ResourcesCatalog_Handler.cxx

index 491f4ff3fea07e612ea3b60cabb0213db8518a9a..41481e449edd81634ea4ee3f509072a38db5e69b 100644 (file)
@@ -140,7 +140,15 @@ SALOME_LifeCycleCORBA::FindComponent(const Engines::MachineParameters& params,
   convert(params, new_params);
   new_params.resource_params.componentList.length(1);
   new_params.resource_params.componentList[0] = componentName;
-  Engines::ResourceList_var listOfResources = _ResManager->GetFittingResources(new_params.resource_params);
+  Engines::ResourceList_var listOfResources;
+  try
+    {
+      listOfResources = _ResManager->GetFittingResources(new_params.resource_params);
+    }
+  catch( const SALOME::SALOME_Exception& ex )
+    {
+      return Engines::Component::_nil();
+    }
 
   Engines::Component_var compo = _FindComponent(new_params,
                                                 componentName,
@@ -175,7 +183,15 @@ SALOME_LifeCycleCORBA::LoadComponent(const Engines::MachineParameters& params,
   new_params.resource_params.componentList.length(1);
   new_params.resource_params.componentList[0] = componentName;
 
-  Engines::ResourceList_var listOfResources = _ResManager->GetFittingResources(new_params.resource_params);
+  Engines::ResourceList_var listOfResources;
+  try
+    {
+      listOfResources = _ResManager->GetFittingResources(new_params.resource_params);
+    }
+  catch( const SALOME::SALOME_Exception& ex )
+    {
+      return Engines::Component::_nil();
+    }
   new_params.resource_params.resList = listOfResources;
 
   Engines::Component_var compo = _LoadComponent(new_params,
@@ -219,7 +235,15 @@ FindOrLoad_Component(const Engines::MachineParameters& params,
     new_params.resource_params.name = CORBA::string_dup(Kernel_Utils::GetHostname().c_str());
   }
 
-  Engines::ResourceList_var listOfResources = _ResManager->GetFittingResources(new_params.resource_params);
+  Engines::ResourceList_var listOfResources;
+  try
+    {
+      listOfResources = _ResManager->GetFittingResources(new_params.resource_params);
+    }
+  catch( const SALOME::SALOME_Exception& ex )
+    {
+      return Engines::Component::_nil();
+    }
 
   Engines::Component_var compo = _FindComponent(new_params,
                                                 componentName,
@@ -252,7 +276,15 @@ FindOrLoad_Component(const Engines::ContainerParameters& params,
   new_params.resource_params.componentList.length(1);
   new_params.resource_params.componentList[0] = componentName;
 
-  Engines::ResourceList_var listOfResources = _ResManager->GetFittingResources(new_params.resource_params);
+  Engines::ResourceList_var listOfResources;
+  try
+    {
+      listOfResources = _ResManager->GetFittingResources(new_params.resource_params);
+    }
+  catch( const SALOME::SALOME_Exception& ex )
+    {
+      return Engines::Component::_nil();
+    }
 
   Engines::Component_var compo = _FindComponent(new_params,
                                                 componentName,
index 5beadabaadac5c63b3a9288aee4454941ab1770c..e2c94b597912a032f10c0e465e29111d4f1555f1 100644 (file)
@@ -247,7 +247,7 @@ ResourcesManager_cpp::GetFittingResources(const resourceParams& params) throw(Re
   // Send an exception if return list is empty...
   if (vec.size() == 0)
   {
-    std::string error("[GetFittingResources] ResourcesManager doesn't find any resource that feets to your parameters");
+    std::string error("[GetFittingResources] ResourcesManager doesn't find any resource that fits to your parameters");
     throw ResourcesException(error);
   }
 
index 316c695d9ddab85fe4fc20844fbc4527f748ce9e..62ff1255471d283f24eab357ead3a83b0afd2fa0 100755 (executable)
@@ -103,6 +103,13 @@ void SALOME_ResourcesCatalog_Handler::ProcessXmlDocument(xmlDocPtr theDoc)
   // Empty private elements
   _resources_list.clear();
 
+  //default resources
+  _resource.Clear();
+       _resource.HostName = Kernel_Utils::GetHostname();
+       _resource.Name = Kernel_Utils::GetHostname();
+       _resource.DataForSort._Name = Kernel_Utils::GetHostname();
+       _resources_list[Kernel_Utils::GetHostname()] = _resource;
+
   // Get the document root node
   xmlNodePtr aCurNode = xmlDocGetRootElement(theDoc);