diff options
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/Notify/Notify_SupplierAdmin_i.cpp')
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Notify/Notify_SupplierAdmin_i.cpp | 182 |
1 files changed, 83 insertions, 99 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_SupplierAdmin_i.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_SupplierAdmin_i.cpp index 696285c0801..5e8bb28d633 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_SupplierAdmin_i.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_SupplierAdmin_i.cpp @@ -6,69 +6,53 @@ #include "Notify_StructuredProxyPushConsumer_i.h" #include "Notify_SequenceProxyPushConsumer_i.h" #include "Notify_EventChannel_i.h" -#include "Notify_Channel_Objects_Factory.h" -#include "Notify_POA_Factory.h" -#include "Notify_Factory.h" +#include "Notify_Resource_Manager.h" #include "Notify_Event_Manager.h" ACE_RCSID(Notify, Notify_SupplierAdmin_i, "$Id$") // Implementation skeleton constructor -TAO_Notify_SupplierAdmin_i::TAO_Notify_SupplierAdmin_i (TAO_Notify_EventChannel_i* event_channel) - :event_channel_ (event_channel), - channel_objects_factory_ (0), - poa_factory_ (0), - lock_ (0), - destory_child_POAs_ (0) +TAO_Notify_SupplierAdmin_i::TAO_Notify_SupplierAdmin_i (TAO_Notify_EventChannel_i* myChannel, TAO_Notify_Resource_Manager* resource_manager) + :my_channel_ (myChannel), + resource_manager_ (resource_manager), + is_destroyed_ (0) { - event_channel_->_add_ref (); // we don't want our parent to go away! + //No-Op. } // Implementation skeleton destructor -TAO_Notify_SupplierAdmin_i::~TAO_Notify_SupplierAdmin_i () +TAO_Notify_SupplierAdmin_i::~TAO_Notify_SupplierAdmin_i (void) { - ACE_DEBUG ((LM_DEBUG,"in SA dtor\n")); - // Cleanup all resources.. - - ACE_DECLARE_NEW_CORBA_ENV; - - delete this->lock_; + /*ACE_DEBUG ((LM_DEBUG,"in SA dtor\n"));*/ + this->cleanup_i (); - this->event_channel_->supplier_admin_destroyed (this->my_id_); - event_channel_->_remove_ref (); + this->my_channel_->supplier_admin_destroyed (this->myID_); } void -TAO_Notify_SupplierAdmin_i::proxy_pushconsumer_destroyed (CosNotifyChannelAdmin::ProxyID /*proxyID*/) +TAO_Notify_SupplierAdmin_i::proxy_pushconsumer_destroyed (CosNotifyChannelAdmin::ProxyID proxyID) { + this->proxy_pushconsumer_ids_.put (proxyID); } void -TAO_Notify_SupplierAdmin_i::init (CosNotifyChannelAdmin::AdminID my_id, - CosNotifyChannelAdmin::InterFilterGroupOperator filter_operator, +TAO_Notify_SupplierAdmin_i::init (CosNotifyChannelAdmin::AdminID myID, + CosNotifyChannelAdmin::InterFilterGroupOperator myOperator, PortableServer::POA_ptr my_POA, CORBA::Environment &ACE_TRY_ENV) { this->my_POA_ = PortableServer::POA::_duplicate (my_POA); - this->channel_objects_factory_ = - TAO_Notify_Factory::get_channel_objects_factory (); - - this->poa_factory_ = TAO_Notify_Factory::get_poa_factory (); - - this->lock_ = this->channel_objects_factory_-> - create_supplier_admin_lock (ACE_TRY_ENV); - ACE_CHECK; - - this->proxy_pushconsumer_POA_ = this->poa_factory_-> - create_proxy_pushconsumer_POA (this->my_POA_.in (), my_id, + this->proxy_pushconsumer_POA_ = this->resource_manager_-> + create_proxy_pushconsumer_POA (this->my_POA_.in (), myID, ACE_TRY_ENV); ACE_CHECK; - my_id_ = my_id; - filter_operator_ = filter_operator; + myID_ = myID; + myOperator_ = myOperator; } + CosNotifyChannelAdmin::SupplierAdmin_ptr TAO_Notify_SupplierAdmin_i::get_ref (CORBA::Environment &ACE_TRY_ENV) { @@ -76,7 +60,7 @@ TAO_Notify_SupplierAdmin_i::get_ref (CORBA::Environment &ACE_TRY_ENV) // notice that this is a very expensive operation, you may want to // cache the result if it is invoked very often... - CORBA::Object_var obj = this->poa_factory_-> + CORBA::Object_var obj = this->resource_manager_-> servant_to_reference (this->my_POA_.in (), this, ACE_TRY_ENV); ACE_CHECK_RETURN (CosNotifyChannelAdmin::SupplierAdmin::_nil ()); @@ -89,7 +73,7 @@ TAO_Notify_SupplierAdmin_i::get_ref (CORBA::Environment &ACE_TRY_ENV) TAO_Notify_Event_Manager* TAO_Notify_SupplierAdmin_i::get_event_manager (void) { - return this->event_channel_->get_event_manager (); + return this->my_channel_->get_event_manager (); } TAO_Notify_FilterAdmin_i& @@ -99,9 +83,17 @@ TAO_Notify_SupplierAdmin_i::get_filter_admin (void) } void +TAO_Notify_SupplierAdmin_i::cleanup_i (CORBA::Environment &/*ACE_TRY_ENV*/) +{ + // Cleanup all resources.. + this->proxy_pushconsumer_POA_ = PortableServer::POA::_nil (); + this->my_POA_ = PortableServer::POA::_nil (); +} + +void TAO_Notify_SupplierAdmin_i::deactivate_proxy_pushconsumer (PortableServer::Servant servant, CORBA::Environment &ACE_TRY_ENV) { - this->poa_factory_-> + this->resource_manager_-> deactivate_object (servant, this->proxy_pushconsumer_POA_.in (), ACE_TRY_ENV); } @@ -112,7 +104,7 @@ TAO_Notify_SupplierAdmin_i::MyID (CORBA::Environment &/*ACE_TRY_ENV*/) CORBA::SystemException )) { - return my_id_; + return myID_; } CosNotifyChannelAdmin::EventChannel_ptr @@ -121,7 +113,7 @@ TAO_Notify_SupplierAdmin_i::MyChannel (CORBA::Environment &ACE_TRY_ENV) CORBA::SystemException )) { - return event_channel_->get_ref (ACE_TRY_ENV); + return my_channel_->get_ref (ACE_TRY_ENV); } CosNotifyChannelAdmin::InterFilterGroupOperator @@ -130,19 +122,30 @@ TAO_Notify_SupplierAdmin_i::MyOperator (CORBA::Environment &/*ACE_TRY_ENV*/) CORBA::SystemException )) { - return filter_operator_; + // Pradeep: we don't use intercaps for field names, but '_' to + // separate words, and they are all lowercase.... + return myOperator_; } CosNotifyChannelAdmin::ProxyIDSeq* -TAO_Notify_SupplierAdmin_i::push_consumers (CORBA::Environment &ACE_TRY_ENV) +TAO_Notify_SupplierAdmin_i::pull_consumers (CORBA::Environment& ACE_TRY_ENV) ACE_THROW_SPEC (( CORBA::SystemException )) { - ACE_GUARD_THROW_EX (ACE_Lock, ace_mon, *this->lock_, - CORBA::INTERNAL ()); - ACE_CHECK_RETURN (0); + // @@ Pradeep: there is no rush to implement pull, but look at the + // code in the new CosEC, we may need to start thinking about pull, + // and how can we reduce duplicated code for both pull and push + // models. + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); +} +CosNotifyChannelAdmin::ProxyIDSeq* +TAO_Notify_SupplierAdmin_i::push_consumers (CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ return this->proxy_pushconsumer_ids_.get_sequence (ACE_TRY_ENV); } @@ -154,20 +157,32 @@ TAO_Notify_SupplierAdmin_i::get_proxy_consumer (CosNotifyChannelAdmin::ProxyID p )) { CORBA::Object_var obj = - this->poa_factory_->id_to_reference (proxy_id, - proxy_pushconsumer_POA_.in (), - ACE_TRY_ENV); + this->resource_manager_->id_to_reference (proxy_id, + proxy_pushconsumer_POA_.in (), + ACE_TRY_ENV); ACE_CHECK_RETURN (CosNotifyChannelAdmin::ProxyConsumer::_nil ()); return CosNotifyChannelAdmin::ProxyConsumer::_narrow (obj.in ()); } +CosNotifyChannelAdmin::ProxyConsumer_ptr +TAO_Notify_SupplierAdmin_i::obtain_notification_pull_consumer (CosNotifyChannelAdmin::ClientType /*ctype*/, CosNotifyChannelAdmin::ProxyID_out /*proxy_id*/, CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC (( + CORBA::SystemException, + CosNotifyChannelAdmin::AdminLimitExceeded + )) +{ + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), + CosNotifyChannelAdmin::ProxyConsumer::_nil ()); +} + + CORBA::Object_ptr TAO_Notify_SupplierAdmin_i::obtain_sequence_proxy_pushconsumer_i (CosNotifyChannelAdmin::ProxyID proxy_id, CORBA::Environment &ACE_TRY_ENV) { TAO_Notify_SequenceProxyPushConsumer_i* seq_proxy_pushconsumer = - this->channel_objects_factory_->create_seq_proxy_pushconsumer (this, - ACE_TRY_ENV); + this->resource_manager_->create_seq_proxy_pushconsumer (this, + ACE_TRY_ENV); ACE_CHECK_RETURN (CORBA::Object::_nil ()); PortableServer::ServantBase_var proxy_pushconsumer_var (seq_proxy_pushconsumer); @@ -175,7 +190,7 @@ TAO_Notify_SupplierAdmin_i::obtain_sequence_proxy_pushconsumer_i (CosNotifyChann seq_proxy_pushconsumer->init (proxy_id, ACE_TRY_ENV); ACE_CHECK_RETURN (CORBA::Object::_nil ()); - return this->poa_factory_-> + return this->resource_manager_-> activate_object_with_id (proxy_id, this->proxy_pushconsumer_POA_.in (), seq_proxy_pushconsumer, @@ -186,8 +201,8 @@ CORBA::Object_ptr TAO_Notify_SupplierAdmin_i::obtain_struct_proxy_pushconsumer_i (CosNotifyChannelAdmin::ProxyID proxy_id, CORBA::Environment &ACE_TRY_ENV) { TAO_Notify_StructuredProxyPushConsumer_i* struct_proxy_pushconsumer = - this->channel_objects_factory_->create_struct_proxy_pushconsumer (this, - ACE_TRY_ENV); + this->resource_manager_->create_struct_proxy_pushconsumer (this, + ACE_TRY_ENV); ACE_CHECK_RETURN (CORBA::Object::_nil ()); PortableServer::ServantBase_var proxy_pushconsumer_var (struct_proxy_pushconsumer); @@ -195,7 +210,7 @@ TAO_Notify_SupplierAdmin_i::obtain_struct_proxy_pushconsumer_i (CosNotifyChannel struct_proxy_pushconsumer->init (proxy_id, ACE_TRY_ENV); ACE_CHECK_RETURN (CORBA::Object::_nil ()); - return this->poa_factory_-> + return this->resource_manager_-> activate_object_with_id (proxy_id, this->proxy_pushconsumer_POA_.in (), struct_proxy_pushconsumer, @@ -206,8 +221,7 @@ CORBA::Object_ptr TAO_Notify_SupplierAdmin_i::obtain_proxy_pushconsumer_i (CosNotifyChannelAdmin::ProxyID proxy_id, CORBA::Environment &ACE_TRY_ENV) { TAO_Notify_ProxyPushConsumer_i* proxy_pushconsumer = - this->channel_objects_factory_->create_proxy_pushconsumer (this, - ACE_TRY_ENV); + this->resource_manager_->create_proxy_pushconsumer (this, ACE_TRY_ENV); ACE_CHECK_RETURN (CORBA::Object::_nil ()); PortableServer::ServantBase_var proxy_pushconsumer_var (proxy_pushconsumer); @@ -215,7 +229,7 @@ TAO_Notify_SupplierAdmin_i::obtain_proxy_pushconsumer_i (CosNotifyChannelAdmin:: proxy_pushconsumer->init (proxy_id, ACE_TRY_ENV); ACE_CHECK_RETURN (CORBA::Object::_nil ()); - return this->poa_factory_-> + return this->resource_manager_-> activate_object_with_id (proxy_id, this->proxy_pushconsumer_POA_.in (), proxy_pushconsumer, @@ -231,13 +245,7 @@ TAO_Notify_SupplierAdmin_i::obtain_notification_push_consumer (CosNotifyChannelA { CORBA::Object_var obj; - { - ACE_GUARD_THROW_EX (ACE_Lock, ace_mon, *this->lock_, - CORBA::INTERNAL ()); - ACE_CHECK_RETURN (CosNotifyChannelAdmin::ProxyConsumer::_nil ()); - - proxy_id = this->proxy_pushconsumer_ids_.get (); - } + proxy_id = this->proxy_pushconsumer_ids_.get (); switch (ctype) { @@ -247,7 +255,6 @@ TAO_Notify_SupplierAdmin_i::obtain_notification_push_consumer (CosNotifyChannelA ACE_CHECK_RETURN (CosNotifyChannelAdmin::ProxyConsumer::_nil ()); } break; - case CosNotifyChannelAdmin::STRUCTURED_EVENT: { obj = this->obtain_struct_proxy_pushconsumer_i (proxy_id, @@ -269,6 +276,8 @@ TAO_Notify_SupplierAdmin_i::obtain_notification_push_consumer (CosNotifyChannelA CosNotifyChannelAdmin::ProxyConsumer::_nil ()); } + this->proxy_pushconsumer_ids_.next (); + return CosNotifyChannelAdmin::ProxyConsumer::_narrow (obj.in (), ACE_TRY_ENV); } @@ -277,15 +286,15 @@ void TAO_Notify_SupplierAdmin_i::destroy (CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { - this->destory_child_POAs_ = 1; - if (this->destory_child_POAs_ == 1) - this->poa_factory_->destroy_POA (this->proxy_pushconsumer_POA_.in (), - ACE_TRY_ENV); + this->is_destroyed_ = 1; + + this->resource_manager_->destroy_POA (this->proxy_pushconsumer_POA_.in (), + ACE_TRY_ENV); ACE_CHECK; // deactivate ourselves - this->poa_factory_->deactivate_object (this, this->my_POA_.in (), - ACE_TRY_ENV); + this->resource_manager_->deactivate_object (this, this->my_POA_.in (), + ACE_TRY_ENV); } CosNotification::QoSProperties* @@ -384,7 +393,7 @@ TAO_Notify_SupplierAdmin_i::obtain_push_consumer (CORBA::Environment& ACE_TRY_EN TAO_Notify_CosEC_ProxyPushConsumer_i* cosec_proxy; ACE_NEW_THROW_EX (cosec_proxy, - TAO_Notify_CosEC_ProxyPushConsumer_i (this), + TAO_Notify_CosEC_ProxyPushConsumer_i (this, this->resource_manager_), CORBA::NO_MEMORY ()); PortableServer::ServantBase_var proxy_var (cosec_proxy); @@ -393,40 +402,15 @@ TAO_Notify_SupplierAdmin_i::obtain_push_consumer (CORBA::Environment& ACE_TRY_EN ACE_CHECK_RETURN (CosEventChannelAdmin::ProxyPushConsumer::_nil ()); PortableServer::POA_var def_poa = - this->event_channel_->get_default_POA (); + this->resource_manager_->get_default_POA (); - CORBA::Object_var obj = this->poa_factory_-> + CORBA::Object_var obj = this->resource_manager_-> activate_object (def_poa.in (), cosec_proxy, ACE_TRY_ENV); ACE_CHECK_RETURN (CosEventChannelAdmin::ProxyPushConsumer::_nil ()); return CosEventChannelAdmin::ProxyPushConsumer::_narrow (obj.in ()); } -// = Pull Methods. -CosNotifyChannelAdmin::ProxyIDSeq* -TAO_Notify_SupplierAdmin_i::pull_consumers (CORBA::Environment& ACE_TRY_ENV) - ACE_THROW_SPEC (( - CORBA::SystemException - )) -{ - // @@ Pradeep: there is no rush to implement pull, but look at the - // code in the new CosEC, we may need to start thinking about pull, - // and how can we reduce duplicated code for both pull and push - // models. - ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); -} - -CosNotifyChannelAdmin::ProxyConsumer_ptr -TAO_Notify_SupplierAdmin_i::obtain_notification_pull_consumer (CosNotifyChannelAdmin::ClientType /*ctype*/, CosNotifyChannelAdmin::ProxyID_out /*proxy_id*/, CORBA::Environment &ACE_TRY_ENV) - ACE_THROW_SPEC (( - CORBA::SystemException, - CosNotifyChannelAdmin::AdminLimitExceeded - )) -{ - ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), - CosNotifyChannelAdmin::ProxyConsumer::_nil ()); -} - CosEventChannelAdmin::ProxyPullConsumer_ptr TAO_Notify_SupplierAdmin_i::obtain_pull_consumer (CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC (( |