Version: 8.3.0
SALOME_LifeCycleCORBA Class Reference

A class to manage life cycle of SALOME components. More...

#include <SALOME_LifeCycleCORBA.hxx>

Public Member Functions

 SALOME_LifeCycleCORBA (SALOME_NamingService *ns=0)
 Constructor. More...
 
virtual ~SALOME_LifeCycleCORBA ()
 Destructor. More...
 
Engines::EngineComponent_ptr FindComponent (const Engines::ContainerParameters &params, const char *componentName, int studyId=0)
 Find an already existing and registered component instance. More...
 
Engines::EngineComponent_ptr LoadComponent (const Engines::ContainerParameters &params, const char *componentName, int studyId=0)
 Load a component instance on a container defined by its parameters. More...
 
Engines::EngineComponent_ptr FindOrLoad_Component (const Engines::ContainerParameters &params, const char *componentName, int studyId=0)
 Find an already existing and registered component instance or load a new component instance on a container defined by its parameters. More...
 
Engines::EngineComponent_ptr FindOrLoad_Component (const char *containerName, const char *componentName)
 Find an already existing and registered component instance or load a new component instance on a container defined by name. More...
 
Engines::EngineComponent_ptr Load_ParallelComponent (const Engines::ContainerParameters &params, const char *componentName, int studyId)
 Load a parallel component instance. More...
 
bool isKnownComponentClass (const char *componentName)
 Check if the component class is known in module catalog. More...
 
int NbProc (const Engines::ContainerParameters &params)
 
Engines::ContainerManager_ptr getContainerManager ()
 Get the container manager. More...
 
Engines::ResourcesManager_ptr getResourcesManager ()
 Get the resources manager. More...
 
SALOME_NamingServicenamingService ()
 get the naming service used by the life cycle More...
 
CORBA::ORB_ptr orb ()
 get the orb used by the life cycle More...
 
void copyFile (const char *hostSrc, const char *fileSrc, const char *hostDest, const char *fileDest)
 copy a file from a source host to a destination host More...
 
void shutdownServers ()
 shutdown all the SALOME servers except SALOME_Session_Server and omniNames More...
 

Static Public Member Functions

static void preSet (Engines::ResourceParameters &outparams)
 Initialisation of a given Engines::ResourceParameters with default values. More...
 
static void preSet (Engines::ContainerParameters &outparams)
 Initialisation of a given Engines::ContainerParameters with default values. More...
 
static void killOmniNames ()
 shutdown omniNames More...
 

Protected Member Functions

Engines::EngineComponent_ptr _FindComponent (const Engines::ContainerParameters &params, const char *componentName, int studyId, const Engines::ResourceList &listOfResources)
 Establish if a component called "componentName" in a container called "containerName" exists among the list of resources in "listOfMachines". More...
 
Engines::EngineComponent_ptr _LoadComponent (const Engines::ContainerParameters &params, const char *componentName, int studyId)
 Load a component instance. More...
 

Protected Attributes

SALOME_NamingService_NS
 
SALOME_NamingService_NSnew
 
Engines::ContainerManager_var _ContManager
 
Engines::ResourcesManager_var _ResManager
 

Detailed Description

A class to manage life cycle of SALOME components.

Constructor & Destructor Documentation

SALOME_LifeCycleCORBA::~SALOME_LifeCycleCORBA ( )
virtual

Destructor.

References _NSnew.

Member Function Documentation

Engines::EngineComponent_ptr SALOME_LifeCycleCORBA::_FindComponent ( const Engines::ContainerParameters params,
const char componentName,
int  studyId,
const Engines::ResourceList listOfResources 
)
protected

Establish if a component called "componentName" in a container called "containerName" exists among the list of resources in "listOfMachines".

Find an already existing and registered component instance.

This method uses Naming Service to find the component.

  • build a list of machines on which an instance of the component is running,
  • find the best machine among the list
Parameters
paramsmachine parameters like type or name...
componentNamethe name of component class
studyIddefault = 0 : multistudy instance
listOfMachineslist of machine address
Returns
a CORBA reference of the component instance, or _nil if not found

References _NS, _ResManager, Engines::ContainerParameters::container_name, NbProc(), and SALOME_NamingService::ResolveComponent().

