diff options
author | pradeep <pradeep@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-09-02 18:44:19 +0000 |
---|---|---|
committer | pradeep <pradeep@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-09-02 18:44:19 +0000 |
commit | b5bf0f371cd6d09d24ba4d77af180f57abe05f95 (patch) | |
tree | c497abc9377982ebfd070160163e163b60196b3f | |
parent | 6840d6beaef45bacc662aa0ccdcc210973b032da (diff) | |
download | ATCD-b5bf0f371cd6d09d24ba4d77af180f57abe05f95.tar.gz |
ChangeLog
172 files changed, 9703 insertions, 56 deletions
diff --git a/TAO/orbsvcs/Notify_Service/Notify_Server.cpp b/TAO/orbsvcs/Notify_Service/Notify_Server.cpp index 309c17a733e..53d761344a8 100644 --- a/TAO/orbsvcs/Notify_Service/Notify_Server.cpp +++ b/TAO/orbsvcs/Notify_Service/Notify_Server.cpp @@ -1,43 +1,44 @@ // $Id$ #include "Notify_Service.h" -#include "orbsvcs/Notify/Notify_EventChannelFactory_i.h" -#include "orbsvcs/Notify/Notify_Default_CO_Factory.h" -#include "orbsvcs/Notify/Notify_Default_POA_Factory.h" -#include "orbsvcs/Notify/Notify_Default_Collection_Factory.h" -#include "orbsvcs/Notify/Notify_Default_EMO_Factory.h" + +TAO_Notify_Service notify_service; + +extern "C" void handler (int signum) +{ + // check of sigint + if (signum == SIGINT) + { + ACE_DECLARE_NEW_CORBA_ENV; + notify_service.shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); + } +} // Driver function for the TAO Notify Service. int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { - // Init factories. - TAO_Notify_Default_CO_Factory::init_svc (); - TAO_Notify_Default_POA_Factory::init_svc (); - TAO_Notify_Default_Collection_Factory::init_svc (); - TAO_Notify_Default_EMO_Factory::init_svc (); + ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT); - TAO_Notify_Service notify_service; + // Init factories. ACE_DECLARE_NEW_CORBA_ENV; if (notify_service.init (argc, argv ACE_ENV_ARG_PARAMETER) == -1) ACE_ERROR_RETURN ((LM_ERROR, - ACE_LIB_TEXT("Failed to start the Notification Service.\n")), + ACE_LIB_TEXT("Failed to initialize the Notification Service.\n")), 1); ACE_TRY { - notify_service.run (); - notify_service.shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + notify_service.run (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; } ACE_CATCHANY { - notify_service.shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - ACE_LIB_TEXT("Failed to start the Notification Service\n")); + ACE_LIB_TEXT("Failed to run the Notification Service\n")); return 1; } ACE_ENDTRY; diff --git a/TAO/orbsvcs/Notify_Service/Notify_Service.cpp b/TAO/orbsvcs/Notify_Service/Notify_Service.cpp index ffa2953f1fa..93fdceb3edb 100644 --- a/TAO/orbsvcs/Notify_Service/Notify_Service.cpp +++ b/TAO/orbsvcs/Notify_Service/Notify_Service.cpp @@ -2,18 +2,18 @@ #include "Notify_Service.h" #include "tao/debug.h" -#include "orbsvcs/Notify/Notify_EventChannelFactory_i.h" -#include "orbsvcs/Notify/Notify_Default_CO_Factory.h" -#include "orbsvcs/Notify/Notify_Default_POA_Factory.h" -#include "orbsvcs/Notify/Notify_Default_Collection_Factory.h" -#include "orbsvcs/Notify/Notify_Default_EMO_Factory.h" #include "tao/IORTable/IORTable.h" #include "ace/Arg_Shifter.h" #include "ace/Get_Opt.h" +#include "ace/Sched_Params.h" +#include "ace/Synch.h" #include "ace/Argv_Type_Converter.h" +#include "tao/ORB_Core.h" +#include "ace/Dynamic_Service.h" TAO_Notify_Service::TAO_Notify_Service (void) - : bootstrap_ (0), + : notify_service_ (0), + bootstrap_ (0), use_name_svc_ (1), ior_output_file_ (0), notify_factory_name_ (NOTIFY_KEY), @@ -43,25 +43,96 @@ TAO_Notify_Service::init_ORB (int& argc, ACE_TCHAR *argv [] ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (-1); - CORBA::Object_var poa_obj = + this->notify_service_ = ACE_Dynamic_Service<TAO_NS_Service>::instance ("TAO_NS_Service"); + + if (this->notify_service_ == 0) + { + ACE_DEBUG ((LM_DEBUG, "Service not found! check conf. file\n")); + return -1; + } + + 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; + } + + // == sched stuff + /// 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_RETURN ((LM_ERROR, + "(%P|%t): sched_params failed\n"),-1); + } + + // == sched stuff + + CORBA::Object_var object = this->orb_->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (-1); - if (CORBA::is_nil (poa_obj.in ())) + if (CORBA::is_nil (object.in ())) ACE_ERROR_RETURN ((LM_ERROR, " (%P|%t) Unable to resolve the RootPOA.\n"), -1); this->poa_ = - PortableServer::POA::_narrow (poa_obj.in () - ACE_ENV_ARG_PARAMETER); + PortableServer::POA::_narrow (object.in () + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (-1); PortableServer::POAManager_var poa_manager = this->poa_->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (-1); - + poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (-1); @@ -77,6 +148,7 @@ TAO_Notify_Service::init (int argc, ACE_TCHAR *argv[] ACE_ENV_ARG_PARAMETER) != 0) return -1; + this->notify_service_->init (this->orb_.in () ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (-1); if (this->parse_args(argc, argv) != 0) @@ -108,8 +180,8 @@ TAO_Notify_Service::init (int argc, ACE_TCHAR *argv[] // Activate the factory this->notify_factory_ = - TAO_Notify_EventChannelFactory_i::create (this->poa_.in () - ACE_ENV_ARG_PARAMETER); + notify_service_->create (this->poa_.in () + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (-1); ACE_ASSERT (!CORBA::is_nil (this->notify_factory_.in ())); @@ -269,7 +341,7 @@ TAO_Notify_Service::resolve_naming_service (ACE_ENV_SINGLE_ARG_DECL) } int -TAO_Notify_Service::run () +TAO_Notify_Service::run (ACE_ENV_SINGLE_ARG_DECL) { if (TAO_debug_level > 0 ) ACE_DEBUG ((LM_DEBUG, "%s: Running the Notification Service\n", @@ -281,18 +353,9 @@ TAO_Notify_Service::run () return 0; } - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - this->orb_->run (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "run"), -1); - } - ACE_ENDTRY; - + this->orb_->run (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + return 0; } @@ -300,16 +363,6 @@ void TAO_Notify_Service::shutdown (ACE_ENV_SINGLE_ARG_DECL) { // Deactivate. - PortableServer::ObjectId_var oid = - this->poa_->reference_to_id (this->notify_factory_.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - // deactivate from the poa. - this->poa_->deactivate_object (oid.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - if (this->use_name_svc_) { // Unbind from the naming service. @@ -339,6 +392,12 @@ TAO_Notify_Service::shutdown (ACE_ENV_SINGLE_ARG_DECL) // shutdown the ORB. if (!CORBA::is_nil (this->orb_.in ())) this->orb_->shutdown (); + + /// Release all the _vars as the ORB is gone now. + notify_factory_._retn (); + orb_._retn (); + poa_._retn (); + naming_._retn (); } int @@ -447,6 +506,7 @@ Worker::svc (void) { this->orb_->run (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; + } ACE_CATCHANY { diff --git a/TAO/orbsvcs/Notify_Service/Notify_Service.h b/TAO/orbsvcs/Notify_Service/Notify_Service.h index eee09fdc3f9..df529d9d58a 100644 --- a/TAO/orbsvcs/Notify_Service/Notify_Service.h +++ b/TAO/orbsvcs/Notify_Service/Notify_Service.h @@ -1,6 +1,5 @@ /* -*- C++ -*- */ // $Id$ - // ============================================================================ // // = FILENAME @@ -18,10 +17,11 @@ #ifndef NOTIFY_SERVICE_H #define NOTIFY_SERVICE_H +#include "ace/Task.h" #include "tao/PortableServer/PortableServer.h" #include "orbsvcs/CosNotifyChannelAdminC.h" #include "orbsvcs/CosNamingC.h" -#include "ace/Task.h" +#include "../orbsvcs/Notify/Service.h" #define NOTIFY_KEY "NotifyEventChannelFactory" #define NOTIFY_CHANNEL_NAME "NotifyEventChannel" @@ -69,7 +69,7 @@ class TAO_Notify_Service // Initializes the Service. // Returns 0 on success, -1 on error. - int run (void); + int run (ACE_ENV_SINGLE_ARG_DECL); // run the Service. // Returns 0 on success, -1 on error. @@ -77,6 +77,7 @@ class TAO_Notify_Service // Shutdown the Service. // Returns 0 on success, -1 on error. + // CosNotifyChannelAdmin::EventChannelFactory_var obj; // protected: @@ -84,6 +85,8 @@ protected: ACE_ENV_ARG_DECL); // initialize the ORB. + TAO_NS_Service* notify_service_; + int resolve_naming_service (ACE_ENV_SINGLE_ARG_DECL); // Resolve the naming service. diff --git a/TAO/orbsvcs/orbsvcs/Notify/Admin.cpp b/TAO/orbsvcs/orbsvcs/Notify/Admin.cpp new file mode 100644 index 00000000000..312841ff9ed --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Admin.cpp @@ -0,0 +1,21 @@ +// $Id$ + +#include "Admin.h" +#include "EventChannel.h" +#include "Proxy.h" +#include "orbsvcs/ESF/ESF_Proxy_Collection.h" + +#if ! defined (__ACE_INLINE__) +#include "Admin.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_Admin, "$Id$") + +TAO_NS_Admin::TAO_NS_Admin (void) +{ +} + +TAO_NS_Admin::~TAO_NS_Admin () +{ +} + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Admin.h b/TAO/orbsvcs/orbsvcs/Notify/Admin.h new file mode 100644 index 00000000000..a168871fee8 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Admin.h @@ -0,0 +1,56 @@ +/* -*- C++ -*- */ +/** + * @file Admin.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_ADMIN_H +#define TAO_NS_ADMIN_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + + +#include "Container_T.h" +//#include "Proxy.h" + +class TAO_NS_Proxy; +class TAO_NS_EventChannel; + +/** + * @class TAO_NS_Admin + * + * @brief Base class for Admin interface implementations. + * + */ +class TAO_Notify_Export TAO_NS_Admin : public TAO_NS_Container_T <TAO_NS_Proxy, TAO_NS_Admin, TAO_NS_EventChannel> +{ +public: + /// Constuctor + TAO_NS_Admin (void); + + /// Destructor + ~TAO_NS_Admin (); + +protected: + typedef TAO_NS_Container_T <TAO_NS_Proxy, TAO_NS_Admin, TAO_NS_EventChannel> inherited; + + /// = Data Members + +}; + +#if defined (__ACE_INLINE__) +#include "Admin.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_ADMIN_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Admin.inl b/TAO/orbsvcs/orbsvcs/Notify/Admin.inl new file mode 100644 index 00000000000..dae2727000d --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Admin.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "Admin.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Builder.cpp b/TAO/orbsvcs/orbsvcs/Notify/Builder.cpp new file mode 100644 index 00000000000..6a3925a3f93 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Builder.cpp @@ -0,0 +1,342 @@ +// $Id$ +#include "Builder.h" + +#if ! defined (__ACE_INLINE__) +#include "Builder.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_Builder, "$Id$") + +#include "ace/Auto_Ptr.h" +#include "tao/PortableServer/PortableServerC.h" +#include "Factory.h" +#include "Properties.h" +#include "POA_Helper.h" +#include "ID_Factory.h" +#include "EventChannelFactory.h" +#include "EventChannel.h" +#include "SupplierAdmin.h" +#include "ConsumerAdmin.h" +#include "Structured/StructuredProxyPushConsumer.h" +#include "Structured/StructuredProxyPushSupplier.h" +#include "Event_Manager.h" +#include "Worker_Task.h" +#include "Reactive_Task.h" +#include "ThreadPool_Task.h" + +CosNotifyChannelAdmin::EventChannelFactory_ptr +TAO_NS_Builder::build_event_channel_factory (PortableServer::POA_ptr poa ACE_ENV_ARG_DECL) +{ + CosNotifyChannelAdmin::EventChannelFactory_var ecf_ret; + + TAO_NS_Factory* factory = TAO_NS_PROPERTIES::instance ()->factory (); + + TAO_NS_POA_Helper* object_poa = 0; + // Bootstrap initial Object POA + ACE_NEW_THROW_EX (object_poa, + TAO_NS_POA_Helper (), + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (ecf_ret._retn ()); + + auto_ptr<TAO_NS_POA_Helper> auto_object_poa (object_poa); + + object_poa->init (poa ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (ecf_ret._retn ()); + + // Create ECF + TAO_NS_EventChannelFactory* ecf = 0; + factory->create (ecf ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (ecf_ret._retn ()); + + ecf->destroy_callback (ecf); + + PortableServer::ServantBase_var servant_var (ecf); + + ecf->init (object_poa, 0, object_poa, object_poa ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (ecf_ret._retn ()); + + ecf->init_collection (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (ecf_ret._retn ()); + + // Give ownership of object_poa + ecf->object_poa (object_poa); + + CORBA::Object_var obj = ecf->activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (ecf_ret._retn ()); + + // release auto_ref. + auto_object_poa.release (); + + ecf_ret = CosNotifyChannelAdmin::EventChannelFactory::_narrow (obj.in() ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (ecf_ret._retn ()); + + return (ecf_ret._retn ()); +} + +CosNotifyChannelAdmin::EventChannel_ptr +TAO_NS_Builder::build_event_channel (TAO_NS_EventChannelFactory* ecf, const CosNotification::QoSProperties & initial_qos, const CosNotification::AdminProperties & initial_admin, CosNotifyChannelAdmin::ChannelID_out id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + , CosNotification::UnsupportedAdmin + )) +{ + CosNotifyChannelAdmin::EventChannel_var ec_ret; + + TAO_NS_Factory* factory = TAO_NS_PROPERTIES::instance ()->factory (); + + TAO_NS_EventChannel* ec = 0; + factory->create (ec ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (ec_ret._retn ()); + + ec->destroy_callback (ec); + + PortableServer::ServantBase_var servant_var (ec); + + // set the parent - + ec->parent_ = ecf; + + ec->init (ecf->object_poa(), 0, ecf->object_poa(), ecf->object_poa() ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (ec_ret._retn ()); + + // Create the default worker task. + TAO_NS_Reactive_Task* worker_task = new TAO_NS_Reactive_Task (); + ec->worker_task_own (worker_task); + + // proxy poa is set next. + ec->init_collection (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (ec_ret._retn ()); + + // insert ec in ecf container. + ecf->insert (ec ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (ec_ret._retn ()); + + // create the event manager. @@ use factory + ACE_NEW_THROW_EX (ec->event_manager_, + TAO_NS_Event_Manager (), + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (ec_ret._retn ()); + + ec->event_manager_->init (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (ec_ret._retn ()); + + ec->set_qos (initial_qos ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (ec_ret._retn ()); + + ec->set_admin (initial_admin ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (ec_ret._retn ()); + + CORBA::Object_var obj = ec->activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (ec_ret._retn ()); + + id = ec->id (); + + ec_ret = CosNotifyChannelAdmin::EventChannel::_narrow (obj.in() ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (ec_ret._retn ()); + + return ec_ret._retn (); +} + +CosNotifyChannelAdmin::ConsumerAdmin_ptr +TAO_NS_Builder::build_consumer_admin (TAO_NS_EventChannel* ec, CosNotifyChannelAdmin::InterFilterGroupOperator op, CosNotifyChannelAdmin::AdminID_out id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + CosNotifyChannelAdmin::ConsumerAdmin_var ca_ret; + + TAO_NS_Factory* factory = TAO_NS_PROPERTIES::instance ()->factory (); + + TAO_NS_ConsumerAdmin* ca = 0; + factory->create (ca ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (ca_ret._retn ()); + + ca->destroy_callback (ca); + + ca->parent_ = ec; + ca->event_manager_ = ec->event_manager_; + + PortableServer::ServantBase_var servant_var (ca); + + ca->init (ec->object_poa (), ec->worker_task (), ec->object_poa (), ec->proxy_poa () ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (ca_ret._retn ()); + + ca->init_collection (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (ca_ret._retn ()); + + // insert admin in ec container. + ec->insert (ca ACE_ENV_ARG_PARAMETER); + + CORBA::Object_var obj = ca->activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (ca_ret._retn ()); + + id = ca->id (); + + ca_ret = CosNotifyChannelAdmin::ConsumerAdmin::_narrow (obj.in() ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (ca_ret._retn ()); + + return ca_ret._retn (); +} + +CosNotifyChannelAdmin::SupplierAdmin_ptr +TAO_NS_Builder::build_supplier_admin (TAO_NS_EventChannel* ec, CosNotifyChannelAdmin::InterFilterGroupOperator op, CosNotifyChannelAdmin::AdminID_out id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + CosNotifyChannelAdmin::SupplierAdmin_var sa_ret; + + TAO_NS_Factory* factory = TAO_NS_PROPERTIES::instance ()->factory (); + + TAO_NS_SupplierAdmin* sa = 0; + factory->create (sa ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (sa_ret._retn ()); + + sa->destroy_callback (sa); + + sa->parent_ = ec; + sa->event_manager_ = ec->event_manager_; + + PortableServer::ServantBase_var servant_var (sa); + + sa->init (ec->object_poa (), ec->worker_task (), ec->object_poa (), ec->proxy_poa () ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (sa_ret._retn ()); + + sa->init_collection (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (sa_ret._retn ()); + + // insert admin in ec container. + ec->insert (sa ACE_ENV_ARG_PARAMETER); + + CORBA::Object_var obj = sa->activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (sa_ret._retn ()); + + id = sa->id (); + + sa_ret = CosNotifyChannelAdmin::SupplierAdmin::_narrow (obj.in() ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (sa_ret._retn ()); + + return sa_ret._retn (); +} + +CosNotifyChannelAdmin::ProxyConsumer_ptr +TAO_NS_Builder::build_notification_push_consumer (TAO_NS_SupplierAdmin* sa, CosNotifyChannelAdmin::ClientType ctype, CosNotifyChannelAdmin::ProxyID_out proxy_id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::AdminLimitExceeded + )) + +{ + CosNotifyChannelAdmin::ProxyConsumer_var proxy_ret; + + TAO_NS_Factory* factory = TAO_NS_PROPERTIES::instance ()->factory (); + + switch (ctype) + { + case CosNotifyChannelAdmin::ANY_EVENT: + { + + } + break; + + case CosNotifyChannelAdmin::STRUCTURED_EVENT: + { + TAO_NS_StructuredProxyPushConsumer* pc = 0; + factory->create (pc ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (proxy_ret._retn ()); + + pc->destroy_callback (pc); + + PortableServer::ServantBase_var servantbase_var (pc); + + pc->event_manager_ = sa->event_manager_; + pc->parent_ = sa; + + pc->init (sa->proxy_poa (), sa->worker_task () ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (proxy_ret._retn ()); + + // insert proxy in admin container. + sa->insert (pc ACE_ENV_ARG_PARAMETER); + + CORBA::Object_var obj = pc->activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (proxy_ret._retn ()); + + proxy_id = pc->id (); + + proxy_ret = CosNotifyChannelAdmin::ProxyConsumer::_narrow (obj.in() ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (proxy_ret._retn ()); + } + + case CosNotifyChannelAdmin::SEQUENCE_EVENT: + { + } + break; + + default: + ACE_THROW_RETURN (CORBA::BAD_PARAM (), + CosNotifyChannelAdmin::ProxyConsumer::_nil ()); + } + + return proxy_ret._retn (); +} + + +CosNotifyChannelAdmin::ProxySupplier_ptr +TAO_NS_Builder::build_notification_push_supplier (TAO_NS_ConsumerAdmin* ca, CosNotifyChannelAdmin::ClientType ctype, CosNotifyChannelAdmin::ProxyID_out proxy_id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::AdminLimitExceeded + )) +{ + CosNotifyChannelAdmin::ProxySupplier_var proxy_ret; + + TAO_NS_Factory* factory = TAO_NS_PROPERTIES::instance ()->factory (); + + switch (ctype) + { + case CosNotifyChannelAdmin::ANY_EVENT: + { + + } + break; + + case CosNotifyChannelAdmin::STRUCTURED_EVENT: + { + TAO_NS_StructuredProxyPushSupplier* ps = 0; + factory->create (ps ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (proxy_ret._retn ()); + + PortableServer::ServantBase_var servant (ps->servant ()); + + ps->event_manager_ = ca->event_manager_; + ps->parent_ = ca; + + ps->init (ca->proxy_poa (), ca->worker_task () ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (proxy_ret._retn ()); + + // insert proxy in admin container. + ca->insert (ps ACE_ENV_ARG_PARAMETER); + + CORBA::Object_var obj = ps->activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (proxy_ret._retn ()); + + proxy_id = ps->id (); + + ps->init_ps (ACE_ENV_SINGLE_ARG_PARAMETER); + + proxy_ret = CosNotifyChannelAdmin::ProxySupplier::_narrow (obj.in() ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (proxy_ret._retn ()); + } + + case CosNotifyChannelAdmin::SEQUENCE_EVENT: + { + } + break; + + default: + ACE_THROW_RETURN (CORBA::BAD_PARAM (), + CosNotifyChannelAdmin::ProxySupplier::_nil ()); + } + + return proxy_ret._retn (); +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/Builder.h b/TAO/orbsvcs/orbsvcs/Notify/Builder.h new file mode 100644 index 00000000000..a046f401c8a --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Builder.h @@ -0,0 +1,76 @@ +/* -*- C++ -*- */ +/** + * @file Builder.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_BUILDER_H +#define TAO_NS_BUILDER_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "orbsvcs/CosNotifyChannelAdminC.h" +#include "tao/PortableServer/PortableServer.h" + +class TAO_NS_EventChannelFactory; +class TAO_NS_EventChannel; +class TAO_NS_SupplierAdmin; +class TAO_NS_ConsumerAdmin; + +/** + * @class TAO_NS_Builder + * + * @brief Helper class to create and activate CORBA objects. + * + */ +class TAO_Notify_Export TAO_NS_Builder +{ +public: + CosNotifyChannelAdmin::EventChannelFactory_ptr build_event_channel_factory (PortableServer::POA_ptr poa ACE_ENV_ARG_DECL); + + CosNotifyChannelAdmin::EventChannel_ptr build_event_channel (TAO_NS_EventChannelFactory* ecf, const CosNotification::QoSProperties & initial_qos, const CosNotification::AdminProperties & initial_admin, CosNotifyChannelAdmin::ChannelID_out id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + , CosNotification::UnsupportedAdmin + )); + + CosNotifyChannelAdmin::ConsumerAdmin_ptr build_consumer_admin (TAO_NS_EventChannel* ec, CosNotifyChannelAdmin::InterFilterGroupOperator op, CosNotifyChannelAdmin::AdminID_out id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + CosNotifyChannelAdmin::SupplierAdmin_ptr build_supplier_admin (TAO_NS_EventChannel* ec, CosNotifyChannelAdmin::InterFilterGroupOperator op, CosNotifyChannelAdmin::AdminID_out id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + CosNotifyChannelAdmin::ProxyConsumer_ptr build_notification_push_consumer (TAO_NS_SupplierAdmin* sa, CosNotifyChannelAdmin::ClientType ctype, CosNotifyChannelAdmin::ProxyID_out proxy_id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::AdminLimitExceeded + )); + + CosNotifyChannelAdmin::ProxySupplier_ptr build_notification_push_supplier (TAO_NS_ConsumerAdmin* ca, CosNotifyChannelAdmin::ClientType ctype, CosNotifyChannelAdmin::ProxyID_out proxy_id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::AdminLimitExceeded + )); +}; + +#if defined (__ACE_INLINE__) +#include "Builder.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_BUILDER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Builder.inl b/TAO/orbsvcs/orbsvcs/Notify/Builder.inl new file mode 100644 index 00000000000..34b13542be9 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Builder.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "Builder.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Consumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Consumer.cpp new file mode 100644 index 00000000000..523d9e4ca4a --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Consumer.cpp @@ -0,0 +1,17 @@ +// $Id$ + +#include "Consumer.h" + +#if ! defined (__ACE_INLINE__) +#include "Consumer.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_Consumer, "$Id$") + +TAO_NS_Consumer::TAO_NS_Consumer (void) +{ +} + +TAO_NS_Consumer::~TAO_NS_Consumer () +{ +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/Consumer.h b/TAO/orbsvcs/orbsvcs/Notify/Consumer.h new file mode 100644 index 00000000000..86b6388fb60 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Consumer.h @@ -0,0 +1,50 @@ +/* -*- C++ -*- */ +/** + * @file Consumer.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_CONSUMER_H +#define TAO_NS_CONSUMER_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "orbsvcs/CosNotificationC.h" +#include "Refcountable.h" +#include "Types.h" + +/** + * @class TAO_NS_Consumer + * + * @brief Astract Base class for wrapping consumer objects that connect to the EventChannel + * + */ +class TAO_Notify_Export TAO_NS_Consumer : public TAO_NS_Refcountable +{ +public: + /// Constuctor + TAO_NS_Consumer (void); + + /// Destructor + virtual ~TAO_NS_Consumer (); + + /// Push <event> to this consumer. + virtual void push (const CosNotification::StructuredEvent & event ACE_ENV_ARG_DECL) = 0; +}; + +#if defined (__ACE_INLINE__) +#include "Consumer.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_CONSUMER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Consumer.inl b/TAO/orbsvcs/orbsvcs/Notify/Consumer.inl new file mode 100644 index 00000000000..882affd00ff --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Consumer.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "Consumer.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.cpp b/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.cpp new file mode 100644 index 00000000000..ba8db23085b --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.cpp @@ -0,0 +1,359 @@ +// $Id$ + +#include "ConsumerAdmin.h" +#include "EventChannel.h" +#include "Builder.h" +#include "Proxy.h" +#include "orbsvcs/ESF/ESF_Proxy_Collection.h" +#include "QoSAdmin.h" + +#if ! defined (__ACE_INLINE__) +#include "ConsumerAdmin.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_ConsumerAdmin, "$Id$") + +TAO_NS_ConsumerAdmin::TAO_NS_ConsumerAdmin (void) +{ +} + +TAO_NS_ConsumerAdmin::~TAO_NS_ConsumerAdmin () +{ +} + +PortableServer::Servant +TAO_NS_ConsumerAdmin::servant (void) +{ + return this; +} + +void +TAO_NS_ConsumerAdmin::_add_ref (ACE_ENV_SINGLE_ARG_DECL) +{ + this->_incr_refcnt (); +} + +void +TAO_NS_ConsumerAdmin::_remove_ref (ACE_ENV_SINGLE_ARG_DECL) +{ + this->_decr_refcnt (); +} + +void +TAO_NS_ConsumerAdmin::release (void) +{ + delete this; + //@@ inform factory +} + +void +TAO_NS_ConsumerAdmin::set (CosNotifyChannelAdmin::InterFilterGroupOperator op ACE_ENV_ARG_DECL) +{ +} + +void +TAO_NS_ConsumerAdmin::destroy (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + this->inherited::destroy (this ACE_ENV_ARG_PARAMETER); +} + + +::CosNotifyChannelAdmin::ProxySupplier_ptr TAO_NS_ConsumerAdmin::obtain_notification_push_supplier ( + CosNotifyChannelAdmin::ClientType ctype, + CosNotifyChannelAdmin::ProxyID_out proxy_id + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::AdminLimitExceeded + )) + + { + return TAO_NS_PROPERTIES::instance()->builder ()->build_notification_push_supplier (this, + ctype, + proxy_id ACE_ENV_ARG_PARAMETER); + } + +CosNotifyChannelAdmin::AdminID +TAO_NS_ConsumerAdmin::MyID ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + + { + return this->id (); + } + +::CosNotifyChannelAdmin::EventChannel_ptr +TAO_NS_ConsumerAdmin::MyChannel ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + + { + //Add your implementation here + return 0; + } + +::CosNotifyChannelAdmin::InterFilterGroupOperator TAO_NS_ConsumerAdmin::MyOperator ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + + { + //Add your implementation here + return ::CosNotifyChannelAdmin::OR_OP; + } + +::CosNotifyFilter::MappingFilter_ptr TAO_NS_ConsumerAdmin::priority_filter ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + + { + //Add your implementation here + return 0; + } + +void TAO_NS_ConsumerAdmin::priority_filter ( + CosNotifyFilter::MappingFilter_ptr priority_filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + + { + //Add your implementation here + } + +::CosNotifyFilter::MappingFilter_ptr TAO_NS_ConsumerAdmin::lifetime_filter ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + + { + //Add your implementation here + return 0; + } + +void TAO_NS_ConsumerAdmin::lifetime_filter ( + CosNotifyFilter::MappingFilter_ptr lifetime_filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + + { + //Add your implementation here + } + +::CosNotifyChannelAdmin::ProxyIDSeq * TAO_NS_ConsumerAdmin::pull_suppliers ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + + { + //Add your implementation here + return 0; + } + +::CosNotifyChannelAdmin::ProxyIDSeq * TAO_NS_ConsumerAdmin::push_suppliers ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + + { + //Add your implementation here + return 0; + } + +::CosNotifyChannelAdmin::ProxySupplier_ptr TAO_NS_ConsumerAdmin::get_proxy_supplier ( + CosNotifyChannelAdmin::ProxyID proxy_id + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::ProxyNotFound + )) + + { + //Add your implementation here + return 0; + } + +::CosNotifyChannelAdmin::ProxySupplier_ptr TAO_NS_ConsumerAdmin::obtain_notification_pull_supplier ( + CosNotifyChannelAdmin::ClientType ctype, + CosNotifyChannelAdmin::ProxyID_out proxy_id + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::AdminLimitExceeded + )) + + { + //Add your implementation here + return 0; + } + +::CosNotification::QoSProperties * TAO_NS_ConsumerAdmin::get_qos ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + + { + //Add your implementation here + return 0; + } + +void TAO_NS_ConsumerAdmin::set_qos ( + const CosNotification::QoSProperties & qos + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + )) + { + for (CORBA::ULong index = 0; index < qos.length (); ++index) + { + ACE_CString property_name (qos[index].name); + + if (property_name.compare (NotifyExt::ThreadPool) == 0) + { + // check if ThreadPool is required. + NotifyExt::ThreadPoolParams* tp_params = 0; + + qos[index].value >>= tp_params; + + this->qos_admin_->apply_threadpool_qos (this, tp_params ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + break; + } + } +} + +void TAO_NS_ConsumerAdmin::validate_qos ( + const CosNotification::QoSProperties & required_qos, + CosNotification::NamedPropertyRangeSeq_out available_qos + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + )) + + { + //Add your implementation here + } + +void TAO_NS_ConsumerAdmin::subscription_change ( + const CosNotification::EventTypeSeq & added, + const CosNotification::EventTypeSeq & removed + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyComm::InvalidEventType + )) + + { + //Add your implementation here + } + +CosNotifyFilter::FilterID TAO_NS_ConsumerAdmin::add_filter ( + CosNotifyFilter::Filter_ptr new_filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + + { + //Add your implementation here + return 0; + } + +void TAO_NS_ConsumerAdmin::remove_filter ( + CosNotifyFilter::FilterID filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyFilter::FilterNotFound + )) + + { + //Add your implementation here + } + +::CosNotifyFilter::Filter_ptr TAO_NS_ConsumerAdmin::get_filter ( + CosNotifyFilter::FilterID filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyFilter::FilterNotFound + )) + + { + //Add your implementation here + return 0; + } + +::CosNotifyFilter::FilterIDSeq * TAO_NS_ConsumerAdmin::get_all_filters ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + + { + //Add your implementation here + return 0; + } + +void TAO_NS_ConsumerAdmin::remove_all_filters ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + + { + //Add your implementation here + } + +::CosEventChannelAdmin::ProxyPushSupplier_ptr TAO_NS_ConsumerAdmin::obtain_push_supplier ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + + { + //Add your implementation here + return 0; + } + +::CosEventChannelAdmin::ProxyPullSupplier_ptr TAO_NS_ConsumerAdmin::obtain_pull_supplier ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + + { + //Add your implementation here + return 0; + } diff --git a/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.h b/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.h new file mode 100644 index 00000000000..c9d280703e6 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.h @@ -0,0 +1,247 @@ +/* -*- C++ -*- */ +/** + * @file ConsumerAdmin.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_CONSUMERADMIN_H +#define TAO_NS_CONSUMERADMIN_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "orbsvcs/CosNotifyChannelAdminS.h" +#include "Admin.h" +#include "Destroy_Callback.h" + +/** + * @class TAO_NS_ConsumerAdmin + * + * @brief Implementation of CosNotifyChannelAdmin::ConsumerAdmin + * + */ +class TAO_Notify_Export TAO_NS_ConsumerAdmin : public POA_CosNotifyChannelAdmin::ConsumerAdmin, public TAO_NS_Admin, public TAO_NS_Destroy_Callback +{ + friend class TAO_NS_Builder; +public: + + /// Constuctor + TAO_NS_ConsumerAdmin (void); + + /// Destructor + ~TAO_NS_ConsumerAdmin (); + + /// Init this object. + void set (CosNotifyChannelAdmin::InterFilterGroupOperator op ACE_ENV_ARG_DECL); + + /// Return servant + virtual PortableServer::Servant servant (void); + + /// ServantBase refcount methods. + virtual void _add_ref (ACE_ENV_SINGLE_ARG_DECL); + virtual void _remove_ref (ACE_ENV_SINGLE_ARG_DECL); + + /// TAO_NS_Destroy_Callback methods + virtual void release (void); + +protected: + /// = CosNotifyChannelAdmin::ConsumerAdmin methods + +virtual CosNotifyChannelAdmin::AdminID MyID ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +virtual ::CosNotifyChannelAdmin::EventChannel_ptr MyChannel ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +virtual ::CosNotifyChannelAdmin::InterFilterGroupOperator MyOperator ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +virtual ::CosNotifyFilter::MappingFilter_ptr priority_filter ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +virtual void priority_filter ( + CosNotifyFilter::MappingFilter_ptr priority_filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +virtual ::CosNotifyFilter::MappingFilter_ptr lifetime_filter ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +virtual void lifetime_filter ( + CosNotifyFilter::MappingFilter_ptr lifetime_filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +virtual ::CosNotifyChannelAdmin::ProxyIDSeq * pull_suppliers ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +virtual ::CosNotifyChannelAdmin::ProxyIDSeq * push_suppliers ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +virtual ::CosNotifyChannelAdmin::ProxySupplier_ptr get_proxy_supplier ( + CosNotifyChannelAdmin::ProxyID proxy_id + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::ProxyNotFound + )); + +virtual ::CosNotifyChannelAdmin::ProxySupplier_ptr obtain_notification_pull_supplier ( + CosNotifyChannelAdmin::ClientType ctype, + CosNotifyChannelAdmin::ProxyID_out proxy_id + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::AdminLimitExceeded + )); + +virtual ::CosNotifyChannelAdmin::ProxySupplier_ptr obtain_notification_push_supplier ( + CosNotifyChannelAdmin::ClientType ctype, + CosNotifyChannelAdmin::ProxyID_out proxy_id + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::AdminLimitExceeded + )); + +virtual void destroy ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +virtual ::CosNotification::QoSProperties * get_qos ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +virtual void set_qos ( + const CosNotification::QoSProperties & qos + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + )); + +virtual void validate_qos ( + const CosNotification::QoSProperties & required_qos, + CosNotification::NamedPropertyRangeSeq_out available_qos + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + )); + +virtual void subscription_change ( + const CosNotification::EventTypeSeq & added, + const CosNotification::EventTypeSeq & removed + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyComm::InvalidEventType + )); + +virtual CosNotifyFilter::FilterID add_filter ( + CosNotifyFilter::Filter_ptr new_filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +virtual void remove_filter ( + CosNotifyFilter::FilterID filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyFilter::FilterNotFound + )); + +virtual ::CosNotifyFilter::Filter_ptr get_filter ( + CosNotifyFilter::FilterID filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyFilter::FilterNotFound + )); + +virtual ::CosNotifyFilter::FilterIDSeq * get_all_filters ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +virtual void remove_all_filters ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +virtual ::CosEventChannelAdmin::ProxyPushSupplier_ptr obtain_push_supplier ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +virtual ::CosEventChannelAdmin::ProxyPullSupplier_ptr obtain_pull_supplier ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +}; + + +#if defined (__ACE_INLINE__) +#include "ConsumerAdmin.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_CONSUMERADMIN_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.inl b/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.inl new file mode 100644 index 00000000000..5e07de81911 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "ConsumerAdmin.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Container.cpp b/TAO/orbsvcs/orbsvcs/Notify/Container.cpp new file mode 100644 index 00000000000..bc1cb91ea02 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Container.cpp @@ -0,0 +1,75 @@ +// $Id$ + +#include "Container.h" +#include "ThreadPool_Task.h" +#include "POA_Helper.h" + +#if ! defined (__ACE_INLINE__) +#include "Container.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_Container, "$Id$") + +TAO_NS_Container::TAO_NS_Container (void) + :object_poa_ (0), proxy_poa_ (0), delete_object_poa_ (0), delete_proxy_poa_ (0) +{ +} + +TAO_NS_Container::~TAO_NS_Container () +{ +} + +void +TAO_NS_Container::init (TAO_NS_POA_Helper* poa, TAO_NS_Worker_Task* worker_task, TAO_NS_POA_Helper* object_poa, TAO_NS_POA_Helper* proxy_poa ACE_ENV_ARG_DECL) +{ + TAO_NS_Object::init (poa, worker_task ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + object_poa_ = object_poa; + proxy_poa_ = proxy_poa; +} + +void +TAO_NS_Container::cleanup (ACE_ENV_SINGLE_ARG_DECL) +{ + if (delete_object_poa_ == 1) + { + object_poa_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); + delete object_poa_; + } + + if (delete_proxy_poa_ == 1) + { + proxy_poa_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); + delete proxy_poa_; + } +} + +void +TAO_NS_Container::object_poa (TAO_NS_POA_Helper* object_poa) +{ + object_poa_ = object_poa; + delete_object_poa_ = 1; +} + +TAO_NS_POA_Helper* +TAO_NS_Container::object_poa (void) +{ + return this->object_poa_; +} + +void +TAO_NS_Container::proxy_poa (TAO_NS_POA_Helper* proxy_poa) +{ + proxy_poa_ = proxy_poa; + delete_proxy_poa_ = 1; +} + +TAO_NS_POA_Helper* +TAO_NS_Container::proxy_poa (void) +{ + return this->proxy_poa_; +} + + + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Container.h b/TAO/orbsvcs/orbsvcs/Notify/Container.h new file mode 100644 index 00000000000..ff9f133a027 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Container.h @@ -0,0 +1,82 @@ +/* -*- C++ -*- */ +/** + * @file Container.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_CONTAINER_H +#define TAO_NS_CONTAINER_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "orbsvcs/NotifyExtC.h" +#include "Object.h" + +class TAO_NS_POA_Helper; +class TAO_NS_QoSAdmin; + +/** + * @class TAO_NS_Container + * + * @brief A Base class for implementing the Notify participants that behave as Obejct Containers. + * + */ +class TAO_Notify_Export TAO_NS_Container : public virtual TAO_NS_Object +{ +public: + /// Constuctor + TAO_NS_Container (void); + + /// Destructor + virtual ~TAO_NS_Container (); + + /// Init this object. + void init (TAO_NS_POA_Helper* poa, TAO_NS_Worker_Task* worker_task, TAO_NS_POA_Helper* object_poa, TAO_NS_POA_Helper* proxy_poa ACE_ENV_ARG_DECL); + + /// Cleanup + void cleanup (ACE_ENV_SINGLE_ARG_DECL); + + /// Accessor for the object_poa_ + /// Setting the object_poa_ gives ownership to this class. + void object_poa (TAO_NS_POA_Helper* object_poa); + TAO_NS_POA_Helper* object_poa (void); + + /// Accessor for the proxy_poa_ + /// Setting the proxy_poa_ gives ownership to this class. + void proxy_poa (TAO_NS_POA_Helper* proxy_poa); + TAO_NS_POA_Helper* proxy_poa (void); + +protected: + /// = Protected Methods + + /// = Data Members + + /// The POA in which the object's are activated. + TAO_NS_POA_Helper* object_poa_; + + /// The POA in which the proxys are activated. + TAO_NS_POA_Helper* proxy_poa_; + + /// Flag that indicates if we own <object_poa_> + int delete_object_poa_; + + /// Flag that indicates if we own <proxy_poa_> + int delete_proxy_poa_; +}; + +#if defined (__ACE_INLINE__) +#include "Container.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_CONTAINER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Container.inl b/TAO/orbsvcs/orbsvcs/Notify/Container.inl new file mode 100644 index 00000000000..311caa51b09 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Container.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "Container.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Container_T.cpp b/TAO/orbsvcs/orbsvcs/Notify/Container_T.cpp new file mode 100644 index 00000000000..92e6bf89dc7 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Container_T.cpp @@ -0,0 +1,68 @@ +// $Id$ + +#ifndef TAO_NS_CONTAINER_T_CPP +#define TAO_NS_CONTAINER_T_CPP + +#include "Container_T.h" + +#include "orbsvcs/ESF/ESF_Proxy_Collection.h" +#include "orbsvcs/ESF/ESF_Shutdown_Proxy.h" +#include "Properties.h" +#include "Factory.h" +#include "POA_Helper.h" + +#if ! defined (__ACE_INLINE__) +#include "Container_T.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_Container_T, "$Id$") + +template<class TYPE, class OBJECT, class PARENT> +TAO_NS_Container_T<TYPE, OBJECT, PARENT>::TAO_NS_Container_T (void) + : collection_ (0) +{ +} + +template<class TYPE, class OBJECT, class PARENT> +TAO_NS_Container_T<TYPE, OBJECT, PARENT>::~TAO_NS_Container_T () +{ + /// + delete collection_; +} + +template <class TYPE, class OBJECT, class PARENT> void +TAO_NS_Container_T<TYPE, OBJECT, PARENT>::shutdown (ACE_ENV_SINGLE_ARG_DECL) +{ + TAO_NS_Object_T<OBJECT, PARENT>::shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + TAO_ESF_Shutdown_Proxy<TYPE> shutdown_worker; + + this->collection_->for_each (&shutdown_worker ACE_ENV_ARG_PARAMETER); + + /// shutdown Container + this->cleanup (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +template<class TYPE, class OBJECT, class PARENT> void +TAO_NS_Container_T<TYPE, OBJECT, PARENT>::insert (TYPE* type ACE_ENV_ARG_DECL) +{ + this->collection_->connected (type ACE_ENV_ARG_PARAMETER); +} + +template<class TYPE, class OBJECT, class PARENT> void +TAO_NS_Container_T<TYPE, OBJECT, PARENT>::remove (TYPE* type ACE_ENV_ARG_DECL) +{ + this->collection_->disconnected (type ACE_ENV_ARG_PARAMETER); +} + +template<class TYPE, class OBJECT, class PARENT> void +TAO_NS_Container_T<TYPE, OBJECT, PARENT>::init_collection (ACE_ENV_SINGLE_ARG_DECL) +{ + // get the factory + TAO_NS_Factory* factory = TAO_NS_PROPERTIES::instance ()->factory (); + + // Init variables + factory->create (this->collection_ ACE_ENV_SINGLE_ARG_PARAMETER); +} +#endif /* TAO_NS_CONTAINER_T_CPP */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Container_T.h b/TAO/orbsvcs/orbsvcs/Notify/Container_T.h new file mode 100644 index 00000000000..b140f4c84af --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Container_T.h @@ -0,0 +1,74 @@ +/* -*- C++ -*- */ +/** + * @file Container_T.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_CONTAINER_T_H +#define TAO_NS_CONTAINER_T_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "Container.h" +#include "Object_T.h" + +/** + * @class TAO_NS_Container_T + * + * @brief A template class that manages a collection. + * TYPE = type of collection, OBJECT = the object, PARENT = parent of object (grandparent of TYPE) + * + */ +template <class TYPE, class OBJECT, class PARENT = TAO_NS_NULL_PARENT> +class TAO_Notify_Export TAO_NS_Container_T : public TAO_NS_Object_T<OBJECT, PARENT>, public virtual TAO_NS_Container +{ +public: + /// Constuctor + TAO_NS_Container_T (void); + + /// Destructor + virtual ~TAO_NS_Container_T (); + + /// Insert object to this container. + void insert (TYPE* type ACE_ENV_ARG_DECL); + + /// Remove type from container_ + void remove (TYPE* type ACE_ENV_ARG_DECL); + + /// Init this object. + void init_collection (ACE_ENV_SINGLE_ARG_DECL); + + /// Shutdown + virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL); + +protected: + typedef TAO_ESF_Proxy_Collection<TYPE> COLLECTION; + + /// The collection data structure that we add objects to. + COLLECTION* collection_; +}; + +#if defined (__ACE_INLINE__) +#include "Container_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "Container_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Container_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include "ace/post.h" +#endif /* TAO_NS_CONTAINER_T_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Container_T.inl b/TAO/orbsvcs/orbsvcs/Notify/Container_T.inl new file mode 100644 index 00000000000..6465cd06ad7 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Container_T.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "Container_T.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.cpp~ b/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.cpp~ new file mode 100644 index 00000000000..e0b04780772 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.cpp~ @@ -0,0 +1,86 @@ +// $Id$ + +#include "CosNotify_Service.h" +#include "tao/ORB_Core.h" +#include "Builder.h" +#include "Properties.h" +#include "Factory.h" + +ACE_RCSID(RT_Notify, TAO_NS_CosNotify_Service, "$Id$") + +TAO_NS_CosNotify_Service::TAO_NS_CosNotify_Service (void) +{ +} + +TAO_NS_CosNotify_Service::~TAO_NS_CosNotify_Service () +{ + delete factory_; + delete builder_; +} + +void +TAO_NS_CosNotify_Service::init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL) +{ + this->init_i (orb ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->init_factory (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->init_builder (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; +} + +void +TAO_NS_CosNotify_Service::init_i (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL) +{ + // 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->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 ()); +} + +void +TAO_NS_CosNotify_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_CosNotify_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_CosNotify_Service::create (PortableServer::POA_ptr poa ACE_ENV_ARG_DECL) +{ + return this->builder_->build_event_channel_factory (poa ACE_ENV_ARG_PARAMETER); +} + +ACE_FACTORY_DEFINE (TAO_Notify, TAO_NS_CosNotify_Service) diff --git a/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.inl~ b/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.inl~ new file mode 100644 index 00000000000..054e027e43f --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.inl~ @@ -0,0 +1,3 @@ +// $Id$ + +#include "CosNotify_Service.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Destroy_Callback.h b/TAO/orbsvcs/orbsvcs/Notify/Destroy_Callback.h new file mode 100644 index 00000000000..8be318d3227 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Destroy_Callback.h @@ -0,0 +1,38 @@ +/* -*- C++ -*- */ +/** + * @file Destroy_Callback.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_DESTROY_CALLBACK_H +#define TAO_NS_DESTROY_CALLBACK_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +/** + * @class TAO_NS_Destroy_Callback + * + * @brief Interface to be implemented by users of TAO_NS_Refcountable + * + */ +class TAO_Notify_Export TAO_NS_Destroy_Callback +{ +public: + + /// Called when Refcountable count drops to 0 + virtual void release (void) = 0; +}; + + +#include "ace/post.h" +#endif /* TAO_NS_DESTROY_CALLBACK_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event.cpp b/TAO/orbsvcs/orbsvcs/Notify/Event.cpp new file mode 100644 index 00000000000..2ae1254ae80 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Event.cpp @@ -0,0 +1,23 @@ +// $Id$ + +#include "Event.h" +#include "tao/debug.h" + +#if ! defined (__ACE_INLINE__) +#include "Event.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_Event, "$Id$") + +TAO_NS_Event::TAO_NS_Event (void) +{ + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG,"event:%x created\n", this )); +} + +TAO_NS_Event::~TAO_NS_Event () +{ + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG,"event:%x destroyed\n", this )); +} + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event.h b/TAO/orbsvcs/orbsvcs/Notify/Event.h new file mode 100644 index 00000000000..52b554cfb33 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Event.h @@ -0,0 +1,58 @@ +/* -*- C++ -*- */ +/** + * @file Event.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_EVENT_H +#define TAO_NS_EVENT_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Copy_Disabled.h" +#include "orbsvcs/Event_ForwarderS.h" + +class TAO_NS_EventType; +class TAO_NS_Consumer; + +/** + * @class TAO_NS_Event + * + * @brief Base class abstraction for Events flowing through the EventChannel. + * + */ +class TAO_Notify_Export TAO_NS_Event : private ACE_Copy_Disabled +{ +public: + /// Constuctor + TAO_NS_Event (void); + + /// Destructor + virtual ~TAO_NS_Event (); + + /// Get the event type. + virtual const TAO_NS_EventType& type (void) const = 0; + + /// Push event to consumer + virtual void push (TAO_NS_Consumer* consumer ACE_ENV_ARG_DECL) const = 0; + + /// Push event to the Event_Forwarder interface + virtual void push (Notify_Internal::Event_Forwarder_ptr forwarder ACE_ENV_ARG_DECL) = 0; +}; + +#if defined (__ACE_INLINE__) +#include "Event.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_EVENT_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event.inl b/TAO/orbsvcs/orbsvcs/Notify/Event.inl new file mode 100644 index 00000000000..43b0ff7781b --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Event.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "Event.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventChannel.cpp b/TAO/orbsvcs/orbsvcs/Notify/EventChannel.cpp new file mode 100644 index 00000000000..4c1a9a45252 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/EventChannel.cpp @@ -0,0 +1,285 @@ +// $Id$ + +#include "EventChannel.h" +#include "EventChannelFactory.h" +#include "Proxy.h" +#include "Admin.h" +#include "Event_Manager.h" +#include "Properties.h" +#include "Builder.h" +#include "ThreadPool_Task.h" +#include "QoSAdmin.h" + +#if ! defined (__ACE_INLINE__) +#include "EventChannel.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_EventChannel, "$Id$") + + TAO_NS_EventChannel::TAO_NS_EventChannel (void) +{ +} + +TAO_NS_EventChannel::~TAO_NS_EventChannel () +{ + delete event_manager_; +} + +PortableServer::Servant +TAO_NS_EventChannel::servant (void) +{ + return this; +} + +void +TAO_NS_EventChannel::_add_ref (ACE_ENV_SINGLE_ARG_DECL) +{ + this->_incr_refcnt (); +} + +void +TAO_NS_EventChannel::_remove_ref (ACE_ENV_SINGLE_ARG_DECL) +{ + this->_decr_refcnt (); +} + +void +TAO_NS_EventChannel::release (void) +{ + delete this; + //@@ inform factory +} + +void +TAO_NS_EventChannel::destroy (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + this->inherited::destroy (this ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_EventChannel::set_qos (const CosNotification::QoSProperties & qos ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + )) +{ + for (CORBA::ULong index = 0; index < qos.length (); ++index) + { + ACE_CString property_name (qos[index].name); + + if (property_name.compare (NotifyExt::ThreadPool) == 0) + { + // check if ThreadPool is required. + NotifyExt::ThreadPoolParams* tp_params = 0; + + qos[index].value >>= tp_params; + + this->qos_admin_->apply_threadpool_qos (this, tp_params ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + break; + } + } + +} + +::CosNotifyChannelAdmin::EventChannelFactory_ptr +TAO_NS_EventChannel::MyFactory () + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + //Add your implementation here + return 0; +} + +::CosNotifyChannelAdmin::ConsumerAdmin_ptr TAO_NS_EventChannel::default_consumer_admin ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + //Add your implementation here + return 0; +} + +::CosNotifyChannelAdmin::SupplierAdmin_ptr TAO_NS_EventChannel::default_supplier_admin ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + //Add your implementation here + return 0; +} + +::CosNotifyFilter::FilterFactory_ptr TAO_NS_EventChannel::default_filter_factory ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + //Add your implementation here + return 0; +} + +::CosNotifyChannelAdmin::ConsumerAdmin_ptr +TAO_NS_EventChannel::new_for_consumers (CosNotifyChannelAdmin::InterFilterGroupOperator op, + CosNotifyChannelAdmin::AdminID_out id + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + /// Builder for ConsumerAdmins + return TAO_NS_PROPERTIES::instance()->builder ()->build_consumer_admin (this, op, id); +} + +::CosNotifyChannelAdmin::SupplierAdmin_ptr +TAO_NS_EventChannel::new_for_suppliers (CosNotifyChannelAdmin::InterFilterGroupOperator op, + CosNotifyChannelAdmin::AdminID_out id + ACE_ENV_ARG_DECL + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + /// Builder for SupplierAdmins + return TAO_NS_PROPERTIES::instance()->builder ()->build_supplier_admin (this, op, id); +} + +::CosNotifyChannelAdmin::ConsumerAdmin_ptr TAO_NS_EventChannel::get_consumeradmin ( + CosNotifyChannelAdmin::AdminID id + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::AdminNotFound + )) + +{ + //Add your implementation here + return 0; +} + +::CosNotifyChannelAdmin::SupplierAdmin_ptr TAO_NS_EventChannel::get_supplieradmin ( + CosNotifyChannelAdmin::AdminID id + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::AdminNotFound + )) + +{ + //Add your implementation here + return 0; +} + +::CosNotifyChannelAdmin::AdminIDSeq * TAO_NS_EventChannel::get_all_consumeradmins ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + //Add your implementation here + return 0; +} + +::CosNotifyChannelAdmin::AdminIDSeq * TAO_NS_EventChannel::get_all_supplieradmins ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + //Add your implementation here + return 0; +} + +::CosNotification::QoSProperties * TAO_NS_EventChannel::get_qos ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + //Add your implementation here + return 0; +} + +void TAO_NS_EventChannel::validate_qos ( + const CosNotification::QoSProperties & required_qos, + CosNotification::NamedPropertyRangeSeq_out available_qos + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + )) + +{ + //Add your implementation here +} + +::CosNotification::AdminProperties * TAO_NS_EventChannel::get_admin ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + //Add your implementation here + return 0; +} + +void TAO_NS_EventChannel::set_admin ( + const CosNotification::AdminProperties & admin + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedAdmin + )) + +{ + //Add your implementation here +} + +::CosEventChannelAdmin::ConsumerAdmin_ptr TAO_NS_EventChannel::for_consumers ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + //Add your implementation here + return 0; +} + +::CosEventChannelAdmin::SupplierAdmin_ptr TAO_NS_EventChannel::for_suppliers ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + //Add your implementation here + return 0; +} + diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventChannel.h b/TAO/orbsvcs/orbsvcs/Notify/EventChannel.h new file mode 100644 index 00000000000..b7d83b5bb9f --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/EventChannel.h @@ -0,0 +1,204 @@ +/* -*- C++ -*- */ +/** + * @file EventChannel.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_EVENTCHANNEL_H +#define TAO_NS_EVENTCHANNEL_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "orbsvcs/CosNotifyChannelAdminS.h" +#include "orbsvcs/NotifyExtC.h" +#include "Container_T.h" +#include "Destroy_Callback.h" + +//#include "Admin.h" + +class TAO_NS_Admin; +class TAO_NS_EventChannelFactory; + +/** + * @class TAO_NS_EventChannel + * + * @brief Implementation of CosNotifyChannelAdmin::EventChannel + * + */ +class TAO_Notify_Export TAO_NS_EventChannel : public POA_CosNotifyChannelAdmin::EventChannel, public TAO_NS_Container_T <TAO_NS_Admin, TAO_NS_EventChannel, TAO_NS_EventChannelFactory>, public TAO_NS_Destroy_Callback +{ + friend class TAO_NS_Builder; + typedef TAO_NS_Container_T <TAO_NS_Admin, TAO_NS_EventChannel, TAO_NS_EventChannelFactory> inherited; + +public: + /// Constuctor + TAO_NS_EventChannel (void); + + /// Destructor + ~TAO_NS_EventChannel (); + + /// Return servant + virtual PortableServer::Servant servant (void); + + /// ServantBase refcount methods. + virtual void _add_ref (ACE_ENV_SINGLE_ARG_DECL); + virtual void _remove_ref (ACE_ENV_SINGLE_ARG_DECL); + + /// TAO_NS_Destroy_Callback methods + virtual void release (void); + +protected: + /// = Data Members + + + /// =CosNotifyChannelAdmin::EventChannel methods + + virtual void destroy (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual ::CosNotifyChannelAdmin::EventChannelFactory_ptr MyFactory ( + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual ::CosNotifyChannelAdmin::ConsumerAdmin_ptr default_consumer_admin ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual ::CosNotifyChannelAdmin::SupplierAdmin_ptr default_supplier_admin ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual ::CosNotifyFilter::FilterFactory_ptr default_filter_factory ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual ::CosNotifyChannelAdmin::ConsumerAdmin_ptr new_for_consumers ( + CosNotifyChannelAdmin::InterFilterGroupOperator op, + CosNotifyChannelAdmin::AdminID_out id + ) + 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_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::AdminNotFound + )); + + virtual ::CosNotifyChannelAdmin::SupplierAdmin_ptr get_supplieradmin ( + CosNotifyChannelAdmin::AdminID id + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::AdminNotFound + )); + + virtual ::CosNotifyChannelAdmin::AdminIDSeq * get_all_consumeradmins ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual ::CosNotifyChannelAdmin::AdminIDSeq * get_all_supplieradmins ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual ::CosNotification::QoSProperties * get_qos ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual void set_qos ( + const CosNotification::QoSProperties & qos + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + )); + + virtual void validate_qos ( + const CosNotification::QoSProperties & required_qos, + CosNotification::NamedPropertyRangeSeq_out available_qos + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + )); + + virtual ::CosNotification::AdminProperties * get_admin ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual void set_admin ( + const CosNotification::AdminProperties & admin + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedAdmin + )); + + virtual ::CosEventChannelAdmin::ConsumerAdmin_ptr for_consumers ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual ::CosEventChannelAdmin::SupplierAdmin_ptr for_suppliers ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); +}; + +#if defined (__ACE_INLINE__) +#include "EventChannel.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_EVENTCHANNEL_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventChannel.inl b/TAO/orbsvcs/orbsvcs/Notify/EventChannel.inl new file mode 100644 index 00000000000..d0dad8b7dd7 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/EventChannel.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "EventChannel.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.cpp b/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.cpp new file mode 100644 index 00000000000..a9b5e782232 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.cpp @@ -0,0 +1,88 @@ +// $Id$ + +#include "EventChannelFactory.h" +#include "Properties.h" +#include "Builder.h" +#include "Proxy.h" +#include "Admin.h" +#include "EventChannel.h" +#include "orbsvcs/ESF/ESF_Proxy_Collection.h" + +#if ! defined (__ACE_INLINE__) +#include "EventChannelFactory.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_EventChannelFactory, "$Id$") + +TAO_NS_EventChannelFactory::TAO_NS_EventChannelFactory (void) +{ +} + +TAO_NS_EventChannelFactory::~TAO_NS_EventChannelFactory () +{ +} + +PortableServer::Servant +TAO_NS_EventChannelFactory::servant (void) +{ + return this; +} + +void +TAO_NS_EventChannelFactory::_add_ref (ACE_ENV_SINGLE_ARG_DECL) +{ + this->_incr_refcnt (); +} + +void +TAO_NS_EventChannelFactory::_remove_ref (ACE_ENV_SINGLE_ARG_DECL) +{ + this->_decr_refcnt (); +} + +void +TAO_NS_EventChannelFactory::release (void) +{ + delete this; + //@@ inform factory +} + +::CosNotifyChannelAdmin::EventChannel_ptr TAO_NS_EventChannelFactory::create_channel ( + const CosNotification::QoSProperties & initial_qos, + const CosNotification::AdminProperties & initial_admin, + CosNotifyChannelAdmin::ChannelID_out id ACE_ENV_ARG_DECL + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + , CosNotification::UnsupportedAdmin + )) +{ + return TAO_NS_PROPERTIES::instance()->builder ()->build_event_channel (this, initial_qos, initial_admin, id ACE_ENV_ARG_PARAMETER); +} + +::CosNotifyChannelAdmin::ChannelIDSeq *TAO_NS_EventChannelFactory::get_all_channels ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + + { + return 0; + //Add your implementation here + } + +::CosNotifyChannelAdmin::EventChannel_ptr TAO_NS_EventChannelFactory::get_event_channel ( + CosNotifyChannelAdmin::ChannelID id + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::ChannelNotFound + )) + + { + //Add your implementation here + return 0; + } + diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.h b/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.h new file mode 100644 index 00000000000..5f93bb7b506 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.h @@ -0,0 +1,91 @@ +/* -*- C++ -*- */ +/** + * @file EventChannelFactory.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_EVENTCHANNELFACTORY_H +#define TAO_NS_EVENTCHANNELFACTORY_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "orbsvcs/CosNotifyChannelAdminS.h" +#include "Container_T.h" +#include "Destroy_Callback.h" + +class TAO_NS_EventChannel; + +/** + * @class TAO_NS_EventChannelFactory + * + * @brief Implementation of CosNotifyChannelAdmin::EventChannelFactory + * + */ +class TAO_Notify_Export TAO_NS_EventChannelFactory : public virtual POA_CosNotifyChannelAdmin::EventChannelFactory, public TAO_NS_Container_T <TAO_NS_EventChannel, TAO_NS_EventChannelFactory>, public TAO_NS_Destroy_Callback +{ + friend class TAO_NS_Builder; + +public: + /// Constuctor + TAO_NS_EventChannelFactory (void); + + /// Destructor + virtual ~TAO_NS_EventChannelFactory (); + + /// Return servant + virtual PortableServer::Servant servant (void); + + /// = ServantBase Methods + virtual void _add_ref (ACE_ENV_SINGLE_ARG_DECL); + virtual void _remove_ref (ACE_ENV_SINGLE_ARG_DECL); + + /// TAO_NS_Destroy_Callback methods + virtual void release (void); + + protected: + /// = Data Members + + /// = CosNotifyChannelAdmin Methods + virtual ::CosNotifyChannelAdmin::EventChannel_ptr create_channel ( + const CosNotification::QoSProperties & initial_qos, + const CosNotification::AdminProperties & initial_admin, + CosNotifyChannelAdmin::ChannelID_out id ACE_ENV_ARG_DECL + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + , CosNotification::UnsupportedAdmin + )); + +virtual ::CosNotifyChannelAdmin::ChannelIDSeq * get_all_channels ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +virtual ::CosNotifyChannelAdmin::EventChannel_ptr get_event_channel ( + CosNotifyChannelAdmin::ChannelID id + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::ChannelNotFound + )); +}; + +#if defined (__ACE_INLINE__) +#include "EventChannelFactory.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_EVENTCHANNELFACTORY_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.inl b/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.inl new file mode 100644 index 00000000000..13066cdc8f8 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.inl @@ -0,0 +1,4 @@ + +// $Id$ + +#include "EventChannelFactory.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventType.cpp b/TAO/orbsvcs/orbsvcs/Notify/EventType.cpp new file mode 100644 index 00000000000..d6e41458ec2 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/EventType.cpp @@ -0,0 +1,124 @@ +// $Id$ + +#include "EventType.h" + +#if ! defined (__ACE_INLINE__) +#include "EventType.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_EventType, "$Id$") + +TAO_NS_EventType +TAO_NS_EventType::special (void) +{ + return TAO_NS_EventType ("*", "%ALL"); +} + +TAO_NS_EventType::TAO_NS_EventType (void) +{ +} + +void +TAO_NS_EventType::init_i (const char* domain_name, const char* type_name) +{ + this->event_type_.domain_name = domain_name; + this->event_type_.type_name = type_name; + + if (this->is_special () == 1) + { + this->event_type_.domain_name = (const char* )"*"; + this->event_type_.type_name = (const char* )"%ALL"; + } + + this->recompute_hash (); +} + +TAO_NS_EventType::TAO_NS_EventType (const char* domain_name, const char* type_name) +{ + this->init_i (domain_name, type_name); +} + +TAO_NS_EventType::TAO_NS_EventType (const CosNotification::EventType& event_type) +{ + this->init_i (event_type.domain_name.in (), event_type.type_name.in ()); +} + +TAO_NS_EventType::~TAO_NS_EventType () +{ +} + +void +TAO_NS_EventType::recompute_hash (void) +{ + // @@ Pradeep: this code is bound to crash someday if the strings + // are too long.... See if the hash_pjw () function can be modified + // to take accumulate multiple strings, as in: + // hash = ACE::hash_pjw_accummulate (0, str1); + // hash = ACE::hash_pjw_accummulate (hash, str2); + // + // @@ Or use grow the buffer when needed, or just add the two hash + // values or something, but fix this code! + // + char buffer[BUFSIZ]; + ACE_OS::strcpy (buffer, this->event_type_.domain_name.in ()); + ACE_OS::strcat (buffer, this->event_type_.type_name.in ()); + + this->hash_value_ = ACE::hash_pjw (buffer); +} + +TAO_NS_EventType& +TAO_NS_EventType::operator=(const CosNotification::EventType& event_type) +{ + this->init_i (event_type.domain_name.in (),event_type.type_name.in ()); + + return *this; +} + +TAO_NS_EventType& +TAO_NS_EventType::operator=(const TAO_NS_EventType& event_type) +{ + if (this == &event_type) + return *this; + + this->init_i (event_type.event_type_.domain_name.in (),event_type.event_type_.type_name.in ()); + + return *this; +} + +int +TAO_NS_EventType::operator==(const TAO_NS_EventType& event_type) const +{ + if (this->hash () != event_type.hash ()) + return 0; + else // compare the strings + return (ACE_OS::strcmp (this->event_type_.type_name, event_type.event_type_.type_name) == 0 && + ACE_OS::strcmp (this->event_type_.domain_name, event_type.event_type_.domain_name) == 0 + ); +} + +int +TAO_NS_EventType::operator!=(const TAO_NS_EventType& event_type) const +{ + if (this->hash () != event_type.hash ()) + return 1; + else // compare the strings + return (ACE_OS::strcmp (this->event_type_.type_name, event_type.event_type_.type_name) != 0 || + ACE_OS::strcmp (this->event_type_.domain_name, event_type.event_type_.domain_name) != 0 + ); +} + +CORBA::Boolean +TAO_NS_EventType::is_special (void) const +{ + if ((this->event_type_.domain_name == 0 || + ACE_OS::strcmp (this->event_type_.domain_name, "") == 0 || + ACE_OS::strcmp (this->event_type_.domain_name, "*") == 0) && + (this->event_type_.type_name == 0 || + ACE_OS::strcmp (this->event_type_.type_name, "") == 0 || + ACE_OS::strcmp (this->event_type_.type_name, "*") == 0 || + ACE_OS::strcmp (this->event_type_.type_name, "%ALL") == 0)) + return 1; + else + return 0; +} + diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventType.h b/TAO/orbsvcs/orbsvcs/Notify/EventType.h new file mode 100644 index 00000000000..e23bf4cfe04 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/EventType.h @@ -0,0 +1,89 @@ +/* -*- C++ -*- */ +/** + * @file EventType.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_EVENTTYPE_H +#define TAO_NS_EVENTTYPE_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "orbsvcs/CosNotificationC.h" + +/** + * @class TAO_NS_EventType + * + * @brief + * + * This type is used to compare different event types. + * It is used by the Event Manager as a key to find subscription lists. + * + */ +class TAO_Notify_Export TAO_NS_EventType +{ +public: + /// Constuctor + TAO_NS_EventType (void); + TAO_NS_EventType (const char* domain_name, const char* type_name); + TAO_NS_EventType (const CosNotification::EventType& event_type); + // Constuctor + + /// Destructor + ~TAO_NS_EventType (); + + /// hash value + u_long hash (void) const; + + /// Assignment from CosNotification::EventType + TAO_NS_EventType& operator=(const CosNotification::EventType& event_type); + + /// Assignment operator. + TAO_NS_EventType& operator=(const TAO_NS_EventType& event_type); + + /// == operator + int operator==(const TAO_NS_EventType& notify_event_type) const; + + /// != operator + int operator!=(const TAO_NS_EventType& notify_event_type) const; + + static TAO_NS_EventType special (void); + // Return the special event type. + + CORBA::Boolean is_special (void) const; + // Is this the special event (accept everything). + + const CosNotification::EventType& native (void) const; + // Get the type underneath us. + +protected: + /// Init this object. + void init_i (const char* domain_name, const char* type_name); + + void recompute_hash (void); + // Recompute the hash value. + + // = Data Members + CosNotification::EventType event_type_; + // The event_type that we're decorating. + + u_long hash_value_; + // The hash value computed. +}; + +#if defined (__ACE_INLINE__) +#include "EventType.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_EVENTTYPE_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventType.inl b/TAO/orbsvcs/orbsvcs/Notify/EventType.inl new file mode 100644 index 00000000000..2c8af265fe4 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/EventType.inl @@ -0,0 +1,15 @@ +// $Id$ + +#include "EventType.h" + +ACE_INLINE u_long +TAO_NS_EventType::hash (void) const +{ + return this->hash_value_; +} + +ACE_INLINE const CosNotification::EventType& +TAO_NS_EventType::native (void) const +{ + return event_type_; +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.cpp b/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.cpp new file mode 100644 index 00000000000..3f700123ab1 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.cpp @@ -0,0 +1,78 @@ +// $Id$ + +#include "EventTypeSeq.h" + +#if ! defined (__ACE_INLINE__) +#include "EventTypeSeq.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_EventTypeSeq, "$Id$") + +TAO_NS_EventTypeSeq::TAO_NS_EventTypeSeq (void) +{ +} + +TAO_NS_EventTypeSeq::TAO_NS_EventTypeSeq (const CosNotification::EventTypeSeq& event_type_seq) +{ + this->insert_seq (event_type_seq); +} + +void +TAO_NS_EventTypeSeq::populate (CosNotification::EventTypeSeq& event_type_seq) +{ + event_type_seq.length (this->size ()); + + TAO_NS_EventTypeSeq::CONST_ITERATOR iter (*this); + + TAO_NS_EventType* event_type; + + CORBA::ULong i = 0; + for (iter.first (); iter.next (event_type); iter.advance (), ++i) + event_type_seq[i] = event_type->native (); +} + +void +TAO_NS_EventTypeSeq::insert_seq (const CosNotification::EventTypeSeq& event_type_seq) +{ + TAO_NS_EventType event_type; + + for (CORBA::ULong i = 0; i < event_type_seq.length (); ++i) + { + event_type = event_type_seq[i]; + inherited::insert (event_type); + } +} + +void +TAO_NS_EventTypeSeq::remove_seq (const CosNotification::EventTypeSeq& event_type_seq) +{ + TAO_NS_EventType event_type; + + for (CORBA::ULong i = 0; i < event_type_seq.length (); ++i) + { + event_type = event_type_seq[i]; + inherited::remove (event_type); + } +} + +void +TAO_NS_EventTypeSeq::insert_seq (const TAO_NS_EventTypeSeq& event_type_seq) +{ + TAO_NS_EventTypeSeq::CONST_ITERATOR iter (event_type_seq); + + TAO_NS_EventType* event_type; + + for (iter.first (); iter.next (event_type); iter.advance ()) + inherited::insert (*event_type); +} + +void +TAO_NS_EventTypeSeq::remove_seq (const TAO_NS_EventTypeSeq& event_type_seq) +{ + TAO_NS_EventTypeSeq::CONST_ITERATOR iter (event_type_seq); + + TAO_NS_EventType* event_type; + + for (iter.first (); iter.next (event_type); iter.advance ()) + inherited::remove (*event_type); +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.h b/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.h new file mode 100644 index 00000000000..a6264246751 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.h @@ -0,0 +1,62 @@ +/* -*- C++ -*- */ +/** + * @file EventTypeSeq.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_EVENTTYPESEQ_H +#define TAO_NS_EVENTTYPESEQ_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "EventType.h" + +template<class T> class ACE_Unbounded_Set; + +/** + * @class TAO_NS_EventTypeSeq + * + * @brief Allows operations using the CosNotification::EventTypeSeq type. + * + */ +class TAO_Notify_Export TAO_NS_EventTypeSeq : public ACE_Unbounded_Set <TAO_NS_EventType> +{ + typedef ACE_Unbounded_Set <TAO_NS_EventType> inherited; + +public: + /// Constructor + TAO_NS_EventTypeSeq (void); + TAO_NS_EventTypeSeq (const CosNotification::EventTypeSeq& event_type_seq); + + /// insert_seq the contents of <event_type_seq> into this object. + void insert_seq (const CosNotification::EventTypeSeq& event_type_seq); + + /// remove_seq the contents of <event_type_seq> from this object. + void remove_seq (const CosNotification::EventTypeSeq& event_type_seq); + + /// insert_seq the contents of <event_type_seq> into this object. + void insert_seq (const TAO_NS_EventTypeSeq& event_type_seq); + + /// remove_seq the contents of <event_type_seq> from this object. + void remove_seq (const TAO_NS_EventTypeSeq& event_type_seq); + + /// Populate <event_type_seq> with the contents of this object. + void populate (CosNotification::EventTypeSeq& event_type_seq); +}; + +#if defined (__ACE_INLINE__) +#include "EventTypeSeq.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_EVENTTYPESEQ_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.inl b/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.inl new file mode 100644 index 00000000000..47236e2d9c4 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.inl @@ -0,0 +1,4 @@ +// $Id$ + +#include "EventTypeSeq.h" + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event_Manager.cpp b/TAO/orbsvcs/orbsvcs/Notify/Event_Manager.cpp new file mode 100644 index 00000000000..dd137a25381 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Event_Manager.cpp @@ -0,0 +1,122 @@ +// $Id$ + +#include "Event_Manager.h" +#include "tao/debug.h" + +#if ! defined (__ACE_INLINE__) +#include "Event_Manager.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_Event_Manager, "$Id$") + +#include "EventTypeSeq.h" +#include "Event.h" +#include "Event_Map_T.h" +#include "orbsvcs/ESF/ESF_Proxy_Collection.h" + +TAO_NS_Event_Manager::TAO_NS_Event_Manager (void) + :consumer_map_ (0), supplier_map_ (0), broadcast_list_ (0) +{ +} + +TAO_NS_Event_Manager::~TAO_NS_Event_Manager () +{ + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, "destroying consumer/supplier map count = %d/%d, \n", + this->consumer_map_->count (), this->supplier_map_->count ())); + } + + delete this->consumer_map_; + delete this->supplier_map_; +} + +void +TAO_NS_Event_Manager::init (ACE_ENV_SINGLE_ARG_DECL) +{ + ACE_NEW_THROW_EX (this->consumer_map_, + TAO_NS_Consumer_Map (), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + ACE_NEW_THROW_EX (this->supplier_map_, + TAO_NS_Supplier_Map (), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + broadcast_list_ = consumer_map_->create_entry (TAO_NS_EventType::special () ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_Event_Manager::subscribe (TAO_NS_ProxySupplier* proxy_supplier, const TAO_NS_EventTypeSeq& seq ACE_ENV_ARG_DECL) +{ + TAO_NS_EventTypeSeq::CONST_ITERATOR iter (seq); + + TAO_NS_EventType* event_type; + + for (iter.first (); iter.next (event_type) != 0; iter.advance ()) + { + consumer_map_->insert (proxy_supplier, *event_type ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } +} + +void +TAO_NS_Event_Manager::un_subscribe (TAO_NS_ProxySupplier* proxy_supplier, const TAO_NS_EventTypeSeq& seq ACE_ENV_ARG_DECL) +{ + TAO_NS_EventTypeSeq::CONST_ITERATOR iter (seq); + + TAO_NS_EventType* event_type = 0; + + for (iter.first (); iter.next (event_type) != 0; iter.advance ()) + { + consumer_map_->remove (proxy_supplier, *event_type ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } +} + +void +TAO_NS_Event_Manager::publish (TAO_NS_ProxyConsumer* proxy_consumer, const TAO_NS_EventTypeSeq& seq ACE_ENV_ARG_DECL) +{ + TAO_NS_EventTypeSeq::CONST_ITERATOR iter (seq); + + TAO_NS_EventType* event_type = 0; + + for (iter.first (); iter.next (event_type) != 0; iter.advance ()) + { + supplier_map_->insert (proxy_consumer, *event_type ACE_ENV_ARG_PARAMETER); + } + +} + +void +TAO_NS_Event_Manager::un_publish (TAO_NS_ProxyConsumer* proxy_consumer, const TAO_NS_EventTypeSeq& seq ACE_ENV_ARG_DECL) +{ + TAO_NS_EventTypeSeq::CONST_ITERATOR iter (seq); + + TAO_NS_EventType* event_type = 0; + + for (iter.first (); iter.next (event_type) != 0; iter.advance ()) + { + supplier_map_->remove (proxy_consumer, *event_type ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class TAO_NS_Event_Map_T<TAO_NS_Consumer, TAO_SYNCH_RW_MUTEX>; +template class TAO_NS_Event_Map_T<TAO_NS_Supplier, TAO_SYNCH_RW_MUTEX>; + +template class TAO_NS_Event_Map_Entry_T<TAO_NS_Consumer>; +template class TAO_NS_Event_Map_Entry_T<TAO_NS_Supplier>; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +#pragma instantiate TAO_NS_Event_Map_T<TAO_NS_Consumer, TAO_SYNCH_RW_MUTEX> +#pragma instantiate TAO_NS_Event_Map_T<TAO_NS_Supplier, TAO_SYNCH_RW_MUTEX> + +#pragma instantiate TAO_NS_Event_Map_Entry_T<TAO_NS_Consumer> +#pragma instantiate TAO_NS_Event_Map_Entry_T<TAO_NS_Supplier> + +#endif /*ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event_Manager.h b/TAO/orbsvcs/orbsvcs/Notify/Event_Manager.h new file mode 100644 index 00000000000..7222344e895 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Event_Manager.h @@ -0,0 +1,76 @@ +/* -*- C++ -*- */ +/** + * @file Event_Manager.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_EVENT_MANAGER_H +#define TAO_NS_EVENT_MANAGER_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "Types.h" + +class TAO_NS_EventTypeSeq; + +/** + * @class TAO_NS_Event_Manager + * + * @brief A class that manages the Consumer and Supplier maps. + * + */ +class TAO_Notify_Export TAO_NS_Event_Manager +{ +public: + /// Constuctor + TAO_NS_Event_Manager (void); + + /// Destructor + ~TAO_NS_Event_Manager (); + + /// Init + void init (ACE_ENV_SINGLE_ARG_DECL); + + /// Subscribe <proxy_supplier> to the event type sequence list <seq>. + void subscribe (TAO_NS_ProxySupplier* proxy_supplier, const TAO_NS_EventTypeSeq& seq ACE_ENV_ARG_DECL); + + /// Unsubscribe <proxy_supplier> to the event type sequence list <seq>. + void un_subscribe (TAO_NS_ProxySupplier* proxy_supplier, const TAO_NS_EventTypeSeq& seq ACE_ENV_ARG_DECL); + + /// Subscribe <proxy_consumer> to the event type sequence list <seq>. + void publish (TAO_NS_ProxyConsumer* proxy_consumer, const TAO_NS_EventTypeSeq& seq ACE_ENV_ARG_DECL); + + /// Subscribe <proxy_consumer> to the event type sequence list <seq>. + void un_publish (TAO_NS_ProxyConsumer* proxy_consumer, const TAO_NS_EventTypeSeq& seq ACE_ENV_ARG_DECL); + + /// Map accessors. + TAO_NS_Consumer_Map* consumer_map (void); + TAO_NS_Supplier_Map* supplier_map (void); + +protected: + /// Consumer Map + TAO_NS_Consumer_Map* consumer_map_; + + /// Supplier Map + TAO_NS_Supplier_Map* supplier_map_; + + /// Cache the list that always gets events. + TAO_NS_Consumer_Collection* broadcast_list_; +}; + +#if defined (__ACE_INLINE__) +#include "Event_Manager.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_EVENT_MANAGER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event_Manager.inl b/TAO/orbsvcs/orbsvcs/Notify/Event_Manager.inl new file mode 100644 index 00000000000..848d3f4945a --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Event_Manager.inl @@ -0,0 +1,15 @@ +// $Id$ + +#include "Event_Manager.h" + +ACE_INLINE TAO_NS_Consumer_Map* +TAO_NS_Event_Manager::consumer_map (void) +{ + return consumer_map_; +} + +ACE_INLINE TAO_NS_Supplier_Map* +TAO_NS_Event_Manager::supplier_map (void) +{ + return supplier_map_; +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.cpp b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.cpp new file mode 100644 index 00000000000..9adf05f6298 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.cpp @@ -0,0 +1,176 @@ +// $Id$ + +#ifndef TAO_NS_EVENT_MAP_T_C +#define TAO_NS_EVENT_MAP_T_C + +#include "Event_Map_T.h" +#include "Properties.h" +#include "Factory.h" +#include "orbsvcs/ESF/ESF_Proxy_Collection.h" + +#if ! defined (__ACE_INLINE__) +#include "Event_Map_T.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_Event_Map_T, "$Id$") + +template <class PROXY> +TAO_NS_Event_Map_Entry_T<PROXY>::TAO_NS_Event_Map_Entry_T (void) + : collection_ (0), count_ (0) +{ +} + +template <class PROXY> +TAO_NS_Event_Map_Entry_T<PROXY>::~TAO_NS_Event_Map_Entry_T () +{ + delete collection_; +} + +template <class PROXY> void +TAO_NS_Event_Map_Entry_T<PROXY>::init (ACE_ENV_SINGLE_ARG_DECL) +{ + TAO_NS_Factory* factory = TAO_NS_PROPERTIES::instance ()->factory (); + + factory->create (collection_ ACE_ENV_ARG_PARAMETER); +} + +template <class PROXY> void +TAO_NS_Event_Map_Entry_T<PROXY>::connected (PROXY* proxy ACE_ENV_ARG_DECL) +{ + this->collection_->connected (proxy ACE_ENV_ARG_PARAMETER); + ++count_; +} + +template <class PROXY> void +TAO_NS_Event_Map_Entry_T<PROXY>::disconnected (PROXY* proxy ACE_ENV_ARG_DECL) +{ + this->collection_->disconnected (proxy ACE_ENV_ARG_PARAMETER); + --count_; +} + +/*****************************************************************************/ + +template <class PROXY, class ACE_LOCK> +TAO_NS_Event_Map_T<PROXY, ACE_LOCK>::TAO_NS_Event_Map_T (void) + :count_ (0) +{ + +} + +template <class PROXY, class ACE_LOCK> +TAO_NS_Event_Map_T<PROXY, ACE_LOCK>::~TAO_NS_Event_Map_T () +{ +} + +template <class PROXY, class ACE_LOCK> TAO_NS_Event_Map_T<PROXY, ACE_LOCK>::COLLECTION* +TAO_NS_Event_Map_T<PROXY, ACE_LOCK>::create_entry (const TAO_NS_EventType& event_type ACE_ENV_ARG_DECL) +{ + TAO_NS_Event_Map_Entry_T<PROXY>* entry; + + int result = -1; + + { + ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, 0); + + result = this->map_.find (event_type, entry); + } + + if (result == -1) + { + ACE_NEW_THROW_EX (entry, + ENTRY (), + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (0); + + entry->init (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, 0); + + if (map_.bind (event_type, entry) == -1) + ACE_THROW_RETURN (CORBA::NO_MEMORY (), 0); + } + + return entry->collection (); +} + +template <class PROXY, class ACE_LOCK> int +TAO_NS_Event_Map_T<PROXY, ACE_LOCK>::insert (PROXY* proxy, const TAO_NS_EventType& event_type ACE_ENV_ARG_DECL) +{ + TAO_NS_Event_Map_Entry_T<PROXY>* entry; + + int result = -1; + + { + ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); + + result = this->map_.find (event_type, entry); + } + + if (result == -1) + { + ACE_NEW_THROW_EX (entry, + ENTRY (), + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (-1); + + entry->init (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + entry->connected (proxy ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); + + if (map_.bind (event_type, entry) == -1) + ACE_THROW_RETURN (CORBA::NO_MEMORY (), -1); + + return ++count_; + } + else + { + entry->connected (proxy ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); + return ++count_; + } +} + +template <class PROXY, class ACE_LOCK> int +TAO_NS_Event_Map_T<PROXY, ACE_LOCK>::remove (PROXY* proxy, const TAO_NS_EventType& event_type ACE_ENV_ARG_DECL) +{ + TAO_NS_Event_Map_Entry_T<PROXY>* entry; + + int result = -1; + { + ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); + + result = this->map_.find (event_type, entry); + } + + if (result == 0) + { + entry->disconnected (proxy ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); + return --count_; + + if (entry->count () == 0) + { + /// @@TODO: Exec a strategy for removing entries. + } + } + + return -1; +} + +template <class PROXY, class ACE_LOCK> int +TAO_NS_Event_Map_T<PROXY, ACE_LOCK>::count (void) +{ + return this->count_; +} + +#endif /* TAO_NS_EVENT_MAP_T_C */ + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.h b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.h new file mode 100644 index 00000000000..4b7fd107bcd --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.h @@ -0,0 +1,128 @@ +/* -*- C++ -*- */ +/** + * @file Event_Map_T.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_EVENT_MAP_T_H +#define TAO_NS_EVENT_MAP_T_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Hash_Map_Manager.h" +#include "ace/Copy_Disabled.h" +#include "Types.h" +#include "EventType.h" + +template <class PROXY, class ACE_LOCK> class TAO_NS_Event_Map_T; + +/** + * @class TAO_NS_Event_Map_Entry_T + * + * @brief The entry stored in the event map. + * + */ +template <class PROXY> +class TAO_NS_Event_Map_Entry_T : private ACE_Copy_Disabled +{ +public: + typedef TAO_ESF_Proxy_Collection<PROXY> COLLECTION; + + /// Constructor + TAO_NS_Event_Map_Entry_T (void); + + /// Destructor + ~TAO_NS_Event_Map_Entry_T (void); + + /// Init - Allocates collection + void init (ACE_ENV_SINGLE_ARG_DECL); + + /// Connect + void connected (PROXY* proxy ACE_ENV_ARG_DECL); + + /// Disconnect + void disconnected (PROXY* proxy ACE_ENV_ARG_DECL); + + /// Collection accessor + COLLECTION* collection (void); + + /// Count accessor + int count (void); + +protected: + /// The Collection + COLLECTION* collection_; + + /// Count of PROXY's connected in the collection; + int count_; +}; + +/** + * @class TAO_NS_Event_Map_T + * + * @brief Template class for storing the collection of Proxys. + * + */ +template <class PROXY, class ACE_LOCK> +class TAO_NS_Event_Map_T +{ + typedef TAO_NS_Event_Map_Entry_T<PROXY> ENTRY; + +public: + typedef TAO_ESF_Proxy_Collection<PROXY> COLLECTION; + /// Constuctor + TAO_NS_Event_Map_T (void); + + /// Destructor + ~TAO_NS_Event_Map_T (); + + /// An entry can be precreated for an event_type. else it is created when required (during insert). + COLLECTION* create_entry (const TAO_NS_EventType& event_type ACE_ENV_ARG_DECL); + + /// Associate PROXY and event_type. returns count of PROXYs. + int insert (PROXY* proxy, const TAO_NS_EventType& event_type ACE_ENV_ARG_DECL); + + /// Remove association of PROXY and event_type. returns count of PROXYs. + int remove (PROXY* proxy, const TAO_NS_EventType& event_type ACE_ENV_ARG_DECL); + + /// Find the collection mapped mapped to the <event_type> + COLLECTION* find (const TAO_NS_EventType& event_type ACE_ENV_ARG_DECL); + + /// Access count + int count (void); + +protected: + /// The Map that stores eventtype to entry mapping. + ACE_Hash_Map_Manager <TAO_NS_EventType, ENTRY*, ACE_SYNCH_NULL_MUTEX> map_; + + /// The lock to use. + ACE_LOCK lock_; + + /// Count of items entered in the map. + int count_; +}; + +#if defined (__ACE_INLINE__) +#include "Event_Map_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "Event_Map_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Event_Map_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include "ace/post.h" +#endif /* TAO_NS_EVENT_MAP_T_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.inl b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.inl new file mode 100644 index 00000000000..9aa02f7707b --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.inl @@ -0,0 +1,28 @@ +// $Id$ + +#include "Event_Map_T.h" + +template <class PROXY> ACE_INLINE TAO_NS_Event_Map_Entry_T<PROXY>::COLLECTION* +TAO_NS_Event_Map_Entry_T<PROXY>::collection (void) +{ + return collection_; +} + +template <class PROXY> ACE_INLINE int +TAO_NS_Event_Map_Entry_T<PROXY>::count (void) +{ + return count_; +} + +template <class PROXY, class ACE_LOCK> ACE_INLINE TAO_NS_Event_Map_T<PROXY, ACE_LOCK>::COLLECTION* +TAO_NS_Event_Map_T<PROXY, ACE_LOCK>::find (const TAO_NS_EventType& event_type ACE_ENV_ARG_DECL) +{ + TAO_NS_Event_Map_Entry_T<PROXY>* entry; + + ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, 0); + + if (map_.find (event_type, entry) == 0) + return entry->collection (); + else + return 0; +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/Factory.cpp b/TAO/orbsvcs/orbsvcs/Notify/Factory.cpp new file mode 100644 index 00000000000..cb5af284a7f --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Factory.cpp @@ -0,0 +1,188 @@ +// $Id$ + +#include "Factory.h" +#include "EventChannelFactory.h" +#include "EventChannel.h" +#include "Admin.h" +#include "Proxy.h" +#include "SupplierAdmin.h" +#include "ConsumerAdmin.h" +#include "Structured/StructuredProxyPushConsumer.h" +#include "Structured/StructuredProxyPushSupplier_Tie.h" +#include "QoSAdmin.h" + +#include "orbsvcs/ESF/ESF_Proxy_List.h" +#include "orbsvcs/ESF/ESF_Copy_On_Write.h" + +#if ! defined (__ACE_INLINE__) +#include "Factory.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RN_Notify, TAO_NS_Factory, "$Id$") + + +TAO_NS_Factory::TAO_NS_Factory (void) +{ +} + +TAO_NS_Factory::~TAO_NS_Factory () +{ +} + +ACE_Lock* +TAO_NS_Factory::create_object_lock (ACE_ENV_SINGLE_ARG_DECL) +{ + ACE_Lock* lock; + ACE_NEW_THROW_EX (lock, + ACE_Lock_Adapter<TAO_SYNCH_MUTEX> (), + CORBA::NO_MEMORY ()); + return lock; +} + +void +TAO_NS_Factory::create (TAO_NS_QoSAdmin*& qos_admin ACE_ENV_SINGLE_ARG_DECL) +{ + ACE_NEW_THROW_EX (qos_admin, TAO_NS_QoSAdmin (), CORBA::NO_MEMORY ()); +} + +void +TAO_NS_Factory::create (TAO_NS_Supplier_Collection*& collection ACE_ENV_SINGLE_ARG_DECL) +{ + typedef TAO_ESF_Proxy_List<TAO_NS_ProxyConsumer>::Iterator ProxyIterator; + typedef TAO_ESF_Copy_On_Write<TAO_NS_ProxyConsumer, TAO_ESF_Proxy_List<TAO_NS_ProxyConsumer>,ProxyIterator, ACE_SYNCH> ProxyType; + + ACE_NEW_THROW_EX (collection, + ProxyType (), + CORBA::NO_MEMORY ()); +} + +void +TAO_NS_Factory::create (TAO_NS_Consumer_Collection*& collection ACE_ENV_SINGLE_ARG_DECL) +{ + typedef TAO_ESF_Proxy_List<TAO_NS_ProxySupplier>::Iterator ProxyIterator; + typedef TAO_ESF_Copy_On_Write<TAO_NS_ProxySupplier, TAO_ESF_Proxy_List<TAO_NS_ProxySupplier>,ProxyIterator, ACE_SYNCH> ProxyType; + + ACE_NEW_THROW_EX (collection, + ProxyType (), + CORBA::NO_MEMORY ()); +} + +void +TAO_NS_Factory::create (TAO_NS_EventChannel_Collection*& collection ACE_ENV_SINGLE_ARG_DECL) +{ + typedef TAO_ESF_Proxy_List<TAO_NS_EventChannel>::Iterator ProxyIterator; + typedef TAO_ESF_Copy_On_Write<TAO_NS_EventChannel, TAO_ESF_Proxy_List<TAO_NS_EventChannel>,ProxyIterator, ACE_SYNCH> ProxyType; + + ACE_NEW_THROW_EX (collection, + ProxyType (), + CORBA::NO_MEMORY ()); +} + +void +TAO_NS_Factory::create (TAO_NS_Admin_Collection*& collection ACE_ENV_SINGLE_ARG_DECL) +{ + typedef TAO_ESF_Proxy_List<TAO_NS_Admin>::Iterator ProxyIterator; + typedef TAO_ESF_Copy_On_Write<TAO_NS_Admin, TAO_ESF_Proxy_List<TAO_NS_Admin>,ProxyIterator, ACE_SYNCH> ProxyType; + + ACE_NEW_THROW_EX (collection, + ProxyType (), + CORBA::NO_MEMORY ()); +} + +void +TAO_NS_Factory::create (TAO_NS_Proxy_Collection*& collection ACE_ENV_SINGLE_ARG_DECL) +{ + typedef TAO_ESF_Proxy_List<TAO_NS_Proxy>::Iterator ProxyIterator; + typedef TAO_ESF_Copy_On_Write<TAO_NS_Proxy,TAO_ESF_Proxy_List<TAO_NS_Proxy>,ProxyIterator,ACE_SYNCH> ProxyType; + + ACE_NEW_THROW_EX (collection, + ProxyType (), + CORBA::NO_MEMORY ()); +} + +void +TAO_NS_Factory::create (TAO_NS_EventChannelFactory*& factory ACE_ENV_SINGLE_ARG_DECL) +{ + ACE_NEW_THROW_EX (factory, + TAO_NS_EventChannelFactory (), + CORBA::NO_MEMORY ()); +} + +void +TAO_NS_Factory::create (TAO_NS_EventChannel*& channel ACE_ENV_SINGLE_ARG_DECL) +{ + ACE_NEW_THROW_EX (channel, + TAO_NS_EventChannel (), + CORBA::NO_MEMORY ()); +} + + +void +TAO_NS_Factory::create (TAO_NS_SupplierAdmin*& admin ACE_ENV_SINGLE_ARG_DECL) +{ + ACE_NEW_THROW_EX (admin, + TAO_NS_SupplierAdmin (), + CORBA::NO_MEMORY ()); +} + +void +TAO_NS_Factory::create (TAO_NS_ConsumerAdmin*& admin ACE_ENV_SINGLE_ARG_DECL) +{ + ACE_NEW_THROW_EX (admin, + TAO_NS_ConsumerAdmin (), + CORBA::NO_MEMORY ()); +} + +void +TAO_NS_Factory::create (TAO_NS_StructuredProxyPushConsumer*& proxy ACE_ENV_SINGLE_ARG_DECL) +{ + ACE_NEW_THROW_EX (proxy, + TAO_NS_StructuredProxyPushConsumer (), + CORBA::NO_MEMORY ()); +} + +void +TAO_NS_Factory::create (TAO_NS_StructuredProxyPushSupplier*& proxy ACE_ENV_SINGLE_ARG_DECL) +{ + TAO_NS_StructuredProxyPushSupplier_Tie* object; + + ACE_NEW_THROW_EX (object, + TAO_NS_StructuredProxyPushSupplier_Tie (), + CORBA::NO_MEMORY ()); + proxy = object->_tied_object (); + + /// set correct callback. + proxy->destroy_callback (object); +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class TAO_NS_Container_T <TAO_NS_EventChannelFactory, TAO_NS_NULL_PARENT>; +template class TAO_NS_Container_T <TAO_NS_EventChannel, TAO_NS_EventChannelFactory>; +template class TAO_NS_Container_T <TAO_NS_Admin, TAO_NS_EventChannel>; + +template class TAO_NS_Object_T <TAO_NS_EC_NULL_PARENT>; +template class TAO_NS_Object_T <TAO_NS_EventChannelfactory>; +template class TAO_NS_Object_T <TAO_NS_EventChannel>; +template class TAO_NS_Object_T <TAO_NS_Admin>; + +template class TAO_NS_Container_T <TAO_NS_EventChannel>; +template class TAO_NS_Container_T <TAO_NS_Admin>; +template class TAO_NS_Container_T <TAO_NS_Proxy>; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +#pragma instantiate TAO_NS_Container_T <TAO_NS_EventChannelFactory, TAO_NS_NULL_PARENT> +#pragma instantiate TAO_NS_Container_T <TAO_NS_EventChannel, TAO_NS_EventChannelFactory> +#pragma instantiate TAO_NS_Container_T <TAO_NS_Admin, TAO_NS_EventChannel> + +#pragma instantiate TAO_NS_Object_T <TAO_NS_EC_NULL_PARENT> +#pragma instantiate TAO_NS_Object_T <TAO_NS_EventChannelfactory> +#pragma instantiate TAO_NS_Object_T <TAO_NS_EventChannel> +#pragma instantiate TAO_NS_Object_T <TAO_NS_Admin> + +#pragma instantiate TAO_NS_Container_T <TAO_NS_EventChannel> +#pragma instantiate TAO_NS_Container_T <TAO_NS_Admin> +#pragma instantiate TAO_NS_Container_T <TAO_NS_Proxy> + +#endif /*ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Factory.h b/TAO/orbsvcs/orbsvcs/Notify/Factory.h new file mode 100644 index 00000000000..0e80465d7fd --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Factory.h @@ -0,0 +1,89 @@ +/* -*- C++ -*- */ +/** + * @file Factory.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_FACTORY_H +#define TAO_NS_FACTORY_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/CORBA_macros.h" + +#include "Types.h" + +class ACE_Lock; +class TAO_NS_Object; +class TAO_NS_EventChannelFactory; +class TAO_NS_EventChannel; +class TAO_NS_SupplierAdmin; +class TAO_NS_StructuredProxyPushConsumer; +class TAO_NS_ConsumerAdmin; +class TAO_NS_StructuredProxyPushSupplier; +class TAO_NS_QoSAdmin; + +/** + * @class TAO_NS_Factory + * + * @brief Factory interface for creating Notify Objects. + * + */ +class TAO_Notify_Export TAO_NS_Factory +{ +public: + /// Constuctor + TAO_NS_Factory (void); + + /// Destructor + virtual ~TAO_NS_Factory (); + + /// Create Object Lock. + virtual ACE_Lock* create_object_lock (ACE_ENV_SINGLE_ARG_DECL); + + /// Create QoSAdmin + virtual void create (TAO_NS_QoSAdmin*& qos_admin ACE_ENV_SINGLE_ARG_DECL); + + /// Create Collection + virtual void create (TAO_NS_Supplier_Collection*& collection ACE_ENV_SINGLE_ARG_DECL); + virtual void create (TAO_NS_Consumer_Collection*& collection ACE_ENV_SINGLE_ARG_DECL); + + virtual void create (TAO_NS_EventChannel_Collection*& collection ACE_ENV_SINGLE_ARG_DECL); + virtual void create (TAO_NS_Admin_Collection*& collection ACE_ENV_SINGLE_ARG_DECL); + virtual void create (TAO_NS_Proxy_Collection*& collection ACE_ENV_SINGLE_ARG_DECL); + + /// Create EventChannelFactory + virtual void create (TAO_NS_EventChannelFactory*& channel_factory ACE_ENV_SINGLE_ARG_DECL); + + /// Create EventChannel + virtual void create (TAO_NS_EventChannel*& channel ACE_ENV_SINGLE_ARG_DECL); + + /// Create SupplierAdmin + virtual void create (TAO_NS_SupplierAdmin*& admin ACE_ENV_SINGLE_ARG_DECL); + + /// Create ConsumerAdmin + virtual void create (TAO_NS_ConsumerAdmin*& admin ACE_ENV_SINGLE_ARG_DECL); + + /// Create StructuredProxyPushConsumer + virtual void create (TAO_NS_StructuredProxyPushConsumer*& proxy ACE_ENV_SINGLE_ARG_DECL); + + /// Create StructuredProxyPushSupplier + virtual void create (TAO_NS_StructuredProxyPushSupplier*& proxy ACE_ENV_SINGLE_ARG_DECL); +}; + +#if defined (__ACE_INLINE__) +#include "Factory.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_FACTORY_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Factory.inl b/TAO/orbsvcs/orbsvcs/Notify/Factory.inl new file mode 100644 index 00000000000..7750f22c607 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Factory.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "Factory.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/ID_Factory.cpp b/TAO/orbsvcs/orbsvcs/Notify/ID_Factory.cpp new file mode 100644 index 00000000000..466a2ea8fb4 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/ID_Factory.cpp @@ -0,0 +1,17 @@ +// $Id$ + +#include "ID_Factory.h" + +#if ! defined (__ACE_INLINE__) +#include "ID_Factory.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_ID_Factory, "$Id$") + +TAO_NS_ID_Factory::TAO_NS_ID_Factory (void) +{ +} + +TAO_NS_ID_Factory::~TAO_NS_ID_Factory () +{ +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/ID_Factory.h b/TAO/orbsvcs/orbsvcs/Notify/ID_Factory.h new file mode 100644 index 00000000000..014516164e2 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/ID_Factory.h @@ -0,0 +1,52 @@ +/* -*- C++ -*- */ +/** + * @file ID_Factory.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_ID_FACTORY_H +#define TAO_NS_ID_FACTORY_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "Types.h" +#include "ace/Atomic_Op.h" + +/** + * @class TAO_NS_ID_Factory + * + * @brief A simple factory for generating ID's for objects created by Notify. + * + */ +class TAO_Notify_Export TAO_NS_ID_Factory +{ +public: + /// Constuctor + TAO_NS_ID_Factory (void); + + /// Destructor + ~TAO_NS_ID_Factory (); + + TAO_NS_Object_Id id (void); + +private: + ACE_Atomic_Op<TAO_SYNCH_MUTEX, TAO_NS_Object_Id> seed_; +}; + + +#if defined (__ACE_INLINE__) +#include "ID_Factory.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_ID_FACTORY_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/ID_Factory.inl b/TAO/orbsvcs/orbsvcs/Notify/ID_Factory.inl new file mode 100644 index 00000000000..59777405767 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/ID_Factory.inl @@ -0,0 +1,10 @@ +// $Id$ + +#include "ID_Factory.h" + +ACE_INLINE TAO_NS_Object_Id +TAO_NS_ID_Factory::id (void) +{ + return ++seed_; +} + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request.cpp b/TAO/orbsvcs/orbsvcs/Notify/Method_Request.cpp new file mode 100644 index 00000000000..60e7331d9f3 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request.cpp @@ -0,0 +1,19 @@ +// $Id$ + +#include "Method_Request.h" + +#if ! defined (__ACE_INLINE__) +#include "Method_Request.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_Method_Request, "$Id$") + +TAO_NS_Method_Request::TAO_NS_Method_Request (TAO_NS_Event_var& event) + :event_ (event) +{ +} + +TAO_NS_Method_Request::~TAO_NS_Method_Request () +{ +} + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request.h b/TAO/orbsvcs/orbsvcs/Notify/Method_Request.h new file mode 100644 index 00000000000..0a11976f3f4 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request.h @@ -0,0 +1,54 @@ +/* -*- C++ -*- */ +/** + * @file Method_Request.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_METHOD_REQUEST_H +#define TAO_NS_METHOD_REQUEST_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Method_Request.h" +#include "ace/Refcounted_Auto_Ptr.h" +#include "Event.h" +#include "Types.h" + +/** + * @class TAO_NS_Method_Request + * + * @brief Base class for NS method Requests + * + */ +class TAO_Notify_Export TAO_NS_Method_Request : public ACE_Method_Request +{ +public: + /// Constuctor + TAO_NS_Method_Request (TAO_NS_Event_var& event); + + /// Destructor + virtual ~TAO_NS_Method_Request (); + + /// Create a copy of this object. + virtual TAO_NS_Method_Request* copy (void) = 0; + +protected: + TAO_NS_Event_var event_; +}; + +#if defined (__ACE_INLINE__) +#include "Method_Request.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_METHOD_REQUEST_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request.inl b/TAO/orbsvcs/orbsvcs/Notify/Method_Request.inl new file mode 100644 index 00000000000..aa8cacaf7e6 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "Method_Request.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.cpp b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.cpp new file mode 100644 index 00000000000..a03c637d0ca --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.cpp @@ -0,0 +1,38 @@ +// $Id$ + +#include "Method_Request_Dispatch.h" +#include "ProxySupplier.h" +#include "Consumer.h" + +#if ! defined (__ACE_INLINE__) +#include "Method_Request_Dispatch.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_Method_Request_Dispatch, "$Id$") + +TAO_NS_Method_Request_Dispatch::TAO_NS_Method_Request_Dispatch (TAO_NS_Event_var& event, TAO_NS_ProxySupplier* proxy_supplier) + : TAO_NS_Method_Request (event), proxy_supplier_ (proxy_supplier) +{ +} + +TAO_NS_Method_Request_Dispatch::~TAO_NS_Method_Request_Dispatch () +{ +} + +TAO_NS_Method_Request* +TAO_NS_Method_Request_Dispatch::copy (void) +{ + /// @@use factory + return new TAO_NS_Method_Request_Dispatch (this->event_, this->proxy_supplier_); +} + +int +TAO_NS_Method_Request_Dispatch::call (void) +{ + ACE_DECLARE_NEW_CORBA_ENV; + + this->event_->push (this->proxy_supplier_->consumer () ACE_ENV_ARG_PARAMETER); + + return 0; +} + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.h b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.h new file mode 100644 index 00000000000..e1910460065 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.h @@ -0,0 +1,56 @@ +/* -*- C++ -*- */ +/** + * @file Method_Request_Dispatch.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_DISPATCH_METHOD_REQUEST_H +#define TAO_NS_DISPATCH_METHOD_REQUEST_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "Method_Request.h" +#include "Types.h" + +/** + * @class TAO_NS_Method_Request_Dispatch + * + * @brief Dispatchs an event to a proxy supplier. + * + */ +class TAO_Notify_Export TAO_NS_Method_Request_Dispatch : public TAO_NS_Method_Request +{ +public: + /// Constuctor + TAO_NS_Method_Request_Dispatch (TAO_NS_Event_var& event, TAO_NS_ProxySupplier* proxy_supplier); + + /// Destructor + ~TAO_NS_Method_Request_Dispatch (); + + /// Create a copy of this object. + TAO_NS_Method_Request* copy (void); + + /// Execute method. + virtual int call (void); + +private: + /// Proxy Supplier that we use. + TAO_NS_ProxySupplier* proxy_supplier_; +}; + +#if defined (__ACE_INLINE__) +#include "Method_Request_Dispatch.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_DISPATCH_METHOD_REQUEST_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.inl b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.inl new file mode 100644 index 00000000000..92e7e52c958 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "Method_Request_Dispatch.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.cpp b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.cpp new file mode 100644 index 00000000000..b925033ddc3 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.cpp @@ -0,0 +1,47 @@ +// $Id$ + +#include "Method_Request_Lookup.h" +#include "orbsvcs/ESF/ESF_Proxy_Collection.h" +#include "Event_Map_T.h" +#include "ProxySupplier.h" +#include "ProxyConsumer.h" + +#if ! defined (__ACE_INLINE__) +#include "Method_Request_Lookup.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_Method_Request_Lookup, "$Id$") + +TAO_NS_Method_Request_Lookup::TAO_NS_Method_Request_Lookup (TAO_NS_Event_var& event, TAO_NS_ProxyConsumer* proxy_consumer, TAO_NS_Consumer_Map* map) + : TAO_NS_Method_Request (event), proxy_consumer_ (proxy_consumer), map_ (map) +{ +} + +TAO_NS_Method_Request_Lookup::~TAO_NS_Method_Request_Lookup () +{ +} + +TAO_NS_Method_Request* +TAO_NS_Method_Request_Lookup::copy (void) +{ + /// @@use factory + return new TAO_NS_Method_Request_Lookup (this->event_, this->proxy_consumer_, this->map_); +} + +int +TAO_NS_Method_Request_Lookup::call (void) +{ + ACE_DECLARE_NEW_CORBA_ENV; + + TAO_NS_Consumer_Collection* consumers = map_->find (this->event_->type () ACE_ENV_ARG_PARAMETER); + + consumers->for_each (this ACE_ENV_ARG_PARAMETER); + + return 0; +} + +void +TAO_NS_Method_Request_Lookup::work (TAO_NS_ProxySupplier* proxy_supplier ACE_ENV_ARG_DECL) +{ + proxy_supplier->push (this->event_ ACE_ENV_ARG_PARAMETER); +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.h b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.h new file mode 100644 index 00000000000..85db7dbba7f --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.h @@ -0,0 +1,63 @@ +/* -*- C++ -*- */ +/** + * @file Method_Request_Lookup.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_LOOKUP_METHOD_REQUEST_H +#define TAO_NS_LOOKUP_METHOD_REQUEST_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "orbsvcs/ESF/ESF_Worker.h" +#include "Method_Request.h" +#include "Types.h" + +/** + * @class TAO_NS_Method_Request_Lookup + * + * @brief Lookup command object looks up the event type of the given event in the consumer map and send the event to each proxysupplier. + * + */ +class TAO_Notify_Export TAO_NS_Method_Request_Lookup : public TAO_NS_Method_Request, public TAO_ESF_Worker<TAO_NS_ProxySupplier> +{ +public: + /// Constuctor + TAO_NS_Method_Request_Lookup (TAO_NS_Event_var& event, TAO_NS_ProxyConsumer* proxy_consumer, TAO_NS_Consumer_Map* map); + + /// Destructor + ~TAO_NS_Method_Request_Lookup (); + + /// Create a copy of this object. + TAO_NS_Method_Request* copy (void); + + /// Execute method. + virtual int call (void); + + ///= TAO_ESF_Worker method + void work (TAO_NS_ProxySupplier* proxy_supplier ACE_ENV_ARG_DECL); + +private: + /// ProxyConsumer supplying event. + TAO_NS_ProxyConsumer* proxy_consumer_; + + /// The map of subscriptions. + TAO_NS_Consumer_Map* map_; +}; + +#if defined (__ACE_INLINE__) +#include "Method_Request_Lookup.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_LOOKUP_METHOD_REQUEST_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.inl b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.inl new file mode 100644 index 00000000000..51e3d3fa8f4 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "Method_Request_Lookup.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Shutdown.cpp b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Shutdown.cpp new file mode 100644 index 00000000000..084ac37bc93 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Shutdown.cpp @@ -0,0 +1,30 @@ +// $Id$ + +#include "Method_Request_Shutdown.h" +#include "ThreadPool_Task.h" + +#if ! defined (__ACE_INLINE__) +#include "Method_Request_Shutdown.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_Method_Request_Shutdown, "$Id$") + +TAO_NS_Method_Request_Shutdown::TAO_NS_Method_Request_Shutdown (TAO_NS_ThreadPool_Task* task) + : task_ (task) +{ +} + +TAO_NS_Method_Request_Shutdown::~TAO_NS_Method_Request_Shutdown () +{ +} + +int +TAO_NS_Method_Request_Shutdown::call (void) +{ + // Shut down the scheduler by deactivating the activation queue's + // underlying message queue - should pop all worker threads off their + // wait and they'll exit. + this->task_->msg_queue ()->deactivate (); + return -1; +} + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Shutdown.h b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Shutdown.h new file mode 100644 index 00000000000..9a35cc0b0a7 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Shutdown.h @@ -0,0 +1,54 @@ +/* -*- C++ -*- */ +/** + * @file Method_Request_Shutdown.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_METHOD_REQUEST_SHUTDOWN_H +#define TAO_NS_METHOD_REQUEST_SHUTDOWN_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Method_Request.h" + +class TAO_NS_ThreadPool_Task; + +/** + * @class TAO_NS_Method_Request_Shutdown + * + * @brief Shutdown message for the ThreadPool_Task + * + */ +class TAO_Notify_Export TAO_NS_Method_Request_Shutdown : public ACE_Method_Request +{ +public: + /// Constuctor + TAO_NS_Method_Request_Shutdown (TAO_NS_ThreadPool_Task* task); + + /// Destructor + ~TAO_NS_Method_Request_Shutdown (); + + /// Execute method. + virtual int call (void); + +private: + // Task to shutdown + TAO_NS_ThreadPool_Task* task_; +}; + +#if defined (__ACE_INLINE__) +#include "Method_Request_Shutdown.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_METHOD_REQUEST_SHUTDOWN_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Shutdown.inl b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Shutdown.inl new file mode 100644 index 00000000000..de41fb92519 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Shutdown.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "Method_Request_Shutdown.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.cpp new file mode 100644 index 00000000000..17fcc006489 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.cpp @@ -0,0 +1,90 @@ +// $Id$ + +#include "Notify_Service.h" +#include "tao/ORB_Core.h" +#include "Builder.h" +#include "Properties.h" +#include "Factory.h" + +ACE_RCSID(RT_Notify, TAO_NS_Notify_Service, "$Id$") + +TAO_NS_Notify_Service::TAO_NS_Notify_Service (void) +{ +} + +TAO_NS_Notify_Service::~TAO_NS_Notify_Service () +{ + delete factory_; + delete builder_; +} + +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) +{ + // 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->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_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); +} + +ACE_FACTORY_DEFINE (TAO_Notify, TAO_NS_Notify_Service) diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.cpp~ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.cpp~ new file mode 100644 index 00000000000..c40e7103a75 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.cpp~ @@ -0,0 +1,87 @@ +// $Id$ + +#include "Notify_Service.h" +#include "tao/ORB_Core.h" +#include "Builder.h" +#include "Properties.h" +#include "Factory.h" + +ACE_RCSID(RT_Notify, TAO_NS_Notify_Service, "$Id$") + +TAO_NS_Notify_Service::TAO_NS_Notify_Service (void) +{ + ACE_DEBUG ((LM_DEBUG, "Loading the Cos Notification Service...")); +} + +TAO_NS_Notify_Service::~TAO_NS_Notify_Service () +{ + delete factory_; + delete builder_; +} + +void +TAO_NS_Notify_Service::init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL) +{ + this->init_i (orb ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + 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_i (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL) +{ + // 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->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 ()); +} + +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); +} + +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 new file mode 100644 index 00000000000..17fc5630ec0 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.h @@ -0,0 +1,74 @@ +/* -*- C++ -*- */ +/** + * @file Notify_Service.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#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_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 (); + + /// 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); + +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); + + /// Service component for object factory operations. + TAO_NS_Factory* factory_; + + /// Service component for building NS participants. + TAO_NS_Builder* builder_; +}; + +ACE_FACTORY_DECLARE (TAO_Notify, TAO_NS_Notify_Service) + +#if defined (__ACE_INLINE__) +#include "Notify_Service.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_COSNOTIFY_SERVICE_H */ + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.inl b/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.inl new file mode 100644 index 00000000000..3a2458e4e34 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "Notify_Service.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Object.cpp b/TAO/orbsvcs/orbsvcs/Notify/Object.cpp new file mode 100644 index 00000000000..66ca453d755 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Object.cpp @@ -0,0 +1,98 @@ +// $Id$ + +#include "Object.h" +#include "Properties.h" +#include "Factory.h" +#include "POA_Helper.h" +#include "Worker_Task.h" +#include "QoSAdmin.h" +#include "tao/debug.h" + +#if ! defined (__ACE_INLINE__) +#include "Object.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_Object, "$Id$") + +TAO_NS_Object::TAO_NS_Object (void) + :event_manager_ (0), qos_admin_ (0), id_ (0), poa_ (0), worker_task_ (0), delete_worker_task_ (0) +{ + if (TAO_debug_level > 0 ) + ACE_DEBUG ((LM_DEBUG,"object:%x created\n", this )); +} + +TAO_NS_Object::~TAO_NS_Object () +{ + if (TAO_debug_level > 0 ) + ACE_DEBUG ((LM_DEBUG,"object:%x destroyed\n", this )); + + this->shutdown_worker_task (); + + delete qos_admin_; +} + +void +TAO_NS_Object::init (TAO_NS_POA_Helper* poa, TAO_NS_Worker_Task* worker_task ACE_ENV_ARG_DECL) +{ + poa_ = poa; + worker_task_ = worker_task; + + TAO_NS_Factory* factory = TAO_NS_PROPERTIES::instance ()->factory (); + factory->create (this->qos_admin_ ACE_ENV_ARG_PARAMETER); +} + +CORBA::Object_ptr +TAO_NS_Object::activate (ACE_ENV_SINGLE_ARG_DECL) +{ + return poa_->activate (this->servant (), id_ ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_Object::deactivate (ACE_ENV_SINGLE_ARG_DECL) +{ + poa_->deactivate (id_ ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_Object::shutdown (ACE_ENV_SINGLE_ARG_DECL) +{ + this->deactivate (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +CORBA::Object_ptr +TAO_NS_Object::ref (ACE_ENV_SINGLE_ARG_DECL) +{ + return poa_->id_to_reference (id_ ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_Object::shutdown_worker_task (void) +{ + /// Only do this if we are the owner. + if (delete_worker_task_ == 1) + { + this->worker_task_->shutdown (); + delete this->worker_task_; + } +} + +void +TAO_NS_Object::worker_task_own (TAO_NS_Worker_Task* worker_task) +{ + this->worker_task (worker_task); + + /// claim ownership. + delete_worker_task_ = 1; +} + +void +TAO_NS_Object::worker_task (TAO_NS_Worker_Task* worker_task) +{ + /// shutdown the current worker. + this->shutdown_worker_task (); + + this->worker_task_ = worker_task; + + delete_worker_task_ = 0; +} + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Object.h b/TAO/orbsvcs/orbsvcs/Notify/Object.h new file mode 100644 index 00000000000..474627ceb5f --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Object.h @@ -0,0 +1,108 @@ +/* -*- C++ -*- */ +/** + * @file Object.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_OBJECT_H +#define TAO_NS_OBJECT_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/corba.h" +#include "tao/PortableServer/Servant_Base.h" +#include "Types.h" + +class TAO_NS_POA_Helper; +class TAO_NS_Worker_Task; +class TAO_NS_QoSAdmin; +class TAO_NS_Event_Manager; + +/** + * @class TAO_NS_Object + * + * @brief Base Object for RT_Notify's CORBA Objects. + * + */ +class TAO_Notify_Export TAO_NS_Object +{ +public: + /// Constuctor + TAO_NS_Object (void); + + /// Destructor + virtual ~TAO_NS_Object (void); + + /// Init. + void init (TAO_NS_POA_Helper* poa, TAO_NS_Worker_Task* worker_task ACE_ENV_ARG_DECL); + + /// This Object's ID + CORBA::Long id (void); + + /// Activate + CORBA::Object_ptr activate (ACE_ENV_SINGLE_ARG_DECL); + + /// Deactivate + void deactivate (ACE_ENV_SINGLE_ARG_DECL); + + /// shutdown + virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL); + + /// Get CORBA Ref. + CORBA::Object_ptr ref (ACE_ENV_SINGLE_ARG_DECL); + + /// Get Worker Task. + TAO_NS_Worker_Task* worker_task (void); + + /// Set Worker Task. This object assume ownership of the set object. + void worker_task_own (TAO_NS_Worker_Task* worker_task); + + /// Set Worker Task. Does not assume ownership. + void worker_task (TAO_NS_Worker_Task* worker_task); + +protected: + /// Servant which we use. + virtual PortableServer::Servant servant (void) = 0; + + /// Shutdown the current worker task and delete it if we own it. + void shutdown_worker_task (void); + + ///= Protected data members. + + /// The event manager. + TAO_NS_Event_Manager* event_manager_; + + /// Administer Qos functionality. + TAO_NS_QoSAdmin* qos_admin_; + + ///=Attributes + + /// Id assigned to this object + TAO_NS_Object_Id id_; + + /// The POA in which the object is activated. + TAO_NS_POA_Helper* poa_; + + /// Worker Task. + TAO_NS_Worker_Task* worker_task_; + + /// Ownership flag + int delete_worker_task_; +}; + +#if defined (__ACE_INLINE__) +#include "Object.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_OBJECT_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Object.inl b/TAO/orbsvcs/orbsvcs/Notify/Object.inl new file mode 100644 index 00000000000..42e2e280bb6 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Object.inl @@ -0,0 +1,16 @@ +// $Id$ + +#include "Object.h" + +ACE_INLINE CORBA::Long +TAO_NS_Object::id (void) +{ + return id_; +} + +ACE_INLINE TAO_NS_Worker_Task* +TAO_NS_Object::worker_task (void) +{ + return this->worker_task_; +} + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Object_T.cpp b/TAO/orbsvcs/orbsvcs/Notify/Object_T.cpp new file mode 100644 index 00000000000..316aa64c58a --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Object_T.cpp @@ -0,0 +1,38 @@ +// $Id$ + +#ifndef TAO_NS_OBJECT_T_CPP +#define TAO_NS_OBJECT_T_CPP + +#include "Object_T.h" +#include "orbsvcs/ESF/ESF_RefCount_Guard.h" + +#if ! defined (__ACE_INLINE__) +#include "Object_T.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_Object, "$Id$") + +template <class TYPE, class PARENT> +TAO_NS_Object_T<TYPE, PARENT>::TAO_NS_Object_T (void) + :parent_ (0) +{ +} + +template <class TYPE, class PARENT> +TAO_NS_Object_T<TYPE, PARENT>::~TAO_NS_Object_T () +{ +} + +template <class TYPE, class PARENT> void +TAO_NS_Object_T<TYPE, PARENT>::destroy (TYPE *type ACE_ENV_ARG_DECL) +{ + TAO_NS_Object_RefCount_Guard guard (this->refcount_); + + this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + if (parent_) + parent_->remove (type ACE_ENV_ARG_PARAMETER); +} + +#endif /* TAO_NS_OBJECT_T_CPP */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Object_T.h b/TAO/orbsvcs/orbsvcs/Notify/Object_T.h new file mode 100644 index 00000000000..fa6b2f67f25 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Object_T.h @@ -0,0 +1,66 @@ +/* -*- C++ -*- */ +/** + * @file Object_T.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_OBJECT_T_H +#define TAO_NS_OBJECT_T_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "Object.h" +#include "Refcountable.h" + +typedef int TAO_NS_NULL_PARENT; + +/** + * @class TAO_NS_Object_T + * + * @brief Base attributes of all EC participants. + * + */ +template <class TYPE, class PARENT> +class TAO_Notify_Export TAO_NS_Object_T : public virtual TAO_NS_Object, public TAO_NS_Refcountable +{ +public: + /// Constuctor + TAO_NS_Object_T (void); + + /// Destructor + virtual ~TAO_NS_Object_T (); + + /// destroy <type> + void destroy (TYPE* type ACE_ENV_ARG_DECL); + +protected: + /// = Data Members + + /// Parent + PARENT* parent_; +}; + +#if defined (__ACE_INLINE__) +#include "Object_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "Object_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Object_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include "ace/post.h" +#endif /* TAO_NS_OBJECT_T_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Object_T.inl b/TAO/orbsvcs/orbsvcs/Notify/Object_T.inl new file mode 100644 index 00000000000..d50310e9cf1 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Object_T.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "Object_T.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.cpp b/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.cpp new file mode 100644 index 00000000000..aafdfaad997 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.cpp @@ -0,0 +1,163 @@ +// $Id$ + +#include "POA_Helper.h" +#include "tao/debug.h" + +#if ! defined (__ACE_INLINE__) +#include "POA_Helper.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_POA_Helper, "$Id$") + +TAO_NS_POA_Helper::TAO_NS_POA_Helper (void) +{ +} + +TAO_NS_POA_Helper::~TAO_NS_POA_Helper () +{ + +} + +void +TAO_NS_POA_Helper::init (PortableServer::POA_ptr parent_poa, const char* poa_name ACE_ENV_ARG_DECL) +{ + CORBA::PolicyList policy_list (2); + + this->set_policy (parent_poa, policy_list ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + this->create_i (parent_poa, poa_name, policy_list ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_POA_Helper::init (PortableServer::POA_ptr parent_poa ACE_ENV_ARG_DECL) +{ + char child_poa_name[32]; + ACE_OS_String::itoa (ACE_OS::rand (), child_poa_name, 10); + + this->init (parent_poa, child_poa_name ACE_ENV_ARG_PARAMETER); +} + + +void +TAO_NS_POA_Helper::set_policy (PortableServer::POA_ptr parent_poa, CORBA::PolicyList &policy_list ACE_ENV_ARG_DECL) +{ + policy_list.length (2); + + policy_list[0] = + parent_poa->create_id_uniqueness_policy (PortableServer::UNIQUE_ID + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + policy_list[1] = + parent_poa->create_id_assignment_policy (PortableServer::USER_ID + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + + +void +TAO_NS_POA_Helper::create_i (PortableServer::POA_ptr parent_poa, const char* poa_name, CORBA::PolicyList &policy_list ACE_ENV_ARG_DECL) +{ + PortableServer::POAManager_var manager = + parent_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + // Create the child POA. + this->poa_ = parent_poa->create_POA (poa_name, + manager.in (), + policy_list + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + /* + // Destroy the policies + for (CORBA::ULong index = 0; index < policy_list.length (); ++index) + { + policy_list[index]->destroy (); + } + */ +} + +PortableServer::ObjectId * +TAO_NS_POA_Helper::long_to_ObjectId (CORBA::Long id ACE_ENV_ARG_DECL) const +{ + // Modified code from string_to_ObjectId .. + // + + CORBA::ULong buffer_size = 4; + + // Create the buffer for the Id + CORBA::Octet *buffer = PortableServer::ObjectId::allocbuf (buffer_size); + + // Copy the contents + ACE_OS::memcpy (buffer, (char*)&id, buffer_size); + + // @@ Pradeep: TAO guarantees that Long is 4 bytes wide, but the + // standard only guarantees that it is at least 4 bytes wide. You + // may want to think about that.... + + // Create and return a new ID + PortableServer::ObjectId *obj_id = 0; + ACE_NEW_THROW_EX (obj_id, + PortableServer::ObjectId (buffer_size, + buffer_size, + buffer, + 1), + CORBA::NO_MEMORY ()); + + return obj_id; +} + +CORBA::Object_ptr +TAO_NS_POA_Helper::activate (PortableServer::Servant servant, CORBA::Long& id ACE_ENV_ARG_DECL) +{ + // Generate a new ID. + id = this->id_factory_.id (); + + // Convert CORBA::Long to ObjectId + PortableServer::ObjectId_var oid = + this->long_to_ObjectId (id ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + poa_->activate_object_with_id (oid.in (), + servant + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + return poa_->id_to_reference (oid.in () + ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_POA_Helper::deactivate (CORBA::Long id ACE_ENV_ARG_DECL) const +{ + // Convert CORBA::Long to ObjectId + PortableServer::ObjectId_var oid = + this->long_to_ObjectId (id ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + poa_->deactivate_object (oid.in () ACE_ENV_ARG_PARAMETER); +} + +CORBA::Object_ptr +TAO_NS_POA_Helper::id_to_reference (CORBA::Long id ACE_ENV_ARG_DECL) const +{ + // Convert CORBA::Long to ObjectId + PortableServer::ObjectId_var oid = + this->long_to_ObjectId (id); + + return poa_->id_to_reference (oid.in () + ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_POA_Helper::destroy (ACE_ENV_SINGLE_ARG_DECL) +{ + poa_->destroy (1,0 ACE_ENV_ARG_PARAMETER); + // The <wait_for_completion> flag = 0 +} + + + + diff --git a/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.h b/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.h new file mode 100644 index 00000000000..21e0ccd65fc --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.h @@ -0,0 +1,84 @@ +/* -*- C++ -*- */ +/** + * @file POA.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_POA_Helper_H +#define TAO_NS_POA_Helper_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Copy_Disabled.h" +#include "tao/PortableServer/PortableServer.h" +#include "ID_Factory.h" + +/** + * @class TAO_NS_POA_Helper + * + * @brief POA Abstraction. + * + */ +class TAO_Notify_Export TAO_NS_POA_Helper : private ACE_Copy_Disabled +{ +public: + /// Default Constructor + TAO_NS_POA_Helper (void); + + /// Create a new PortableServer::POA. + void init (PortableServer::POA_ptr parent_poa, const char* poa_name ACE_ENV_ARG_DECL); + + /// Create a new PortableServer::POA. The name is chosen at random. + void init (PortableServer::POA_ptr parent_poa ACE_ENV_ARG_DECL); + + /// Destructor + virtual ~TAO_NS_POA_Helper (); + + /// Get underlying POA + PortableServer::POA_ptr poa (void); + + /// Destroy underlying POA. + void destroy (ACE_ENV_SINGLE_ARG_DECL); + + /// Activate Object, the POA will assign an ID and return its value. + CORBA::Object_ptr activate (PortableServer::Servant servant, CORBA::Long& id ACE_ENV_ARG_DECL); + + /// Deactivate Object with ID + void deactivate (CORBA::Long id ACE_ENV_ARG_DECL) const; + + /// Convert ID to reference. + CORBA::Object_ptr id_to_reference (CORBA::Long id ACE_ENV_ARG_DECL) const; + +protected: + /// Set default POA policies. + virtual void set_policy (PortableServer::POA_ptr parent_poa, CORBA::PolicyList &policy_list ACE_ENV_ARG_DECL); + + /// Apply the polices and create child POA. + void create_i (PortableServer::POA_ptr parent_poa, const char* poa_name, CORBA::PolicyList &policy_list ACE_ENV_ARG_DECL); + + /// POA + PortableServer::POA_var poa_; + + /// ID Factory + TAO_NS_ID_Factory id_factory_; + + /// Convert id to ObjectID + PortableServer::ObjectId* long_to_ObjectId (CORBA::Long id ACE_ENV_ARG_DECL) const; +}; + +#if defined (__ACE_INLINE__) +#include "POA.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_POA_Helper_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.inl b/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.inl new file mode 100644 index 00000000000..0e1d6d3f893 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.inl @@ -0,0 +1,9 @@ +// $Id$ + +#include "POA_Helper.h" + +ACE_INLINE PortableServer::POA_ptr +TAO_NS_POA_Helper::poa (void) +{ + return this->poa_.in (); +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/Properties.cpp b/TAO/orbsvcs/orbsvcs/Notify/Properties.cpp new file mode 100644 index 00000000000..6b0e229a909 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Properties.cpp @@ -0,0 +1,21 @@ +// $Id$ + +#include "Properties.h" +#include "tao/debug.h" + +#if ! defined (__ACE_INLINE__) +#include "Properties.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_Properties, "$Id$") + +TAO_NS_Properties::TAO_NS_Properties (void) +{ + //ACE_DEBUG ((LM_DEBUG, "in TAO_Properties ctos %x\n", this)); +} + +TAO_NS_Properties::~TAO_NS_Properties () +{ +} + + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Properties.h b/TAO/orbsvcs/orbsvcs/Notify/Properties.h new file mode 100644 index 00000000000..d5d16fe1e5d --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Properties.h @@ -0,0 +1,94 @@ +/* -*- C++ -*- */ +/** + * @file Properties.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_PROPERTIES_H +#define TAO_NS_PROPERTIES_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Singleton.h" +#include "tao/ORB.h" +#include "tao/PortableServer/PortableServer.h" + +class TAO_NS_Factory; +class TAO_NS_Builder; + +/** + * @class TAO_NS_Properties + * + * @brief Global properties that strategize RT Notify's run-time behaviour. + * + */ +class TAO_Notify_Export TAO_NS_Properties +{ + friend class ACE_Singleton<TAO_NS_Properties, TAO_SYNCH_MUTEX>; + +public: + /// Constuctor + TAO_NS_Properties (void); + + /// Destructor + ~TAO_NS_Properties (); + + // = Property Accessors + TAO_NS_Factory* factory (void); + void factory (TAO_NS_Factory* factory); + + TAO_NS_Builder* builder (void); + void builder (TAO_NS_Builder* builder); + + CORBA::ORB_ptr orb (void); + void orb (CORBA::ORB_ptr orb); + + PortableServer::POA_ptr default_poa (void); + void default_poa (PortableServer::POA_ptr default_poa); + + long scope_policy (void); + void scope_policy (long scope_policy); + + long sched_policy (void); + void sched_policy (long sched_policy); + +protected: + /// Object Factory + TAO_NS_Factory* factory_; + + /// Object Builder + TAO_NS_Builder* builder_; + + /// ORB + CORBA::ORB_var orb_; + + // POA + PortableServer::POA_var default_poa_; + + /// Sched policy + long thr_sched_policy_; + + /// Scope policy + long thr_scope_policy_; +}; + +typedef ACE_Singleton<TAO_NS_Properties, TAO_SYNCH_MUTEX> TAO_NS_PROPERTIES; + +TAO_NOTIFY_SINGLETON_DECLARE (ACE_Singleton, TAO_NS_Properties, TAO_SYNCH_MUTEX); + +#if defined (__ACE_INLINE__) +#include "Properties.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_PROPERTIES_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Properties.inl b/TAO/orbsvcs/orbsvcs/Notify/Properties.inl new file mode 100644 index 00000000000..64b9245d23a --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Properties.inl @@ -0,0 +1,75 @@ +// $Id$ + +#include "Properties.h" + +ACE_INLINE TAO_NS_Factory* +TAO_NS_Properties::factory (void) +{ + return this->factory_; +} + +ACE_INLINE void +TAO_NS_Properties::factory (TAO_NS_Factory* factory) +{ + this->factory_ = factory; +} + +ACE_INLINE TAO_NS_Builder* +TAO_NS_Properties::builder (void) +{ + return this->builder_; +} + +ACE_INLINE void +TAO_NS_Properties::builder (TAO_NS_Builder* builder) +{ + this->builder_ = builder; +} + +ACE_INLINE CORBA::ORB_ptr +TAO_NS_Properties::orb (void) +{ + return CORBA::ORB::_duplicate (orb_.in ()); +} + +ACE_INLINE void +TAO_NS_Properties::orb (CORBA::ORB_ptr orb) +{ + orb_ = CORBA::ORB::_duplicate (orb); +} + +ACE_INLINE PortableServer::POA_ptr +TAO_NS_Properties::default_poa (void) +{ + return PortableServer::POA::_duplicate (this->default_poa_.in ()); +} + +ACE_INLINE void +TAO_NS_Properties::default_poa (PortableServer::POA_ptr default_poa) +{ + this->default_poa_ = PortableServer::POA::_duplicate (default_poa); +} + +ACE_INLINE long +TAO_NS_Properties::scope_policy (void) +{ + return thr_scope_policy_; +} + +ACE_INLINE void +TAO_NS_Properties::scope_policy (long scope_policy) +{ + thr_scope_policy_ = scope_policy; +} + +ACE_INLINE long +TAO_NS_Properties::sched_policy (void) +{ + return thr_sched_policy_; +} + +ACE_INLINE void +TAO_NS_Properties::sched_policy (long sched_policy) +{ + thr_sched_policy_ = sched_policy; +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/Proxy.cpp b/TAO/orbsvcs/orbsvcs/Notify/Proxy.cpp new file mode 100644 index 00000000000..cdbbb4572cd --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Proxy.cpp @@ -0,0 +1,83 @@ +// $Id$ + +#include "Proxy.h" +#include "Admin.h" + +#if ! defined (__ACE_INLINE__) +#include "Proxy.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_Proxy, "$Id$") + +TAO_NS_Proxy::TAO_NS_Proxy (void) +{ + // Set initial proxy mode to broadcast. + this->subscribed_types_.insert (TAO_NS_EventType::special ()); +} + + +TAO_NS_Proxy::~TAO_NS_Proxy () +{ +} + +void +TAO_NS_Proxy::preprocess (TAO_NS_EventTypeSeq& seq_added, TAO_NS_EventTypeSeq& seq_remove_seq) +{ + const TAO_NS_EventType& special = TAO_NS_EventType::special (); + + if (this->subscribed_types_.find (special) == 0) + { + if (seq_added.find (special) == 0) + { + seq_added.reset (); + seq_remove_seq.reset (); + } + else + { + this->subscribed_types_.reset (); + this->subscribed_types_.insert_seq (seq_added); + + seq_remove_seq.reset (); + seq_remove_seq.insert (special); + } + } + else + { + if (seq_added.find (special) == 0) + { + if (seq_remove_seq.find (special) == 0) + { + seq_added.reset (); + seq_remove_seq.reset (); + } + else + { + seq_remove_seq.reset (); + seq_remove_seq.insert_seq (this->subscribed_types_); + + this->subscribed_types_.reset (); + this->subscribed_types_.insert (special); + + seq_added.reset (); + seq_added.insert (special); + } + } + else + { + if (seq_remove_seq.find (special) == 0) + { + + seq_remove_seq.reset (); + seq_remove_seq.insert_seq (this->subscribed_types_); + + this->subscribed_types_.reset (); + this->subscribed_types_.insert_seq (seq_added); + } + else + { + this->subscribed_types_.insert_seq (seq_added); + this->subscribed_types_.remove_seq (seq_remove_seq); + } + } + } +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/Proxy.h b/TAO/orbsvcs/orbsvcs/Notify/Proxy.h new file mode 100644 index 00000000000..fb6c3d5e083 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Proxy.h @@ -0,0 +1,60 @@ +/* -*- C++ -*- */ +/** + * @file Proxy.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_PROXY_H +#define TAO_NS_PROXY_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "Object_T.h" +#include "EventTypeSeq.h" + +class TAO_NS_Admin; + +/** + * @class TAO_NS_Proxy + * + * @brief Base class proxy for all proxys in NS. + * + */ +class TAO_Notify_Export TAO_NS_Proxy : public TAO_NS_Object_T <TAO_NS_Proxy, TAO_NS_Admin> +{ +public: + /// Constuctor + TAO_NS_Proxy (void); + + /// Destructor + ~TAO_NS_Proxy (); + + /// Init method. + // virtual void init (ACE_ENV_SINGLE_ARG_DECL); + +protected: + typedef TAO_NS_Object_T <TAO_NS_Proxy, TAO_NS_Admin> inherited; + + /// Preprocess the types added and removed. + void preprocess (TAO_NS_EventTypeSeq& added, TAO_NS_EventTypeSeq& removed); + + /// The types that we're subscribed with the event manager. + TAO_NS_EventTypeSeq subscribed_types_; +}; + +#if defined (__ACE_INLINE__) +#include "Proxy.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_PROXY_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Proxy.inl b/TAO/orbsvcs/orbsvcs/Notify/Proxy.inl new file mode 100644 index 00000000000..30483781a8f --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Proxy.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "Proxy.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.cpp new file mode 100644 index 00000000000..33b92c42e46 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.cpp @@ -0,0 +1,66 @@ +// $Id$ + +#include "ProxyConsumer.h" +#include "Supplier.h" + +#if ! defined (__ACE_INLINE__) +#include "ProxyConsumer.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_ProxyConsumer, "$Id$") + +TAO_NS_ProxyConsumer::TAO_NS_ProxyConsumer (void) + :supplier_ (0) +{ +} + +TAO_NS_ProxyConsumer::~TAO_NS_ProxyConsumer () +{ + this->supplier_->_decr_refcnt (); +} + +void +TAO_NS_ProxyConsumer::connect (TAO_NS_Supplier *supplier ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosEventChannelAdmin::AlreadyConnected + )) +{ + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK; + + if (this->is_connected ()) + ACE_THROW (CosEventChannelAdmin::AlreadyConnected ()); + else + { + supplier_ = supplier; + + event_manager_->publish (this, this->subscribed_types_ ACE_ENV_ARG_PARAMETER); + } +} + +void +TAO_NS_ProxyConsumer::disconnect (void) +{ + event_manager_->un_publish (this, this->subscribed_types_ ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_ProxyConsumer::shutdown (ACE_ENV_SINGLE_ARG_DECL) +{ + this->disconnect (ACE_ENV_SINGLE_ARG_PARAMETER); + + this->inherited::shutdown (ACE_ENV_ARG_PARAMETER); + + //@@ inform the supplier that its disconnected? +} + +void +TAO_NS_ProxyConsumer::push (TAO_NS_Event_var &event) +{ + TAO_NS_Method_Request_Lookup request (event, this, this->event_manager_->consumer_map ()); + + this->worker_task ()->exec (request); +} + diff --git a/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.h new file mode 100644 index 00000000000..c30d800ba86 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.h @@ -0,0 +1,72 @@ +/* -*- C++ -*- */ +/** + * @file ProxyConsumer.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_PROXYCONSUMER_H +#define TAO_NS_PROXYCONSUMER_H +#include "ace/pre.h" + +#include "notify_export.h" +#include "ace/Auto_Ptr.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + + +#include "Event.h" +#include "Supplier.h" +#include "Proxy.h" +#include "orbsvcs/CosEventChannelAdminC.h" + +/** + * @class TAO_NS_ProxyConsumer + * + * @brief Base class for all types of ProxyConsumer implementations. + * + */ +class TAO_Notify_Export TAO_NS_ProxyConsumer : public TAO_NS_Proxy +{ +public: + /// Constuctor + TAO_NS_ProxyConsumer (void); + + /// Destructor + ~TAO_NS_ProxyConsumer (); + + /// Connect + void connect (TAO_NS_Supplier* supplier ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosEventChannelAdmin::AlreadyConnected + )); + + /// Disconnect + void disconnect (void); + + /// Shutdown (TAO_NS_Container_T method) + virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL); + + virtual void push (TAO_NS_Event_var &event); + +protected: + /// Return 1 if connected + int is_connected (void); + + /// The Supplier that we're connect to. + TAO_NS_Supplier* supplier_; +}; + +#if defined (__ACE_INLINE__) +#include "ProxyConsumer.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_PROXYCONSUMER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.inl b/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.inl new file mode 100644 index 00000000000..c9074028875 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.inl @@ -0,0 +1,13 @@ +// $Id$ + +#include "ProxyConsumer.h" +#include "Worker_Task.h" + +#include "Event_Manager.h" +#include "Method_Request_Lookup.h" + +ACE_INLINE int +TAO_NS_ProxyConsumer::is_connected (void) +{ + return supplier_ == 0 ? 0 : 1; +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.cpp new file mode 100644 index 00000000000..e964dff0d62 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.cpp @@ -0,0 +1,71 @@ +// $Id$ + +#include "ProxySupplier.h" +#include "Event_Manager.h" + +#if ! defined (__ACE_INLINE__) +#include "ProxySupplier.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_ProxySupplier, "$Id$") + +TAO_NS_ProxySupplier::TAO_NS_ProxySupplier (void) + :consumer_ (0) +{ +} + +TAO_NS_ProxySupplier::~TAO_NS_ProxySupplier () +{ + this->consumer_->_decr_refcnt (); +} + +void +TAO_NS_ProxySupplier::init_ps (ACE_ENV_SINGLE_ARG_DECL) +{ +} + +void +TAO_NS_ProxySupplier::connect (TAO_NS_Consumer *consumer ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosEventChannelAdmin::AlreadyConnected + )) +{ + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK; + + if (this->is_connected ()) + ACE_THROW (CosEventChannelAdmin::AlreadyConnected ()); + else + { + consumer_ = consumer; + + event_manager_->subscribe (this, this->subscribed_types_ ACE_ENV_ARG_PARAMETER); + } +} + +void +TAO_NS_ProxySupplier::disconnect (ACE_ENV_SINGLE_ARG_DECL) +{ + event_manager_->un_subscribe (this, this->subscribed_types_ ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_ProxySupplier::shutdown (ACE_ENV_SINGLE_ARG_DECL) +{ + this->disconnect (ACE_ENV_SINGLE_ARG_PARAMETER); + + this->inherited::shutdown (ACE_ENV_ARG_PARAMETER); + + //@@ inform the consumer that its disconnected? +} + +void +TAO_NS_ProxySupplier::push (TAO_NS_Event_var &event) +{ + TAO_NS_Method_Request_Dispatch request (event, this); + + this->worker_task ()->exec (request); +} + diff --git a/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.h b/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.h new file mode 100644 index 00000000000..f4ac42b09f6 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.h @@ -0,0 +1,76 @@ +/* -*- C++ -*- */ +/** + * @file ProxySupplier.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_PROXYSUPPLIER_H +#define TAO_NS_PROXYSUPPLIER_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "Event.h" +#include "Consumer.h" +#include "Proxy.h" +#include "orbsvcs/CosEventChannelAdminC.h" + +/** + * @class TAO_NS_ProxySupplier + * + * @brief Base class for all the ProxySuppliers. + * + */ +class TAO_Notify_Export TAO_NS_ProxySupplier : public TAO_NS_Proxy +{ +public: + /// Constuctor + TAO_NS_ProxySupplier (void); + + /// Destructor + virtual ~TAO_NS_ProxySupplier (); + + /// Init method. + virtual void init_ps (ACE_ENV_SINGLE_ARG_DECL); + + /// Connect + void connect (TAO_NS_Consumer* consumer ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosEventChannelAdmin::AlreadyConnected + )); + /// Disconnect + void disconnect (ACE_ENV_SINGLE_ARG_DECL); + + /// Dispatch Event to consumer + virtual void push (TAO_NS_Event_var &event); + + /// Shutdown (TAO_NS_Container_T method) + virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL); + + /// Access the Consumer + TAO_NS_Consumer* consumer (void); + +protected: + /// Return 1 if connected + int is_connected (void); + + /// The Consumer that we're connect to. + TAO_NS_Consumer* consumer_; +}; + +#if defined (__ACE_INLINE__) +#include "ProxySupplier.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_PROXYSUPPLIER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.inl b/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.inl new file mode 100644 index 00000000000..e2d63d51060 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.inl @@ -0,0 +1,18 @@ +// $Id$ + +#include "ProxySupplier.h" +//#include "Properties.h" +#include "Method_Request_Dispatch.h" +#include "Worker_Task.h" + +ACE_INLINE int +TAO_NS_ProxySupplier::is_connected (void) +{ + return consumer_ == 0 ? 0 : 1; +} + +ACE_INLINE TAO_NS_Consumer* +TAO_NS_ProxySupplier::consumer (void) +{ + return this->consumer_; +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/QoSAdmin.cpp b/TAO/orbsvcs/orbsvcs/Notify/QoSAdmin.cpp new file mode 100644 index 00000000000..6734d82d16f --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/QoSAdmin.cpp @@ -0,0 +1,38 @@ +// $Id$ + +#include "QoSAdmin.h" +#include "Container.h" +#include "ThreadPool_Task.h" + +#if ! defined (__ACE_INLINE__) +#include "QoSAdmin.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_QoSAdmin, "$Id$") + +TAO_NS_QoSAdmin::TAO_NS_QoSAdmin (void) +{ +} + +TAO_NS_QoSAdmin::~TAO_NS_QoSAdmin () +{ +} + +void +TAO_NS_QoSAdmin::apply_threadpool_qos (TAO_NS_Container* container, NotifyExt::ThreadPoolParams* tp_params ACE_ENV_ARG_DECL) +{ + // @@ TODO??: check if number of threads is 0, if so, set as reactive. + + TAO_NS_ThreadPool_Task* worker_task; + + ACE_NEW_THROW_EX (worker_task, + TAO_NS_ThreadPool_Task (), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + worker_task->init (tp_params ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + container->worker_task_own (worker_task); +} + diff --git a/TAO/orbsvcs/orbsvcs/Notify/QoSAdmin.h b/TAO/orbsvcs/orbsvcs/Notify/QoSAdmin.h new file mode 100644 index 00000000000..d00b6a52b1e --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/QoSAdmin.h @@ -0,0 +1,50 @@ +/* -*- C++ -*- */ +/** + * @file QoSAdmin.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_QOSADMIN_H +#define TAO_NS_QOSADMIN_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "orbsvcs/NotifyExtC.h" + +class TAO_NS_Container; + +/** + * @class TAO_NS_QoSAdmin + * + * @brief Admin class to manage and apply QoS parameters to the EventChannel, Admin and Proxy classes. + * + */ +class TAO_Notify_Export TAO_NS_QoSAdmin +{ +public: + /// Constuctor + TAO_NS_QoSAdmin (void); + + /// Destructor + ~TAO_NS_QoSAdmin (); + + /// Apply Threadpool QoS + virtual void apply_threadpool_qos (TAO_NS_Container* container, NotifyExt::ThreadPoolParams* tp_params ACE_ENV_ARG_DECL); +}; + +#if defined (__ACE_INLINE__) +#include "QoSAdmin.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_QOSADMIN_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/QoSAdmin.inl b/TAO/orbsvcs/orbsvcs/Notify/QoSAdmin.inl new file mode 100644 index 00000000000..fcdc349349e --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/QoSAdmin.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "QoSAdmin.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Builder.cpp b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Builder.cpp new file mode 100644 index 00000000000..8ed68dd03f1 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Builder.cpp @@ -0,0 +1,24 @@ +// $Id$ + +#include "RTCORBA_Builder.h" +#include "ace/Auto_Ptr.h" +#include "RTCORBA_POA_Helper.h" +#include "EventChannel.h" +#include "Proxy.h" +#include "Admin.h" +#include "EventChannelFactory.h" + +#if ! defined (__ACE_INLINE__) +#include "RTCORBA_Builder.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_RTCORBA_Builder, "$Id$") + +TAO_NS_RTCORBA_Builder::TAO_NS_RTCORBA_Builder (void) +{ +} + +TAO_NS_RTCORBA_Builder::~TAO_NS_RTCORBA_Builder () +{ +} + diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Builder.h b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Builder.h new file mode 100644 index 00000000000..a70b12af0cc --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Builder.h @@ -0,0 +1,45 @@ +/* -*- C++ -*- */ +/** + * @file RTCORBA_Builder.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_RTCORBA_BUILDER_H +#define TAO_NS_RTCORBA_BUILDER_H +#include "ace/pre.h" + +#include "rt_notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "Builder.h" + +/** + * @class TAO_NS_RTCORBA_Builder + * + * @brief Builder for RTCORBA specific classes. + * + */ +class TAO_RT_Notify_Export TAO_NS_RTCORBA_Builder : public TAO_NS_Builder +{ +public: + /// Constuctor + TAO_NS_RTCORBA_Builder (void); + + /// Destructor + ~TAO_NS_RTCORBA_Builder (); +}; + +#if defined (__ACE_INLINE__) +#include "RTCORBA_Builder.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_RTCORBA_BUILDER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Builder.inl b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Builder.inl new file mode 100644 index 00000000000..89c5aa485e2 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Builder.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "RTCORBA_Builder.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_EventChannel.cpp b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_EventChannel.cpp new file mode 100644 index 00000000000..53615a959cb --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_EventChannel.cpp @@ -0,0 +1,22 @@ +// $Id$ + +#include "RTCORBA_EventChannel.h" +#include "EventChannel.h" +#include "Proxy.h" +#include "Admin.h" +#include "EventChannelFactory.h" + +#if ! defined (__ACE_INLINE__) +#include "RTCORBA_EventChannel.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_RTCORBA_EventChannel, "$Id$") + +TAO_NS_RTCORBA_EventChannel::TAO_NS_RTCORBA_EventChannel (void) +{ +} + +TAO_NS_RTCORBA_EventChannel::~TAO_NS_RTCORBA_EventChannel () +{ +} + diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_EventChannel.h b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_EventChannel.h new file mode 100644 index 00000000000..c78440decc9 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_EventChannel.h @@ -0,0 +1,47 @@ +/* -*- C++ -*- */ +/** + * @file RTCORBA_EventChannel.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_RTCORBA_EVENTCHANNEL_H +#define TAO_NS_RTCORBA_EVENTCHANNEL_H +#include "ace/pre.h" + +#include "rt_notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "EventChannel.h" + + /** + * @class TAO_NS_RTCORBA_EventChannel + * + * @brief RTCORBA specific EventChannel. + * + */ +class TAO_RT_Notify_Export TAO_NS_RTCORBA_EventChannel : public TAO_NS_EventChannel +{ +public: + /// Constuctor + TAO_NS_RTCORBA_EventChannel (void); + + /// Destructor + ~TAO_NS_RTCORBA_EventChannel (); + +protected: +}; + +#if defined (__ACE_INLINE__) +#include "RTCORBA_EventChannel.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_RTCORBA_EVENTCHANNEL_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_EventChannel.inl b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_EventChannel.inl new file mode 100644 index 00000000000..298a4a0d7f8 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_EventChannel.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "RTCORBA_EventChannel.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Factory.cpp b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Factory.cpp new file mode 100644 index 00000000000..57981b3be9a --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Factory.cpp @@ -0,0 +1,62 @@ +// $Id$ + +#include "RTCORBA_Factory.h" +#include "Structured/RTCORBA_StructuredProxyPushSupplier_Tie.h" +#include "Structured/RTCORBA_StructuredProxyPushConsumer.h" +#include "RTCORBA_EventChannel.h" +#include "Admin.h" +#include "Proxy.h" +#include "RTCORBA_QoSAdmin.h" + +#if ! defined (__ACE_INLINE__) +#include "RTCORBA_Factory.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_RTCORBA_Factory, "$Id$") + +TAO_NS_RTCORBA_Factory::TAO_NS_RTCORBA_Factory (void) +{ +} + +TAO_NS_RTCORBA_Factory::~TAO_NS_RTCORBA_Factory () +{ +} + +void +TAO_NS_RTCORBA_Factory::create (TAO_NS_QoSAdmin*& qos_admin ACE_ENV_SINGLE_ARG_DECL) +{ + ACE_NEW_THROW_EX (qos_admin, TAO_NS_RTCORBA_QoSAdmin (), CORBA::NO_MEMORY ()); +} + +void +TAO_NS_RTCORBA_Factory::create (TAO_NS_EventChannel*& channel ACE_ENV_SINGLE_ARG_DECL) +{ + ACE_NEW_THROW_EX (channel, + TAO_NS_RTCORBA_EventChannel (), + CORBA::NO_MEMORY ()); +} + +void +TAO_NS_RTCORBA_Factory::create (TAO_NS_StructuredProxyPushSupplier*& proxy ACE_ENV_SINGLE_ARG_DECL) +{ + TAO_NS_RTCORBA_StructuredProxyPushSupplier_Tie* proxy_tie; + + ACE_NEW_THROW_EX (proxy_tie, + TAO_NS_RTCORBA_StructuredProxyPushSupplier_Tie (), + CORBA::NO_MEMORY ()); + proxy = proxy_tie->_tied_object (); + + /// set correct callback. + proxy->destroy_callback (proxy_tie); + +} + +void +TAO_NS_RTCORBA_Factory::create (TAO_NS_StructuredProxyPushConsumer*& proxy ACE_ENV_SINGLE_ARG_DECL) +{ + ACE_NEW_THROW_EX (proxy, + TAO_NS_RTCORBA_StructuredProxyPushConsumer (), + CORBA::NO_MEMORY ()); +} + + diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Factory.h b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Factory.h new file mode 100644 index 00000000000..bf59dfaec35 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Factory.h @@ -0,0 +1,57 @@ +/* -*- C++ -*- */ +/** + * @file RTCORBA_Factory.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_RTCORBA_FACTORY_H +#define TAO_NS_RTCORBA_FACTORY_H +#include "ace/pre.h" + +#include "rt_notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "Factory.h" + +/** + * @class TAO_NS_RTCORBA_Factory + * + * @brief The Factory for the RTCORBA aware Notify classes. + * + */ +class TAO_RT_Notify_Export TAO_NS_RTCORBA_Factory : public TAO_NS_Factory +{ +public: + /// Constuctor + TAO_NS_RTCORBA_Factory (void); + + /// Destructor + ~TAO_NS_RTCORBA_Factory (); + + /// Create QoSAdmin + virtual void create (TAO_NS_QoSAdmin*& qos_admin ACE_ENV_SINGLE_ARG_DECL); + + /// Create EventChannel + virtual void create (TAO_NS_EventChannel*& ACE_ENV_SINGLE_ARG_DECL); + + /// Create StructuredProxyPushSupplier + virtual void create (TAO_NS_StructuredProxyPushSupplier*& proxy ACE_ENV_SINGLE_ARG_DECL); + + /// Create StructuredProxyPushConsumer + virtual void create (TAO_NS_StructuredProxyPushConsumer*& proxy ACE_ENV_SINGLE_ARG_DECL); +}; + +#if defined (__ACE_INLINE__) +#include "RTCORBA_Factory.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_RTCORBA_FACTORY_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Factory.inl b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Factory.inl new file mode 100644 index 00000000000..73c842908fb --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Factory.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "RTCORBA_Factory.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Notify_Service.cpp b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Notify_Service.cpp new file mode 100644 index 00000000000..86a137e929b --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Notify_Service.cpp @@ -0,0 +1,91 @@ +// $Id$ + +#include "RTCORBA_Notify_Service.h" + +#if ! defined (__ACE_INLINE__) +#include "RTCORBA_Notify_Service.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_RTCORBA_Notify_Service, "$Id$") + +#include "Properties.h" +#include "RTCORBA_Properties.h" +#include "RTCORBA_Factory.h" +#include "RTCORBA_Builder.h" + +TAO_NS_RTCORBA_Notify_Service::TAO_NS_RTCORBA_Notify_Service (void) +{ +} + +TAO_NS_RTCORBA_Notify_Service::~TAO_NS_RTCORBA_Notify_Service () +{ +} + +void +TAO_NS_RTCORBA_Notify_Service::init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL) +{ + ACE_DEBUG ((LM_DEBUG, "Loading the Real-Time Notification Service...\n")); + + this->init_i (orb ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +void +TAO_NS_RTCORBA_Notify_Service::init_i (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL) +{ + //init the base class. + TAO_NS_Notify_Service::init_i (orb ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + TAO_NS_RTCORBA_Properties* properties = TAO_NS_RTCORBA_PROPERTIES::instance(); + + // Resolve RTORB + CORBA::Object_var object = + orb->resolve_initial_references ("RTORB" + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + RTCORBA::RTORB_var rt_orb = + RTCORBA::RTORB::_narrow (object.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + // Resolve RTCurrent + object = + orb->resolve_initial_references ("RTCurrent" + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + RTCORBA::Current_var current = + RTCORBA::Current::_narrow (object.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + /// Set the properties + properties->rt_orb (rt_orb.in ()); + properties->current (current.in ()); +} + +void +TAO_NS_RTCORBA_Notify_Service::init_factory (ACE_ENV_SINGLE_ARG_DECL) +{ + ACE_NEW_THROW_EX (this->factory_, + TAO_NS_RTCORBA_Factory (), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + TAO_NS_PROPERTIES::instance()->factory (this->factory_); +} + +void +TAO_NS_RTCORBA_Notify_Service::init_builder (ACE_ENV_SINGLE_ARG_DECL) +{ + ACE_NEW_THROW_EX (this->builder_, + TAO_NS_RTCORBA_Builder (), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + TAO_NS_PROPERTIES::instance()->builder (this->builder_); +} + +ACE_FACTORY_DEFINE (TAO_RT_Notify,TAO_NS_RTCORBA_Notify_Service) diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Notify_Service.cpp~ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Notify_Service.cpp~ new file mode 100644 index 00000000000..955ba12759f --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Notify_Service.cpp~ @@ -0,0 +1,83 @@ +// $Id$ + +#include "RTCORBA_Notify_Service.h" + +#if ! defined (__ACE_INLINE__) +#include "RTCORBA_Notify_Service.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_RTCORBA_Notify_Service, "$Id$") + +#include "Properties.h" +#include "RTCORBA_Properties.h" +#include "RTCORBA_Factory.h" +#include "RTCORBA_Builder.h" + +TAO_NS_RTCORBA_Notify_Service::TAO_NS_RTCORBA_Notify_Service (void) +{ + ACE_DEBUG ((LM_DEBUG, "Loading the Real-Time Notification Service...")); +} + +TAO_NS_RTCORBA_Notify_Service::~TAO_NS_RTCORBA_Notify_Service () +{ +} + +void +TAO_NS_RTCORBA_Notify_Service::init_i (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL) +{ + //init the base class. + TAO_NS_Notify_Service::init_i (orb ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + TAO_NS_RTCORBA_Properties* properties = TAO_NS_RTCORBA_PROPERTIES::instance(); + + // Resolve RTORB + CORBA::Object_var object = + orb->resolve_initial_references ("RTORB" + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + RTCORBA::RTORB_var rt_orb = + RTCORBA::RTORB::_narrow (object.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + // Resolve RTCurrent + object = + orb->resolve_initial_references ("RTCurrent" + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + RTCORBA::Current_var current = + RTCORBA::Current::_narrow (object.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + /// Set the properties + properties->rt_orb (rt_orb.in ()); + properties->current (current.in ()); +} + +void +TAO_NS_RTCORBA_Notify_Service::init_factory (ACE_ENV_SINGLE_ARG_DECL) +{ + ACE_NEW_THROW_EX (this->factory_, + TAO_NS_RTCORBA_Factory (), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + TAO_NS_PROPERTIES::instance()->factory (this->factory_); +} + +void +TAO_NS_RTCORBA_Notify_Service::init_builder (ACE_ENV_SINGLE_ARG_DECL) +{ + ACE_NEW_THROW_EX (this->builder_, + TAO_NS_RTCORBA_Builder (), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + TAO_NS_PROPERTIES::instance()->builder (this->builder_); +} + +ACE_FACTORY_DEFINE (TAO_RT_Notify,TAO_NS_RTCORBA_Notify_Service) diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Notify_Service.h b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Notify_Service.h new file mode 100644 index 00000000000..c4f8f9f46e4 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Notify_Service.h @@ -0,0 +1,60 @@ +/* -*- C++ -*- */ +/** + * @file RTCORBA_Notify_Service.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_RTCORBA_SERVICE_H +#define TAO_NS_RTCORBA_SERVICE_H +#include "ace/pre.h" + +#include "rt_notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "Notify_Service.h" + +/** + * @class TAO_NS_RTCORBA_Notify_Service + * + * @brief Implemetation of the TAO_NS_Service interface for RT Notification. + * + */ +class TAO_RT_Notify_Export TAO_NS_RTCORBA_Notify_Service : public TAO_NS_Notify_Service +{ +public: + /// Constuctor + TAO_NS_RTCORBA_Notify_Service (void); + + /// Destructor + ~TAO_NS_RTCORBA_Notify_Service (); + + /// Init the service. + virtual void init (CORBA::ORB_ptr orb 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); +}; + +ACE_FACTORY_DECLARE (TAO_RT_Notify,TAO_NS_RTCORBA_Notify_Service) + +#if defined (__ACE_INLINE__) +#include "RTCORBA_Notify_Service.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_RTCORBA_SERVICE_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Notify_Service.inl b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Notify_Service.inl new file mode 100644 index 00000000000..f1cc7809251 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Notify_Service.inl @@ -0,0 +1,3 @@ +// $Id$ +#include "RTCORBA_Notify_Service.h" + diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_POA_Helper.cpp b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_POA_Helper.cpp new file mode 100644 index 00000000000..3a24fc69f0e --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_POA_Helper.cpp @@ -0,0 +1,72 @@ +// $Id$ + +#include "RTCORBA_POA_Helper.h" +#include "tao/RTCORBA/RTCORBA.h" +#include "tao/debug.h" +#include "orbsvcs/NotifyExtC.h" +#include "RTCORBA_Properties.h" + +#if ! defined (__ACE_INLINE__) +#include "RTCORBA_POA_Helper.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_RTCORBA_POA_Helper, "$Id$") + +TAO_NS_RTCORBA_POA_Helper::~TAO_NS_RTCORBA_POA_Helper () +{ +} + +void +TAO_NS_RTCORBA_POA_Helper::init (PortableServer::POA_ptr parent_poa, NotifyExt::ThreadPoolParams* tp_params ACE_ENV_ARG_DECL) +{ + char child_poa_name[32]; + ACE_OS_String::itoa (ACE_OS::rand (), child_poa_name, 10); + + this->init (parent_poa, child_poa_name, tp_params ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_RTCORBA_POA_Helper::init (PortableServer::POA_ptr parent_poa, const char* poa_name, NotifyExt::ThreadPoolParams* tp_params ACE_ENV_ARG_DECL) +{ + CORBA::PolicyList policy_list (4); + + this->set_policy (parent_poa, policy_list ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + RTCORBA::RTORB_var rt_orb = TAO_NS_RTCORBA_PROPERTIES::instance ()->rt_orb (); + + policy_list.length (3); + policy_list[2] = + rt_orb->create_priority_model_policy (RTCORBA::CLIENT_PROPAGATED, + 0 + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (tp_params != 0) + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, "Creating threadpool: static threads = %d, def. prio = %d\n", tp_params->static_threads, tp_params->default_priority)); + } + + // Create the thread-pool. + RTCORBA::ThreadpoolId threadpool_id = + rt_orb->create_threadpool (tp_params->stacksize, + tp_params->static_threads, + tp_params->dynamic_threads, + tp_params->default_priority, + tp_params->allow_request_buffering, + tp_params->max_buffered_requests, + tp_params->max_request_buffer_size + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + policy_list.length (4); + policy_list[3] = + rt_orb->create_threadpool_policy (threadpool_id + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + + this->create_i (parent_poa, poa_name, policy_list ACE_ENV_ARG_PARAMETER); +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_POA_Helper.h b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_POA_Helper.h new file mode 100644 index 00000000000..4c7d9506ddb --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_POA_Helper.h @@ -0,0 +1,49 @@ +/* -*- C++ -*- */ +/** + * @file RTCORBA_POA_Helper.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_RTCORBA_POA_Helper_H +#define TAO_NS_RTCORBA_POA_Helper_H +#include "ace/pre.h" + +#include "rt_notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "POA_Helper.h" +#include "orbsvcs/NotifyExtC.h" + +/** + * @class TAO_NS_RTCORBA_POA_Helper + * + * @brief Helper for creating RT POA objects. + * + */ +class TAO_RT_Notify_Export TAO_NS_RTCORBA_POA_Helper : public TAO_NS_POA_Helper +{ +public: + /// Destructor + ~TAO_NS_RTCORBA_POA_Helper (); + + /// Create a new PortableServer::POA. + void init (PortableServer::POA_ptr parent_poa, const char* poa_name, NotifyExt::ThreadPoolParams* tp_params ACE_ENV_ARG_DECL); + + /// Create a new PortableServer::POA. The name is chosen at random. + void init (PortableServer::POA_ptr parent_poa, NotifyExt::ThreadPoolParams* tp_params ACE_ENV_ARG_DECL); +}; + +#if defined (__ACE_INLINE__) +#include "RT_POA.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_RTCORBA_POA_Helper_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_POA_Helper.inl b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_POA_Helper.inl new file mode 100644 index 00000000000..9cefb670a0c --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_POA_Helper.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "RTCORBA_POA_Helper.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Properties.cpp b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Properties.cpp new file mode 100644 index 00000000000..2e065b3565d --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Properties.cpp @@ -0,0 +1,18 @@ +// $Id$ + +#include "RTCORBA_Properties.h" + +#if ! defined (__ACE_INLINE__) +#include "RTCORBA_Properties.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_RTCORBA_Properties, "$Id$") + +TAO_NS_RTCORBA_Properties::TAO_NS_RTCORBA_Properties (void) +{ +} + +TAO_NS_RTCORBA_Properties::~TAO_NS_RTCORBA_Properties () +{ +} + diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Properties.h b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Properties.h new file mode 100644 index 00000000000..23f8a952f8a --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Properties.h @@ -0,0 +1,63 @@ +/* -*- C++ -*- */ +/** + * @file RTCORBA_Properties.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_RTCORBA_PROPERTIES_H +#define TAO_NS_RTCORBA_PROPERTIES_H +#include "ace/pre.h" + +#include "rt_notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Singleton.h" +#include "tao/RTCORBA/RTCORBA.h" + +/** + * @class TAO_NS_RTCORBA_Properties + * + * @brief RTCORBA specifc global properties are stored here. + * + */ +class TAO_RT_Notify_Export TAO_NS_RTCORBA_Properties +{ + friend class ACE_Singleton<TAO_NS_RTCORBA_Properties, TAO_SYNCH_MUTEX>; + +public: + /// Constuctor + TAO_NS_RTCORBA_Properties (void); + + /// Destructor + ~TAO_NS_RTCORBA_Properties (); + + RTCORBA::RTORB_ptr rt_orb (void); + void rt_orb (RTCORBA::RTORB_ptr rt_orb); + + RTCORBA::Current_ptr current (void); + void current (RTCORBA::Current_ptr current); + +protected: + /// RT-ORB + RTCORBA::RTORB_var rt_orb_; + + /// Current + RTCORBA::Current_var current_; +}; + +typedef ACE_Singleton<TAO_NS_RTCORBA_Properties, TAO_SYNCH_MUTEX> TAO_NS_RTCORBA_PROPERTIES; + +#if defined (__ACE_INLINE__) +#include "RTCORBA_Properties.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_RTCORBA_PROPERTIES_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Properties.inl b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Properties.inl new file mode 100644 index 00000000000..f6546b553f3 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Properties.inl @@ -0,0 +1,27 @@ +// $Id$ + +#include "RTCORBA_Properties.h" + +ACE_INLINE RTCORBA::RTORB_ptr +TAO_NS_RTCORBA_Properties::rt_orb (void) +{ + return RTCORBA::RTORB::_duplicate (rt_orb_.in ()); +} + +ACE_INLINE void +TAO_NS_RTCORBA_Properties::rt_orb (RTCORBA::RTORB_ptr rt_orb) +{ + rt_orb_ = RTCORBA::RTORB::_duplicate (rt_orb); +} + +ACE_INLINE RTCORBA::Current_ptr +TAO_NS_RTCORBA_Properties::current (void) +{ + return RTCORBA::Current::_duplicate (current_.in()); +} + +ACE_INLINE void +TAO_NS_RTCORBA_Properties::current (RTCORBA::Current_ptr current) +{ + current_ = RTCORBA::Current::_duplicate (current); +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_ProxyConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_ProxyConsumer.cpp new file mode 100644 index 00000000000..5ff7768a309 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_ProxyConsumer.cpp @@ -0,0 +1,38 @@ +// $Id$ + +#include "RTCORBA_ProxyConsumer.h" + +#include "tao/debug.h" +#include "RTCORBA_Properties.h" +#include "Method_Request_Lookup.h" +#include "Event_Manager.h" + +#if ! defined (__ACE_INLINE__) +#include "RTCORBA_ProxyConsumer.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_RTCORBA_ProxyConsumer, "$Id$") + +TAO_NS_RTCORBA_ProxyConsumer::TAO_NS_RTCORBA_ProxyConsumer (void) +{ +} + +TAO_NS_RTCORBA_ProxyConsumer::~TAO_NS_RTCORBA_ProxyConsumer () +{ +} + +void +TAO_NS_RTCORBA_ProxyConsumer::push (TAO_NS_Event_var &event) +{ + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, "(%x,%P,%t) received event priority %d\n", this, + TAO_NS_RTCORBA_PROPERTIES::instance()->current ()->the_priority ())); + + TAO_NS_Method_Request_Lookup request (event, this, this->event_manager_->consumer_map ()); + + request.call (); +} + + + + diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_ProxyConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_ProxyConsumer.h new file mode 100644 index 00000000000..e4fff9b4085 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_ProxyConsumer.h @@ -0,0 +1,48 @@ +/* -*- C++ -*- */ +/** + * @file RTCORBA_ProxyConsumer.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_RTCORBA_PROXYCONSUMER_H +#define TAO_NS_RTCORBA_PROXYCONSUMER_H +#include "ace/pre.h" + +#include "rt_notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ProxyConsumer.h" + +/** + * @class TAO_NS_RTCORBA_ProxyConsumer + * + * @brief Implements Base ProxyConsumer for RTCORBA aware consumers. + * + */ +class TAO_RT_Notify_Export TAO_NS_RTCORBA_ProxyConsumer : public virtual TAO_NS_ProxyConsumer +{ +public: + /// Constuctor + TAO_NS_RTCORBA_ProxyConsumer (void); + + /// Destructor + ~TAO_NS_RTCORBA_ProxyConsumer (); + + /// Process + virtual void push (TAO_NS_Event_var &event); +}; + +#if defined (__ACE_INLINE__) +#include "RTCORBA_ProxyConsumer.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_RTCORBA_PROXYCONSUMER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_ProxyConsumer.inl b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_ProxyConsumer.inl new file mode 100644 index 00000000000..296f9ccb0ac --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_ProxyConsumer.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "RTCORBA_ProxyConsumer.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_ProxySupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_ProxySupplier.cpp new file mode 100644 index 00000000000..a83e1404030 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_ProxySupplier.cpp @@ -0,0 +1,55 @@ +// $Id$ + +#include "RTCORBA_ProxySupplier.h" + +#include "ace/Refcounted_Auto_Ptr.h" +#include "tao/debug.h" +#include "RTCORBA_Properties.h" +#include "Event.h" +#include "Types.h" + +#if ! defined (__ACE_INLINE__) +#include "RTCORBA_ProxySupplier.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_RTCORBA_ProxySupplier, "$Id$") + +TAO_NS_RTCORBA_ProxySupplier::TAO_NS_RTCORBA_ProxySupplier (void) +{ +} + +TAO_NS_RTCORBA_ProxySupplier::~TAO_NS_RTCORBA_ProxySupplier () +{ +} + +void +TAO_NS_RTCORBA_ProxySupplier::init_ps (ACE_ENV_SINGLE_ARG_DECL) +{ + // Obtain our ref. + CORBA::Object_var obj = this->ref (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->event_forwarder_ = Notify_Internal::Event_Forwarder::_narrow (obj.in () ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_RTCORBA_ProxySupplier::push (TAO_NS_Event_var &event) +{ + event->push (this->event_forwarder_.in () ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_RTCORBA_ProxySupplier::forward (const CosNotification::StructuredEvent& event ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, "(%x,%P,%t) TAO_NS_RTCORBA_ProxySupplier::forward received event priority %d\n", this, + TAO_NS_RTCORBA_PROPERTIES::instance()->current ()->the_priority ())); + + // final dispatch to consumer + this->consumer_->push (event ACE_ENV_ARG_PARAMETER); +} + + diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_ProxySupplier.h b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_ProxySupplier.h new file mode 100644 index 00000000000..58eb08e436c --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_ProxySupplier.h @@ -0,0 +1,61 @@ +/* -*- C++ -*- */ +/** + * @file RTCORBA_ProxySupplier.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_RTCORBA_PROXYSUPPLIER_H +#define TAO_NS_RTCORBA_PROXYSUPPLIER_H +#include "ace/pre.h" + +#include "rt_notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ProxySupplier.h" + +/** + * @class TAO_NS_RTCORBA_ProxySupplier + * + * @brief ProxySupplier implementation for RTCORBA aware Suppliers. + * + */ +class TAO_RT_Notify_Export TAO_NS_RTCORBA_ProxySupplier : public virtual TAO_NS_ProxySupplier +{ +public: + /// Constuctor + TAO_NS_RTCORBA_ProxySupplier (void); + + /// Destructor + ~TAO_NS_RTCORBA_ProxySupplier (); + + /// Init method. + virtual void init_ps (ACE_ENV_SINGLE_ARG_DECL); + + /// Override TAO_NS_ProxySupplier::push + virtual void push (TAO_NS_Event_var &event); + + /// POA_Notify_Internal::Event_Forwarder method + virtual void forward (const CosNotification::StructuredEvent & event ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +private: + /// Our ref. + Notify_Internal::Event_Forwarder_var event_forwarder_; +}; + +#if defined (__ACE_INLINE__) +#include "RTCORBA_ProxySupplier.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_RTCORBA_PROXYSUPPLIER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_ProxySupplier.inl b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_ProxySupplier.inl new file mode 100644 index 00000000000..d012e5d0036 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_ProxySupplier.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "RTCORBA_ProxySupplier.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_QoSAdmin.cpp b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_QoSAdmin.cpp new file mode 100644 index 00000000000..254b0a08a28 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_QoSAdmin.cpp @@ -0,0 +1,45 @@ +// $Id$ + +#include "RTCORBA_QoSAdmin.h" +#include "RTCORBA_POA_Helper.h" +#include "Properties.h" +#include "Container.h" + +#if ! defined (__ACE_INLINE__) +#include "RTCORBA_QoSAdmin.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_RTCORBA_QoSAdmin, "$Id$") + +TAO_NS_RTCORBA_QoSAdmin::TAO_NS_RTCORBA_QoSAdmin (void) +{ +} + +TAO_NS_RTCORBA_QoSAdmin::~TAO_NS_RTCORBA_QoSAdmin () +{ +} + +void +TAO_NS_RTCORBA_QoSAdmin::apply_threadpool_qos (TAO_NS_Container* container, NotifyExt::ThreadPoolParams* tp_params ACE_ENV_ARG_DECL) +{ + TAO_NS_RTCORBA_POA_Helper* proxy_poa = 0; + + // Bootstrap EC Proxy POA + ACE_NEW_THROW_EX (proxy_poa, + TAO_NS_RTCORBA_POA_Helper (), + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (ec_ret._retn ()); + + auto_ptr<TAO_NS_POA_Helper> auto_proxy_poa (proxy_poa); + + PortableServer::POA_var default_poa = TAO_NS_PROPERTIES::instance ()->default_poa (); + + proxy_poa->init (default_poa.in (), tp_params ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + // Give ownership of proxy_poa + container->proxy_poa (proxy_poa); + + // release auto ref. + auto_proxy_poa.release (); +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_QoSAdmin.h b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_QoSAdmin.h new file mode 100644 index 00000000000..b8f6f5b1099 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_QoSAdmin.h @@ -0,0 +1,48 @@ +/* -*- C++ -*- */ +/** + * @file RTCORBA_QoSAdmin.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_RTCORBA_QOSADMIN_H +#define TAO_NS_RTCORBA_QOSADMIN_H +#include "ace/pre.h" + +#include "rt_notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "QoSAdmin.h" + +/** + * @class TAO_NS_RTCORBA_QoSAdmin + * + * @brief Admin class that manages RT Notify QoS properties. + * + */ +class TAO_RT_Notify_Export TAO_NS_RTCORBA_QoSAdmin : public TAO_NS_QoSAdmin +{ +public: + /// Constuctor + TAO_NS_RTCORBA_QoSAdmin (void); + + /// Destructor + ~TAO_NS_RTCORBA_QoSAdmin (); + + /// Apply Threadpool QoS + virtual void apply_threadpool_qos (TAO_NS_Container* container, NotifyExt::ThreadPoolParams* tp_params ACE_ENV_ARG_DECL); +}; + +#if defined (__ACE_INLINE__) +#include "RTCORBA_QoSAdmin.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_RTCORBA_QOSADMIN_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_QoSAdmin.inl b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_QoSAdmin.inl new file mode 100644 index 00000000000..8429a922539 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_QoSAdmin.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "RTCORBA_QoSAdmin.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Service.cpp~ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Service.cpp~ new file mode 100644 index 00000000000..423aa2408e1 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Service.cpp~ @@ -0,0 +1,81 @@ +// $Id$ + +#include "RTCORBA_Service.h" + +#if ! defined (__ACE_INLINE__) +#include "RTCORBA_Service.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_RTCORBA_Service, "$Id$") + +#include "Properties.h" +#include "RTCORBA_Properties.h" +#include "RTCORBA_Factory.h" +#include "RTCORBA_Builder.h" + +TAO_NS_RTCORBA_Service::TAO_NS_RTCORBA_Service (void) +{ +} + +TAO_NS_RTCORBA_Service::~TAO_NS_RTCORBA_Service () +{ +} + +void +TAO_NS_RTCORBA_Service::init_i (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL) +{ + //init the base class. + TAO_NS_Service::init_i (orb ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + TAO_NS_RTCORBA_Properties* properties = TAO_NS_RTCORBA_PROPERTIES::instance(); + + // Resolve RTORB + CORBA::Object_var object = + orb->resolve_initial_references ("RTORB" + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + RTCORBA::RTORB_var rt_orb = + RTCORBA::RTORB::_narrow (object.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + // Resolve RTCurrent + object = + orb->resolve_initial_references ("RTCurrent" + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + RTCORBA::Current_var current = + RTCORBA::Current::_narrow (object.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + /// Set the properties + properties->rt_orb (rt_orb.in ()); + properties->current (current.in ()); +} + +void +TAO_NS_RTCORBA_Service::init_factory (ACE_ENV_SINGLE_ARG_DECL) +{ + ACE_NEW_THROW_EX (this->factory_, + TAO_NS_RTCORBA_Factory (), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + TAO_NS_PROPERTIES::instance()->factory (this->factory_); +} + +void +TAO_NS_RTCORBA_Service::init_builder (ACE_ENV_SINGLE_ARG_DECL) +{ + ACE_NEW_THROW_EX (this->builder_, + TAO_NS_RTCORBA_Builder (), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + TAO_NS_PROPERTIES::instance()->builder (this->builder_); +} + diff --git a/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Service.inl~ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Service.inl~ new file mode 100644 index 00000000000..e3d4ada0708 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RTCORBA_Service.inl~ @@ -0,0 +1,3 @@ +// $Id$ +#include "RTCORBA_Service.h" + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.cpp b/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.cpp new file mode 100644 index 00000000000..494cbae2add --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.cpp @@ -0,0 +1,23 @@ +// $Id$ + +#include "Reactive_Task.h" + +#if ! defined (__ACE_INLINE__) +#include "Reactive_Task.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_Reactive_Task, "$Id$") + +TAO_NS_Reactive_Task::TAO_NS_Reactive_Task (void) +{ +} + +TAO_NS_Reactive_Task::~TAO_NS_Reactive_Task () +{ +} + +void +TAO_NS_Reactive_Task::exec (TAO_NS_Method_Request& method_request) +{ + method_request.call (); +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.h b/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.h new file mode 100644 index 00000000000..9b92292f307 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.h @@ -0,0 +1,48 @@ +/* -*- C++ -*- */ +/** + * @file Reactive_Task.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_REACTIVE_TASK_H +#define TAO_NS_REACTIVE_TASK_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "Worker_Task.h" + +/** + * @class TAO_NS_Reactive_Task + * + * @brief A reactive worker task. Simply executes the command in the caller's context. + * + */ +class TAO_Notify_Export TAO_NS_Reactive_Task : public TAO_NS_Worker_Task +{ +public: + /// Constuctor + TAO_NS_Reactive_Task (void); + + /// Destructor + ~TAO_NS_Reactive_Task (); + + /// Exec the request. + virtual void exec (TAO_NS_Method_Request& method_request); +}; + +#if defined (__ACE_INLINE__) +#include "Reactive_Task.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_REACTIVE_TASK_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.inl b/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.inl new file mode 100644 index 00000000000..d20c1cc441c --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "Reactive_Task.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Refcountable.cpp b/TAO/orbsvcs/orbsvcs/Notify/Refcountable.cpp new file mode 100644 index 00000000000..2a77a6fc0e1 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Refcountable.cpp @@ -0,0 +1,59 @@ +// $Id$ + +#include "Refcountable.h" +#include "Destroy_Callback.h" + +#include "tao/debug.h" + +#if ! defined (__ACE_INLINE__) +#include "Refcountable.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_Refcountable, "$Id$") + +TAO_NS_Refcountable::TAO_NS_Refcountable (void) + :refcount_ (1) +{ +} + +TAO_NS_Refcountable::~TAO_NS_Refcountable () +{ +} + +CORBA::ULong +TAO_NS_Refcountable::_incr_refcnt (void) +{ + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0); + if (TAO_debug_level > 0 ) + ACE_DEBUG ((LM_DEBUG,"object:%x incr refcount = %d\n", this, refcount_+1 )); + + + return this->refcount_++; +} + +CORBA::ULong +TAO_NS_Refcountable::_decr_refcnt (void) +{ + { + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0); + + if (TAO_debug_level > 0 ) + ACE_DEBUG ((LM_DEBUG,"object:%x decr refcount = %d\n", this, refcount_-1 )); + + this->refcount_--; + if (this->refcount_ != 0) + return this->refcount_; + } + + if (this->destroy_callback_ != 0) + this->destroy_callback_->release (); + + return 0; +} + +void +TAO_NS_Refcountable::destroy_callback (TAO_NS_Destroy_Callback* destroy_callback) +{ + destroy_callback_ = destroy_callback; +} + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Refcountable.h b/TAO/orbsvcs/orbsvcs/Notify/Refcountable.h new file mode 100644 index 00000000000..33dbbb22ed7 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Refcountable.h @@ -0,0 +1,66 @@ +/* -*- C++ -*- */ +/** + * @file Refcountable.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_REFCOUNTABLE_H +#define TAO_NS_REFCOUNTABLE_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Synch_T.h" +#include "tao/orbconf.h" +#include "tao/corbafwd.h" + +class TAO_NS_Destroy_Callback; + +/** + * @class TAO_NS_Refcountable + * + * @brief Thread-safe refounting, calls a Destroy_Callback when refcount falls to 0. + * + */ +class TAO_Notify_Export TAO_NS_Refcountable +{ +public: + /// Constuctor + TAO_NS_Refcountable (void); + + /// Destructor + ~TAO_NS_Refcountable (); + + /// Set the destroy callback. + void destroy_callback (TAO_NS_Destroy_Callback* destroy_callback); + + /// This method sigantures deliberately match the RefCounting methods required for ESF Proxy + CORBA::ULong _incr_refcnt (void); + CORBA::ULong _decr_refcnt (void); + +protected: + /// The reference count. + CORBA::ULong refcount_; + + /// The mutex to serialize access to state variables. + TAO_SYNCH_MUTEX lock_; + + /// The callback when refcount falls to 0. + TAO_NS_Destroy_Callback* destroy_callback_; +}; + +#if defined (__ACE_INLINE__) +#include "Refcountable.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_REFCOUNTABLE_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Refcountable.inl b/TAO/orbsvcs/orbsvcs/Notify/Refcountable.inl new file mode 100644 index 00000000000..5220e418ae5 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Refcountable.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "Refcountable.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Service.h b/TAO/orbsvcs/orbsvcs/Notify/Service.h new file mode 100644 index 00000000000..37575cef1a7 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Service.h @@ -0,0 +1,44 @@ +/* -*- C++ -*- */ +/** + * @file Service.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_SERVICE_H +#define TAO_NS_SERVICE_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Service_Config.h" +#include "orbsvcs/CosNotifyChannelAdminS.h" +#include "tao/PortableServer/PortableServer.h" + +/** + * @class TAO_NS_Service + * + * @brief Abstract ACE_Service_Object interface that is a factory for creating a Notify EventChannelFactory. + * Note that a Service creates only 1 Factory object. + * + */ +class TAO_Notify_Export TAO_NS_Service : public ACE_Service_Object +{ +public: + /// Init the service. + virtual void init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL) = 0; + + /// Create the Channel Factory. + virtual CosNotifyChannelAdmin::EventChannelFactory_ptr create (PortableServer::POA_ptr default_POA ACE_ENV_ARG_DECL) = 0; +}; + +#include "ace/post.h" +#endif /* TAO_NS_SERVICE_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushConsumer.cpp new file mode 100644 index 00000000000..7232351da5a --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushConsumer.cpp @@ -0,0 +1,21 @@ +// $Id$ + +#include "RTCORBA_StructuredProxyPushConsumer.h" +#include "ace/Refcounted_Auto_Ptr.h" +#include "StructuredEvent.h" + +#if ! defined (__ACE_INLINE__) +#include "RTCORBA_StructuredProxyPushConsumer.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_RTCORBA_StructuredProxyPushConsumer, "$Id$") + +TAO_NS_RTCORBA_StructuredProxyPushConsumer::TAO_NS_RTCORBA_StructuredProxyPushConsumer (void) +{ +} + +TAO_NS_RTCORBA_StructuredProxyPushConsumer::~TAO_NS_RTCORBA_StructuredProxyPushConsumer () +{ +} + + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushConsumer.h new file mode 100644 index 00000000000..1236821657b --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushConsumer.h @@ -0,0 +1,46 @@ +/* -*- C++ -*- */ +/** + * @file RTCORBA_StructuredProxyPushConsumer.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_RTCORBA_STRUCTUREDPROXYPUSHCONSUMER_H +#define TAO_NS_RTCORBA_STRUCTUREDPROXYPUSHCONSUMER_H +#include "ace/pre.h" + +#include "../rt_notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "StructuredProxyPushConsumer.h" +#include "../RTCORBA_ProxyConsumer.h" + +/** + * @class TAO_NS_RTCORBA_StructuredProxyPushConsumer + * + * @brief RTCORBA specific StructuredProxyPushConsumer + * + */ +class TAO_RT_Notify_Export TAO_NS_RTCORBA_StructuredProxyPushConsumer : public TAO_NS_StructuredProxyPushConsumer, public TAO_NS_RTCORBA_ProxyConsumer +{ +public: + /// Constuctor + TAO_NS_RTCORBA_StructuredProxyPushConsumer (void); + + /// Destructor + ~TAO_NS_RTCORBA_StructuredProxyPushConsumer (); +}; + +#if defined (__ACE_INLINE__) +#include "RTCORBA_StructuredProxyPushConsumer.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_RTCORBA_STRUCTUREDPROXYPUSHCONSUMER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushConsumer.inl b/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushConsumer.inl new file mode 100644 index 00000000000..cf92fc592e7 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushConsumer.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "RTCORBA_StructuredProxyPushConsumer.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier.cpp new file mode 100644 index 00000000000..ab03c690ab2 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier.cpp @@ -0,0 +1,20 @@ +// $Id$ + +#include "RTCORBA_StructuredProxyPushSupplier.h" + +#if ! defined (__ACE_INLINE__) +#include "RTCORBA_StructuredProxyPushSupplier.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_RTCORBA_StructuredProxyPushSupplier, "$Id$") + +TAO_NS_RTCORBA_StructuredProxyPushSupplier::TAO_NS_RTCORBA_StructuredProxyPushSupplier (void) +{ +} + +TAO_NS_RTCORBA_StructuredProxyPushSupplier::~TAO_NS_RTCORBA_StructuredProxyPushSupplier () +{ +} + + + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier.h new file mode 100644 index 00000000000..9fd56c31fa1 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier.h @@ -0,0 +1,51 @@ +/* -*- C++ -*- */ +/** + * @file RTCORBA_StructuredProxyPushSupplier.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_RTCORBA_STRUCTUREDPROXYPUSHSUPPLIER_H +#define TAO_NS_RTCORBA_STRUCTUREDPROXYPUSHSUPPLIER_H +#include "ace/pre.h" + +#include "../rt_notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "StructuredProxyPushSupplier.h" +#include "../RTCORBA_ProxySupplier.h" +#include "orbsvcs/Event_ForwarderS_T.h" +#include "orbsvcs/CosNotificationS_T.h" + +/** + * @class TAO_NS_RTCORBA_StructuredProxyPushSupplier + * + * @brief RTCORBA specific StructuredProxyPushSupplier + * + */ + +class TAO_RT_Notify_Export TAO_NS_RTCORBA_StructuredProxyPushSupplier : public TAO_NS_StructuredProxyPushSupplier, public TAO_NS_RTCORBA_ProxySupplier +{ +public: + /// Constuctor + TAO_NS_RTCORBA_StructuredProxyPushSupplier (void); + + /// Destructor + virtual ~TAO_NS_RTCORBA_StructuredProxyPushSupplier (); +}; + + + +#if defined (__ACE_INLINE__) +#include "RTCORBA_StructuredProxyPushSupplier.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_RTCORBA_STRUCTUREDPROXYPUSHSUPPLIER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier.inl b/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier.inl new file mode 100644 index 00000000000..b667bb40908 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "RTCORBA_StructuredProxyPushSupplier.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier_Tie.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier_Tie.cpp new file mode 100644 index 00000000000..755fb827d96 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier_Tie.cpp @@ -0,0 +1,43 @@ +// $Id$ +#include "RTCORBA_StructuredProxyPushSupplier_Tie.h" + +#if ! defined (__ACE_INLINE__) +#include "RTCORBA_StructuredProxyPushSupplier_Tie.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_RTCORBA_StructuredProxyPushSupplier_Tie, "$Id$") + +TAO_NS_RTCORBA_StructuredProxyPushSupplier_Tie::TAO_NS_RTCORBA_StructuredProxyPushSupplier_Tie (void) +: inherited (this->tied_) +{ + this->tied_.servant (this); +} + +TAO_NS_RTCORBA_StructuredProxyPushSupplier_Tie::~TAO_NS_RTCORBA_StructuredProxyPushSupplier_Tie () +{ +} + + +void +TAO_NS_RTCORBA_StructuredProxyPushSupplier_Tie::_add_ref (ACE_ENV_SINGLE_ARG_DECL) +{ + this->tied_._incr_refcnt (); +} + +void +TAO_NS_RTCORBA_StructuredProxyPushSupplier_Tie::_remove_ref (ACE_ENV_SINGLE_ARG_DECL) +{ + this->tied_._decr_refcnt (); +} + +void +TAO_NS_RTCORBA_StructuredProxyPushSupplier_Tie::release (void) +{ + delete this; + //@@ inform factory +} + + + + + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier_Tie.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier_Tie.h new file mode 100644 index 00000000000..531bddaa53c --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier_Tie.h @@ -0,0 +1,65 @@ +/* -*- C++ -*- */ +/** + * @file RTCORBA_StructuredProxyPushSupplier_Tie.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ +#ifndef TAO_NS_RTCORBA_STRUCTUREDPROXYPUSHSUPPLIER_TIE_H +#define TAO_NS_RTCORBA_STRUCTUREDPROXYPUSHSUPPLIER_TIE_H + +#include "ace/pre.h" +#include "../rt_notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/corba.h" +#include "tao/PortableServer/PortableServer.h" +#include "orbsvcs/CosNotificationC.h" +#include "orbsvcs/CosNotifyCommC.h" +#include "orbsvcs/CosNotifyChannelAdminC.h" +#include "orbsvcs/Event_ForwarderS.h" +#include "orbsvcs/Event_ForwarderS_T.h" +#include "RTCORBA_StructuredProxyPushSupplier.h" +#include "../Destroy_Callback.h" + +/** + * @class TAO_NS_RTCORBA_StructuredProxyPushSupplier_Tie + * + * @brief Tie implementation of the StructuredProxyPushSupplier + * + */ + +class TAO_RT_Notify_Export TAO_NS_RTCORBA_StructuredProxyPushSupplier_Tie : public POA_Notify_Internal::Event_Forwarder_tie <TAO_NS_RTCORBA_StructuredProxyPushSupplier>, public TAO_NS_Destroy_Callback +{ + typedef POA_Notify_Internal::Event_Forwarder_tie <TAO_NS_RTCORBA_StructuredProxyPushSupplier> inherited; +public: + /// Constuctor + TAO_NS_RTCORBA_StructuredProxyPushSupplier_Tie (void); + + /// Destructor + ~TAO_NS_RTCORBA_StructuredProxyPushSupplier_Tie (); + + /// ServantBase refcount methods. + virtual void _add_ref (ACE_ENV_SINGLE_ARG_DECL); + virtual void _remove_ref (ACE_ENV_SINGLE_ARG_DECL); + + /// TAO_NS_Destroy_Callback methods + virtual void release (void); + +private: + TAO_NS_RTCORBA_StructuredProxyPushSupplier tied_; +}; + +#if defined (__ACE_INLINE__) +#include "RTCORBA_StructuredProxyPushSupplier_Tie.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_RTCORBA_STRUCTUREDPROXYPUSHSUPPLIER_TIE_H */ + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier_Tie.inl b/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier_Tie.inl new file mode 100644 index 00000000000..6cb93c8be17 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier_Tie.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "RTCORBA_StructuredProxyPushSupplier_Tie.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredEvent.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredEvent.cpp new file mode 100644 index 00000000000..7efb3f603d0 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredEvent.cpp @@ -0,0 +1,44 @@ +// $Id$ + +#include "StructuredEvent.h" +#include "../Consumer.h" +#include "tao/debug.h" + +#if ! defined (__ACE_INLINE__) +#include "StructuredEvent.inl" +#endif /* __ACE_INLINE__ */ + + +ACE_RCSID(RT_Notify, TAO_NS_StructuredEvent, "$Id$") + +TAO_NS_StructuredEvent::TAO_NS_StructuredEvent (const CosNotification::StructuredEvent ¬ification) + : notification_ (notification), type_ (notification.header.fixed_header.event_type) +{ +} + +TAO_NS_StructuredEvent::~TAO_NS_StructuredEvent () +{ +} + +const TAO_NS_EventType& +TAO_NS_StructuredEvent::type (void) const +{ + return this->type_; +} + +void +TAO_NS_StructuredEvent::push (TAO_NS_Consumer* consumer ACE_ENV_ARG_DECL) const +{ + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, "Notify (%P|%t) - " + "TAO_Notify_StructuredEvent::do_push (" + "CosNotifyComm::StructuredPushConsumer_ptr)\n")); + + consumer->push (notification_ ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_StructuredEvent::push (Notify_Internal::Event_Forwarder_ptr forwarder ACE_ENV_ARG_DECL) +{ + forwarder->forward (notification_ ACE_ENV_ARG_PARAMETER); +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredEvent.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredEvent.h new file mode 100644 index 00000000000..6b6781ec2d6 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredEvent.h @@ -0,0 +1,62 @@ +/* -*- C++ -*- */ +/** + * @file StructuredEvent.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ +#ifndef TAO_NS_STRUCTUREDEVENT_H +#define TAO_NS_STRUCTUREDEVENT_H + +#include "ace/pre.h" +#include "../notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "../Event.h" +#include "../EventType.h" +#include "orbsvcs/CosNotificationC.h" + +/** + * @class TAO_NS_StructuredEvent + * + * @brief StructuredEvent implementation. + * + */ + +class TAO_Notify_Export TAO_NS_StructuredEvent : public TAO_NS_Event +{ +public: + /// Constuctor + TAO_NS_StructuredEvent (const CosNotification::StructuredEvent& notification); + + /// Destructor + ~TAO_NS_StructuredEvent (); + + virtual const TAO_NS_EventType& type (void) const; + + /// Push event to consumer + virtual void push (TAO_NS_Consumer* consumer ACE_ENV_ARG_DECL) const; + + /// Push event to the Event_Forwarder interface + virtual void push (Notify_Internal::Event_Forwarder_ptr forwarder ACE_ENV_ARG_DECL); +protected: + /// Structured Event + CosNotification::StructuredEvent notification_; + + /// Our type. + const TAO_NS_EventType type_; +}; + +#if defined (__ACE_INLINE__) +#include "StructuredEvent.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_STRUCTUREDEVENT_H */ + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredEvent.inl b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredEvent.inl new file mode 100644 index 00000000000..f92715e126c --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredEvent.inl @@ -0,0 +1,4 @@ +// $Id$ + +#include "StructuredEvent.h" + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.cpp new file mode 100644 index 00000000000..5d98d1195e4 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.cpp @@ -0,0 +1,249 @@ +// $Id$ + +#include "StructuredProxyPushConsumer.h" +#include "ace/Refcounted_Auto_Ptr.h" +#include "StructuredPushSupplier.h" +#include "StructuredEvent.h" +#include "../Admin.h" + +#if ! defined (__ACE_INLINE__) +#include "StructuredProxyPushConsumer.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_StructuredProxyPushConsumer, "$Id$") + +TAO_NS_StructuredProxyPushConsumer::TAO_NS_StructuredProxyPushConsumer (void) +{ +} + +TAO_NS_StructuredProxyPushConsumer::~TAO_NS_StructuredProxyPushConsumer () +{ + +} + +PortableServer::Servant +TAO_NS_StructuredProxyPushConsumer::servant (void) +{ + return this; +} + +void +TAO_NS_StructuredProxyPushConsumer::_add_ref (ACE_ENV_SINGLE_ARG_DECL) +{ + this->_incr_refcnt (); +} + +void +TAO_NS_StructuredProxyPushConsumer::_remove_ref (ACE_ENV_SINGLE_ARG_DECL) +{ + this->_decr_refcnt (); +} + +void +TAO_NS_StructuredProxyPushConsumer::release (void) +{ + delete this; + //@@ inform factory +} + +void +TAO_NS_StructuredProxyPushConsumer::connect_structured_push_supplier (CosNotifyComm::StructuredPushSupplier_ptr push_supplier ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosEventChannelAdmin::AlreadyConnected + )) +{ + // Convert Supplier to Base Type + TAO_NS_StructuredPushSupplier * supplier; + ACE_NEW_THROW_EX (supplier, + TAO_NS_StructuredPushSupplier (push_supplier), + CORBA::NO_MEMORY ()); + + supplier->destroy_callback (supplier); + + this->connect (supplier ACE_ENV_ARG_PARAMETER); +} + + +void +TAO_NS_StructuredProxyPushConsumer::push_structured_event (const CosNotification::StructuredEvent & notification ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosEventComm::Disconnected + )) +{ + // Convert + TAO_NS_Event_var event (new TAO_NS_StructuredEvent (notification)); + //this->proxy ()->push (event); + this->push (event); +} + + +::CosNotifyChannelAdmin::ProxyType TAO_NS_StructuredProxyPushConsumer::MyType ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + //Add your implementation here + return ::CosNotifyChannelAdmin::PUSH_STRUCTURED; +} + +::CosNotifyChannelAdmin::SupplierAdmin_ptr TAO_NS_StructuredProxyPushConsumer::MyAdmin ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + //Add your implementation here + return 0; +} + +::CosNotification::EventTypeSeq * TAO_NS_StructuredProxyPushConsumer::obtain_subscription_types ( + CosNotifyChannelAdmin::ObtainInfoMode mode + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + //Add your implementation here + return 0; +} + +void TAO_NS_StructuredProxyPushConsumer::validate_event_qos ( + const CosNotification::QoSProperties & required_qos, + CosNotification::NamedPropertyRangeSeq_out available_qos + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + )) + +{ + //Add your implementation here +} + +void +TAO_NS_StructuredProxyPushConsumer::disconnect_structured_push_consumer (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + this->inherited::destroy (this ACE_ENV_ARG_PARAMETER); +} + +::CosNotification::QoSProperties * TAO_NS_StructuredProxyPushConsumer::get_qos ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + //Add your implementation here + return 0; +} + +void TAO_NS_StructuredProxyPushConsumer::set_qos ( + const CosNotification::QoSProperties & qos + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + )) + +{ + //Add your implementation here +} + +void TAO_NS_StructuredProxyPushConsumer::validate_qos ( + const CosNotification::QoSProperties & required_qos, + CosNotification::NamedPropertyRangeSeq_out available_qos + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + )) + +{ + //Add your implementation here +} + +CosNotifyFilter::FilterID TAO_NS_StructuredProxyPushConsumer::add_filter ( + CosNotifyFilter::Filter_ptr new_filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + //Add your implementation here + return 0; +} + +void TAO_NS_StructuredProxyPushConsumer::remove_filter ( + CosNotifyFilter::FilterID filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyFilter::FilterNotFound + )) + +{ + //Add your implementation here +} + +::CosNotifyFilter::Filter_ptr TAO_NS_StructuredProxyPushConsumer::get_filter ( + CosNotifyFilter::FilterID filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyFilter::FilterNotFound + )) + +{ + //Add your implementation here + return 0; +} + +::CosNotifyFilter::FilterIDSeq * TAO_NS_StructuredProxyPushConsumer::get_all_filters ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + //Add your implementation here + return 0; +} + +void TAO_NS_StructuredProxyPushConsumer::remove_all_filters ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + //Add your implementation here +} + +void TAO_NS_StructuredProxyPushConsumer::offer_change ( + const CosNotification::EventTypeSeq & added, + const CosNotification::EventTypeSeq & removed + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyComm::InvalidEventType + )) + +{ + //Add your implementation here +} + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.h new file mode 100644 index 00000000000..2df2fa54ccb --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.h @@ -0,0 +1,185 @@ +/* -*- C++ -*- */ +/** + * @file StructuredProxyPushConsumer.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_STRUCTUREDPROXYPUSHCONSUMER_H +#define TAO_NS_STRUCTUREDPROXYPUSHCONSUMER_H +#include "ace/pre.h" + +#include "../notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "orbsvcs/CosNotifyChannelAdminS.h" +#include "../ProxyConsumer.h" +#include "../Destroy_Callback.h" + +/** + * @class TAO_NS_StructuredProxyPushConsumer + * + * @brief CosNotifyChannelAdmin::StructuredProxyPushConsumer implementation. + * + */ +class TAO_Notify_Export TAO_NS_StructuredProxyPushConsumer : public virtual POA_CosNotifyChannelAdmin::StructuredProxyPushConsumer, public virtual TAO_NS_ProxyConsumer, public TAO_NS_Destroy_Callback +{ + friend class TAO_NS_Builder; + +public: + /// Constuctor + TAO_NS_StructuredProxyPushConsumer (void); + + /// Destructor + ~TAO_NS_StructuredProxyPushConsumer (); + + /// Implements TAO_NS_Object::servant method. + virtual PortableServer::Servant servant (void); + + /// ServantBase refcount methods. + virtual void _add_ref (ACE_ENV_SINGLE_ARG_DECL); + virtual void _remove_ref (ACE_ENV_SINGLE_ARG_DECL); + + /// TAO_NS_Destroy_Callback methods + virtual void release (void); + +protected: + /// = Servant methods + virtual void connect_structured_push_supplier ( + CosNotifyComm::StructuredPushSupplier_ptr push_supplier + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosEventChannelAdmin::AlreadyConnected + )); + + virtual ::CosNotifyChannelAdmin::ProxyType MyType ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual ::CosNotifyChannelAdmin::SupplierAdmin_ptr MyAdmin ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual ::CosNotification::EventTypeSeq * obtain_subscription_types ( + CosNotifyChannelAdmin::ObtainInfoMode mode + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual void validate_event_qos ( + const CosNotification::QoSProperties & required_qos, + CosNotification::NamedPropertyRangeSeq_out available_qos + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + )); + + virtual void push_structured_event ( + const CosNotification::StructuredEvent & notification + ACE_ENV_ARG_DECL + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosEventComm::Disconnected + )); + + virtual void disconnect_structured_push_consumer ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual ::CosNotification::QoSProperties * get_qos ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual void set_qos ( + const CosNotification::QoSProperties & qos + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + )); + + virtual void validate_qos ( + const CosNotification::QoSProperties & required_qos, + CosNotification::NamedPropertyRangeSeq_out available_qos + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + )); + + virtual CosNotifyFilter::FilterID add_filter ( + CosNotifyFilter::Filter_ptr new_filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual void remove_filter ( + CosNotifyFilter::FilterID filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyFilter::FilterNotFound + )); + + virtual ::CosNotifyFilter::Filter_ptr get_filter ( + CosNotifyFilter::FilterID filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyFilter::FilterNotFound + )); + + virtual ::CosNotifyFilter::FilterIDSeq * get_all_filters ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual void remove_all_filters ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual void offer_change ( + const CosNotification::EventTypeSeq & added, + const CosNotification::EventTypeSeq & removed + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyComm::InvalidEventType + )); +}; + +#if defined (__ACE_INLINE__) +#include "StructuredProxyPushConsumer.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_STRUCTUREDPROXYPUSHCONSUMER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.inl b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.inl new file mode 100644 index 00000000000..0ae697976e7 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "StructuredProxyPushConsumer.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.cpp new file mode 100644 index 00000000000..43aa28e5abe --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.cpp @@ -0,0 +1,311 @@ + // $Id$ + +#include "StructuredProxyPushSupplier.h" +#include "tao/PortableServer/Servant_Base.h" + +#include "StructuredPushConsumer.h" +#include "../Event_Manager.h" +#include "../Admin.h" + +#if ! defined (__ACE_INLINE__) +#include "StructuredProxyPushSupplier.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_StructuredProxyPushSupplier, "$Id$") + +TAO_NS_StructuredProxyPushSupplier::TAO_NS_StructuredProxyPushSupplier (void) +{ +} + +TAO_NS_StructuredProxyPushSupplier::~TAO_NS_StructuredProxyPushSupplier () +{ +} + +void +TAO_NS_StructuredProxyPushSupplier::servant (PortableServer::Servant servant) +{ + servant_ = servant; +} + +PortableServer::Servant +TAO_NS_StructuredProxyPushSupplier::servant (void) +{ + return servant_; +} + +void TAO_NS_StructuredProxyPushSupplier::connect_structured_push_consumer ( + CosNotifyComm::StructuredPushConsumer_ptr push_consumer ACE_ENV_ARG_DECL + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosEventChannelAdmin::AlreadyConnected + , CosEventChannelAdmin::TypeError + )) +{ + // Convert Consumer to Base Type + TAO_NS_StructuredPushConsumer* consumer; + ACE_NEW_THROW_EX (consumer, + TAO_NS_StructuredPushConsumer (push_consumer), + CORBA::NO_MEMORY ()); + + consumer->destroy_callback (consumer); + + this->connect (consumer ACE_ENV_ARG_PARAMETER); +} + + +void TAO_NS_StructuredProxyPushSupplier::subscription_change ( + const CosNotification::EventTypeSeq & added, + const CosNotification::EventTypeSeq & removed + ACE_ENV_ARG_DECL + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyComm::InvalidEventType + )) + +{ + TAO_NS_EventTypeSeq seq_added (added); + TAO_NS_EventTypeSeq seq_removed (removed); + + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK; + + this->preprocess (seq_added, seq_removed); + + if (this->is_connected () == 1) + { + event_manager_->subscribe (this, seq_added); + event_manager_->un_subscribe (this, seq_removed); + } +} + +void TAO_NS_StructuredProxyPushSupplier::disconnect_structured_push_supplier ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + + { + this->inherited::destroy (this ACE_ENV_ARG_PARAMETER); + } + +void TAO_NS_StructuredProxyPushSupplier::suspend_connection ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::ConnectionAlreadyInactive + , CosNotifyChannelAdmin::NotConnected + )) + + { + //Add your implementation here + } + +void TAO_NS_StructuredProxyPushSupplier::resume_connection ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::ConnectionAlreadyActive + , CosNotifyChannelAdmin::NotConnected + )) + + { + //Add your implementation here + } + +::CosNotifyChannelAdmin::ProxyType TAO_NS_StructuredProxyPushSupplier::MyType ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + + { + //Add your implementation here + return ::CosNotifyChannelAdmin::PUSH_STRUCTURED; + } + +::CosNotifyChannelAdmin::ConsumerAdmin_ptr TAO_NS_StructuredProxyPushSupplier::MyAdmin ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + + { + //Add your implementation here + return 0; + } + +::CosNotifyFilter::MappingFilter_ptr TAO_NS_StructuredProxyPushSupplier::priority_filter ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + + { + //Add your implementation here + return 0; + } + +void TAO_NS_StructuredProxyPushSupplier::priority_filter ( + CosNotifyFilter::MappingFilter_ptr priority_filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + + { + //Add your implementation here + } + +::CosNotifyFilter::MappingFilter_ptr TAO_NS_StructuredProxyPushSupplier::lifetime_filter ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + + { + //Add your implementation here + return 0; + } + +void TAO_NS_StructuredProxyPushSupplier::lifetime_filter ( + CosNotifyFilter::MappingFilter_ptr lifetime_filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + + { + //Add your implementation here + } + +::CosNotification::EventTypeSeq * TAO_NS_StructuredProxyPushSupplier::obtain_offered_types ( + CosNotifyChannelAdmin::ObtainInfoMode mode + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + + { + //Add your implementation here + return 0; + } + +void TAO_NS_StructuredProxyPushSupplier::validate_event_qos ( + const CosNotification::QoSProperties & required_qos, + CosNotification::NamedPropertyRangeSeq_out available_qos + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + )) + + { + //Add your implementation here + } + +::CosNotification::QoSProperties * TAO_NS_StructuredProxyPushSupplier::get_qos ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + + { + //Add your implementation here + return 0; + } + +void TAO_NS_StructuredProxyPushSupplier::set_qos ( + const CosNotification::QoSProperties & qos + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + )) + + { + //Add your implementation here + } + +void TAO_NS_StructuredProxyPushSupplier::validate_qos ( + const CosNotification::QoSProperties & required_qos, + CosNotification::NamedPropertyRangeSeq_out available_qos + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + )) + + { + //Add your implementation here + } + +CosNotifyFilter::FilterID TAO_NS_StructuredProxyPushSupplier::add_filter ( + CosNotifyFilter::Filter_ptr new_filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + + { + //Add your implementation here + return 0; + } + +void TAO_NS_StructuredProxyPushSupplier::remove_filter ( + CosNotifyFilter::FilterID filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyFilter::FilterNotFound + )) + + { + //Add your implementation here + } + +::CosNotifyFilter::Filter_ptr TAO_NS_StructuredProxyPushSupplier::get_filter ( + CosNotifyFilter::FilterID filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyFilter::FilterNotFound + )) + + { + //Add your implementation here + return 0; + } + +::CosNotifyFilter::FilterIDSeq * TAO_NS_StructuredProxyPushSupplier::get_all_filters ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + + { + //Add your implementation here + return 0; + } + +void TAO_NS_StructuredProxyPushSupplier::remove_all_filters ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + + { + //Add your implementation here + } diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.h new file mode 100644 index 00000000000..4ac7d23658c --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.h @@ -0,0 +1,222 @@ +/* -*- C++ -*- */ +/** + * @file StructuredProxyPushSupplier.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_STRUCTUREDPROXYPUSHSUPPLIER_H +#define TAO_NS_STRUCTUREDPROXYPUSHSUPPLIER_H +#include "ace/pre.h" + +#include "../notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/PortableServer/PortableServerC.h" +#include "orbsvcs/CosNotifyChannelAdminS.h" +#include "../ProxySupplier.h" + +/** + * @class TAO_NS_StructuredProxyPushSupplier + * + * @brief Implements the CosNotifyChannelAdmin::StructuredProxyPushSupplier methods. However does not derive from it. This class is to be used by specific Tie implementations of the Notify ProxySupplier interface. + * + */ +class TAO_Notify_Export TAO_NS_StructuredProxyPushSupplier : public virtual TAO_NS_ProxySupplier +{ + friend class TAO_NS_Builder; + +public: + /// Constuctor + TAO_NS_StructuredProxyPushSupplier (void); + + /// Destructor + ~TAO_NS_StructuredProxyPushSupplier (); + + /// Set the servant. + void servant (PortableServer::Servant servant); + + /// Return servant + virtual PortableServer::Servant servant (void); + + /// = Servant methods + virtual void connect_structured_push_consumer ( + CosNotifyComm::StructuredPushConsumer_ptr push_consumer ACE_ENV_ARG_DECL + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosEventChannelAdmin::AlreadyConnected + , CosEventChannelAdmin::TypeError + )); + +virtual void suspend_connection ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::ConnectionAlreadyInactive + , CosNotifyChannelAdmin::NotConnected + )); + +virtual void resume_connection ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::ConnectionAlreadyActive + , CosNotifyChannelAdmin::NotConnected + )); + +virtual ::CosNotifyChannelAdmin::ProxyType MyType ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +virtual ::CosNotifyChannelAdmin::ConsumerAdmin_ptr MyAdmin ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +virtual ::CosNotifyFilter::MappingFilter_ptr priority_filter ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +virtual void priority_filter ( + CosNotifyFilter::MappingFilter_ptr priority_filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +virtual ::CosNotifyFilter::MappingFilter_ptr lifetime_filter ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +virtual void lifetime_filter ( + CosNotifyFilter::MappingFilter_ptr lifetime_filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +virtual ::CosNotification::EventTypeSeq * obtain_offered_types ( + CosNotifyChannelAdmin::ObtainInfoMode mode + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +virtual void validate_event_qos ( + const CosNotification::QoSProperties & required_qos, + CosNotification::NamedPropertyRangeSeq_out available_qos + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + )); + +virtual void disconnect_structured_push_supplier ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +virtual ::CosNotification::QoSProperties * get_qos ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +virtual void set_qos ( + const CosNotification::QoSProperties & qos + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + )); + +virtual void validate_qos ( + const CosNotification::QoSProperties & required_qos, + CosNotification::NamedPropertyRangeSeq_out available_qos + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + )); + +virtual CosNotifyFilter::FilterID add_filter ( + CosNotifyFilter::Filter_ptr new_filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +virtual void remove_filter ( + CosNotifyFilter::FilterID filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyFilter::FilterNotFound + )); + +virtual ::CosNotifyFilter::Filter_ptr get_filter ( + CosNotifyFilter::FilterID filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyFilter::FilterNotFound + )); + +virtual ::CosNotifyFilter::FilterIDSeq * get_all_filters ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +virtual void remove_all_filters ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +virtual void subscription_change ( + const CosNotification::EventTypeSeq & added, + const CosNotification::EventTypeSeq & removed + ACE_ENV_ARG_DECL + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyComm::InvalidEventType + )); + +protected: + PortableServer::Servant servant_; +}; + +#if defined (__ACE_INLINE__) +#include "StructuredProxyPushSupplier.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_STRUCTUREDPROXYPUSHSUPPLIER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.inl b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.inl new file mode 100644 index 00000000000..1e0efbafba2 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "StructuredProxyPushSupplier.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier_Tie.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier_Tie.cpp new file mode 100644 index 00000000000..9157f0eb7ab --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier_Tie.cpp @@ -0,0 +1,42 @@ +// $Id$ + +#include "StructuredProxyPushSupplier_Tie.h" + +#if ! defined (__ACE_INLINE__) +#include "StructuredProxyPushSupplier_Tie.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_StructuredProxyPushSupplier_Tie, "$Id$") + +TAO_NS_StructuredProxyPushSupplier_Tie::TAO_NS_StructuredProxyPushSupplier_Tie (void) + :inherited (tied_) +{ + this->tied_.servant (this); +} + +TAO_NS_StructuredProxyPushSupplier_Tie::~TAO_NS_StructuredProxyPushSupplier_Tie () +{ +} + +void +TAO_NS_StructuredProxyPushSupplier_Tie::_add_ref (ACE_ENV_SINGLE_ARG_DECL) +{ + this->tied_._incr_refcnt (); +} + +void +TAO_NS_StructuredProxyPushSupplier_Tie::_remove_ref (ACE_ENV_SINGLE_ARG_DECL) +{ + this->tied_._decr_refcnt (); +} + +void +TAO_NS_StructuredProxyPushSupplier_Tie::release (void) +{ + delete this; + //@@ inform factory +} + + + + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier_Tie.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier_Tie.h new file mode 100644 index 00000000000..ff4b129d0df --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier_Tie.h @@ -0,0 +1,60 @@ +/* -*- C++ -*- */ +/** + * @file StructuredProxyPushSupplier_Tie.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_STRUCTUREDPROXYPUSHSUPPLIER_TIE_H +#define TAO_NS_STRUCTUREDPROXYPUSHSUPPLIER_TIE_H +#include "ace/pre.h" + +#include "../notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "orbsvcs/CosNotifyChannelAdminS.h" +#include "StructuredProxyPushSupplier.h" +#include "../Destroy_Callback.h" + +/** + * @class TAO_NS_StructuredProxyPushSupplier_Tie + * + * @brief Tie implementation that implements CosNotifyChannelAdmin::StructuredProxyPushSupplier. + * + */ +class TAO_Notify_Export TAO_NS_StructuredProxyPushSupplier_Tie : public POA_CosNotifyChannelAdmin::StructuredProxyPushSupplier_tie <TAO_NS_StructuredProxyPushSupplier>, public TAO_NS_Destroy_Callback +{ + typedef POA_CosNotifyChannelAdmin::StructuredProxyPushSupplier_tie <TAO_NS_StructuredProxyPushSupplier> inherited; + +public: + /// Constuctor + TAO_NS_StructuredProxyPushSupplier_Tie (void); + + /// Destructor + ~TAO_NS_StructuredProxyPushSupplier_Tie (); + + /// ServantBase refcount methods. + virtual void _add_ref (ACE_ENV_SINGLE_ARG_DECL); + virtual void _remove_ref (ACE_ENV_SINGLE_ARG_DECL); + + /// TAO_NS_Destroy_Callback methods + virtual void release (void); + +protected: + /// The Tied object providing the required proxy functionality. + TAO_NS_StructuredProxyPushSupplier tied_; +}; + +#if defined (__ACE_INLINE__) +#include "StructuredProxyPushSupplier_Tie.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_STRUCTUREDPROXYPUSHSUPPLIER_TIE_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier_Tie.inl b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier_Tie.inl new file mode 100644 index 00000000000..31069fec8a5 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier_Tie.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "StructuredProxyPushSupplier_Tie.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.cpp new file mode 100644 index 00000000000..86f79d7dbcd --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.cpp @@ -0,0 +1,32 @@ +// $Id$ +#include "StructuredPushConsumer.h" +#include "ace/Refcounted_Auto_Ptr.h" +#include "../Event.h" + +#if ! defined (__ACE_INLINE__) +#include "StructuredPushConsumer.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_StructuredPushConsumer, "$Id$") + +TAO_NS_StructuredPushConsumer::TAO_NS_StructuredPushConsumer (CosNotifyComm::StructuredPushConsumer_ptr push_consumer) + :push_consumer_ (CosNotifyComm::StructuredPushConsumer::_duplicate (push_consumer)) +{ +} + +TAO_NS_StructuredPushConsumer::~TAO_NS_StructuredPushConsumer () +{ +} + +void +TAO_NS_StructuredPushConsumer::release (void) +{ + delete this; + //@@ inform factory +} + +void +TAO_NS_StructuredPushConsumer::push (const CosNotification::StructuredEvent & event ACE_ENV_ARG_DECL) +{ + this->push_consumer_->push_structured_event (event ACE_ENV_ARG_PARAMETER); +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.h new file mode 100644 index 00000000000..b9bc1af56f3 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.h @@ -0,0 +1,56 @@ +/* -*- C++ -*- */ +/** + * @file StructuredPushConsumer.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_STRUCTUREDPUSHCONSUMER_H +#define TAO_NS_STRUCTUREDPUSHCONSUMER_H +#include "ace/pre.h" + +#include "../notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "orbsvcs/CosNotifyCommC.h" +#include "../Consumer.h" +#include "../Destroy_Callback.h" + +/** + * @class TAO_NS_StructuredPushConsumer + * + * @brief Wrapper for the StructuredPushConsumer that connect to the EventChannel. + * + */ +class TAO_Notify_Export TAO_NS_StructuredPushConsumer : public TAO_NS_Consumer, public TAO_NS_Destroy_Callback +{ +public: + /// Constuctor + TAO_NS_StructuredPushConsumer (CosNotifyComm::StructuredPushConsumer_ptr push_consumer); + + /// Destructor + ~TAO_NS_StructuredPushConsumer (); + + /// TAO_NS_Destroy_Callback methods. + virtual void release (void); + + virtual void push (const CosNotification::StructuredEvent & event ACE_ENV_ARG_DECL); + +protected: + /// The Consumer + CosNotifyComm::StructuredPushConsumer_var push_consumer_; +}; + +#if defined (__ACE_INLINE__) +#include "StructuredPushConsumer.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_STRUCTUREDPUSHCONSUMER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.inl b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.inl new file mode 100644 index 00000000000..24e952b7ae8 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "StructuredPushConsumer.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.cpp new file mode 100644 index 00000000000..ae78d805b38 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.cpp @@ -0,0 +1,26 @@ +// $Id$ + +#include "StructuredPushSupplier.h" + +#if ! defined (__ACE_INLINE__) +#include "StructuredPushSupplier.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_StructuredPushSupplier, "$Id$") + +TAO_NS_StructuredPushSupplier::TAO_NS_StructuredPushSupplier (CosNotifyComm::StructuredPushSupplier_ptr push_supplier) + :push_supplier_ (CosNotifyComm::StructuredPushSupplier::_duplicate (push_supplier)) +{ +} + +TAO_NS_StructuredPushSupplier::~TAO_NS_StructuredPushSupplier () +{ +} + +void +TAO_NS_StructuredPushSupplier::release (void) +{ + delete this; + //@@ inform factory +} + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.h new file mode 100644 index 00000000000..8ed8893ff22 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.h @@ -0,0 +1,54 @@ +/* -*- C++ -*- */ +/** + * @file StructuredPushSupplier.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_STRUCTUREDPUSHSUPPLIER_H +#define TAO_NS_STRUCTUREDPUSHSUPPLIER_H +#include "ace/pre.h" + +#include "../notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "orbsvcs/CosNotifyCommC.h" +#include "../Supplier.h" +#include "../Destroy_Callback.h" + +/** + * @class TAO_NS_StructuredPushSupplier + * + * @brief Wrapper for the StructuredPushSupplier that connect to the EventChannel. + * + */ +class TAO_Notify_Export TAO_NS_StructuredPushSupplier : public TAO_NS_Supplier, public TAO_NS_Destroy_Callback +{ +public: + /// Constuctor + TAO_NS_StructuredPushSupplier (CosNotifyComm::StructuredPushSupplier_ptr push_supplier); + + /// Destructor + ~TAO_NS_StructuredPushSupplier (); + + /// TAO_NS_Destroy_Callback methods + virtual void release (void); + +protected: + /// The Supplier + CosNotifyComm::StructuredPushSupplier_var push_supplier_; +}; + +#if defined (__ACE_INLINE__) +#include "StructuredPushSupplier.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_STRUCTUREDPUSHSUPPLIER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.inl b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.inl new file mode 100644 index 00000000000..12cb29daaef --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "StructuredPushSupplier.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Supplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Supplier.cpp new file mode 100644 index 00000000000..b23749d29e8 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Supplier.cpp @@ -0,0 +1,18 @@ +// $Id$ + +#include "Supplier.h" + +#if ! defined (__ACE_INLINE__) +#include "Supplier.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_Supplier, "$Id$") + +TAO_NS_Supplier::TAO_NS_Supplier (void) +{ +} + +TAO_NS_Supplier::~TAO_NS_Supplier () +{ +} + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Supplier.h b/TAO/orbsvcs/orbsvcs/Notify/Supplier.h new file mode 100644 index 00000000000..2b07529eb5f --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Supplier.h @@ -0,0 +1,45 @@ +/* -*- C++ -*- */ +/** + * @file Supplier.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_SUPPLIER_H +#define TAO_NS_SUPPLIER_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "Refcountable.h" + +/** + * @class TAO_NS_Supplier + * + * @brief Base Wrappers for Suppliers that connect to the EventChannel. + * + */ +class TAO_Notify_Export TAO_NS_Supplier : public TAO_NS_Refcountable +{ +public: + /// Constuctor + TAO_NS_Supplier (void); + + /// Destructor + ~TAO_NS_Supplier (); +}; + +#if defined (__ACE_INLINE__) +#include "Supplier.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_SUPPLIER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Supplier.inl b/TAO/orbsvcs/orbsvcs/Notify/Supplier.inl new file mode 100644 index 00000000000..bdc8354606e --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Supplier.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "Supplier.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/SupplierAdmin.cpp b/TAO/orbsvcs/orbsvcs/Notify/SupplierAdmin.cpp new file mode 100644 index 00000000000..5ac0fc97ae3 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/SupplierAdmin.cpp @@ -0,0 +1,296 @@ +// $Id$ + +#include "SupplierAdmin.h" +#include "Builder.h" +#include "Proxy.h" +#include "EventChannel.h" +#include "orbsvcs/ESF/ESF_Proxy_Collection.h" + +#if ! defined (__ACE_INLINE__) +#include "SupplierAdmin.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_SupplierAdmin, "$Id$") + +TAO_NS_SupplierAdmin::TAO_NS_SupplierAdmin (void) +{ +} + +TAO_NS_SupplierAdmin::~TAO_NS_SupplierAdmin () +{ +} + + +PortableServer::Servant +TAO_NS_SupplierAdmin::servant (void) +{ + return this; +} + +void +TAO_NS_SupplierAdmin::_add_ref (ACE_ENV_SINGLE_ARG_DECL) +{ + this->_incr_refcnt (); +} + +void +TAO_NS_SupplierAdmin::_remove_ref (ACE_ENV_SINGLE_ARG_DECL) +{ + this->_decr_refcnt (); +} + +void +TAO_NS_SupplierAdmin::release (void) +{ + delete this; + //@@ inform factory +} + +void +TAO_NS_SupplierAdmin::set (CosNotifyChannelAdmin::InterFilterGroupOperator op ACE_ENV_ARG_DECL) +{ +} + +void +TAO_NS_SupplierAdmin::destroy (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + this->inherited::destroy (this ACE_ENV_ARG_PARAMETER); +} + +CosNotifyChannelAdmin::ProxyConsumer_ptr +TAO_NS_SupplierAdmin::obtain_notification_push_consumer (CosNotifyChannelAdmin::ClientType ctype, CosNotifyChannelAdmin::ProxyID_out proxy_id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::AdminLimitExceeded + )) + +{ + return TAO_NS_PROPERTIES::instance()->builder ()->build_notification_push_consumer (this, + ctype, + proxy_id ACE_ENV_ARG_PARAMETER); +} + +CosNotifyChannelAdmin::AdminID TAO_NS_SupplierAdmin::MyID ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + return this->id (); +} + +::CosNotifyChannelAdmin::EventChannel_ptr TAO_NS_SupplierAdmin::MyChannel ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + //Add your implementation here + return 0; +} + +::CosNotifyChannelAdmin::InterFilterGroupOperator TAO_NS_SupplierAdmin::MyOperator ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + return ::CosNotifyChannelAdmin::OR_OP; + + //Add your implementation here +} + +::CosNotifyChannelAdmin::ProxyIDSeq * TAO_NS_SupplierAdmin::pull_consumers ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + //Add your implementation here + return 0; +} + +::CosNotifyChannelAdmin::ProxyIDSeq * TAO_NS_SupplierAdmin::push_consumers ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + //Add your implementation here + return 0; +} + +::CosNotifyChannelAdmin::ProxyConsumer_ptr TAO_NS_SupplierAdmin::get_proxy_consumer ( + CosNotifyChannelAdmin::ProxyID proxy_id + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::ProxyNotFound + )) + +{ + //Add your implementation here + return 0; +} + +::CosNotifyChannelAdmin::ProxyConsumer_ptr TAO_NS_SupplierAdmin::obtain_notification_pull_consumer ( + CosNotifyChannelAdmin::ClientType ctype, + CosNotifyChannelAdmin::ProxyID_out proxy_id + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::AdminLimitExceeded + )) + +{ + //Add your implementation here + return 0; +} + +::CosNotification::QoSProperties * TAO_NS_SupplierAdmin::get_qos ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + //Add your implementation here + return 0; +} + +void TAO_NS_SupplierAdmin::set_qos ( + const CosNotification::QoSProperties & qos + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + )) + +{ + //Add your implementation here +} + +void TAO_NS_SupplierAdmin::validate_qos ( + const CosNotification::QoSProperties & required_qos, + CosNotification::NamedPropertyRangeSeq_out available_qos + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + )) + +{ + //Add your implementation here +} + +void TAO_NS_SupplierAdmin::offer_change ( + const CosNotification::EventTypeSeq & added, + const CosNotification::EventTypeSeq & removed + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyComm::InvalidEventType + )) + +{ + //Add your implementation here +} + +CosNotifyFilter::FilterID TAO_NS_SupplierAdmin::add_filter ( + CosNotifyFilter::Filter_ptr new_filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + //Add your implementation here + return 0; +} + +void TAO_NS_SupplierAdmin::remove_filter ( + CosNotifyFilter::FilterID filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyFilter::FilterNotFound + )) + +{ + //Add your implementation here +} + +::CosNotifyFilter::Filter_ptr TAO_NS_SupplierAdmin::get_filter ( + CosNotifyFilter::FilterID filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyFilter::FilterNotFound + )) + +{ + //Add your implementation here + return 0; +} + +::CosNotifyFilter::FilterIDSeq * TAO_NS_SupplierAdmin::get_all_filters ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + //Add your implementation here + return 0; +} + +void TAO_NS_SupplierAdmin::remove_all_filters ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + //Add your implementation here +} + +::CosEventChannelAdmin::ProxyPushConsumer_ptr TAO_NS_SupplierAdmin::obtain_push_consumer ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + //Add your implementation here + return 0; +} + +::CosEventChannelAdmin::ProxyPullConsumer_ptr TAO_NS_SupplierAdmin::obtain_pull_consumer ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + //Add your implementation here + return 0; +} + diff --git a/TAO/orbsvcs/orbsvcs/Notify/SupplierAdmin.h b/TAO/orbsvcs/orbsvcs/Notify/SupplierAdmin.h new file mode 100644 index 00000000000..c1eee20ab10 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/SupplierAdmin.h @@ -0,0 +1,215 @@ +/* -*- C++ -*- */ +/** + * @file SupplierAdmin.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_SUPPLIERADMIN_H +#define TAO_NS_SUPPLIERADMIN_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "orbsvcs/CosNotifyChannelAdminS.h" +#include "Admin.h" +#include "Destroy_Callback.h" + +/** + * @class TAO_NS_SupplierAdmin + * + * @brief Implementation of CosNotifyChannelAdmin::SupplierAdmin + * + */ +class TAO_Notify_Export TAO_NS_SupplierAdmin : public virtual POA_CosNotifyChannelAdmin::SupplierAdmin, public TAO_NS_Admin, public TAO_NS_Destroy_Callback +{ + friend class TAO_NS_Builder; +public: + /// Constuctor + TAO_NS_SupplierAdmin (void); + + /// Destructor + ~TAO_NS_SupplierAdmin (); + + /// Init this object. + void set (CosNotifyChannelAdmin::InterFilterGroupOperator op ACE_ENV_ARG_DECL); + + /// Return servant + virtual PortableServer::Servant servant (void); + + /// ServantBase refcount methods. + virtual void _add_ref (ACE_ENV_SINGLE_ARG_DECL); + virtual void _remove_ref (ACE_ENV_SINGLE_ARG_DECL); + + /// TAO_NS_Destroy_Callback methods + virtual void release (void); + +protected: + /// = CosNotifyChannelAdmin::SupplierAdmin methods + virtual CosNotifyChannelAdmin::AdminID MyID ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual ::CosNotifyChannelAdmin::EventChannel_ptr MyChannel ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual ::CosNotifyChannelAdmin::InterFilterGroupOperator MyOperator ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual ::CosNotifyChannelAdmin::ProxyIDSeq * pull_consumers ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual ::CosNotifyChannelAdmin::ProxyIDSeq * push_consumers ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual ::CosNotifyChannelAdmin::ProxyConsumer_ptr get_proxy_consumer ( + CosNotifyChannelAdmin::ProxyID proxy_id + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::ProxyNotFound + )); + + virtual ::CosNotifyChannelAdmin::ProxyConsumer_ptr obtain_notification_pull_consumer ( + CosNotifyChannelAdmin::ClientType ctype, + CosNotifyChannelAdmin::ProxyID_out proxy_id + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::AdminLimitExceeded + )); + + virtual ::CosNotifyChannelAdmin::ProxyConsumer_ptr obtain_notification_push_consumer ( + CosNotifyChannelAdmin::ClientType ctype, + CosNotifyChannelAdmin::ProxyID_out proxy_id + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::AdminLimitExceeded + )); + + virtual void destroy ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual ::CosNotification::QoSProperties * get_qos ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual void set_qos ( + const CosNotification::QoSProperties & qos + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + )); + + virtual void validate_qos ( + const CosNotification::QoSProperties & required_qos, + CosNotification::NamedPropertyRangeSeq_out available_qos + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + )); + + virtual void offer_change ( + const CosNotification::EventTypeSeq & added, + const CosNotification::EventTypeSeq & removed + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyComm::InvalidEventType + )); + + virtual CosNotifyFilter::FilterID add_filter ( + CosNotifyFilter::Filter_ptr new_filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual void remove_filter ( + CosNotifyFilter::FilterID filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyFilter::FilterNotFound + )); + + virtual ::CosNotifyFilter::Filter_ptr get_filter ( + CosNotifyFilter::FilterID filter + ) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyFilter::FilterNotFound + )); + + virtual ::CosNotifyFilter::FilterIDSeq * get_all_filters ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual void remove_all_filters ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual ::CosEventChannelAdmin::ProxyPushConsumer_ptr obtain_push_consumer ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual ::CosEventChannelAdmin::ProxyPullConsumer_ptr obtain_pull_consumer ( + + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )); +}; + +#if defined (__ACE_INLINE__) +#include "SupplierAdmin.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_SUPPLIERADMIN_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/SupplierAdmin.inl b/TAO/orbsvcs/orbsvcs/Notify/SupplierAdmin.inl new file mode 100644 index 00000000000..42ef0b9d672 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/SupplierAdmin.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "SupplierAdmin.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.cpp b/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.cpp new file mode 100644 index 00000000000..b2393adc7e7 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.cpp @@ -0,0 +1,98 @@ +// $Id$ + +#include "tao/debug.h" +#include "ThreadPool_Task.h" +#include "Properties.h" +#include "Method_Request_Shutdown.h" + +#if ! defined (__ACE_INLINE__) +#include "ThreadPool_Task.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_ThreadPool_Task, "$Id$") + +TAO_NS_ThreadPool_Task::TAO_NS_ThreadPool_Task (void) + : activation_queue_ (msg_queue ()) +{ +} + +TAO_NS_ThreadPool_Task::~TAO_NS_ThreadPool_Task () +{ +} + +void +TAO_NS_ThreadPool_Task::init (NotifyExt::ThreadPoolParams* tp_params ACE_ENV_ARG_DECL) +{ + long flags = THR_NEW_LWP | THR_JOINABLE; + + flags |= + TAO_NS_PROPERTIES::instance()->scope_policy () | + TAO_NS_PROPERTIES::instance()->sched_policy (); + + // Become an active object. + if (this->ACE_Task <ACE_SYNCH>::activate (flags, + tp_params->static_threads, + 0, + tp_params->default_priority) == -1) + { + if (TAO_debug_level > 0) + { + if (ACE_OS::last_error () == EPERM) + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Insufficient privilege.\n"))); + else + ACE_DEBUG ((LM_ERROR, + ACE_TEXT ("(%t) task activation at priority %d failed\n") + ACE_TEXT ("exiting!\n%a"), + tp_params->default_priority)); + } + + ACE_THROW (CORBA::BAD_PARAM ()); + } +} + +void +TAO_NS_ThreadPool_Task::exec (TAO_NS_Method_Request& method_request) +{ + /// Use Buffering Strategy + + TAO_NS_Method_Request* request_copy = method_request.copy (); + + this->activation_queue_.enqueue (request_copy); +} + +int +TAO_NS_ThreadPool_Task::svc (void) +{ + for (;;) + { + // Dequeue the next method request (we use an auto pointer in + // case an exception is thrown in the <call>). + ACE_Method_Request *mo_p = this->activation_queue_.dequeue (); + + if (0 == mo_p) + { + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, + ACE_LIB_TEXT ("(%t) activation queue shut down\n"))); + break; + } + auto_ptr<ACE_Method_Request> mo (mo_p); + + // Call it. + if(mo->call () == -1) + break; + + // Destructor automatically deletes it. + } + + return 0; +} + + +void +TAO_NS_ThreadPool_Task::shutdown (void) +{ + this->activation_queue_.enqueue (new TAO_NS_Method_Request_Shutdown (this)); + this->wait (); + return; +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.h b/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.h new file mode 100644 index 00000000000..8b6515877d1 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.h @@ -0,0 +1,67 @@ +/* -*- C++ -*- */ +/** + * @file ThreadPool_Task.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_THREADPOOL_TASK_H +#define TAO_NS_THREADPOOL_TASK_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/Task.h" +#include "ace/Activation_Queue.h" +#include "orbsvcs/NotifyExtC.h" +#include "Worker_Task.h" + +/** + * @class TAO_NS_ThreadPool_Task + * + * @brief Implements a Thread Pool Worker Task. + * + */ +class TAO_Notify_Export TAO_NS_ThreadPool_Task : public TAO_NS_Worker_Task, ACE_Task<ACE_SYNCH> +{ + friend class TAO_NS_Method_Request_Shutdown; + +public: + /// Constuctor + TAO_NS_ThreadPool_Task (void); + + /// Destructor + ~TAO_NS_ThreadPool_Task (); + + /// Activate the threadpool + void init (NotifyExt::ThreadPoolParams* tp_params ACE_ENV_ARG_DECL); + + /// Queue the request + virtual void exec (TAO_NS_Method_Request& method_request); + + /// Shutdown task + virtual void shutdown (void); + +protected: + /// task svc + virtual int svc (void); + +private: + /// Activation Queue + ACE_Activation_Queue activation_queue_; +}; + +#if defined (__ACE_INLINE__) +#include "ThreadPool_Task.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_THREADPOOL_TASK_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.inl b/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.inl new file mode 100644 index 00000000000..fbfedd2a6d5 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "ThreadPool_Task.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Types.cpp b/TAO/orbsvcs/orbsvcs/Notify/Types.cpp new file mode 100644 index 00000000000..8a5931d2563 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Types.cpp @@ -0,0 +1,12 @@ +// $Id$ + +#include "Types.h" +#include "orbsvcs/NotifyExtC.h" + +#if ! defined (__ACE_INLINE__) +#include "Types.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_Types, "$Id$") + + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Types.h b/TAO/orbsvcs/orbsvcs/Notify/Types.h new file mode 100644 index 00000000000..b9c0e9372b8 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Types.h @@ -0,0 +1,65 @@ +/* -*- C++ -*- */ +/** + * @file Types.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_TYPES_H +#define TAO_NS_TYPES_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/corba.h" +#include "tao/orbconf.h" + +/** + * Forward declare templates + */ +template <class EVENT, class SYNCH> class ACE_Refcounted_Auto_Ptr; +template <class PROXY> class TAO_ESF_Proxy_Collection; +template <class TYPE> class TAO_ESF_RefCount_Guard; +template <class PROXY, class ACE_LOCK> class TAO_NS_Event_Map_T; + +/** + * Forward declare classes + */ +class TAO_NS_Supplier; +class TAO_NS_Consumer; +class TAO_NS_Object; +class TAO_NS_EventChannel; +class TAO_NS_Admin; +class TAO_NS_Proxy; +class TAO_NS_Event; +class TAO_NS_ProxySupplier; +class TAO_NS_ProxyConsumer; + +/** + * Define common types + */ +typedef CORBA::Long TAO_NS_Object_Id; + +typedef ACE_Refcounted_Auto_Ptr<TAO_NS_Event, TAO_SYNCH_MUTEX> TAO_NS_Event_var; +typedef TAO_ESF_Proxy_Collection<TAO_NS_ProxyConsumer> TAO_NS_Supplier_Collection; +typedef TAO_ESF_Proxy_Collection<TAO_NS_ProxySupplier> TAO_NS_Consumer_Collection; + +typedef TAO_ESF_Proxy_Collection<TAO_NS_EventChannel> TAO_NS_EventChannel_Collection; +typedef TAO_ESF_Proxy_Collection<TAO_NS_Admin> TAO_NS_Admin_Collection; +typedef TAO_ESF_Proxy_Collection<TAO_NS_Proxy> TAO_NS_Proxy_Collection; + +typedef TAO_ESF_RefCount_Guard<CORBA::ULong> TAO_NS_Object_RefCount_Guard; + +typedef TAO_NS_Event_Map_T<TAO_NS_ProxySupplier, TAO_SYNCH_RW_MUTEX> TAO_NS_Consumer_Map; +typedef TAO_NS_Event_Map_T<TAO_NS_ProxyConsumer, TAO_SYNCH_RW_MUTEX> TAO_NS_Supplier_Map; + +#include "ace/post.h" +#endif /* TAO_NS_TYPES_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Types.inl b/TAO/orbsvcs/orbsvcs/Notify/Types.inl new file mode 100644 index 00000000000..5ccf33ea155 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Types.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "Types.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.cpp b/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.cpp new file mode 100644 index 00000000000..53e7db14e55 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.cpp @@ -0,0 +1,24 @@ +// $Id$ + +#include "Worker_Task.h" + +#if ! defined (__ACE_INLINE__) +#include "Worker_Task.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_Worker_Task, "$Id$") + +TAO_NS_Worker_Task::TAO_NS_Worker_Task (void) +{ +} + +TAO_NS_Worker_Task::~TAO_NS_Worker_Task () +{ +} + +void +TAO_NS_Worker_Task::shutdown (void) +{ + return; +} + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.h b/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.h new file mode 100644 index 00000000000..1c6636f07f1 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.h @@ -0,0 +1,51 @@ +/* -*- C++ -*- */ +/** + * @file Worker_Task.h + * + * $Id$ + * + * @author Pradeep Gore <pradeep@oomworks.com> + * + * + */ + +#ifndef TAO_NS_WORKER_TASK_H +#define TAO_NS_WORKER_TASK_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "Method_Request.h" + +/** + * @class TAO_NS_Worker_Task + * + * @brief Base Worker Task. + * + */ +class TAO_Notify_Export TAO_NS_Worker_Task +{ +public: + /// Constuctor + TAO_NS_Worker_Task (void); + + /// Destructor + virtual ~TAO_NS_Worker_Task (); + + /// Exec the request. + virtual void exec (TAO_NS_Method_Request& method_request) = 0; + + /// Shutdown task + virtual void shutdown (void); +}; + +#if defined (__ACE_INLINE__) +#include "Worker_Task.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_WORKER_TASK_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.inl b/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.inl new file mode 100644 index 00000000000..8033deae834 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "Worker_Task.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/notify_stubs_export.h b/TAO/orbsvcs/orbsvcs/Notify/notify_stubs_export.h new file mode 100644 index 00000000000..75b83640c83 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/notify_stubs_export.h @@ -0,0 +1,50 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl TAO_NOTIFY_STUBS +// ------------------------------ +#ifndef TAO_NOTIFY_STUBS_EXPORT_H +#define TAO_NOTIFY_STUBS_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (TAO_NOTIFY_STUBS_HAS_DLL) +# define TAO_NOTIFY_STUBS_HAS_DLL 1 +#endif /* ! TAO_NOTIFY_STUBS_HAS_DLL */ + +#if defined (TAO_NOTIFY_STUBS_HAS_DLL) && (TAO_NOTIFY_STUBS_HAS_DLL == 1) +# if defined (TAO_NOTIFY_STUBS_BUILD_DLL) +# define TAO_NOTIFY_STUBS_Export ACE_Proper_Export_Flag +# define TAO_NOTIFY_STUBS_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define TAO_NOTIFY_STUBS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* TAO_NOTIFY_STUBS_BUILD_DLL */ +# define TAO_NOTIFY_STUBS_Export ACE_Proper_Import_Flag +# define TAO_NOTIFY_STUBS_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define TAO_NOTIFY_STUBS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* TAO_NOTIFY_STUBS_BUILD_DLL */ +#else /* TAO_NOTIFY_STUBS_HAS_DLL == 1 */ +# define TAO_NOTIFY_STUBS_Export +# define TAO_NOTIFY_STUBS_SINGLETON_DECLARATION(T) +# define TAO_NOTIFY_STUBS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* TAO_NOTIFY_STUBS_HAS_DLL == 1 */ + +// Set TAO_NOTIFY_STUBS_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (TAO_NOTIFY_STUBS_NTRACE) +# if (ACE_NTRACE == 1) +# define TAO_NOTIFY_STUBS_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define TAO_NOTIFY_STUBS_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !TAO_NOTIFY_STUBS_NTRACE */ + +#if (TAO_NOTIFY_STUBS_NTRACE == 1) +# define TAO_NOTIFY_STUBS_TRACE(X) +#else /* (TAO_NOTIFY_STUBS_NTRACE == 1) */ +# define TAO_NOTIFY_STUBS_TRACE(X) ACE_TRACE_IMPL(X) +#endif /* (TAO_NOTIFY_STUBS_NTRACE == 1) */ + +#endif /* TAO_NOTIFY_STUBS_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/orbsvcs/orbsvcs/Notify/rt_notify_export.h b/TAO/orbsvcs/orbsvcs/Notify/rt_notify_export.h new file mode 100644 index 00000000000..288a67cb67f --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/rt_notify_export.h @@ -0,0 +1,39 @@ +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl +// ------------------------------ +#ifndef TAO_RT_NOTIFY_EXPORT_H +#define TAO_RT_NOTIFY_EXPORT_H + +#include "ace/config-all.h" + +#if defined (TAO_AS_STATIC_LIBS) +# if !defined (TAO_RT_NOTIFY_HAS_DLL) +# define TAO_RT_NOTIFY_HAS_DLL 0 +# endif /* ! TAO_RT_NOTIFY_HAS_DLL */ +#else +# if !defined (TAO_RT_NOTIFY_HAS_DLL) +# define TAO_RT_NOTIFY_HAS_DLL 1 +# endif /* ! TAO_RT_NOTIFY_HAS_DLL */ +#endif + +#if defined (TAO_RT_NOTIFY_HAS_DLL) && (TAO_RT_NOTIFY_HAS_DLL == 1) +# if defined (TAO_RT_NOTIFY_BUILD_DLL) +# define TAO_RT_Notify_Export ACE_Proper_Export_Flag +# define TAO_RT_NOTIFY_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define TAO_RT_NOTIFY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* TAO_RT_NOTIFY_BUILD_DLL */ +# define TAO_RT_Notify_Export ACE_Proper_Import_Flag +# define TAO_RT_NOTIFY_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define TAO_RT_NOTIFY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* TAO_RT_NOTIFY_BUILD_DLL */ +#else /* TAO_RT_NOTIFY_HAS_DLL == 1 */ +# define TAO_RT_Notify_Export +# define TAO_RT_NOTIFY_SINGLETON_DECLARATION(T) +# define TAO_RT_NOTIFY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* TAO_RT_NOTIFY_HAS_DLL == 1 */ + +#endif /* TAO_RT_NOTIFY_EXPORT_H */ + +// End of auto generated file. |