Salome HOME
Some tests are modified to work in session less mode.
[modules/yacs.git] / src / runtime / SalomeContainer.cxx
index 2d1583e2755407f0999fe7dd9bbf6b2eae9f97cb..65ed0ed67208e26b408088d5babcc5ff9cbca150 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2006-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2006-2021  CEA/DEN, EDF R&D
 //
 // 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
@@ -29,9 +29,9 @@
 #include "RuntimeSALOME.hxx"
 #include "SalomeContainer.hxx"
 #include "SalomeComponent.hxx"
+#include "ServiceNode.hxx"
 #include "Proc.hxx"
 
-#include "SALOME_NamingService.hxx"
 #include "SALOME_LifeCycleCORBA.hxx"
 #include "SALOME_ContainerManager.hxx"
 #include "Basics_Utils.hxx"
@@ -40,7 +40,7 @@
 #include <sstream>
 #include <iostream>
 
-#ifdef WNT
+#ifdef WIN32
 #include <process.h>
 #define getpid _getpid
 #endif
 using namespace YACS::ENGINE;
 using namespace std;
 
-SalomeContainer::SalomeContainer():_trueCont(Engines::Container::_nil()),_type("mono"),_shutdownLevel(999)
+const char SalomeContainer::KIND[]="Salome";
+
+const char SalomeContainer::TYPE_PROPERTY_STR[]="type";
+
+SalomeContainer::SalomeContainer():_launchModeType(new SalomeContainerMonoHelper),_shutdownLevel(999)
 {
-  /* Init ContainerParameters */
-  SALOME_LifeCycleCORBA::preSet(_params);
-  _params.mode= "start";
 }
 
 SalomeContainer::SalomeContainer(const SalomeContainer& other)
-: Container(other),
-  _trueCont(Engines::Container::_nil()),
-  _type(other._type),
+: Container(other),_componentNames(other._componentNames),
+  _launchModeType(other._launchModeType->deepCpyOnlyStaticInfo()),
   _shutdownLevel(other._shutdownLevel),
-  _params(other._params)
+  _sct(other._sct)
+{
+}
+
+SalomeContainer::SalomeContainer(const Container& other, const SalomeContainerTools& sct, const SalomeContainerHelper *lmt,
+                                 const std::vector<std::string>& componentNames, int shutdownLev):Container(other),_componentNames(componentNames),
+                                     _launchModeType(const_cast<SalomeContainerHelper *>(lmt)),_shutdownLevel(shutdownLev),_sct(sct)
 {
+  if(lmt)
+    lmt->incrRef();
 }
 
 SalomeContainer::~SalomeContainer()
 {
+  _launchModeType->decrRef();
 }
 
 void SalomeContainer::lock()
@@ -78,7 +87,12 @@ void SalomeContainer::lock()
 
 void SalomeContainer::unLock()
 {
-  _mutex.unlock();
+  _mutex.unLock();
+}
+
+std::string SalomeContainer::getKind() const
+{
+  return KIND;
 }
 
 Container *SalomeContainer::clone() const
@@ -92,7 +106,12 @@ Container *SalomeContainer::clone() const
     return new SalomeContainer(*this);
 }
 
