From cad396e5015a47dab1f3aebd7203d426eea99537 Mon Sep 17 00:00:00 2001 From: pradeep Date: Fri, 21 Mar 2003 15:54:28 +0000 Subject: ChangeLogTag: Wed Mar 19 08:42:45 2003 Pradeep Gore --- .../orbsvcs/Notify/Notify_EventChannel_i.cpp | 452 --------------------- TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannel_i.h | 318 --------------- TAO/orbsvcs/orbsvcs/Notify/Notify_Service.cpp | 357 ---------------- TAO/orbsvcs/orbsvcs/Notify/Notify_Service.h | 104 ----- 4 files changed, 1231 deletions(-) delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannel_i.cpp delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannel_i.h delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Notify_Service.cpp delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Notify_Service.h diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannel_i.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannel_i.cpp deleted file mode 100644 index 628b37fc18e..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannel_i.cpp +++ /dev/null @@ -1,452 +0,0 @@ -// $Id$ - -#include "orbsvcs/ESF/ESF_Proxy_Collection.h" -#include "Notify_EventChannel_i.h" -#include "Notify_EventChannelFactory_i.h" -#include "Notify_SupplierAdmin_i.h" -#include "Notify_ConsumerAdmin_i.h" -#include "Notify_Event_Manager.h" -#include "Notify_Channel_Objects_Factory.h" -#include "Notify_POA_Factory.h" -#include "Notify_Factory.h" -#include "Notify_Event_Manager_Objects_Factory.h" -#include "Notify_Collection_Factory.h" -#include "Notify_AdminProperties.h" - -#include "tao/debug.h" - -ACE_RCSID(Notify, Notify_EventChannel_i, "$Id$") - -TAO_Notify_EventChannel_i::TAO_Notify_EventChannel_i (TAO_Notify_EventChannelFactory_i* my_factory) - :lock_ (0), - destory_child_POAs_ (0), - channel_factory_ (my_factory), - channel_objects_factory_ (TAO_Notify_Factory:: - get_channel_objects_factory ()), - poa_factory_ (TAO_Notify_Factory::get_poa_factory ()), - event_manager_objects_factory_ (TAO_Notify_Factory::create_event_manager_objects_factory ()), - default_op_ (CosNotifyChannelAdmin::OR_OP), - default_id_ (0), - event_listener_list_ (0) -{ - this->channel_factory_->_add_ref (); -} - -// Implementation skeleton destructor -TAO_Notify_EventChannel_i::~TAO_Notify_EventChannel_i (void) -{ - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG,"in EC dtor\n")); - // Cleanup all resources.. - - delete this->event_manager_; - delete this->lock_; - delete this->event_listener_list_; - - this->channel_factory_->event_channel_destroyed (this->channel_id_); - this->channel_factory_->_remove_ref (); - - delete event_manager_objects_factory_; -} - -void -TAO_Notify_EventChannel_i::init (CosNotifyChannelAdmin::ChannelID channel_id, const CosNotification::QoSProperties& initial_qos, const CosNotification::AdminProperties& initial_admin, PortableServer::POA_ptr default_POA, PortableServer::POA_ptr my_POA ACE_ENV_ARG_DECL) -{ - this->channel_id_ = channel_id; - - this->my_POA_ = PortableServer::POA::_duplicate (my_POA); - this->default_POA_ = PortableServer::POA::_duplicate (default_POA); - - this->lock_ = - this->channel_objects_factory_->create_event_channel_lock (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - this->event_manager_ = - this->event_manager_objects_factory_->create_event_manager (this ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - // Set these before initializing the event manger. - this->set_qos (initial_qos ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - this->event_manager_->init (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - // try to set initial admin params - // This must be set after initializing the event manager - // since it is the one that owns the admin properties. - this->set_admin (initial_admin ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - // Create the POA for the CA's - this->CA_POA_ = - this->poa_factory_->create_consumer_admin_POA (this->my_POA_.in (), channel_id - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - // Create the POA for the SA's - this->SA_POA_ = - this->poa_factory_->create_supplier_admin_POA (this->my_POA_.in (), channel_id - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - this->event_listener_list_ = - TAO_Notify_Factory::get_collection_factory ()->create_event_listener_list (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - // Create the default Consumer Admin. Because the ID_Pool is being used - // the first time here, it will generate the id 0. - CosNotifyChannelAdmin::AdminID id_unused; - - CosNotifyChannelAdmin::ConsumerAdmin_var def_consumer_admin = - this->new_for_consumers (default_op_, id_unused ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - CosNotifyChannelAdmin::SupplierAdmin_var def_supplier_admin = - this->new_for_suppliers (default_op_, id_unused ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -TAO_Notify_Event_Manager* -TAO_Notify_EventChannel_i::get_event_manager (void) -{ - return this->event_manager_; -} - -void -TAO_Notify_EventChannel_i::consumer_admin_destroyed (CosNotifyChannelAdmin::AdminID CA_ID) -{ - this->consumer_admin_ids_.put (CA_ID); -} - -void -TAO_Notify_EventChannel_i::supplier_admin_destroyed (CosNotifyChannelAdmin::AdminID SA_ID) -{ - this->supplier_admin_ids_.put (SA_ID); -} - -PortableServer::POA_ptr -TAO_Notify_EventChannel_i::get_default_POA (void) -{ - return PortableServer::POA::_duplicate (this->default_POA_.in ()); -} - -CosNotifyChannelAdmin::EventChannel_ptr -TAO_Notify_EventChannel_i::get_ref (ACE_ENV_SINGLE_ARG_DECL) -{ - CORBA::Object_var obj = this->poa_factory_-> - servant_to_reference (this->my_POA_.in (), this ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CosNotifyChannelAdmin::EventChannel::_nil ()); - - return CosNotifyChannelAdmin::EventChannel::_narrow (obj.in ()); -} - - -void -TAO_Notify_EventChannel_i::unregister_listener (TAO_Notify_EventListener* group_listener ACE_ENV_ARG_DECL) -{ - // UnRegister the group listener. - this->event_listener_list_->disconnected (group_listener ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -void -TAO_Notify_EventChannel_i::destroy (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException - )) -{ - this->event_manager_->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - // Deactivate ourselves. - this->poa_factory_->deactivate_object (this, - this->my_POA_.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - // shutdown consumer admins's. - TAO_Notify_Shutdown_Worker shutdown_worker; - - this->event_listener_list_->for_each (&shutdown_worker ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - // release all references. - this->event_listener_list_->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - // @@ TODO: We need a way to send shutdown messages to the proxy consumers too. - // (event listeners are proxy suppliers or CA's in disguise) - - this->poa_factory_->destroy_POA (this->CA_POA_.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - this->poa_factory_->destroy_POA (this->SA_POA_.in () - ACE_ENV_ARG_PARAMETER); -} - -const TAO_Notify_QoSAdmin_i& -TAO_Notify_EventChannel_i::qos_admin (void) const -{ - return this->qos_admin_; -} - -CosNotifyChannelAdmin::EventChannelFactory_ptr -TAO_Notify_EventChannel_i::MyFactory (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->channel_factory_->get_ref (ACE_ENV_SINGLE_ARG_PARAMETER); -} - -CosNotifyChannelAdmin::ConsumerAdmin_ptr -TAO_Notify_EventChannel_i::default_consumer_admin (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException - )) -{ - return this->get_consumeradmin (this->default_id_ ACE_ENV_ARG_PARAMETER); -} - -CosNotifyChannelAdmin::SupplierAdmin_ptr -TAO_Notify_EventChannel_i::default_supplier_admin (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException - )) -{ - return this->get_supplieradmin (this->default_id_ ACE_ENV_ARG_PARAMETER); -} - -CosNotifyFilter::FilterFactory_ptr -TAO_Notify_EventChannel_i::default_filter_factory (ACE_ENV_SINGLE_ARG_DECL_NOT_USED/*ACE_ENV_SINGLE_ARG_PARAMETER*/) - ACE_THROW_SPEC (( - CORBA::SystemException - )) -{ - return this->channel_factory_->get_default_filter_factory (); -} - -CosNotifyChannelAdmin::ConsumerAdmin_ptr -TAO_Notify_EventChannel_i::new_for_consumers (CosNotifyChannelAdmin::InterFilterGroupOperator op, CosNotifyChannelAdmin::AdminID_out id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException - )) -{ - // @@ use auto_ptr - TAO_Notify_ConsumerAdmin_i* consumer_admin = - this->channel_objects_factory_->create_consumer_admin (this ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CosNotifyChannelAdmin::ConsumerAdmin::_nil ()); - - PortableServer::ServantBase_var consumeradmin_var (consumer_admin); - - { - ACE_GUARD_THROW_EX (ACE_Lock, ace_mon, *this->lock_, - CORBA::INTERNAL ()); - ACE_CHECK_RETURN (CosNotifyChannelAdmin::ConsumerAdmin::_nil ()); - - id = this->consumer_admin_ids_.get (); - } - - consumer_admin->init (id, op, this->CA_POA_.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CosNotifyChannelAdmin::ConsumerAdmin::_nil ()); - - CORBA::Object_var obj = - this->poa_factory_->activate_object_with_id (id, - this->CA_POA_.in (), - consumer_admin - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CosNotifyChannelAdmin::ConsumerAdmin::_nil ()); - - // Register the group listener. - this->event_listener_list_->connected (consumer_admin ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CosNotifyChannelAdmin::ConsumerAdmin::_nil ()); - - this->consumer_admin_ids_.next (); - return CosNotifyChannelAdmin::ConsumerAdmin::_narrow (obj.in ()); -} - -CosNotifyChannelAdmin::SupplierAdmin_ptr -TAO_Notify_EventChannel_i::new_for_suppliers (CosNotifyChannelAdmin::InterFilterGroupOperator op, CosNotifyChannelAdmin::AdminID_out id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException - )) -{ - TAO_Notify_SupplierAdmin_i* supplieradmin = - this->channel_objects_factory_->create_supplier_admin (this ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CosNotifyChannelAdmin::SupplierAdmin::_nil ()); - - PortableServer::ServantBase_var supplieradmin_var (supplieradmin); - - { - ACE_GUARD_THROW_EX (ACE_Lock, ace_mon, *this->lock_, - CORBA::INTERNAL ()); - id = this->supplier_admin_ids_.get (); - } - - supplieradmin->init (id, op, this->SA_POA_.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CosNotifyChannelAdmin::SupplierAdmin::_nil ()); - - CORBA::Object_var obj = this->poa_factory_-> - activate_object_with_id (id, - this->SA_POA_.in (), - supplieradmin - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CosNotifyChannelAdmin::SupplierAdmin::_nil ()); - - this->supplier_admin_ids_.next (); - return CosNotifyChannelAdmin::SupplierAdmin::_narrow (obj.in ()); -} - -CosNotifyChannelAdmin::ConsumerAdmin_ptr -TAO_Notify_EventChannel_i::get_consumeradmin (CosNotifyChannelAdmin::AdminID id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - CosNotifyChannelAdmin::AdminNotFound - )) -{ - CORBA::Object_var obj = - this->poa_factory_->id_to_reference (id, this->CA_POA_.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CosNotifyChannelAdmin::ConsumerAdmin::_nil ()); - - return CosNotifyChannelAdmin::ConsumerAdmin::_narrow (obj.in ()); -} - -CosNotifyChannelAdmin::SupplierAdmin_ptr -TAO_Notify_EventChannel_i::get_supplieradmin (CosNotifyChannelAdmin::AdminID id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - CosNotifyChannelAdmin::AdminNotFound - )) -{ - CORBA::Object_var obj = - this->poa_factory_->id_to_reference (id, this->SA_POA_.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CosNotifyChannelAdmin::SupplierAdmin::_nil ()); - - return CosNotifyChannelAdmin::SupplierAdmin::_narrow (obj.in ()); -} - -CosNotifyChannelAdmin::AdminIDSeq* -TAO_Notify_EventChannel_i::get_all_consumeradmins (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException - )) -{ - return this->consumer_admin_ids_.get_sequence (ACE_ENV_SINGLE_ARG_PARAMETER); -} - -CosNotifyChannelAdmin::AdminIDSeq* -TAO_Notify_EventChannel_i::get_all_supplieradmins (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException - )) -{ - ACE_GUARD_THROW_EX (ACE_Lock, ace_mon, *this->lock_, - CORBA::INTERNAL ()); - ACE_CHECK_RETURN (0); - - return this->supplier_admin_ids_.get_sequence (ACE_ENV_SINGLE_ARG_PARAMETER); -} - -CosNotification::QoSProperties* -TAO_Notify_EventChannel_i::get_qos (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException - )) -{ - return this->qos_admin_.get_qos (ACE_ENV_SINGLE_ARG_PARAMETER); -} - -void -TAO_Notify_EventChannel_i::set_qos (const CosNotification::QoSProperties & qos ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - CosNotification::UnsupportedQoS - )) -{ - this->qos_admin_.set_qos (qos ACE_ENV_ARG_PARAMETER); -} - -void -TAO_Notify_EventChannel_i::validate_qos (const CosNotification::QoSProperties & required_qos, CosNotification::NamedPropertyRangeSeq_out available_qos ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - CosNotification::UnsupportedQoS - )) -{ - this->qos_admin_.validate_qos (required_qos, available_qos ACE_ENV_ARG_PARAMETER); -} - -CosNotification::AdminProperties* -TAO_Notify_EventChannel_i::get_admin (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException - )) -{ - // Delegate to Event Manager. - return this->event_manager_->admin_properties ()->get_admin (ACE_ENV_SINGLE_ARG_PARAMETER); -} - -void -TAO_Notify_EventChannel_i::set_admin (const CosNotification::AdminProperties & admin ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - CosNotification::UnsupportedAdmin - )) -{ - this->event_manager_->admin_properties ()->set_admin (admin ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - this->event_manager_->update_task_admins (); -} - -CosEventChannelAdmin::ConsumerAdmin_ptr -TAO_Notify_EventChannel_i::for_consumers (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException - )) -{ - // There is no way to destroy CosEventChannelAdmin::ConsumerAdmin's - // so we just return the default Consumer Admin here. - // TODO: find a way to disable the destroy method in the default Admin. - - CORBA::Object_var obj = - this->get_consumeradmin (this->default_id_ ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CosEventChannelAdmin::ConsumerAdmin::_nil ()); - - return CosEventChannelAdmin::ConsumerAdmin::_narrow (obj.in () - ACE_ENV_ARG_PARAMETER); -} - -CosEventChannelAdmin::SupplierAdmin_ptr -TAO_Notify_EventChannel_i::for_suppliers (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException - )) -{ - CORBA::Object_var obj = - this->get_supplieradmin (this->default_id_ ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CosEventChannelAdmin::SupplierAdmin::_nil ()); - - return CosEventChannelAdmin::SupplierAdmin::_narrow (obj.in () - ACE_ENV_ARG_PARAMETER); -} - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - -template class TAO_Notify_ID_Pool_Ex; -template class TAO_Notify_ID_Pool; - -template class ACE_Unbounded_Set; -template class ACE_Unbounded_Set_Iterator; - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -#pragma instantiate TAO_Notify_ID_Pool_Ex -#pragma instantiate TAO_Notify_ID_Pool - -#pragma instantiate ACE_Unbounded_Set -#pragma instantiate ACE_Unbounded_Set_Iterator - -#endif /*ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannel_i.h b/TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannel_i.h deleted file mode 100644 index 74d7a6601d8..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannel_i.h +++ /dev/null @@ -1,318 +0,0 @@ -//============================================================================= -/** - * @file Notify_EventChannel_i.h - * - * $Id$ - * - * Implements the CosNotifyChannelAdmin::EventChannel interface. - * - * - * @author Pradeep Gore - */ -//============================================================================= - - -#ifndef TAO_NOTIFY_EVENTCHANNEL_I_H_ -#define TAO_NOTIFY_EVENTCHANNEL_I_H_ -#include "ace/pre.h" -#include "ace/Hash_Map_Manager.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/CosNotifyChannelAdminS.h" -#include "Notify_ID_Pool_T.h" -#include "Notify_QoSAdmin_i.h" -#include "Notify_Collection.h" - -class TAO_Notify_EventChannelFactory_i; -class TAO_Notify_Resource_Manager; -class TAO_Notify_Event_Manager; -class TAO_Notify_CO_Factory; -class TAO_Notify_POA_Factory; -class TAO_Notify_EMO_Factory; -class TAO_Notify_EventListener; - -#if defined (_MSC_VER) -#if (_MSC_VER >= 1200) -#pragma warning (push) -#endif /* _MSC_VER >= 1200 */ -#pragma warning (disable:4250) -#endif /* _MSC_VER */ - - /** - * @class TAO_Notify_EventChannel_i - * - * @brief TAO_Notify_EventChannel_i - * - * This class handles all the object factory functionality.All the event - * routing is handled by its contained Event Manager class. - * = MISC. NOTES - * This class creates and owns 2 child POA's. one to contain CA's and the other for SA's. - * Now, a Channel object can be destoyed in 2 ways - as a side effect of its parent POA being - * destroyed or if this class's method is invoked. If the object is being destroyed - * as a result of its Parent POA being destroyed, it is illegal to destroy a childPOA - * because, the root poa destruction will destroy all child poa's. - * So in the destructor we conditionally check if the child POAs should be destroyed explicitly - * or not. - */ -class TAO_Notify_Export TAO_Notify_EventChannel_i : public virtual POA_CosNotifyChannelAdmin::EventChannel, public PortableServer::RefCountServantBase -{ - public: - /// Constructor. - /// is the parent. - TAO_Notify_EventChannel_i (TAO_Notify_EventChannelFactory_i* channel_factory); - - /// Destructor - virtual ~TAO_Notify_EventChannel_i (void); - - /** - * Initialize this object. - * checks if the and are valid. - * creates default filter, consumer admin and supplier admin. - */ - void init (CosNotifyChannelAdmin::ChannelID channel_id, - const CosNotification::QoSProperties& initial_qos, - const CosNotification::AdminProperties& initial_admin, - PortableServer::POA_ptr default_POA, - PortableServer::POA_ptr my_POA - ACE_ENV_ARG_DECL); - - // = Accessors - /// Get the default POA. - PortableServer::POA_ptr get_default_POA (void); - - /// Get the CORBA object for this servant - CosNotifyChannelAdmin::EventChannel_ptr get_ref (ACE_ENV_SINGLE_ARG_DECL); - - /// Get the event manager. - TAO_Notify_Event_Manager* get_event_manager (void); - - // = Child destroyed notification. - /// This id is no longer in use.It can be reused by . - void consumer_admin_destroyed (CosNotifyChannelAdmin::AdminID CA_ID); - - /// This id is no longer in use.It can be reused by . - void supplier_admin_destroyed (CosNotifyChannelAdmin::AdminID SA_ID); - - /// Consumer Admin's are Group Listeners that are registered automatically with the EC when a ConsumerAdmin - /// is created. When a consumer is destroyed, it asks the EC to unregister itself. - void unregister_listener (TAO_Notify_EventListener* group_listener ACE_ENV_ARG_DECL); - - // = Interface methods - virtual CosNotifyChannelAdmin::EventChannelFactory_ptr MyFactory ( - ACE_ENV_SINGLE_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - -virtual CosNotifyChannelAdmin::ConsumerAdmin_ptr default_consumer_admin ( - ACE_ENV_SINGLE_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - -virtual CosNotifyChannelAdmin::SupplierAdmin_ptr default_supplier_admin ( - ACE_ENV_SINGLE_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - -virtual CosNotifyFilter::FilterFactory_ptr default_filter_factory ( - ACE_ENV_SINGLE_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - -virtual CosNotifyChannelAdmin::ConsumerAdmin_ptr new_for_consumers ( - CosNotifyChannelAdmin::InterFilterGroupOperator op, - CosNotifyChannelAdmin::AdminID_out id - ACE_ENV_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - -virtual CosNotifyChannelAdmin::SupplierAdmin_ptr new_for_suppliers ( - CosNotifyChannelAdmin::InterFilterGroupOperator op, - CosNotifyChannelAdmin::AdminID_out id - ACE_ENV_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - -virtual CosNotifyChannelAdmin::ConsumerAdmin_ptr get_consumeradmin ( - CosNotifyChannelAdmin::AdminID id - ACE_ENV_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException, - CosNotifyChannelAdmin::AdminNotFound - )); - -virtual CosNotifyChannelAdmin::SupplierAdmin_ptr get_supplieradmin ( - CosNotifyChannelAdmin::AdminID id - ACE_ENV_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException, - CosNotifyChannelAdmin::AdminNotFound - )); - -virtual CosNotifyChannelAdmin::AdminIDSeq * get_all_consumeradmins ( - ACE_ENV_SINGLE_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - -virtual CosNotifyChannelAdmin::AdminIDSeq * get_all_supplieradmins ( - ACE_ENV_SINGLE_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - -virtual CosNotification::QoSProperties * get_qos ( - ACE_ENV_SINGLE_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - - virtual void set_qos ( - const CosNotification::QoSProperties & qos - ACE_ENV_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException, - CosNotification::UnsupportedQoS - )); - - virtual void validate_qos ( - const CosNotification::QoSProperties & required_qos, - CosNotification::NamedPropertyRangeSeq_out available_qos - ACE_ENV_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException, - CosNotification::UnsupportedQoS - )); - - virtual CosNotification::AdminProperties * get_admin ( - ACE_ENV_SINGLE_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - - virtual void set_admin ( - const CosNotification::AdminProperties & admin - ACE_ENV_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException, - CosNotification::UnsupportedAdmin - )); - - virtual CosEventChannelAdmin::ConsumerAdmin_ptr for_consumers ( - ACE_ENV_SINGLE_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - - virtual CosEventChannelAdmin::SupplierAdmin_ptr for_suppliers ( - ACE_ENV_SINGLE_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - - virtual void destroy ( - ACE_ENV_SINGLE_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - - const TAO_Notify_QoSAdmin_i& qos_admin (void) const; - -protected: - // = Data Members - /// The locking strategy. - ACE_Lock* lock_; - - /** - * Flag to tell our destructor if we should destroy the CA and SA POA's. - * default is false, the parent poa destruction will remove these. - * set to true if the method is invoked. - */ - CORBA::Boolean destory_child_POAs_; - - /// The factory that created us. - TAO_Notify_EventChannelFactory_i* channel_factory_; - - /// The default POA in which we activate objects that don't have ids' pre-assigned. - PortableServer::POA_var default_POA_; - - /// The POA in which i live. - PortableServer::POA_var my_POA_; - - /// The POA in which we should activate ConsumerAdmins in. - /// We create and own this. - PortableServer::POA_var CA_POA_; - - /// The POA in which we should activate SupplierAdmins in. - /// We create and own this. - PortableServer::POA_var SA_POA_; - - /// The ID assigned to this channel. - CosNotifyChannelAdmin::ChannelID channel_id_; - - /// The factory for channel objects. - TAO_Notify_CO_Factory* channel_objects_factory_; - - /// The factory for POA based containers. - TAO_Notify_POA_Factory* poa_factory_; - - /// Event manager objects factory, - TAO_Notify_EMO_Factory* event_manager_objects_factory_; - - /// Id generator for consumer admins. - TAO_Notify_ID_Pool_Ex consumer_admin_ids_; - - /// Id generator for supplier admins. - TAO_Notify_ID_Pool_Ex supplier_admin_ids_; - - /// Default InterFilterGroupOperator operator used when creating - /// the default ConsumerAdmin and SupplierAdmin. - const CosNotifyChannelAdmin::InterFilterGroupOperator default_op_; - - /// Default id's to CosEventChannelAdmin::ConsumerAdmin, SupplierAdmin. - const CosNotifyChannelAdmin::AdminID default_id_; - - /// Handle QoS admin methods. - TAO_Notify_QoSAdmin_i qos_admin_; - - /// The event manager. - TAO_Notify_Event_Manager* event_manager_; - - /// The list of group event listeners that have registered with us. - TAO_Notify_EventListener_List* event_listener_list_; -}; - -#if defined (_MSC_VER) && (_MSC_VER >= 1200) -#pragma warning (pop) -#endif /* _MSC_VER */ - -#include "ace/post.h" -#endif /* TAO_NOTIFY_EVENTCHANNEL_I_H_ */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.cpp deleted file mode 100644 index 95f798bf589..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.cpp +++ /dev/null @@ -1,357 +0,0 @@ -// $Id$ - -#include "Notify_Service.h" -#include "Builder.h" -#include "Properties.h" -#include "Factory.h" - -#include "ace/Sched_Params.h" -#include "ace/Arg_Shifter.h" -#include "ace/Dynamic_Service.h" -#include "tao/ORB_Core.h" -#include "tao/debug.h" - -ACE_RCSID(RT_Notify, TAO_NS_Notify_Service, "$Id$") - -TAO_NS_Notify_Service::TAO_NS_Notify_Service (void) -:factory_ (0), builder_ (0) -{ -} - -TAO_NS_Notify_Service::~TAO_NS_Notify_Service () -{ - delete factory_; - delete builder_; -} - -void -TAO_NS_Notify_Service::_decr_refcnt (void) -{ -} - -int -TAO_NS_Notify_Service::init (int argc, char *argv[]) -{ - ACE_Arg_Shifter arg_shifter (argc, argv); - - const ACE_TCHAR *current_arg = 0; - - // Default to an all reactive system. - int ec_threads = 0; - int dispatching_threads = 0; - int listener_threads = 0; - int source_threads = 0; - int lookup_threads = 0; - - int task_per_proxy = 0; - - while (arg_shifter.is_anything_left ()) - { - if (arg_shifter.cur_arg_strncasecmp (ACE_LIB_TEXT("-MTDispatching")) == 0) - { - // If Dispatching Threads are initalized, the option is implicit. - arg_shifter.consume_arg (); - } - else if ((current_arg = arg_shifter.get_the_parameter (ACE_LIB_TEXT("-DispatchingThreads")))) - { - dispatching_threads = ACE_OS::atoi (current_arg); - arg_shifter.consume_arg (); - } - else if (arg_shifter.cur_arg_strncasecmp (ACE_LIB_TEXT("-MTSourceEval")) == 0) - { - // If Source Threads are initalized, the option is implicit. - arg_shifter.consume_arg (); - } - else if ((current_arg = arg_shifter.get_the_parameter (ACE_LIB_TEXT("-SourceThreads")))) - { - source_threads = ACE_OS::atoi (current_arg); - arg_shifter.consume_arg (); - } - else if (arg_shifter.cur_arg_strncasecmp (ACE_LIB_TEXT("-MTLookup")) == 0) - { - // If Source Threads are initalized, the option is implicit. - arg_shifter.consume_arg (); - } - else if ((current_arg = arg_shifter.get_the_parameter (ACE_LIB_TEXT("-LookupThreads")))) - { - lookup_threads = ACE_OS::atoi (current_arg); - arg_shifter.consume_arg (); - } - else if (arg_shifter.cur_arg_strncasecmp (ACE_LIB_TEXT("-MTListenerEval")) == 0) - { - // If Source Threads are initalized, the option is implicit. - arg_shifter.consume_arg (); - } - else if ((current_arg = arg_shifter.get_the_parameter (ACE_LIB_TEXT("-ListenerThreads")))) - { - listener_threads = ACE_OS::atoi (current_arg); - arg_shifter.consume_arg (); - } - else if (arg_shifter.cur_arg_strncasecmp (ACE_LIB_TEXT("-AsynchUpdates")) == 0) - { - arg_shifter.consume_arg (); - - TAO_NS_PROPERTIES::instance()->asynch_updates (1); - } - else if (arg_shifter.cur_arg_strncasecmp (ACE_LIB_TEXT("-AllocateTaskperProxy")) == 0) - { - task_per_proxy = 1; - arg_shifter.consume_arg (); - } - } - - this->set_event_channel_threads (ec_threads); - - if (task_per_proxy == 0) - { - this->set_consumer_admin_threads (dispatching_threads + listener_threads); - this->set_supplier_admin_threads (lookup_threads + source_threads); - } - else - { - this->set_proxy_supplier_threads (dispatching_threads + listener_threads); - this->set_proxy_consumer_threads (source_threads); // lookup thread per proxy doesn't make sense. - } - - return 0; -} - -void -TAO_NS_Notify_Service::set_event_channel_threads (int threads) -{ - NotifyExt::ThreadPoolParams tp_params = - {0, (unsigned)threads, 0, 0, 0, 0, 0 }; - CosNotification::QoSProperties qos; - - qos.length (1); - qos[0].name = CORBA::string_dup (NotifyExt::ThreadPool); - qos[0].value <<= tp_params; - - TAO_NS_PROPERTIES::instance()->default_event_channel_qos_properties (qos); -} - -void -TAO_NS_Notify_Service::set_consumer_admin_threads (int threads) -{ - NotifyExt::ThreadPoolParams tp_params = - {0, (unsigned)threads, 0, 0, 0, 0, 0 }; - CosNotification::QoSProperties qos; - - qos.length (1); - qos[0].name = CORBA::string_dup (NotifyExt::ThreadPool); - qos[0].value <<= tp_params; - - TAO_NS_PROPERTIES::instance()->default_consumer_admin_qos_properties (qos); -} - -void -TAO_NS_Notify_Service::set_supplier_admin_threads (int threads) -{ - NotifyExt::ThreadPoolParams tp_params = - {0, (unsigned)threads, 0, 0, 0, 0, 0 }; - CosNotification::QoSProperties qos; - - qos.length (1); - qos[0].name = CORBA::string_dup (NotifyExt::ThreadPool); - qos[0].value <<= tp_params; - - TAO_NS_PROPERTIES::instance()->default_supplier_admin_qos_properties (qos); -} - -void -TAO_NS_Notify_Service::set_proxy_consumer_threads (int threads) -{ - NotifyExt::ThreadPoolParams tp_params = - {0, (unsigned)threads, 0, 0, 0, 0, 0 }; - CosNotification::QoSProperties qos; - - qos.length (1); - qos[0].name = CORBA::string_dup (NotifyExt::ThreadPool); - qos[0].value <<= tp_params; - - TAO_NS_PROPERTIES::instance()->default_proxy_consumer_qos_properties (qos); -} - -void -TAO_NS_Notify_Service::set_proxy_supplier_threads (int threads) -{ - NotifyExt::ThreadPoolParams tp_params = - {0, (unsigned)threads, 0, 0, 0, 0, 0 }; - CosNotification::QoSProperties qos; - - qos.length (1); - qos[0].name = CORBA::string_dup (NotifyExt::ThreadPool); - qos[0].value <<= tp_params; - - TAO_NS_PROPERTIES::instance()->default_proxy_supplier_qos_properties (qos); -} - -int -TAO_NS_Notify_Service::fini (void) -{ - return 0; -} - -void -TAO_NS_Notify_Service::init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL) -{ - ACE_DEBUG ((LM_DEBUG, "Loading the Cos Notification Service...\n")); - - this->init_i (orb ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -void -TAO_NS_Notify_Service::init_i (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL) -{ - /// first, init the main thread. - //this->init_main_thread (orb ACE_ENV_ARG_PARAMETER); - //ACE_CHECK; - - // Obtain the Root POA - CORBA::Object_var object = - orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - if (CORBA::is_nil (object.in ())) - ACE_ERROR ((LM_ERROR, - " (%P|%t) Unable to resolve the RootPOA.\n")); - - PortableServer::POA_var default_poa = PortableServer::POA::_narrow (object.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - /// Set the properties - TAO_NS_Properties* properties = TAO_NS_PROPERTIES::instance(); - - properties->orb (orb); - properties->default_poa (default_poa.in ()); - properties->sched_policy (orb->orb_core ()->orb_params ()->sched_policy ()); - properties->scope_policy (orb->orb_core ()->orb_params ()->scope_policy ()); - - // Init the factory and builder - - this->init_factory (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - this->init_builder (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; -} - -void -TAO_NS_Notify_Service::init_main_thread (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL_NOT_USED) -{ - ACE_Sched_Params::Policy sched_policy; - long thr_sched_policy = orb->orb_core ()->orb_params ()->sched_policy (); - - //long thr_scope_policy = orb->orb_core ()->orb_params ()->scope_policy (); - - if (thr_sched_policy == THR_SCHED_FIFO) - { - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, "Sched policy = THR_SCHED_FIFO\n")); - - sched_policy = ACE_SCHED_FIFO; - } - else if (thr_sched_policy == THR_SCHED_RR) - { - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, "Sched policy = THR_SCHED_RR\n")); - - sched_policy = ACE_SCHED_RR; - } - else - { - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, "Sched policy = THR_SCHED_OTHER\n")); - - sched_policy = ACE_SCHED_OTHER; - } - - /// Check sched. - int min_priority = ACE_Sched_Params::priority_min (sched_policy); - int max_priority = ACE_Sched_Params::priority_max (sched_policy); - - if (TAO_debug_level > 0) - { - ACE_DEBUG ((LM_DEBUG, "max_priority = %d, min_priority = %d\n", - max_priority, min_priority)); - - if (max_priority == min_priority) - { - ACE_DEBUG ((LM_DEBUG,"Detected max_priority == min_priority\n")); - } - } - - // Set the main thread to min priority... - int priority = min_priority; - - if (ACE_OS::sched_params (ACE_Sched_Params (sched_policy , - priority, - ACE_SCOPE_PROCESS)) != 0) - { - if (ACE_OS::last_error () == EPERM) - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t): user is not superuser, " - "test runs in time-shared class\n")); - } - else - ACE_ERROR ((LM_ERROR, - "(%P|%t): sched_params failed\n")); - } -} - -void -TAO_NS_Notify_Service::init_factory (ACE_ENV_SINGLE_ARG_DECL) -{ - ACE_NEW_THROW_EX (this->factory_, - TAO_NS_Factory (), - CORBA::NO_MEMORY ()); - ACE_CHECK; - - TAO_NS_PROPERTIES::instance()->factory (this->factory_); -} - -void -TAO_NS_Notify_Service::init_builder (ACE_ENV_SINGLE_ARG_DECL) -{ - ACE_NEW_THROW_EX (this->builder_, - TAO_NS_Builder (), - CORBA::NO_MEMORY ()); - ACE_CHECK; - - TAO_NS_PROPERTIES::instance()->builder (this->builder_); -} - -CosNotifyChannelAdmin::EventChannelFactory_ptr -TAO_NS_Notify_Service::create (PortableServer::POA_ptr poa ACE_ENV_ARG_DECL) -{ - return this->builder_->build_event_channel_factory (poa ACE_ENV_ARG_PARAMETER); -} - -void -TAO_NS_Notify_Service::remove (TAO_NS_EventChannelFactory* /*ecf*/ ACE_ENV_ARG_DECL_NOT_USED) -{ - // NOP. -} - -/*********************************************************************************************************************/ - -ACE_STATIC_SVC_DEFINE (TAO_Notify_Default_EMO_Factory_OLD, - ACE_TEXT (TAO_NOTIFY_DEF_EMO_FACTORY_NAME), - ACE_SVC_OBJ_T, - &ACE_SVC_NAME (TAO_NS_Notify_Service), - ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, - 0) - -/*********************************************************************************************************************/ - -ACE_STATIC_SVC_DEFINE (TAO_NS_Notify_Service, - ACE_TEXT (TAO_NS_COS_NOTIFICATION_SERVICE_NAME), - ACE_SVC_OBJ_T, - &ACE_SVC_NAME (TAO_NS_Notify_Service), - ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, - 0) -ACE_FACTORY_DEFINE (TAO_Notify, TAO_NS_Notify_Service) - -/*********************************************************************************************************************/ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.h b/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.h deleted file mode 100644 index ca29c811bb5..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.h +++ /dev/null @@ -1,104 +0,0 @@ -/* -*- C++ -*- */ -/** - * @file Notify_Service.h - * - * $Id$ - * - * @author Pradeep Gore - * - * - */ - -#ifndef TAO_NS_COSNOTIFY_SERVICE_H -#define TAO_NS_COSNOTIFY_SERVICE_H -#include "ace/pre.h" - -#include "notify_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "Service.h" - -class TAO_NS_Factory; -class TAO_NS_Builder; -class TAO_NS_Properties; -class TAO_NS_EventChannelFactory; - -/** - * @class TAO_NS_Notify_Service - * - * @brief A service object for creating the Notify Service Factory. - * - */ -class TAO_Notify_Export TAO_NS_Notify_Service : public TAO_NS_Service -{ -public: - /// Constuctor - TAO_NS_Notify_Service (void); - - /// Destructor - virtual ~TAO_NS_Notify_Service (); - - /// = Service_Object virtual method overloads. - virtual int init (int argc, char *argv[]); - virtual int fini (void); - - void _decr_refcnt (void); - - /// Init - virtual void init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL); - - /// Create the Channel Factory. - virtual CosNotifyChannelAdmin::EventChannelFactory_ptr create (PortableServer::POA_ptr default_POA ACE_ENV_ARG_DECL); - - /// Called by the factory when it is destroyed. - virtual void remove (TAO_NS_EventChannelFactory* ecf ACE_ENV_ARG_DECL); - -protected: - /// Init the data members - virtual void init_i (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL); - - /// Create the Factory for RT Notify objects. - virtual void init_factory (ACE_ENV_SINGLE_ARG_DECL); - - /// Creates the Builder for RT Notify objects. - virtual void init_builder (ACE_ENV_SINGLE_ARG_DECL); - - /// Apply ORB Scheduling policy to main thread and set its priority to the lowest available. - void init_main_thread (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL); - - /// Set event channel thread options. - void set_event_channel_threads (int threads); - - /// Set consumer admin thread options. - void set_consumer_admin_threads (int threads); - - /// Set supplier admin thread options. - void set_supplier_admin_threads (int threads); - - /// Set proxy supplier thread options. - void set_proxy_supplier_threads (int threads); - - // Set proxy consumer threads options. - void set_proxy_consumer_threads (int threads); - - /// Service component for object factory operations. - TAO_NS_Factory* factory_; - - /// Service component for building NS participants. - TAO_NS_Builder* builder_; -}; - -ACE_STATIC_SVC_DECLARE (TAO_NS_Notify_Service) -ACE_FACTORY_DECLARE (TAO_Notify, TAO_NS_Notify_Service) - -ACE_STATIC_SVC_DECLARE (TAO_Notify_Default_EMO_Factory_OLD) - -#if defined (__ACE_INLINE__) -#include "Notify_Service.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/post.h" -#endif /* TAO_NS_COSNOTIFY_SERVICE_H */ -- cgit v1.2.1