From a84aa101c1a9ab3d7009f90bfd5f310a55e1695d Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Tue, 28 Oct 2014 17:30:34 +0100 Subject: [PATCH] ScopeServer launching. --- idl/SALOME_SDS.idl | 2 + src/Container/SALOME_ContainerManager.cxx | 95 +++++++++++-------- src/Container/SALOME_ContainerManager.hxx | 17 ++-- src/Launcher/SALOME_Launcher.cxx | 5 +- src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx | 2 + src/LifeCycleCORBA/TestContainerManager.cxx | 1 + src/SALOMESDS/CMakeLists.txt | 11 ++- src/SALOMESDS/SALOMESDS_AnyDataServer.cxx | 2 + src/SALOMESDS/SALOMESDS_BasicDataServer.cxx | 27 +++++- src/SALOMESDS/SALOMESDS_BasicDataServer.hxx | 7 ++ src/SALOMESDS/SALOMESDS_DataServerManager.cxx | 57 +++++++++++ src/SALOMESDS/SALOMESDS_DataServerManager.hxx | 2 + src/SALOMESDS/SALOMESDS_StringDataServer.cxx | 2 + src/SALOMESDS/SALOME_DataScopeServer.cxx | 62 ++++++++++++ 14 files changed, 241 insertions(+), 51 deletions(-) create mode 100644 src/SALOMESDS/SALOME_DataScopeServer.cxx diff --git a/idl/SALOME_SDS.idl b/idl/SALOME_SDS.idl index 6bb48f433..1fabdef1a 100644 --- a/idl/SALOME_SDS.idl +++ b/idl/SALOME_SDS.idl @@ -25,6 +25,8 @@ module SALOME interface BasicDataServer { string getVarName(); + void setReadOnlyStatus(); + void setRWStatus(); }; interface StringDataServer : BasicDataServer diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index 8a33c0fec..5004165e9 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -21,6 +21,8 @@ // #include "SALOME_ContainerManager.hxx" +#include "SALOME_ResourcesManager.hxx" +#include "SALOME_LoadRateManager.hxx" #include "SALOME_NamingService.hxx" #include "SALOME_ModuleCatalog.hh" #include "Basics_Utils.hxx" @@ -48,7 +50,7 @@ #include "PaCOPP.hxx" #endif -#define TIME_OUT_TO_LAUNCH_CONT 60 +const int SALOME_ContainerManager::TIME_OUT_TO_LAUNCH_CONT=60; const char *SALOME_ContainerManager::_ContainerManagerNameInNS = "/ContainerManager"; @@ -584,11 +586,7 @@ SALOME_ContainerManager::LaunchContainer(const Engines::ContainerParameters& par logFilename += tmp.str(); logFilename += ".log" ; command += " > " + logFilename + " 2>&1"; -#ifdef WIN32 - command = "%PYTHONBIN% -c \"import win32pm ; win32pm.spawnpid(r'" + command + "', '')\""; -#else - command += " &"; -#endif + MakeTheCommandToBeLaunchedASync(command); // launch container with a system call status=SystemThreadSafe(command.c_str()); @@ -609,30 +607,14 @@ SALOME_ContainerManager::LaunchContainer(const Engines::ContainerParameters& par else { // Step 4: Wait for the container - int count = TIME_OUT_TO_LAUNCH_CONT; - if (GetenvThreadSafe("TIMEOUT_TO_LAUNCH_CONTAINER") != 0) - { - std::string new_count_str = GetenvThreadSafe("TIMEOUT_TO_LAUNCH_CONTAINER"); - int new_count; - std::istringstream ss(new_count_str); - if (!(ss >> new_count)) - { - INFOS("[LaunchContainer] TIMEOUT_TO_LAUNCH_CONTAINER should be an int"); - } - else - count = new_count; - } + int count(GetTimeOutToLoaunchServer()); INFOS("[GiveContainer] waiting " << count << " second steps container " << containerNameInNS); while (CORBA::is_nil(ret) && count) { -#ifndef WIN32 - sleep( 1 ) ; -#else - Sleep(1000); -#endif + SleepInSecond(1); count--; MESSAGE("[GiveContainer] step " << count << " Waiting for container on " << resource_selected); - CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str()); + CORBA::Object_var obj(_NS->Resolve(containerNameInNS.c_str())); ret=Engines::Container::_narrow(obj); } if (CORBA::is_nil(ret)) @@ -979,9 +961,9 @@ void SALOME_ContainerManager::RmTmpFile(std::string& tmpFileName) void SALOME_ContainerManager::AddOmninamesParams(std::string& command) const { - CORBA::String_var iorstr = _NS->getIORaddr(); - command += "ORBInitRef NameService="; - command += iorstr; + std::ostringstream oss; + AddOmninamesParams(oss); + command+=oss.str(); } //============================================================================= @@ -990,11 +972,9 @@ void SALOME_ContainerManager::AddOmninamesParams(std::string& command) const */ //============================================================================= -void SALOME_ContainerManager::AddOmninamesParams(std::ofstream& fileStream) const +void SALOME_ContainerManager::AddOmninamesParams(std::ostream& fileStream) const { - CORBA::String_var iorstr = _NS->getIORaddr(); - fileStream << "ORBInitRef NameService="; - fileStream << iorstr; + AddOmninamesParams(fileStream,_NS); } //============================================================================= @@ -1003,11 +983,48 @@ void SALOME_ContainerManager::AddOmninamesParams(std::ofstream& fileStream) cons */ //============================================================================= -void SALOME_ContainerManager::AddOmninamesParams(std::ostringstream& oss) const +void SALOME_ContainerManager::AddOmninamesParams(std::ostream& fileStream, SALOME_NamingService *ns) +{ + CORBA::String_var iorstr(ns->getIORaddr()); + fileStream << "ORBInitRef NameService="; + fileStream << iorstr; +} + +void SALOME_ContainerManager::MakeTheCommandToBeLaunchedASync(std::string& command) { - CORBA::String_var iorstr = _NS->getIORaddr(); - oss << "ORBInitRef NameService="; - oss << iorstr; +#ifdef WIN32 + command = "%PYTHONBIN% -c \"import win32pm ; win32pm.spawnpid(r'" + command + "', '')\""; +#else + command += " &"; +#endif +} + +int SALOME_ContainerManager::GetTimeOutToLoaunchServer() +{ + int count(TIME_OUT_TO_LAUNCH_CONT); + if (GetenvThreadSafe("TIMEOUT_TO_LAUNCH_CONTAINER") != 0) + { + std::string new_count_str(GetenvThreadSafe("TIMEOUT_TO_LAUNCH_CONTAINER")); + int new_count; + std::istringstream ss(new_count_str); + if (!(ss >> new_count)) + { + INFOS("[LaunchContainer] TIMEOUT_TO_LAUNCH_CONTAINER should be an int"); + } + else + count = new_count; + } + return count; +} + +void SALOME_ContainerManager::SleepInSecond(int ellapseTimeInSecond) +{ +#ifndef WIN32 + sleep( ellapseTimeInSecond ) ; +#else + int timeInMS(1000*ellapseTimeInSecond); + Sleep(timeInMS); +#endif } //============================================================================= @@ -1851,7 +1868,7 @@ SALOME_ContainerManager::LaunchPaCOProxyContainer(const std::string& command, return container_proxy; } - int count = TIME_OUT_TO_LAUNCH_CONT; + int count(GetTimeOutToLoaunchServer()); CORBA::Object_var obj = CORBA::Object::_nil(); std::string containerNameInNS = _NS->BuildContainerNameForNS(params.container_name.in(), hostname.c_str()); @@ -1935,9 +1952,9 @@ SALOME_ContainerManager::LaunchPaCONodeContainer(const std::string& command, std::string container_node_name = name + proc_number; std::string containerNameInNS = _NS->BuildContainerNameForNS((char*) container_node_name.c_str(), theMachine.c_str()); INFOS("[LaunchPaCONodeContainer] Waiting for Parallel Container node " << containerNameInNS << " on " << theMachine); - int count = TIME_OUT_TO_LAUNCH_CONT; + int count(GetTimeOutToLoaunchServer()); while (CORBA::is_nil(obj) && count) { - sleep(1) ; + SleepInSecond(1); count-- ; obj = _NS->Resolve(containerNameInNS.c_str()); } diff --git a/src/Container/SALOME_ContainerManager.hxx b/src/Container/SALOME_ContainerManager.hxx index 3aa4b4a7e..3891af6e5 100644 --- a/src/Container/SALOME_ContainerManager.hxx +++ b/src/Container/SALOME_ContainerManager.hxx @@ -28,15 +28,15 @@ #include #include CORBA_CLIENT_HEADER(SALOME_Component) #include CORBA_CLIENT_HEADER(SALOME_ContainerManager) -#include "SALOME_ResourcesManager.hxx" -#include "SALOME_LoadRateManager.hxx" - +#include "SALOME_ResourcesCatalog_Parser.hxx" +#include "Utils_SALOME_Exception.hxx" #include "Utils_Mutex.hxx" #include #include class SALOME_NamingService; +class SALOME_ResourcesManager; class CONTAINER_EXPORT SALOME_ContainerManager : public POA_Engines::ContainerManager { @@ -81,9 +81,7 @@ protected: void AddOmninamesParams(std::string& command) const; - void AddOmninamesParams(std::ostringstream& oss) const; - - void AddOmninamesParams(std::ofstream& fileStream) const; + void AddOmninamesParams(std::ostream& fileStream) const; static std::string BuildTemporaryFileName(); @@ -161,7 +159,12 @@ protected: public: static char *GetenvThreadSafe(const char *name); static int SystemThreadSafe(const char *command); -private: + static void AddOmninamesParams(std::ostream& fileStream, SALOME_NamingService *ns); + static void MakeTheCommandToBeLaunchedASync(std::string& command); + static int GetTimeOutToLoaunchServer(); + static void SleepInSecond(int ellapseTimeInSecond); + private: + static const int TIME_OUT_TO_LAUNCH_CONT; static Utils_Mutex _getenvMutex; static Utils_Mutex _systemMutex; }; diff --git a/src/Launcher/SALOME_Launcher.cxx b/src/Launcher/SALOME_Launcher.cxx index 3c16fdf7a..5ce7dcb0a 100644 --- a/src/Launcher/SALOME_Launcher.cxx +++ b/src/Launcher/SALOME_Launcher.cxx @@ -24,13 +24,16 @@ #include "BatchTest.hxx" #include "OpUtil.hxx" #include "SALOME_ContainerManager.hxx" +#include "SALOME_NamingService.hxx" +#include "SALOME_ResourcesManager.hxx" #include "Utils_CorbaException.hxx" - #include "Launcher_Job_Command.hxx" #include "Launcher_Job_YACSFile.hxx" #include "Launcher_Job_PythonSALOME.hxx" +#include "utilities.h" + #ifdef WIN32 # include #else diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx index 41e294e02..a63385a43 100644 --- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx +++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx @@ -42,6 +42,8 @@ #include #include "SALOME_LifeCycleCORBA.hxx" +#include "SALOME_ResourcesManager.hxx" + #include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog) #include CORBA_CLIENT_HEADER(SALOME_Session) #include CORBA_CLIENT_HEADER(DSC_Engines) diff --git a/src/LifeCycleCORBA/TestContainerManager.cxx b/src/LifeCycleCORBA/TestContainerManager.cxx index 175ff62eb..06440f005 100644 --- a/src/LifeCycleCORBA/TestContainerManager.cxx +++ b/src/LifeCycleCORBA/TestContainerManager.cxx @@ -32,6 +32,7 @@ #include "SALOME_NamingService.hxx" #include "SALOME_ContainerManager.hxx" #include "SALOME_LifeCycleCORBA.hxx" +#include "SALOME_ResourcesManager.hxx" #include "NamingService_WaitForServerReadiness.hxx" #include "OpUtil.hxx" #include "Utils_ORB_INIT.hxx" diff --git a/src/SALOMESDS/CMakeLists.txt b/src/SALOMESDS/CMakeLists.txt index 96964389e..f136c6353 100644 --- a/src/SALOMESDS/CMakeLists.txt +++ b/src/SALOMESDS/CMakeLists.txt @@ -16,7 +16,7 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -# +# Author : Anthony GEAY (EDF R&D) INCLUDE_DIRECTORIES( ${OMNIORB_INCLUDE_DIR} @@ -25,11 +25,13 @@ INCLUDE_DIRECTORIES( ${PROJECT_BINARY_DIR}/salome_adm ${CMAKE_CURRENT_SOURCE_DIR}/../Utils ${CMAKE_CURRENT_SOURCE_DIR}/../NamingService + ${CMAKE_CURRENT_SOURCE_DIR}/../Container + ${CMAKE_CURRENT_SOURCE_DIR}/../ResourcesManager ) ADD_DEFINITIONS(${OMNIORB_DEFINITIONS}) -SET(COMMON_LIBS SalomeNS SalomeIDLKernel ${OMNIORB_LIBRARIES}) +SET(COMMON_LIBS SalomeNS SalomeContainer SalomeIDLKernel ${OMNIORB_LIBRARIES}) SET(SalomeSDS_SOURCES SALOMESDS_Exception.cxx @@ -45,6 +47,9 @@ ADD_LIBRARY(SalomeSDS ${SalomeSDS_SOURCES}) TARGET_LINK_LIBRARIES(SalomeSDS ${COMMON_LIBS} ${PTHREAD_LIBRARIES}) INSTALL(TARGETS SalomeSDS EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) -FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") +ADD_EXECUTABLE(SALOME_DataScopeServer SALOME_DataScopeServer.cxx) +TARGET_LINK_LIBRARIES(SALOME_DataScopeServer SalomeSDS) +INSTALL(TARGETS SALOME_DataScopeServer DESTINATION ${SALOME_INSTALL_BINS}) +FILE(GLOB COMMON_HEADERS_HXX "${CMAKE_CURRENT_SOURCE_DIR}/*.hxx") INSTALL(FILES ${COMMON_HEADERS_HXX} DESTINATION ${SALOME_INSTALL_HEADERS}) diff --git a/src/SALOMESDS/SALOMESDS_AnyDataServer.cxx b/src/SALOMESDS/SALOMESDS_AnyDataServer.cxx index 0cc049f2e..282828ded 100644 --- a/src/SALOMESDS/SALOMESDS_AnyDataServer.cxx +++ b/src/SALOMESDS/SALOMESDS_AnyDataServer.cxx @@ -19,6 +19,7 @@ // Author : Anthony GEAY (EDF R&D) #include "SALOMESDS_AnyDataServer.hxx" +#include "SALOMESDS_Exception.hxx" using namespace SALOMESDS; @@ -31,6 +32,7 @@ AnyDataServer::AnyDataServer(const std::string& varName):BasicDataServer(varName */ void AnyDataServer::setValueOf(const CORBA::Any& newValue) { + checkReadOnlyStatusRegardingConstness("StringDataServer::setValueOf : read only var !"); delete _data; _data=new CORBA::Any(newValue); } diff --git a/src/SALOMESDS/SALOMESDS_BasicDataServer.cxx b/src/SALOMESDS/SALOMESDS_BasicDataServer.cxx index 1477629f8..6f8be87e3 100644 --- a/src/SALOMESDS/SALOMESDS_BasicDataServer.cxx +++ b/src/SALOMESDS/SALOMESDS_BasicDataServer.cxx @@ -25,11 +25,36 @@ using namespace SALOMESDS; -BasicDataServer::BasicDataServer(const std::string& varName):_var_name(varName) +BasicDataServer::BasicDataServer(const std::string& varName):_is_read_only(false),_var_name(varName) { } +/*! + * Called remotely -> to protect against throw + */ char *BasicDataServer::getVarName() { return CORBA::string_dup(_var_name.c_str()); } + +/*! + * Called remotely -> to protect against throw + */ +void BasicDataServer::setReadOnlyStatus() +{ + _is_read_only=true; +} + +/*! + * Called remotely -> to protect against throw + */ +void BasicDataServer::setRWStatus() +{ + _is_read_only=false; +} + +void BasicDataServer::checkReadOnlyStatusRegardingConstness(const char *sender) const +{ + if(isReadOnly()) + throw Exception(sender); +} diff --git a/src/SALOMESDS/SALOMESDS_BasicDataServer.hxx b/src/SALOMESDS/SALOMESDS_BasicDataServer.hxx index 1a0b1ccff..ca90c4b9b 100644 --- a/src/SALOMESDS/SALOMESDS_BasicDataServer.hxx +++ b/src/SALOMESDS/SALOMESDS_BasicDataServer.hxx @@ -35,8 +35,15 @@ namespace SALOMESDS public: BasicDataServer(const std::string& varName); char *getVarName(); + void setReadOnlyStatus(); + void setRWStatus(); std::string getVarNameCpp() const { return _var_name; } + protected: + void checkReadOnlyStatusRegardingConstness(const char *sender) const; + bool isReadOnly() const { return _is_read_only; } private: + //! false by default + bool _is_read_only; std::string _var_name; }; } diff --git a/src/SALOMESDS/SALOMESDS_DataServerManager.cxx b/src/SALOMESDS/SALOMESDS_DataServerManager.cxx index ac81e710f..69b5b35e7 100644 --- a/src/SALOMESDS/SALOMESDS_DataServerManager.cxx +++ b/src/SALOMESDS/SALOMESDS_DataServerManager.cxx @@ -21,6 +21,7 @@ #include "SALOMESDS_DataServerManager.hxx" #include "SALOMESDS_Exception.hxx" +#include "SALOME_ContainerManager.hxx" #include "SALOME_NamingService.hxx" #include @@ -80,14 +81,50 @@ SALOME::DataScopeServer_ptr DataServerManager::getDefaultScope() SALOME::DataScopeServer_ptr DataServerManager::createDataScope(const char *scopeName) { + std::string scopeNameCpp(scopeName); + std::size_t sz(_scopes.size()); + std::list< SALOME::DataScopeServer_var >::iterator it(_scopes.begin()); + for(std::size_t i=0;igetScopeName()); + if(scopeNameCpp==(const char *)zeName) + { + std::ostringstream oss; oss << "DataServerManager::createDataScope : scope name \"" << scopeName << "\" already exists !"; + throw Exception(oss.str()); + } + } + // + SALOME_NamingService ns(_orb); + std::string fullScopeName(CreateAbsNameInNSFromScopeName(scopeName)); + std::ostringstream oss; oss << "SALOME_DataScopeServer" << " " << scopeName; + SALOME_ContainerManager::AddOmninamesParams(oss,&ns); + std::string command(oss.str()); + SALOME_ContainerManager::MakeTheCommandToBeLaunchedASync(command); + int status(SALOME_ContainerManager::SystemThreadSafe(command.c_str())); + int count(SALOME_ContainerManager::GetTimeOutToLoaunchServer()); + SALOME::DataScopeServer_var ret(SALOME::DataScopeServer::_nil()); + while (CORBA::is_nil(ret) && count) + { + CORBA::Object_var obj(ns.Resolve(fullScopeName.c_str())); + ret=SALOME::DataScopeServer::_narrow(obj); + } + if(!CORBA::is_nil(ret)) + { + _scopes.push_back(ret); + } + return SALOME::DataScopeServer::_duplicate(ret); } SALOME::DataScopeServer_ptr DataServerManager::retriveDataScope(const char *scopeName) { + std::list< SALOME::DataScopeServer_var >::iterator it(getScopePtrGivenName(scopeName)); + return SALOME::DataScopeServer::_duplicate(*it); } SALOME::DataScopeServer_ptr DataServerManager::removeDataScope(const char *scopeName) { + std::list< SALOME::DataScopeServer_var >::iterator it(getScopePtrGivenName(scopeName)); + return SALOME::DataScopeServer::_duplicate(*it); } std::string DataServerManager::CreateAbsNameInNSFromScopeName(const std::string& scopeName) @@ -95,3 +132,23 @@ std::string DataServerManager::CreateAbsNameInNSFromScopeName(const std::string& std::ostringstream oss; oss << NAME_IN_NS << "/" << scopeName; return oss.str(); } + +std::list< SALOME::DataScopeServer_var >::iterator DataServerManager::getScopePtrGivenName(const std::string& scopeName) +{ + std::size_t sz(_scopes.size()); + std::list< SALOME::DataScopeServer_var >::iterator it(_scopes.begin()); + bool found(false); + for(std::size_t i=0;igetScopeName()); + found=(scopeName==(const char *)zeName); + if(found) + break; + } + if(!found) + { + std::ostringstream oss; oss << "DataServerManager::getScopePtrGivenName : scope name \"" << scopeName << "\" does not exist !"; + throw Exception(oss.str()); + } + return it; +} diff --git a/src/SALOMESDS/SALOMESDS_DataServerManager.hxx b/src/SALOMESDS/SALOMESDS_DataServerManager.hxx index 323ce0384..61e01a1ae 100644 --- a/src/SALOMESDS/SALOMESDS_DataServerManager.hxx +++ b/src/SALOMESDS/SALOMESDS_DataServerManager.hxx @@ -47,6 +47,8 @@ namespace SALOMESDS public: static const char NAME_IN_NS[]; static const char DFT_SCOPE_NAME_IN_NS[]; + private: + std::list< SALOME::DataScopeServer_var >::iterator getScopePtrGivenName(const std::string& scopeName); private: AutoRefCountPtr _dft_scope; SALOME::DataScopeServer_var _ptr_dft_scope; diff --git a/src/SALOMESDS/SALOMESDS_StringDataServer.cxx b/src/SALOMESDS/SALOMESDS_StringDataServer.cxx index 9583d7677..28b8c3a8b 100644 --- a/src/SALOMESDS/SALOMESDS_StringDataServer.cxx +++ b/src/SALOMESDS/SALOMESDS_StringDataServer.cxx @@ -19,6 +19,7 @@ // Author : Anthony GEAY (EDF R&D) #include "SALOMESDS_StringDataServer.hxx" +#include "SALOMESDS_Exception.hxx" using namespace SALOMESDS; @@ -31,6 +32,7 @@ StringDataServer::StringDataServer(const std::string& varName):BasicDataServer(v */ void StringDataServer::setValueOf(const char *newValue) { + checkReadOnlyStatusRegardingConstness("StringDataServer::setValueOf : read only var !"); _data=newValue; } diff --git a/src/SALOMESDS/SALOME_DataScopeServer.cxx b/src/SALOMESDS/SALOME_DataScopeServer.cxx new file mode 100644 index 000000000..1ffab0a1f --- /dev/null +++ b/src/SALOMESDS/SALOME_DataScopeServer.cxx @@ -0,0 +1,62 @@ +// Copyright (C) 2007-2014 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 : Anthony GEAY (EDF R&D) + +#include "SALOMESDS_DataScopeServer.hxx" +#include "SALOMESDS_DataServerManager.hxx" +#include "SALOMESDS_Exception.hxx" + +#include "SALOME_NamingService.hxx" + +#include +#include + +int main(int argc, char* argv[]) +{ + std::string scopeName; + if(argc<=1) + throw SALOMESDS::Exception("In the main of SALOME_DataScopeServer.cxx !"); + scopeName=argv[1]; + CORBA::ORB_var orb(CORBA::ORB_init(argc,argv)); + CORBA::Object_var obj(orb->resolve_initial_references("RootPOA")); + PortableServer::POA_var poa(PortableServer::POA::_narrow(obj)); + PortableServer::POAManager_var mgr(poa->the_POAManager()); + mgr->activate(); + SALOMESDS::DataScopeServer *server(new SALOMESDS::DataScopeServer(orb,scopeName)); + // + CORBA::PolicyList policies; + policies.length(1); + PortableServer::ThreadPolicy_var threadPol(poa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL)); + policies[0]=PortableServer::ThreadPolicy::_duplicate(threadPol); + PortableServer::POA_var poa2(poa->create_POA("SingleThPOA4SDS",mgr,policies)); + threadPol->destroy(); + PortableServer::ObjectId_var id(poa2->activate_object(server)); + obj=poa2->id_to_reference(id); + SALOME::DataScopeServer_var serverPtr(SALOME::DataScopeServer::_narrow(obj)); + // + std::ostringstream oss; oss << SALOMESDS::DataServerManager::NAME_IN_NS << "/" << scopeName; + std::string fullScopeName(oss.str()); + SALOME_NamingService ns(orb); + ns.Register(serverPtr,fullScopeName.c_str()); + // + orb->run(); + server->decrRef(); + return 0; +} + -- 2.39.2