]> SALOME platform Git repositories - modules/jobmanager.git/commitdiff
Salome HOME
bos #26460 Add SSL mode
authorViktor UZLOV <vuzlov@centos7-01.nnov.opencascade.com>
Wed, 3 Nov 2021 11:40:21 +0000 (14:40 +0300)
committervsr <vsr@opencascade.com>
Mon, 17 Jan 2022 11:45:46 +0000 (14:45 +0300)
src/engine/BL_NamingService_Wrapper.cxx [new file with mode: 0644]
src/engine/BL_NamingService_Wrapper.hxx [new file with mode: 0644]
src/engine/BL_SALOMEServices.cxx
src/engine/BL_SALOMEServices.hxx
src/engine/CMakeLists.txt
src/salomegui/CMakeLists.txt

diff --git a/src/engine/BL_NamingService_Wrapper.cxx b/src/engine/BL_NamingService_Wrapper.cxx
new file mode 100644 (file)
index 0000000..1e2322e
--- /dev/null
@@ -0,0 +1,47 @@
+// Copyright (C) 2021  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "BL_NamingService_Wrapper.hxx"
+
+#include "SALOME_NamingService.hxx"
+#include "SALOME_Fake_NamingService.hxx"
+#include "KernelBasis.hxx"
+
+BL_SALOME_NamingService_Wrapper::BL_SALOME_NamingService_Wrapper()
+{
+  this->initializeEffectiveNS();
+}
+
+BL_SALOME_NamingService_Wrapper::BL_SALOME_NamingService_Wrapper(CORBA::ORB_ptr orb)
+{
+  this->initializeEffectiveNS();
+  this->_effective_ns->init_orb(orb);
+}
+
+BL_SALOME_NamingService_Wrapper::BL_SALOME_NamingService_Wrapper(const BL_SALOME_NamingService_Wrapper& other):_effective_ns(other._effective_ns->cloneCoVar())
+{
+}
+
+void BL_SALOME_NamingService_Wrapper::initializeEffectiveNS()
+{
+  if(getSSLMode())
+    _effective_ns.reset( new SALOME_Fake_NamingService );
+  else
+    _effective_ns.reset( new SALOME_NamingService );
+}
diff --git a/src/engine/BL_NamingService_Wrapper.hxx b/src/engine/BL_NamingService_Wrapper.hxx
new file mode 100644 (file)
index 0000000..dad3d98
--- /dev/null
@@ -0,0 +1,57 @@
+// Copyright (C) 2021  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#pragma once
+
+#include "SALOME_NamingService_Abstract.hxx"
+#include "BL_Engine.hxx"
+
+#include <memory>
+
+/*!
+ * Decorator class that allows JobManager engine to switch between :
+ * - NamingService CORBA server (SALOME_NamingService)
+ * - NamingService embedded (SALOME_Fake_NamingService)
+ */
+class BL_Engine_EXPORT BL_SALOME_NamingService_Wrapper : public SALOME_NamingService_Abstract
+{
+public:
+  BL_SALOME_NamingService_Wrapper();
+  BL_SALOME_NamingService_Wrapper(CORBA::ORB_ptr orb);
+  std::vector< std::string > repr() override { return _effective_ns->repr(); }
+  void init_orb(CORBA::ORB_ptr orb=0) override { _effective_ns->init_orb(orb); }
+  bool IsTrueNS() const override { return _effective_ns->IsTrueNS(); }
+  void Register(CORBA::Object_ptr ObjRef, const char* Path) override { _effective_ns->Register(ObjRef,Path); }
+  CORBA::Object_ptr Resolve(const char* Path) override { return _effective_ns->Resolve(Path); }
+  CORBA::Object_ptr ResolveFirst(const char* Path) override { return _effective_ns->ResolveFirst(Path); }
+  void Destroy_Name(const char* Path) override { _effective_ns->Destroy_Name(Path); }
+  void Destroy_Directory(const char* Path) override { _effective_ns->Destroy_Directory(Path); }
+  void Destroy_FullDirectory(const char* Path) override { _effective_ns->Destroy_FullDirectory(Path); }
+  bool Change_Directory(const char* Path) override { return _effective_ns->Change_Directory(Path); }
+  std::vector<std::string> list_subdirs() override { return _effective_ns->list_directory(); }
+  std::vector<std::string> list_directory() override { return _effective_ns->list_directory(); }
+  std::vector<std::string> list_directory_recurs() override { return _effective_ns->list_directory_recurs(); }
+  SALOME_NamingService_Abstract *clone() override { return new BL_SALOME_NamingService_Wrapper(*this); }
+  CORBA::Object_ptr ResolveComponent(const char* hostname, const char* containerName, const char* componentName, const int nbproc=0) override { return _effective_ns->ResolveComponent(hostname,containerName,componentName,nbproc); }
+private:
+  BL_SALOME_NamingService_Wrapper(const BL_SALOME_NamingService_Wrapper& other);
+  void initializeEffectiveNS();
+private:
+  std::unique_ptr<SALOME_NamingService_Abstract> _effective_ns;
+};
index 25cbb0f04d05defe7419a5fa5ddeac31b5df2151..ff67bd0512eea9fdbe31064a846b56ede40ba7c1 100644 (file)
@@ -61,7 +61,7 @@ bool
 BL::SALOMEServices::initNS()
 {
   bool return_value = true;
-  _salome_naming_service = new SALOME_NamingService(_orb);
+  _salome_naming_service = new BL_SALOME_NamingService_Wrapper(_orb);
   _lcc = new SALOME_LifeCycleCORBA(_salome_naming_service);
   CORBA::Object_var obj = _salome_naming_service->Resolve("/SalomeLauncher");
   _salome_launcher = Engines::SalomeLauncher::_narrow(obj);
index 83f141a73a6251eef3a94ec3144d3b557592e13b..dd7e0f637f5e9827c8cf7dd9faecc24d90f480a5 100644 (file)
@@ -23,6 +23,7 @@
 #include "BL_Engine.hxx"
 #include "BL_Traces.hxx"
 #include "BL_Job.hxx"
+#include "BL_NamingService_Wrapper.hxx"
 
 #include "SALOME_NamingService.hxx"
 #include "SALOME_LifeCycleCORBA.hxx"
@@ -97,7 +98,7 @@ namespace BL{
 
     private:
       CORBA::ORB_var _orb;
-      SALOME_NamingService * _salome_naming_service;
+      BL_SALOME_NamingService_Wrapper * _salome_naming_service;
       SALOME_LifeCycleCORBA * _lcc;
       Engines::SalomeLauncher_var _salome_launcher;
       Engines::ResourcesManager_var _resources_manager;
index d1e9493f732a3df1e381ce62baa33c98e2808a04..94ada3972f0c2723c20723129df303d2977a5d23 100644 (file)
@@ -53,6 +53,8 @@ SET(BL_Engine_SOURCES
   BL_SALOMEServices.hxx 
   BL_SALOMEServices.cxx
   BL_Observer.hxx
+  BL_NamingService_Wrapper.hxx
+  BL_NamingService_Wrapper.cxx
 )
 
 # --- rules ---
index 460aaba67f91cb2f8c5d20d29a99ab6ce96b3bcb..7cb164eab67e384985ee5eedc7bf61b5e48519be 100644 (file)
@@ -70,6 +70,7 @@ SET(_other_SOURCES
 # --- resources ---
 
 SALOME_CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/resources/SalomeApp.xml.in ${CMAKE_CURRENT_BINARY_DIR}/resources/SalomeApp.xml INSTALL ${SALOME_JOBMANAGER_INSTALL_RES_DATA})
+SALOME_CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/resources/SalomeApp.xml.in ${CMAKE_CURRENT_BINARY_DIR}/resources/SalomeAppSL.xml INSTALL ${SALOME_JOBMANAGER_INSTALL_RES_DATA})
 
 # resource files / static
 SET(_other_RESOURCES