-void SalomeContainer::checkCapabilityToDealWith(const ComponentInstance *inst) const throw(YACS::Exception)
+Container *SalomeContainer::cloneAlways() const
+{
+  return new SalomeContainer(*this);
+}
+
+void SalomeContainer::checkCapabilityToDealWith(const ComponentInstance *inst) const
 {
   if(inst->getKind()!=SalomeComponent::KIND)
     throw Exception("SalomeContainer::checkCapabilityToDealWith : SalomeContainer is not able to deal with this type of ComponentInstance.");
@@ -100,228 +119,66 @@ void SalomeContainer::checkCapabilityToDealWith(const ComponentInstance *inst) c
 
 void SalomeContainer::setProperty(const std::string& name, const std::string& value)
 {
-  DEBTRACE("SalomeContainer::setProperty : " << name << " ; " << value);
-   
-  // Container Part
-  if (name == "container_name")
-    _params.container_name = CORBA::string_dup(value.c_str());
-  else if (name == "type")
-  {
-    if (value == "mono")
-      _params.mode = "start";
-    else if (value == "multi")
-      _params.mode = "getorstart";
-    else 
-      throw Exception("SalomeContainer::setProperty : type value is not correct (mono or multi): " + value);
-    _type=value;
-  }
-  else if (name == "workingdir")
-    _params.workingdir = CORBA::string_dup(value.c_str());
-  else if (name == "nb_parallel_procs")
-  {
-    std::istringstream iss(value);
-    if (!(iss >> _params.nb_proc))
-      throw Exception("salomecontainer::setproperty : params.nb_proc value not correct : " + value);
-  }
-  else if (name == "isMPI")
-  {
-    if (value == "true")
-      _params.isMPI = true;
-    else if (value == "false")
-      _params.isMPI = false;
-    else 
-      throw Exception("SalomeContainer::setProperty : params.isMPI value not correct : " + value);
-  }
-  else if (name == "parallelLib")
-    _params.parallelLib = CORBA::string_dup(value.c_str());
-
-  // Resource part
-  else if (name == "name")
-    _params.resource_params.name = CORBA::string_dup(value.c_str());
-  else if (name == "hostname")
-    _params.resource_params.hostname = CORBA::string_dup(value.c_str());
-  else if (name == "OS")
-    _params.resource_params.OS = CORBA::string_dup(value.c_str());
-  else if (name == "nb_resource_procs")
-  {
-    std::istringstream iss(value);
-    if (!(iss >> _params.resource_params.nb_proc))
-      throw Exception("salomecontainer::setproperty : params.resource_params.nb_proc value not correct : " + value);
-  }
-  else if (name == "mem_mb")
-  {
-    std::istringstream iss(value);
-    if (!(iss >> _params.resource_params.mem_mb))
-      throw Exception("salomecontainer::setproperty : params.resource_params.mem_mb value not correct : " + value);
-  }
-  else if (name == "cpu_clock")
-  {
-    std::istringstream iss(value);
-    if (!(iss >> _params.resource_params.cpu_clock))
-      throw Exception("salomecontainer::setproperty : params.resource_params.cpu_clock value not correct : " + value);
-  }
-  else if (name == "nb_node")
-  {
-    std::istringstream iss(value);
-    if (!(iss >> _params.resource_params.nb_node))
-      throw Exception("salomecontainer::setproperty : params.nb_node value not correct : " + value);
-  }
-  else if (name == "nb_proc_per_node")
-  {
-    std::istringstream iss(value);
-    if (!(iss >> _params.resource_params.nb_proc_per_node))
-      throw Exception("salomecontainer::setproperty : params.nb_proc_per_node value not correct : " + value);
-  }
-  else if (name == "policy")
-    _params.resource_params.policy = CORBA::string_dup(value.c_str());
-  else if (name == "component_list")
-  {
-    std::string clean_value(value);
-
-    // Step 1: remove blanks
-    while(clean_value.find(" ") != std::string::npos)
-      clean_value = clean_value.erase(clean_value.find(" "), 1);
-
-    // Step 2: get values
-    while(!clean_value.empty())
+  if (name == AOC_ENTRY)
     {
-      std::string result("");
-      std::string::size_type loc = clean_value.find(",", 0);
-      if (loc != std::string::npos)
-      {
-        result = clean_value.substr(0, loc);
-        clean_value = clean_value.erase(0, loc+1);
-      }
+      std::istringstream iss(value);
+      int val;
+      iss >> val;
+      setAttachOnCloningStatus((bool)val);
+    }
+  else if (name == TYPE_PROPERTY_STR)
+    {
+      if (value == SalomeContainerMonoHelper::TYPE_NAME)
+        {
+          _launchModeType->decrRef();
+          _launchModeType=new SalomeContainerMonoHelper;
+        }
+      else if (value == SalomeContainerMultiHelper::TYPE_NAME)
+        {
+          _launchModeType->decrRef();
+          _launchModeType=new SalomeContainerMultiHelper;
+        }
       else
-      {
-        result = clean_value;
-        clean_value.erase();
-      }
-      if (result != "," && result != "")
-      {
-        addToComponentList(result);
-      }
+        throw Exception("SalomeContainer::setProperty : type value is not correct (mono or multi): " + value);
     }
+  _sct.setProperty(name,value);
+}
 
-  }
-  else if (name == "resource_list")
-  {
-    std::string clean_value(value);
-
-    // Step 1: remove blanks
-    while(clean_value.find(" ") != std::string::npos)
-      clean_value = clean_value.erase(clean_value.find(" "), 1);
-
-    // Step 2: get values
-    while(!clean_value.empty())
+std::string SalomeContainer::getProperty(const std::string& name) const
+{
+  if (name == TYPE_PROPERTY_STR)
+    return _launchModeType->getType();
+  if (name==AOC_ENTRY)
     {
-      std::string result("");
-      std::string::size_type loc = clean_value.find(",", 0);
-      if (loc != std::string::npos)
-      {
-        result = clean_value.substr(0, loc);
-        clean_value = clean_value.erase(0, loc+1);
-      }
-      else
-      {
-        result = clean_value;
-        clean_value.erase();
-      }
-      if (result != "," && result != "")
-      {
-        addToResourceList(result);
-      }
+      int reti(_isAttachedOnCloning);
+      std::ostringstream oss; oss << reti;
+      return oss.str();
     }
+  return _sct.getProperty(name);
+}
 
-  }
-  // End
-  Container::setProperty(name, value);
+void SalomeContainer::clearProperties()
+{
+  _sct.clearProperties();
 }
 
-void SalomeContainer::addComponentName(std::string name)
+void SalomeContainer::addComponentName(const std::string& name)
 {
   _componentNames.push_back(name);
 }
 
+void SalomeContainer::addToResourceList(const std::string& name)
+{
+  _sct.addToResourceList(name);
+}
+
 //! Load a component instance in this container
 /*!
  * \param inst the component instance to load
  */
-CORBA::Object_ptr SalomeContainer::loadComponent(ComponentInstance *inst)
+CORBA::Object_ptr SalomeContainer::loadComponent(Task *askingNode)
 {
-  DEBTRACE("SalomeContainer::loadComponent ");
-  lock();//To be sure
-  if(!isAlreadyStarted(inst))
-    {
-      try
-        {
-          start(inst);
-        }
-      catch(Exception& e)
-        {
-          unLock();
-          throw e;
-        }
-    }
-  unLock();
-  lock();//To be sure
-  CORBA::Object_ptr objComponent=CORBA::Object::_nil();
-  std::string compoName=inst->getCompoName();
-  const char* componentName=compoName.c_str();
-  Engines::Container_var container;
-  if(_type=="multi")
-    container=_trueContainers[inst];
-  else
-    container=_trueCont;
-
-  char* reason;
-
-  bool isLoadable = container->load_component_Library(componentName, reason);
-  if (isLoadable)
-    {
-      CORBA::string_free(reason);
-      int studyid=1;
-      Proc* p=getProc();
-      if(p)
-        {
-          std::string value=p->getProperty("DefaultStudyID");
-          if(!value.empty())
-            studyid= atoi(value.c_str());
-        }
-      // prepare component instance properties
-      Engines::FieldsDict_var env = new Engines::FieldsDict;
-      std::map<std::string, std::string> properties = inst->getProperties();
-      if(p)
-        {
-          std::map<std::string,std::string> procMap=p->getProperties();
-          properties.insert(procMap.begin(),procMap.end());
-        }
-
-      std::map<std::string, std::string>::const_iterator itm;
-      env->length(properties.size());
-      int item=0;
-      for(itm = properties.begin(); itm != properties.end(); ++itm, item++)
-        {
-          DEBTRACE("envname="<<itm->first<<" envvalue="<< itm->second);
-          env[item].key= CORBA::string_dup(itm->first.c_str());
-          env[item].value <<= itm->second.c_str();
-        }
-
-      objComponent=container->create_component_instance_env(componentName, studyid, env, reason);
-    }
-
-  if(CORBA::is_nil(objComponent))
-    {
-      unLock();
-      std::string text="Error while trying to create a new component: component '"+ compoName;
-      text=text+"' is not installed or it's a wrong name";
-      text += '\n';
-      text += reason;
-      CORBA::string_free(reason);
-      throw Exception(text);
-    }
-  unLock();
-  return objComponent;
+  return SalomeContainerTools::LoadComponent(_launchModeType,this,askingNode);
 }
 
 //! Get the container placement id for a component instance
@@ -329,30 +186,9 @@ CORBA::Object_ptr SalomeContainer::loadComponent(ComponentInstance *inst)
  * \param inst the component instance
  * \return the placement id
  */
-std::string SalomeContainer::getPlacementId(const ComponentInstance *inst) const
+std::string SalomeContainer::getPlacementId(const Task *askingNode) const
 {
-
-  if(isAlreadyStarted(inst))
-    {
-      Engines::Container_var container=_trueCont;
-      if(_type=="multi")
-        {
-          std::map<const ComponentInstance *, Engines::Container_var>::const_iterator found = _trueContainers.find(inst);
-          container=found->second;
-        }
-      const char *what="/";
-      CORBA::String_var corbaStr=container->name();
-      string ret(corbaStr);
-
-      //Salome FOREVER ...
-      std::string::size_type i=ret.find_first_of(what,0);
-      i=ret.find_first_of(what, i==std::string::npos ? i:i+1);
-      if(i!=std::string::npos)
-        return ret.substr(i+1);
-      return ret;
-    }
-  else
-    return "Not placed yet !!!";
+  return SalomeContainerTools::GetPlacementId(_launchModeType,this,askingNode);
 }
 
 //! Get the container full path for a component instance
@@ -360,30 +196,9 @@ std::string SalomeContainer::getPlacementId(const ComponentInstance *inst) const
  * \param inst the component instance
  * \return the full placement id
  */
-std::string SalomeContainer::getFullPlacementId(const ComponentInstance *inst) const
+std::string SalomeContainer::getFullPlacementId(const Task *askingNode) const
 {
-
-  if(isAlreadyStarted(inst))
-    {
-      Engines::Container_var container=_trueCont;
-      if(_type=="multi")
-        {
-          std::map<const ComponentInstance *, Engines::Container_var>::const_iterator found = _trueContainers.find(inst);
-          container=found->second;
-        }
-      try
-        {
-          CORBA::String_var corbaStr=container->name();
-          string ret(corbaStr);
-          return ret;
-        }
-      catch(...)
-        {
-          return "Unknown_placement";
-        }
-    }
-  else
-    return "Not_placed_yet";
+  return SalomeContainerTools::GetFullPlacementId(_launchModeType,this,askingNode);
 }
 
 //! Check if the component instance container is already started
@@ -391,174 +206,47 @@ std::string SalomeContainer::getFullPlacementId(const ComponentInstance *inst) c
  * \param inst the component instance
  * \return true, if the container is already started, else false
  */
-bool SalomeContainer::isAlreadyStarted(const ComponentInstance *inst) const
+bool SalomeContainer::isAlreadyStarted(const Task *askingNode) const
 {
-  if(_type=="mono")
-    {
-      if(CORBA::is_nil(_trueCont))
-        return false;
-      else
-        return true;
-    }
-  else
-    {
-      if(_trueContainers.count(inst)==0)
-        return false;
-      else
-        return true;
-    }
+  return _launchModeType->isAlreadyStarted(askingNode);
 }
 
-Engines::Container_ptr SalomeContainer::getContainerPtr(const ComponentInstance *inst) const
+Engines::Container_ptr SalomeContainer::getContainerPtr(const Task *askingNode) const
 {
-  if(_type=="mono")
-    {
-      if(CORBA::is_nil(_trueCont))
-        return Engines::Container::_nil();
-      else
-        return Engines::Container::_duplicate(_trueCont);
-    }
-  else
-    {
-      if(_trueContainers.count(inst)==0)
-        return Engines::Container::_nil();
-      else
-        {
-          std::map<const ComponentInstance *,Engines::Container_var>::const_iterator iter=_trueContainers.find(inst);
-          return Engines::Container::_duplicate(iter->second);
-        }
-    }
+  return Engines::Container::_duplicate(_launchModeType->getContainer(askingNode));
 }
 
 //! Start a salome container (true salome container not yacs one) with given ContainerParameters (_params)
 /*!
  * \param inst the component instance
  */
-void SalomeContainer::start(const ComponentInstance *inst) throw(YACS::Exception)
+void SalomeContainer::start(const Task *askingNode)
 {
-  CORBA::ORB_ptr orb=getSALOMERuntime()->getOrb();
-  SALOME_NamingService ns;
-  try
-    {
-      ns.init_orb(orb);
-    }
-  catch(SALOME_Exception& e)
-    {
-      throw Exception("SalomeContainer::start : Unable to contact the SALOME Naming Service");
-    }
-  CORBA::Object_var obj=ns.Resolve(SALOME_ContainerManager::_ContainerManagerNameInNS);
-  Engines::ContainerManager_var contManager=Engines::ContainerManager::_narrow(obj);
-
-  std::string str(_params.container_name);
-  DEBTRACE("SalomeContainer::start " << str <<";"<<_params.resource_params.hostname <<";"<<_type);
-
-  // Finalize parameters with components found in the container
-  std::vector<std::string>::iterator iter;
-  for(CORBA::ULong i=0; i < _componentNames.size();i++)
-    addToComponentList(_componentNames[i]);
-  Engines::ContainerParameters myparams = _params;
-
-  bool namedContainer=false;
-  if(str != "")
-    namedContainer=true;
-
-  //If a container_name is given try to find an already existing container in naming service
-  //If not found start a new container with the given parameters
-  if (_type=="mono" && str != "")
-    {
-      myparams.mode="getorstart";
-    }
+  SalomeContainerTools::Start(_componentNames,_launchModeType,_sct,_shutdownLevel,this,askingNode);
+}
 
-  if (str == "")
+void SalomeContainer::start(const Task *askingNode,
+                            const std::string& resource_name,
+                            const std::string& container_name)
+{
+  if(canAcceptImposedResource()
+    && askingNode != nullptr
+    && askingNode->hasImposedResource())
   {
-    //give a almost unique name to the container : Pid_Name_Addr
-    std::ostringstream stream;
-    stream << getpid();
-    stream << "_";
-    stream << _name;
-    stream << "_";
-    stream << (void *)(this);
-    DEBTRACE("container_name="<<stream.str());
-    myparams.container_name=CORBA::string_dup(stream.str().c_str());
-    _shutdownLevel=1;
+    SalomeContainerTools tempSct = _sct;
+    tempSct.setProperty("name", resource_name);
+    tempSct.setProperty("container_name", container_name);
+    // components are not supported yet on this kind of start
+    std::vector<std::string> noComponentNames;
+    SalomeContainerTools::Start(noComponentNames,_launchModeType,tempSct,_shutdownLevel,this,askingNode);
   }
+  else
+    start(askingNode);
+}
 
-  _trueCont=Engines::Container::_nil();
-  if(namedContainer && _shutdownLevel==999)
-    {
-      //Make this only the first time start is called (_shutdownLevel==999)
-      //If the container is named, first try to get an existing container
-      //If there is an existing container use it and set the shutdown level to 3
-      //If there is no existing container, try to launch a new one and set the shutdown level to 2
-      myparams.mode="get";
-      try
-        { 
-          _trueCont=contManager->GiveContainer(myparams);
-        }
-      catch( const SALOME::SALOME_Exception& ex )
-        {
-          std::string msg="SalomeContainer::start : no existing container : ";
-          msg += '\n';
-          msg += ex.details.text.in();
-          DEBTRACE( msg );
-        }
-      catch(...)
-        {
-        }
-
-      if(!CORBA::is_nil(_trueCont))
-        {
-          _shutdownLevel=3;
-          DEBTRACE( "container found: " << str << " " << _shutdownLevel );
-        }
-      else
-        {
-          _shutdownLevel=2;
-          myparams.mode="start";
-          DEBTRACE( "container not found: " << str << " " << _shutdownLevel);
-        }
-    }
-
-  if(CORBA::is_nil(_trueCont))
-    try
-      { 
-        // --- GiveContainer is used in batch mode to retreive launched containers,
-        //     and is equivalent to StartContainer when not in batch.
-        _trueCont=contManager->GiveContainer(myparams);
-      }
-    catch( const SALOME::SALOME_Exception& ex )
-      {
-        std::string msg="SalomeContainer::start : Unable to launch container in Salome : ";
-        msg += '\n';
-        msg += ex.details.text.in();
-        throw Exception(msg);
-      }
-    catch(CORBA::COMM_FAILURE&)
-      {
-        throw Exception("SalomeContainer::start : Unable to launch container in Salome : CORBA Comm failure detected");
-      }
-    catch(CORBA::Exception&)
-      {
-        throw Exception("SalomeContainer::start : Unable to launch container in Salome : Unexpected CORBA failure detected");
-      }
-
-  if(CORBA::is_nil(_trueCont))
-    throw Exception("SalomeContainer::start : Unable to launch container in Salome. Check your CatalogResources.xml file");
-
-  _trueContainers[inst]=_trueCont;
-
-  CORBA::String_var containerName=_trueCont->name();
-  CORBA::String_var hostName=_trueCont->getHostName();
-  std::cerr << "SalomeContainer launched : " << containerName << " " << hostName << " " << _trueCont->getPID() << std::endl;
-
-#ifdef REFCNT
-    DEBTRACE(_trueCont->_PR_getobj()->pd_refCount );
-    std::map<const ComponentInstance *, Engines::Container_var >::const_iterator it;
-    for(it = _trueContainers.begin(); it != _trueContainers.end(); ++it)
-      {
-        DEBTRACE(it->second->_PR_getobj()->pd_refCount );
-      }
-#endif
+bool SalomeContainer::canAcceptImposedResource()
+{
+  return _launchModeType->getType() == SalomeContainerMultiHelper::TYPE_NAME;
 }
 
 void SalomeContainer::shutdown(int level)
@@ -569,117 +257,15 @@ void SalomeContainer::shutdown(int level)
 
   _shutdownLevel=999;
   //shutdown the SALOME containers
-  if(_type=="multi")
-    {
-      std::map<const ComponentInstance *, Engines::Container_var >::const_iterator it;
-      for(it = _trueContainers.begin(); it != _trueContainers.end(); ++it)
-        {
-          try
-            {
-              DEBTRACE("shutdown SALOME container: " );
-              CORBA::String_var containerName=it->second->name();
-              DEBTRACE(containerName);
-              it->second->Shutdown();
-              std::cerr << "shutdown SALOME container: " << containerName << std::endl;
-            }
-          catch(CORBA::Exception&)
-            {
-              DEBTRACE("Unexpected CORBA failure detected." );
-            }
-          catch(...)
-            {
-              DEBTRACE("Unknown exception ignored." );
-            }
-        }
-      _trueContainers.clear();
-    }
-  else
-    {
-      try
-        {
-          DEBTRACE("shutdown SALOME container: " );
-          CORBA::String_var containerName=_trueCont->name();
-          DEBTRACE(containerName);
-          _trueCont->Shutdown();
-          std::cerr << "shutdown SALOME container: " << containerName << std::endl;
-        }
-      catch(...)
-        {
-          DEBTRACE("Unknown exception ignored." );
-        }
-      _trueCont=Engines::Container::_nil();
-    }
+  _launchModeType->shutdown();
 }
 
