From 077491647e4e3f8d6c904f55f7f0a2e73c0fbd2c Mon Sep 17 00:00:00 2001 From: Anthony GEAY Date: Sun, 21 Feb 2021 22:36:20 +0100 Subject: [PATCH] Make the helper KERNEL::getNamingService used by Study to retrieve Session SSL ready --- src/SalomeApp/SalomeApp_Application.cxx | 10 +++++----- src/SalomeApp/SalomeApp_Application.h | 2 +- src/SalomeApp/SalomeApp_Application_SL.cxx | 3 +-- src/Session/Session_NS_wrapper.cxx | 7 +++++++ src/Session/Session_NS_wrapper.hxx | 2 ++ src/Session/Session_ServerLauncher.cxx | 2 +- 6 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index b02c12a7a..d5cc4fb44 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -176,12 +176,12 @@ namespace } /*!Constructor.*/ -SalomeApp_Application::SalomeApp_Application() - : LightApp_Application(), - myIsCloseFromExit( false ), - myToIgnoreMessages( false ) +SalomeApp_Application::SalomeApp_Application(SALOME_NamingService_Abstract *ns):myIsCloseFromExit( false ),myToIgnoreMessages( false ) { - _ns.reset(new SALOME_NamingService(orb())); + if(!ns) + _ns.reset(new SALOME_NamingService(orb())); + else + _ns.reset(ns); } /*!Destructor. diff --git a/src/SalomeApp/SalomeApp_Application.h b/src/SalomeApp/SalomeApp_Application.h index 165c6fb3b..a29b67c21 100644 --- a/src/SalomeApp/SalomeApp_Application.h +++ b/src/SalomeApp/SalomeApp_Application.h @@ -84,7 +84,7 @@ protected: enum { LoadStudyId = LightApp_Application::OpenStudyId + 1, NewAndScriptId }; public: - SalomeApp_Application(); + SalomeApp_Application(SALOME_NamingService_Abstract *ns = nullptr); virtual ~SalomeApp_Application(); virtual void updateObjectBrowser( const bool = true ); diff --git a/src/SalomeApp/SalomeApp_Application_SL.cxx b/src/SalomeApp/SalomeApp_Application_SL.cxx index eebf34bdd..def6831ad 100644 --- a/src/SalomeApp/SalomeApp_Application_SL.cxx +++ b/src/SalomeApp/SalomeApp_Application_SL.cxx @@ -21,7 +21,6 @@ #include "SALOME_Fake_NamingService.hxx" -SalomeApp_Application_SL::SalomeApp_Application_SL() +SalomeApp_Application_SL::SalomeApp_Application_SL():SalomeApp_Application( new SALOME_Fake_NamingService ) { - _ns.reset( new SALOME_Fake_NamingService ); } diff --git a/src/Session/Session_NS_wrapper.cxx b/src/Session/Session_NS_wrapper.cxx index cbd4b5974..a5dd110a7 100644 --- a/src/Session/Session_NS_wrapper.cxx +++ b/src/Session/Session_NS_wrapper.cxx @@ -223,6 +223,13 @@ CosNaming::NamingContext_var OldStyleNS::checkTrueNamingServiceIfExpected(int ar return _root_context; } +#include "SALOME_KernelServices.hxx" + +void NewStyleNS::defineDefaultSALOMEKERNELNamingService() +{ + KERNEL::assignNamingServiceSL(); +} + Engines_Container_i *NewStyleNS::activateContainer(CORBA::ORB_var orb, PortableServer::POA_var poa, int argc, char **argv) { return KERNEL::getContainerSA(); diff --git a/src/Session/Session_NS_wrapper.hxx b/src/Session/Session_NS_wrapper.hxx index 96c929b4e..85518aff0 100644 --- a/src/Session/Session_NS_wrapper.hxx +++ b/src/Session/Session_NS_wrapper.hxx @@ -38,6 +38,7 @@ public: CORBA::Object_ptr Resolve(const char* Path) { return _NS.Resolve(Path); } RealNS *getNS() { return &_NS; } Engines_Container_i *activateContainer(CORBA::ORB_var orb, PortableServer::POA_var poa, int argc, char** argv); + static void defineDefaultSALOMEKERNELNamingService() { /* nothing to do by default true NamingService server is considered */ } static void activateContainerManager(CORBA::ORB_var orb); static void activateSession(CORBA::ORB_var orb, PortableServer::POA_var poa, QMutex *GUIMutex, QWaitCondition *GUILauncher, int argc, char ** argv); static void activateSALOMEDS(CORBA::ORB_var orb, PortableServer::POA_var poa); @@ -60,6 +61,7 @@ public: CORBA::Object_ptr Resolve(const char* Path) { return _NS.Resolve(Path); } RealNS *getNS() { return &_NS; } Engines_Container_i *activateContainer(CORBA::ORB_var orb, PortableServer::POA_var poa, int argc, char** argv); + static void defineDefaultSALOMEKERNELNamingService(); static void activateContainerManager(CORBA::ORB_var orb); static void activateSession(CORBA::ORB_var orb, PortableServer::POA_var poa, QMutex *GUIMutex, QWaitCondition *GUILauncher, int argc, char ** argv); static void activateSALOMEDS(CORBA::ORB_var orb, PortableServer::POA_var poa); diff --git a/src/Session/Session_ServerLauncher.cxx b/src/Session/Session_ServerLauncher.cxx index 73ed5b118..fd8f638db 100644 --- a/src/Session/Session_ServerLauncher.cxx +++ b/src/Session/Session_ServerLauncher.cxx @@ -63,7 +63,7 @@ Session_ServerLauncher::Session_ServerLauncher(int argc, _ServerLaunch = ServerLaunch; _SessionMutex = SessionMutex; _SessionStarted = SessionStarted; - + MY_NS::defineDefaultSALOMEKERNELNamingService(); // start thread start(); } -- 2.39.2