virtual void setContainer(Container *cont);
Container *getContainer() const { return _container; }
//! Load the component instance
- virtual void load() = 0;
+ virtual void load(ServiceNode *askingNode) = 0;
//! Unload the component instance
- virtual void unload() = 0;
+ virtual void unload(ServiceNode *askingNode) = 0;
//! Indicate if the component instance is loaded (true) or not
- virtual bool isLoaded() = 0;
+ virtual bool isLoaded(ServiceNode *askingNode) = 0;
virtual void attachOnCloning() const;
virtual void dettachOnCloning() const;
bool isAttachedOnCloning() const;
{
if(_component)
{
- if(!_component->isLoaded())
+ if(!_component->isLoaded(this))
{
try
{
- _component->load();
+ _component->load(this);
}
catch(Exception& e)
{
{
}
-void ComponentInstanceTest1::load()
+void ComponentInstanceTest1::load(ServiceNode *askingNode)
{
_loaded=true;
}
-void ComponentInstanceTest1::unload()
+void ComponentInstanceTest1::unload(ServiceNode *askingNode)
{
_loaded=false;
}
-bool ComponentInstanceTest1::isLoaded()
+bool ComponentInstanceTest1::isLoaded(ServiceNode *askingNode)
{
return _loaded;
}
{
}
-void ComponentInstanceTest2::load()
+void ComponentInstanceTest2::load(ServiceNode *askingNode)
{
_loaded=true;
}
-void ComponentInstanceTest2::unload()
+void ComponentInstanceTest2::unload(ServiceNode *askingNode)
{
_loaded=false;
}
-bool ComponentInstanceTest2::isLoaded()
+bool ComponentInstanceTest2::isLoaded(ServiceNode *askingNode)
{
return _loaded;
}
public:
ComponentInstanceTest1(const ComponentInstanceTest1& other);
ComponentInstanceTest1(const std::string& name);
- void load();
- void unload();
- bool isLoaded();
+ void load(ServiceNode *askingNode);
+ void unload(ServiceNode *askingNode);
+ bool isLoaded(ServiceNode *askingNode);
std::string getKind() const;
ServiceNode* createNode(const std::string& name);
ComponentInstance *clone() const;
public:
ComponentInstanceTest2(const ComponentInstanceTest2& other);
ComponentInstanceTest2(const std::string& name);
- void load();
- void unload();
- bool isLoaded();
+ void load(ServiceNode *askingNode);
+ void unload(ServiceNode *askingNode);
+ bool isLoaded(ServiceNode *askingNode);
std::string getKind() const;
ServiceNode* createNode(const std::string& name);
ComponentInstance *clone() const;
}
//! Unload the component
-void CORBAComponent::unload()
+void CORBAComponent::unload(ServiceNode *askingNode)
{
//Not implemented
std::cerr << "CORBAComponent::unload : not implemented " << std::endl;
}
//! Is the component instance already loaded ?
-bool CORBAComponent::isLoaded()
+bool CORBAComponent::isLoaded(ServiceNode *askingNode)
{
if(CORBA::is_nil(_objComponent))
return false;
}
//! Load the component
-void CORBAComponent::load()
+void CORBAComponent::load(ServiceNode *askingNode)
{
DEBTRACE( "CORBAComponent::load" );
CORBA::ORB_ptr orb;
CORBAComponent(const std::string& name);
CORBAComponent(const CORBAComponent& other);
virtual ~CORBAComponent();
- virtual void load();
- virtual void unload();
- virtual bool isLoaded();
+ virtual void load(ServiceNode *askingNode);
+ virtual void unload(ServiceNode *askingNode);
+ virtual bool isLoaded(ServiceNode *askingNode);
virtual ServiceNode* createNode(const std::string& name);
virtual ComponentInstance* clone() const;
virtual std::string getFileRepr() const;
}
//! Unload the component
-void CppComponent::unload()
+void CppComponent::unload(ServiceNode *askingNode)
{
//Not implemented
DEBTRACE("CppComponent::unload : not implemented ");
}
//! Is the component instance already loaded ?
-bool CppComponent::isLoaded()
+bool CppComponent::isLoaded(ServiceNode *askingNode)
{
return NULL != __obj;
}
-void CppComponent::load()
+void CppComponent::load(ServiceNode *askingNode)
{
if (!_container) {
_container = getRuntime()->createContainer(CppNode::KIND);
static const char KIND[];
virtual std::string getKind() const;
- virtual void load();
- virtual void unload();
- virtual bool isLoaded();
+ virtual void load(ServiceNode *askingNode);
+ virtual void unload(ServiceNode *askingNode);
+ virtual bool isLoaded(ServiceNode *askingNode);
virtual ServiceNode* createNode(const std::string& name);
virtual YACS::ENGINE::ComponentInstance* clone() const;
}
//! Unload the component
-void SalomeComponent::unload()
+void SalomeComponent::unload(ServiceNode *askingNode)
{
//Not implemented
std::cerr << "SalomeComponent::unload : not implemented " << std::endl;
}
//! Is the component instance already loaded ?
-bool SalomeComponent::isLoaded()
+bool SalomeComponent::isLoaded(ServiceNode *askingNode)
{
if(CORBA::is_nil(_objComponent))
return false;
#ifdef SALOME_KERNEL
//! Load the component
-void SalomeComponent::load()
+void SalomeComponent::load(ServiceNode *askingNode)
{
if(_container)
{
- _objComponent=((SalomeContainer*)_container)->loadComponent(this);
+ _objComponent=((SalomeContainer*)_container)->loadComponent(askingNode);
return;
}
//throw Exception("SalomeComponent::load : no container specified !!! To be implemented in executor to allocate default a Container in case of presenceOfDefaultContainer.");
_objComponent=LCC.LoadComponent(params,_compoName.c_str());
}
#else
-void SalomeComponent::load()
+void SalomeComponent::load(ServiceNode *askingNode)
{
throw Exception("YACS has been built without SALOME support");
}
SalomeComponent(const std::string& name);
SalomeComponent(const SalomeComponent& other);
virtual ~SalomeComponent();
- virtual void load();
- virtual void unload();
- virtual bool isLoaded();
+ virtual void load(ServiceNode *askingNode);
+ virtual void unload(ServiceNode *askingNode);
+ virtual bool isLoaded(ServiceNode *askingNode);
virtual void setContainer(Container *cont);
virtual ServiceNode* createNode(const std::string& name);
virtual ComponentInstance* clone() const;
#include "RuntimeSALOME.hxx"
#include "SalomeContainer.hxx"
#include "SalomeComponent.hxx"
+#include "ServiceNode.hxx"
#include "Proc.hxx"
#include "SALOME_NamingService.hxx"
/*!
* \param inst the component instance to load
*/
-CORBA::Object_ptr SalomeContainer::loadComponent(ComponentInstance *inst)
+CORBA::Object_ptr SalomeContainer::loadComponent(ServiceNode *inst)
{
- return SalomeContainerTools::LoadComponent(_launchModeType,this,inst);
+ return SalomeContainerTools::LoadComponent(_launchModeType,this,inst->getComponent());
}
//! Get the container placement id for a component instance
void clearProperties();
void addComponentName(const std::string& name);
void addToResourceList(const std::string& name);
- virtual CORBA::Object_ptr loadComponent(ComponentInstance *inst);
+ virtual CORBA::Object_ptr loadComponent(ServiceNode *inst);
void shutdown(int level);
// Helper methods
std::map<std::string,std::string> getResourceProperties(const std::string& name) const;
{
}
-void SalomePythonComponent::load()
+void SalomePythonComponent::load(ServiceNode *askingNode)
{
if(_container)
{
//throw Exception("SalomePythonComponent::load : no container specified !!! To be implemented in executor to allocate default a Container in case of presenceOfDefaultContainer.");
}
-void SalomePythonComponent::unload()
+void SalomePythonComponent::unload(ServiceNode *askingNode)
{
}
-bool SalomePythonComponent::isLoaded()
+bool SalomePythonComponent::isLoaded(ServiceNode *askingNode)
{
if(!_container)
return false;
SalomePythonComponent(const SalomePythonComponent& other);
std::string getPlacementId() const;
virtual ~SalomePythonComponent();
- virtual void load();
- virtual void unload();
- virtual bool isLoaded();
+ virtual void load(ServiceNode *askingNode);
+ virtual void unload(ServiceNode *askingNode);
+ virtual bool isLoaded(ServiceNode *askingNode);
virtual std::string getKind() const;
virtual ComponentInstance* clone() const;
virtual std::string getFileRepr() const;