Go to the documentation of this file.00001
00002
00003 #include "tao/CSD_Framework/CSD_POA.h"
00004 #include "tao/CSD_Framework/CSD_Strategy_Repository.h"
00005 #include "tao/CSD_Framework/CSD_Strategy_Base.h"
00006
00007 #include "ace/Dynamic_Service.h"
00008
00009 ACE_RCSID (CSD_Framework,
00010 CSD_POA,
00011 "$Id: CSD_POA.cpp 81882 2008-06-10 14:59:20Z johnc $")
00012
00013 #if !defined (__ACE_INLINE__)
00014 # include "tao/CSD_Framework/CSD_POA.inl"
00015 #endif
00016
00017 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00018
00019
00020 TAO_CSD_POA::TAO_CSD_POA (const String &name,
00021 PortableServer::POAManager_ptr poa_manager,
00022 const TAO_POA_Policy_Set &policies,
00023 TAO_Root_POA *parent,
00024 ACE_Lock &lock,
00025 TAO_SYNCH_MUTEX &thread_lock,
00026 TAO_ORB_Core &orb_core,
00027 TAO_Object_Adapter *object_adapter)
00028 : TAO_Regular_POA (name,
00029 poa_manager,
00030 policies,
00031 parent,
00032 lock,
00033 thread_lock,
00034 orb_core,
00035 object_adapter)
00036 {
00037 ACE_NEW_THROW_EX (this->sds_proxy_,
00038 TAO::CSD::Strategy_Proxy (),
00039 CORBA::NO_MEMORY ());
00040 }
00041
00042
00043
00044 TAO_CSD_POA::~TAO_CSD_POA (void)
00045 {
00046 delete this->sds_proxy_;
00047 }
00048
00049 void TAO_CSD_POA::set_csd_strategy (::CSD_Framework::Strategy_ptr strategy)
00050 {
00051 if (CORBA::is_nil (strategy))
00052 {
00053 throw ::CORBA::BAD_PARAM ();
00054 }
00055 this->sds_proxy_->custom_strategy (strategy);
00056 }
00057
00058 TAO_Root_POA *
00059 TAO_CSD_POA::new_POA (const String &name,
00060 PortableServer::POAManager_ptr poa_manager,
00061 const TAO_POA_Policy_Set &policies,
00062 TAO_Root_POA *parent,
00063 ACE_Lock &lock,
00064 TAO_SYNCH_MUTEX &thread_lock,
00065 TAO_ORB_Core &orb_core,
00066 TAO_Object_Adapter *object_adapter)
00067 {
00068 TAO_CSD_POA *poa = 0;
00069
00070 ACE_NEW_THROW_EX (poa,
00071 TAO_CSD_POA (name,
00072 poa_manager,
00073 policies,
00074 parent,
00075 lock,
00076 thread_lock,
00077 orb_core,
00078 object_adapter
00079 ),
00080 CORBA::NO_MEMORY ());
00081
00082 TAO_CSD_Strategy_Repository *repo =
00083 ACE_Dynamic_Service<TAO_CSD_Strategy_Repository>::instance ("TAO_CSD_Strategy_Repository");
00084
00085 CSD_Framework::Strategy_var strategy = repo->find (name);
00086
00087 if (! ::CORBA::is_nil (strategy.in ()))
00088 {
00089 poa->set_csd_strategy (strategy.in ());
00090 }
00091
00092 return poa;
00093 }
00094
00095 void TAO_CSD_POA::poa_activated_hook ()
00096 {
00097 this->sds_proxy_->poa_activated_event (this->orb_core_);
00098 }
00099
00100 void TAO_CSD_POA::poa_deactivated_hook ()
00101 {
00102 this->sds_proxy_->poa_deactivated_event ();
00103 }
00104
00105 void TAO_CSD_POA::servant_activated_hook (PortableServer::Servant servant,
00106 const PortableServer::ObjectId& oid)
00107 {
00108 this->sds_proxy_->servant_activated_event (servant, oid);
00109 }
00110
00111 void TAO_CSD_POA::servant_deactivated_hook (PortableServer::Servant servant,
00112 const PortableServer::ObjectId& oid)
00113 {
00114 this->sds_proxy_->servant_deactivated_event (servant, oid);
00115 }
00116
00117 TAO_END_VERSIONED_NAMESPACE_DECL