]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Portability Alpha_OSF(CCRT) + ContainersManager + Missing code <--> C++
authorrahuel <rahuel@opencascade.com>
Fri, 5 Nov 2004 07:23:55 +0000 (07:23 +0000)
committerrahuel <rahuel@opencascade.com>
Fri, 5 Nov 2004 07:23:55 +0000 (07:23 +0000)
src/Container/SALOME_ComponentPy.py

index 004d6ededc699551b7832e1fe58bc96043c36041..2d8b0f6832cabd51c455b07716746adcb14e22a2 100755 (executable)
@@ -30,6 +30,7 @@
 
 import os
 import sys
+import string
 import time
 from omniORB import CORBA, PortableServer
 import Engines, Engines__POA
@@ -59,9 +60,11 @@ class SALOME_ComponentPy_i (Engines__POA.Component):
         MESSAGE(  "SALOME_ComponentPy_i::__init__" + " " + str (containerName) + " " + str(instanceName) + " " + str(interfaceName) )
         self._orb = orb
         self._poa = poa
+        self._contId = self._poa.reference_to_id( contID )
         self._instanceName = instanceName
         self._interfaceName = interfaceName
         self._containerName = containerName
+        self._Id = None
         self._notif = notif
         self._myConnexionToRegistry = 0
         self._graphName = ''
@@ -72,9 +75,14 @@ class SALOME_ComponentPy_i (Engines__POA.Component):
         self._Executed = 0
 
         naming_service = SALOME_NamingServicePy_i(self._orb)
-        Component_path = "/Containers/" +  os.getenv( "HOSTNAME" ) + "/" + self._containerName + "/" + self._interfaceName
+        self.naming_service = naming_service
+        #Component_path = "/Containers/" +  os.getenv( "HOSTNAME" ) + "/" + self._containerName + "/" + self._interfaceName
+        HostName = os.getenv( "HOST" )
+        myMachine = string.split( HostName , '.' )
+        Component_path = "/Containers/" + myMachine[0] + "/" + self._containerName + "/" + self._interfaceName
         MESSAGE(  'SALOME_ComponentPy_i Register' + str( Component_path ) )
         naming_service.Register(self._this(), Component_path)
+        self.Component_path = Component_path
 
         # Add componentinstance to registry
         obj = naming_service.Resolve('/Registry')
@@ -113,6 +121,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" )
         
@@ -120,13 +134,24 @@ class SALOME_ComponentPy_i (Engines__POA.Component):
 
     def destroy(self):
         MESSAGE(  "SALOME_ComponentPy_i::destroy" )
-        poa.deactivate_object(self)
-        CORBA.release(_poa)
+        self.naming_service.Destroy_Name( self.Component_path )
+        self._poa.deactivate_object(self._Id)
+        MESSAGE(  "SALOME_ComponentPy_i::destroy _poa.deactivate_object done" )
         
     #-------------------------------------------------------------------------
 
     def GetContainerRef(self):
         MESSAGE(  "SALOME_ComponentPy_i::GetContainerRef" )
+        theContainer = None
+        try :
+            obj = self._poa.id_to_reference( self._contId )
+            try :
+                theContainer = obj._narrow( Engines.Container )
+            except :
+                print "SALOME_ComponentPy_i::GetContainerRef _narrow( Engines.Container ) exception"
+        except :
+            print "SALOME_ComponentPy_i::GetContainerRef _poa.id_to_reference( _contId ) exception"
+        return theContainer
         
     #-------------------------------------------------------------------------