]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Remove StandaloneLifecyle to reduce code divergence between SSL and classical. It...
authorAnthony Geay <anthony.geay@edf.fr>
Mon, 24 Jan 2022 15:25:14 +0000 (16:25 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Mon, 24 Jan 2022 15:25:14 +0000 (16:25 +0100)
src/KERNEL_PY/__init__.py
src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx
src/LifeCycleCORBA/SALOME_LifeCycleCORBA.hxx
src/LifeCycleCORBA_SWIG/LifeCycleCORBA.py

index b82ee7dfe322631253b9cd987a3416a64fc93923..80449ac00512a39bbeddb70e04f24516cb325958 100644 (file)
@@ -188,26 +188,6 @@ def salome_init(path=None, embedded=False):
     else:
         salome_init_with_session(path, embedded)
 
     else:
         salome_init_with_session(path, embedded)
 
-class StandAloneLifecyle:
-    def __init__(self, containerManager, resourcesManager):
-        self._cm = containerManager
-        self._rm = resourcesManager
-
-    def FindOrLoadComponent(self,contName,moduleName):
-        global orb
-        import importlib
-        builder_name = moduleName + "_SalomeSessionless"
-        moduleObj = importlib.import_module(builder_name)
-        result, orb = moduleObj.buildInstance(orb)
-        return result
-        #raise RuntimeError("Undealed situation cont = {} module = {}".format(contName,moduleName))
-
-    def getContainerManager(self):
-      return self._cm
-
-    def getResourcesManager(self):
-      return self._rm
-
 def salome_init_without_session_common(path=None, embedded=False):
     from ORBConfigFile import writeORBConfigFileSSL
     OMNIORB_USER_PATH = "OMNIORB_USER_PATH"
 def salome_init_without_session_common(path=None, embedded=False):
     from ORBConfigFile import writeORBConfigFileSSL
     OMNIORB_USER_PATH = "OMNIORB_USER_PATH"
@@ -250,7 +230,8 @@ def salome_init_without_session(path=None, embedded=False):
     global lcc,cm,dsm,esm
     import KernelLauncher
     cm = KernelLauncher.myContainerManager()
     global lcc,cm,dsm,esm
     import KernelLauncher
     cm = KernelLauncher.myContainerManager()
-    lcc = StandAloneLifecyle(cm, KernelLauncher.myResourcesManager())
+    from LifeCycleCORBA import LifeCycleCORBASSL
+    lcc = LifeCycleCORBASSL()
     # create a FactoryServer Container servant
     import KernelContainer
     KernelContainer.myContainer()
     # create a FactoryServer Container servant
     import KernelContainer
     KernelContainer.myContainer()
@@ -286,8 +267,9 @@ def salome_init_without_session_attached(path=None, embedded=False):
     rm = orb.string_to_object( nsAbroad.Resolve(RM_NAME_IN_NS).decode() )
     naming_service.Register(rm,RM_NAME_IN_NS)
     #
     rm = orb.string_to_object( nsAbroad.Resolve(RM_NAME_IN_NS).decode() )
     naming_service.Register(rm,RM_NAME_IN_NS)
     #
+    from LifeCycleCORBA import LifeCycleCORBASSL
+    lcc = LifeCycleCORBASSL()
     DSM_NAME_IN_NS = "/DataServerManager"
     DSM_NAME_IN_NS = "/DataServerManager"
-    lcc = StandAloneLifecyle(cm,rm)
     dsm = orb.string_to_object( nsAbroad.Resolve(DSM_NAME_IN_NS).decode() )
     naming_service.Register(dsm,DSM_NAME_IN_NS)
     #
     dsm = orb.string_to_object( nsAbroad.Resolve(DSM_NAME_IN_NS).decode() )
     naming_service.Register(dsm,DSM_NAME_IN_NS)
     #
index a576b5b6f37041000a77f570da0880bea76c4366..d8e39f3efd4bdc1f3f01e3c56d6ddc7e6a6180b2 100644 (file)
@@ -89,7 +89,7 @@ SALOME_LifeCycleCORBA::SALOME_LifeCycleCORBA(SALOME_NamingService_Abstract *ns)
   // in a Python module
   CORBA::ORB_var orb = KERNEL::GetRefToORB();
   //  LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
   // in a Python module
   CORBA::ORB_var orb = KERNEL::GetRefToORB();
   //  LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
-  _NSnew=0;
+  _NSnew = nullptr;
   if (!ns)
     {
       _NS = new SALOME_NamingService(orb);
   if (!ns)
     {
       _NS = new SALOME_NamingService(orb);
@@ -837,3 +837,10 @@ CORBA::ORB_ptr SALOME_LifeCycleCORBA::orb()
     THROW_SALOME_EXCEPTION("SALOME_LifeCycleCORBA::orb : not a CORBA SALOME_NamingService ");
   return NSC->orb();
 }
     THROW_SALOME_EXCEPTION("SALOME_LifeCycleCORBA::orb : not a CORBA SALOME_NamingService ");
   return NSC->orb();
 }
+
+#include "SALOME_Fake_NamingService.hxx"
+
+SALOME_LifeCycleCORBASSL::SALOME_LifeCycleCORBASSL():SALOME_LifeCycleCORBA(new SALOME_Fake_NamingService)
+{
+  _NSnew = _NS;//give to SALOME_LifeCycleCORBA owenership of _NS
+}
index fc5406547137c98a3fef20b4cad1f390a8c23033..851459fd7655ec5a4a69cf5c741aceb0f38469e0 100644 (file)
@@ -125,4 +125,10 @@ protected:
   
 } ;
 
   
 } ;
 
+class SALOME_LifeCycleCORBASSL : public SALOME_LifeCycleCORBA
+{
+public:
+  SALOME_LifeCycleCORBASSL();
+};
+
 #endif
 #endif
index c7b99bd4414a28831f7ca314e4f6b54d845a0fe7..5ff4dc5b8a65098700cf7fe183ea2109244999ef 100644 (file)
 import Engines
 from libSALOME_LifeCycleCORBA import *
 
 import Engines
 from libSALOME_LifeCycleCORBA import *
 
-class LifeCycleCORBA (SALOME_LifeCycleCORBA):
+class LifeCycleCORBA(SALOME_LifeCycleCORBA):
 
     def __init__(self, orb = None):
         SALOME_LifeCycleCORBA.__init__(self)
 
     def FindOrLoadComponent(self, containerName, componentName):
 
     def __init__(self, orb = None):
         SALOME_LifeCycleCORBA.__init__(self)
 
     def FindOrLoadComponent(self, containerName, componentName):
-        return SALOME_LifeCycleCORBA.FindOrLoad_Component(self,
-                                                          containerName,
-                                                          componentName)
+        return SALOME_LifeCycleCORBA.FindOrLoad_Component(self,containerName,componentName)
+
+class LifeCycleCORBASSL(SALOME_LifeCycleCORBASSL):
+    def __init__(self):
+        SALOME_LifeCycleCORBASSL.__init__(self)
+    def FindOrLoadComponent(self, containerName, componentName):
+        return SALOME_LifeCycleCORBA.FindOrLoad_Component(self,containerName,componentName)
 
 class ContainerParameters (Engines.ContainerParameters):
   def __init__(self, container_name='', mode='start', workingdir='', nb_proc=0, isMPI=False, parallelLib='',resource_params=None):
 
 class ContainerParameters (Engines.ContainerParameters):
   def __init__(self, container_name='', mode='start', workingdir='', nb_proc=0, isMPI=False, parallelLib='',resource_params=None):