Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / CSD_Framework / CSD_POA.cpp
blobb5556b4441e7cca12e1b65b7ea6f94052631bb89
1 // -*- C++ -*-
2 #include "tao/CSD_Framework/CSD_POA.h"
3 #include "tao/CSD_Framework/CSD_Strategy_Repository.h"
4 #include "tao/CSD_Framework/CSD_Strategy_Base.h"
6 #include "ace/Dynamic_Service.h"
8 #if !defined (__ACE_INLINE__)
9 # include "tao/CSD_Framework/CSD_POA.inl"
10 #endif /* ! __ACE_INLINE__ */
12 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
14 // Implementation skeleton constructor
15 TAO_CSD_POA::TAO_CSD_POA (const String &name,
16 PortableServer::POAManager_ptr poa_manager,
17 const TAO_POA_Policy_Set &policies,
18 TAO_Root_POA *parent,
19 ACE_Lock &lock,
20 TAO_SYNCH_MUTEX &thread_lock,
21 TAO_ORB_Core &orb_core,
22 TAO_Object_Adapter *object_adapter)
23 : TAO_Regular_POA (name,
24 poa_manager,
25 policies,
26 parent,
27 lock,
28 thread_lock,
29 orb_core,
30 object_adapter)
32 ACE_NEW_THROW_EX (this->sds_proxy_,
33 TAO::CSD::Strategy_Proxy (),
34 CORBA::NO_MEMORY ());
38 // Implementation skeleton destructor
39 TAO_CSD_POA::~TAO_CSD_POA ()
41 delete this->sds_proxy_;
44 void TAO_CSD_POA::set_csd_strategy (::CSD_Framework::Strategy_ptr strategy)
46 if (CORBA::is_nil (strategy))
48 throw ::CORBA::BAD_PARAM ();
50 this->sds_proxy_->custom_strategy (strategy);
53 TAO_Root_POA *
54 TAO_CSD_POA::new_POA (const String &name,
55 PortableServer::POAManager_ptr poa_manager,
56 const TAO_POA_Policy_Set &policies,
57 TAO_Root_POA *parent,
58 ACE_Lock &lock,
59 TAO_SYNCH_MUTEX &thread_lock,
60 TAO_ORB_Core &orb_core,
61 TAO_Object_Adapter *object_adapter)
63 TAO_CSD_POA *poa = 0;
65 ACE_NEW_THROW_EX (poa,
66 TAO_CSD_POA (name,
67 poa_manager,
68 policies,
69 parent,
70 lock,
71 thread_lock,
72 orb_core,
73 object_adapter),
74 CORBA::NO_MEMORY ());
76 TAO_CSD_Strategy_Repository *repo =
77 ACE_Dynamic_Service<TAO_CSD_Strategy_Repository>::instance ("TAO_CSD_Strategy_Repository");
79 if (repo)
81 CSD_Framework::Strategy_var strategy = repo->find (name);
83 if (! ::CORBA::is_nil (strategy.in ()))
85 poa->set_csd_strategy (strategy.in ());
89 return poa;
92 void TAO_CSD_POA::poa_activated_hook ()
94 this->sds_proxy_->poa_activated_event (this->orb_core_);
97 void TAO_CSD_POA::poa_deactivated_hook ()
99 this->sds_proxy_->poa_deactivated_event ();
102 void TAO_CSD_POA::servant_activated_hook (PortableServer::Servant servant,
103 const PortableServer::ObjectId& oid)
105 this->sds_proxy_->servant_activated_event (servant, oid);
108 void TAO_CSD_POA::servant_deactivated_hook (PortableServer::Servant servant,
109 const PortableServer::ObjectId& oid)
111 this->sds_proxy_->servant_deactivated_event (servant, oid);
114 TAO_END_VERSIONED_NAMESPACE_DECL