Salome HOME
Some tests are modified to work in session less mode.
[modules/yacs.git] / src / runtime / SalomeContainer.cxx
index 137d7027532ed008044c399f7c4a97126517ed3f..65ed0ed67208e26b408088d5babcc5ff9cbca150 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2006-2020  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
@@ -32,7 +32,6 @@
 #include "ServiceNode.hxx"
 #include "Proc.hxx"
 
-#include "SALOME_NamingService.hxx"
 #include "SALOME_LifeCycleCORBA.hxx"
 #include "SALOME_ContainerManager.hxx"
 #include "Basics_Utils.hxx"
@@ -112,7 +111,7 @@ Container *SalomeContainer::cloneAlways() const
   return new SalomeContainer(*this);
 }
 
-void SalomeContainer::checkCapabilityToDealWith(const ComponentInstance *inst) const throw(YACS::Exception)
+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.");
@@ -221,11 +220,35 @@ Engines::Container_ptr SalomeContainer::getContainerPtr(const Task *askingNode)
 /*!
  * \param inst the component instance
  */
-void SalomeContainer::start(const Task *askingNode) throw(YACS::Exception)
+void SalomeContainer::start(const Task *askingNode)
 {
   SalomeContainerTools::Start(_componentNames,_launchModeType,_sct,_shutdownLevel,this,askingNode);
 }
 
+void SalomeContainer::start(const Task *askingNode,
+                            const std::string& resource_name,
+                            const std::string& container_name)
+{
+  if(canAcceptImposedResource()
+    && askingNode != nullptr
+    && askingNode->hasImposedResource())
+  {
+    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);
+}
+
+bool SalomeContainer::canAcceptImposedResource()
+{
+  return _launchModeType->getType() == SalomeContainerMultiHelper::TYPE_NAME;
+}
+
 void SalomeContainer::shutdown(int level)
 {
   DEBTRACE("SalomeContainer::shutdown: " << _name << "," << level << "," << _shutdownLevel);