Salome HOME
PR: container lifecycle, new design, first part
[modules/kernel.git] / src / Container / SALOME_ContainerPy.py
index 417599eb98239f851e815c623d3e94ab777f72d2..d2b30bfa89753151c0c7ce34504d0f547de7d3f9 100755 (executable)
@@ -36,6 +36,8 @@ from omniORB import CORBA, PortableServer
 # (if not, incomplete import done by SALOME module: no load of SALOMEDS_attributes)
 import SALOMEDS 
 import Engines, Engines__POA
+reload(Engines)
+reload(Engines__POA)
 from SALOME_NamingServicePy import *
 from SALOME_ComponentPy import *
 
@@ -133,6 +135,22 @@ class SALOME_ContainerPy_i (Engines__POA.Container):
 
     #-------------------------------------------------------------------------
 
+    def instance(self, nameToRegister, componentName):
+        MESSAGE(  "SALOME_ContainerPy_i::instance " + str(nameToRegister) + ' ' + str(componentName) )
+        self._numInstance = self._numInstance +1
+        instanceName = nameToRegister + "_inst_" + `self._numInstance`
+
+       component=__import__(componentName)
+       factory=getattr(component,componentName)
+       comp_i=factory(self._orb, self._poa, self._this(), self._containerName,
+                      instanceName, nameToRegister)
+
+        MESSAGE( "SALOME_ContainerPy_i::instance : component created")
+        comp_o = comp_i._this()
+        return comp_o
+
+    #-------------------------------------------------------------------------
+
     def load_impl(self, nameToRegister, componentName):
         MESSAGE(  "SALOME_ContainerPy_i::load_impl " + str(nameToRegister) + ' ' + str(componentName) )
         self._numInstance = self._numInstance +1
@@ -150,21 +168,25 @@ class SALOME_ContainerPy_i (Engines__POA.Container):
 
     def remove_impl(self, component):
         MESSAGE( "SALOME_ContainerPy_i::remove_impl" )
+        return None
 
     #-------------------------------------------------------------------------
 
     def finalize_removal(self):
         MESSAGE( "SALOME_ContainerPy_i::finalize_removal" )
+        return None
 
     #-------------------------------------------------------------------------
 
     def ping(self):
         MESSAGE( "SALOME_ContainerPy_i::ping" )
+        return None
 
     #-------------------------------------------------------------------------
 
     def _get_name(self):
         MESSAGE( "SALOME_ContainerPy_i::_get_name" )
+        return self._containerName
 
     #-------------------------------------------------------------------------
 
@@ -173,6 +195,12 @@ class SALOME_ContainerPy_i (Engines__POA.Container):
         self._machineName = "localhost"
         return self._machineName
 
+    #-------------------------------------------------------------------------
+
+    def Shutdown(self):
+        self._orb.shutdown(0)
+        pass
+
 #=============================================================================
 
 #initialise the ORB and find the root POA