-void
-SalomeContainer::addToComponentList(const std::string & name)
+std::map<std::string,std::string> SalomeContainer::getResourceProperties(const std::string& name) const
 {
-  // Search if name is already in the list
-  for (CORBA::ULong i = 0; i < _params.resource_params.componentList.length(); i++)
-  {
-    std::string component_name = _params.resource_params.componentList[i].in();
-    if (component_name == name)
-      return;
-  }
-
-  // Add name to list
-  CORBA::ULong lgth = _params.resource_params.componentList.length();
-  _params.resource_params.componentList.length(lgth + 1);
-  _params.resource_params.componentList[lgth] = CORBA::string_dup(name.c_str());
+  return _sct.getResourceProperties(name);
 }
 
-void
-SalomeContainer::addToResourceList(const std::string & name)
+std::map<std::string,std::string> SalomeContainer::getProperties() const
 {
-  // Search if name is already in the list
-  for (CORBA::ULong i = 0; i < _params.resource_params.resList.length(); i++)
-  {
-    std::string component_name = _params.resource_params.resList[i].in();
-    if (component_name == name)
-      return;
-  }
-
-  // Add name to list
-  CORBA::ULong lgth = _params.resource_params.resList.length();
-  _params.resource_params.resList.length(lgth + 1);
-  _params.resource_params.resList[lgth] = CORBA::string_dup(name.c_str());
-}
-
-std::map<std::string,std::string> SalomeContainer::getResourceProperties(const std::string& name)
-{
-  std::map<std::string,std::string> properties;
-
-  YACS::ENGINE::RuntimeSALOME* runTime = YACS::ENGINE::getSALOMERuntime();
-  CORBA::ORB_ptr orb = runTime->getOrb();
-  if (!orb) return properties;
-  SALOME_NamingService namingService(orb);
-  SALOME_LifeCycleCORBA lcc(&namingService);
-  CORBA::Object_var obj = namingService.Resolve(SALOME_ResourcesManager::_ResourcesManagerNameInNS);
-  if (CORBA::is_nil(obj)) return properties;
-  Engines::ResourcesManager_var resManager = Engines::ResourcesManager::_narrow(obj);
-  if (CORBA::is_nil(resManager)) return properties;
-
-  std::ostringstream value;
-  Engines::ResourceDefinition_var resource_definition = resManager->GetResourceDefinition(name.c_str());
-  properties["hostname"]=resource_definition->hostname.in();
-  properties["OS"]=resource_definition->OS.in();
-  value.str(""); value << resource_definition->mem_mb;
-  properties["mem_mb"]=value.str();
-  value.str(""); value << resource_definition->cpu_clock;
-  properties["cpu_clock"]=value.str();
-  value.str(""); value << resource_definition->nb_node;
-  properties["nb_node"]=value.str();
-  value.str(""); value << resource_definition->nb_proc_per_node;
-  properties["nb_proc_per_node"]=value.str();
-  /*
-  properties["component_list"]="";
-  for(CORBA::ULong i=0; i < resource_definition->componentList.length(); i++)
-    {
-      if(i > 0)
-        properties["component_list"]=properties["component_list"]+",";
-      properties["component_list"]=properties["component_list"]+resource_definition->componentList[i].in();
-    }
-    */
-
-  return properties;
+  return _sct.getProperties();
 }