From 079701fc30cf485379ed81613e5b2b7b77d95c68 Mon Sep 17 00:00:00 2001 From: Paul RASCLE Date: Mon, 5 Feb 2018 16:45:22 +0100 Subject: [PATCH] Use a CORBA single thread model for study to avoid problems on concurrent access from multiple component instances. Problems detected on geometry and mesh scripts executed in YACS foreach loop with multiple branches. --- src/GenericObj/SALOME_GenericObj_i.cc | 4 ++- src/SALOMEDS/SALOMEDS.cxx | 19 +++++++++-- src/SALOMEDS/SALOMEDS_ChildIterator_i.cxx | 23 +++++++++++-- src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx | 2 ++ src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx | 21 +++++++++++- src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx | 2 ++ .../SALOMEDS_SComponentIterator_i.cxx | 22 +++++++++++- .../SALOMEDS_SComponentIterator_i.hxx | 2 ++ src/SALOMEDS/SALOMEDS_SObject_i.cxx | 20 ++++++++++- src/SALOMEDS/SALOMEDS_SObject_i.hxx | 2 ++ src/SALOMEDS/SALOMEDS_Server.cxx | 18 ++++++++-- src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx | 18 ++++++++++ src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx | 2 ++ src/SALOMEDS/SALOMEDS_StudyManager_i.cxx | 34 +++++++++++++++++++ src/SALOMEDS/SALOMEDS_StudyManager_i.hxx | 3 ++ src/SALOMEDS/SALOMEDS_Study_i.cxx | 17 ++++++++++ src/SALOMEDS/SALOMEDS_Study_i.hxx | 3 ++ src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx | 21 +++++++++++- src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx | 2 ++ src/SALOMEDS/SALOMEDS_UseCaseIterator_i.cxx | 21 +++++++++++- src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx | 2 ++ 21 files changed, 244 insertions(+), 14 deletions(-) diff --git a/src/GenericObj/SALOME_GenericObj_i.cc b/src/GenericObj/SALOME_GenericObj_i.cc index 80966ca6e..1d756a1ce 100644 --- a/src/GenericObj/SALOME_GenericObj_i.cc +++ b/src/GenericObj/SALOME_GenericObj_i.cc @@ -31,7 +31,7 @@ // note: in KERNEL _DEBUG_ is not defined by default #ifdef _DEBUG_ -static int MYDEBUG = 0; +static int MYDEBUG = 1; #else static int MYDEBUG = 0; #endif @@ -92,6 +92,7 @@ namespace SALOME else { myPOA = PortableServer::POA::_duplicate(thePOA); } + MESSAGE("GenericObj_i::GenericObj_i thePOA: " << thePOA << " myPOA: " << myPOA); } /*! @@ -104,6 +105,7 @@ namespace SALOME */ PortableServer::POA_ptr GenericObj_i::_default_POA() { + MESSAGE("GenericObj_i::_default_POA: " << myPOA); return PortableServer::POA::_duplicate(myPOA); } diff --git a/src/SALOMEDS/SALOMEDS.cxx b/src/SALOMEDS/SALOMEDS.cxx index 81a3ce56e..06dda3211 100644 --- a/src/SALOMEDS/SALOMEDS.cxx +++ b/src/SALOMEDS/SALOMEDS.cxx @@ -36,6 +36,7 @@ #include "SALOMEDSClient_IParameters.hxx" #include "SALOMEDS_IParameters.hxx" #include "SALOMEDS_StudyManager_i.hxx" +#include "utilities.h" #include "SALOMEDS_Defines.hxx" @@ -117,10 +118,22 @@ SALOMEDS_EXPORT SALOME_NamingService namingService(orb); CORBA::Object_var obj = namingService.Resolve( "/myStudyManager" ); SALOMEDS::StudyManager_var theManager = SALOMEDS::StudyManager::_narrow( obj ); - if( CORBA::is_nil(theManager) ) { - SALOMEDS_StudyManager_i * aStudyManager_i = new SALOMEDS_StudyManager_i(orb, root_poa); + if( CORBA::is_nil(theManager) ) + { + PortableServer::POAManager_var pman = root_poa->the_POAManager(); + CORBA::PolicyList policies; + policies.length(2); + PortableServer::ThreadPolicy_var threadPol(root_poa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL)); + PortableServer::ImplicitActivationPolicy_var implicitPol(root_poa->create_implicit_activation_policy(PortableServer::IMPLICIT_ACTIVATION)); + policies[0] = PortableServer::ThreadPolicy::_duplicate(threadPol); + policies[1] = PortableServer::ImplicitActivationPolicy::_duplicate(implicitPol); + PortableServer::POA_var poa = root_poa->create_POA("KERNELStudySingleThreadPOA",pman,policies); + MESSAGE("CreateStudyManager: KERNELStudySingleThreadPOA: "<< poa); + threadPol->destroy(); + + SALOMEDS_StudyManager_i * aStudyManager_i = new SALOMEDS_StudyManager_i(orb, poa); // Activate the objects. This tells the POA that the objects are ready to accept requests. - PortableServer::ObjectId_var aStudyManager_iid = root_poa->activate_object(aStudyManager_i); + PortableServer::ObjectId_var aStudyManager_iid = poa->activate_object(aStudyManager_i); //give ownership to the poa : the object will be deleted by the poa aStudyManager_i->_remove_ref(); aStudyManager_i->register_name((char*)"/myStudyManager"); diff --git a/src/SALOMEDS/SALOMEDS_ChildIterator_i.cxx b/src/SALOMEDS/SALOMEDS_ChildIterator_i.cxx index e5c3ad9e1..31476bf5b 100644 --- a/src/SALOMEDS/SALOMEDS_ChildIterator_i.cxx +++ b/src/SALOMEDS/SALOMEDS_ChildIterator_i.cxx @@ -25,6 +25,7 @@ // Module : SALOME // #include "SALOMEDS_ChildIterator_i.hxx" +#include "SALOMEDS_StudyManager_i.hxx" #include "SALOMEDS_SObject_i.hxx" #include "SALOMEDS.hxx" #include "SALOMEDSImpl_SObject.hxx" @@ -37,8 +38,9 @@ */ //============================================================================ SALOMEDS_ChildIterator_i::SALOMEDS_ChildIterator_i(const SALOMEDSImpl_ChildIterator& theImpl, - CORBA::ORB_ptr orb) - : _it(theImpl.GetPersistentCopy()) + CORBA::ORB_ptr orb) : + GenericObj_i(SALOMEDS_StudyManager_i::GetThePOA()), + _it(theImpl.GetPersistentCopy()) { SALOMEDS::Locker lock; _orb = CORBA::ORB::_duplicate(orb); @@ -54,6 +56,23 @@ SALOMEDS_ChildIterator_i::~SALOMEDS_ChildIterator_i() if(_it) delete _it; } +//============================================================================ +/*! + \brief Get default POA for the servant object. + + This function is implicitly called from "_this()" function. + Default POA can be set via the constructor. + + \return reference to the default POA for the servant +*/ +//============================================================================ +PortableServer::POA_ptr SALOMEDS_ChildIterator_i::_default_POA() +{ + myPOA = PortableServer::POA::_duplicate(SALOMEDS_StudyManager_i::GetThePOA()); + MESSAGE("SALOMEDS_ChildIterator_i::_default_POA: " << myPOA); + return PortableServer::POA::_duplicate(myPOA); +} + //============================================================================ /*! Function :Init * diff --git a/src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx b/src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx index 4b68eaf35..779731f78 100644 --- a/src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx +++ b/src/SALOMEDS/SALOMEDS_ChildIterator_i.hxx @@ -53,6 +53,8 @@ public: //! standard destructor ~SALOMEDS_ChildIterator_i(); + + virtual PortableServer::POA_ptr _default_POA(); virtual void Init(); virtual void InitEx(CORBA::Boolean); diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx index 5b98df2db..fc3f26323 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.cxx @@ -26,6 +26,7 @@ // #include "utilities.h" #include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDS_StudyManager_i.hxx" #include "SALOMEDS_Attributes.hxx" #include "SALOMEDS.hxx" #include "SALOMEDSImpl_SObject.hxx" @@ -43,7 +44,8 @@ UNEXPECT_CATCH(GALockProtection, SALOMEDS::GenericAttribute::LockProtection); -SALOMEDS_GenericAttribute_i::SALOMEDS_GenericAttribute_i(DF_Attribute* theImpl, CORBA::ORB_ptr theOrb) +SALOMEDS_GenericAttribute_i::SALOMEDS_GenericAttribute_i(DF_Attribute* theImpl, CORBA::ORB_ptr theOrb) : + GenericObj_i(SALOMEDS_StudyManager_i::GetThePOA()) { _orb = CORBA::ORB::_duplicate(theOrb); _impl = theImpl; @@ -53,6 +55,23 @@ SALOMEDS_GenericAttribute_i::~SALOMEDS_GenericAttribute_i() { } +//============================================================================ +/*! + \brief Get default POA for the servant object. + + This function is implicitly called from "_this()" function. + Default POA can be set via the constructor. + + \return reference to the default POA for the servant +*/ +//============================================================================ +PortableServer::POA_ptr SALOMEDS_GenericAttribute_i::_default_POA() +{ + myPOA = PortableServer::POA::_duplicate(SALOMEDS_StudyManager_i::GetThePOA()); + MESSAGE("SALOMEDS_GenericAttribute_i::_default_POA: " << myPOA); + return PortableServer::POA::_duplicate(myPOA); +} + void SALOMEDS_GenericAttribute_i::CheckLocked() throw (SALOMEDS::GenericAttribute::LockProtection) { SALOMEDS::Locker lock; diff --git a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx index 0654e26dd..b141ad266 100644 --- a/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx +++ b/src/SALOMEDS/SALOMEDS_GenericAttribute_i.hxx @@ -48,6 +48,8 @@ public: SALOMEDS_GenericAttribute_i(DF_Attribute* theImpl, CORBA::ORB_ptr theOrb); virtual ~SALOMEDS_GenericAttribute_i(); + virtual PortableServer::POA_ptr _default_POA(); + void CheckLocked() throw (SALOMEDS::GenericAttribute::LockProtection); virtual char* Type(); diff --git a/src/SALOMEDS/SALOMEDS_SComponentIterator_i.cxx b/src/SALOMEDS/SALOMEDS_SComponentIterator_i.cxx index cc7d6700f..07b24a93c 100644 --- a/src/SALOMEDS/SALOMEDS_SComponentIterator_i.cxx +++ b/src/SALOMEDS/SALOMEDS_SComponentIterator_i.cxx @@ -27,6 +27,8 @@ #include "SALOMEDS_SComponentIterator_i.hxx" #include "SALOMEDS.hxx" #include "SALOMEDSImpl_SComponent.hxx" +#include "SALOMEDS_StudyManager_i.hxx" +#include "utilities.h" //============================================================================ /*! Function : constructor @@ -35,7 +37,8 @@ //============================================================================ SALOMEDS_SComponentIterator_i::SALOMEDS_SComponentIterator_i(const SALOMEDSImpl_SComponentIterator& theImpl, - CORBA::ORB_ptr orb) + CORBA::ORB_ptr orb) : + GenericObj_i(SALOMEDS_StudyManager_i::GetThePOA()) { _orb = CORBA::ORB::_duplicate(orb); _impl = theImpl.GetPersistentCopy(); @@ -51,6 +54,23 @@ SALOMEDS_SComponentIterator_i::~SALOMEDS_SComponentIterator_i() if(_impl) delete _impl; } +//============================================================================ +/*! + \brief Get default POA for the servant object. + + This function is implicitly called from "_this()" function. + Default POA can be set via the constructor. + + \return reference to the default POA for the servant +*/ +//============================================================================ +PortableServer::POA_ptr SALOMEDS_SComponentIterator_i::_default_POA() +{ + myPOA = PortableServer::POA::_duplicate(SALOMEDS_StudyManager_i::GetThePOA()); + MESSAGE("SALOMEDS_SComponentIterator_i::_default_POA: " << myPOA); + return PortableServer::POA::_duplicate(myPOA); +} + //============================================================================ /*! Function : Init * diff --git a/src/SALOMEDS/SALOMEDS_SComponentIterator_i.hxx b/src/SALOMEDS/SALOMEDS_SComponentIterator_i.hxx index 73124108f..928fe0530 100644 --- a/src/SALOMEDS/SALOMEDS_SComponentIterator_i.hxx +++ b/src/SALOMEDS/SALOMEDS_SComponentIterator_i.hxx @@ -54,6 +54,8 @@ public: SALOMEDS_SComponentIterator_i(const SALOMEDSImpl_SComponentIterator& theImpl, CORBA::ORB_ptr); ~SALOMEDS_SComponentIterator_i(); + + virtual PortableServer::POA_ptr _default_POA(); virtual void Init(); virtual CORBA::Boolean More(); diff --git a/src/SALOMEDS/SALOMEDS_SObject_i.cxx b/src/SALOMEDS/SALOMEDS_SObject_i.cxx index 210e0fa68..fd6601ee0 100644 --- a/src/SALOMEDS/SALOMEDS_SObject_i.cxx +++ b/src/SALOMEDS/SALOMEDS_SObject_i.cxx @@ -58,7 +58,8 @@ SALOMEDS::SObject_ptr SALOMEDS_SObject_i::New(const SALOMEDSImpl_SObject& theImp * Purpose : */ //============================================================================ -SALOMEDS_SObject_i::SALOMEDS_SObject_i(const SALOMEDSImpl_SObject& impl, CORBA::ORB_ptr orb) +SALOMEDS_SObject_i::SALOMEDS_SObject_i(const SALOMEDSImpl_SObject& impl, CORBA::ORB_ptr orb) : + GenericObj_i(SALOMEDS_StudyManager_i::GetThePOA()) { _impl = 0; if(!impl.IsNull()) { @@ -85,6 +86,23 @@ SALOMEDS_SObject_i::~SALOMEDS_SObject_i() if(_impl) delete _impl; } +//============================================================================ +/*! + \brief Get default POA for the servant object. + + This function is implicitly called from "_this()" function. + Default POA can be set via the constructor. + + \return reference to the default POA for the servant +*/ +//============================================================================ +PortableServer::POA_ptr SALOMEDS_SObject_i::_default_POA() +{ + myPOA = PortableServer::POA::_duplicate(SALOMEDS_StudyManager_i::GetThePOA()); + MESSAGE("SALOMEDS_SObject_i::_default_POA: " << myPOA); + return PortableServer::POA::_duplicate(myPOA); +} + //================================================================================ /*! * \brief Returns true if the %SObject does not belong to any %Study diff --git a/src/SALOMEDS/SALOMEDS_SObject_i.hxx b/src/SALOMEDS/SALOMEDS_SObject_i.hxx index f996197fb..5c0bdc652 100644 --- a/src/SALOMEDS/SALOMEDS_SObject_i.hxx +++ b/src/SALOMEDS/SALOMEDS_SObject_i.hxx @@ -53,6 +53,8 @@ public: SALOMEDS_SObject_i(const SALOMEDSImpl_SObject&, CORBA::ORB_ptr); virtual ~SALOMEDS_SObject_i(); + + virtual PortableServer::POA_ptr _default_POA(); virtual CORBA::Boolean IsNull(); virtual char* GetID(); diff --git a/src/SALOMEDS/SALOMEDS_Server.cxx b/src/SALOMEDS/SALOMEDS_Server.cxx index 17a6583b0..a780abd6c 100644 --- a/src/SALOMEDS/SALOMEDS_Server.cxx +++ b/src/SALOMEDS/SALOMEDS_Server.cxx @@ -70,6 +70,7 @@ int main(int argc, char** argv) ts_rem.tv_nsec=0; ts_rem.tv_sec=0; CosNaming::NamingContext_var inc; + PortableServer::POA_var defaultPoa; PortableServer::POA_var poa; CORBA::Object_var theObj; CORBA::Object_var obj; @@ -95,9 +96,20 @@ int main(int argc, char** argv) { obj = orb->resolve_initial_references("RootPOA"); if(!CORBA::is_nil(obj)) - poa = PortableServer::POA::_narrow(obj); - if(!CORBA::is_nil(poa)) - pman = poa->the_POAManager(); + defaultPoa = PortableServer::POA::_narrow(obj); + if(!CORBA::is_nil(defaultPoa)) + pman = defaultPoa->the_POAManager(); + + PortableServer::POAManager_var pman = defaultPoa->the_POAManager(); + CORBA::PolicyList policies; + policies.length(2); + PortableServer::ThreadPolicy_var threadPol(defaultPoa->create_thread_policy(PortableServer::SINGLE_THREAD_MODEL)); + PortableServer::ImplicitActivationPolicy_var implicitPol(defaultPoa->create_implicit_activation_policy(PortableServer::IMPLICIT_ACTIVATION)); + policies[0] = PortableServer::ThreadPolicy::_duplicate(threadPol); + policies[1] = PortableServer::ImplicitActivationPolicy::_duplicate(implicitPol); + poa = defaultPoa->create_POA("KERNELStandaloneStudySingleThreadPOA",pman,policies); + threadPol->destroy(); + if(!CORBA::is_nil(orb)) theObj = orb->resolve_initial_references("NameService"); if (!CORBA::is_nil(theObj)){ diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx index a31fda64c..e3013e714 100644 --- a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx @@ -26,6 +26,7 @@ // #include "utilities.h" #include "SALOMEDS_StudyBuilder_i.hxx" +#include "SALOMEDS_StudyManager_i.hxx" #include "SALOMEDS_Study_i.hxx" #include "SALOMEDS_SObject_i.hxx" #include "SALOMEDS_SComponent_i.hxx" @@ -67,6 +68,23 @@ SALOMEDS_StudyBuilder_i::SALOMEDS_StudyBuilder_i(SALOMEDSImpl_StudyBuilder* theI SALOMEDS_StudyBuilder_i::~SALOMEDS_StudyBuilder_i() {} +//============================================================================ +/*! + \brief Get default POA for the servant object. + + This function is implicitly called from "_this()" function. + Default POA can be set via the constructor. + + \return reference to the default POA for the servant +*/ +//============================================================================ +PortableServer::POA_ptr SALOMEDS_StudyBuilder_i::_default_POA() +{ + PortableServer::POA_ptr poa = SALOMEDS_StudyManager_i::GetThePOA(); + MESSAGE("SALOMEDS_StudyBuilder_i::_default_POA: " << poa); + return PortableServer::POA::_duplicate(poa); +} + //============================================================================ /*! Function : NewComponent * Purpose : Create a new component (Scomponent) diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx index d4c30fb74..99b44a92c 100644 --- a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.hxx @@ -48,6 +48,8 @@ public: ~SALOMEDS_StudyBuilder_i(); + virtual PortableServer::POA_ptr _default_POA(); + //! NewComponent /*! \param ComponentDataType diff --git a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx index c5eefdfaa..2e9146896 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager_i.cxx @@ -69,6 +69,11 @@ SALOMEDS_StudyManager_i::SALOMEDS_StudyManager_i(CORBA::ORB_ptr orb, PortableSer { _orb = CORBA::ORB::_duplicate(orb); _poa = PortableServer::POA::_duplicate(thePOA); + MESSAGE("thePOA, _poa="<<_poa); + if (_mapOfPOA.empty()) + _mapOfPOA[0] = _poa; + else + MESSAGE("_mapOfPOA[0] already contains: " << _mapOfPOA[0]); _name_service = new SALOME_NamingService(_orb); // Study directory creation in the naming service : to register all // open studies in the session @@ -91,6 +96,22 @@ SALOMEDS_StudyManager_i::~SALOMEDS_StudyManager_i() delete _impl; } +//============================================================================ +/*! + \brief Get default POA for the servant object. + + This function is implicitly called from "_this()" function. + Default POA can be set via the constructor. + + \return reference to the default POA for the servant +*/ +//============================================================================ +PortableServer::POA_ptr SALOMEDS_StudyManager_i::_default_POA() +{ + MESSAGE("SALOMEDS_StudyManager_i::_default_POA: " << _poa); + return PortableServer::POA::_duplicate(_poa); +} + //============================================================================ /*! Function : register_name * Purpose : Register the study Manager in the naming service under the @@ -487,6 +508,19 @@ PortableServer::POA_ptr SALOMEDS_StudyManager_i::GetPOA(const SALOMEDS::Study_pt return PortableServer::POA::_nil(); } +PortableServer::POA_ptr SALOMEDS_StudyManager_i::GetThePOA() +{ + std::map::iterator iter = _mapOfPOA.begin(); + if (iter != _mapOfPOA.end()) + { + PortableServer::POA_ptr aPoa = iter->second; + MESSAGE("GetThePOA(): "<< aPoa); + return aPoa; + } + MESSAGE("GetThePOA(): _nil !"); + return PortableServer::POA::_nil(); +} + CORBA::Long SALOMEDS_StudyManager_i::getPID() { #ifdef WIN32 diff --git a/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx b/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx index ba1daf0eb..05225c75e 100644 --- a/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx +++ b/src/SALOMEDS/SALOMEDS_StudyManager_i.hxx @@ -71,6 +71,8 @@ public: //! standard destructor virtual ~SALOMEDS_StudyManager_i(); + virtual PortableServer::POA_ptr _default_POA(); + //! method to Register study Manager in the naming service /*! \param char* arguments, the context to register the study manager in the NS @@ -149,6 +151,7 @@ public: virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal); static PortableServer::POA_ptr GetPOA(const SALOMEDS::Study_ptr theStudy); + static PortableServer::POA_ptr GetThePOA(); void Shutdown() { if(!CORBA::is_nil(_orb)) _orb->shutdown(0); } }; diff --git a/src/SALOMEDS/SALOMEDS_Study_i.cxx b/src/SALOMEDS/SALOMEDS_Study_i.cxx index d0b936acc..3d99e2b73 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.cxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.cxx @@ -274,6 +274,23 @@ SALOMEDS_Study_i::~SALOMEDS_Study_i() _mapOfStudies.erase(_impl); } +//============================================================================ +/*! + \brief Get default POA for the servant object. + + This function is implicitly called from "_this()" function. + Default POA can be set via the constructor. + + \return reference to the default POA for the servant +*/ +//============================================================================ +PortableServer::POA_ptr SALOMEDS_Study_i::_default_POA() +{ + PortableServer::POA_ptr poa = SALOMEDS_StudyManager_i::GetThePOA(); + MESSAGE("SALOMEDS_Study_i::_default_POA: " << poa); + return PortableServer::POA::_duplicate(poa); +} + //============================================================================ /*! Function : GetPersistentReference * Purpose : Get persistent reference of study (idem URL()) diff --git a/src/SALOMEDS/SALOMEDS_Study_i.hxx b/src/SALOMEDS/SALOMEDS_Study_i.hxx index a767e6414..59fed5664 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.hxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.hxx @@ -38,6 +38,7 @@ #include //SALOMEDS headers +#include "SALOMEDS_StudyManager_i.hxx" #include "SALOMEDS_SComponentIterator_i.hxx" #include "SALOMEDS_StudyBuilder_i.hxx" #include "SALOMEDS_SObject_i.hxx" @@ -64,6 +65,8 @@ public: //! standard destructor virtual ~SALOMEDS_Study_i(); + + virtual PortableServer::POA_ptr _default_POA(); //! method to Get persistent reference of study (idem URL()) /*! diff --git a/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx b/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx index 118ab2d81..2076c255b 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.cxx @@ -28,6 +28,7 @@ #include "SALOMEDS_UseCaseIterator_i.hxx" #include "SALOMEDS_SObject_i.hxx" #include "SALOMEDS.hxx" +#include "SALOMEDS_StudyManager_i.hxx" #include "utilities.h" @@ -37,7 +38,8 @@ */ //============================================================================ SALOMEDS_UseCaseBuilder_i::SALOMEDS_UseCaseBuilder_i(SALOMEDSImpl_UseCaseBuilder* theImpl, - CORBA::ORB_ptr orb) + CORBA::ORB_ptr orb) : + GenericObj_i(SALOMEDS_StudyManager_i::GetThePOA()) { _orb = CORBA::ORB::_duplicate(orb); _impl = theImpl; @@ -52,6 +54,23 @@ SALOMEDS_UseCaseBuilder_i::~SALOMEDS_UseCaseBuilder_i() { } +//============================================================================ +/*! + \brief Get default POA for the servant object. + + This function is implicitly called from "_this()" function. + Default POA can be set via the constructor. + + \return reference to the default POA for the servant +*/ +//============================================================================ +PortableServer::POA_ptr SALOMEDS_UseCaseBuilder_i::_default_POA() +{ + myPOA = PortableServer::POA::_duplicate(SALOMEDS_StudyManager_i::GetThePOA()); + MESSAGE("SALOMEDS_UseCaseBuilder_i::_default_POA: " << myPOA); + return PortableServer::POA::_duplicate(myPOA); +} + //============================================================================ /*! Function : Append diff --git a/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx b/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx index b7edf4d81..42a836e0d 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseBuilder_i.hxx @@ -58,6 +58,8 @@ public: //! standard destructor ~SALOMEDS_UseCaseBuilder_i(); + + virtual PortableServer::POA_ptr _default_POA(); virtual CORBA::Boolean Append(SALOMEDS::SObject_ptr theObject); diff --git a/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.cxx b/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.cxx index cb3babe76..9a1f681b1 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.cxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.cxx @@ -27,6 +27,7 @@ #include "SALOMEDS_UseCaseIterator_i.hxx" #include "SALOMEDS_SObject_i.hxx" #include "SALOMEDS.hxx" +#include "SALOMEDS_StudyManager_i.hxx" #include "SALOMEDSImpl_SObject.hxx" #include "utilities.h" @@ -37,7 +38,8 @@ */ //============================================================================ SALOMEDS_UseCaseIterator_i::SALOMEDS_UseCaseIterator_i(const SALOMEDSImpl_UseCaseIterator& theImpl, - CORBA::ORB_ptr orb) + CORBA::ORB_ptr orb) : + GenericObj_i(SALOMEDS_StudyManager_i::GetThePOA()) { _orb = CORBA::ORB::_duplicate(orb); _impl = theImpl.GetPersistentCopy(); @@ -53,6 +55,23 @@ SALOMEDS_UseCaseIterator_i::~SALOMEDS_UseCaseIterator_i() if(_impl) delete _impl; } +//============================================================================ +/*! + \brief Get default POA for the servant object. + + This function is implicitly called from "_this()" function. + Default POA can be set via the constructor. + + \return reference to the default POA for the servant +*/ +//============================================================================ +PortableServer::POA_ptr SALOMEDS_UseCaseIterator_i::_default_POA() +{ + myPOA = PortableServer::POA::_duplicate(SALOMEDS_StudyManager_i::GetThePOA()); + MESSAGE("SALOMEDS_UseCaseIterator_i::_default_POA: " << myPOA); + return PortableServer::POA::_duplicate(myPOA); +} + //============================================================================ /*! Function :Init * diff --git a/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx b/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx index fbba0d691..a659cd81a 100644 --- a/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx +++ b/src/SALOMEDS/SALOMEDS_UseCaseIterator_i.hxx @@ -53,6 +53,8 @@ public: //! standard destructor ~SALOMEDS_UseCaseIterator_i(); + + virtual PortableServer::POA_ptr _default_POA(); virtual void Init(CORBA::Boolean); virtual CORBA::Boolean More(); -- 2.39.2