From 767983912af8821d63c082a4997a6dd260fbeb4a Mon Sep 17 00:00:00 2001 From: rahuel Date: Mon, 8 Mar 2004 08:44:19 +0000 Subject: [PATCH] *** empty log message *** --- src/Container/Container_i.cxx | 2 +- src/Container/SALOME_ComponentPy.py | 6 ++ src/ContainersManager/ContainersManager_i.cxx | 101 +++++++++++------- .../TestContainersManager.py | 14 ++- 4 files changed, 82 insertions(+), 41 deletions(-) diff --git a/src/Container/Container_i.cxx b/src/Container/Container_i.cxx index a49e3a8f9..c2c40cf73 100644 --- a/src/Container/Container_i.cxx +++ b/src/Container/Container_i.cxx @@ -149,7 +149,7 @@ Engines_Container_i::~Engines_Container_i() } void Engines_Container_i::destroy() { - MESSAGE( "Manager_i::destroy" ) ; + MESSAGE( "Container_i::destroy" ) ; _poa->deactivate_object(*_id) ; CORBA::release(_poa) ; delete(_id) ; diff --git a/src/Container/SALOME_ComponentPy.py b/src/Container/SALOME_ComponentPy.py index 004d6eded..6de14924a 100755 --- a/src/Container/SALOME_ComponentPy.py +++ b/src/Container/SALOME_ComponentPy.py @@ -113,6 +113,12 @@ class SALOME_ComponentPy_i (Engines__POA.Component): #------------------------------------------------------------------------- + def _get_interfaceName(self): + MESSAGE( "SALOME_ComponentPy_i::_get_interfaceName" ) + return self._interfaceName + + #------------------------------------------------------------------------- + def ping(self): MESSAGE( "SALOME_ComponentPy_i::ping" ) diff --git a/src/ContainersManager/ContainersManager_i.cxx b/src/ContainersManager/ContainersManager_i.cxx index 8fbb255b9..8907437ac 100644 --- a/src/ContainersManager/ContainersManager_i.cxx +++ b/src/ContainersManager/ContainersManager_i.cxx @@ -112,7 +112,7 @@ void Manager_i::destroy() { MESSAGE( "Manager_i::destroy " << _ListOfEnginesComponents.size() << " components" ) ; for ( i = 0 ; i < _ListOfEnginesComponents.size() ; i++ ) { try { - _NamingService->Destroy_Name( _ListOfComponentsNames[ i ].c_str() ) ; +// _NamingService->Destroy_Name( _ListOfComponentsNames[ i ].c_str() ) ; _ListOfEnginesComponents[ i ]->destroy() ; MESSAGE( "Manager_i::destroy Component " << _ListOfComponentsNames[ i ] ) ; } @@ -123,7 +123,7 @@ void Manager_i::destroy() { MESSAGE( "Manager_i::destroy " << _ListOfEnginesContainers.size() << " containers" ) ; for ( i = 0 ; i < _ListOfEnginesContainers.size() ; i++ ) { try { - _NamingService->Destroy_Name( _ListOfContainersNames[ i ].c_str() ) ; +// _NamingService->Destroy_Name( _ListOfContainersNames[ i ].c_str() ) ; _ListOfEnginesContainers[ i ]->destroy() ; MESSAGE( "Manager_i::destroy Container " << _ListOfContainersNames[ i ] ) ; } @@ -135,11 +135,12 @@ void Manager_i::destroy() { CORBA::release(_Poa) ; delete(_Id) ; this->_remove_ref(); - _NamingService->Destroy_Name( "/Kernel/ContainersManager" ) ; +// _NamingService->Destroy_Name( "/Kernel/ContainersManager" ) ; } Manager_i::~Manager_i() { MESSAGE( "Manager_i::~Manager_i" ) ; + exit( 0 ) ; } Containers::MachineParameters * Manager_i::Parameters() { @@ -320,19 +321,25 @@ Engines::ListOfContainers * Manager_i::FindContainersLocked( Containers::Machine } } if ( !CORBA::is_nil( _ContainerObject ) ) { - _EnginesContainer = Engines::Container::_narrow( _ContainerObject ) ; - if ( _EnginesContainer->type() == MyParams.ContainerType ) { - int size = _ListOfContainers->length() ; - _ListOfContainers->length( size + 1 ) ; - _ListOfContainers[ size ] = Engines::Container::_duplicate( _EnginesContainer ) ; - MESSAGE( "Manager_i::FindContainers --> " << _EnginesContainer->machineName() << " " - << _EnginesContainer->name() << " " << _EnginesContainer->type() ) ; + try { + _EnginesContainer = Engines::Container::_narrow( _ContainerObject ) ; + if ( MyParams.ContainerType == Engines::Undefined || + _EnginesContainer->type() == MyParams.ContainerType ) { + int size = _ListOfContainers->length() ; + _ListOfContainers->length( size + 1 ) ; + _ListOfContainers[ size ] = Engines::Container::_duplicate( _EnginesContainer ) ; + MESSAGE( "Manager_i::FindContainers --> " << _EnginesContainer->machineName() << " " + << _EnginesContainer->name() << " " << _EnginesContainer->type() ) ; + } + else { + MESSAGE( "Manager_i::FindContainers --> " << _EnginesContainer->machineName() << " " + << _EnginesContainer->name() << " " << _EnginesContainer->type() << " # " + << MyParams.ContainerType ) ; + } + } + catch ( ... ) { + MESSAGE( "Manager_i::FindContainers " << _FullContainerName << " catched NOT responding " ) ; } - else { - MESSAGE( "Manager_i::FindContainers --> " << _EnginesContainer->machineName() << " " - << _EnginesContainer->name() << " " << _EnginesContainer->type() << " # " - << MyParams.ContainerType ) ; - } } else { MESSAGE( "Manager_i::FindContainers " << _FullContainerName << " unknown" ) ; @@ -348,21 +355,26 @@ Engines::ListOfContainers * Manager_i::FindContainersLocked( Containers::Machine MESSAGE( "Manager_i::FindContainers " << j << " " << _FullContainerName ) ; _ContainerObject = _NamingService->Resolve( _FullContainerName.c_str() ) ; if ( !CORBA::is_nil( _ContainerObject ) ) { - _EnginesContainer = Engines::Container::_narrow( _ContainerObject ) ; - if ( MyParams.ContainerType == Engines::Undefined || - _EnginesContainer->type() == MyParams.ContainerType ) { - int size = _ListOfContainers->length() ; - _ListOfContainers->length( size + 1 ) ; - _ListOfContainers[ size ] = Engines::Container::_duplicate( _EnginesContainer ); - MESSAGE( "Manager_i::FindContainers --> " << _EnginesContainer->machineName() << " " - << _EnginesContainer->name() << " " << _EnginesContainer->type() ) ; - } - else { - MESSAGE( "Manager_i::FindContainers --> " << _EnginesContainer->machineName() << " " - << _EnginesContainer->name() << " " << _EnginesContainer->type() << " # " - << MyParams.ContainerType ) ; - _EnginesContainer = Engines::Container::_nil() ; - } + try { + _EnginesContainer = Engines::Container::_narrow( _ContainerObject ) ; + if ( MyParams.ContainerType == Engines::Undefined || + _EnginesContainer->type() == MyParams.ContainerType ) { + int size = _ListOfContainers->length() ; + _ListOfContainers->length( size + 1 ) ; + _ListOfContainers[ size ] = Engines::Container::_duplicate( _EnginesContainer ); + MESSAGE( "Manager_i::FindContainers --> " << _EnginesContainer->machineName() << " " + << _EnginesContainer->name() << " " << _EnginesContainer->type() ) ; + } + else { + MESSAGE( "Manager_i::FindContainers --> " << _EnginesContainer->machineName() << " " + << _EnginesContainer->name() << " " << _EnginesContainer->type() << " # " + << MyParams.ContainerType ) ; + _EnginesContainer = Engines::Container::_nil() ; + } + } + catch( ... ) { + MESSAGE( "Manager_i::FindContainers " << _FullContainerName << " catched NOT responding" ) ; + } } else { MESSAGE( "Manager_i::FindContainers " << _FullContainerName << " unknown" ) ; @@ -472,12 +484,17 @@ Engines::Container_ptr Manager_i::FindOrStartContainerLocked( Containers::Machin if ( !CORBA::is_nil( _ComponentObject ) ) { MESSAGE( "Manager_i::FindOrStartContainerLocked --> " << _EnginesContainer->machineName() << " " << _EnginesContainer->name() ) ; - _EnginesComponent = Engines::Component::_duplicate( Engines::Component::_narrow( _ComponentObject ) ) ; - int size = _ListOfComponents->length() ; - _ListOfComponents->length( size + 1 ) ; - _ListOfComponents[ size ] = Engines::Component::_duplicate( _EnginesComponent ) ; - MESSAGE( "Manager_i::FindOrStartContainerLocked --> " << _EnginesComponent->instanceName() - << " " << _EnginesComponent->interfaceName() ) ; + try { + _EnginesComponent = Engines::Component::_duplicate( Engines::Component::_narrow( _ComponentObject ) ) ; + int size = _ListOfComponents->length() ; + _ListOfComponents->length( size + 1 ) ; + _ListOfComponents[ size ] = Engines::Component::_duplicate( _EnginesComponent ) ; + MESSAGE( "Manager_i::FindOrStartContainerLocked --> " << _EnginesComponent->instanceName() + << " " << _EnginesComponent->interfaceName() ) ; + } + catch ( ... ) { + MESSAGE( "Manager_i::FindOrStartContainerLocked catched NOT responding" ) ; + } } } } @@ -491,9 +508,15 @@ Engines::Container_ptr Manager_i::FindOrStartContainerLocked( Containers::Machin if ( !CORBA::is_nil( _ComponentObject ) ) { MESSAGE( "Manager_i::FindOrStartContainerLocked --> " << _EnginesContainer->machineName() << " " << _EnginesContainer->name() << " Component " << _FullComponentName ) ; - _EnginesComponent = Engines::Component::_duplicate( Engines::Component::_narrow( _ComponentObject ) ) ; - MESSAGE( "Manager_i::FindOrStartContainerLocked --> " << _EnginesComponent->instanceName() << " " - << _EnginesComponent->interfaceName() ) ; + try { + _EnginesComponent = Engines::Component::_duplicate( Engines::Component::_narrow( _ComponentObject ) ) ; + MESSAGE( "Manager_i::FindOrStartContainerLocked --> " << _EnginesComponent->instanceName() << " " + << _EnginesComponent->interfaceName() ) ; + } + catch ( ... ) { + MESSAGE( "Manager_i::FindOrStartContainerLocked --> " << myParams.HostName << " " + << myParams.ContainerName << " " << _ComponentName << " catched NOT responding" ) ; + } } else { MESSAGE( "Manager_i::FindOrStartContainerLocked --> " << myParams.HostName << " " diff --git a/src/ContainersManager/TestContainersManager.py b/src/ContainersManager/TestContainersManager.py index 2b1109470..7b8c62f78 100644 --- a/src/ContainersManager/TestContainersManager.py +++ b/src/ContainersManager/TestContainersManager.py @@ -261,6 +261,14 @@ DefaultParams.ContainerName = 'FactoryServer' FactoryServerAddComponent = MyContainersMgr.FindOrLoad_Component( DefaultParams , "AddComponent" ) print FactoryServerAddComponent.GetContainerRef()._get_name(),FactoryServerAddComponent._get_instanceName(),FactoryServerAddComponent._get_interfaceName() +DefaultParams.ContainerType = Engines.Python +DefaultParams.ContainerName = '' +Containers = MyContainersMgr.FindContainers( DefaultParams ) +i = 0 +while i < len( Containers ) : + print "Container running on",Containers[ i ]._get_machineName(),"with name",Containers[ i ]._get_name(),"and type",Containers[ i ].type() + i = i + 1 + DefaultParams.ContainerType = Engines.Undefined DefaultParams.ContainerName = '' @@ -286,13 +294,17 @@ while i < len( ListOfAddComponent ) : ContainerParameters( DefaultParams ) -FactoryServeSubComponent = MyContainersMgr.FindOrLoad_Component( DefaultParams , "SubComponent" ) +FactoryServerSubComponent = MyContainersMgr.FindOrLoad_Component( DefaultParams , "SubComponent" ) ListOfComponents = MyContainersMgr.FindComponents( DefaultParams , '' ) i = 0 while i < len( ListOfComponents ) : print ListOfComponents[ i ].GetContainerRef()._get_name(),ListOfComponents[ i ]._get_instanceName(),ListOfComponents[ i ]._get_interfaceName() i = i + 1 +DefaultParams.ContainerName = 'ServerPy' +ServerPy = MyContainersMgr.FindContainer( DefaultParams ) +print "Container running on",ServerPy._get_machineName(),"with name",ServerPy._get_name(),"and type",ServerPy.type() + DefaultParams.ContainerName = 'SuperVisionContainer' SuperVisionContainerAddComponent = MyContainersMgr.FindOrLoad_Component( DefaultParams , "AddComponent" ) DefaultParams.ContainerName = '' -- 2.39.2