DF SalomeLoggerServer with_loggerTraceCollector SalomeNS SalomeGenericObj
Registry SalomeCatalog ResourcesManager SalomeResourcesManager
SalomeNotification SalomeContainer SalomeSDS Launcher SalomeLauncher
- SalomeLifeCycleCORBA SalomeDSClient TOOLSDS SalomeKernelHelpers
+ SalomeLifeCycleCORBA SalomeDSClient TOOLSDS SalomeKernelHelpers SalomeORB
SalomeDSImpl SalomeDS SalomeCommunication SalomeDSCContainer)
# Temporary solution for package src\DSC on windows
IF(NOT WIN32)
SET(KERNEL_UtilsTest UtilsTest)
SET(KERNEL_with_loggerTraceCollector with_loggerTraceCollector)
SET(KERNEL_SalomeKernelHelpers SalomeKernelHelpers)
+SET(KERNEL_SalomeORB SalomeORB)
SALOME_TestModuleCatalog.idl
SALOME_CommonTypes.idl
SALOME_ExternalServerLauncher.idl
+ SALOME_Embedded_NamingService.idl
${CMAKE_CURRENT_BINARY_DIR}/Calcium_Ports.idl
)
#include "SALOMEDS.idl"
#include "SALOME_Exception.idl"
#include "SALOME_PyNode.idl"
+#include "SALOME_Embedded_NamingService.idl"
/*! \file SALOME_Component.idl \brief interfaces for EngineComponent and Container
*/
\param component_i Component to be removed
*/
void remove_impl(in EngineComponent component_i);
+
+ //! In case of SSL mode Returns entry to Embedded NS
+ EmbeddedNamingService get_embedded_NS_if_ssl();
//! Unload component libraries from the container.
void finalize_removal() ;
--- /dev/null
+// Copyright (C) 2007-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
+//
+
+#ifndef _SALOME_EMBEDDED_NAMINGSERVICE_IDL_
+#define _SALOME_EMBEDDED_NAMINGSERVICE_IDL_
+
+module Engines
+{
+ typedef sequence<octet> IORType;
+
+ interface EmbeddedNamingService
+ {
+ void Register(in IORType ObjRef, in string Path);
+ void Destroy_FullDirectory(in string Path);
+ void Destroy_Name(in string Path);
+ IORType Resolve(in string Path);
+ IORType ResolveFirst(in string Path);
+ };
+};
+
+#endif
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+include(${SWIG_USE_FILE})
+
INCLUDE_DIRECTORIES(
${PTHREAD_INCLUDE_DIR}
+ ${PYTHON_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_SOURCE_DIR}
)
SET(SALOMEBasics_SOURCES
BasicsGenericDestructor.hxx
Basics_Utils.hxx
Basics_DirUtils.hxx
+ KernelBasis.cxx
)
ADD_LIBRARY(SALOMEBasics ${SALOMEBasics_SOURCES})
FILE(GLOB SALOMEBasics_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx")
INSTALL(FILES ${SALOMEBasics_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS})
-SALOME_CONFIGURE_FILE(smIdType.hxx.in smIdType.hxx INSTALL ${SALOME_INSTALL_HEADERS})
\ No newline at end of file
+SET(KernelBasis_HEADERS KernelBasis.hxx KernelBasis.i)
+SET(KernelBasis_SOURCES ${KernelBasis_HEADERS})
+SET_SOURCE_FILES_PROPERTIES(KernelBasis.i PROPERTIES CPLUSPLUS ON)
+SET_SOURCE_FILES_PROPERTIES(KernelBasis.i PROPERTIES SWIG_FLAGS "-py3")
+SET_SOURCE_FILES_PROPERTIES(KernelBasis_wrap.cpp PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H")
+SET(_swig_SCRIPTS ${CMAKE_CURRENT_BINARY_DIR}/KernelBasis.py )
+IF(${CMAKE_VERSION} VERSION_LESS "3.8.0")
+ SWIG_ADD_MODULE(KernelBasis python ${KernelBasis_SOURCES})
+ELSE()
+ SWIG_ADD_LIBRARY(KernelBasis LANGUAGE python SOURCES ${KernelBasis_SOURCES})
+ENDIF()
+SWIG_LINK_LIBRARIES(KernelBasis ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} SALOMEBasics)
+install(TARGETS _KernelBasis DESTINATION ${SALOME_INSTALL_LIBS})
+install(FILES ${KernelBasis_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
+SALOME_INSTALL_SCRIPTS("${_swig_SCRIPTS}" ${SALOME_INSTALL_BINS} EXTRA_DPYS "${SWIG_MODULE_KernelBasis_REAL_NAME}")
+
+SALOME_CONFIGURE_FILE(smIdType.hxx.in smIdType.hxx INSTALL ${SALOME_INSTALL_HEADERS})
+
--- /dev/null
+// 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 "KernelBasis.hxx"
+
+static bool DEFAULT_SSL_MODE = false;
+
+bool getSSLMode()
+{
+ return DEFAULT_SSL_MODE;
+}
+
+void setSSLMode(bool sslMode)
+{
+ DEFAULT_SSL_MODE = sslMode;
+}
--- /dev/null
+// 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_Basics.hxx"
+
+bool BASICS_EXPORT getSSLMode();
+void BASICS_EXPORT setSSLMode(bool sslMode);
--- /dev/null
+// 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
+//
+
+%module KernelBasis
+
+%{
+#include "KernelBasis.hxx"
+%}
+
+bool getSSLMode();
+void setSSLMode(bool sslMode);
${CMAKE_CURRENT_SOURCE_DIR}/../HDFPersist
${CMAKE_CURRENT_SOURCE_DIR}/../GenericObj
${CMAKE_CURRENT_SOURCE_DIR}/../SALOMETraceCollector/Test
+ ${CMAKE_CURRENT_SOURCE_DIR}/../KernelHelpers
${PROJECT_BINARY_DIR}/idl
)
${MPI_LIBRARIES}
)
-ADD_EXECUTABLE(SALOME_Container SALOME_Container.cxx SALOME_Container_SignalsHandler.cxx)
-TARGET_LINK_LIBRARIES(SALOME_Container ${SALOME_Container_LIBS})
+ADD_LIBRARY(SalomeContainerServer SALOME_Container_Common.cxx SALOME_Container_SignalsHandler.cxx)
+TARGET_LINK_LIBRARIES(SalomeContainerServer ${SALOME_Container_LIBS})
+INSTALL(TARGETS SalomeContainerServer EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
+
+ADD_EXECUTABLE(SALOME_Container SALOME_Container.cxx)
+TARGET_LINK_LIBRARIES(SALOME_Container SalomeContainerServer)
+
+ADD_EXECUTABLE(SALOME_Container_No_NS_Serv SALOME_Container_No_NS_Serv.cxx)
+TARGET_LINK_LIBRARIES(SALOME_Container_No_NS_Serv SalomeContainerServer)
IF(SALOME_BUILD_TESTS)
ADD_EXECUTABLE(TestSalome_file TestSalome_file.cxx)
TARGET_LINK_LIBRARIES(TestSalome_file SALOMETraceCollectorTest ${SALOME_Container_LIBS})
ENDIF()
-INSTALL(TARGETS SALOME_Container DESTINATION ${SALOME_INSTALL_BINS})
+INSTALL(TARGETS SALOME_Container SALOME_Container_No_NS_Serv DESTINATION ${SALOME_INSTALL_BINS})
# Executable scripts to be installed
SALOME_INSTALL_SCRIPTS("${SCRIPTS}" ${SALOME_INSTALL_SCRIPT_PYTHON})
#include "Salome_file_i.hxx"
#include "SALOME_NamingService.hxx"
#include "SALOME_Fake_NamingService.hxx"
+#include "SALOME_Embedded_NamingService_Client.hxx"
#include "Basics_Utils.hxx"
#ifdef _XOPEN_SOURCE
PortableServer::POA_ptr poa,
char *containerName ,
int argc , char* argv[],
- SALOME_NamingService_Abstract *ns,
+ SALOME_NamingService_Container_Abstract *ns,
bool isServantAloneInProcess
) :
- _NS(0),_id(0),_numInstance(0),_isServantAloneInProcess(isServantAloneInProcess)
+ _NS(nullptr),_id(0),_numInstance(0),_isServantAloneInProcess(isServantAloneInProcess)
{
_pid = (long)getpid();
{
_id = _poa->activate_object(this);
+ // key point : if ns is nullptr : this servant is alone in its process
+ // if ns is not null : this servant embedded into single process.
_NS = ns==nullptr ? new SALOME_NamingService : ns->clone();
_NS->init_orb( _orb ) ;
CORBA::Object_var obj=_poa->id_to_reference(*_id);
- Engines::Container_var pCont
- = Engines::Container::_narrow(obj);
+ Engines::Container_var pCont = Engines::Container::_narrow(obj);
_remove_ref();
- _containerName = _NS->BuildContainerNameForNS(containerName,
- hostname.c_str());
+ _containerName = SALOME_NamingService_Abstract::BuildContainerNameForNS(containerName, hostname.c_str());
SCRUTE(_containerName);
_NS->Register(pCont, _containerName.c_str());
- MESSAGE("Engines_Container_i::Engines_Container_i : Container name "
- << _containerName);
+ MESSAGE("Engines_Container_i::Engines_Container_i : Container name " << _containerName);
// Python:
// import SALOME_Container
}
_listInstances_map.clear();
- _NS->Destroy_FullDirectory(_containerName.c_str());
- _NS->Destroy_Name(_containerName.c_str());
+ // NS unregistering may throw in SSL mode if master process hosting SALOME_Embedded_NamingService servant has vanished
+ // In this case it's skip it and still continue.
+ try
+ {
+ _NS->Destroy_FullDirectory(_containerName.c_str());
+ _NS->Destroy_Name(_containerName.c_str());
+ }
+ catch(...)
+ {
+ }
+ //
if(_isServantAloneInProcess)
{
MESSAGE("Effective Shutdown of container Begins...");
return iobject._retn();
}
+Engines::EmbeddedNamingService_ptr Engines_Container_i::get_embedded_NS_if_ssl()
+{
+ SALOME_Embedded_NamingService_Client *nsc(dynamic_cast<SALOME_Embedded_NamingService_Client *>(this->_NS));
+ if(nsc)
+ {
+ Engines::EmbeddedNamingService_var obj = nsc->GetObject();
+ return Engines::EmbeddedNamingService::_duplicate(obj);
+ }
+ else
+ {
+ return Engines::EmbeddedNamingService::_nil();
+ }
+}
+
//=============================================================================
//! Finds an already existing component instance or create a new instance
/*!
import Registry
from Utils_Identity import *
from SALOME_NamingServicePy import *
+from SALOME_Embedded_NamingService_ClientPy import SALOME_Embedded_NamingService_ClientPy
from libNOTIFICATION import *
from SALOME_utilities import *
"""
def __init__ (self, orb, poa, contID, containerName, instanceName, interfaceName, notif=False):
SALOME_ComponentPy_Gen_i.__init__(self, orb, poa, contID, containerName, instanceName, interfaceName, notif)
- naming_service = SALOME_NamingServicePy_i(self._orb)
+ emb_ns = self._contId.get_embedded_NS_if_ssl()
+ if CORBA.is_nil(emb_ns):
+ self._naming_service = SALOME_NamingServicePy_i(self._orb)
+ else:
+ self._naming_service = SALOME_Embedded_NamingService_ClientPy(emb_ns)
Component_path = self._containerName + "/" + self._instanceName
MESSAGE( 'SALOME_ComponentPy_i Register' + str( Component_path ) )
- naming_service.Register(self._compo_o, Component_path)
+ self._naming_service.Register(self._compo_o, Component_path)
# Add componentinstance to registry
- obj = naming_service.Resolve('/Registry')
+ obj = self._naming_service.Resolve('/Registry')
if obj is None:
MESSAGE( "Registry Reference is invalid" )
else:
-// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// 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
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// SALOME Container : implementation of container and engine for Kernel
-// File : SALOME_Container.cxx
-// Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
-// Module : SALOME
-// $Header$
-//
-#ifdef _MPI_SEQ_CONTAINER_
- #ifdef HAVE_MPI2
-#include <mpi.h>
- #endif
-#endif
-
-#include <iostream>
-#include <sstream>
-#include <string>
-#include <stdio.h>
-#include <time.h>
-#ifndef WIN32
-# include <sys/time.h>
-# include <dlfcn.h>
-#endif
-
-
-#ifndef WIN32
-#include <unistd.h>
-#else
-#include <process.h>
-#endif
-#include "SALOME_Container_i.hxx"
-#include "utilities.h"
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
-#include "OpUtil.hxx"
-
-#ifdef CHECKTIME
-#include <Utils_Timer.hxx>
-#endif
-
-#include "Container_init_python.hxx"
-
-extern "C" void HandleServerSideSignals(CORBA::ORB_ptr theORB);
-
-#include <stdexcept>
-#include <signal.h>
-#include <sys/types.h>
-#ifndef WIN32
-# include <sys/wait.h>
-#endif
-
-void AttachDebugger();
-void Handler(int);
-void terminateHandler();
-void unexpectedHandler();
-
-#ifndef WIN32
-void (* setsig(int, void (*)(int)))(int);
-
-typedef void (*sighandler_t)(int);
-sighandler_t setsig(int sig, sighandler_t handler)
-{
- struct sigaction context, ocontext;
- context.sa_handler = handler;
- sigemptyset(&context.sa_mask);
- context.sa_flags = 0;
- if (sigaction(sig, &context, &ocontext) == -1)
- return SIG_ERR;
- return ocontext.sa_handler;
-}
-#endif //WIN32
-
-void AttachDebugger()
-{
-#ifndef WIN32
- if(getenv ("DEBUGGER"))
- {
- std::stringstream exec;
- exec << "$DEBUGGER SALOME_Container " << getpid() << "&";
- std::cerr << exec.str() << std::endl;
- system(exec.str().c_str());
- while(1);
- }
-#endif
-}
-
-void Handler(int theSigId)
-{
- std::cerr << "Signal= "<< theSigId << std::endl;
- AttachDebugger();
- //to exit or not to exit
- _exit(1);
-}
-
-void terminateHandler(void)
-{
- std::cerr << "Terminate: not managed exception !" << std::endl;
- AttachDebugger();
-}
-
-void unexpectedHandler(void)
-{
- std::cerr << "Unexpected: unexpected exception !" << std::endl;
- AttachDebugger();
-}
+#include "SALOME_Container_Common.hxx"
+#include "SALOME_NamingService.hxx"
int main(int argc, char* argv[])
{
-#ifdef _MPI_SEQ_CONTAINER_
- #ifdef HAVE_MPI2
- MPI_Init(&argc,&argv);
- #endif
-#endif
-
-#ifndef WIN32
- if(getenv ("DEBUGGER"))
- {
- setsig(SIGSEGV,&Handler);
- setsig(SIGFPE,&Handler);
- std::set_terminate(&terminateHandler);
- std::set_unexpected(&unexpectedHandler);
- }
-#endif
-
- // Initialise the ORB.
- //SRN: BugID: IPAL9541, it's necessary to set a size of one message to be at least 100Mb
- //CORBA::ORB_var orb = CORBA::ORB_init( argc , argv ) ;
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
- CORBA::ORB_ptr orb = init(argc , argv ) ;
-
- // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
- INFOS_COMPILATION;
- BEGIN_OF(argv[0]);
-
- ASSERT(argc > 1);
- SCRUTE(argv[1]);
-
- KERNEL_PYTHON::init_python(argc,argv);
-
- char *containerName = (char *)"";
- if(argc > 1)
- {
- containerName = argv[1] ;
- }
-
- try
- {
- CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
- ASSERT(!CORBA::is_nil(obj));
- PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj);
-
- PortableServer::POAManager_var pman = root_poa->the_POAManager();
-
- // add new container to the kill list
-#ifndef WIN32
- std::stringstream aCommand ;
- aCommand << "addToKillList.py " << getpid() << " SALOME_Container" << std::ends ;
- system(aCommand.str().c_str());
-#endif
-
- new Engines_Container_i(orb, root_poa, containerName , argc , argv );
-
- pman->activate();
-
-#ifdef CHECKTIME
- Utils_Timer timer;
- timer.Start();
- timer.Stop();
- timer.ShowAbsolute();
-#endif
-
- HandleServerSideSignals(orb);
-
-//#define MEMORYLEAKS
-#ifdef MEMORYLEAKS
- PyGILState_Ensure();
- //Destroy orb from python (for chasing memory leaks)
- PyRun_SimpleString("from omniORB import CORBA");
- PyRun_SimpleString("orb=CORBA.ORB_init([''], CORBA.ORB_ID)");
- PyRun_SimpleString("orb.destroy()");
- Py_Finalize();
-#endif
- }
- catch(CORBA::SystemException&)
- {
- INFOS("Caught CORBA::SystemException.");
- }
- catch(PortableServer::POA::ServantAlreadyActive&)
- {
- INFOS("Caught CORBA::ServantAlreadyActiveException");
- }
- catch(CORBA::Exception&)
- {
- INFOS("Caught CORBA::Exception.");
- }
- catch(std::exception& exc)
- {
- INFOS("Caught std::exception - "<<exc.what());
- }
- catch(...)
- {
- INFOS("Caught unknown exception.");
- }
-
-#ifdef _MPI_SEQ_CONTAINER_
- #ifdef HAVE_MPI2
- MPI_Finalize();
- #endif
-#endif
-
- return 0 ;
+ std::unique_ptr<SALOME_NamingService_Container_Abstract> ns;
+ return container_common_main(argc,argv,std::move(ns));
}
-
#include "SALOME_LoadRateManager.hxx"
#include "SALOME_NamingService.hxx"
#include "SALOME_ResourcesManager_Client.hxx"
+#include "SALOME_Embedded_NamingService.hxx"
#include "SALOME_ModuleCatalog.hh"
#include "Basics_Utils.hxx"
#include "Basics_DirUtils.hxx"
*/
//=============================================================================
-SALOME_ContainerManager::SALOME_ContainerManager(CORBA::ORB_ptr orb, PortableServer::POA_var poa, SALOME_NamingService *ns)
+SALOME_ContainerManager::SALOME_ContainerManager(CORBA::ORB_ptr orb, PortableServer::POA_var poa, SALOME_NamingService_Abstract *ns)
: _nbprocUsed(1)
{
MESSAGE("constructor");
// Mpi already tested in step 5, specific code on BuildCommandToLaunch Local/Remote Container methods
// TODO -> separates Mpi from Classic/Exe
// Classic or Exe ?
- std::string container_exe = "SALOME_Container"; // Classic container
+ std::string container_exe = this->_isSSL ? "SALOME_Container_No_NS_Serv" : "SALOME_Container"; // Classic container
Engines::ContainerParameters local_params(params);
int found=0;
try
o << container_exe + " ";
}
+
+ o << _NS->ContainerName(params) << " ";
- o << _NS->ContainerName(params);
- o << " -";
- AddOmninamesParams(o);
-
+ if( this->_isSSL )
+ {
+ Engines::EmbeddedNamingService_var ns = GetEmbeddedNamingService();
+ CORBA::String_var iorNS = _orb->object_to_string(ns);
+ o << iorNS;
+ }
+ else
+ {
+ o << "-";
+ AddOmninamesParams(o);
+ }
+
std::ofstream command_file( tmpFileName.c_str() );
command_file << o.str();
command_file.close();
*/
//=============================================================================
-void SALOME_ContainerManager::AddOmninamesParams(std::ostream& fileStream, SALOME_NamingService *ns)
+void SALOME_ContainerManager::AddOmninamesParams(std::ostream& fileStream, SALOME_NamingService_Abstract *ns)
{
- CORBA::String_var iorstr(ns->getIORaddr());
- fileStream << "ORBInitRef NameService=";
- fileStream << iorstr;
+ SALOME_NamingService *nsTrad(dynamic_cast<SALOME_NamingService *>(ns));
+ if(nsTrad)
+ {
+ CORBA::String_var iorstr(nsTrad->getIORaddr());
+ fileStream << "ORBInitRef NameService=";
+ fileStream << iorstr;
+ }
}
void SALOME_ContainerManager::MakeTheCommandToBeLaunchedASync(std::string& command)
#include <string>
#include <set>
-class SALOME_NamingService;
+class SALOME_NamingService_Abstract;
class SALOME_ResourcesManager_Client;
class CONTAINER_EXPORT SALOME_ContainerManager : public POA_Engines::ContainerManager
{
public:
- SALOME_ContainerManager(CORBA::ORB_ptr orb, PortableServer::POA_var poa, SALOME_NamingService *ns);
+ SALOME_ContainerManager(CORBA::ORB_ptr orb, PortableServer::POA_var poa, SALOME_NamingService_Abstract *ns);
~SALOME_ContainerManager();
// Corba Methods
// C++ Methods
void Shutdown();
+ void DeclareUsingSalomeSession() { _isSSL = false; }
+
static const char *_ContainerManagerNameInNS;
protected:
PortableServer::POA_var _poa;
SALOME_ResourcesManager_Client *_resManager;
- SALOME_NamingService *_NS;
+ SALOME_NamingService_Abstract *_NS;
//! different behaviour if $APPLI exists (SALOME Application)
bool _isAppliSalomeDefined;
//! attribute that contains the number of processes used in batch mode by MPI containers
int _nbprocUsed;
+ //! attribute that specifies the launch mode.
+ bool _isSSL = true;
+
static omni_mutex _numInstanceMutex ; // lib and instance protection
//! attributes to allow concurrency for // GiveContainer
static std::string GetenvThreadSafeAsString(const char *name);
static int SystemThreadSafe(const char *command);
static long SystemWithPIDThreadSafe(const std::vector<std::string>& command);
- static void AddOmninamesParams(std::ostream& fileStream, SALOME_NamingService *ns);
+ static void AddOmninamesParams(std::ostream& fileStream, SALOME_NamingService_Abstract *ns);
static void MakeTheCommandToBeLaunchedASync(std::string& command);
static int GetTimeOutToLoaunchServer();
static void SleepInSecond(int ellapseTimeInSecond);
--- /dev/null
+// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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
+//
+
+// SALOME Container : implementation of container and engine for Kernel
+// File : SALOME_Container.cxx
+// Author : Paul RASCLE, EDF - MARC TAJCHMAN, CEA
+// Module : SALOME
+// $Header$
+//
+#ifdef _MPI_SEQ_CONTAINER_
+ #ifdef HAVE_MPI2
+#include <mpi.h>
+ #endif
+#endif
+
+#include <iostream>
+#include <sstream>
+#include <string>
+#include <stdio.h>
+#include <time.h>
+#ifndef WIN32
+# include <sys/time.h>
+# include <dlfcn.h>
+#endif
+
+
+#ifndef WIN32
+#include <unistd.h>
+#else
+#include <process.h>
+#endif
+#include "SALOME_Container_i.hxx"
+#include "utilities.h"
+#include "Utils_ORB_INIT.hxx"
+#include "Utils_SINGLETON.hxx"
+#include "OpUtil.hxx"
+
+#ifdef CHECKTIME
+#include <Utils_Timer.hxx>
+#endif
+
+#include "Container_init_python.hxx"
+
+extern "C" void HandleServerSideSignals(CORBA::ORB_ptr theORB);
+
+#include <stdexcept>
+#include <signal.h>
+#include <sys/types.h>
+#ifndef WIN32
+# include <sys/wait.h>
+#endif
+
+#include <memory>
+
+void AttachDebugger();
+void Handler(int);
+void terminateHandler();
+void unexpectedHandler();
+
+#ifndef WIN32
+void (* setsig(int, void (*)(int)))(int);
+
+typedef void (*sighandler_t)(int);
+sighandler_t setsig(int sig, sighandler_t handler)
+{
+ struct sigaction context, ocontext;
+ context.sa_handler = handler;
+ sigemptyset(&context.sa_mask);
+ context.sa_flags = 0;
+ if (sigaction(sig, &context, &ocontext) == -1)
+ return SIG_ERR;
+ return ocontext.sa_handler;
+}
+#endif //WIN32
+
+void AttachDebugger()
+{
+#ifndef WIN32
+ if(getenv ("DEBUGGER"))
+ {
+ std::stringstream exec;
+ exec << "$DEBUGGER SALOME_Container " << getpid() << "&";
+ std::cerr << exec.str() << std::endl;
+ system(exec.str().c_str());
+ while(1);
+ }
+#endif
+}
+
+void Handler(int theSigId)
+{
+ std::cerr << "Signal= "<< theSigId << std::endl;
+ AttachDebugger();
+ //to exit or not to exit
+ _exit(1);
+}
+
+void terminateHandler(void)
+{
+ std::cerr << "Terminate: not managed exception !" << std::endl;
+ AttachDebugger();
+}
+
+void unexpectedHandler(void)
+{
+ std::cerr << "Unexpected: unexpected exception !" << std::endl;
+ AttachDebugger();
+}
+
+int container_common_main(int argc, char* argv[], std::unique_ptr<SALOME_NamingService_Container_Abstract> ns)
+{
+#ifdef _MPI_SEQ_CONTAINER_
+ #ifdef HAVE_MPI2
+ MPI_Init(&argc,&argv);
+ #endif
+#endif
+
+#ifndef WIN32
+ if(getenv ("DEBUGGER"))
+ {
+ setsig(SIGSEGV,&Handler);
+ setsig(SIGFPE,&Handler);
+ std::set_terminate(&terminateHandler);
+ std::set_unexpected(&unexpectedHandler);
+ }
+#endif
+
+ // Initialise the ORB.
+ //SRN: BugID: IPAL9541, it's necessary to set a size of one message to be at least 100Mb
+ //CORBA::ORB_var orb = CORBA::ORB_init( argc , argv ) ;
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+ ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
+ CORBA::ORB_ptr orb = init(argc , argv ) ;
+
+ // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
+ INFOS_COMPILATION;
+ BEGIN_OF(argv[0]);
+
+ ASSERT(argc > 1);
+ SCRUTE(argv[1]);
+
+ KERNEL_PYTHON::init_python(argc,argv);
+
+ char *containerName = (char *)"";
+ if(argc > 1)
+ {
+ containerName = argv[1] ;
+ }
+
+ try
+ {
+ CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
+ ASSERT(!CORBA::is_nil(obj));
+ PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj);
+
+ PortableServer::POAManager_var pman = root_poa->the_POAManager();
+
+ // add new container to the kill list
+#ifndef WIN32
+ std::stringstream aCommand ;
+ aCommand << "addToKillList.py " << getpid() << " SALOME_Container" << std::ends ;
+ system(aCommand.str().c_str());
+#endif
+
+ new Engines_Container_i(orb, root_poa, containerName , argc , argv, ns.get() );
+ ns.release();
+
+ pman->activate();
+
+#ifdef CHECKTIME
+ Utils_Timer timer;
+ timer.Start();
+ timer.Stop();
+ timer.ShowAbsolute();
+#endif
+
+ HandleServerSideSignals(orb);
+
+//#define MEMORYLEAKS
+#ifdef MEMORYLEAKS
+ PyGILState_Ensure();
+ //Destroy orb from python (for chasing memory leaks)
+ PyRun_SimpleString("from omniORB import CORBA");
+ PyRun_SimpleString("orb=CORBA.ORB_init([''], CORBA.ORB_ID)");
+ PyRun_SimpleString("orb.destroy()");
+ Py_Finalize();
+#endif
+ }
+ catch(CORBA::SystemException&)
+ {
+ INFOS("Caught CORBA::SystemException.");
+ }
+ catch(PortableServer::POA::ServantAlreadyActive&)
+ {
+ INFOS("Caught CORBA::ServantAlreadyActiveException");
+ }
+ catch(CORBA::Exception&)
+ {
+ INFOS("Caught CORBA::Exception.");
+ }
+ catch(std::exception& exc)
+ {
+ INFOS("Caught std::exception - "<<exc.what());
+ }
+ catch(...)
+ {
+ INFOS("Caught unknown exception.");
+ }
+
+#ifdef _MPI_SEQ_CONTAINER_
+ #ifdef HAVE_MPI2
+ MPI_Finalize();
+ #endif
+#endif
+
+ return 0 ;
+}
+
--- /dev/null
+// 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_Container.hxx"
+#include "SALOME_NamingService_Abstract.hxx"
+
+#include <memory>
+
+int CONTAINER_EXPORT container_common_main(int argc, char* argv[], std::unique_ptr<SALOME_NamingService_Container_Abstract> ns);
--- /dev/null
+// 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 "SALOME_Container_Common.hxx"
+#include "SALOME_Embedded_NamingService_Client.hxx"
+#include "Utils_SALOME_Exception.hxx"
+#include "SALOME_KernelORB.hxx"
+
+int main(int argc, char* argv[])
+{
+ if(argc<3)
+ THROW_SALOME_EXCEPTION( "SALOME_Container_No_NS_Serv : requires 2 input arguments <containerName> <IOR of Engines::EmbeddedNamingService>" );
+ CORBA::ORB_ptr orb(KERNEL::getORB());
+ CORBA::Object_var ns_serv_obj_base = orb->string_to_object(argv[2]);
+ if( CORBA::is_nil(ns_serv_obj_base) )
+ THROW_SALOME_EXCEPTION( "SALOME_Container_No_NS_Serv : argument 2 is NOT a valid IOR" );
+ Engines::EmbeddedNamingService_var ns_serv_obj = Engines::EmbeddedNamingService::_narrow(ns_serv_obj_base);
+ if( CORBA::is_nil(ns_serv_obj) )
+ THROW_SALOME_EXCEPTION( "SALOME_Container_No_NS_Serv : argument 2 is NOT a valid IOR of Engines::EmbeddedNamingService" );
+ std::unique_ptr<SALOME_NamingService_Container_Abstract> ns( new SALOME_Embedded_NamingService_Client(ns_serv_obj) );
+ return container_common_main(argc,argv,std::move(ns));
+}
#include <list>
#include <string>
-class SALOME_NamingService_Abstract;
+class SALOME_NamingService_Container_Abstract;
class CONTAINER_EXPORT Engines_Container_i:
public virtual POA_Engines::Container,
PortableServer::POA_ptr poa,
char * containerName ,
int argc, char* argv[],
- SALOME_NamingService_Abstract *ns = nullptr,
+ SALOME_NamingService_Container_Abstract *ns = nullptr,
bool isServantAloneInProcess = true);
virtual ~Engines_Container_i();
load_impl(const char* nameToRegister,
const char* componentName);
+ Engines::EmbeddedNamingService_ptr get_embedded_NS_if_ssl() override;
void remove_impl(Engines::EngineComponent_ptr component_i);
void finalize_removal();
bool _isSupervContainer;
- SALOME_NamingService_Abstract *_NS ;
+ SALOME_NamingService_Container_Abstract *_NS ;
std::string _library_path;
std::string _containerName;
std::string _logfilename;
if __EMB_SERVANT_ENV_VAR_NAME in os.environ:
salome_init_without_session()
else:
- salome_init_with_session(path, embedded)
+ import KernelBasis
+ if KernelBasis.getSSLMode():
+ salome_init_without_session()
+ else:
+ salome_init_with_session(path, embedded)
class StandAloneLifecyle:
def FindOrLoadComponent(self,contName,moduleName):
#raise RuntimeError("Undealed situation cont = {} module = {}".format(contName,moduleName))
def salome_init_without_session():
- global lcc,myStudy,orb,modulcat,sg
+ global lcc,myStudy,orb,modulcat,sg,cm
lcc = StandAloneLifecyle()
+ import KernelBasis
+ KernelBasis.setSSLMode(True)
import KernelDS
myStudy = KernelDS.myStudy()
import CORBA
import SALOME_ModuleCatalog
from salome_kernel import list_of_catalogs_regarding_environement
modulcat = KernelModuleCatalog.myModuleCatalog( list_of_catalogs_regarding_environement() )
+ import KernelLauncher
+ cm = KernelLauncher.myContainerManager()
# activate poaManager to accept co-localized CORBA calls.
poa = orb.resolve_initial_references("RootPOA")
poaManager = poa._get_the_POAManager()
global orb, lcc, naming_service, cm, esm, dsm, modulcat
global sg
global myStudy, myStudyName
-
+ import KernelBasis
+ KernelBasis.setSSLMode(False)
try:
if salome_initial:
salome_initial=False
${PROJECT_BINARY_DIR}/idl
)
+SET(SalomeORB_SOURCES
+ SALOME_KernelORB.cxx
+)
+
+ADD_LIBRARY(SalomeORB ${SalomeORB_SOURCES})
+TARGET_LINK_LIBRARIES(SalomeORB ${OMNIORB_LIBRARIES})
+INSTALL(TARGETS SalomeORB EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
+
SET(SalomeKernelHelpers_LIBS
- ${OMNIORB_LIBRARIES}
+ SalomeORB
SalomeNS
SALOMELocalTrace
SALOMEBasics
--- /dev/null
+// 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 "SALOME_KernelORB.hxx"
+
+namespace KERNEL {
+ /**
+ * This function returns a static reference to the orb. The orb can
+ * be used for example to initialize CORBA variables or to serialize
+ * and unserialize the CORBA objet to/from an IOR string.
+ */
+ CORBA::ORB_ptr getORB() {
+ static CORBA::ORB_ptr orb;
+ if(CORBA::is_nil(orb)){
+ int argc=0;
+ orb = CORBA::ORB_init(argc,0);
+ }
+ return orb;
+ }
+}
--- /dev/null
+// Copyright (C) 2007-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
+//
+
+// Author: Guillaume Boulant (EDF/R&D)
+
+#pragma once
+
+#include "KernelHelpers.hxx"
+
+#include <omniORB4/CORBA.h>
+
+namespace KERNEL
+{
+ KERNELHELPERS_EXPORT CORBA::ORB_ptr getORB();
+}
namespace KERNEL {
- /**
- * This function returns a static reference to the orb. The orb can
- * be used for example to initialize CORBA variables or to serialize
- * and unserialize the CORBA objet to/from an IOR string.
- */
- CORBA::ORB_ptr getORB() {
- static CORBA::ORB_ptr orb;
- if(CORBA::is_nil(orb)){
- int argc=0;
- orb = CORBA::ORB_init(argc,0);
- }
- return orb;
- }
-
void assignNamingServiceSL()
{
if ( !_naming_service.get() )
#include "SALOME_NamingService.hxx"
#include "SALOME_LifeCycleCORBA.hxx"
+#include "SALOME_KernelORB.hxx"
+
namespace KERNEL {
// ---------------------------------------------
// SALOME KERNEL main services
- KERNELHELPERS_EXPORT CORBA::ORB_ptr getORB();
KERNELHELPERS_EXPORT SALOME_NamingService_Abstract *getNamingService();
KERNELHELPERS_EXPORT void assignNamingServiceSL();
KERNELHELPERS_EXPORT SALOME_LifeCycleCORBA * getLifeCycleCORBA();
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+include(${SWIG_USE_FILE})
+
IF(SALOME_BUILD_TESTS)
ADD_SUBDIRECTORY(Test)
ENDIF(SALOME_BUILD_TESTS)
${CMAKE_CURRENT_SOURCE_DIR}/../Container
${CMAKE_CURRENT_SOURCE_DIR}/../ResourcesManager
${CMAKE_CURRENT_SOURCE_DIR}/../SALOMESDS
+ ${CMAKE_CURRENT_SOURCE_DIR}/../LifeCycleCORBA
+ ${CMAKE_CURRENT_SOURCE_DIR}/../KernelHelpers
${PROJECT_BINARY_DIR}/idl
+ ${CMAKE_CURRENT_SOURCE_DIR}
)
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} ${BOOST_DEFINITIONS} ${OMNIORB_DEFINITIONS})
SALOME_Launcher_defs.hxx
SALOME_ExternalServerLauncher.hxx
SALOME_LauncherException.hxx
+ KernelLauncher.hxx
)
SET(LAUNCHER_PYTHON_SCRIPTS
launcher_proxy.py
)
+SET(KernelLauncher_HEADERS KernelLauncher.hxx KernelLauncher.i)
+SET(KernelLauncher_SOURCES KernelLauncher.cxx ${KernelLauncher_HEADERS})
+SET_SOURCE_FILES_PROPERTIES(KernelLauncher.i PROPERTIES CPLUSPLUS ON)
+SET_SOURCE_FILES_PROPERTIES(KernelLauncher.i PROPERTIES SWIG_FLAGS "-py3")
+SET_SOURCE_FILES_PROPERTIES(KernelLauncher_wrap.cpp PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H")
+SET(_swig_SCRIPTS ${CMAKE_CURRENT_BINARY_DIR}/KernelLauncher.py )
+IF(${CMAKE_VERSION} VERSION_LESS "3.8.0")
+ SWIG_ADD_MODULE(KernelLauncher python ${KernelLauncher_SOURCES})
+ELSE()
+ SWIG_ADD_LIBRARY(KernelLauncher LANGUAGE python SOURCES ${KernelLauncher_SOURCES})
+ENDIF()
+SWIG_LINK_LIBRARIES(KernelLauncher ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} SalomeDS SalomeKernelHelpers)
+install(TARGETS _KernelLauncher DESTINATION ${SALOME_INSTALL_LIBS})
+install(FILES ${KernelLauncher_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
+SALOME_INSTALL_SCRIPTS("${_swig_SCRIPTS}" ${SALOME_INSTALL_BINS} EXTRA_DPYS "${SWIG_MODULE_KernelLauncher_REAL_NAME}")
+
+
INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS})
INSTALL(FILES testLauncher.xml DESTINATION ${SALOME_KERNEL_INSTALL_RES_DATA})
SALOME_INSTALL_SCRIPTS("${LAUNCHER_PYTHON_SCRIPTS}" ${SALOME_INSTALL_PYTHON})
--- /dev/null
+// 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 "KernelLauncher.hxx"
+
+#include "SALOME_Launcher.hxx"
+#include "SALOME_ContainerManager.hxx"
+#include "SALOME_Fake_NamingService.hxx"
+#include "SALOME_KernelServices.hxx"
+
+#include <cstring>
+
+std::string GetContainerManagerInstance()
+{
+ SALOME_Launcher *launcher = KERNEL::getLauncherSA();
+ SALOME_Fake_NamingService ns;
+ CORBA::Object_var cm = ns.Resolve(SALOME_ContainerManager::_ContainerManagerNameInNS);
+ CORBA::ORB_ptr orb = KERNEL::getORB();
+ CORBA::String_var ior = orb->object_to_string(cm);
+ return std::string(ior.in());
+}
--- /dev/null
+// 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 <string>
+
+std::string GetContainerManagerInstance();
--- /dev/null
+// 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
+//
+
+%module KernelLauncher
+
+%include "std_string.i"
+
+%{
+#include "KernelLauncher.hxx"
+%}
+
+%inline
+{
+ std::string GetContainerManagerInstance();
+}
+
+%pythoncode %{
+def myContainerManager():
+ import Engines
+ import CORBA
+ orb=CORBA.ORB_init([''])
+ return orb.string_to_object(GetContainerManagerInstance())
+%}
void SALOME_Launcher::init(CORBA::ORB_ptr orb, PortableServer::POA_var poa)
{
- _ResManager = new SALOME_ResourcesManager(orb,poa,tradNS());
+ _ResManager = new SALOME_ResourcesManager(orb,poa,_NS);
_l.SetResourcesManager(_ResManager->GetImpl());
- _ContManager = new SALOME_ContainerManager(orb,poa,tradNS());
+ _ContManager = new SALOME_ContainerManager(orb,poa,_NS);
_ResManager->_remove_ref();
_ContManager->_remove_ref();
return rtn;
}
+void SALOME_Launcher::DeclareUsingSalomeSession()
+{
+ this->_ContManager->DeclareUsingSalomeSession();
+}
+
void
SALOME_Launcher::removeJob(CORBA::Long job_id)
{
// Save and load methods
virtual void loadJobs(const char* jobs_file);
virtual void saveJobs(const char* jobs_file);
+
+ void DeclareUsingSalomeSession();
static const char *_LauncherNameInNS;
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);
SALOME_CPythonHelper cPyh;
cPyh.initializePython(argc,argv);
SALOME_Launcher *lServ(new SALOME_Launcher(orb,safePOA));
+ lServ->DeclareUsingSalomeSession();
lServ->_remove_ref();
//
SALOMESDS::DataServerManager *dsm(new SALOMESDS::DataServerManager(&cPyh,orb,root_poa));
// not enough: set a current directory in naming service is not thread safe
// if naming service instance is shared among several threads...
// ==> always use absolute path and don't rely on current directory!
- if( dynamic_cast<SALOME_NamingService *>(_NS) )
+ //if( dynamic_cast<SALOME_NamingService *>(_NS) )
{
CORBA::Object_var obj =
_NS->Resolve(SALOME_ContainerManager::_ContainerManagerNameInNS);
std::string GetModuleCatalogInstance(const std::string& listOfCatalogsGrouped)
{
- SALOME_ModuleCatalog::ModuleCatalog_var study = KERNEL::getModuleComponentServantSA(listOfCatalogsGrouped.c_str());
+ SALOME_ModuleCatalog::ModuleCatalog_var cata = KERNEL::getModuleComponentServantSA(listOfCatalogsGrouped.c_str());
CORBA::ORB_ptr orb = KERNEL::getORB();
- CORBA::String_var ior = orb->object_to_string(study);
+ CORBA::String_var ior = orb->object_to_string(cata);
return std::string(ior.in());
}
// initialise Naming Service
SALOME_NamingService _NS(orb);
// register Catalog in Naming Service
- _NS.Register(myCata ,"/Kernel/ModulCatalog");
+ _NS.Register(myCata ,SALOME_ModuleCatalogImpl::ENTRY_IN_NS);
MESSAGE("Running CatalogServer.");
#include "SALOME_ModuleCatalog_impl.hxx"
#include "SALOME_ModuleCatalog_Acomponent_impl.hxx"
#include "SALOME_ModuleCatalog_Handler.hxx"
+#include "SALOME_Fake_NamingService.hxx"
+
#include <libxml/parser.h>
#include <fstream>
#include <map>
static const char* SEPARATOR = "::";
static const char* OLD_SEPARATOR = ":";
+const char SALOME_ModuleCatalogImpl::ENTRY_IN_NS[] = "/Kernel/ModulCatalog";
+
SALOME_ModuleCatalog::ModuleCatalog_ptr KERNEL::getModuleComponentServantSA(const char *listOfCatalogs)
{
static SALOME_ModuleCatalog::ModuleCatalog_var moduleCata;
argv[2] = const_cast<char*>(listOfCatalogs);
SALOME_ModuleCatalogImpl *servant = new SALOME_ModuleCatalogImpl(NB_OF_ELT_IN_CMD,argv,orb);
moduleCata = servant->_this();
+ SALOME_Fake_NamingService NS;
+ NS.Register(moduleCata,SALOME_ModuleCatalogImpl::ENTRY_IN_NS);
}
return SALOME_ModuleCatalog::ModuleCatalog::_duplicate(moduleCata);
}
//! shutdown server
void shutdown();
+ static const char ENTRY_IN_NS[];
+
private:
//! method to parse arguments to get general and personal catalog files
/*!
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+include(${SWIG_USE_FILE})
+
INCLUDE_DIRECTORIES(
${OMNIORB_INCLUDE_DIR}
${PTHREAD_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../Basics
${CMAKE_CURRENT_SOURCE_DIR}/../SALOMELocalTrace
${CMAKE_CURRENT_SOURCE_DIR}/../Utils
+ ${CMAKE_CURRENT_SOURCE_DIR}/../KernelHelpers
+ ${CMAKE_CURRENT_SOURCE_DIR}/../LifeCycleCORBA
+ ${CMAKE_CURRENT_SOURCE_DIR}
${PROJECT_BINARY_DIR}/idl
+ ${PYTHON_INCLUDE_DIRS}
)
SET(SalomeNS_SOURCES
NamingService_WaitForServerReadiness.cxx
SALOME_Fake_NamingService.cxx
SALOME_NamingService_Abstract.cxx
+ SALOME_Embedded_NamingService.cxx
+ SALOME_Embedded_NamingService_Common.cxx
+ SALOME_Embedded_NamingService_Client.cxx
)
-
ADD_DEFINITIONS(${OMNIORB_DEFINITIONS})
ADD_LIBRARY(SalomeNS ${SalomeNS_SOURCES})
ADD_DEPENDENCIES(SalomeNS SalomeIDLKernel)
-TARGET_LINK_LIBRARIES(SalomeNS OpUtil)
+TARGET_LINK_LIBRARIES(SalomeNS OpUtil SalomeORB)
INSTALL(TARGETS SalomeNS EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
# Executable scripts to be installed
SALOME_INSTALL_SCRIPTS(SALOME_NamingServicePy.py ${SALOME_INSTALL_SCRIPT_PYTHON})
+SALOME_INSTALL_SCRIPTS(SALOME_Embedded_NamingService_ClientPy.py ${SALOME_INSTALL_SCRIPT_PYTHON})
FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx")
INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS})
+
+SET(NamingService_HEADERS NamingService.i)
+SET(NamingService_SOURCES ${NamingService_HEADERS})
+SET_SOURCE_FILES_PROPERTIES(NamingService.i PROPERTIES CPLUSPLUS ON)
+SET_SOURCE_FILES_PROPERTIES(NamingService.i PROPERTIES SWIG_FLAGS "-py3")
+SET_SOURCE_FILES_PROPERTIES(NamingService_wrap.cpp PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H")
+SET(_swig_SCRIPTS ${CMAKE_CURRENT_BINARY_DIR}/NamingService.py )
+IF(${CMAKE_VERSION} VERSION_LESS "3.8.0")
+ SWIG_ADD_MODULE(NamingService python ${NamingService_SOURCES})
+ELSE()
+ SWIG_ADD_LIBRARY(NamingService LANGUAGE python SOURCES ${NamingService_SOURCES})
+ENDIF()
+SWIG_LINK_LIBRARIES(NamingService ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} SalomeNS)
+install(TARGETS _NamingService DESTINATION ${SALOME_INSTALL_LIBS})
+install(FILES ${NamingService_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
+SALOME_INSTALL_SCRIPTS("${_swig_SCRIPTS}" ${SALOME_INSTALL_BINS} EXTRA_DPYS "${SWIG_MODULE_NamingService_REAL_NAME}")
--- /dev/null
+// 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
+//
+
+%module NamingService
+
+%{
+#include "SALOME_Fake_NamingService.hxx"
+#include "SALOME_Embedded_NamingService.hxx"
+#include "SALOME_KernelORB.hxx"
+#include "Utils_SALOME_Exception.hxx"
+%}
+
+%include "std_string.i"
+%include "std_vector.i"
+
+%rename(NamingService) SALOME_Fake_NamingService ;
+
+%template(svec) std::vector<std::string>;
+
+%exceptionclass SALOME_Exception;
+
+class SALOME_Exception
+{
+public:
+ SALOME_Exception(const std::string& text);
+ ~SALOME_Exception() noexcept;
+ const char *what() const noexcept;
+ %extend
+ {
+ std::string __str__() const
+ {
+ return std::string(self->what());
+ }
+ }
+};
+
+%exception {
+ try {
+ $action
+ }
+ catch (SALOME_Exception& _e) {
+ // Reraise with SWIG_Python_Raise
+ SWIG_Python_Raise(SWIG_NewPointerObj((new SALOME_Exception(static_cast< const SALOME_Exception& >(_e))),SWIGTYPE_p_SALOME_Exception,SWIG_POINTER_OWN), "SALOME_Exception", SWIGTYPE_p_SALOME_Exception);
+ SWIG_fail;
+ }
+}
+
+class SALOME_Fake_NamingService
+{
+public:
+ SALOME_Fake_NamingService();
+ std::vector< std::string > repr();
+ static std::string GetLogContainersFile();
+ static void FlushLogContainersFile();
+ %extend {
+ static void SetLogContainersFileInternal(const std::string& logFileName)
+ {
+ SALOME_Fake_NamingService::SetLogContainersFile(logFileName);
+ }
+ std::string _ResolveInternal(const char *Path)
+ {
+ CORBA::Object_var obj = self->Resolve(Path);
+ CORBA::ORB_ptr orb = KERNEL::getORB();
+ CORBA::String_var ior = orb->object_to_string(obj);
+ return std::string(ior);
+ }
+ void _RegisterInternal(const char *ior, const char* Path)
+ {
+ CORBA::ORB_ptr orb = KERNEL::getORB();
+ CORBA::Object_var obj = orb->string_to_object(ior);
+ self->Register(obj,Path);
+ }
+ static std::string IOROfNS()
+ {
+ CORBA::ORB_ptr orb = KERNEL::getORB();
+ Engines::EmbeddedNamingService_var ns = GetEmbeddedNamingService();
+ CORBA::String_var ior = orb->object_to_string(ns);
+ return std::string(ior);
+ }
+ }
+};
+
+%pythoncode %{
+def NamingService_Resolve(self,Path):
+ ret = self._ResolveInternal(Path)
+ import CORBA
+ orb=CORBA.ORB_init([''])
+ return orb.string_to_object(ret)
+def NamingService_Register(self,obj,Path):
+ import CORBA
+ orb=CORBA.ORB_init([''])
+ self._RegisterInternal( orb.object_to_string(obj) , Path)
+NamingService.Resolve = NamingService_Resolve
+NamingService.Register = NamingService_Register
+def NamingService_SetLogContainersFile(cls,logFileName = None):
+ if logFileName is None:
+ import tempfile
+ with tempfile.NamedTemporaryFile() as f:
+ logFileName = f.name
+ cls.SetLogContainersFileInternal(logFileName)
+NamingService.SetLogContainersFile = classmethod(NamingService_SetLogContainersFile)
+def NamingService_RefOfNS(cls):
+ ret = cls.IOROfNS()
+ import Engines
+ import CORBA
+ orb=CORBA.ORB_init([''])
+ return orb.string_to_object(ret)
+NamingService.RefOfNS = classmethod(NamingService_RefOfNS)
+def NamingService_KillContainersInFile(cls,logFileName):
+ import Engines
+ import CORBA
+ orb=CORBA.ORB_init([''])
+ with open(logFileName) as f:
+ cont_to_kill = [elt.split(" : ") for elt in f]
+ for name,ior in cont_to_kill:
+ try:
+ ref = orb.string_to_object(ior)
+ ref.Shutdown()
+ except Exception as e:
+ print("Failed to kill container remotely \"{}\"".format(name))
+NamingService.KillContainersInFile = classmethod(NamingService_KillContainersInFile)
+%}
--- /dev/null
+// 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 "SALOME_Embedded_NamingService.hxx"
+#include "SALOME_Embedded_NamingService_Common.hxx"
+#include "SALOME_Fake_NamingService.hxx"
+
+#include <memory>
+#include <cstring>
+
+static Engines::EmbeddedNamingService_var _embedded_ns_singleton;
+
+Engines::EmbeddedNamingService_var GetEmbeddedNamingService()
+{
+ if( CORBA::is_nil(_embedded_ns_singleton) )
+ {
+ std::unique_ptr<SALOME_Embedded_NamingService> servant(new SALOME_Embedded_NamingService);
+ _embedded_ns_singleton = servant->_this();
+ servant->_remove_ref();
+ servant.release();
+ }
+ return _embedded_ns_singleton;
+}
+
+void SALOME_Embedded_NamingService::Register(const Engines::IORType& ObjRef, const char *Path)
+{
+ SALOME_Fake_NamingService ns;
+ ns.Register(IORToObject(ObjRef),Path);
+}
+
+void SALOME_Embedded_NamingService::Destroy_FullDirectory(const char *Path)
+{
+ SALOME_Fake_NamingService ns;
+ ns.Destroy_FullDirectory(Path);
+}
+
+void SALOME_Embedded_NamingService::Destroy_Name(const char *Path)
+{
+ SALOME_Fake_NamingService ns;
+ ns.Destroy_Name(Path);
+}
+
+Engines::IORType *SALOME_Embedded_NamingService::Resolve(const char *Path)
+{
+ SALOME_Fake_NamingService ns;
+ CORBA::Object_var obj = ns.Resolve(Path);
+ return ObjectToIOR(obj);
+}
+
+Engines::IORType *SALOME_Embedded_NamingService::ResolveFirst(const char *Path)
+{
+ SALOME_Fake_NamingService ns;
+ CORBA::Object_var obj = ns.ResolveFirst(Path);
+ return ObjectToIOR(obj);
+}
--- /dev/null
+// 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_defs.hxx"
+
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(SALOME_Embedded_NamingService)
+
+Engines::EmbeddedNamingService_var NAMINGSERVICE_EXPORT GetEmbeddedNamingService();
+
+class NAMINGSERVICE_EXPORT SALOME_Embedded_NamingService : public virtual POA_Engines::EmbeddedNamingService
+{
+public:
+ void Register(const Engines::IORType& ObjRef, const char *Path) override;
+ void Destroy_FullDirectory(const char *Path) override;
+ void Destroy_Name(const char *Path) override;
+ Engines::IORType *Resolve(const char *Path) override;
+ Engines::IORType *ResolveFirst(const char *Path) override;
+};
--- /dev/null
+// 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 "SALOME_Embedded_NamingService_Client.hxx"
+#include "SALOME_Embedded_NamingService_Common.hxx"
+
+#include <memory>
+
+void SALOME_Embedded_NamingService_Client::init_orb(CORBA::ORB_ptr orb)
+{
+}
+
+SALOME_NamingService_Container_Abstract *SALOME_Embedded_NamingService_Client::clone()
+{
+ return new SALOME_Embedded_NamingService_Client(*this);
+}
+
+void SALOME_Embedded_NamingService_Client::Register(CORBA::Object_ptr ObjRef, const char* Path)
+{
+ std::unique_ptr<Engines::IORType> ior( ObjectToIOR(ObjRef) );
+ this->_remote_ns_serv->Register( *(ior.get()), Path);
+}
+
+void SALOME_Embedded_NamingService_Client::Destroy_FullDirectory(const char* Path)
+{
+ this->_remote_ns_serv->Destroy_FullDirectory(Path);
+}
+
+void SALOME_Embedded_NamingService_Client::Destroy_Name(const char* Path)
+{
+ this->_remote_ns_serv->Destroy_Name(Path);
+}
+
+CORBA::Object_ptr SALOME_Embedded_NamingService_Client::Resolve(const char* Path)
+{
+ std::unique_ptr<Engines::IORType> ior( this->_remote_ns_serv->Resolve(Path) );
+ CORBA::Object_var ret( IORToObject( *(ior.get()) ) );
+ return CORBA::Object::_duplicate(ret);
+}
+
+CORBA::Object_ptr SALOME_Embedded_NamingService_Client::ResolveFirst(const char* Path)
+{
+ std::unique_ptr<Engines::IORType> ior( this->_remote_ns_serv->ResolveFirst(Path) );
+ CORBA::Object_var ret( IORToObject( *(ior.get()) ) );
+ return CORBA::Object::_duplicate(ret);
+}
--- /dev/null
+// 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_defs.hxx"
+#include "SALOME_NamingService_Abstract.hxx"
+
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(SALOME_Embedded_NamingService)
+
+class NAMINGSERVICE_EXPORT SALOME_Embedded_NamingService_Client : public SALOME_NamingService_Container_Abstract
+{
+public:
+ SALOME_Embedded_NamingService_Client(Engines::EmbeddedNamingService_var remoteNSServ):_remote_ns_serv(remoteNSServ) { }
+ void init_orb(CORBA::ORB_ptr orb=0) override;
+ SALOME_NamingService_Container_Abstract *clone() override;
+ void Register(CORBA::Object_ptr ObjRef, const char* Path) override;
+ void Destroy_FullDirectory(const char* Path) override;
+ void Destroy_Name(const char* Path) override;
+ CORBA::Object_ptr Resolve(const char* Path) override;
+ CORBA::Object_ptr ResolveFirst(const char* Path) override;
+public:
+ Engines::EmbeddedNamingService_var GetObject() const { return _remote_ns_serv; }
+private:
+ SALOME_Embedded_NamingService_Client(const SALOME_Embedded_NamingService_Client& other) = default;
+private:
+ Engines::EmbeddedNamingService_var _remote_ns_serv;
+};
--- /dev/null
+#! /usr/bin/env python3
+# -*- coding: iso-8859-1 -*-
+# 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
+#
+
+from omniORB import CORBA
+
+class SALOME_Embedded_NamingService_ClientPy:
+ """
+ A python client class to handle remote servant of SALOME_Embedded_NamingService
+ """
+ #-------------------------------------------------------------------------
+
+ def __init__(self, serv):
+ self._orb=CORBA.ORB_init([''], CORBA.ORB_ID)
+ self._obj = serv
+ #-------------------------------------------------------------------------
+
+ def Register(self,ObjRef, Path):
+ ior = bytes(self._orb.object_to_string(ObjRef),encoding="utf-8")
+ self._obj.Register(ior,Path)
+
+ #-------------------------------------------------------------------------
+
+ def Resolve(self, Path):
+ ret = self._obj.Resolve(Path)
+ return self._orb.string_to_object(ret.decode())
--- /dev/null
+// 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 "SALOME_Embedded_NamingService_Common.hxx"
+#include "SALOME_KernelORB.hxx"
+
+#include <memory>
+#include <cstring>
+
+CORBA::Object_var IORToObject(const Engines::IORType& ObjRef)
+{
+ CORBA::ORB_ptr orb(KERNEL::getORB());
+ CORBA::ULong size(ObjRef.length());
+ std::unique_ptr<char[]> pt(new char[size+1]);
+ pt[size] = '\0';
+ for(CORBA::ULong i = 0 ; i < size ; ++i)
+ pt[i] = ObjRef[i];
+ CORBA::Object_var obj = orb->string_to_object(pt.get());
+ return obj;
+}
+
+Engines::IORType *ObjectToIOR(CORBA::Object_ptr obj)
+{
+ std::unique_ptr<Engines::IORType> ret(new Engines::IORType);
+ CORBA::ORB_ptr orb(KERNEL::getORB());
+ CORBA::String_var ior = orb->object_to_string(obj);
+ auto len( strlen(ior) );
+ ret->length( len );
+ for(std::size_t i = 0 ; i < len ; ++i)
+ (*ret)[i] = ior[i];
+ return ret.release();
+}
--- /dev/null
+// 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_defs.hxx"
+
+#include <SALOMEconfig.h>
+
+#include CORBA_CLIENT_HEADER(SALOME_Embedded_NamingService)
+
+CORBA::Object_var IORToObject(const Engines::IORType& ObjRef);
+
+Engines::IORType *ObjectToIOR(CORBA::Object_ptr obj);
#include "SALOME_Fake_NamingService.hxx"
#include "Utils_SALOME_Exception.hxx"
+#include "SALOME_KernelORB.hxx"
+
+#include CORBA_CLIENT_HEADER(SALOME_Component)
+
+#include <sstream>
+#include <fstream>
std::mutex SALOME_Fake_NamingService::_mutex;
std::map<std::string,CORBA::Object_var> SALOME_Fake_NamingService::_map;
+bool SALOME_Fake_NamingService::_log_container_file_thread_launched = false;
+std::string SALOME_Fake_NamingService::_log_container_file_name;
SALOME_Fake_NamingService::SALOME_Fake_NamingService(CORBA::ORB_ptr orb)
{
}
+std::vector< std::string > SALOME_Fake_NamingService::repr()
+{
+ std::lock_guard<std::mutex> g(_mutex);
+ std::vector< std::string > ret;
+ for(auto it : _map)
+ {
+ ret.push_back( it.first );
+ }
+ return ret;
+}
+
void SALOME_Fake_NamingService::init_orb(CORBA::ORB_ptr orb)
{
}
std::lock_guard<std::mutex> g(_mutex);
CORBA::Object_var ObjRefAuto = CORBA::Object::_duplicate(ObjRef);
_map[Path] = ObjRefAuto;
+ FlushLogContainersFile_NoThreadSafe();
}
void SALOME_Fake_NamingService::Destroy_Name(const char* Path)
return std::vector<std::string>();
}
+std::vector<std::string> SALOME_Fake_NamingService::list_directory_recurs()
+{
+ return std::vector<std::string>();
+}
+
CORBA::Object_ptr SALOME_Fake_NamingService::Resolve(const char* Path)
{
+ std::lock_guard<std::mutex> g(_mutex);
std::string pathCpp(Path);
auto it = _map.find(pathCpp);
if( it != _map.end() )
CORBA::Object_ptr SALOME_Fake_NamingService::ResolveComponent(const char* hostname, const char* containerName, const char* componentName, const int nbproc)
{
- THROW_SALOME_EXCEPTION("SALOME_Fake_NamingService::ResolveComponent : " << hostname << " " << containerName << " " << componentName << " " << nbproc);
+ std::ostringstream oss;
+ oss << SEP << "Containers" << SEP << hostname << SEP << containerName << SEP << componentName;
+ std::string entryToFind(oss.str());
+ return Resolve(entryToFind.c_str());
+}
+
+std::vector< std::pair< std::string, Engines::Container_var> > SALOME_Fake_NamingService::ListOfContainersInNS_NoThreadSafe()
+{
+ std::vector< std::pair< std::string, Engines::Container_var> > ret;
+ for(auto it : _map)
+ {
+ Engines::Container_var elt = Engines::Container::_narrow(it.second);
+ if(!CORBA::is_nil(elt))
+ ret.push_back({it.first,elt});
+ }
+ return ret;
+}
+
+std::string SALOME_Fake_NamingService::ReprOfContainersIORS_NoThreadSafe()
+{
+ std::vector< std::pair< std::string, Engines::Container_var> > conts( ListOfContainersInNS_NoThreadSafe() );
+ std::ostringstream oss;
+ CORBA::ORB_ptr orb = KERNEL::getORB();
+ char SEP[2] = { '\0', '\0' };
+ constexpr char SEP2[] = " : ";
+ for(auto it : conts)
+ {
+ CORBA::String_var ior(orb->object_to_string(it.second));
+ oss << SEP << it.first << SEP2 << ior;
+ SEP[0] = '\n';
+ }
+ return oss.str();
+}
+
+std::string SALOME_Fake_NamingService::ReprOfContainersIORS()
+{
+ std::lock_guard<std::mutex> g(_mutex);
+ return ReprOfContainersIORS_NoThreadSafe();
+}
+
+std::string SALOME_Fake_NamingService::GetLogContainersFile()
+{
+ return _log_container_file_name;
+}
+
+void SALOME_Fake_NamingService::FlushLogContainersFile()
+{
+ std::lock_guard<std::mutex> g(_mutex);
+ FlushLogContainersFile_NoThreadSafe();
+}
+
+void SALOME_Fake_NamingService::FlushLogContainersFile_NoThreadSafe()
+{
+ if(!_log_container_file_name.empty())
+ {
+ std::string content( ReprOfContainersIORS_NoThreadSafe() );
+ std::ofstream ofs(_log_container_file_name);
+ ofs.write(content.c_str(),content.length());
+ }
+}
+
+void SALOME_Fake_NamingService::SetLogContainersFile(const std::string& logFileName)
+{
+ if(logFileName.empty())
+ THROW_SALOME_EXCEPTION("SALOME_Fake_NamingService::SetLogContainersFile : empty log name !");
+ constexpr char EXPT_CONTENT[] = "SALOME_Fake_NamingService::SetLogContainersFile : input logFileName write access failed ! no log file set !";
+ {
+ std::ofstream ofs(logFileName);
+ if(!ofs)
+ THROW_SALOME_EXCEPTION(EXPT_CONTENT);
+ }
+ _log_container_file_name = logFileName;
}
#include "SALOME_NamingService_Abstract.hxx"
#include <mutex>
+#include <utility>
#include <string>
#include <map>
class NAMINGSERVICE_EXPORT SALOME_Fake_NamingService : public SALOME_NamingService_Abstract
{
public:
- SALOME_Fake_NamingService(CORBA::ORB_ptr orb);
- SALOME_Fake_NamingService() = default;
- void init_orb(CORBA::ORB_ptr orb=0) override;
- 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) override;
- void Destroy_Name(const char* Path) override;
- void Destroy_Directory(const char* Path) override;
- void Destroy_FullDirectory(const char* Path) override;
- bool Change_Directory(const char* Path) override;
- std::vector<std::string> list_subdirs() override;
- std::vector<std::string> list_directory() override;
- SALOME_NamingService_Abstract *clone() override;
- CORBA::Object_ptr ResolveComponent(const char* hostname, const char* containerName, const char* componentName, const int nbproc=0) override;
+ SALOME_Fake_NamingService(CORBA::ORB_ptr orb);
+ SALOME_Fake_NamingService() = default;
+ static void SetLogContainersFile(const std::string& logFileName);
+ static std::string GetLogContainersFile();
+ static void FlushLogContainersFile();
+ std::vector< std::string > repr() override;
+ void init_orb(CORBA::ORB_ptr orb=0) override;
+ 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) override;
+ void Destroy_Name(const char* Path) override;
+ void Destroy_Directory(const char* Path) override;
+ void Destroy_FullDirectory(const char* Path) override;
+ bool Change_Directory(const char* Path) override;
+ std::vector<std::string> list_subdirs() override;
+ std::vector<std::string> list_directory() override;
+ std::vector<std::string> list_directory_recurs() override;
+ SALOME_NamingService_Abstract *clone() override;
+ CORBA::Object_ptr ResolveComponent(const char* hostname, const char* containerName, const char* componentName, const int nbproc=0) override;
private:
- static std::mutex _mutex;
- static std::map<std::string,CORBA::Object_var> _map;
+ static std::string ReprOfContainersIORS_NoThreadSafe();
+ static std::string ReprOfContainersIORS();
+ static std::vector< std::pair< std::string, Engines::Container_var> > ListOfContainersInNS_NoThreadSafe();
+ static void FlushLogContainersFile_NoThreadSafe();
+private:
+ static std::mutex _mutex;
+ static std::map<std::string,CORBA::Object_var> _map;
+ static bool _log_container_file_thread_launched;
+ static std::string _log_container_file_name;
};
//MESSAGE("SALOME_NamingService destruction");
}
-SALOME_NamingService *SALOME_NamingService::GetTraditionalNS(SALOME_NamingService_Abstract *ns)
+std::vector< std::string > SALOME_NamingService::repr()
{
- SALOME_NamingService *nsc(dynamic_cast<SALOME_NamingService *>(ns));
- return nsc;
+ return std::vector< std::string >();
}
// ============================================================================
}
}
-// ============================================================================
-/*! \brief build a container name, given a ContainerParameters struct.
- *
- * Build a container name with a ContainerParameters struct. In case of multi
- * processor machine, container name is suffixed with number of processors.
- * \param params struct from which we get container name (may be empty) and
- * number of processors.
- * \return a container name without the path.
- * \sa BuildContainerNameForNS(const Engines::ContainerParameters& params,
- * const char *hostname)
- */
-// ============================================================================
-
-std::string SALOME_NamingService::ContainerName(const Engines::ContainerParameters& params)
-{
- int nbproc;
-
- if ( !params.isMPI )
- nbproc = 0;
- else if ( params.nb_proc <= 0 )
- nbproc = 1;
- else
- nbproc = params.nb_proc;
-
- std::string ret(SALOME_NamingService_Abstract::ContainerName(params.container_name));
-
- if ( nbproc >= 1 )
- {
- std::ostringstream suffix;
- suffix << "_" << nbproc;
- ret += suffix.str();
- }
-
- return ret;
-}
-
-// ============================================================================
-/*! \brief build a string representing a container in Naming Service.
- *
- * Build a string representing the absolute pathname of a container in
- * SALOME_NamingService.
- * \param params used as it is, or replaced by FactoryServer if empty.
- * \param hostname name of the host of the container, without domain names.
- * \return the path under the form /Containers/hostname/containerName
- * \sa ContainerName(const char *containerName)
- */
-// ============================================================================
-
-std::string SALOME_NamingService::BuildContainerNameForNS(const Engines::ContainerParameters& params, const char *hostname)
-{
- std::string ret("/Containers/");
- ret += hostname;
- ret += "/";
- ret += ContainerName(params);
-
- return ret;
-}
-
// ============================================================================
/*! \brief search a name in current directory.
*
SALOME_NamingService(CORBA::ORB_ptr orb);
virtual ~SALOME_NamingService();
-
- static SALOME_NamingService *GetTraditionalNS(SALOME_NamingService_Abstract *ns);
-
+ std::vector< std::string > repr() override;
void init_orb(CORBA::ORB_ptr orb=0) override;
void Register(CORBA::Object_ptr ObjRef, const char* Path) override;
CORBA::Object_ptr Resolve(const char* Path) override;
const char* containerName,
const char* componentName,
const int nbproc=0) override;
- std::string ContainerName(const Engines::ContainerParameters& params);
- std::string BuildContainerNameForNS(const Engines::ContainerParameters& params, const char *hostname);
int Find(const char* name) ;
bool Create_Directory(const char* Path) ;
void list() ;
std::vector<std::string> list_directory() override;
std::vector<std::string> list_subdirs() override;
- std::vector<std::string> list_directory_recurs() ;
+ std::vector<std::string> list_directory_recurs() override ;
void Destroy_Name(const char* Path) override;
void Destroy_Directory(const char* Path) override;
void Destroy_FullDirectory(const char* Path) override;
+++ /dev/null
-// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// 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
-//
-
-// SALOME NamingService : wrapping NamingService services
-// File : SALOME_NamingService.i
-// Author : Paul RASCLE, EDF
-// Module : SALOME
-// $Header$
-//
-%{
-#include "SALOME_NamingService.hxx"
-//#include <omniORB4/CORBA.h>
-#include <omniORB3/CORBA.h>
-#include "ServiceUnreachable.hxx"
-%}
-
-%except(python)
-{
- try
- {
- $function
- }
- catch (ServiceUnreachable)
- {
- PyErr_SetString(PyExc_IndexError,"Naming Service Unreacheable");
- return NULL;
- }
-}
-
-class SALOME_NamingService
-{
-public:
-
- //! standard constructor
- SALOME_NamingService();
-
- //! standard destructor
- virtual ~SALOME_NamingService();
-
- //! initialize ORB reference after default constructor
- void init_orb(CORBA::ORB_ptr orb);
-
- //! method to create an association in the NamingService between an object reference and a path
- void Register(CORBA::Object_ptr ObjRef, const char* Path)
- throw(ServiceUnreachable);
-
- //! method to get the ObjRef of a symbolic name
- CORBA::Object_ptr Resolve(const char* Path)
- throw( ServiceUnreachable);
-
- //! method to research a name from the naming service's current directory
- int Find(const char* name)
- throw(ServiceUnreachable);
-
- //! method to create a directory from the current directory
- bool Create_Directory(const char* Path)
- throw(ServiceUnreachable);
-
- //! method to change the current directory to the directory Path indicated in "in" Parameter
- bool Change_Directory(const char* Path)
- throw(ServiceUnreachable);
-
- //!method to get the current directory
- char* Current_Directory()
- throw(ServiceUnreachable);
-
- //!method to print all the contexts contained from the current directory
- void list()
- throw(ServiceUnreachable);
-
- //! method to destroy an association Path-Object Reference
- void Destroy_Name(const char* Path)
- throw(ServiceUnreachable);
-
- //! method to destroy a directory if it is empty
- virtual void Destroy_Directory(const char* Path)
- throw(ServiceUnreachable);
-};
-
//
#include "SALOME_NamingService_Abstract.hxx"
+#include "Utils_SALOME_Exception.hxx"
+
+#include <sstream>
+#include <memory>
+
+SALOME_NamingService_Abstract *SALOME_NamingService_Abstract::cloneCoVar()
+{
+ std::unique_ptr<SALOME_NamingService_Container_Abstract> ret(this->clone());
+ SALOME_NamingService_Abstract *ret2(dynamic_cast<SALOME_NamingService_Abstract *>(ret.get()));
+ if(!ret2)
+ throw SALOME_Exception(std::string("SALOME_NamingService_Abstract::cloneCoVar : clone is expected to return a SALOME_NamingService_Abstract type !"));
+ ret.release();
+ return ret2;
+}
// ============================================================================
/*! \brief provide a default container name if empty.
return ret;
}
+
+// ============================================================================
+/*! \brief build a container name, given a ContainerParameters struct.
+ *
+ * Build a container name with a ContainerParameters struct. In case of multi
+ * processor machine, container name is suffixed with number of processors.
+ * \param params struct from which we get container name (may be empty) and
+ * number of processors.
+ * \return a container name without the path.
+ * \sa BuildContainerNameForNS(const Engines::ContainerParameters& params,
+ * const char *hostname)
+ */
+// ============================================================================
+
+std::string SALOME_NamingService_Abstract::ContainerName(const Engines::ContainerParameters& params)
+{
+ int nbproc;
+
+ if ( !params.isMPI )
+ nbproc = 0;
+ else if ( params.nb_proc <= 0 )
+ nbproc = 1;
+ else
+ nbproc = params.nb_proc;
+
+ std::string ret(SALOME_NamingService_Abstract::ContainerName(params.container_name));
+
+ if ( nbproc >= 1 )
+ {
+ std::ostringstream suffix;
+ suffix << "_" << nbproc;
+ ret += suffix.str();
+ }
+
+ return ret;
+}
+
+// ============================================================================
+/*! \brief build a string representing a container in Naming Service.
+ *
+ * Build a string representing the absolute pathname of a container in
+ * SALOME_NamingService.
+ * \param params used as it is, or replaced by FactoryServer if empty.
+ * \param hostname name of the host of the container, without domain names.
+ * \return the path under the form /Containers/hostname/containerName
+ * \sa ContainerName(const char *containerName)
+ */
+// ============================================================================
+
+std::string SALOME_NamingService_Abstract::BuildContainerNameForNS(const Engines::ContainerParameters& params, const char *hostname)
+{
+ std::string ret("/Containers/");
+ ret += hostname;
+ ret += "/";
+ ret += ContainerName(params);
+
+ return ret;
+}
#include "SALOME_NamingService_defs.hxx"
-#include "omniORB4/CORBA.h"
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
+#include CORBA_CLIENT_HEADER(SALOME_Component)
#include <vector>
#include <string>
-class NAMINGSERVICE_EXPORT SALOME_NamingService_Abstract
+class NAMINGSERVICE_EXPORT SALOME_NamingService_Container_Abstract
{
public:
virtual void init_orb(CORBA::ORB_ptr orb=0) = 0;
+ virtual SALOME_NamingService_Container_Abstract *clone() = 0;
virtual void Register(CORBA::Object_ptr ObjRef, const char* Path) = 0;
- virtual CORBA::Object_ptr Resolve(const char* Path) = 0;
- virtual CORBA::Object_ptr ResolveFirst(const char* Path) = 0;
+ virtual void Destroy_FullDirectory(const char* Path) = 0;
virtual void Destroy_Name(const char* Path) = 0;
+ virtual CORBA::Object_ptr Resolve(const char* Path) = 0;
+ virtual CORBA::Object_ptr ResolveFirst(const char* Path) = 0;
+ static constexpr char SEP = '/';
+};
+
+class NAMINGSERVICE_EXPORT SALOME_NamingService_Abstract : public SALOME_NamingService_Container_Abstract
+{
+public:
+ SALOME_NamingService_Abstract *cloneCoVar();
+ virtual std::vector< std::string > repr() = 0;
virtual void Destroy_Directory(const char* Path) = 0;
- virtual void Destroy_FullDirectory(const char* Path) = 0;
virtual bool Change_Directory(const char* Path) = 0;
virtual std::vector<std::string> list_subdirs() = 0;
virtual std::vector<std::string> list_directory() = 0;
- virtual SALOME_NamingService_Abstract *clone() = 0;
+ virtual std::vector<std::string> list_directory_recurs() = 0;
virtual CORBA::Object_ptr ResolveComponent(const char* hostname, const char* containerName, const char* componentName, const int nbproc=0) = 0;
virtual ~SALOME_NamingService_Abstract() { }
+ static std::string ContainerName(const Engines::ContainerParameters& params);
static std::string ContainerName(const char *ContainerName);
static std::string BuildContainerNameForNS(const char *ContainerName, const char *hostname);
+ static std::string BuildContainerNameForNS(const Engines::ContainerParameters& params, const char *hostname);
};
SALOME_ResourcesManager::SALOME_ResourcesManager(CORBA::ORB_ptr orb,
PortableServer::POA_var poa,
- SALOME_NamingService *ns,
+ SALOME_NamingService_Abstract *ns,
const char *xmlFilePath)
: _rm(new ResourcesManager_cpp(xmlFilePath))
{
SALOME_ResourcesManager::SALOME_ResourcesManager(CORBA::ORB_ptr orb,
PortableServer::POA_var poa,
- SALOME_NamingService *ns) : _rm(new ResourcesManager_cpp())
+ SALOME_NamingService_Abstract *ns) : _rm(new ResourcesManager_cpp())
{
MESSAGE("SALOME_ResourcesManager constructor");
_NS = ns;
#include "Utils_SALOME_Exception.hxx"
#include "utilities.h"
#include <SALOMEconfig.h>
-#include "SALOME_NamingService.hxx"
+#include "SALOME_NamingService_Abstract.hxx"
#include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
#include <string>
#include <fstream>
public:
- SALOME_ResourcesManager(CORBA::ORB_ptr orb, PortableServer::POA_var poa, SALOME_NamingService *ns, const char *xmlFilePath);
- SALOME_ResourcesManager(CORBA::ORB_ptr orb, PortableServer::POA_var poa, SALOME_NamingService *ns);
+ SALOME_ResourcesManager(CORBA::ORB_ptr orb, PortableServer::POA_var poa, SALOME_NamingService_Abstract *ns, const char *xmlFilePath);
+ SALOME_ResourcesManager(CORBA::ORB_ptr orb, PortableServer::POA_var poa, SALOME_NamingService_Abstract *ns);
~SALOME_ResourcesManager();
static const char *_ResourcesManagerNameInNS;
protected:
- SALOME_NamingService *_NS;
+ SALOME_NamingService_Abstract *_NS;
CORBA::ORB_var _orb;
PortableServer::POA_var _poa;
std::shared_ptr<ResourcesManager_cpp> _rm;
#include "SALOME_ResourcesManager_Client.hxx"
#include "SALOME_ResourcesManager.hxx"
+#include "SALOME_NamingService_Abstract.hxx"
using namespace std;
-SALOME_ResourcesManager_Client::SALOME_ResourcesManager_Client(SALOME_NamingService *ns)
+SALOME_ResourcesManager_Client::SALOME_ResourcesManager_Client(SALOME_NamingService_Abstract *ns)
: _rm(Engines::ResourcesManager::_nil())
{
CORBA::Object_var objRM = ns->Resolve(SALOME_ResourcesManager::_ResourcesManagerNameInNS);
#include "SALOME_ResourcesManager_Common.hxx"
-class SALOME_NamingService;
+class SALOME_NamingService_Abstract;
// This class is fully thread-safe because the ResourcesManager CORBA object
// runs in a single-thread POA.
{
public:
- SALOME_ResourcesManager_Client(SALOME_NamingService *ns);
+ SALOME_ResourcesManager_Client(SALOME_NamingService_Abstract *ns);
~SALOME_ResourcesManager_Client();
std::vector<std::string> GetFittingResources(const resourceParams& params);
SALOMEDS_DriverFactory_i::SALOMEDS_DriverFactory_i(CORBA::ORB_ptr theORB, SALOME_NamingService_Abstract *ns):_orb( CORBA::ORB::_duplicate(theORB) )
{
- _name_service = ns->clone();
+ _name_service = ns->cloneCoVar();
}
SALOMEDS_DriverFactory_i::~SALOMEDS_DriverFactory_i()