diff options
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/Notify/Admin.cpp')
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Notify/Admin.cpp | 133 |
1 files changed, 59 insertions, 74 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Notify/Admin.cpp b/TAO/orbsvcs/orbsvcs/Notify/Admin.cpp index 48a0a7d9de0..8cf67d318c6 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Admin.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Admin.cpp @@ -1,8 +1,8 @@ // $Id$ -#include "orbsvcs/Notify/Admin.h" +#include "Admin.h" #if ! defined (__ACE_INLINE__) -#include "orbsvcs/Notify/Admin.inl" +#include "Admin.inl" #endif /* __ACE_INLINE__ */ ACE_RCSID (Notify, @@ -11,16 +11,16 @@ ACE_RCSID (Notify, #include "orbsvcs/CosNotifyChannelAdminC.h" -#include "orbsvcs/Notify/Container_T.h" -#include "orbsvcs/Notify/Proxy.h" -#include "orbsvcs/Notify/EventChannel.h" -#include "orbsvcs/Notify/Topology_Saver.h" -#include "orbsvcs/Notify/Save_Persist_Worker_T.h" -#include "orbsvcs/Notify/Reconnect_Worker_T.h" -#include "orbsvcs/Notify/Consumer_Map.h" -#include "orbsvcs/Notify/Supplier_Map.h" -#include "orbsvcs/Notify/ConsumerAdmin.h" -#include "orbsvcs/Notify/SupplierAdmin.h" +#include "Container_T.h" +#include "Proxy.h" +#include "EventChannel.h" +#include "Topology_Saver.h" +#include "Save_Persist_Worker_T.h" +#include "Reconnect_Worker_T.h" +#include "Consumer_Map.h" +#include "Supplier_Map.h" +#include "ConsumerAdmin.h" +#include "SupplierAdmin.h" #include "tao/debug.h" @@ -29,16 +29,13 @@ ACE_RCSID (Notify, # define DEBUG_LEVEL TAO_debug_level #endif //DEBUG_LEVEL -TAO_BEGIN_VERSIONED_NAMESPACE_DECL - TAO_Notify_Admin::TAO_Notify_Admin () : ec_ (0) , filter_operator_ (CosNotifyChannelAdmin::OR_OP) , is_default_ (false) { - // Initialize all Admin objects to initially be subscribed for all - // events. This is a reasonable default and is required to allow - // Cos Event consumers/suppliers to send/receive events, + // Initialize all Admin objects to initially be subscribed for all events. + // This is a reasonable default and is required to allow Cos Event consumers/suppliers to send/receive events, this->subscribed_types_.insert (TAO_Notify_EventType::special ()); } @@ -94,9 +91,7 @@ TAO_Notify_Admin::subscribed_types (TAO_Notify_EventTypeSeq& subscribed_types AC int TAO_Notify_Admin::shutdown (ACE_ENV_SINGLE_ARG_DECL) { - int sd_ret = TAO_Notify_Object::shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (1); - if (sd_ret == 1) + if (TAO_Notify_Object::shutdown (ACE_ENV_SINGLE_ARG_PARAMETER) == 1) return 1; this->proxy_container().shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); @@ -119,44 +114,40 @@ TAO_Notify_Admin::save_persistent (TAO_Notify::Topology_Saver& saver ACE_ENV_ARG this->self_changed_ = false; if (is_persistent ()) - { - TAO_Notify::NVPList attrs; - this->save_attrs(attrs); + { + TAO_Notify::NVPList attrs; + this->save_attrs(attrs); - const char* type = this->get_admin_type_name(); + const char* type = this->get_admin_type_name(); - bool want_all_children = - saver.begin_object(this->id(), type, attrs, changed - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; + bool want_all_children = + saver.begin_object(this->id(), type, attrs, changed ACE_ENV_ARG_PARAMETER); + ACE_CHECK; - if (want_all_children || this->filter_admin_.is_changed ()) - { - this->filter_admin_.save_persistent(saver ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } - if (want_all_children || this->subscribed_types_.is_changed ()) - { - this->subscribed_types_.save_persistent(saver ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } - - TAO_Notify::Save_Persist_Worker<TAO_Notify_Proxy> - wrk(saver, want_all_children); - this->proxy_container().collection()->for_each(&wrk - ACE_ENV_ARG_PARAMETER); + if (want_all_children || this->filter_admin_.is_changed ()) + { + this->filter_admin_.save_persistent(saver ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + if (want_all_children || this->subscribed_types_.is_changed ()) + { + this->subscribed_types_.save_persistent(saver ACE_ENV_ARG_PARAMETER); ACE_CHECK; - - saver.end_object(this->id(), type ACE_ENV_ARG_PARAMETER); } + + TAO_Notify::Save_Persist_Worker<TAO_Notify_Proxy> wrk(saver, want_all_children); + this->proxy_container().collection()->for_each(&wrk ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + saver.end_object(this->id(), type ACE_ENV_ARG_PARAMETER); + } } void TAO_Notify_Admin::save_attrs (TAO_Notify::NVPList& attrs) { TAO_Notify_Object::save_attrs(attrs); - attrs.push_back(TAO_Notify::NVP("InterFilterGroupOperator", - this->filter_operator_)); + attrs.push_back(TAO_Notify::NVP("InterFilterGroupOperator", this->filter_operator_)); if (this->is_default_) { attrs.push_back (TAO_Notify::NVP ("default", "yes")); @@ -172,42 +163,37 @@ TAO_Notify_Admin::load_attrs(const TAO_Notify::NVPList& attrs) { this->filter_operator_ = static_cast <CosNotifyChannelAdmin::InterFilterGroupOperator> (ACE_OS::atoi (value)); } - if (attrs.find ("default", value)) - { - this->is_default_ = (ACE_OS::strcmp (value, "yes") == 0); - } + { + this->is_default_ = (ACE_OS::strcmp (value, "yes") == 0); + } } TAO_Notify::Topology_Object* TAO_Notify_Admin::load_child (const ACE_CString &type, - CORBA::Long id, - const TAO_Notify::NVPList& attrs - ACE_ENV_ARG_DECL_NOT_USED) + CORBA::Long id, const TAO_Notify::NVPList& attrs ACE_ENV_ARG_DECL_NOT_USED) { ACE_UNUSED_ARG (attrs); TAO_Notify::Topology_Object* result = this; if (type == "subscriptions") - { - if (DEBUG_LEVEL) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) Admin reload subscription %d\n"), - static_cast<int> (id) - )); - // since we initialized our subscribed types to everything - // in the constructor. we have to clear it out first. - this->subscribed_types_.reset(); - result = &this->subscribed_types_; - } + { + if (DEBUG_LEVEL) ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) Admin reload subscription %d\n") + , static_cast<int> (id) + )); + // since we initialized our subscribed types to everything + // in the constructor. we have to clear it out first. + this->subscribed_types_.reset(); + result = &this->subscribed_types_; + } else if (type == "filter_admin") - { - if (DEBUG_LEVEL) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t) Admin reload filter_admin %d\n"), - static_cast<int> (id) - )); - result = & this->filter_admin_; - } + { + if (DEBUG_LEVEL) ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("(%P|%t) Admin reload filter_admin %d\n") + , static_cast<int> (id) + )); + result = & this->filter_admin_; + } return result; } @@ -219,4 +205,3 @@ TAO_Notify_Admin::reconnect (ACE_ENV_SINGLE_ARG_DECL) ACE_CHECK; } -TAO_END_VERSIONED_NAMESPACE_DECL |