Referenced by FindComponent(), and FindOrLoad_Component().

Engines::EngineComponent_ptr SALOME_LifeCycleCORBA::_LoadComponent ( const Engines::ContainerParameters params,
const char componentName,
int  studyId 
)
protected

Load a component instance.

  • Finds a container in the list of machine or start one.
  • Try to load the component library in the container,
  • then create an instance of the component.
Parameters
paramsmachine parameters like type or name...
componentNamethe name of component class
studyIddefault = 0 : multistudy instance
Returns
a CORBA reference of the component instance, or _nil if problem

References _ContManager, Engines::ContainerParameters::container_name, MESSAGE, Engines::ContainerParameters::mode, and NbProc().

Referenced by FindOrLoad_Component(), and LoadComponent().

void SALOME_LifeCycleCORBA::copyFile ( const char hostSrc,
const char fileSrc,
const char hostDest,
const char fileDest 
)

copy a file from a source host to a destination host

Parameters
hostSrcthe source host
fileSrcthe file to copy from the source host to the destination host
hostDestthe destination host
fileDestthe destination file

References getContainerManager(), SALOME_FileTransferCORBA::getLocalFile(), Engines::ResourceParameters::hostname, Engines::ContainerParameters::mode, preSet(), and Engines::ContainerParameters::resource_params.

Engines::EngineComponent_ptr SALOME_LifeCycleCORBA::FindComponent ( const Engines::ContainerParameters params,
const char componentName,
int  studyId = 0 
)

Find an already existing and registered component instance.

Parameters
paramscontainer parameters like type or name...
componentNamethe name of component class
studyIddefault = 0 : multistudy instance
Returns
a CORBA reference of the component instance, or _nil if not found

References _FindComponent(), _ResManager, Engines::ResourceParameters::can_run_containers, Engines::ResourceParameters::componentList, isKnownComponentClass(), and Engines::ContainerParameters::resource_params.

Engines::EngineComponent_ptr SALOME_LifeCycleCORBA::FindOrLoad_Component ( const Engines::ContainerParameters params,
const char componentName,
int  studyId = 0 
)

Find an already existing and registered component instance or load a new component instance on a container defined by its parameters.

Parameters
paramscontainer parameters like type or name...
componentNamethe name of component class
studyIddefault = 0 : multistudy instance
Returns
a CORBA reference of the component instance, or _nil if problem

References _FindComponent(), _LoadComponent(), _ResManager, Engines::ResourceParameters::can_run_containers, Engines::ResourceParameters::componentList, isKnownComponentClass(), Engines::ResourceParameters::resList, and Engines::ContainerParameters::resource_params.

Referenced by FindOrLoad_Component(), SALOMEDS_DriverFactory_i::GetDriverByType(), main(), TEST_getLifeCycleCORBA(), KernelHelpersUnitTests::TEST_getLifeCycleCORBA(), LifeCycleCORBATest::testFindOrLoad_Component_LaunchContainer(), LifeCycleCORBATest::testFindOrLoad_Component_LaunchContainerHostname(), LifeCycleCORBATest::testFindOrLoad_Component_ParamsContainerName(), LifeCycleCORBATest::testFindOrLoad_Component_ParamsEmpty(), LifeCycleCORBATest::testFindOrLoad_Component_ParamsLocalContainer(), LifeCycleCORBATest::testFindOrLoad_Component_ParamsRemoteComputer(), LifeCycleCORBATest::testFindOrLoad_Component_ParamsRemoteComputer2(), LifeCycleCORBATest::testFindOrLoad_Component_PythonInCppContainer(), LifeCycleCORBATest::testFindOrLoad_Component_PythonSameInstance(), LifeCycleCORBATest::testFindOrLoad_Component_RemoteComputer(), LifeCycleCORBATest::testFindOrLoad_Component_SameContainer(), LifeCycleCORBATest::testFindOrLoad_Component_SameInstance(), LifeCycleCORBATest::testFindOrLoad_Component_UnknownInCatalog(), LifeCycleCORBATest::testFindOrLoad_Component_UnknownMachine(), and SALOMEDSTest::testStudyBuilder().

Engines::EngineComponent_ptr SALOME_LifeCycleCORBA::FindOrLoad_Component ( const char containerName,
const char componentName 
)

