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
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.
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);
+}
#include "SALOMESDS_AutoRefCountPtr.hxx"
#include "SALOMESDS_DataScopeServer.hxx"
+#include "SALOMESDS_RequestSwitcher.hxx"
#include "SALOMESDS_Defines.hxx"
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
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);
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<RequestSwitcherDSM> _rs;
};
}