From: Anthony Geay Date: Fri, 5 Jan 2018 14:37:49 +0000 (+0100) Subject: On the fly X-Git-Tag: V9_0_0~1^2~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=688f28c4d58d66e3b6a2ee7673b01993b320ba74;p=modules%2Fkernel.git On the fly --- diff --git a/idl/SALOME_SDS.idl b/idl/SALOME_SDS.idl index 82f6c2dcf..7e658252d 100644 --- a/idl/SALOME_SDS.idl +++ b/idl/SALOME_SDS.idl @@ -84,6 +84,11 @@ module SALOME ByteVec fetchSerializedContent(in string varName) raises (SALOME::SALOME_Exception); }; + interface RequestSwitcherDSM : RequestSwitcherBase + { + StringVec listScopes(); + }; + interface DataScopeServerBase { void ping(); diff --git a/src/SALOMESDS/SALOMESDS_DataServerManager.cxx b/src/SALOMESDS/SALOMESDS_DataServerManager.cxx index a613a3a7d..5c93fb111 100644 --- a/src/SALOMESDS/SALOMESDS_DataServerManager.cxx +++ b/src/SALOMESDS/SALOMESDS_DataServerManager.cxx @@ -33,6 +33,11 @@ const char DataServerManager::NAME_IN_NS[]="/DataServerManager"; const char DataServerManager::DFT_SCOPE_NAME_IN_NS[]="Default"; +SALOME::StringVec *RequestSwitcherDSM::listScopes() +{ + return _dsm->listScopes(); +} + DataServerManager::DataServerManager(int argc, char *argv[], CORBA::ORB_ptr orb, PortableServer::POA_ptr poa):_orb(CORBA::ORB::_duplicate(orb)) { DataScopeServer *dftScope(new DataScopeServer(orb,SALOME::DataScopeKiller::_nil(),DFT_SCOPE_NAME_IN_NS));//_remove_ref will be call by DataScopeServer::shutdownIfNotHostedByDSM @@ -43,19 +48,6 @@ DataServerManager::DataServerManager(int argc, char *argv[], CORBA::ORB_ptr orb, policies[0]=PortableServer::ThreadPolicy::_duplicate(threadPol); _poa=poa->create_POA("SingleThPOA4SDS",pman,policies); threadPol->destroy(); - //An another _poa_for_request_control to give to my boss the pure power - { - CORBA::PolicyList policies; - policies.length(1); - PortableServer::ThreadPolicy_var threadPol(poa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL)); - policies[0]=PortableServer::ThreadPolicy::_duplicate(threadPol); - // all is in PortableServer::POAManager::_nil. By specifying _nil cf Advanced CORBA Programming with C++ p 506 - // a new POA manager is created. This POA manager is independent from POA manager of the son ones. - _poa_for_request_control=poa->create_POA("4RqstSwitcher",PortableServer::POAManager::_nil(),policies); - threadPol->destroy(); - PortableServer::POAManager_var mgr(_poa_for_request_control->the_POAManager()); - mgr->activate(); - } // dftScope->initializePython(argc,argv);// agy : Very important ! invoke this method BEFORE activation ! // activate this to be ready to be usable from NS. @@ -320,3 +312,13 @@ SALOME::DataScopeServerBase_var DataServerManager::getScopePtrGivenName(const st SALOME_NamingService ns(_orb); return GetScopePtrGivenName(scopeName,listOfScopesCpp(),ns); } + +SALOME::RequestSwitcherDSM_ptr DataServerManager::getRequestSwitcher() +{ + if(_rs.isNull()) + { + _rs=new RequestSwitcherDSM(_orb,this); + } + CORBA::Object_var obj(_rs->activate()); + return SALOME::RequestSwitcherDSM::_narrow(obj); +} diff --git a/src/SALOMESDS/SALOMESDS_DataServerManager.hxx b/src/SALOMESDS/SALOMESDS_DataServerManager.hxx index f476db082..e8ffa1ede 100644 --- a/src/SALOMESDS/SALOMESDS_DataServerManager.hxx +++ b/src/SALOMESDS/SALOMESDS_DataServerManager.hxx @@ -26,6 +26,7 @@ #include "SALOMESDS_AutoRefCountPtr.hxx" #include "SALOMESDS_DataScopeServer.hxx" +#include "SALOMESDS_RequestSwitcher.hxx" #include "SALOMESDS_Defines.hxx" @@ -35,6 +36,17 @@ class SALOME_NamingService; namespace SALOMESDS { + class DataServerManager; + + class RequestSwitcherDSM : public RequestSwitcherBase, public virtual POA_SALOME::RequestSwitcherDSM + { + public: + RequestSwitcherDSM(CORBA::ORB_ptr orb, DataServerManager *dsm):RequestSwitcherBase(orb),_dsm(dsm) { } + SALOME::StringVec *listScopes(); + private: + DataServerManager *_dsm; + }; + class DataScopeServer; class SALOMESDS_EXPORT DataServerManager : public virtual POA_SALOME::DataServerManager @@ -56,6 +68,7 @@ namespace SALOMESDS void removeDataScope(const char *scopeName); void cleanScopesInNS(); void shutdownScopes(); + SALOME::RequestSwitcherDSM_ptr getRequestSwitcher(); public: CORBA::ORB_var getORB() { return _orb; } static std::string CreateAbsNameInNSFromScopeName(const std::string& scopeName); @@ -71,8 +84,7 @@ namespace SALOMESDS CORBA::ORB_var _orb; //! single thread poa PortableServer::POA_var _poa; - //! single thread poa and with a specific poa_manager - PortableServer::POA_var _poa_for_request_control; + AutoServantPtr _rs; }; }