From 4b743d0c0534640d97d8e1aaaf467145a7a8c2e9 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Tue, 17 Aug 2021 11:16:05 +0200 Subject: [PATCH] naming_service is available in salome module in SSL mode --- src/KERNEL_PY/__init__.py | 4 +++- src/NamingService/NamingService.i | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/KERNEL_PY/__init__.py b/src/KERNEL_PY/__init__.py index 7b99a03e4..5c0900e62 100644 --- a/src/KERNEL_PY/__init__.py +++ b/src/KERNEL_PY/__init__.py @@ -204,7 +204,7 @@ class StandAloneLifecyle: return self._rm def salome_init_without_session(): - global lcc,myStudy,orb,modulcat,sg,cm + global lcc,naming_service,myStudy,orb,modulcat,sg,cm import KernelBasis KernelBasis.setSSLMode(True) import KernelDS @@ -216,6 +216,7 @@ def salome_init_without_session(): from salome_kernel import list_of_catalogs_regarding_environement modulcat = KernelModuleCatalog.myModuleCatalog( list_of_catalogs_regarding_environement() ) import KernelLauncher + from NamingService import NamingService cm = KernelLauncher.myContainerManager() lcc = StandAloneLifecyle(cm, KernelLauncher.myResourcesManager()) # activate poaManager to accept co-localized CORBA calls. @@ -224,6 +225,7 @@ def salome_init_without_session(): poaManager.activate() sg = SalomeOutsideGUI() salome_study_init_without_session() + naming_service = NamingService() def salome_init_with_session(path=None, embedded=False): """ diff --git a/src/NamingService/NamingService.i b/src/NamingService/NamingService.i index 08b58d996..a6497c6a0 100644 --- a/src/NamingService/NamingService.i +++ b/src/NamingService/NamingService.i @@ -68,6 +68,8 @@ public: std::vector< std::string > repr(); static std::string GetLogContainersFile(); static void FlushLogContainersFile(); + void Destroy_Name(const char* Path); + void Destroy_FullDirectory(const char* Path); %extend { static void SetLogContainersFileInternal(const std::string& logFileName) { @@ -86,6 +88,13 @@ public: CORBA::Object_var obj = orb->string_to_object(ior); self->Register(obj,Path); } + std::string _Resolve_DirInternal(const char *Path) + { + CORBA::ORB_ptr orb = KERNEL::getORB(); + CORBA::Object_var ret = self->Resolve(Path); + CORBA::String_var ior = orb->object_to_string(ret); + return std::string(ior.in()); + } static std::string IOROfNS() { CORBA::ORB_ptr orb = KERNEL::getORB(); @@ -106,8 +115,14 @@ def NamingService_Register(self,obj,Path): import CORBA orb=CORBA.ORB_init(['']) self._RegisterInternal( orb.object_to_string(obj) , Path) +def NamingService_Resolve_Dir(self,Path): + ret = self._Resolve_DirInternal( Path ) + import CORBA + orb=CORBA.ORB_init(['']) + return orb.string_to_object(ret) NamingService.Resolve = NamingService_Resolve NamingService.Register = NamingService_Register +NamingService.Resolve_Dir = NamingService_Resolve_Dir def NamingService_SetLogContainersFile(cls,logFileName = None): if logFileName is None: import tempfile -- 2.39.2