-// Copyright (C) 2006-2014 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
#include "ServiceNode.hxx"
#include "Proc.hxx"
-#include "SALOME_NamingService.hxx"
#include "SALOME_LifeCycleCORBA.hxx"
#include "SALOME_ContainerManager.hxx"
#include "Basics_Utils.hxx"
using namespace YACS::ENGINE;
using namespace std;
+const char SalomeContainer::KIND[]="Salome";
+
+const char SalomeContainer::TYPE_PROPERTY_STR[]="type";
+
SalomeContainer::SalomeContainer():_launchModeType(new SalomeContainerMonoHelper),_shutdownLevel(999)
{
}
_mutex.unLock();
}
+std::string SalomeContainer::getKind() const
+{
+ return KIND;
+}
+
Container *SalomeContainer::clone() const
{
if(_isAttachedOnCloning)
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.");
void SalomeContainer::setProperty(const std::string& name, const std::string& value)
{
- if (name == "type")
+ if (name == AOC_ENTRY)
+ {
+ std::istringstream iss(value);
+ int val;
+ iss >> val;
+ setAttachOnCloningStatus((bool)val);
+ }
+ else if (name == TYPE_PROPERTY_STR)
{
if (value == SalomeContainerMonoHelper::TYPE_NAME)
{
}
else
throw Exception("SalomeContainer::setProperty : type value is not correct (mono or multi): " + value);
- return ;
}
_sct.setProperty(name,value);
}
std::string SalomeContainer::getProperty(const std::string& name) const
{
+ if (name == TYPE_PROPERTY_STR)
+ return _launchModeType->getType();
+ if (name==AOC_ENTRY)
+ {
+ int reti(_isAttachedOnCloning);
+ std::ostringstream oss; oss << reti;
+ return oss.str();
+ }
return _sct.getProperty(name);
}
/*!
* \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);