]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
*** empty log message ***
authorrahuel <rahuel@opencascade.com>
Mon, 8 Mar 2004 08:44:19 +0000 (08:44 +0000)
committerrahuel <rahuel@opencascade.com>
Mon, 8 Mar 2004 08:44:19 +0000 (08:44 +0000)
src/Container/Container_i.cxx
src/Container/SALOME_ComponentPy.py
src/ContainersManager/ContainersManager_i.cxx
src/ContainersManager/TestContainersManager.py

index a49e3a8f909eee7f1bd372cb2c78090561416edc..c2c40cf7368a5affeb545d0784d4eda2f87d017d 100644 (file)
@@ -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) ;
index 004d6ededc699551b7832e1fe58bc96043c36041..6de14924a1d3beef98defd6c42c3976195209f63 100755 (executable)
@@ -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" )
         
index 8fbb255b95224bb2fd2261174dfc88f87f69339d..8907437acf2b9e35dd7b1c41c7e8242ed7557c8c 100644 (file)
@@ -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 << " "
index 2b110947061703012e61291e53797bd1f5e5a4be..7b8c62f78d8dfd30424d53efade9d1010f390a8f 100644 (file)
@@ -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 = ''