From dfb66dec094a264fe0ba1112c80253edd06c4eaa Mon Sep 17 00:00:00 2001 From: rahuel Date: Fri, 5 Nov 2004 07:23:55 +0000 Subject: [PATCH] Portability Alpha_OSF(CCRT) + ContainersManager + Missing code <--> C++ --- src/Container/SALOME_ComponentPy.py | 31 ++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/Container/SALOME_ComponentPy.py b/src/Container/SALOME_ComponentPy.py index 004d6eded..2d8b0f683 100755 --- a/src/Container/SALOME_ComponentPy.py +++ b/src/Container/SALOME_ComponentPy.py @@ -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 #------------------------------------------------------------------------- -- 2.39.2