threadPol->destroy();
PortableServer::ObjectId_var id = _poa->activate_object(this);
CORBA::Object_var obj = _poa->id_to_reference(id);
- Engines::ContainerManager_var refContMan =
- Engines::ContainerManager::_narrow(obj);
-
- _NS->Register(refContMan,_ContainerManagerNameInNS);
+ Engines::ContainerManager_var refContMan = Engines::ContainerManager::_narrow(obj);
+ if(_NS)
+ _NS->Register(refContMan,_ContainerManagerNameInNS);
_isAppliSalomeDefined = (GetenvThreadSafe("APPLI") != 0);
#ifdef HAVE_MPI2
{
MESSAGE("Shutdown");
ShutdownContainers();
- _NS->Destroy_Name(_ContainerManagerNameInNS);
+ if(_NS)
+ _NS->Destroy_Name(_ContainerManagerNameInNS);
PortableServer::ObjectId_var oid = _poa->servant_to_id(this);
_poa->deactivate_object(oid);
}
void SALOME_ContainerManager::ShutdownContainers()
{
MESSAGE("ShutdownContainers");
-
+ if(!_NS)
+ return ;
SALOME::Session_var session = SALOME::Session::_nil();
CORBA::Long pid = 0;
CORBA::Object_var objS = _NS->Resolve("/Kernel/Session");
* \param orb
*/
//=============================================================================
-SALOME_Launcher::SALOME_Launcher(CORBA::ORB_ptr orb, PortableServer::POA_var poa) : _l()
+SALOME_Launcher::SALOME_Launcher(CORBA::ORB_ptr orb, PortableServer::POA_var poa)
{
MESSAGE("SALOME_Launcher constructor");
_NS = new SALOME_NamingService(orb);
- _ResManager = new SALOME_ResourcesManager(orb,poa,_NS);
+ init(orb,poa);
+ MESSAGE("SALOME_Launcher constructor end");
+}
+
+SALOME_Launcher::SALOME_Launcher(CORBA::ORB_ptr orb, PortableServer::POA_var poa, SALOME_NamingService_Abstract *externalNS):_NS(externalNS)
+{
+ init(orb,poa);
+}
+
+void SALOME_Launcher::init(CORBA::ORB_ptr orb, PortableServer::POA_var poa)
+{
+ _ResManager = new SALOME_ResourcesManager(orb,poa,tradNS());
_l.SetResourcesManager(_ResManager->GetImpl());
- _ContManager = new SALOME_ContainerManager(orb,poa,_NS);
+ _ContManager = new SALOME_ContainerManager(orb,poa,tradNS());
_ResManager->_remove_ref();
_ContManager->_remove_ref();
PortableServer::ObjectId_var id = _poa->activate_object(this);
CORBA::Object_var obj = _poa->id_to_reference(id);
Engines::SalomeLauncher_var refContMan = Engines::SalomeLauncher::_narrow(obj);
-
_NS->Register(refContMan,_LauncherNameInNS);
- MESSAGE("SALOME_Launcher constructor end");
}
//=============================================================================
void SALOME_Launcher::Shutdown()
{
MESSAGE("Shutdown");
+ if(!_NS)
+ return;
_NS->Destroy_Name(_LauncherNameInNS);
_ContManager->Shutdown();
_ResManager->Shutdown();
result->launcher_args = CORBA::string_dup(job_parameters.launcher_args.c_str());
return result;
}
+
+static SALOME_Launcher *_launcher_singleton_ssl = nullptr;
+
+#include "SALOME_Fake_NamingService.hxx"
+
+SALOME_Launcher *KERNEL::getLauncherSA()
+{
+ if(!_launcher_singleton_ssl)
+ {
+ int argc(0);
+ CORBA::ORB_var orb = CORBA::ORB_init(argc,nullptr);
+ PortableServer::POA_var root_poa=PortableServer::POA::_the_root_poa();
+ SALOME_Fake_NamingService *ns=new SALOME_Fake_NamingService(orb);
+ _launcher_singleton_ssl = new SALOME_Launcher(orb,root_poa,ns);//3rd arg is important to skip NS !
+ }
+ return _launcher_singleton_ssl;
+}
#include "SALOME_Launcher_defs.hxx"
-#include <SALOMEconfig.h>
+#include "SALOME_NamingService.hxx"
+#include "SALOMEconfig.h"
#include CORBA_CLIENT_HEADER(SALOME_Launcher)
#include "Launcher.hxx"
#include <string>
#include <list>
-class SALOME_NamingService;
class SALOME_ContainerManager;
class SALOME_ResourcesManager;
public:
SALOME_Launcher(CORBA::ORB_ptr orb, PortableServer::POA_var poa);
+ SALOME_Launcher(CORBA::ORB_ptr orb, PortableServer::POA_var poa, SALOME_NamingService_Abstract *externalNS);
virtual ~SALOME_Launcher();
-
// Main methods
CORBA::Long createJob (const Engines::JobParameters & job_parameters);
void launchJob (CORBA::Long job_id);
static Engines::JobParameters_var
JobParameters_CPP2CORBA(const JobParameters_cpp& job_parameters);
+ SALOME_NamingService *tradNS() { return SALOME_NamingService::GetTraditionalNS(_NS); }
+
protected:
// Internal methods
virtual void notifyObservers(const std::string & event_name, const std::string & event_data);
-
+ void init(CORBA::ORB_ptr orb, PortableServer::POA_var poa);
protected:
CORBA::ORB_var _orb;
PortableServer::POA_var _poa;
SALOME_ContainerManager *_ContManager;
SALOME_ResourcesManager *_ResManager;
- SALOME_NamingService *_NS;
+ SALOME_NamingService_Abstract *_NS = nullptr;
std::list<Engines::SalomeLauncherObserver_var> _observers;
Launcher_cpp _l;
};
+/*!
+ * Methods to be used in SSL mode to skip NS.
+ */
+namespace KERNEL
+{
+ SALOMELAUNCHER_EXPORT SALOME_Launcher *getLauncherSA();
+}
+
#endif
#include "SALOME_Fake_NamingService.hxx"
#include "Utils_SALOME_Exception.hxx"
-SALOME_Fake_NamingService::SALOME_Fake_NamingService(CORBA::ORB_ptr orb):_orb(CORBA::ORB::_duplicate(orb))
+std::mutex SALOME_Fake_NamingService::_mutex;
+std::map<std::string,CORBA::Object_var> SALOME_Fake_NamingService::_map;
+
+SALOME_Fake_NamingService::SALOME_Fake_NamingService(CORBA::ORB_ptr orb)
{
}
_map[Path] = ObjRefAuto;
}
+void SALOME_Fake_NamingService::Destroy_Name(const char* Path)
+{
+}
+
CORBA::Object_ptr SALOME_Fake_NamingService::Resolve(const char* Path)
{
std::string pathCpp(Path);
#include "omniORB4/CORBA.h"
+#include "SALOME_NamingService_Abstract.hxx"
+
#include <mutex>
#include <string>
#include <map>
-class SALOME_Fake_NamingService
+class NAMINGSERVICE_EXPORT SALOME_Fake_NamingService : public SALOME_NamingService_Abstract
{
public:
SALOME_Fake_NamingService(CORBA::ORB_ptr orb);
- void Register(CORBA::Object_ptr ObjRef, const char* Path);
- CORBA::Object_ptr Resolve(const char* Path);
-private:
- CORBA::ORB_var _orb;
- std::mutex _mutex;
- std::map<std::string,CORBA::Object_var> _map;
+ void Register(CORBA::Object_ptr ObjRef, const char* Path) override;
+ CORBA::Object_ptr Resolve(const char* Path) override;
+ void Destroy_Name(const char* Path) override;
+private:
+ static std::mutex _mutex;
+ static std::map<std::string,CORBA::Object_var> _map;
};
//MESSAGE("SALOME_NamingService destruction");
}
+SALOME_NamingService *SALOME_NamingService::GetTraditionalNS(SALOME_NamingService_Abstract *ns)
+{
+ SALOME_NamingService *nsc(dynamic_cast<SALOME_NamingService *>(ns));
+ return nsc;
+}
+
// ============================================================================
/*! \brief initializes ORB reference and naming service root context.
*
#include "Utils_Mutex.hxx"
#include "ServiceUnreachable.hxx"
-#include "SALOME_NamingService_defs.hxx"
+#include "SALOME_NamingService_Abstract.hxx"
#ifdef WIN32
//#pragma warning(disable:4290) // Warning Exception ...
#endif
-class NAMINGSERVICE_EXPORT SALOME_NamingService
+class NAMINGSERVICE_EXPORT SALOME_NamingService : public SALOME_NamingService_Abstract
{
public:
SALOME_NamingService();
SALOME_NamingService(CORBA::ORB_ptr orb);
virtual ~SALOME_NamingService();
+
+ static SALOME_NamingService *GetTraditionalNS(SALOME_NamingService_Abstract *ns);
void init_orb(CORBA::ORB_ptr orb=0);
- void Register(CORBA::Object_ptr ObjRef, const char* Path) ;
- CORBA::Object_ptr Resolve(const char* Path) ;
+ void Register(CORBA::Object_ptr ObjRef, const char* Path) override;
+ CORBA::Object_ptr Resolve(const char* Path) override;
CORBA::Object_ptr ResolveFirst(const char* Path) ;
CORBA::Object_ptr ResolveComponent(const char* hostname,
const char* containerName,
std::vector<std::string> list_directory() ;
std::vector<std::string> list_subdirs() ;
std::vector<std::string> list_directory_recurs() ;
- void Destroy_Name(const char* Path) ;
+ void Destroy_Name(const char* Path) override;
virtual void Destroy_Directory(const char* Path) ;
virtual void Destroy_FullDirectory(const char* Path) ;
char *getIORaddr();
--- /dev/null
+// Copyright (C) 2021 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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_defs.hxx"
+
+#include "omniORB4/CORBA.h"
+
+class NAMINGSERVICE_EXPORT SALOME_NamingService_Abstract
+{
+public:
+ virtual void Register(CORBA::Object_ptr ObjRef, const char* Path) = 0;
+ virtual CORBA::Object_ptr Resolve(const char* Path) = 0;
+ virtual void Destroy_Name(const char* Path) = 0;
+ virtual ~SALOME_NamingService_Abstract() { }
+};
PortableServer::ObjectId_var id = _poa->activate_object(this);
CORBA::Object_var obj = _poa->id_to_reference(id);
Engines::ResourcesManager_var refContMan = Engines::ResourcesManager::_narrow(obj);
- _NS->Register(refContMan,_ResourcesManagerNameInNS);
+ if(_NS)
+ _NS->Register(refContMan,_ResourcesManagerNameInNS);
MESSAGE("SALOME_ResourcesManager constructor end");
}
void SALOME_ResourcesManager::Shutdown()
{
MESSAGE("Shutdown");
+ if(!_NS)
+ return ;
_NS->Destroy_Name(_ResourcesManagerNameInNS);
PortableServer::ObjectId_var oid = _poa->servant_to_id(this);
_poa->deactivate_object(oid);