Find an already existing and registered component instance or load a new component instance on a container defined by name.

Parameters
containerNamethe name of container, under one of the forms
  • 1 aContainer (local container)
  • 2 machine/aContainer (container on hostname = machine)
componentNamethe name of component class
Returns
a CORBA reference of the component instance, or _nil if problem

References Engines::ContainerParameters::container_name, FindOrLoad_Component(), Engines::ResourceParameters::hostname, isKnownComponentClass(), Engines::ContainerParameters::isMPI, MESSAGE, preSet(), Engines::ContainerParameters::resource_params, and SCRUTE.

Engines::ContainerManager_ptr SALOME_LifeCycleCORBA::getContainerManager ( )

Get the container manager.

Returns
the container Manager

References _ContManager.

Referenced by copyFile(), and SALOME_FileTransferCORBA::getLocalFile().

Engines::ResourcesManager_ptr SALOME_LifeCycleCORBA::getResourcesManager ( )

Get the resources manager.

Returns
the container Manager

References _ResManager.

Referenced by SALOME_FileTransferCORBA::getLocalFile().

bool SALOME_LifeCycleCORBA::isKnownComponentClass ( const char componentName)

Check if the component class is known in module catalog.

Parameters
componentNamethe name of component class
Returns
true if found, false otherwise

References _NS, ASSERT, INFOS, MESSAGE, and SALOME_NamingService::Resolve().

Referenced by FindComponent(), FindOrLoad_Component(), and LoadComponent().

void SALOME_LifeCycleCORBA::killOmniNames ( )
static

shutdown omniNames

References MESSAGE.

Engines::EngineComponent_ptr SALOME_LifeCycleCORBA::Load_ParallelComponent ( const Engines::ContainerParameters params,
const char componentName,
int  studyId 
)

Load a parallel component instance.

Parameters
paramsmachine parameters like type or name...
componentNamethe name of component class
studyIddefault = 0 : multistudy instance
Returns
a CORBA reference of the parallel component instance, or _nil if problem

References _ContManager, Engines::ResourceParameters::componentList, INFOS, MESSAGE, Engines::ContainerParameters::mode, and Engines::ContainerParameters::resource_params.

Engines::EngineComponent_ptr SALOME_LifeCycleCORBA::LoadComponent ( const Engines::ContainerParameters params,
const char componentName,
int  studyId = 0 
)

Load a component instance on a container defined by its parameters.

Parameters
paramscontainer parameters like type or name...
componentNamethe name of component class
studyIddefault = 0 : multistudy instance
Returns
a CORBA reference of the component instance, or _nil if problem

References _LoadComponent(), _ResManager, Engines::ResourceParameters::can_run_containers, Engines::ResourceParameters::componentList, isKnownComponentClass(), Engines::ResourceParameters::resList, and Engines::ContainerParameters::resource_params.

SALOME_NamingService * SALOME_LifeCycleCORBA::namingService ( )

get the naming service used by the life cycle

Returns
the naming service

References _NS.

int SALOME_LifeCycleCORBA::NbProc ( const Engines::ContainerParameters params)
Returns
a number of processors not 0, only for MPI containers

References Engines::ContainerParameters::isMPI, and Engines::ContainerParameters::nb_proc.

Referenced by _FindComponent(), and _LoadComponent().

CORBA::ORB_ptr SALOME_LifeCycleCORBA::orb ( )

get the orb used by the life cycle

Returns
the orb

References _NS, and SALOME_NamingService::orb().

Referenced by SALOME_LifeCycleCORBA(), and shutdownServers().

void SALOME_LifeCycleCORBA::shutdownServers ( )

shutdown all the SALOME servers except SALOME_Session_Server and omniNames

References _NS, Kernel_Utils::GetHostname(), SALOMESDS::DataServerManager::NAME_IN_NS, orb(), and SALOME_NamingService::Resolve().

Field Documentation

Engines::ContainerManager_var SALOME_LifeCycleCORBA::_ContManager
protected
SALOME_NamingService* SALOME_LifeCycleCORBA::_NSnew
protected
Engines::ResourcesManager_var SALOME_LifeCycleCORBA::_ResManager
protected