]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Fix for bug PAL9772 : SALOME_ContainerPy.py not synchronized with latest LifeCycleCOR...
authormkr <mkr@opencascade.com>
Wed, 24 Aug 2005 04:32:25 +0000 (04:32 +0000)
committermkr <mkr@opencascade.com>
Wed, 24 Aug 2005 04:32:25 +0000 (04:32 +0000)
src/Container/SALOME_ComponentPy.py
src/Container/SALOME_ContainerPy.py

index 00077531860440cde82f75078e62684940b0ee44..708bcb2c41b77f689ec9ce1336106225a92284b8 100755 (executable)
@@ -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
index 4d2d87e024ee97f4b1d6c990bdbf07b68a097b8c..7c575b9299f3d37d2aba85e5c756adeb9e8f0c47 100755 (executable)
@@ -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"