From: mkr Date: Wed, 24 Aug 2005 04:32:25 +0000 (+0000) Subject: Fix for bug PAL9772 : SALOME_ContainerPy.py not synchronized with latest LifeCycleCOR... X-Git-Tag: T_3_0_2a1~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c6c404743accf3a3a3dbf65d5f0af2612283e2fb;p=modules%2Fkernel.git Fix for bug PAL9772 : SALOME_ContainerPy.py not synchronized with latest LifeCycleCORBA changes. --- diff --git a/src/Container/SALOME_ComponentPy.py b/src/Container/SALOME_ComponentPy.py index 000775318..708bcb2c4 100755 --- a/src/Container/SALOME_ComponentPy.py +++ b/src/Container/SALOME_ComponentPy.py @@ -51,6 +51,7 @@ class SALOME_ComponentPy_i (Engines__POA.Component): _orb = None _poa = None _fieldsDict = [] + _studyId = -1 #------------------------------------------------------------------------- @@ -224,3 +225,6 @@ class SALOME_ComponentPy_i (Engines__POA.Component): return (aBuffer, 1) #------------------------------------------------------------------------- + + def getStudyId(self): + return self._studyId diff --git a/src/Container/SALOME_ContainerPy.py b/src/Container/SALOME_ContainerPy.py index 4d2d87e02..7c575b929 100755 --- a/src/Container/SALOME_ContainerPy.py +++ b/src/Container/SALOME_ContainerPy.py @@ -52,6 +52,7 @@ class SALOME_ContainerPy_i (Engines__POA.Container): _orb = None _poa = None _numInstance = 0 + _listInstances_map = {} #------------------------------------------------------------------------- @@ -229,6 +230,7 @@ class SALOME_ContainerPy_i (Engines__POA.Container): MESSAGE( "SALOME_Container_i::create_component_instance : OK") comp_o = comp_i._this() + self._listInstances_map[instanceName] = comp_i except: import traceback traceback.print_exc() @@ -237,9 +239,29 @@ class SALOME_ContainerPy_i (Engines__POA.Container): #------------------------------------------------------------------------- + def find_component_instance(self, registeredName, studyId): + anEngine = None + keysList = self._listInstances_map.keys() + i = 0 + while i < len(keysList): + instance = keysList[i] + if find(instance,registeredName) == 0: + anEngine = self._listInstances_map[instance] + if studyId == anEngine.getStudyId(): + return anEngine._this() + i = i + 1 + return anEngine._this() + + + #------------------------------------------------------------------------- + def remove_impl(self, component): MESSAGE( "SALOME_ContainerPy_i::remove_impl" ) - return None + instanceName = component._get_instanceName() + MESSAGE( "unload component " + str(instanceName) ) + self._listInstances_map.remove(instanceName) + component.destroy() + self._naming_service.Destroy_Name(str(instanceName)) #------------------------------------------------------------------------- @@ -250,17 +272,29 @@ class SALOME_ContainerPy_i (Engines__POA.Container): #------------------------------------------------------------------------- def ping(self): - MESSAGE( "SALOME_ContainerPy_i::ping" ) + MESSAGE( "SALOME_ContainerPy_i::ping() pid " + str(os.getpid()) ) return None #------------------------------------------------------------------------- + def getPID(self): + return os.getpid() + + #------------------------------------------------------------------------- + def _get_name(self): MESSAGE( "SALOME_ContainerPy_i::_get_name" ) return self._containerName #------------------------------------------------------------------------- + def getHostName(self): + MESSAGE( "SALOME_ContainerPy_i::_get_MachineName" ) + self._machineName = "localhost" + return self._machineName + + #------------------------------------------------------------------------- + def _get_machineName(self): MESSAGE( "SALOME_ContainerPy_i::_get_MachineName" ) self._machineName = "localhost"