diff options
author | edwardgt <edwardgt@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-10-18 20:11:54 +0000 |
---|---|---|
committer | edwardgt <edwardgt@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-10-18 20:11:54 +0000 |
commit | 1d5e3e7042e60ec98200ac3ca4c46b5fd85ca376 (patch) | |
tree | b4639f7d2dc188fd8c5cadc1c9b16592f9623c48 | |
parent | 60b96ed29cd73f65eb5a69ecfcf5d254103d9997 (diff) | |
download | ATCD-1d5e3e7042e60ec98200ac3ca4c46b5fd85ca376.tar.gz |
ChangeLogTag: Sat Oct 18 14:19:56 2003 George Edwards <g.edwards@vanderbilt.edu>
46 files changed, 3519 insertions, 2433 deletions
diff --git a/TAO/CIAO/ChangeLog_EC b/TAO/CIAO/ChangeLog_EC index 3385090c3f4..fc97f153114 100644 --- a/TAO/CIAO/ChangeLog_EC +++ b/TAO/CIAO/ChangeLog_EC @@ -1,3 +1,103 @@ +Sat Oct 18 14:19:56 2003 George Edwards <g.edwards@vanderbilt.edu> + + Added files: + * CIAO_CosNotify.cpp + * CIAO_CosNotify.h + * CIAO_CosNotify.idl + * CIAO_DirectEvent.cpp + * CIAO_DirectEvent.h + * CIAO_DirectEvent.idl + * CIAO_EventServiceBase.h + * CIAO_EventService_Factory.cpp + * CIAO_EventService_Factory.h + * CIAO_EventService_Factory_impl.cpp + * CIAO_EventService_Factory_impl.h + * CIAO_Events_Export.h + * CIAO_RTEvent.cpp CIAO_RTEvent.h CIAO_RTEvent.idl + + Added event service factory to dynamically create event service + objects, provided via ACE dynamic service. Changed UUID to string + to match Assembly_Deployer tool. Moved consumer state information + into the event service objects. + + Modified files: + * CCM_Component.idl + * CCM_Core.mpc + * CCM_Deployment.idl + * CIAO_Events.idl + * ComponentInstallation_Impl.h + * ComponentServer_Impl.h + * Container_Base.cpp + * Container_Base.h + * Container_Base.inl + * Container_Impl.h + * Container_Impl.inl + * Cookies.h + + Changed container to dynamically link event service libraries. Added new + CIAO_Events project. Added method to CIAO::Container that provides an object + reference to the events interface. Removed map of EventServiceInfo structs from + CIAO::Container. Added a UUID attribute to CCM_Object. + + * Assembly_Deployer/Assembly_Impl.cpp + * Assembly_Deployer/Assembly_Impl.h + * Assembly_Deployer/Assembly_Visitors.cpp + * Assembly_Deployer/Assembly_Visitors.h + * XML_Helpers/Assembly_Handlers.cpp + * XML_Helpers/Assembly_Spec.h + * XML_Helpers/Assembly_Spec.inl + + Moved glue code that establishes events connections into the Deployer. + Added a map of container references to CIAO::Assembly_Context. + + * handcrafted/BasicSP_EC/BMClosedED/BMClosedEDE.idl + * handcrafted/BasicSP_EC/BMClosedED/BMClosedED_svnt.cpp + * handcrafted/BasicSP_EC/BMClosedED/BMClosedED_svnt.h + * handcrafted/BasicSP_EC/BMDevice/BMDeviceE.idl + * handcrafted/BasicSP_EC/BMDevice/BMDevice_svnt.cpp + * handcrafted/BasicSP_EC/BMDevice/BMDevice_svnt.h + * handcrafted/BasicSP_EC/BMDisplay/BMDisplayE.idl + * handcrafted/BasicSP_EC/BMDisplay/BMDisplay_svnt.cpp + * handcrafted/BasicSP_EC/BMDisplay/BMDisplay_svnt.h + * handcrafted/BasicSP_EC/EC/ECE.idl + * handcrafted/BasicSP_EC/EC/EC_svnt.cpp + * handcrafted/BasicSP_EC/EC/EC_svnt.h + + Added a UUID attribute to CCM_Object. Moved glue code that establishes + events connections into the Deployer. Changed push_event to use the + component UUID with port name appended. + + Removed files: + * CIAO_Events.cpp + * CIAO_Events.h + + Broke these files apart into one file per service. + +Sat Oct 4 18:28:23 2003 George Edwards <g.edwards@vanderbilt.edu> + + Added files: + + * ciao/CIAO_CosNotify.idl + * ciao/CIAO_DirectEvent.idl + * ciao/CIAO_RTEvent.idl + + Modified files: + + * ciao/CCM_Core.mpc + * ciao/CIAO_Events.cpp + * ciao/CIAO_Events.h + * ciao/CIAO_Events.idl + * ciao/ComponentInstallation_Impl.h + * ciao/ComponentServer_Impl.h + * ciao/Container_Base.cpp + * ciao/Container_Base.h + * ciao/Container_Impl.h ciao/Cookies.h + * examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED_svnt.cpp + * examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_svnt.cpp + * examples/handcrafted/BasicSP_EC/EC/EC_svnt.cpp + + Made design changes according to Bala's suggestions. + Thu Oct 2 12:19:22 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu> * ciao/CIAO_Events.cpp: diff --git a/TAO/CIAO/ciao/CCM_Component.idl b/TAO/CIAO/ciao/CCM_Component.idl index a1547d815e4..d19d46819a4 100644 --- a/TAO/CIAO/ciao/CCM_Component.idl +++ b/TAO/CIAO/ciao/CCM_Component.idl @@ -19,6 +19,9 @@ module Components { + + typedef string UUID; + abstract valuetype PrimaryKeyBase {}; interface CCMObject; //forward reference @@ -97,6 +100,7 @@ module Components void remove() raises (RemoveFailure); ComponentPortDescription get_all_ports (); + attribute UUID component_UUID; }; // @@ Enumeration and DefaultEnumeration are only for EJB to CCM diff --git a/TAO/CIAO/ciao/CCM_Core.mpc b/TAO/CIAO/ciao/CCM_Core.mpc index 79d8ab4ce96..6ca13f8227c 100644 --- a/TAO/CIAO/ciao/CCM_Core.mpc +++ b/TAO/CIAO/ciao/CCM_Core.mpc @@ -1,7 +1,8 @@ project (CIAO_Client) : taolib_with_idl, valuetype, ifr_client { sharedname = CIAO_Client - idlflags += -I $(TAO_ROOT) -Wb,stub_export_include=CIAO_Client_Export.h -Wb,stub_export_macro=CIAO_CLIENT_Export -Wb,skel_export_include=CIAO_Container_Export.h -Wb,skel_export_macro=CIAO_CONTAINER_Export + idlflags += -I$(TAO_ROOT) -Wb,stub_export_include=CIAO_Client_Export.h -Wb,stub_export_macro=CIAO_CLIENT_Export -Wb,skel_export_include=CIAO_Container_Export.h -Wb,skel_export_macro=CIAO_CONTAINER_Export dynamicflags = CIAO_CLIENT_BUILD_DLL + libpaths += $(ACE_ROOT)\lib,$(TAO_ROOT)\tao\IFR_Client,$(TAO_ROOT)\tao\Valuetype,$(TAO_ROOT)\tao,$(ACE_ROOT)\ace IDL_Files { CCM_Base.idl @@ -19,20 +20,57 @@ project (CIAO_Client) : taolib_with_idl, valuetype, ifr_client { } } -project (CIAO_Container) : orbsvcslib, portableserver, security, iorinterceptor, objreftemplate, valuetype, ifr_client { +project (CIAO_Events) : rtevent, notify { + after += CIAO_Client + sharedname = CIAO_Events + includes += $(TAO_ROOT)/orbsvcs + idlflags += -I$(TAO_ROOT)/orbsvcs -I$(TAO_ROOT) -Wb,export_include=CIAO_Events_Export.h -Wb,export_macro=CIAO_EVENTS_Export + dynamicflags = CIAO_EVENTS_BUILD_DLL + libpaths += $(ACE_ROOT)\lib,$(TAO_ROOT)\tao\IFR_Client,$(TAO_ROOT)\tao\Valuetype,$(TAO_ROOT)\tao,$(ACE_ROOT)\ace,$(TAO_ROOT)\orbsvcs\orbsvcs,$(TAO_ROOT)\tao\PortableServer,$(TAO_ROOT)\tao\IORInterceptor,$(TAO_ROOT)\tao\ObjRefTemplate,$(TAO_ROOT)\tao\DynamicAny,$(TAO_ROOT)\orbsvcs\orbsvcs\ETCL,$(TAO_ROOT)\tao\IORTable,$(TAO_ROOT)\tao\Messaging + + IDL_Files { + CIAO_Events.idl + CIAO_RTEvent.idl + CIAO_DirectEvent.idl + CIAO_CosNotify.idl + } + + Source_Files { + CIAO_EventService_Factory.cpp + CIAO_EventService_Factory_impl.cpp + CIAO_EventsS.cpp + CIAO_EventsC.cpp + CIAO_DirectEventS.cpp + CIAO_DirectEventC.cpp + CIAO_DirectEvent.cpp + CIAO_RTEventS.cpp + CIAO_RTEventC.cpp + CIAO_RTEvent.cpp + CIAO_CosNotifyS.cpp + CIAO_CosNotifyC.cpp + CIAO_CosNotify.cpp + } + + Header_Files { + CIAO_EventServiceBase.h + } +} + +project (CIAO_Container) : orbsvcslib, portableserver, security, valuetype, ifr_client { + after += CIAO_Events sharedname = CIAO_Container libs += CIAO_Client includes += $(TAO_ROOT)/orbsvcs/orbsvcs idlflags += -I$(TAO_ROOT)/orbsvcs/orbsvcs -Wb,export_include=CIAO_Container_Export.h -Wb,export_macro=CIAO_CONTAINER_Export dynamicflags = CIAO_CONTAINER_BUILD_DLL - + libpaths += $(ACE_ROOT)\lib,$(TAO_ROOT)\tao\IFR_Client,$(TAO_ROOT)\tao\Valuetype,$(TAO_ROOT)\tao,$(ACE_ROOT)\ace,$(TAO_ROOT)\orbsvcs\orbsvcs,$(TAO_ROOT)\tao\PortableServer,$(TAO_ROOT)\tao\IORInterceptor,$(TAO_ROOT)\tao\ObjRefTemplate IDL_Files { CCM_Transaction.idl CosPersistentState.idl CCM_Container.idl CCM_Container_Ex.idl - CIAO_Events.idl + CCM_Deployment.idl } Source_Files { @@ -44,39 +82,32 @@ project (CIAO_Container) : orbsvcslib, portableserver, security, iorinterceptor, CCM_EventS.cpp CCM_ComponentS.cpp Cookies.cpp - CIAO_EventsS.cpp - CIAO_EventsC.cpp - CIAO_Events.cpp + Container_Base.cpp + Container_Impl.cpp + CCM_DeploymentC.cpp + CCM_DeploymentS.cpp } + } -project (CIAO_Server) : orbsvcslib, portableserver, iorinterceptor, objreftemplate, valuetype, ifr_client, security { +project (CIAO_Server) : orbsvcslib, portableserver, valuetype, ifr_client, security { after += CIAO_Container sharedname = CIAO_Server libs += CIAO_Client includes += $(TAO_ROOT)/orbsvcs/orbsvcs idlflags += -I$(TAO_ROOT)/orbsvcs/orbsvcs -Wb,export_include=CIAO_Server_Export.h -Wb,export_macro=CIAO_SERVER_Export - + libpaths += $(ACE_ROOT)\lib,$(TAO_ROOT)\tao\IFR_Client,$(TAO_ROOT)\tao\Valuetype,$(TAO_ROOT)\tao,$(ACE_ROOT)\ace,$(TAO_ROOT)\orbsvcs\orbsvcs,$(TAO_ROOT)\tao\PortableServer,$(TAO_ROOT)\tao\IORInterceptor,$(TAO_ROOT)\tao\ObjRefTemplate dynamicflags = CIAO_SERVER_BUILD_DLL IDL_Files { - CCM_Deployment.idl CIAO_Servers.idl -// HomeRegistrar.idl } Source_Files { - CCM_DeploymentC.cpp - CCM_DeploymentS.cpp CIAO_ServersC.cpp CIAO_ServersS.cpp -// HomeRegistrarC.cpp -// HomeRegistrarS.cpp ComponentInstallation_Impl.cpp ComponentServer_Impl.cpp - Container_Base.cpp - Container_Impl.cpp -// HomeRegistrar_i.cpp Server_init.cpp ServerActivator_Impl.cpp } diff --git a/TAO/CIAO/ciao/CCM_Deployment.idl b/TAO/CIAO/ciao/CCM_Deployment.idl index d95765ea708..9842cf103dc 100644 --- a/TAO/CIAO/ciao/CCM_Deployment.idl +++ b/TAO/CIAO/ciao/CCM_Deployment.idl @@ -17,6 +17,7 @@ #define CCM_DEPLOYMENT_IDL #include "CCM_Component.idl" +#include "CIAO_Events.idl" // *************** Packaging and Deployment *************** @@ -26,7 +27,7 @@ module Components module Deployment { - typedef string UUID; + typedef string Location; enum AssemblyState @@ -148,7 +149,7 @@ module Components void remove () raises (RemoveFailure); - + CIAO::ContainerEventService get_event_service (); }; diff --git a/TAO/CIAO/ciao/CIAO_CosNotify.cpp b/TAO/CIAO/ciao/CIAO_CosNotify.cpp new file mode 100644 index 00000000000..7b031af61b9 --- /dev/null +++ b/TAO/CIAO/ciao/CIAO_CosNotify.cpp @@ -0,0 +1,405 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CIAO_CosNotify.cpp + * + * $Id$ + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//============================================================================= + +#include "CIAO_CosNotify.h" + +namespace CIAO +{ + + CosNotifyService::CosNotifyService (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + CosNotifyChannelAdmin::EventChannel_ptr ec) : + orb_ (CORBA::ORB::_duplicate (orb)), + root_poa_ (PortableServer::POA::_duplicate (poa)), + notify_channel_ (CosNotifyChannelAdmin::EventChannel::_duplicate (ec)), + type_id_ ("Any"), + source_id_ ("Any") + { + } + + void + CosNotifyService::connect_event_supplier ( + Supplier_Config_ptr supplier_config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + + ACE_DEBUG ((LM_DEBUG, "CIAO::CosNotifyService::connect_event_supplier\n")); + + CosNotifyChannelAdmin::AdminID admin_id; + CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin = + this->notify_channel_->new_for_suppliers (CosNotifyChannelAdmin::OR_OP, + admin_id + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + CosNotifyChannelAdmin::ProxyID proxy_id; + CosNotifyChannelAdmin::ProxyConsumer_var my_proxy = + supplier_admin->obtain_notification_push_consumer (CosNotifyChannelAdmin::STRUCTURED_EVENT, + proxy_id + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->proxy_consumer_ = + CosNotifyChannelAdmin::StructuredProxyPushConsumer::_narrow (my_proxy.in ()); + if (CORBA::is_nil (this->proxy_consumer_.in ())) + { + ACE_ERROR ((LM_ERROR, + " (%P|%t) CosNotifyService::connect_event_supplier\n")); + } + + // Create and register supplier servant + CosNotifyServiceSupplier_impl * supplier_servant; + ACE_NEW (supplier_servant, + CosNotifyServiceSupplier_impl (orb_.in ())); + CosNotifyComm::StructuredPushSupplier_var push_supplier = + supplier_servant->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + CosNotify_Supplier_Config_ptr notify_config = + CosNotify_Supplier_Config::_narrow (supplier_config + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (notify_config)) + { + ACE_THROW ((CORBA::BAD_PARAM ())); + } + + CosNotifyFilter::Filter_var filter = + notify_config->notify_filter (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + CosNotification::QoSProperties_var qos = + notify_config->notify_qos (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->proxy_consumer_->add_filter (filter.in () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->proxy_consumer_->set_qos (qos.in () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->proxy_consumer_->connect_structured_push_supplier (push_supplier.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + } + + void + CosNotifyService::connect_event_consumer ( + Consumer_Config_ptr consumer_config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + + Components::EventConsumerBase_var consumer = + consumer_config->consumer (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + CosNotifyChannelAdmin::AdminID admin_id; + CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin = + this->notify_channel_->new_for_consumers (CosNotifyChannelAdmin::OR_OP, + admin_id + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + CosNotifyChannelAdmin::ProxyID proxy_id; + CosNotifyChannelAdmin::ProxySupplier_var my_proxy = + consumer_admin->obtain_notification_push_supplier (CosNotifyChannelAdmin::STRUCTURED_EVENT, + proxy_id + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + CosNotifyChannelAdmin::StructuredProxyPushSupplier_var proxy_supplier = + CosNotifyChannelAdmin::StructuredProxyPushSupplier::_narrow (my_proxy.in ()); + if (CORBA::is_nil (proxy_supplier.in ())) + { + ACE_ERROR ((LM_ERROR, + " (%P|%t) CosNotifyService::connect_event_consumer\n")); + } + + // Create and register consumer servant + CosNotifyServiceConsumer_impl * consumer_servant; + ACE_NEW (consumer_servant, + CosNotifyServiceConsumer_impl (orb_.in (), consumer.in ())); + CosNotifyComm::StructuredPushConsumer_var push_consumer = + consumer_servant->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + CosNotify_Consumer_Config_ptr notify_config = + CosNotify_Consumer_Config::_narrow (consumer_config + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (notify_config)) + { + ACE_THROW ((CORBA::BAD_PARAM ())); + } + + CosNotifyFilter::Filter_var filter = + notify_config->notify_filter (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + CosNotification::QoSProperties_var qos = + notify_config->notify_qos (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + proxy_supplier->add_filter (filter.in () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + proxy_supplier->set_qos (qos.in () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + proxy_supplier->connect_structured_push_consumer (push_consumer.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + ACE_CString consumer_id = + consumer_config->consumer_id (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->proxy_supplier_map_.bind (consumer_id.c_str (), proxy_supplier._retn ()); + + } + + void CosNotifyService::disconnect_event_supplier ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)) + { + + this->proxy_consumer_->disconnect_structured_push_consumer ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + } + + void CosNotifyService::disconnect_event_consumer ( + const char * connection_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)) + { + + CosNotifyChannelAdmin::StructuredProxyPushSupplier_var proxy_supplier; + + this->proxy_supplier_map_.unbind (connection_id, proxy_supplier); + + proxy_supplier->disconnect_structured_push_supplier ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + } + + void CosNotifyService::push_event ( + Components::EventBase * ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + + ACE_DEBUG ((LM_DEBUG, "CIAO::CosNotifyService::push_event\n")); + + CosNotification::StructuredEvent event; + event.header.fixed_header.event_type.domain_name = CORBA::string_dup ("CIAO_Events"); + event.header.fixed_header.event_type.type_name = this->type_id_.c_str (); + event.header.fixed_header.event_name = this->source_id_.c_str (); + event.remainder_of_body <<= ev; + + this->proxy_consumer_->push_structured_event (event ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + } + + CosNotifyServiceSupplier_impl::CosNotifyServiceSupplier_impl (void) + { + } + + CosNotifyServiceSupplier_impl::CosNotifyServiceSupplier_impl (CORBA::ORB_ptr orb) : + orb_ (CORBA::ORB::_duplicate (orb)) + { + } + + void + CosNotifyServiceSupplier_impl::disconnect_structured_push_supplier (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + } + + void + CosNotifyServiceSupplier_impl::subscription_change ( + const CosNotification::EventTypeSeq& events_added, + const CosNotification::EventTypeSeq& events_removed + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + CosNotifyComm::InvalidEventType)) + { + } + + CosNotifyServiceConsumer_impl::CosNotifyServiceConsumer_impl (void) + { + } + + CosNotifyServiceConsumer_impl::CosNotifyServiceConsumer_impl (CORBA::ORB_ptr orb, + Components::EventConsumerBase_ptr consumer) : + orb_ (CORBA::ORB::_duplicate (orb)), + event_consumer_ (Components::EventConsumerBase::_duplicate (consumer)) + { + } + + void + CosNotifyServiceConsumer_impl::push_structured_event (const CosNotification::StructuredEvent& event) + { + ACE_DEBUG ((LM_DEBUG, "CosNotifyServiceConsumer_impl::push_structured_event\n")); + Components::EventBase * ev; + if (event.remainder_of_body >>= ev) + { + ev->_add_ref (); + this->event_consumer_->push_event (ev + ACE_ENV_ARG_PARAMETER); + } + } + + void + CosNotifyServiceConsumer_impl::disconnect_structured_push_consumer (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + } + + void + CosNotifyServiceConsumer_impl::offer_change ( + const CosNotification::EventTypeSeq& events_added, + const CosNotification::EventTypeSeq& events_removed + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + CosNotifyComm::InvalidEventType)) + { + } + + CosNotify_Consumer_Config_impl::CosNotify_Consumer_Config_impl () : + service_type_ (NOTIFY) + { + } + + void + CosNotify_Consumer_Config_impl::consumer_id (const char * consumer_id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->consumer_id_ = consumer_id; + } + + void + CosNotify_Consumer_Config_impl::supplier_id (const char * supplier_id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->supplier_id_ = supplier_id; + } + + void + CosNotify_Consumer_Config_impl::consumer (Components::EventConsumerBase_ptr consumer ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->consumer_ = consumer; + } + + CONNECTION_ID + CosNotify_Consumer_Config_impl::consumer_id (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return CORBA::string_dup (this->consumer_id_.c_str ()); + } + + CONNECTION_ID + CosNotify_Consumer_Config_impl::supplier_id (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return CORBA::string_dup (this->supplier_id_.c_str ()); + } + + EventServiceType + CosNotify_Consumer_Config_impl::service_type (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->service_type_; + } + + Components::EventConsumerBase_ptr + CosNotify_Consumer_Config_impl::consumer (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return Components::EventConsumerBase::_duplicate (this->consumer_.in ()); + } + + CosNotifyFilter::Filter * + CosNotify_Consumer_Config_impl::notify_filter (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->filter_._retn (); + } + + CosNotification::QoSProperties * + CosNotify_Consumer_Config_impl::notify_qos (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->qos_._retn (); + } + + CosNotify_Supplier_Config_impl::CosNotify_Supplier_Config_impl () : + service_type_ (NOTIFY) + { + } + + void + CosNotify_Supplier_Config_impl::supplier_id (const char * supplier_id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->supplier_id_ = supplier_id; + } + + CONNECTION_ID + CosNotify_Supplier_Config_impl::supplier_id (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return CORBA::string_dup (this->supplier_id_.c_str ()); + } + + EventServiceType + CosNotify_Supplier_Config_impl::service_type (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->service_type_; + } + + CosNotifyFilter::Filter_ptr + CosNotify_Supplier_Config_impl::notify_filter (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->filter_._retn (); + } + + CosNotification::QoSProperties * + CosNotify_Supplier_Config_impl::notify_qos (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return this->qos_._retn (); + } + +} diff --git a/TAO/CIAO/ciao/CIAO_CosNotify.h b/TAO/CIAO/ciao/CIAO_CosNotify.h new file mode 100644 index 00000000000..a7c240dd7ce --- /dev/null +++ b/TAO/CIAO/ciao/CIAO_CosNotify.h @@ -0,0 +1,307 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CIAO_CosNotify.h + * + * $Id$ + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//============================================================================= + +#ifndef CIAO_COSNOTIFY_H +#define CIAO_COSNOTIFY_H +#include /**/ "ace/pre.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "CIAO_EventServiceBase.h" +#include "CIAO_CosNotifyS.h" + +#include "orbsvcs/CosNotifyChannelAdminC.h" + +namespace CIAO +{ + + /** + * @class CosNotifyService + * + * An implementation of EventServiceBase using the COS notification service. + */ + class CosNotifyService : + public virtual EventServiceBase + { + + public: + + CosNotifyService (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + CosNotifyChannelAdmin::EventChannel_ptr ec); + + virtual void connect_event_supplier ( + CIAO::Supplier_Config_ptr supplier_config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + virtual void connect_event_consumer ( + CIAO::Consumer_Config_ptr consumer_config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + virtual void disconnect_event_consumer ( + const char * connection_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)); + + virtual void disconnect_event_supplier ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)); + + virtual void push_event ( + Components::EventBase * ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + private: + + // Reference to the ORB + CORBA::ORB_var orb_; + + // Reference to the Root POA + PortableServer::POA_var root_poa_; + + /** + * @var CosNotifyChannelAdmin::EventChannel_var notify_channel_ + * + * Reference to the notification channel. + */ + CosNotifyChannelAdmin::EventChannel_var notify_channel_; + + /** + * @var ACE_CString type_id_ + * + * The type of event. + */ + ACE_CString type_id_; + + /** + * @var ACE_CString source_id_ + * + * The supplier id. + */ + ACE_CString source_id_; + + /** + * @var CosNotifyChannelAdmin::StructuredProxyPushConsumer_var proxy_consumer_ + * + * The proxy consumer to which events are pushed. + */ + CosNotifyChannelAdmin::StructuredProxyPushConsumer_var proxy_consumer_; + + /** + * @var ACE_Hash_Map_Manager<> proxy_supplier_map_ + * + * Mapping of each event sink to a proxy supplier for disconnect purposes. + */ + ACE_Hash_Map_Manager<ACE_CString, + CosNotifyChannelAdmin::StructuredProxyPushSupplier_ptr, + ACE_Null_Mutex> proxy_supplier_map_; + + }; + + /** + * @class CosNotifyServiceSupplier_impl + * + * An implementation of the StructuredPushSupplier interface. + */ + class CosNotifyServiceSupplier_impl : + public virtual POA_CosNotifyComm::StructuredPushSupplier, + public virtual PortableServer::RefCountServantBase + { + + public: + + CosNotifyServiceSupplier_impl (void); + + CosNotifyServiceSupplier_impl ( + CORBA::ORB_ptr orb); + + virtual void disconnect_structured_push_supplier ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + virtual void subscription_change ( + const CosNotification::EventTypeSeq& events_added, + const CosNotification::EventTypeSeq& events_removed + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + CosNotifyComm::InvalidEventType)); + + private: + + CORBA::ORB_var orb_; + + }; + + /** + * @class CosNotifyServiceConsumer_impl + * + * An implementation of the StructuredPushConsumer interface. + */ + class CosNotifyServiceConsumer_impl : + public virtual POA_CosNotifyComm::StructuredPushConsumer, + public virtual PortableServer::RefCountServantBase + { + + public: + + CosNotifyServiceConsumer_impl (void); + + CosNotifyServiceConsumer_impl ( + CORBA::ORB_ptr orb, + Components::EventConsumerBase_ptr consumer); + + virtual void push_structured_event ( + const CosNotification::StructuredEvent& event); + + virtual void disconnect_structured_push_consumer ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + virtual void offer_change ( + const CosNotification::EventTypeSeq& events_added, + const CosNotification::EventTypeSeq& events_removed + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + CosNotifyComm::InvalidEventType)); + + private: + + CORBA::ORB_var orb_; + + Components::EventConsumerBase_var event_consumer_; + + }; + + /** + * @class CosNotify_Consumer_Config_impl + * + * Implementation of the CosNotify_Consumer_Config IDL interface that + * configures the CosNotification service. An object of this type will be + * returned from @c CIAO::Container::create_consumer_config () when @c NOTIFY + * is specified as the event service type. + */ + class CosNotify_Consumer_Config_impl : + public virtual POA_CIAO::CosNotify_Consumer_Config + { + + public: + + CosNotify_Consumer_Config_impl (); + + virtual void consumer_id (const char * consumer_id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CONNECTION_ID consumer_id (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void supplier_id (const char * supplier_id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CONNECTION_ID supplier_id (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void consumer (Components::EventConsumerBase_ptr consumer ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual Components::EventConsumerBase_ptr consumer (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual EventServiceType service_type (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + CosNotifyFilter::Filter_ptr notify_filter (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + CosNotification::QoSProperties * notify_qos (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + private: + + ACE_CString consumer_id_; + + ACE_CString supplier_id_; + + Components::EventConsumerBase_var consumer_; + + EventServiceType service_type_; + + CosNotifyFilter::Filter_var filter_; + + CosNotification::QoSProperties_var qos_; + + }; + + /** + * @class CosNotify_Supplier_Config_impl + * + * Implementation of the CosNotify_Supplier_Config IDL interface that + * configures the CosNotification service. An object of this type will be + * returned from @c CIAO::Container::create_supplier_config () when @c NOTIFY + * is specified as the event service type. + */ + class CosNotify_Supplier_Config_impl : + public virtual POA_CIAO::CosNotify_Supplier_Config + { + + public: + + CosNotify_Supplier_Config_impl (); + + void supplier_id (const char * supplier_id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + char * supplier_id (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + EventServiceType service_type (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + CosNotifyFilter::Filter_ptr notify_filter (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + CosNotification::QoSProperties * notify_qos (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + private: + + ACE_CString supplier_id_; + + EventServiceType service_type_; + + CosNotifyFilter::Filter_var filter_; + + CosNotification::QoSProperties_var qos_; + + }; + +} + +#include /**/ "ace/post.h" +#endif /* CIAO_COSNOTIFY_H */ diff --git a/TAO/CIAO/ciao/CIAO_CosNotify.idl b/TAO/CIAO/ciao/CIAO_CosNotify.idl new file mode 100644 index 00000000000..a4e92815a98 --- /dev/null +++ b/TAO/CIAO/ciao/CIAO_CosNotify.idl @@ -0,0 +1,37 @@ +// $Id$ + +/** + * @file CIAO_CosNotify.idl + * + * @author George Edwards + * + * @brief Interfaces for configuring CIAO's notification service. + */ + +#include "CIAO_Events.idl" +#include "orbsvcs/CosNotifyFilter.idl" + +module CIAO +{ + + interface CosNotify_Consumer_Config : + Consumer_Config + { + + readonly attribute CosNotifyFilter::Filter notify_filter; + + readonly attribute CosNotification::QoSProperties notify_qos; + + }; + + interface CosNotify_Supplier_Config : + Supplier_Config + { + + readonly attribute CosNotifyFilter::Filter notify_filter; + + readonly attribute CosNotification::QoSProperties notify_qos; + + }; + +}; diff --git a/TAO/CIAO/ciao/CIAO_DirectEvent.cpp b/TAO/CIAO/ciao/CIAO_DirectEvent.cpp new file mode 100644 index 00000000000..6e8a42d9a92 --- /dev/null +++ b/TAO/CIAO/ciao/CIAO_DirectEvent.cpp @@ -0,0 +1,201 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CIAO_DirectEvent.cpp + * + * $Id$ + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//============================================================================= + +#include "CIAO_DirectEvent.h" + +namespace CIAO +{ + + DirectEventService::DirectEventService ( + CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa) : + orb_ (CORBA::ORB::_duplicate (orb)), + root_poa_ (PortableServer::POA::_duplicate (poa)) + { + } + + void + DirectEventService::connect_event_supplier ( + Supplier_Config_ptr supplier_config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + } + + void + DirectEventService::connect_event_consumer ( + Consumer_Config_ptr consumer_config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + + // @@ George, Any reason not to use ACE_NEW_THROW_EX (). Exceptions + // comes free then. + Components::EventConsumerBase_var consumer = + consumer_config->consumer (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->consumer_array_.set (consumer._retn (), + this->consumer_array_.size ()); + + } + + void + DirectEventService::disconnect_event_consumer ( + const char * connection_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)) + { + } + + void + DirectEventService::disconnect_event_supplier ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)) + { + } + + + void + DirectEventService::push_event ( + Components::EventBase * ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + ACE_DEBUG ((LM_DEBUG, "CIAO::DirectEventService::push_event\n")); + + size_t end = this->consumer_array_.size (); + + // Iterate through the array, pushing the event to each consumer. + for (size_t iter = 0; iter < end; ++iter) + { + ev->_add_ref (); + this->consumer_array_[iter]->push_event ( + ev + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + } + + Direct_Consumer_Config_impl::Direct_Consumer_Config_impl () : + service_type_ (DIRECT) + { + } + + void + Direct_Consumer_Config_impl::consumer_id ( + const char * consumer_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + this->consumer_id_ = consumer_id; + } + + void + Direct_Consumer_Config_impl::supplier_id ( + const char * supplier_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + this->supplier_id_ = supplier_id; + } + + void + Direct_Consumer_Config_impl::consumer ( + Components::EventConsumerBase_ptr consumer + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + this->consumer_ = consumer; + } + + CONNECTION_ID + Direct_Consumer_Config_impl::consumer_id ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + return CORBA::string_dup (this->consumer_id_.c_str ()); + } + + CONNECTION_ID + Direct_Consumer_Config_impl::supplier_id ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + return CORBA::string_dup (this->supplier_id_.c_str ()); + } + + EventServiceType + Direct_Consumer_Config_impl::service_type ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + return this->service_type_; + } + + Components::EventConsumerBase_ptr + Direct_Consumer_Config_impl::consumer ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + return Components::EventConsumerBase::_duplicate (this->consumer_.in ()); + } + + Direct_Supplier_Config_impl::Direct_Supplier_Config_impl () : + service_type_ (DIRECT) + { + } + + void + Direct_Supplier_Config_impl::supplier_id ( + const char * supplier_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + this->supplier_id_ = supplier_id; + } + + CONNECTION_ID + Direct_Supplier_Config_impl::supplier_id ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + return CORBA::string_dup (this->supplier_id_.c_str ()); + } + + EventServiceType + Direct_Supplier_Config_impl::service_type ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + return this->service_type_; + } + +} diff --git a/TAO/CIAO/ciao/CIAO_DirectEvent.h b/TAO/CIAO/ciao/CIAO_DirectEvent.h new file mode 100644 index 00000000000..f96c947c45f --- /dev/null +++ b/TAO/CIAO/ciao/CIAO_DirectEvent.h @@ -0,0 +1,179 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CIAO_DirectEvent.h + * + * $Id$ + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//============================================================================= + +#ifndef CIAO_DIRECTEVENT_H +#define CIAO_DIRECTEVENT_H +#include /**/ "ace/pre.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "CIAO_EventServiceBase.h" +#include "CIAO_DirectEventS.h" + +#include "ace/Array.h" + +namespace CIAO +{ + + /** + * @class DirectEventService + * + * An implementation of EventServiceBase using direct communication. + */ + class DirectEventService : + public virtual EventServiceBase + { + + public: + + DirectEventService (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa); + + virtual void connect_event_supplier ( + CIAO::Supplier_Config_ptr supplier_config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + virtual void connect_event_consumer ( + CIAO::Consumer_Config_ptr consumer_config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + virtual void disconnect_event_consumer ( + const char * connection_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)); + + virtual void disconnect_event_supplier ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)); + + virtual void push_event ( + Components::EventBase * ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + private: + + // Reference to the ORB + CORBA::ORB_var orb_; + + // Reference to the Root POA + PortableServer::POA_var root_poa_; + + /** + * @var ACE_Array<Components::EventConsumerBase_ptr> consumer_array_ + * + * List of consumers. + */ + ACE_Array<Components::EventConsumerBase_ptr> consumer_array_; + + }; + + + /** + * @class Direct_Consumer_Config_impl + * + * Implementation of the Direct_Consumer_Config IDL interface that + * configures TAO's direct event mechanism. An object of this type will be + * returned from @c CIAO::Container::create_consumer_config () when @c DIRECT + * is specified as the event service type. + */ + class Direct_Consumer_Config_impl : + public virtual POA_CIAO::Direct_Consumer_Config + { + + public: + + Direct_Consumer_Config_impl (); + + virtual void consumer_id (const char * consumer_id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CONNECTION_ID consumer_id (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void supplier_id (const char * supplier_id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CONNECTION_ID supplier_id (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void consumer (Components::EventConsumerBase_ptr consumer ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual Components::EventConsumerBase_ptr consumer (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual EventServiceType service_type (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + private: + + ACE_CString consumer_id_; + + ACE_CString supplier_id_; + + Components::EventConsumerBase_var consumer_; + + EventServiceType service_type_; + + }; + + /** + * @class Direct_Supplier_Config_impl + * + * Implementation of the Direct_Supplier_Config IDL interface that + * configures TAO's direct event mechanism. An object of this type will be + * returned from @c CIAO::Container::create_supplier_config () when @c DIRECT + * is specified as the event service type. + */ + class Direct_Supplier_Config_impl : + public virtual POA_CIAO::Direct_Supplier_Config + { + + public: + + Direct_Supplier_Config_impl (); + + void supplier_id (const char * supplier_id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + char * supplier_id (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + EventServiceType service_type (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + private: + + ACE_CString supplier_id_; + + EventServiceType service_type_; + + }; + +} + +#include /**/ "ace/post.h" +#endif /* CIAO_DIRECTEVENT_H */ diff --git a/TAO/CIAO/ciao/CIAO_DirectEvent.idl b/TAO/CIAO/ciao/CIAO_DirectEvent.idl new file mode 100644 index 00000000000..917e5007cb9 --- /dev/null +++ b/TAO/CIAO/ciao/CIAO_DirectEvent.idl @@ -0,0 +1,28 @@ +// $Id$ + +/** + * @file CIAO_DirectEvent.idl + * + * @author George Edwards + * + * @brief Interfaces for configuring CIAO's direct event service. + */ + +#include "CIAO_Events.idl" + +module CIAO +{ + + interface Direct_Consumer_Config : + Consumer_Config + { + + }; + + interface Direct_Supplier_Config : + Supplier_Config + { + + }; + +}; diff --git a/TAO/CIAO/ciao/CIAO_EventServiceBase.h b/TAO/CIAO/ciao/CIAO_EventServiceBase.h new file mode 100644 index 00000000000..b18b756902a --- /dev/null +++ b/TAO/CIAO/ciao/CIAO_EventServiceBase.h @@ -0,0 +1,108 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CIAO_EventServiceBase.h + * + * $Id$ + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//============================================================================= + +#ifndef CIAO_EVENTSERVICEBASE_H +#define CIAO_EVENTSERVICEBASE_H +#include /**/ "ace/pre.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "CIAO_EventsS.h" + +namespace CIAO +{ + + /** + * @class EventServiceBase + * + * An abstract base class; derived classes will provide appropriate + * implementations of the connect, disconnect, and push methods depending on + * the event mechanism used. @c EventServiceBase objects are created on a + * 1-per-supplier basis. Each event source and sink has an associated + * @c EventServiceBase object, stored in a map in CIAO::Container. + */ + // @@ George, any particular reason that this cannot be a local + /// interface in an idl? The above struct can also be pushed into + /// an IDL, unless you don't want to have object semantics. + class CIAO_EVENTS_Export EventServiceBase + { + + public: + + /** + * @fn void connect_event_supplier (Supplier_Config_ptr supplier_config) + * + * Connects an event supplier using the options specified by + * @c supplier_config. + */ + virtual void connect_event_supplier ( + Supplier_Config_ptr supplier_config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) = 0; + + /** + * @fn void connect_event_consumer (Consumer_Config_ptr consumer_config) + * + * Connects an event consumer using the options specified by + * @c consumer_config. + */ + virtual void connect_event_consumer ( + Consumer_Config_ptr consumer_config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) = 0; + + /** + * @fn void disconnect_event_supplier () + * + * Disconnects the event supplier associated with this object. + */ + virtual void disconnect_event_supplier ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)) = 0; + + /** + * @fn void disconnect_event_consumer (CONNECTION_ID consumer_id) + * + * Disconnects the event consumer with UUID @c consumer_id. + */ + virtual void disconnect_event_consumer ( + const char * consumer_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)) = 0; + + /** + * @fn void push_event (Components::EventBase * ev) + * + * Pushes event @c ev to all consumers. + */ + virtual void push_event ( + Components::EventBase * ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) = 0; + + }; + +} + +#include /**/ "ace/post.h" +#endif /* CIAO_EVENTSERVICEBASE_H */ diff --git a/TAO/CIAO/ciao/CIAO_EventService_Factory.cpp b/TAO/CIAO/ciao/CIAO_EventService_Factory.cpp new file mode 100644 index 00000000000..2118a7068c3 --- /dev/null +++ b/TAO/CIAO/ciao/CIAO_EventService_Factory.cpp @@ -0,0 +1,28 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CIAO_EventService_Factory.cpp + * + * $Id$ + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//============================================================================= + +#include "CIAO_EventService_Factory.h" +#include "ace/Dynamic_Service.h" + +CIAO::EventService_Factory::~EventService_Factory (void) +{ +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class ACE_Dynamic_Service<EventService_Factory>; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +#pragma instantiate ACE_Dynamic_Service<EventService_Factory> + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/CIAO/ciao/CIAO_EventService_Factory.h b/TAO/CIAO/ciao/CIAO_EventService_Factory.h new file mode 100644 index 00000000000..811bc8bb5ff --- /dev/null +++ b/TAO/CIAO/ciao/CIAO_EventService_Factory.h @@ -0,0 +1,81 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CIAO_EventService_Factory.h + * + * $Id$ + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//============================================================================= + +#ifndef CIAO_EVENTSERVICE_FACTORY_H +#define CIAO_EVENTSERVICE_FACTORY_H +#include /**/ "ace/pre.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "CIAO_EventServiceBase.h" + +namespace CIAO +{ + /** + * @class EventService_Factory + * + * An abstract factory that creates event configuration and service objects. + * A concrete implementation is obtained by CIAO::Container via the ACE + * service configurator. + */ + class CIAO_EVENTS_Export EventService_Factory : + public ACE_Service_Object + { + + public: + + /** + * @fn ~EventService_Factory (void) + * + * Destructor. + */ + virtual ~EventService_Factory (void); + + /** + * @fn Consumer_Config_ptr create_consumer_config (EventServiceType type) + * + * Creates and returns a new Consumer_Config object corresponding to the + * type specified by @c type. + */ + virtual Consumer_Config_ptr create_consumer_config ( + EventServiceType type) = 0; + + /** + * @fn Supplier_Config_ptr create_supplier_config (EventServiceType type) + * + * Creates and returns a new Supplier_Config object corresponding to the + * type specified by @c type. + */ + virtual Supplier_Config_ptr create_supplier_config ( + EventServiceType type) = 0; + + /** + * @fn EventServiceBase * create (EventServiceType type) + * + * Creates and returns a new EventServiceBase object corresponding to the + * type specified by @c type. + */ + virtual EventServiceBase * create ( + EventServiceType type) = 0; + + virtual void init ( + CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa) = 0; + + }; + +} + +#include /**/ "ace/post.h" +#endif /* CIAO_EVENTSERVICE_FACTORY_H */ diff --git a/TAO/CIAO/ciao/CIAO_EventService_Factory_impl.cpp b/TAO/CIAO/ciao/CIAO_EventService_Factory_impl.cpp new file mode 100644 index 00000000000..2f2c2874764 --- /dev/null +++ b/TAO/CIAO/ciao/CIAO_EventService_Factory_impl.cpp @@ -0,0 +1,343 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CIAO_EventService_Factory_impl.cpp + * + * $Id$ + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//============================================================================= + +#include "CIAO_EventService_Factory_impl.h" +#include "CIAO_DirectEvent.h" +#include "CIAO_RTEvent.h" +#include "CIAO_CosNotify.h" + +#include "orbsvcs/Event/EC_Event_Channel.h" + +/// Initialize the RTEventService object. Will eventually be moved to a separate init () +/// method so exceptions can be handled properly. + +// @@ George, an init () method in the base class sounds like a better option. + +namespace CIAO +{ + + EventService_Factory_impl::EventService_Factory_impl (void) : + rt_event_channel_ (RtecEventChannelAdmin::EventChannel::_nil ()), + notify_channel_ (CosNotifyChannelAdmin::EventChannel::_nil ()) + { + + /*this->orb_ = CORBA::ORB_init (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + CORBA::Object_var poa_object = + this->orb_->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + if (CORBA::is_nil (poa_object.in ())) + ACE_ERROR ((LM_ERROR, + " (%P|%t) Unable to initialize the POA.\n")); + this->root_poa_ = + PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + */ + + } + + EventService_Factory_impl::~EventService_Factory_impl (void) + { + } + + Consumer_Config_ptr + EventService_Factory_impl::create_consumer_config (EventServiceType type) + { + + switch (type) + { + case DIRECT: + { + Direct_Consumer_Config_impl * consumer_config = 0; + ACE_NEW_RETURN (consumer_config, + Direct_Consumer_Config_impl, + Consumer_Config::_nil ()); + Direct_Consumer_Config_var return_direct = + consumer_config->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + return return_direct._retn (); + break; + } + case RTEC: + { + RTEvent_Consumer_Config_impl * consumer_config = 0; + ACE_NEW_RETURN (consumer_config, + RTEvent_Consumer_Config_impl, + Consumer_Config::_nil ()); + RTEvent_Consumer_Config_var return_rtec = + consumer_config->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + return return_rtec._retn (); + break; + } + case NOTIFY: + { + CosNotify_Consumer_Config_impl * consumer_config = 0; + ACE_NEW_RETURN (consumer_config, + CosNotify_Consumer_Config_impl, + Consumer_Config::_nil ()); + CosNotify_Consumer_Config_var return_notify = + consumer_config->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + return return_notify._retn (); + break; + } + } + + return Consumer_Config::_nil (); + + } + + Supplier_Config_ptr + EventService_Factory_impl::create_supplier_config (EventServiceType type) + { + + // @@George, at this place we should be able to load from a library. + // @@ And oh, BTW, keep direct as default. If there are no strings + // for then we should use the direct mode of connection. + + switch (type) + { + case DIRECT: + { + Direct_Supplier_Config_impl * supplier_config = 0; + ACE_NEW_RETURN (supplier_config, + Direct_Supplier_Config_impl, + Supplier_Config::_nil ()); + Direct_Supplier_Config_var return_direct = + supplier_config->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + return return_direct._retn (); + break; + } + case RTEC: + { + RTEvent_Supplier_Config_impl * supplier_config = 0; + ACE_NEW_RETURN (supplier_config, + RTEvent_Supplier_Config_impl, + Supplier_Config::_nil ()); + RTEvent_Supplier_Config_var return_rtec = + supplier_config->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + return return_rtec._retn (); + break; + } + case NOTIFY: + { + CosNotify_Supplier_Config_impl * supplier_config = 0; + ACE_NEW_RETURN (supplier_config, + CosNotify_Supplier_Config_impl, + Supplier_Config::_nil ()); + CosNotify_Supplier_Config_var return_notify = + supplier_config->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + return return_notify._retn (); + break; + } + } + + return Supplier_Config::_nil (); + + } + + EventServiceBase * + EventService_Factory_impl::create (EventServiceType type) + { + + ACE_DEBUG ((LM_DEBUG, "CIAO::EventService_Factory_impl::create_event_service\n")); + + switch (type) + { + case DIRECT: + { + DirectEventService * event_service = 0; + ACE_NEW_RETURN (event_service, + DirectEventService (this->orb_.in (), + this->root_poa_.in ()), + 0); + return event_service; + break; + } + case RTEC: + { + if (CORBA::is_nil (this->rt_event_channel_.in ())) + { + this->create_rt_event_channel (ACE_ENV_SINGLE_ARG_DECL); + ACE_CHECK; + } + RTEventService * event_service = 0; + ACE_NEW_RETURN (event_service, + RTEventService (this->orb_.in (), + this->root_poa_.in (), + this->rt_event_channel_.in ()), + 0); + return event_service; + break; + } + case NOTIFY: + { + if (CORBA::is_nil (this->notify_channel_.in ())) + { + this->create_notify_channel (ACE_ENV_SINGLE_ARG_DECL); + ACE_CHECK; + } + CosNotifyService * event_service = 0; + ACE_NEW_RETURN (event_service, + CosNotifyService (this->orb_.in (), + this->root_poa_.in (), + this->notify_channel_.in ()), + 0); + return event_service; + break; + } + } + + return 0; + + } + + /*EventConsumerInfo + Events_Manager::find_consumer_info (CONNECTION_ID connection_id) + { + + EventConsumerInfo consumer_info; + + if (this->consumer_info_map_.find (connection_id, consumer_info) == -1) + { + ACE_THROW ((CORBA::BAD_PARAM ())); + } + + return consumer_info; + + } + + void + Events_Manager::bind_consumer_info (EventConsumerInfo consumer_info, + CONNECTION_ID connection_id) + { + + /// Save the consumer's disconnect info in a map. + this->consumer_info_map_.bind (connection_id, + consumer_info); + + } + + RtecEventComm::EventType + Events_Manager::find_rtec_type_id (CONNECTION_ID connection_id) + { + + RtecEventComm::EventType event_type_id; + + if (this->event_types_map_.find (connection_id, event_type_id) == -1) + { + event_type_id = + ACE_ES_EVENT_ANY + 1 + this->event_types_map_.current_size (); + this->event_types_map_.bind (connection_id, event_type_id); + } + + return event_type_id; + + } + + RtecEventComm::EventSourceID + Events_Manager::find_rtec_source_id (CONNECTION_ID connection_id) + { + + RtecEventComm::EventSourceID event_source_id; + + if (this->publishers_map_.find (connection_id, event_source_id) == -1) + { + event_source_id = + ACE_ES_EVENT_SOURCE_ANY + 1 + this->publishers_map_.current_size (); + this->publishers_map_.bind (connection_id, event_source_id); + } + + return event_source_id; + + }*/ + + // @@ George, not sure how we plan to get the svc.conf file options + // into the channel. Just a place holder to think about it. + void + EventService_Factory_impl::create_rt_event_channel ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + ACE_DEBUG ((LM_DEBUG, "CIAO::EventService_Factory_impl::create_rt_event_channel\n")); + + TAO_EC_Event_Channel_Attributes attributes (this->root_poa_.in (), + this->root_poa_.in ()); + TAO_EC_Event_Channel * ec_servant; + ACE_NEW (ec_servant, TAO_EC_Event_Channel (attributes)); + ec_servant->activate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + this->rt_event_channel_ = ec_servant->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } + + void + EventService_Factory_impl::create_notify_channel ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + + ACE_DEBUG ((LM_DEBUG, "CIAO::EventService_Factory_impl::create_notify_channel\n")); + + CosNotifyChannelAdmin::EventChannelFactory_var notify_factory; + CosNotifyChannelAdmin::ChannelID id; + CosNotification::QoSProperties initial_qos; + CosNotification::AdminProperties initial_admin; + this->notify_channel_ = notify_factory->create_channel (initial_qos, + initial_admin, + id + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + + int + EventService_Factory_impl::Initializer (void) + { + return + ACE_Service_Config::process_directive ( + ace_svc_desc_EventService_Factory_impl + ); + } + + void EventService_Factory_impl::init (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa) + { + this->orb_ = CORBA::ORB::_duplicate (orb); + this->root_poa_ = PortableServer::POA::_duplicate (poa); + } + +ACE_STATIC_SVC_DEFINE ( + EventService_Factory_impl, + ACE_TEXT ("CIAO_EventService_Factory"), + ACE_SVC_OBJ_T, + &ACE_SVC_NAME (EventService_Factory_impl), + ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, + 0 + ) + +ACE_FACTORY_DEFINE (CIAO_EVENTS, EventService_Factory_impl) + +} // namespace CIAO + diff --git a/TAO/CIAO/ciao/CIAO_EventService_Factory_impl.h b/TAO/CIAO/ciao/CIAO_EventService_Factory_impl.h new file mode 100644 index 00000000000..e9b447a141d --- /dev/null +++ b/TAO/CIAO/ciao/CIAO_EventService_Factory_impl.h @@ -0,0 +1,125 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CIAO_EventService_Factory_impl.h + * + * $Id$ + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//============================================================================= + +#ifndef CIAO_EVENTSERVICE_FACTORY_IMPL_H +#define CIAO_EVENTSERVICE_FACTORY_IMPL_H +#include /**/ "ace/pre.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "CIAO_EventService_Factory.h" + +#include "orbsvcs/RtecEventChannelAdminC.h" +#include "orbsvcs/CosNotifyChannelAdminC.h" +#include "tao/PortableServer/PortableServer.h" + +namespace CIAO +{ + + class CIAO_EVENTS_Export EventService_Factory_impl + : public virtual EventService_Factory + { + + public: + // @@ George, why don't you initialize with the POA pointer. Just + // curious. + EventService_Factory_impl (void); + + virtual ~EventService_Factory_impl (void); + + virtual Consumer_Config_ptr create_consumer_config (EventServiceType type); + + virtual Supplier_Config_ptr create_supplier_config (EventServiceType type); + + virtual EventServiceBase * create (EventServiceType type); + + virtual void init (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa); + + // Used to force the initialization. + static int Initializer (void); + + //RtecEventComm::EventType find_rtec_type_id (CONNECTION_ID connection_id); + + //RtecEventComm::EventSourceID find_rtec_source_id (CONNECTION_ID connection_id); + + //EventConsumerInfo find_consumer_info (CONNECTION_ID connection_id); + + //void bind_consumer_info (EventConsumerInfo consumer_info, CONNECTION_ID connection_id); + + private: + + // @George, all these can be moved to a different + // library. Further, they probably need to be delegated to the + // underlying concrete type to create it for you instead of + // providing interfaces. + void create_rt_event_channel ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + void create_notify_channel ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + // Reference to the ORB + CORBA::ORB_var orb_; + + // Reference to the Root POA + PortableServer::POA_var root_poa_; + + /// Reference to the RT event channel + RtecEventChannelAdmin::EventChannel_var rt_event_channel_; + + /// Reference to the notification channel + CosNotifyChannelAdmin::EventChannel_var notify_channel_; + + /// Map of rt event type ids + //ACE_Hash_Map_Manager<CONNECTION_ID, RtecEventComm::EventType, ACE_Null_Mutex> + // event_types_map_; + + /// Map of rt supplier ids + //ACE_Hash_Map_Manager<CONNECTION_ID, RtecEventComm::EventSourceID, ACE_Null_Mutex> + // publishers_map_; + + /// Mapping of consumers to state/disconnect info. + //ACE_Hash_Map_Manager<CIAO_Events::CONNECTION_ID, + // CIAO_Events::EventConsumerInfo, + // ACE_Null_Mutex> consumer_info_map_; + + }; + +ACE_STATIC_SVC_DECLARE (EventService_Factory_impl) +ACE_FACTORY_DECLARE (CIAO_EVENTS, EventService_Factory_impl) + +} + +#if defined (ACE_HAS_BROKEN_STATIC_CONSTRUCTORS) + +typedef int (*CIAO_Module_Initializer) (void); + +static CIAO_Module_Initializer +CIAO_Requires_EventService_Initializer = + &CIAO::EventService_Factory_impl::Initializer; + +#else + +static int +CIAO_Requires_EventService_Initializer = + CIAO::EventService_Factory_impl::Initializer (); + +#endif /* ACE_HAS_BROKEN_STATIC_CONSTRUCTORS */ + +#include /**/ "ace/post.h" +#endif /* CIAO_EVENTSERVICE_FACTORY_IMPL_H */ diff --git a/TAO/CIAO/ciao/CIAO_Events.cpp b/TAO/CIAO/ciao/CIAO_Events.cpp deleted file mode 100644 index 05061bfcda0..00000000000 --- a/TAO/CIAO/ciao/CIAO_Events.cpp +++ /dev/null @@ -1,1132 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file CIAO_Events.cpp - * - * $Id$ - * - * Method definitions for CIAO's event classes - * - * @author George Edwards <g.edwards@vanderbilt.edu> - */ -//============================================================================= - -#include "CIAO_Events.h" - -// @George, to prevent long lines, you could do -// -// -// namespace CIAO_Events -// { -// RTEventService::RTEventService () -// .... -// } -// -// Further please keep things to 80 columns. -// -// There seems to be some obvious memory leaks that I think you are -// already addressing. - -/// Initialize the RTEventService object. Will eventually be moved to a separate init () -/// method so exceptions can be handled properly. - -// @@ George, an init () method in the base class sounds like a better option. -CIAO_Events::RTEventService::RTEventService (CORBA::ORB_ptr orb, RtecEventChannelAdmin::EventChannel_ptr ec) : - orb_ (CORBA::ORB::_duplicate (orb)), - rt_event_channel_ (RtecEventChannelAdmin::EventChannel::_duplicate (ec)), - type_id_ (ACE_ES_EVENT_ANY), - source_id_ (ACE_ES_EVENT_SOURCE_ANY) -{ - CORBA::Object_var poa_object = - orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - if (CORBA::is_nil (poa_object.in ())) - ACE_ERROR ((LM_ERROR, - " (%P|%t) Unable to initialize the POA.\n")); - this->root_poa_ = - PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -// @@ George, ad these comments to the header file. The CPP file -// should have code and other comments related to the code. TAO and -// ACE has code like this which I am cleaning up. -/// Connect a supplier to the RT event channel. -void CIAO_Events::RTEventService::connect_event_supplier ( - CIAO_Events::Supplier_Config_ptr supplier_config - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException)) -{ - - ACE_DEBUG ((LM_DEBUG, "CIAO_Events::RTEventService::connect_event_supplier\n")); - - RtecEventChannelAdmin::SupplierAdmin_var supplier_admin = - this->rt_event_channel_->for_suppliers (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - this->proxy_consumer_ = - supplier_admin->obtain_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - // Create and register supplier servant - CIAO_Events::RTEventServiceSupplier_impl * supplier_servant; - ACE_NEW (supplier_servant, - CIAO_Events::RTEventServiceSupplier_impl (orb_.in ())); - this->push_supplier_ = - supplier_servant->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - RtecEventChannelAdmin::SupplierQOS_var qos = supplier_config->get_rt_event_qos (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - this->proxy_consumer_->connect_push_supplier (this->push_supplier_.in (), - qos.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -/// Connect a consumer to the RT event channel. -CIAO_Events::EventServiceInfo -CIAO_Events::RTEventService::connect_event_consumer ( - CIAO_Events::Consumer_Config_ptr consumer_config - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException)) -{ - ACE_DEBUG ((LM_DEBUG, "CIAO_Events::RTEventService::connect_event_consumer\n")); - - CIAO_Events::EventServiceInfo service_info; - service_info.type = RTEC; - service_info.service = this; - - Components::EventConsumerBase_var consumer = - consumer_config->get_consumer (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - RtecEventChannelAdmin::ConsumerAdmin_var consumer_admin = - this->rt_event_channel_->for_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - RtecEventChannelAdmin::ProxyPushSupplier_var proxy_supplier = - consumer_admin->obtain_push_supplier (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - // Create and register consumer servant - CIAO_Events::RTEventServiceConsumer_impl * consumer_servant; - ACE_NEW_RETURN (consumer_servant, - CIAO_Events::RTEventServiceConsumer_impl (orb_.in (), consumer.in ()), - service_info); - RtecEventComm::PushConsumer_var push_consumer = - consumer_servant->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - RtecEventChannelAdmin::ConsumerQOS_var qos = - consumer_config->get_rt_event_qos (ACE_ENV_SINGLE_ARG_PARAMETER); - - ACE_CHECK; - proxy_supplier->connect_push_consumer (push_consumer.in (), - qos.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - service_info.disconnect.rtec_push_consumer = push_consumer._retn (); - - return service_info; -} - -void CIAO_Events::RTEventService::disconnect_event_consumer ( - CIAO_Events::EventServiceInfo service_info - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - Components::InvalidName, - Components::InvalidConnection)) -{ - service_info.disconnect.rtec_push_consumer->disconnect_push_consumer ( - ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; -} - -void -CIAO_Events::RTEventService::disconnect_event_supplier ( - ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - Components::InvalidName, - Components::InvalidConnection)) -{ - this->push_supplier_->disconnect_push_supplier ( - ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; -} - -void -CIAO_Events::RTEventService::push_event ( - ::Components::EventBase *ev - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException)) -{ - ACE_DEBUG ((LM_DEBUG, "CIAO_Events::RTEventService::push_event\n")); - - RtecEventComm::EventSet events (1); - events.length (1); - events[0].header.source = this->source_id_; - events[0].header.type = this->type_id_; - events[0].data.any_value <<= ev; - /** - * @@George, a place holder for reliable oneways if we get to - * support it. - */ - this->proxy_consumer_->push (events ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -/// Nothing to do here. -void CIAO_Events::DirectEventService::connect_event_supplier ( - CIAO_Events::Supplier_Config_ptr supplier_config - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException)) -{ -} - -/// Add a consumer to the map. -CIAO_Events::EventServiceInfo CIAO_Events::DirectEventService::connect_event_consumer ( - CIAO_Events::Consumer_Config_ptr consumer_config - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - CIAO_Events::EventServiceInfo service_info; - service_info.type = DIRECT; - service_info.service = this; - - // @@ George, Any reason not to use ACE_NEW_THROW_EX (). Exceptions - // comes free then. - ACE_NEW_RETURN (service_info.disconnect.consumer_key, - ACE_Active_Map_Manager_Key, - service_info); - Components::EventConsumerBase_var consumer = - consumer_config->get_consumer (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - this->consumer_map_.bind (consumer._retn (), - *service_info.disconnect.consumer_key); - - return service_info; - -} - -void CIAO_Events::DirectEventService::disconnect_event_consumer ( - CIAO_Events::EventServiceInfo service_info - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - Components::InvalidName, - Components::InvalidConnection)) -{ -} - -void CIAO_Events::DirectEventService::disconnect_event_supplier ( - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - Components::InvalidName, - Components::InvalidConnection)) -{ -} - -/// Iterate through the map, pushing the event to each consumer. -void CIAO_Events::DirectEventService::push_event ( - Components::EventBase *ev - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException)) -{ - ACE_DEBUG ((LM_DEBUG, "CIAO_Events::DirectEventService::push_event\n")); - - ev->_add_ref (); - - ACE_Active_Map_Manager<Components::EventConsumerBase_ptr>::iterator end = - this->consumer_map_.end (); - - for (ACE_Active_Map_Manager<Components::EventConsumerBase_ptr>::iterator iter = - this->consumer_map_.begin (); - iter != end; - ++iter) - { - ACE_Active_Map_Manager<Components::EventConsumerBase_ptr>::ENTRY &entry = *iter; - - entry.int_id_->push_event ( - ev - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } -} - -CIAO_Events::CosNotifyService::CosNotifyService (CORBA::ORB_ptr orb, CosNotifyChannelAdmin::EventChannel_ptr ec) : - orb_ (CORBA::ORB::_duplicate (orb)), - notify_channel_ (CosNotifyChannelAdmin::EventChannel::_duplicate (ec)), - type_id_ ("Any"), - source_id_ ("Any") -{ - CORBA::Object_var poa_object = - orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - if (CORBA::is_nil (poa_object.in ())) - ACE_ERROR ((LM_ERROR, - " (%P|%t) Unable to initialize the POA.\n")); - this->root_poa_ = - PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -void CIAO_Events::CosNotifyService::connect_event_supplier ( - CIAO_Events::Supplier_Config_ptr supplier_config - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException)) -{ - ACE_DEBUG ((LM_DEBUG, "CIAO_Events::CosNotifyService::connect_event_supplie\n")); - - CosNotifyChannelAdmin::AdminID admin_id; - CosNotifyChannelAdmin::SupplierAdmin_var supplier_admin = - this->notify_channel_->new_for_suppliers (CosNotifyChannelAdmin::OR_OP, - admin_id - ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - CosNotifyChannelAdmin::ProxyID proxy_id; - CosNotifyChannelAdmin::ProxyConsumer_var my_proxy = - supplier_admin->obtain_notification_push_consumer (CosNotifyChannelAdmin::STRUCTURED_EVENT, - proxy_id - ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - this->proxy_consumer_ = CosNotifyChannelAdmin::StructuredProxyPushConsumer::_narrow (my_proxy.in ()); - if (CORBA::is_nil (this->proxy_consumer_.in ())) - { - ACE_ERROR ((LM_ERROR, - " (%P|%t) CIAO_Events::CosNotifyService::connect_event_supplier\n")); - } - - // Create and register supplier servant - CIAO_Events::CosNotifyServiceSupplier_impl * supplier_servant; - ACE_NEW (supplier_servant, - CIAO_Events::CosNotifyServiceSupplier_impl (orb_.in ())); - this->push_supplier_ = - supplier_servant->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - CosNotifyFilter::Filter_var filter = supplier_config->get_notify_filter (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - CosNotification::QoSProperties_var qos = supplier_config->get_notify_qos (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - this->proxy_consumer_->add_filter (filter.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - this->proxy_consumer_->set_qos (qos.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - this->proxy_consumer_->connect_structured_push_supplier (this->push_supplier_.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -CIAO_Events::EventServiceInfo CIAO_Events::CosNotifyService::connect_event_consumer ( - CIAO_Events::Consumer_Config_ptr consumer_config - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException)) -{ - CIAO_Events::EventServiceInfo service_info; - service_info.type = NOTIFY; - service_info.service = this; - - Components::EventConsumerBase_var consumer = - consumer_config->get_consumer (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - CosNotifyChannelAdmin::AdminID admin_id; - CosNotifyChannelAdmin::ConsumerAdmin_var consumer_admin = - this->notify_channel_->new_for_consumers (CosNotifyChannelAdmin::OR_OP, - admin_id - ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - CosNotifyChannelAdmin::ProxyID proxy_id; - CosNotifyChannelAdmin::ProxySupplier_var my_proxy = - consumer_admin->obtain_notification_push_supplier (CosNotifyChannelAdmin::STRUCTURED_EVENT, - proxy_id - ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - CosNotifyChannelAdmin::StructuredProxyPushSupplier_var proxy_supplier = - CosNotifyChannelAdmin::StructuredProxyPushSupplier::_narrow (my_proxy.in ()); - if (CORBA::is_nil (proxy_supplier.in ())) - { - ACE_ERROR ((LM_ERROR, - " (%P|%t) CIAO_Events::CosNotifyService::connect_event_consumer\n")); - } - - // Create and register consumer servant - CIAO_Events::CosNotifyServiceConsumer_impl * consumer_servant; - ACE_NEW_RETURN (consumer_servant, - CIAO_Events::CosNotifyServiceConsumer_impl (orb_.in (), consumer.in ()), - service_info); - CosNotifyComm::StructuredPushConsumer_var push_consumer = - consumer_servant->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - CosNotifyFilter::Filter_var filter = consumer_config->get_notify_filter (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - CosNotification::QoSProperties_var qos = consumer_config->get_notify_qos (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - proxy_supplier->add_filter (filter.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - proxy_supplier->set_qos (qos.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - proxy_supplier->connect_structured_push_consumer (push_consumer.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - service_info.disconnect.notify_push_consumer = push_consumer._retn (); - return service_info; - -} - -void CIAO_Events::CosNotifyService::disconnect_event_consumer ( - CIAO_Events::EventServiceInfo service_info - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - Components::InvalidName, - Components::InvalidConnection)) -{ -} - -void CIAO_Events::CosNotifyService::disconnect_event_supplier ( - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - Components::InvalidName, - Components::InvalidConnection)) -{ -} - -void CIAO_Events::CosNotifyService::push_event ( - Components::EventBase *ev - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException)) -{ - ACE_DEBUG ((LM_DEBUG, "CIAO_Events::DirectEventService::push_event\n")); - CosNotification::StructuredEvent event; - event.header.fixed_header.event_type.domain_name = CORBA::string_dup ("CIAO_Events"); - event.header.fixed_header.event_type.type_name = this->type_id_; - event.header.fixed_header.event_name = this->source_id_; - event.remainder_of_body <<= ev; - - this->proxy_consumer_->push_structured_event (event ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - -} - -CIAO_Events::RTEvent_Consumer_Config::RTEvent_Consumer_Config (Events_Manager * em) : - service_type_ (RTEC), - events_manager_ (em) -{ -} - -void CIAO_Events::RTEvent_Consumer_Config::start_conjunction_group (CORBA::Long size ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->qos_.start_conjunction_group (size); -} - -void CIAO_Events::RTEvent_Consumer_Config::start_disjunction_group (CORBA::Long size ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->qos_.start_disjunction_group (size); -} - -void CIAO_Events::RTEvent_Consumer_Config::set_consumer_id (CONNECTION_ID connection_id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->consumer_id_ = connection_id; -} - -void CIAO_Events::RTEvent_Consumer_Config::insert_supplier_id (CONNECTION_ID connection_id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->supplier_id_ = connection_id; - this->qos_.insert (this->events_manager_->get_rtec_source_id (connection_id), - this->events_manager_->get_rtec_type_id (connection_id), - 0); -} - -void CIAO_Events::RTEvent_Consumer_Config::set_consumer (Components::EventConsumerBase_ptr consumer ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->consumer_ = Components::EventConsumerBase::_duplicate (consumer); -} - -CIAO_Events::CONNECTION_ID CIAO_Events::RTEvent_Consumer_Config::get_consumer_id (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->consumer_id_; -} - -CIAO_Events::CONNECTION_ID CIAO_Events::RTEvent_Consumer_Config::get_supplier_id (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->supplier_id_; -} - -CIAO_Events::EventServiceType CIAO_Events::RTEvent_Consumer_Config::get_service_type (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->service_type_; -} - -Components::EventConsumerBase_ptr CIAO_Events::RTEvent_Consumer_Config::get_consumer (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->consumer_._retn (); -} - -RtecEventChannelAdmin::ConsumerQOS * CIAO_Events::RTEvent_Consumer_Config::get_rt_event_qos (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - ACE_DEBUG ((LM_DEBUG, "CIAO_Events::RTEvent_Consumer_Config::get_rt_event_qos\n")); - - RtecEventChannelAdmin::ConsumerQOS * consumer_qos = 0; - ACE_NEW_RETURN (consumer_qos, RtecEventChannelAdmin::ConsumerQOS (this->qos_.get_ConsumerQOS ()), 0); - return consumer_qos; -} - -CosNotifyFilter::Filter * CIAO_Events::RTEvent_Consumer_Config::get_notify_filter (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return 0; -} - -CosNotification::QoSProperties * CIAO_Events::RTEvent_Consumer_Config::get_notify_qos (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return 0; -} - -CIAO_Events::RTEvent_Supplier_Config::RTEvent_Supplier_Config (Events_Manager * em) : - service_type_ (RTEC), - events_manager_ (em) -{ -} - -void CIAO_Events::RTEvent_Supplier_Config::set_supplier_id (CONNECTION_ID connection_id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->supplier_id_ = connection_id; - this->qos_.insert (this->events_manager_->get_rtec_source_id (this->supplier_id_), - this->events_manager_->get_rtec_type_id (this->supplier_id_), - 0, - 1); -} - -CIAO_Events::CONNECTION_ID CIAO_Events::RTEvent_Supplier_Config::get_supplier_id (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->supplier_id_; -} - -CIAO_Events::EventServiceType CIAO_Events::RTEvent_Supplier_Config::get_service_type (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->service_type_; -} - -RtecEventChannelAdmin::SupplierQOS * CIAO_Events::RTEvent_Supplier_Config::get_rt_event_qos (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - - ACE_DEBUG ((LM_DEBUG, "CIAO_Events::RTEvent_Supplier_Config::get_rt_event_qos\n")); - - RtecEventChannelAdmin::SupplierQOS * supplier_qos = 0; - ACE_NEW_RETURN (supplier_qos, RtecEventChannelAdmin::SupplierQOS (this->qos_.get_SupplierQOS ()), 0); - return supplier_qos; -} - -CosNotification::QoSProperties * CIAO_Events::RTEvent_Supplier_Config::get_notify_qos (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return 0; -} - -CosNotifyFilter::Filter * CIAO_Events::RTEvent_Supplier_Config::get_notify_filter (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return 0; -} - -CIAO_Events::Direct_Consumer_Config::Direct_Consumer_Config (Events_Manager * em) : - service_type_ (DIRECT), - events_manager_ (em) -{ -} - -void CIAO_Events::Direct_Consumer_Config::start_conjunction_group (CORBA::Long size ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ -} - -void CIAO_Events::Direct_Consumer_Config::start_disjunction_group (CORBA::Long size ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ -} - -void CIAO_Events::Direct_Consumer_Config::set_consumer_id (CONNECTION_ID connection_id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->consumer_id_ = connection_id; -} - -void CIAO_Events::Direct_Consumer_Config::insert_supplier_id (CONNECTION_ID connection_id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->supplier_id_ = connection_id; -} - -void CIAO_Events::Direct_Consumer_Config::set_consumer (Components::EventConsumerBase_ptr consumer ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->consumer_ = Components::EventConsumerBase::_duplicate (consumer); -} - -CIAO_Events::CONNECTION_ID CIAO_Events::Direct_Consumer_Config::get_consumer_id (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->consumer_id_; -} - -CIAO_Events::CONNECTION_ID CIAO_Events::Direct_Consumer_Config::get_supplier_id (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->supplier_id_; -} - -CIAO_Events::EventServiceType CIAO_Events::Direct_Consumer_Config::get_service_type (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->service_type_; -} - -Components::EventConsumerBase_ptr CIAO_Events::Direct_Consumer_Config::get_consumer (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->consumer_._retn (); -} - -RtecEventChannelAdmin::ConsumerQOS * CIAO_Events::Direct_Consumer_Config::get_rt_event_qos (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return 0; -} - -CosNotifyFilter::Filter * CIAO_Events::Direct_Consumer_Config::get_notify_filter (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return 0; -} - -CosNotification::QoSProperties * CIAO_Events::Direct_Consumer_Config::get_notify_qos (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return 0; -} - -CIAO_Events::Direct_Supplier_Config::Direct_Supplier_Config (Events_Manager * em) : - service_type_ (DIRECT), - events_manager_ (em) -{ -} - -void CIAO_Events::Direct_Supplier_Config::set_supplier_id (CONNECTION_ID connection_id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->supplier_id_ = connection_id; -} - -CIAO_Events::CONNECTION_ID CIAO_Events::Direct_Supplier_Config::get_supplier_id (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->supplier_id_; -} - -CIAO_Events::EventServiceType CIAO_Events::Direct_Supplier_Config::get_service_type (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->service_type_; -} - -RtecEventChannelAdmin::SupplierQOS * CIAO_Events::Direct_Supplier_Config::get_rt_event_qos (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return 0; -} - -CosNotifyFilter::Filter * CIAO_Events::Direct_Supplier_Config::get_notify_filter (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return 0; -} - -CosNotification::QoSProperties * CIAO_Events::Direct_Supplier_Config::get_notify_qos (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return 0; -} - -CIAO_Events::CosNotify_Consumer_Config::CosNotify_Consumer_Config (Events_Manager * em) : - service_type_ (NOTIFY), - events_manager_ (em) -{ -} - -void CIAO_Events::CosNotify_Consumer_Config::start_conjunction_group (CORBA::Long size ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ -} - -void CIAO_Events::CosNotify_Consumer_Config::start_disjunction_group (CORBA::Long size ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ -} - -void CIAO_Events::CosNotify_Consumer_Config::set_consumer_id (CONNECTION_ID connection_id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->consumer_id_ = connection_id; -} - -void CIAO_Events::CosNotify_Consumer_Config::insert_supplier_id (CONNECTION_ID connection_id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->supplier_id_ = connection_id; -} - -void CIAO_Events::CosNotify_Consumer_Config::set_consumer (Components::EventConsumerBase_ptr consumer ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->consumer_ = Components::EventConsumerBase::_duplicate (consumer); -} - -CIAO_Events::CONNECTION_ID CIAO_Events::CosNotify_Consumer_Config::get_consumer_id (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->consumer_id_; -} - -CIAO_Events::CONNECTION_ID CIAO_Events::CosNotify_Consumer_Config::get_supplier_id (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->supplier_id_; -} - -CIAO_Events::EventServiceType CIAO_Events::CosNotify_Consumer_Config::get_service_type (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->service_type_; -} - -Components::EventConsumerBase_ptr CIAO_Events::CosNotify_Consumer_Config::get_consumer (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->consumer_._retn (); -} - -RtecEventChannelAdmin::ConsumerQOS * CIAO_Events::CosNotify_Consumer_Config::get_rt_event_qos (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return 0; -} - -CosNotifyFilter::Filter * CIAO_Events::CosNotify_Consumer_Config::get_notify_filter (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->filter_._retn (); -} - -CosNotification::QoSProperties * CIAO_Events::CosNotify_Consumer_Config::get_notify_qos (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->qos_._retn (); -} - -CIAO_Events::CosNotify_Supplier_Config::CosNotify_Supplier_Config (Events_Manager * em) : - service_type_ (NOTIFY), - events_manager_ (em) -{ -} - -void CIAO_Events::CosNotify_Supplier_Config::set_supplier_id (CONNECTION_ID connection_id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - this->supplier_id_ = connection_id; -} - -CIAO_Events::CONNECTION_ID CIAO_Events::CosNotify_Supplier_Config::get_supplier_id (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->supplier_id_; -} - -CIAO_Events::EventServiceType CIAO_Events::CosNotify_Supplier_Config::get_service_type (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->service_type_; -} - -RtecEventChannelAdmin::SupplierQOS * CIAO_Events::CosNotify_Supplier_Config::get_rt_event_qos (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return 0; -} - -CosNotifyFilter::Filter * CIAO_Events::CosNotify_Supplier_Config::get_notify_filter (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->filter_._retn (); -} - -CosNotification::QoSProperties * CIAO_Events::CosNotify_Supplier_Config::get_notify_qos (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - return this->qos_._retn (); -} - -/// Initialize the Events_Manager -CIAO_Events::Events_Manager::Events_Manager (CORBA::ORB_ptr orb) : - orb_ (CORBA::ORB::_duplicate (orb)), - rt_event_channel_ (RtecEventChannelAdmin::EventChannel::_nil ()), - notify_channel_ (CosNotifyChannelAdmin::EventChannel::_nil ()) -{ - CORBA::Object_var poa_object = - orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - if (CORBA::is_nil (poa_object.in ())) - ACE_ERROR ((LM_ERROR, - " (%P|%t) Unable to initialize the POA.\n")); - this->root_poa_ = - PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -CIAO_Events::Consumer_Config_ptr CIAO_Events::Events_Manager::create_consumer_config (const char * service_type) -{ - if (ACE_OS::strcmp (service_type, "DIRECT") == 0) - { - CIAO_Events::Direct_Consumer_Config * consumer_config = 0; - ACE_NEW_RETURN (consumer_config, CIAO_Events::Direct_Consumer_Config (this), 0); - CIAO_Events::Consumer_Config_var return_config = - consumer_config->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - return return_config._retn (); - } - else if (ACE_OS::strcmp (service_type, "RTEC") == 0) - { - CIAO_Events::RTEvent_Consumer_Config * consumer_config = 0; - ACE_NEW_RETURN (consumer_config, CIAO_Events::RTEvent_Consumer_Config (this), 0); - CIAO_Events::Consumer_Config_var return_config = - consumer_config->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - return return_config._retn (); - } - else if (ACE_OS::strcmp (service_type, "NOTIFY") == 0) - { - CIAO_Events::CosNotify_Consumer_Config * consumer_config = 0; - ACE_NEW_RETURN (consumer_config, CIAO_Events::CosNotify_Consumer_Config (this), 0); - CIAO_Events::Consumer_Config_var return_config = - consumer_config->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - return return_config._retn (); - } - - return 0; - -} - -CIAO_Events::Supplier_Config_ptr -CIAO_Events::Events_Manager::create_supplier_config (const char * service_type) -{ - - // @@George, at this place we should be able to load from a library. - // @@ And oh, BTW, keep direct as default. If there are no strings - // for then we should use the direct mode of connection. - if (ACE_OS::strcmp (service_type, "DIRECT") == 0) - { - CIAO_Events::Direct_Supplier_Config * supplier_config = 0; - ACE_NEW_RETURN (supplier_config, CIAO_Events::Direct_Supplier_Config (this), 0); - CIAO_Events::Supplier_Config_var return_config = - supplier_config->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - return return_config._retn (); - } - else if (ACE_OS::strcmp (service_type, "RTEC") == 0) - { - CIAO_Events::RTEvent_Supplier_Config * supplier_config = 0; - ACE_NEW_RETURN (supplier_config, CIAO_Events::RTEvent_Supplier_Config (this), 0); - CIAO_Events::Supplier_Config_var return_config = - supplier_config->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - return return_config._retn (); - } - else if (ACE_OS::strcmp (service_type, "NOTIFY") == 0) - { - CIAO_Events::CosNotify_Supplier_Config * supplier_config = 0; - ACE_NEW_RETURN (supplier_config, CIAO_Events::CosNotify_Supplier_Config (this), 0); - CIAO_Events::Supplier_Config_var return_config = - supplier_config->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - return return_config._retn (); - } - - return 0; -} - -CIAO_Events::EventServiceBase * CIAO_Events::Events_Manager::create_supplier (Supplier_Config_ptr supplier_config) -{ - - ACE_DEBUG ((LM_DEBUG, "CIAO_Events::Events_Manager::create_supplier\n")); - - CIAO_Events::EventServiceBase * event_service = 0; - - switch (supplier_config->get_service_type ()) - { - case DIRECT: - ACE_NEW_RETURN (event_service, CIAO_Events::DirectEventService, 0); - break; - case RTEC: - if (CORBA::is_nil (this->rt_event_channel_.in ())) - { - this->create_rt_event_channel (ACE_ENV_SINGLE_ARG_DECL); - ACE_CHECK; - } - ACE_NEW_RETURN (event_service, CIAO_Events::RTEventService (orb_.in (), rt_event_channel_.in ()), 0); - break; - case NOTIFY: - if (CORBA::is_nil (this->notify_channel_.in ())) - { - this->create_notify_channel (ACE_ENV_SINGLE_ARG_DECL); - ACE_CHECK; - } - ACE_NEW_RETURN (event_service, CIAO_Events::CosNotifyService (orb_.in (), notify_channel_.in ()), 0); - break; - } - - return event_service; -} - -RtecEventComm::EventType CIAO_Events::Events_Manager::get_rtec_type_id (CONNECTION_ID connection_id) -{ - - RtecEventComm::EventType event_type_id; - - if (this->event_types_map_.find (connection_id, event_type_id) == -1) - { - event_type_id = - ACE_ES_EVENT_ANY + 1 + this->event_types_map_.current_size (); - this->event_types_map_.bind (connection_id, event_type_id); - } - - return event_type_id; -} - -RtecEventComm::EventSourceID CIAO_Events::Events_Manager::get_rtec_source_id (CONNECTION_ID connection_id) -{ - - RtecEventComm::EventSourceID event_source_id; - - if (this->publishers_map_.find (connection_id, event_source_id) == -1) - { - event_source_id = - ACE_ES_EVENT_SOURCE_ANY + 1 + this->publishers_map_.current_size (); - this->publishers_map_.bind (connection_id, event_source_id); - } - - return event_source_id; -} - -// @@ George, not sure how we plan to get the svc.conf file options -// into the channel. Just a place holder to think about it. -void CIAO_Events::Events_Manager::create_rt_event_channel ( - ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException)) -{ - ACE_DEBUG ((LM_DEBUG, "CIAO_Events::Events_Manager::create_rt_event_channel\n")); - - TAO_EC_Event_Channel_Attributes attributes (this->root_poa_.in (), - this->root_poa_.in ()); - TAO_EC_Event_Channel * ec_servant; - ACE_NEW (ec_servant, TAO_EC_Event_Channel (attributes)); - ec_servant->activate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - this->rt_event_channel_ = ec_servant->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; -} - -void CIAO_Events::Events_Manager::create_notify_channel ( - ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException)) -{ - - ACE_DEBUG ((LM_DEBUG, "CIAO_Events::Events_Manager::create_notify_channel\n")); - CosNotifyChannelAdmin::EventChannelFactory_var notify_factory; - CosNotifyChannelAdmin::ChannelID id; - CosNotification::QoSProperties initial_qos; - CosNotification::AdminProperties initial_admin; - this->notify_channel_ = notify_factory->create_channel (initial_qos, - initial_admin, - id - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -CIAO_Events::RTEventServiceSupplier_impl::RTEventServiceSupplier_impl (void) -{ -} - -CIAO_Events::RTEventServiceSupplier_impl::RTEventServiceSupplier_impl (CORBA::ORB_ptr orb) : - orb_ (CORBA::ORB::_duplicate (orb)) -{ -} - -void CIAO_Events::RTEventServiceSupplier_impl::disconnect_push_supplier (void) -{ - CORBA::Object_var poa_object = - orb_->resolve_initial_references ("RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - PortableServer::POA_var root_poa = - PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - if (CORBA::is_nil (root_poa.in ())) - ACE_ERROR ((LM_ERROR, "Nil RootPOA\n")); - PortableServer::ObjectId_var oid = root_poa->servant_to_id (this); - root_poa->deactivate_object (oid); - delete this; -} - -CIAO_Events::RTEventServiceConsumer_impl::RTEventServiceConsumer_impl (void) -{ -} - -CIAO_Events::RTEventServiceConsumer_impl::RTEventServiceConsumer_impl - (CORBA::ORB_ptr orb, - Components::EventConsumerBase_ptr consumer) : - orb_ (CORBA::ORB::_duplicate (orb)), - event_consumer_ (Components::EventConsumerBase::_duplicate (consumer)) -{ -} - -void CIAO_Events::RTEventServiceConsumer_impl::push (const RtecEventComm::EventSet& events) -{ - ACE_DEBUG ((LM_DEBUG, "CIAO::RTEventServiceConsumer_impl::push\n")); - for (unsigned long i = 0; i < events.length (); ++i) - { - ::Components::EventBase * ev; - if (events[i].data.any_value >>= ev) - { - ev->_add_ref (); - this->event_consumer_->push_event (ev - ACE_ENV_ARG_PARAMETER); - } - } -} - -void CIAO_Events::RTEventServiceConsumer_impl::disconnect_push_consumer (void) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - ACE_DEBUG ((LM_DEBUG, "CIAO::RTEventServiceConsumer_impl::disconnect_push_consumer\n")); - - CORBA::Object_var poa_object = - orb_->resolve_initial_references ("RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - PortableServer::POA_var root_poa = - PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - if (CORBA::is_nil (root_poa.in ())) - ACE_ERROR ((LM_ERROR, "Nil RootPOA\n")); - PortableServer::ObjectId_var oid = root_poa->servant_to_id (this); - root_poa->deactivate_object (oid); - delete this; -} - -CIAO_Events::CosNotifyServiceSupplier_impl::CosNotifyServiceSupplier_impl (void) -{ -} - -CIAO_Events::CosNotifyServiceSupplier_impl::CosNotifyServiceSupplier_impl (CORBA::ORB_ptr orb) : - orb_ (CORBA::ORB::_duplicate (orb)) -{ -} - -// @@ George, we write like this. -void -CIAO_Events::CosNotifyServiceSupplier_impl::disconnect_structured_push_supplier (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ -} - -void CIAO_Events::CosNotifyServiceSupplier_impl::subscription_change ( - const CosNotification::EventTypeSeq& events_added, - const CosNotification::EventTypeSeq& events_removed - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - CosNotifyComm::InvalidEventType)) -{ -} - -CIAO_Events::CosNotifyServiceConsumer_impl::CosNotifyServiceConsumer_impl (void) -{ -} - -CIAO_Events::CosNotifyServiceConsumer_impl::CosNotifyServiceConsumer_impl (CORBA::ORB_ptr orb, - Components::EventConsumerBase_ptr consumer) : - orb_ (CORBA::ORB::_duplicate (orb)), - event_consumer_ (Components::EventConsumerBase::_duplicate (consumer)) -{ -} - -void CIAO_Events::CosNotifyServiceConsumer_impl::push_structured_event (const CosNotification::StructuredEvent& event) -{ - ACE_DEBUG ((LM_DEBUG, "CIAO_Events::CosNotifyServiceConsumer_impl::push_structured_event\n")); - Components::EventBase * ev; - if (event.remainder_of_body >>= ev) - { - ev->_add_ref (); - this->event_consumer_->push_event (ev - ACE_ENV_ARG_PARAMETER); - } -} - -void CIAO_Events::CosNotifyServiceConsumer_impl::disconnect_structured_push_consumer (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ -} - -void CIAO_Events::CosNotifyServiceConsumer_impl::offer_change ( - const CosNotification::EventTypeSeq& events_added, - const CosNotification::EventTypeSeq& events_removed - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - CosNotifyComm::InvalidEventType)) -{ -} diff --git a/TAO/CIAO/ciao/CIAO_Events.h b/TAO/CIAO/ciao/CIAO_Events.h deleted file mode 100644 index 38db3afe4c3..00000000000 --- a/TAO/CIAO/ciao/CIAO_Events.h +++ /dev/null @@ -1,754 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file CIAO_Events.h - * - * $Id$ - * - * Header file for CIAO's event classes - * - * @author George Edwards <g.edwards@vanderbilt.edu> - */ -//============================================================================= - -#ifndef CIAO_EVENTS_H -#define CIAO_EVENTS_H -#include /**/ "ace/pre.h" - -// @@ George Pragma please.. - -#include "orbsvcs/CosNotifyCommS.h" -#include "orbsvcs/CosNotifyChannelAdminS.h" -#include "orbsvcs/RtecEventCommS.h" -#include "orbsvcs/RtecEventChannelAdminS.h" -#include "Event_Utilities.h" -#include "orbsvcs/Event/EC_Event_Channel.h" -#include "orbsvcs/Event/EC_Default_Factory.h" -#include "CCM_ContainerC.h" -#include "ace/Active_Map_Manager.h" -#include "CIAO_EventsS.h" - -// @@ George, can't we stuff everything in CIAO namespace? -namespace CIAO_Events -{ - - // Forward declarations. - class EventServiceBase; - class Events_Manager; - - /// Stores information about event consumers. Stored in a map in CIAO::Container. - struct EventServiceInfo - { - EventServiceType type; - EventServiceBase * service; - union - { - CosNotifyComm::StructuredPushConsumer_ptr notify_push_consumer; - RtecEventComm::PushConsumer_ptr rtec_push_consumer; - ACE_Active_Map_Manager_Key * consumer_key; - } disconnect; - }; - - // @@ George, if you accept the suggestion in CIAO_Events.idl, we - // should probably add a class per file. - - /// An abstract base class. Derived classes will provide appropriate implementations of - /// the connect, disconnect, and push methods. Each event source has an associated - /// EventServiceBase, stored in a map in CIAO::Container. - /** - * @@ George, doxygen documentation please.. - */ - // @@ George, any particular reason that this cannot be a local - /// interface in an idl? The above struct can also be pushed into - /// an IDL, unless you don't want to have object semantics. - class EventServiceBase - { - - public: - - virtual void connect_event_supplier ( - CIAO_Events::Supplier_Config_ptr supplier_config - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException)) = 0; - - virtual CIAO_Events::EventServiceInfo connect_event_consumer ( - CIAO_Events::Consumer_Config_ptr consumer_config - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException)) = 0; - - virtual void disconnect_event_consumer ( - CIAO_Events::EventServiceInfo service_info - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - Components::InvalidName, - Components::InvalidConnection)) = 0; - - virtual void disconnect_event_supplier ( - ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - Components::InvalidName, - Components::InvalidConnection)) = 0; - - virtual void push_event ( - Components::EventBase *ev - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException)) = 0; - - }; - - /// An implementation of EventServiceBase using TAO's RT Event Channel. - class RTEventService : - public virtual EventServiceBase - { - - public: - - RTEventService (CORBA::ORB_ptr orb, RtecEventChannelAdmin::EventChannel_ptr ec); - - virtual void connect_event_supplier ( - CIAO_Events::Supplier_Config_ptr supplier_config - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException)); - - virtual CIAO_Events::EventServiceInfo connect_event_consumer ( - CIAO_Events::Consumer_Config_ptr consumer_config - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException)); - - virtual void disconnect_event_consumer ( - CIAO_Events::EventServiceInfo service_info - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - Components::InvalidName, - Components::InvalidConnection)); - - virtual void disconnect_event_supplier ( - ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - Components::InvalidName, - Components::InvalidConnection)); - - virtual void push_event ( - Components::EventBase *ev - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException)); - - private: - - CORBA::ORB_var orb_; - - // Reference to the Root POA - PortableServer::POA_var root_poa_; - - /// Reference to the RT event channel - RtecEventChannelAdmin::EventChannel_var rt_event_channel_; - - /// The type of event - RtecEventComm::EventType type_id_; - - /// Info for the event publisher - RtecEventComm::EventSourceID source_id_; - RtecEventComm::PushSupplier_var push_supplier_; - RtecEventChannelAdmin::ProxyPushConsumer_var proxy_consumer_; - - }; - - /// An implementation of EventServiceBase using direct communication. - class DirectEventService : - public virtual EventServiceBase - { - - public: - - virtual void connect_event_supplier ( - CIAO_Events::Supplier_Config_ptr supplier_config - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException)); - - virtual CIAO_Events::EventServiceInfo connect_event_consumer ( - CIAO_Events::Consumer_Config_ptr consumer_config - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException)); - - virtual void disconnect_event_consumer ( - CIAO_Events::EventServiceInfo service_info - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - Components::InvalidName, - Components::InvalidConnection)); - - virtual void disconnect_event_supplier ( - ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - Components::InvalidName, - Components::InvalidConnection)); - - virtual void push_event ( - Components::EventBase *ev - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException)); - - private: - - /// Map of consumers - ACE_Active_Map_Manager<Components::EventConsumerBase_ptr> consumer_map_; - - }; - - class CosNotifyService : - public virtual EventServiceBase - { - - public: - - CosNotifyService (CORBA::ORB_ptr orb, CosNotifyChannelAdmin::EventChannel_ptr ec); - - virtual void connect_event_supplier ( - CIAO_Events::Supplier_Config_ptr supplier_config - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException)); - - virtual CIAO_Events::EventServiceInfo connect_event_consumer ( - CIAO_Events::Consumer_Config_ptr consumer_config - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException)); - - virtual void disconnect_event_consumer ( - CIAO_Events::EventServiceInfo service_info - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - Components::InvalidName, - Components::InvalidConnection)); - - virtual void disconnect_event_supplier ( - ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - Components::InvalidName, - Components::InvalidConnection)); - - virtual void push_event ( - Components::EventBase *ev - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException)); - - private: - - CORBA::ORB_var orb_; - - // Reference to the Root POA - PortableServer::POA_var root_poa_; - - /// Reference to the RT event channel - CosNotifyChannelAdmin::EventChannel_var notify_channel_; - - /// The type of event - CORBA::String_var type_id_; - - /// Info for the event publisher - CORBA::String_var source_id_; - CosNotifyComm::StructuredPushSupplier_var push_supplier_; - CosNotifyChannelAdmin::StructuredProxyPushConsumer_var proxy_consumer_; - - }; - - /// An implementation of the Consumer_Config IDL interface that configures - /// an RT Event Channel. An object of this type will be returned from - /// CIAO::Container::_ciao_create_event_consumer_config () when "RTEC" is - /// specified as the event service type. - // @@ George, class documentations are done like this in doxygen - // - // /** - // * @class name - // * - // * @brief brief explanation here - // * - // * - // */ - // - - - class RTEvent_Consumer_Config : - public virtual POA_CIAO_Events::Consumer_Config - { - - public: - - RTEvent_Consumer_Config (Events_Manager * em); - - void start_conjunction_group (CORBA::Long size ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - void start_disjunction_group (CORBA::Long size ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - void set_consumer_id (CONNECTION_ID connection_id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - void insert_supplier_id (CONNECTION_ID connection_id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - void set_consumer (Components::EventConsumerBase_ptr consumer ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - CONNECTION_ID get_consumer_id (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - CONNECTION_ID get_supplier_id (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - EventServiceType get_service_type (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - Components::EventConsumerBase_ptr get_consumer (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - RtecEventChannelAdmin::ConsumerQOS * get_rt_event_qos (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - CosNotifyFilter::Filter * get_notify_filter (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - CosNotification::QoSProperties * get_notify_qos (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - private: - - CONNECTION_ID consumer_id_; - - CONNECTION_ID supplier_id_; - - Components::EventConsumerBase_var consumer_; - - EventServiceType service_type_; - - Events_Manager * events_manager_; - - ACE_ConsumerQOS_Factory qos_; - }; - - /// An implementation of the Supplier_Config IDL interface that configures - /// TAO's RT Event Channel. An object of this type will be returned from - /// CIAO::Container::_ciao_create_event_supplier_config () when "RTEC" is - /// specified as the event service type. - class RTEvent_Supplier_Config : - public virtual POA_CIAO_Events::Supplier_Config - { - - public: - - RTEvent_Supplier_Config (Events_Manager * em); - - void set_supplier_id (CONNECTION_ID connection_id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - CONNECTION_ID get_supplier_id (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - EventServiceType get_service_type (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - RtecEventChannelAdmin::SupplierQOS * get_rt_event_qos (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - CosNotifyFilter::Filter * get_notify_filter (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - CosNotification::QoSProperties * get_notify_qos (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - private: - - CONNECTION_ID supplier_id_; - - EventServiceType service_type_; - - Events_Manager * events_manager_; - - ACE_SupplierQOS_Factory qos_; - - }; - - /// An implementation of the Consumer_Config IDL interface that configures - /// direct communication. An object of this type will be returned from - /// CIAO::Container::_ciao_create_event_consumer_config () when "DIRECT" is - /// specified as the event service type. - class Direct_Consumer_Config : - public virtual POA_CIAO_Events::Consumer_Config - { - - public: - - Direct_Consumer_Config (Events_Manager * em); - - void start_conjunction_group (CORBA::Long size ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - void start_disjunction_group (CORBA::Long size ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - void set_consumer_id (CONNECTION_ID connection_id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - void insert_supplier_id (CONNECTION_ID connection_id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - void set_consumer (Components::EventConsumerBase_ptr consumer ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - CONNECTION_ID get_consumer_id (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - CONNECTION_ID get_supplier_id (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - EventServiceType get_service_type (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - Components::EventConsumerBase_ptr get_consumer (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - RtecEventChannelAdmin::ConsumerQOS * get_rt_event_qos (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - CosNotifyFilter::Filter * get_notify_filter (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - CosNotification::QoSProperties * get_notify_qos (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - private: - - CONNECTION_ID consumer_id_; - - CONNECTION_ID supplier_id_; - - Components::EventConsumerBase_var consumer_; - - EventServiceType service_type_; - - Events_Manager * events_manager_; - }; - - /// An implementation of the Supplier_Config IDL interface that configures - /// direct communication. An object of this type will be returned from - /// CIAO::Container::_ciao_create_event_supplier_config () when "DIRECT" is - /// specified as the event service type. - class Direct_Supplier_Config : - public virtual POA_CIAO_Events::Supplier_Config - { - - public: - - Direct_Supplier_Config (Events_Manager * em); - - void set_supplier_id (CONNECTION_ID connection_id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - CONNECTION_ID get_supplier_id (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - EventServiceType get_service_type (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - RtecEventChannelAdmin::SupplierQOS * get_rt_event_qos (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - CosNotifyFilter::Filter * get_notify_filter (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - CosNotification::QoSProperties * get_notify_qos (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - private: - - CONNECTION_ID supplier_id_; - - EventServiceType service_type_; - - Events_Manager * events_manager_; - }; - - /// An implementation of the Consumer_Config IDL interface that configures - /// the CosNotify service. An object of this type will be returned from - /// CIAO::Container::_ciao_create_event_consumer_config () when "NOTIFY" is - /// specified as the event service type. - class CosNotify_Consumer_Config : - public virtual POA_CIAO_Events::Consumer_Config - { - - public: - - CosNotify_Consumer_Config (Events_Manager * em); - - void start_conjunction_group (CORBA::Long size ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - void start_disjunction_group (CORBA::Long size ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - void set_consumer_id (CONNECTION_ID connection_id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - void insert_supplier_id (CONNECTION_ID connection_id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - void set_consumer (Components::EventConsumerBase_ptr consumer ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - CONNECTION_ID get_consumer_id (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - CONNECTION_ID get_supplier_id (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - EventServiceType get_service_type (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - Components::EventConsumerBase_ptr get_consumer (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - RtecEventChannelAdmin::ConsumerQOS * get_rt_event_qos (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - CosNotifyFilter::Filter * get_notify_filter (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - CosNotification::QoSProperties * get_notify_qos (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - private: - - CONNECTION_ID consumer_id_; - - CONNECTION_ID supplier_id_; - - Components::EventConsumerBase_var consumer_; - - EventServiceType service_type_; - - Events_Manager * events_manager_; - - CosNotifyFilter::Filter_var filter_; - - CosNotification::QoSProperties_var qos_; - }; - - /// An implementation of the Supplier_Config IDL interface that configures - /// the CosNotify service. An object of this type will be returned from - /// CIAO::Container::_ciao_create_event_supplier_config () when "NOTIFY" is - /// specified as the event service type. - class CosNotify_Supplier_Config : - public virtual POA_CIAO_Events::Supplier_Config - { - - public: - - CosNotify_Supplier_Config (Events_Manager * em); - - void set_supplier_id (CONNECTION_ID connection_id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - CONNECTION_ID get_supplier_id (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - EventServiceType get_service_type (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - RtecEventChannelAdmin::SupplierQOS * get_rt_event_qos (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - CosNotifyFilter::Filter * get_notify_filter (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - CosNotification::QoSProperties * get_notify_qos (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - private: - - CONNECTION_ID supplier_id_; - - EventServiceType service_type_; - - Events_Manager * events_manager_; - - CosNotifyFilter::Filter_var filter_; - - CosNotification::QoSProperties_var qos_; - }; - - /// A helper class that encapsulates management functions for CIAO::Container. - class Events_Manager - { - - public: - // @@ George, why don't you initialize with the POA pointer. Just - // curious. - Events_Manager (CORBA::ORB_ptr orb); - - Consumer_Config_ptr create_consumer_config (const char * service_type); - - Supplier_Config_ptr create_supplier_config (const char * service_type); - - EventServiceBase * create_supplier (Supplier_Config * supplier_config); - - RtecEventComm::EventType get_rtec_type_id (CONNECTION_ID connection_id); - - RtecEventComm::EventSourceID get_rtec_source_id (CONNECTION_ID connection_id); - - private: - - // @George, all these can be moved to a different - // library. Further, they probably need to be delegated to the - // underlying concrete type to create it for you instead of - // providing interfaces. - void create_rt_event_channel ( - ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException)); - - void create_notify_channel ( - ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException)); - - CORBA::ORB_var orb_; - - PortableServer::POA_var root_poa_; - - /// Reference to the RT Event channel - RtecEventChannelAdmin::EventChannel_var rt_event_channel_; - - /// Reference to the Notification channel - CosNotifyChannelAdmin::EventChannel_var notify_channel_; - - /// Map of event type ids - ACE_Hash_Map_Manager<CONNECTION_ID, RtecEventComm::EventType, ACE_Null_Mutex> - event_types_map_; - - /// Map of supplier ids - ACE_Hash_Map_Manager<CONNECTION_ID, RtecEventComm::EventSourceID, ACE_Null_Mutex> - publishers_map_; - - }; - - /// An implementation for PushSupplier - class RTEventServiceSupplier_impl : - public virtual POA_RtecEventComm::PushSupplier, - public virtual PortableServer::RefCountServantBase - { - - public: - RTEventServiceSupplier_impl (void); - - RTEventServiceSupplier_impl (CORBA::ORB_ptr orb); - - virtual void disconnect_push_supplier (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - private: - CORBA::ORB_var orb_; - }; - - /// An implementation for PushConsumer - class RTEventServiceConsumer_impl : - public virtual POA_RtecEventComm::PushConsumer, - public virtual PortableServer::RefCountServantBase - { - - public: - RTEventServiceConsumer_impl (void); - - RTEventServiceConsumer_impl (CORBA::ORB_ptr orb, - Components::EventConsumerBase_ptr consumer); - - virtual void push (const RtecEventComm::EventSet& events); - - virtual void disconnect_push_consumer (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - private: - CORBA::ORB_var orb_; - Components::EventConsumerBase_var event_consumer_; - }; - - /// An implementation for PushSupplier - class CosNotifyServiceSupplier_impl : - public virtual POA_CosNotifyComm::StructuredPushSupplier, - public virtual PortableServer::RefCountServantBase - { - - public: - CosNotifyServiceSupplier_impl (void); - - CosNotifyServiceSupplier_impl (CORBA::ORB_ptr orb); - - virtual void disconnect_structured_push_supplier (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void subscription_change ( - const CosNotification::EventTypeSeq& events_added, - const CosNotification::EventTypeSeq& events_removed - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - CosNotifyComm::InvalidEventType)); - - private: - CORBA::ORB_var orb_; - }; - - /// An implementation for PushConsumer - class CosNotifyServiceConsumer_impl : - public virtual POA_CosNotifyComm::StructuredPushConsumer, - public virtual PortableServer::RefCountServantBase - { - - public: - CosNotifyServiceConsumer_impl (void); - - CosNotifyServiceConsumer_impl (CORBA::ORB_ptr orb, - Components::EventConsumerBase_ptr consumer); - - virtual void push_structured_event (const CosNotification::StructuredEvent& event); - - virtual void disconnect_structured_push_consumer (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); - - virtual void offer_change ( - const CosNotification::EventTypeSeq& events_added, - const CosNotification::EventTypeSeq& events_removed - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - CosNotifyComm::InvalidEventType)); - - private: - CORBA::ORB_var orb_; - Components::EventConsumerBase_var event_consumer_; - }; - -} - -#include /**/ "ace/post.h" -#endif /* CIAO_EVENTS_H */ diff --git a/TAO/CIAO/ciao/CIAO_Events.idl b/TAO/CIAO/ciao/CIAO_Events.idl index 9b233556bc6..f6c2a79d368 100644 --- a/TAO/CIAO/ciao/CIAO_Events.idl +++ b/TAO/CIAO/ciao/CIAO_Events.idl @@ -3,19 +3,18 @@ /** * @file CIAO_Events.idl * - * @author George Edwards + * @author George Edwards <g.edwards@vanderbilt.edu> * * @brief Interfaces for configuring CIAO's event mechanism. */ #include "CCM_Event.idl" -#include "RtecEventChannelAdmin.idl" -#include "CosNotifyChannelAdmin.idl" -module CIAO_Events +module CIAO { - /// A component's UUID. - typedef long CONNECTION_ID; + + /// A component's UUID + port name. + typedef string CONNECTION_ID; enum EventServiceType { @@ -26,6 +25,47 @@ module CIAO_Events RTNOTIFY }; + interface Consumer_Config + { + + attribute CONNECTION_ID supplier_id; + + attribute CONNECTION_ID consumer_id; + + attribute Components::EventConsumerBase consumer; + + readonly attribute EventServiceType service_type; + + }; + + interface Supplier_Config + { + + attribute CONNECTION_ID supplier_id; + + readonly attribute EventServiceType service_type; + + }; + + interface ContainerEventService + { + + Supplier_Config create_supplier_config (in EventServiceType type); + + Consumer_Config create_consumer_config (in EventServiceType type); + + void connect_event_supplier (in Supplier_Config supplier_config); + + void disconnect_event_supplier (in CONNECTION_ID connection_id); + + void connect_event_consumer (in Consumer_Config consumer_config); + + void disconnect_event_consumer (in CONNECTION_ID connection_id); + + void push_event (in Components::EventBase ev, + in CONNECTION_ID connection_id); + }; + /// An object for setting consumer QoS requirements. This will be expanded to /// allow filtering, correlation, etc. A Consumer_Config object is passed as /// a parameter to CIAO::Container::_ciao_connect_event_consumer (). @@ -66,6 +106,7 @@ module CIAO_Events // time. // // + /* interface Consumer_Config { // @@ George, when you have time, could you please document the @@ -132,5 +173,6 @@ module CIAO_Events CosNotification::QoSProperties get_notify_qos (); }; + */ }; diff --git a/TAO/CIAO/ciao/CIAO_Events_Export.h b/TAO/CIAO/ciao/CIAO_Events_Export.h new file mode 100644 index 00000000000..6678cef4bcc --- /dev/null +++ b/TAO/CIAO/ciao/CIAO_Events_Export.h @@ -0,0 +1,53 @@ +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl CIAO_EVENTS +// ------------------------------ +#ifndef CIAO_EVENTS_EXPORT_H +#define CIAO_EVENTS_EXPORT_H + +#include "ace/config-all.h" + +#if !defined (CIAO_EVENTS_HAS_DLL) +# define CIAO_EVENTS_HAS_DLL 1 +#endif /* ! CIAO_EVENTS_HAS_DLL */ + +#if defined (CIAO_EVENTS_HAS_DLL) && (CIAO_EVENTS_HAS_DLL == 1) +# if defined (CIAO_EVENTS_BUILD_DLL) +# define CIAO_EVENTS_Export ACE_Proper_Export_Flag +# define CIAO_EVENTS_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define CIAO_EVENTS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* CIAO_EVENTS_BUILD_DLL */ +# define CIAO_EVENTS_Export ACE_Proper_Import_Flag +# define CIAO_EVENTS_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define CIAO_EVENTS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* CIAO_EVENTS_BUILD_DLL */ +#else /* CIAO_EVENTS_HAS_DLL == 1 */ +# define CIAO_EVENTS_Export +# define CIAO_EVENTS_SINGLETON_DECLARATION(T) +# define CIAO_EVENTS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* CIAO_EVENTS_HAS_DLL == 1 */ + +// Set CIAO_EVENTS_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (CIAO_EVENTS_NTRACE) +# if (ACE_NTRACE == 1) +# define CIAO_EVENTS_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define CIAO_EVENTS_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !CIAO_EVENTS_NTRACE */ + +#if (CIAO_EVENTS_NTRACE == 1) +# define CIAO_EVENTS_TRACE(X) +#else /* (CIAO_EVENTS_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define CIAO_EVENTS_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (CIAO_EVENTS_NTRACE == 1) */ + +#endif /* CIAO_EVENTS_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/ciao/CIAO_RTEvent.cpp b/TAO/CIAO/ciao/CIAO_RTEvent.cpp new file mode 100644 index 00000000000..4c491c3aa94 --- /dev/null +++ b/TAO/CIAO/ciao/CIAO_RTEvent.cpp @@ -0,0 +1,491 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CIAO_RTEvent.cpp + * + * $Id$ + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//============================================================================= + +#include "CIAO_RTEvent.h" + +namespace CIAO +{ + + RTEventService::RTEventService (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + RtecEventChannelAdmin::EventChannel_ptr ec) : + orb_ (CORBA::ORB::_duplicate (orb)), + root_poa_ (PortableServer::POA::_duplicate (poa)), + rt_event_channel_ (RtecEventChannelAdmin::EventChannel::_duplicate (ec)), + type_id_ (ACE_ES_EVENT_ANY), + source_id_ (ACE_ES_EVENT_SOURCE_ANY) + { + } + + RTEventService::~RTEventService (void) + { + } + + void + RTEventService::connect_event_supplier ( + Supplier_Config_ptr supplier_config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + + ACE_DEBUG ((LM_DEBUG, "CIAO::RTEventService::connect_event_supplier\n")); + + ACE_Hash<ACE_CString> hasher; + this->source_id_ = hasher (supplier_config->supplier_id (ACE_ENV_SINGLE_ARG_PARAMETER)); + ACE_CHECK; + this->type_id_ = this->source_id_; + + ACE_DEBUG ((LM_DEBUG, "connect source id: %i\n", this->source_id_)); + + RtecEventChannelAdmin::SupplierAdmin_var supplier_admin = + this->rt_event_channel_->for_suppliers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->proxy_consumer_ = + supplier_admin->obtain_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + // Create and register supplier servant + RTEventServiceSupplier_impl * supplier_servant = 0; + ACE_NEW (supplier_servant, + RTEventServiceSupplier_impl (orb_.in ())); + RtecEventComm::PushSupplier_var push_supplier = + supplier_servant->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + RTEvent_Supplier_Config_ptr rt_config = + RTEvent_Supplier_Config::_narrow (supplier_config + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (rt_config)) + { + ACE_THROW ((CORBA::BAD_PARAM ())); + } + + RtecEventChannelAdmin::SupplierQOS_var qos = + rt_config->rt_event_qos (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->proxy_consumer_->connect_push_supplier (push_supplier.in (), + qos.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + } + + void + RTEventService::connect_event_consumer ( + Consumer_Config_ptr consumer_config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + + ACE_DEBUG ((LM_DEBUG, "CIAO::RTEventService::connect_event_consumer\n")); + + Components::EventConsumerBase_var consumer = + consumer_config->consumer (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (consumer.in ())) + ACE_DEBUG ((LM_DEBUG, "nil event consumer\n")); + + RtecEventChannelAdmin::ConsumerAdmin_var consumer_admin = + this->rt_event_channel_->for_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + RtecEventChannelAdmin::ProxyPushSupplier_var proxy_supplier = + consumer_admin->obtain_push_supplier (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + // Create and register consumer servant + RTEventServiceConsumer_impl * consumer_servant = 0; + ACE_NEW (consumer_servant, + RTEventServiceConsumer_impl ( + orb_.in (), + Components::EventConsumerBase::_duplicate (consumer.in ()))); + RtecEventComm::PushConsumer_var push_consumer = + consumer_servant->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + RTEvent_Consumer_Config_ptr rt_config = + RTEvent_Consumer_Config::_narrow (consumer_config + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (rt_config)) + { + ACE_THROW ((CORBA::BAD_PARAM ())); + } + + RtecEventChannelAdmin::ConsumerQOS_var qos = + rt_config->rt_event_qos (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + proxy_supplier->connect_push_consumer (push_consumer.in (), + qos.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + ACE_CString consumer_id = + consumer_config->consumer_id (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->proxy_supplier_map_.bind (consumer_id.c_str (), proxy_supplier._retn ()); + + } + + void + RTEventService::disconnect_event_supplier ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)) + { + + this->proxy_consumer_->disconnect_push_consumer ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + // What to do with the consumers?! + + } + + void + RTEventService::disconnect_event_consumer ( + const char * connection_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)) + { + + RtecEventChannelAdmin::ProxyPushSupplier_var proxy_supplier; + + this->proxy_supplier_map_.unbind (connection_id, proxy_supplier); + + proxy_supplier->disconnect_push_supplier ( + ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + } + + void + RTEventService::push_event ( + Components::EventBase * ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + + ACE_DEBUG ((LM_DEBUG, "CIAO::RTEventService::push_event\n")); + + RtecEventComm::EventSet events (1); + events.length (1); + events[0].header.source = ACE_ES_EVENT_SOURCE_ANY; //this->source_id_; + events[0].header.type = ACE_ES_EVENT_ANY; //this->type_id_; + events[0].data.any_value <<= ev; + /** + * @@George, a place holder for reliable oneways if we get to + * support it. + */ + this->proxy_consumer_->push (events ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + } + + RTEventServiceSupplier_impl::RTEventServiceSupplier_impl (void) + { + } + + RTEventServiceSupplier_impl::RTEventServiceSupplier_impl ( + CORBA::ORB_ptr orb) : + orb_ (CORBA::ORB::_duplicate (orb)) + { + } + + void + RTEventServiceSupplier_impl::disconnect_push_supplier (void) + { + CORBA::Object_var poa_object = + orb_->resolve_initial_references ("RootPOA" ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR ((LM_ERROR, "Nil RootPOA\n")); + PortableServer::ObjectId_var oid = root_poa->servant_to_id (this); + root_poa->deactivate_object (oid); + delete this; + } + + RTEventServiceConsumer_impl::RTEventServiceConsumer_impl (void) + { + } + + RTEventServiceConsumer_impl::RTEventServiceConsumer_impl ( + CORBA::ORB_ptr orb, + Components::EventConsumerBase_ptr consumer) : + orb_ (CORBA::ORB::_duplicate (orb)), + event_consumer_ (Components::EventConsumerBase::_duplicate (consumer)) + { + } + + void + RTEventServiceConsumer_impl::push (const RtecEventComm::EventSet& events) + { + ACE_DEBUG ((LM_DEBUG, "CIAO::RTEventServiceConsumer_impl::push\n")); + + for (size_t i = 0; i < events.length (); ++i) + { + Components::EventBase * ev; + if (events[i].data.any_value >>= ev) + { + ev->_add_ref (); + this->event_consumer_->push_event (ev + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + } + } + + void + RTEventServiceConsumer_impl::disconnect_push_consumer (void) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + ACE_DEBUG ((LM_DEBUG, "CIAO::RTEventServiceConsumer_impl::disconnect_push_consumer\n")); + + CORBA::Object_var poa_object = + orb_->resolve_initial_references ("RootPOA" ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + if (CORBA::is_nil (root_poa.in ())) + ACE_ERROR ((LM_ERROR, "Nil RootPOA\n")); + PortableServer::ObjectId_var oid = root_poa->servant_to_id (this); + root_poa->deactivate_object (oid); + delete this; + } + + RTEvent_Consumer_Config_impl::RTEvent_Consumer_Config_impl (void) : + service_type_ (RTEC) + { + } + + RTEvent_Consumer_Config_impl::~RTEvent_Consumer_Config_impl (void) + { + ACE_DEBUG + ((LM_DEBUG, "RTEvent_Consumer_Config_impl::~RTEvent_Consumer_Config_impl\n")); + } + + void + RTEvent_Consumer_Config_impl::start_conjunction_group ( + CORBA::Long size ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + this->qos_.start_conjunction_group (size); + } + + void + RTEvent_Consumer_Config_impl::start_disjunction_group ( + CORBA::Long size + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + this->qos_.start_disjunction_group (size); + } + + void + RTEvent_Consumer_Config_impl::insert_source ( + const char * source_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + + ACE_Hash<ACE_CString> hasher; + RtecEventComm::EventSourceID int_source_id = + hasher (source_id); + + this->qos_.insert (int_source_id, + int_source_id, + 0); + } + + void + RTEvent_Consumer_Config_impl::consumer_id ( + const char * consumer_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + + ACE_DEBUG ((LM_DEBUG, "RTEvent_Consumer_Config_impl::consumer_id\n")); + + this->consumer_id_ = consumer_id; + } + + void + RTEvent_Consumer_Config_impl::supplier_id ( + const char * supplier_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + + ACE_DEBUG ((LM_DEBUG, "RTEvent_Consumer_Config_impl::supplier_id\n")); + + this->supplier_id_ = supplier_id; + + ACE_Hash<ACE_CString> hasher; + RtecEventComm::EventSourceID source_id = + hasher (this->supplier_id_.c_str ()); + + this->qos_.start_disjunction_group (1); + this->qos_.insert (source_id, + source_id, + 0); + } + + void + RTEvent_Consumer_Config_impl::consumer ( + Components::EventConsumerBase_ptr consumer + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + this->consumer_ = consumer; + } + + CONNECTION_ID + RTEvent_Consumer_Config_impl::consumer_id ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + return CORBA::string_dup (this->consumer_id_.c_str ()); + } + + CONNECTION_ID + RTEvent_Consumer_Config_impl::supplier_id ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + return CORBA::string_dup (this->supplier_id_.c_str ()); + } + + EventServiceType + RTEvent_Consumer_Config_impl::service_type ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + return this->service_type_; + } + + Components::EventConsumerBase_ptr + RTEvent_Consumer_Config_impl::consumer ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + return Components::EventConsumerBase::_duplicate (this->consumer_.in ()); + } + + RtecEventChannelAdmin::ConsumerQOS * + RTEvent_Consumer_Config_impl::rt_event_qos ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + + RtecEventChannelAdmin::ConsumerQOS * consumer_qos = 0; + ACE_NEW_RETURN (consumer_qos, + RtecEventChannelAdmin::ConsumerQOS (this->qos_.get_ConsumerQOS ()), + 0); + return consumer_qos; + + } + + RTEvent_Supplier_Config_impl::RTEvent_Supplier_Config_impl (void) : + service_type_ (RTEC) + { + } + + RTEvent_Supplier_Config_impl::~RTEvent_Supplier_Config_impl (void) + { + ACE_DEBUG + ((LM_DEBUG, "RTEvent_Supplier_Config_impl::~RTEvent_Supplier_Config_impl\n")); + } + + void + RTEvent_Supplier_Config_impl::supplier_id ( + const char * supplier_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + this->supplier_id_ = supplier_id; + + ACE_Hash<ACE_CString> hasher; + RtecEventComm::EventSourceID source_id = + hasher (this->supplier_id_.c_str ()); + + ACE_DEBUG ((LM_DEBUG, "supplier's source id: %i\n", source_id)); + + this->qos_.insert (source_id, + source_id, + 0, + 1); + } + + CONNECTION_ID + RTEvent_Supplier_Config_impl::supplier_id ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + return CORBA::string_dup (this->supplier_id_.c_str ()); + } + + EventServiceType + RTEvent_Supplier_Config_impl::service_type ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + return this->service_type_; + } + + RtecEventChannelAdmin::SupplierQOS * + RTEvent_Supplier_Config_impl::rt_event_qos ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + + RtecEventChannelAdmin::SupplierQOS * supplier_qos = 0; + ACE_NEW_RETURN (supplier_qos, RtecEventChannelAdmin::SupplierQOS (this->qos_.get_SupplierQOS ()), 0); + return supplier_qos; + + } + +} diff --git a/TAO/CIAO/ciao/CIAO_RTEvent.h b/TAO/CIAO/ciao/CIAO_RTEvent.h new file mode 100644 index 00000000000..b382461f0a6 --- /dev/null +++ b/TAO/CIAO/ciao/CIAO_RTEvent.h @@ -0,0 +1,298 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CIAO_RTEvent.h + * + * $Id$ + * + * @author George Edwards <g.edwards@vanderbilt.edu> + */ +//============================================================================= + +#ifndef CIAO_RTEVENT_H +#define CIAO_RTEVENT_H +#include /**/ "ace/pre.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "CIAO_EventServiceBase.h" +#include "CIAO_RTEventS.h" + +#include "orbsvcs/Event_Utilities.h" + +namespace CIAO +{ + + /** + * @class RTEventService + * + * An implementation of EventServiceBase using the RT event channel. + */ + class RTEventService : + public virtual EventServiceBase + { + + public: + + RTEventService (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + RtecEventChannelAdmin::EventChannel_ptr ec); + + ~RTEventService (); + + virtual void connect_event_supplier ( + CIAO::Supplier_Config_ptr supplier_config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + virtual void connect_event_consumer ( + CIAO::Consumer_Config_ptr consumer_config + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + virtual void disconnect_event_supplier ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)); + + virtual void disconnect_event_consumer ( + const char * connection_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)); + + virtual void push_event ( + Components::EventBase * ev + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + private: + + // Reference to the ORB + CORBA::ORB_var orb_; + + // Reference to the Root POA + PortableServer::POA_var root_poa_; + + /** + * @var RtecEventChannelAdmin::EventChannel_var rt_event_channel_ + * + * Reference to the RT event channel. + */ + RtecEventChannelAdmin::EventChannel_var rt_event_channel_; + + /** + * @var RtecEventComm::EventType type_id_ + * + * The type of event. + */ + RtecEventComm::EventType type_id_; + + /** + * @var RtecEventComm::EventSourceID source_id_ + * + * The supplier id. + */ + RtecEventComm::EventSourceID source_id_; + + /** + * @var RtecEventChannelAdmin::ProxyPushConsumer_var proxy_consumer_ + * + * The proxy consumer to which events are pushed. + */ + RtecEventChannelAdmin::ProxyPushConsumer_var proxy_consumer_; + + /** + * @var ACE_Hash_Map_Manager<> proxy_supplier_map_ + * + * Mapping of each event sink to a proxy supplier for disconnect purposes. + */ + ACE_Hash_Map_Manager_Ex<ACE_CString, + RtecEventChannelAdmin::ProxyPushSupplier_ptr, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> proxy_supplier_map_; + + }; + + /** + * @class RTEventServiceSupplier_impl + * + * An implementation of the PushSupplier interface. + */ + class RTEventServiceSupplier_impl : + public virtual POA_RtecEventComm::PushSupplier, + public virtual PortableServer::RefCountServantBase + { + + public: + + RTEventServiceSupplier_impl (void); + + RTEventServiceSupplier_impl ( + CORBA::ORB_ptr orb); + + virtual void disconnect_push_supplier ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + private: + + CORBA::ORB_var orb_; + + }; + + /** + * @class RTEventServiceConsumer_impl + * + * An implementation of the PushConsumer interface. + */ + class RTEventServiceConsumer_impl : + public virtual POA_RtecEventComm::PushConsumer, + public virtual PortableServer::RefCountServantBase + { + + public: + + RTEventServiceConsumer_impl (void); + + RTEventServiceConsumer_impl ( + CORBA::ORB_ptr orb, + Components::EventConsumerBase_ptr consumer); + + virtual void push ( + const RtecEventComm::EventSet& events); + + virtual void disconnect_push_consumer ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + private: + + CORBA::ORB_var orb_; + + Components::EventConsumerBase_var event_consumer_; + + }; + + /** + * @class RTEvent_Consumer_Config_impl + * + * Implementation of the RTEvent_Consumer_Config IDL interface that + * configures TAO's RT event channel. An object of this type will be returned + * from @c CIAO::Container::create_consumer_config () when @c RTEC is + * specified as the event service type. + */ + class RTEvent_Consumer_Config_impl : + public virtual POA_CIAO::RTEvent_Consumer_Config + { + + public: + + RTEvent_Consumer_Config_impl (); + + ~RTEvent_Consumer_Config_impl (); + + virtual void start_conjunction_group (CORBA::Long size ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void start_disjunction_group (CORBA::Long size ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void insert_source (const char * source_id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void consumer_id (const char * consumer_id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CONNECTION_ID consumer_id (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void supplier_id (const char * supplier_id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CONNECTION_ID supplier_id (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void consumer (Components::EventConsumerBase_ptr consumer ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual Components::EventConsumerBase_ptr consumer (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual EventServiceType service_type (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual RtecEventChannelAdmin::ConsumerQOS * rt_event_qos (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + private: + + ACE_CString consumer_id_; + + ACE_CString supplier_id_; + + Components::EventConsumerBase_var consumer_; + + EventServiceType service_type_; + + ACE_ConsumerQOS_Factory qos_; + + }; + + /** + * @class RTEvent_Supplier_Config_impl + * + * Implementation of the RTEvent_Supplier_Config IDL interface that + * configures TAO's RT event channel. An object of this type will be returned + * from @c CIAO::Container::create_supplier_config () when @c RTEC is + * specified as the event service type. + */ + class RTEvent_Supplier_Config_impl : + public virtual POA_CIAO::RTEvent_Supplier_Config + { + + public: + + RTEvent_Supplier_Config_impl (); + + ~RTEvent_Supplier_Config_impl (); + + void supplier_id (const char * supplier_id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + CONNECTION_ID supplier_id (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + EventServiceType service_type (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + RtecEventChannelAdmin::SupplierQOS * rt_event_qos (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + private: + + ACE_CString supplier_id_; + + EventServiceType service_type_; + + ACE_SupplierQOS_Factory qos_; + + }; + +} + +#include /**/ "ace/post.h" +#endif /* CIAO_RTEVENT_H */ diff --git a/TAO/CIAO/ciao/CIAO_RTEvent.idl b/TAO/CIAO/ciao/CIAO_RTEvent.idl new file mode 100644 index 00000000000..c37e96f7b97 --- /dev/null +++ b/TAO/CIAO/ciao/CIAO_RTEvent.idl @@ -0,0 +1,48 @@ +// $Id$ + +/** + * @file CIAO_RTEvent.idl + * + * @author George Edwards + * + * @brief Interfaces for configuring CIAO's RT event channel. + */ + +#include "CIAO_Events.idl" +#include "orbsvcs/RtecEventChannelAdmin.idl" + +module CIAO +{ + + interface RTEvent_Consumer_Config : + Consumer_Config + { + + void start_conjunction_group (in long size); + + void start_disjunction_group (in long size); + + void insert_source (in CONNECTION_ID source_id); + + //void start_logical_and_group (in long size); + + //void start_negation (); + + //void insert_bitmasked_value (in long source_mask, + // in long type_mask, + // in long source_value, + // in long type_value); + + readonly attribute RtecEventChannelAdmin::ConsumerQOS rt_event_qos; + + }; + + interface RTEvent_Supplier_Config : + Supplier_Config + { + + readonly attribute RtecEventChannelAdmin::SupplierQOS rt_event_qos; + + }; + +}; diff --git a/TAO/CIAO/ciao/ComponentInstallation_Impl.h b/TAO/CIAO/ciao/ComponentInstallation_Impl.h index db850b9296b..26506922dc0 100644 --- a/TAO/CIAO/ciao/ComponentInstallation_Impl.h +++ b/TAO/CIAO/ciao/ComponentInstallation_Impl.h @@ -18,7 +18,7 @@ #define CIAO_COMPONENTINSTALLATION_IMPL_H #include /**/ "ace/pre.h" -#include "CCM_DeploymentS.h" +#include "CIAO_ServersS.h" #include "ace/Configuration.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) diff --git a/TAO/CIAO/ciao/ComponentServer_Impl.h b/TAO/CIAO/ciao/ComponentServer_Impl.h index fb6fb438282..0c3440e8ed7 100644 --- a/TAO/CIAO/ciao/ComponentServer_Impl.h +++ b/TAO/CIAO/ciao/ComponentServer_Impl.h @@ -24,7 +24,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "CCM_DeploymentS.h" +//#include "CCM_DeploymentS.h" +#include "CIAO_ServersS.h" #include "Object_Set_T.h" namespace CIAO diff --git a/TAO/CIAO/ciao/Container_Base.cpp b/TAO/CIAO/ciao/Container_Base.cpp index fe0d7643ec0..ca57500e3d5 100644 --- a/TAO/CIAO/ciao/Container_Base.cpp +++ b/TAO/CIAO/ciao/Container_Base.cpp @@ -1,8 +1,8 @@ // $Id$ #include "Container_Base.h" -#include "Cookies.h" #include "ace/DLL.h" +#include "ace/Dynamic_Service.h" #if !defined (__ACE_INLINE__) # include "Container_Base.inl" @@ -11,8 +11,7 @@ //////////////////////////////////////////////////////////////// CIAO::Container::Container (CORBA::ORB_ptr o) : - orb_ (CORBA::ORB::_duplicate (o)), - events_manager_ (o) + orb_ (CORBA::ORB::_duplicate (o)) { } @@ -32,141 +31,175 @@ CIAO::Container::_ciao_the_ORB () return this->orb_.in (); } -/// Events_Manager creates the appropriate servant for Consumer_Config. -CIAO_Events::Consumer_Config_ptr CIAO::Container::_ciao_create_event_consumer_config ( - const char * service_type - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException)) +// Creates the appropriate servant for Consumer_Config object. +CIAO::Consumer_Config_ptr +CIAO::Container::create_consumer_config ( + CIAO::EventServiceType type + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) { - // @@ George Why did the exception specification dropped in these places. ? - return this->events_manager_.create_consumer_config (service_type); + CIAO::Consumer_Config_ptr consumer_config = + this->event_service_factory_->create_consumer_config (type + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + return consumer_config; } -/// Events_Manager creates the appropriate servant for Supplier_Config -// @@ George, Should these pointers be exposed to the glue code at all? I -//don't see a reason why it should be done. -CIAO_Events::Supplier_Config_ptr -CIAO::Container::_ciao_create_event_supplier_config ( - const char * service_type - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException)) +// Creates the appropriate servant for Supplier_Config object. +CIAO::Supplier_Config_ptr +CIAO::Container::create_supplier_config ( + CIAO::EventServiceType type + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) { - return this->events_manager_.create_supplier_config (service_type); + CIAO::Supplier_Config_ptr supplier_config = + this->event_service_factory_->create_supplier_config (type + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + return supplier_config; } -/// Connect up an event sink. -void CIAO::Container::_ciao_connect_event_consumer ( - CIAO_Events::Consumer_Config_ptr consumer_config +// Connect up an event sink. +void +CIAO::Container::connect_event_consumer ( + CIAO::Consumer_Config_ptr consumer_config ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException)) { - ACE_DEBUG ((LM_DEBUG, "CIAO::Container::_ciao_connect_event_consumer\n")); + ACE_DEBUG ((LM_DEBUG, "CIAO::Container::connect_event_consumer\n")); // Look up the supplier's event service implementation. - CIAO_Events::EventServiceBase * event_service = 0; - if (this->event_service_map_.find (consumer_config->get_supplier_id (), event_service) != 0) + CIAO::EventServiceBase * event_service = 0; + + ACE_CString supplier_id = + consumer_config->supplier_id (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + if (this->event_service_map_.find (supplier_id.c_str (), event_service) != 0) { ACE_THROW ( - ::Components::InvalidConnection ()); + Components::InvalidConnection ()); } - /// Connect to the supplier's event service implementation - CIAO_Events::EventServiceInfo service_info = - event_service->connect_event_consumer (consumer_config ACE_ENV_ARG_PARAMETER); + // Connect to the supplier's event service implementation + event_service->connect_event_consumer (consumer_config ACE_ENV_ARG_PARAMETER); ACE_CHECK; - /// Save the consumer's disconnect info in a map. - this->event_info_map_.bind (consumer_config->get_consumer_id (), - service_info); + // Save a pointer to the event service implementation in a map. + ACE_CString consumer_id = + consumer_config->consumer_id (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->event_service_map_.bind (consumer_id.c_str (), + event_service); + } -/// Connect up an event source. -void CIAO::Container::_ciao_connect_event_supplier ( - CIAO_Events::Supplier_Config_ptr supplier_config +// Connect up an event source. +void +CIAO::Container::connect_event_supplier ( + CIAO::Supplier_Config_ptr supplier_config ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException)) { - ACE_DEBUG ((LM_DEBUG, "CIAO::Container::_ciao_connect_event_supplier\n")); + ACE_DEBUG ((LM_DEBUG, "CIAO::Container::connect_event_supplier\n")); + + // Use factory to create the appropriate implementation of EventServiceBase + CIAO::EventServiceType type = + supplier_config->service_type (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; - /// Use Events_Manager factory method to create the appropriate implementation of - /// EventServiceBase - CIAO_Events::EventServiceBase * event_service = - this->events_manager_.create_supplier (supplier_config); + CIAO::EventServiceBase * event_service = + this->event_service_factory_->create (type + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; - /// Connect the supplier + // Connect the supplier event_service->connect_event_supplier (supplier_config ACE_ENV_ARG_PARAMETER); ACE_CHECK; - /// Save a pointer to the event service implementation in a map. - this->event_service_map_.bind (supplier_config->get_supplier_id (), + // Save a pointer to the event service implementation in a map. + ACE_CString supplier_id = + supplier_config->supplier_id (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->event_service_map_.bind (supplier_id.c_str (), event_service); } -void CIAO::Container::_ciao_disconnect_event_consumer - (CIAO_Events::CONNECTION_ID connection_id - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((::CORBA::SystemException, - ::Components::InvalidName, - ::Components::InvalidConnection)) +void +CIAO::Container::disconnect_event_consumer ( + const char * connection_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)) { - ACE_DEBUG ((LM_DEBUG, "CIAO::Container::_ciao_disconnect_event_consumer\n")); - CIAO_Events::EventServiceInfo service_info; + ACE_DEBUG ((LM_DEBUG, "CIAO::Container::disconnect_event_consumer\n")); + + CIAO::EventServiceBase * event_service; - if (this->event_info_map_.unbind (connection_id, service_info) != 0) + if (this->event_service_map_.unbind (connection_id, event_service) != 0) { ACE_THROW ( - ::Components::InvalidConnection ()); + Components::InvalidConnection ()); } - service_info.service->disconnect_event_consumer (service_info ACE_ENV_ARG_PARAMETER); + event_service->disconnect_event_consumer (connection_id ACE_ENV_ARG_PARAMETER); ACE_CHECK; } -void CIAO::Container::_ciao_disconnect_event_supplier - (CIAO_Events::CONNECTION_ID connection_id - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((::CORBA::SystemException, - ::Components::InvalidName, - ::Components::InvalidConnection)) +void +CIAO::Container::disconnect_event_supplier ( + const char * connection_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)) { - ACE_DEBUG ((LM_DEBUG, "CIAO::Container::_ciao_disconnect_event_supplier\n")); - CIAO_Events::EventServiceBase * event_service; + ACE_DEBUG ((LM_DEBUG, "CIAO::Container::disconnect_event_supplier\n")); + + CIAO::EventServiceBase * event_service; if (this->event_service_map_.unbind (connection_id, event_service) != 0) { ACE_THROW ( - ::Components::InvalidConnection ()); + Components::InvalidConnection ()); } event_service->disconnect_event_supplier (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; + } -void CIAO::Container::_ciao_push_event (Components::EventBase *ev, - CIAO_Events::CONNECTION_ID connection_id - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException)) +void +CIAO::Container::push_event ( + Components::EventBase * ev, + const char * connection_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) { - ACE_DEBUG ((LM_DEBUG, "CIAO::Container::_ciao_push_event\n")); + ACE_DEBUG ((LM_DEBUG, "CIAO::Container::push_event\n")); - /// Pushing an event requires a map lookup. - CIAO_Events::EventServiceBase * event_service; + CIAO::EventServiceBase * event_service; if (this->event_service_map_.find (connection_id, event_service) != 0) { ACE_THROW ( - ::Components::InvalidConnection ()); + Components::InvalidConnection ()); } event_service->push_event (ev ACE_ENV_ARG_PARAMETER); @@ -187,6 +220,7 @@ CIAO::Session_Container::Session_Container (CORBA::ORB_ptr o) CIAO::Session_Container::~Session_Container () { + ACE_DEBUG ((LM_DEBUG, "CIAO::Session_Container::~Session_Container\n")); } int @@ -244,6 +278,12 @@ CIAO::Session_Container::init (const char *name, poa_manager->activate (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (-1); + this->event_service_factory_ = + ACE_Dynamic_Service<EventService_Factory>::instance + ("CIAO_EventService_Factory"); + + this->event_service_factory_->init (this->orb_.in (), root_poa.in ()); + return 0; } diff --git a/TAO/CIAO/ciao/Container_Base.h b/TAO/CIAO/ciao/Container_Base.h index ce4f7d196b4..5122256b4da 100644 --- a/TAO/CIAO/ciao/Container_Base.h +++ b/TAO/CIAO/ciao/Container_Base.h @@ -26,19 +26,16 @@ #include "tao/PortableServer/PortableServer.h" #include "tao/PortableServer/Servant_Base.h" +#include "CCM_DeploymentS.h" #include "CCM_ContainerC.h" -#include "CCM_DeploymentC.h" -#include "ace/Active_Map_Manager.h" -#include "CIAO_Events.h" +#include "ace/Hash_Map_Manager.h" + +#include "CIAO_EventService_Factory.h" +#include "CIAO_EventsS.h" namespace CIAO { - // Forward declarations - struct EventServiceInfo; - class RTEventServiceSupplier_impl; - class RTEventServiceConsumer_impl; - /** * @class Container * @@ -47,7 +44,8 @@ namespace CIAO * Perhaps we can use local interface to define these interfaces as * we will also get reference counting automatically. */ - class CIAO_SERVER_Export Container + class CIAO_CONTAINER_Export Container : + public virtual POA_CIAO::ContainerEventService { public: Container (CORBA::ORB_ptr o); @@ -84,57 +82,65 @@ namespace CIAO ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)) = 0; - // Events methods + ContainerEventService_ptr + CIAO::Container::get_container_events_ref ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); + + // ContainerEventService implementation /// A factory method for Consumer_Config objects. - CIAO_Events::Consumer_Config_ptr _ciao_create_event_consumer_config ( - const char * service_type + Consumer_Config_ptr create_consumer_config ( + EventServiceType type ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException)); /// A factory method for Supplier_Config objects. - CIAO_Events::Supplier_Config_ptr _ciao_create_event_supplier_config ( - const char * service_type + Supplier_Config_ptr create_supplier_config ( + EventServiceType type ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException)); /// Connect an event sink. - virtual void _ciao_connect_event_consumer ( - CIAO_Events::Consumer_Config_ptr consumer_config + virtual void connect_event_consumer ( + Consumer_Config_ptr consumer_config ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException)); /// Connect an event source. - virtual void _ciao_connect_event_supplier ( - CIAO_Events::Supplier_Config_ptr supplier_config + virtual void connect_event_supplier ( + Supplier_Config_ptr supplier_config ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException)); /// Disconnect event sink. - virtual void _ciao_disconnect_event_consumer ( - CIAO_Events::CONNECTION_ID connection_id + virtual void disconnect_event_consumer ( + const char * connection_id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((::CORBA::SystemException, - ::Components::InvalidName, - ::Components::InvalidConnection)); + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)); /// Disconnect event source. - virtual void _ciao_disconnect_event_supplier ( - CIAO_Events::CONNECTION_ID connection_id + virtual void disconnect_event_supplier ( + const char * connection_id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((::CORBA::SystemException, - ::Components::InvalidName, - ::Components::InvalidConnection)); + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)); /// Push an event. - virtual void _ciao_push_event (::Components::EventBase *ev, - CIAO_Events::CONNECTION_ID connection_id - ACE_ENV_ARG_DECL) - ACE_THROW_SPEC ((CORBA::SystemException)); + virtual void push_event ( + Components::EventBase * ev, + const char * connection_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); protected: @@ -144,21 +150,22 @@ namespace CIAO // Reference to the POA PortableServer::POA_var poa_; - /// Mapping of suppliers to an event service implementation. - ACE_Hash_Map_Manager<CIAO_Events::CONNECTION_ID, - CIAO_Events::EventServiceBase *, - ACE_Null_Mutex> event_service_map_; + /// Factory for event services. + EventService_Factory * event_service_factory_; - /// Mapping of consumers to state/disconnect info. - ACE_Hash_Map_Manager<CIAO_Events::CONNECTION_ID, - CIAO_Events::EventServiceInfo, - ACE_Null_Mutex> event_info_map_; + /// Mapping of components to an event service. + ACE_Hash_Map_Manager_Ex<ACE_CString, + EventServiceBase *, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> event_service_map_; + + /// Object reference to the events interface + ContainerEventService_var events_ref_; - /// A helper class that encapsulates event service management. - CIAO_Events::Events_Manager events_manager_; }; - class CIAO_SERVER_Export Session_Container : public Container + class CIAO_CONTAINER_Export Session_Container : public Container { public: Session_Container (CORBA::ORB_ptr o); @@ -210,11 +217,6 @@ namespace CIAO ACE_THROW_SPEC ((CORBA::SystemException)); - // Get an object reference to a component or home from the servant. - CORBA::Object_ptr get_objref (PortableServer::Servant p - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - ACE_THROW_SPEC ((CORBA::SystemException)); - // Uninstall a servant for component or home. void uninstall (CORBA::Object_ptr objref ACE_ENV_ARG_DECL_WITH_DEFAULTS) @@ -231,6 +233,11 @@ namespace CIAO ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); + // Get an object reference to a component or home from the servant. + CORBA::Object_ptr get_objref (PortableServer::Servant p + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + protected: long number_; diff --git a/TAO/CIAO/ciao/Container_Base.inl b/TAO/CIAO/ciao/Container_Base.inl index b47ff263ff6..f7cf0e94f02 100644 --- a/TAO/CIAO/ciao/Container_Base.inl +++ b/TAO/CIAO/ciao/Container_Base.inl @@ -1,10 +1,23 @@ // $Id$ -*- C++ -*- +ACE_INLINE CIAO::ContainerEventService_ptr +CIAO::Container::get_container_events_ref (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (CORBA::is_nil (this->events_ref_.in ())) + { + this->events_ref_ = this->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + } + return this->events_ref_._retn (); +} + + ACE_INLINE CORBA::Object_ptr CIAO::Session_Container::get_objref (PortableServer::Servant p - ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)) { return this->_ciao_the_POA ()->servant_to_reference (p - ACE_ENV_ARG_PARAMETER); + ACE_ENV_ARG_PARAMETER); } diff --git a/TAO/CIAO/ciao/Container_Impl.h b/TAO/CIAO/ciao/Container_Impl.h index ab2f007c817..f3b84559164 100644 --- a/TAO/CIAO/ciao/Container_Impl.h +++ b/TAO/CIAO/ciao/Container_Impl.h @@ -24,7 +24,6 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "CCM_DeploymentS.h" #include "Container_Base.h" #include "Object_Set_T.h" @@ -49,7 +48,7 @@ namespace CIAO * used to manage the lifecycle of the installed components and * homes. */ - class CIAO_SERVER_Export Container_Impl + class CIAO_CONTAINER_Export Container_Impl : public virtual POA_Components::Deployment::Container, public virtual PortableServer::RefCountServantBase { @@ -102,6 +101,10 @@ namespace CIAO ACE_THROW_SPEC ((CORBA::SystemException, Components::RemoveFailure)); + virtual CIAO::ContainerEventService_ptr + get_event_service (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + // ------------------- CIAO Internal Operations ------------------------ /// Set the cached object reference. void set_objref (Components::Deployment::Container_ptr o diff --git a/TAO/CIAO/ciao/Container_Impl.inl b/TAO/CIAO/ciao/Container_Impl.inl index 004ad4d9876..2bb0d6dd93f 100644 --- a/TAO/CIAO/ciao/Container_Impl.inl +++ b/TAO/CIAO/ciao/Container_Impl.inl @@ -31,3 +31,10 @@ CIAO::Container_Impl::get_objref (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) } return this->objref_.in (); } + +CIAO::ContainerEventService_ptr +CIAO::Container_Impl::get_event_service (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->container_->get_container_events_ref (ACE_ENV_SINGLE_ARG_PARAMETER); +} diff --git a/TAO/CIAO/ciao/Cookies.h b/TAO/CIAO/ciao/Cookies.h index 2ca8437d981..96e83511f96 100644 --- a/TAO/CIAO/ciao/Cookies.h +++ b/TAO/CIAO/ciao/Cookies.h @@ -23,7 +23,6 @@ #include "CIAO_ValueC.h" #include "ace/Active_Map_Manager.h" #include "tao/PortableServer/PortableServer.h" -#include "CIAO_Events.h" namespace CIAO { diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED_svnt.cpp b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED_svnt.cpp index 81828c1a704..511df25fde4 100644 --- a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED_svnt.cpp +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED_svnt.cpp @@ -86,9 +86,7 @@ namespace CIAO_GLUE_BasicSP BMClosedED_Servant *sv) : home_ (::Components::CCMHome::_duplicate (home)), container_ (c), - servant_ (sv), - push_out_avail_cookie_ (0), - out_avail_service_cookie_ (0) + servant_ (sv) { } @@ -251,9 +249,14 @@ namespace CIAO_GLUE_BasicSP ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - this->container_->_ciao_push_event (ev, - 0301 - ACE_ENV_ARG_PARAMETER); + + ACE_CString my_uuid = this->servant_->component_UUID (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + my_uuid += "_data_available_publisher"; + + this->container_->push_event (ev, + my_uuid.c_str () + ACE_ENV_ARG_PARAMETER); ACE_CHECK; /* @@ -288,35 +291,10 @@ namespace CIAO_GLUE_BasicSP ::CORBA::SystemException, ::Components::ExceededConnectionLimit)) { - CIAO_Events::Supplier_Config_var supplier_config = - this->container_->_ciao_create_event_supplier_config ("RTEC" ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - supplier_config->set_supplier_id (0301 ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - CIAO_Events::Consumer_Config_var consumer_config = - this->container_->_ciao_create_event_consumer_config ("RTEC" ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - consumer_config->start_conjunction_group (2 ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - consumer_config->insert_supplier_id (0201 ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - consumer_config->insert_supplier_id (0301 ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - consumer_config->set_consumer_id (0302 ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - consumer_config->set_consumer (c ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - this->container_->_ciao_connect_event_supplier (supplier_config.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - this->container_->_ciao_connect_event_consumer (consumer_config.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; return 0; /* - if (CORBA::is_nil (c)) { ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); @@ -344,9 +322,6 @@ namespace CIAO_GLUE_BasicSP ::Components::InvalidConnection)) { - this->container_->_ciao_disconnect_event_consumer (0302 ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - return ::BasicSP::DataAvailableConsumer::_nil (); /* @@ -964,6 +939,23 @@ namespace CIAO_GLUE_BasicSP // Operations for CCMObject interface. + void + BMClosedED_Servant::component_UUID ( + const char * new_component_UUID + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->component_UUID_ = new_component_UUID; + } + + CIAO::CONNECTION_ID + BMClosedED_Servant::component_UUID ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return CORBA::string_dup (this->component_UUID_.c_str ()); + } + CORBA::IRObject_ptr BMClosedED_Servant::get_component_def ( ACE_ENV_SINGLE_ARG_DECL) diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED_svnt.h b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED_svnt.h index e7b5c5d449b..5e7b16758a7 100644 --- a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED_svnt.h +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMClosedED/BMClosedED_svnt.h @@ -187,9 +187,11 @@ namespace CIAO_GLUE_BasicSP ::BasicSP::ReadData_var ciao_uses_datain_; + /* ACE_Active_Map_Manager< ::BasicSP::DataAvailableConsumer_var> ciao_publishes_out_avail_map_; + */ ::Components::CCMHome_var home_; @@ -202,11 +204,6 @@ namespace CIAO_GLUE_BasicSP ::BasicSP::BMClosedED_var component_; - - ::Components::Cookie * push_out_avail_cookie_; - - ::Components::Cookie * out_avail_service_cookie_; - }; class BMCLOSEDED_SVNT_Export BMClosedED_Servant @@ -474,6 +471,17 @@ namespace CIAO_GLUE_BasicSP // Operations for CCMObject interface. + virtual void + component_UUID ( + const char * new_component_UUID + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CIAO::CONNECTION_ID + component_UUID ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual CORBA::IRObject_ptr get_component_def ( ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) @@ -544,6 +552,8 @@ namespace CIAO_GLUE_BasicSP ::BasicSP::DataAvailableConsumer_var consumes_in_avail_; + ACE_CString component_UUID_; + }; class BMCLOSEDED_SVNT_Export BMClosedEDHome_Servant diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_svnt.cpp b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_svnt.cpp index a38c2c19653..0d9de37c382 100644 --- a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_svnt.cpp +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_svnt.cpp @@ -86,9 +86,7 @@ namespace CIAO_GLUE_BasicSP BMDevice_Servant *sv) : home_ (::Components::CCMHome::_duplicate (home)), container_ (c), - servant_ (sv), - push_data_available_cookie_ (0), - data_available_service_cookie_ (0) + servant_ (sv) { } @@ -202,9 +200,14 @@ namespace CIAO_GLUE_BasicSP ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - this->container_->_ciao_push_event (ev, - 0201 - ACE_ENV_ARG_PARAMETER); + + ACE_CString my_uuid = this->servant_->component_UUID (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + my_uuid += "_data_available_publisher"; + + this->container_->push_event (ev, + my_uuid.c_str () + ACE_ENV_ARG_PARAMETER); ACE_CHECK; /* @@ -240,29 +243,6 @@ namespace CIAO_GLUE_BasicSP ::Components::ExceededConnectionLimit)) { - CIAO_Events::Supplier_Config_var supplier_config = - this->container_->_ciao_create_event_supplier_config ("RTEC" ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - supplier_config->set_supplier_id (0201 ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - CIAO_Events::Consumer_Config_var consumer_config = - this->container_->_ciao_create_event_consumer_config ("RTEC" ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - consumer_config->start_disjunction_group (1 ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - consumer_config->insert_supplier_id (0201 ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - consumer_config->set_consumer_id (0202 ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - consumer_config->set_consumer (c ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - this->container_->_ciao_connect_event_supplier (supplier_config.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - this->container_->_ciao_connect_event_consumer (consumer_config.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - return 0; /* @@ -292,8 +272,6 @@ namespace CIAO_GLUE_BasicSP ::CORBA::SystemException, ::Components::InvalidConnection)) { - this->container_->_ciao_disconnect_event_consumer (0202 ACE_ENV_ARG_PARAMETER); - ACE_CHECK; return ::BasicSP::DataAvailableConsumer::_nil (); @@ -851,6 +829,23 @@ namespace CIAO_GLUE_BasicSP // Operations for CCMObject interface. + void + BMDevice_Servant::component_UUID ( + const char * new_component_UUID + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->component_UUID_ = new_component_UUID; + } + + CIAO::CONNECTION_ID + BMDevice_Servant::component_UUID ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return CORBA::string_dup (this->component_UUID_.c_str ()); + } + CORBA::IRObject_ptr BMDevice_Servant::get_component_def ( ACE_ENV_SINGLE_ARG_DECL) diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_svnt.h b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_svnt.h index 7986c4fb14f..88f6bd1695a 100644 --- a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_svnt.h +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDevice/BMDevice_svnt.h @@ -162,9 +162,11 @@ namespace CIAO_GLUE_BasicSP ::Components::InvalidConnection)); protected: + /* ACE_Active_Map_Manager< ::BasicSP::DataAvailableConsumer_var> ciao_publishes_data_available_map_; + */ ::Components::CCMHome_var home_; @@ -178,10 +180,6 @@ namespace CIAO_GLUE_BasicSP ::BasicSP::BMDevice_var component_; - ::Components::Cookie * push_data_available_cookie_; - - ::Components::Cookie * data_available_service_cookie_; - }; class BMDEVICE_SVNT_Export BMDevice_Servant @@ -430,6 +428,17 @@ namespace CIAO_GLUE_BasicSP // Operations for CCMObject interface. + virtual void + component_UUID ( + const char * new_component_UUID + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CIAO::CONNECTION_ID + component_UUID ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual CORBA::IRObject_ptr get_component_def ( ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) @@ -500,6 +509,8 @@ namespace CIAO_GLUE_BasicSP ::BasicSP::TimeOutConsumer_var consumes_timeout_; + ACE_CString component_UUID_; + }; class BMDEVICE_SVNT_Export BMDeviceHome_Servant diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplayE.idl b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplayE.idl index 78575b701d9..0188ea55aa8 100644 --- a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplayE.idl +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplayE.idl @@ -1,4 +1,5 @@ // $Id$ + #include <Components.idl> #include "BMDisplay.idl" diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_svnt.cpp b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_svnt.cpp index d198fa14984..a0aa6c02a66 100644 --- a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_svnt.cpp +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_svnt.cpp @@ -681,6 +681,23 @@ namespace CIAO_GLUE_BasicSP // Operations for CCMObject interface. + void + BMDisplay_Servant::component_UUID ( + const char * new_component_UUID + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->component_UUID_ = new_component_UUID; + } + + CIAO::CONNECTION_ID + BMDisplay_Servant::component_UUID ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return CORBA::string_dup (this->component_UUID_.c_str ()); + } + CORBA::IRObject_ptr BMDisplay_Servant::get_component_def ( ACE_ENV_SINGLE_ARG_DECL) diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_svnt.h b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_svnt.h index e495bc820d3..c006763cec0 100644 --- a/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_svnt.h +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/BMDisplay/BMDisplay_svnt.h @@ -388,6 +388,17 @@ namespace CIAO_GLUE_BasicSP // Operations for CCMObject interface. + virtual void + component_UUID ( + const char * new_component_UUID + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CIAO::CONNECTION_ID + component_UUID ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual CORBA::IRObject_ptr get_component_def ( ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) @@ -455,6 +466,8 @@ namespace CIAO_GLUE_BasicSP ::BasicSP::DataAvailableConsumer_var consumes_data_ready_; + ACE_CString component_UUID_; + }; class BMDISPLAY_SVNT_Export BMDisplayHome_Servant diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC_svnt.cpp b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC_svnt.cpp index bedc88636b3..7dd1a1f2bb9 100644 --- a/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC_svnt.cpp +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC_svnt.cpp @@ -27,46 +27,13 @@ namespace CIAO_GLUE_BasicSP ::Components::CCMHome_ptr home, ::CIAO::Session_Container *c, EC_Servant *sv) - : home_ (::Components::CCMHome::_duplicate (home)), + : + home_ (::Components::CCMHome::_duplicate (home)), container_ (c), - servant_ (sv), - push_timeout_cookie_ (0) + servant_ (sv) { } - /* - // START new event code - void EC_Context::create_event_channel (void) - { - - // Get a reference to the ORB. - CORBA::ORB_var orb = this->container_->_ciao_the_ORB (); - if (CORBA::is_nil (orb.in ())) - ACE_ERROR ((LM_ERROR, "Nil ORB\n")); - - // Get a reference to the POA - CORBA::Object_var poa_object = - orb->resolve_initial_references ("RootPOA" ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - PortableServer::POA_var root_poa = - PortableServer::POA::_narrow (poa_object.in () ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - if (CORBA::is_nil (root_poa.in ())) - ACE_ERROR ((LM_ERROR, "Nil RootPOA\n")); - - // Get a reference to the event channel - if (CORBA::is_nil (this->ciao_event_channel_.in ())) - { - TAO_EC_Event_Channel_Attributes attributes (root_poa.in (), root_poa.in ()); - TAO_EC_Event_Channel * ec_servant; - ACE_NEW (ec_servant, TAO_EC_Event_Channel (attributes)); - ec_servant->activate (); - this->ciao_event_channel_ = ec_servant->_this (); - } - } - // END new event code - */ - EC_Context::~EC_Context (void) { } @@ -177,24 +144,16 @@ namespace CIAO_GLUE_BasicSP ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - this->container_->_ciao_push_event (ev, - 0101 - ACE_ENV_ARG_PARAMETER); + + ACE_CString my_uuid = this->servant_->component_UUID (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + my_uuid += "_timeout_publisher"; + + this->container_->push_event (ev, + my_uuid.c_str () + ACE_ENV_ARG_PARAMETER); ACE_CHECK; - - /* - // START new event code - RtecEventComm::EventSet events (1); - events.length (1); - events[0].header.source = ACE_ES_EVENT_SOURCE_ANY + 1; - events[0].header.type = ACE_ES_EVENT_UNDEFINED + 1; - events[0].data.any_value <<= ev; - ciao_proxy_timeout_consumer_->push (events ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - // END new event code - */ - // START old event code /* ACE_Active_Map_Manager<::BasicSP::TimeOutConsumer_var>::iterator end = this->ciao_publishes_timeout_map_.end (); @@ -217,7 +176,6 @@ namespace CIAO_GLUE_BasicSP ACE_CHECK; } */ - // END old event code } ::Components::Cookie * @@ -228,74 +186,41 @@ namespace CIAO_GLUE_BasicSP ::CORBA::SystemException, ::Components::ExceededConnectionLimit)) { - CIAO_Events::Supplier_Config_var supplier_config = - this->container_->_ciao_create_event_supplier_config ("DIRECT" ACE_ENV_ARG_PARAMETER); + + // This method is not used. + + return 0; + + /*CIAO::EventServiceType type = CIAO::RTEC; + + CIAO::Supplier_Config_var supplier_config = + this->container_->create_supplier_config (type ACE_ENV_ARG_PARAMETER); ACE_CHECK; - supplier_config->set_supplier_id (0101 ACE_ENV_ARG_PARAMETER); + supplier_config->supplier_id (0101 ACE_ENV_ARG_PARAMETER); ACE_CHECK; - CIAO_Events::Consumer_Config_var consumer_config = - this->container_->_ciao_create_event_consumer_config ("DIRECT" ACE_ENV_ARG_PARAMETER); + CIAO::Consumer_Config_var consumer_config = + this->container_->create_consumer_config (type ACE_ENV_ARG_PARAMETER); ACE_CHECK; - consumer_config->start_disjunction_group (1 ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - consumer_config->insert_supplier_id (0101 ACE_ENV_ARG_PARAMETER); + + //CIAO::RTEvent_Consumer_Config_var rt_config = + // CIAO::RTEvent_Consumer_Config::_narrow (consumer_config.in ()); + + //rt_config->start_disjunction_group (1 ACE_ENV_ARG_PARAMETER); + //ACE_CHECK; + consumer_config->supplier_id (0101 ACE_ENV_ARG_PARAMETER); ACE_CHECK; - consumer_config->set_consumer_id (0102 ACE_ENV_ARG_PARAMETER); + consumer_config->consumer_id (0102 ACE_ENV_ARG_PARAMETER); ACE_CHECK; - consumer_config->set_consumer (c ACE_ENV_ARG_PARAMETER); + consumer_config->consumer (c ACE_ENV_ARG_PARAMETER); ACE_CHECK; - this->container_->_ciao_connect_event_supplier (supplier_config.in () ACE_ENV_ARG_PARAMETER); + this->container_->connect_event_supplier (supplier_config.in () ACE_ENV_ARG_PARAMETER); ACE_CHECK; - this->container_->_ciao_connect_event_consumer (consumer_config.in () ACE_ENV_ARG_PARAMETER); + this->container_->connect_event_consumer (consumer_config.in () ACE_ENV_ARG_PARAMETER); ACE_CHECK; - - return 0; - - /* - // START new event code - CORBA::ORB_var orb = this->container_->_ciao_the_ORB (); - - // Establish supplier's connection to event channel if not done yet - if (CORBA::is_nil (this->ciao_proxy_timeout_consumer_.in ())) - { - RtecEventChannelAdmin::SupplierAdmin_var supplier_admin = - this->ciao_event_channel_->for_suppliers (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - this->ciao_proxy_timeout_consumer_ = - supplier_admin->obtain_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - // Create and register supplier servant - timeout_Supplier_impl * supplier_servant; - ACE_NEW_RETURN (supplier_servant, - timeout_Supplier_impl (orb.in ()), - 0); - RtecEventComm::PushSupplier_var supplier = - supplier_servant->_this (); - - // Set QoS properties and connect - ACE_SupplierQOS_Factory qos; - qos.insert (ACE_ES_EVENT_SOURCE_ANY + 1, - ACE_ES_EVENT_UNDEFINED + 1, - 0, - 1); - this->ciao_proxy_timeout_consumer_->connect_push_supplier (supplier.in (), - qos.get_SupplierQOS ()); - } // End if (ciao_proxy_timeout_consumer_ is nil) - - // Establish consumer's connection to event channel - if (CORBA::is_nil (c)) - { - ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); - } - - return this->subscribe_timeout_consumer (c); - // END new event code */ - // START old event code /* if (CORBA::is_nil (c)) { @@ -312,53 +237,10 @@ namespace CIAO_GLUE_BasicSP ::Components::Cookie_var retv = new ::CIAO::Map_Key_Cookie (key); return retv._retn (); + */ - // END old event code } - /*::Components::Cookie * - EC_Context::subscribe_timeout_consumer ( - ::BasicSP::TimeOutConsumer_ptr c) - { - - return 0; - - - CORBA::ORB_var orb = this->container_->_ciao_the_ORB (); - - ::BasicSP::TimeOutConsumer_var sub = - ::BasicSP::TimeOutConsumer::_duplicate (c); - - RtecEventChannelAdmin::ConsumerAdmin_var consumer_admin = - this->ciao_event_channel_->for_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - RtecEventChannelAdmin::ProxyPushSupplier_var ciao_proxy_timeout_supplier = - consumer_admin->obtain_push_supplier (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - // Create and register consumer servant - timeout_Consumer_impl * consumer_servant; - ACE_NEW_RETURN (consumer_servant, timeout_Consumer_impl (orb.in (), sub.in ()), 0); - RtecEventComm::PushConsumer_var consumer = consumer_servant->_this (); - - // Set QoS properties and connect - ACE_ConsumerQOS_Factory qos; - qos.start_disjunction_group (1); - qos.insert_type (ACE_ES_EVENT_UNDEFINED + 1, - 0); - ciao_proxy_timeout_supplier->connect_push_consumer (consumer.in (), - qos.get_ConsumerQOS ()); - - sub._retn (); - - ::Components::Cookie * return_cookie; - ACE_NEW_RETURN (return_cookie, - ::CIAO::Object_Reference_Cookie (consumer.in ()), - 0); - return return_cookie; - - }*/ - ::BasicSP::TimeOutConsumer_ptr EC_Context::unsubscribe_timeout ( ::Components::Cookie *ck @@ -368,41 +250,14 @@ namespace CIAO_GLUE_BasicSP ::Components::InvalidConnection)) { - this->container_->_ciao_disconnect_event_consumer (0102 ACE_ENV_ARG_PARAMETER); - ACE_CHECK; + // This method must be changed to make the consumer connection id + // available to pass in as a parameter. Using '0' as a placeholder. - return ::BasicSP::TimeOutConsumer::_nil (); - - /* - // START new event code - CORBA::Object_var obj = CORBA::Object::_nil (); - ::BasicSP::TimeOutConsumer_var return_consumer; - - if (ck == 0 || ::CIAO::Object_Reference_Cookie::extract (ck, obj.out ()) == -1) - { - ACE_THROW_RETURN ( - ::Components::InvalidConnection (), - ::BasicSP::TimeOutConsumer::_nil ()); - } - - RtecEventComm::PushConsumer_var push_consumer = - ::RtecEventComm::PushConsumer::_narrow (obj.in ()); - - if (CORBA::is_nil (push_consumer.in ())) - { - ACE_THROW_RETURN ( - ::Components::InvalidConnection (), - ::BasicSP::TimeOutConsumer::_nil ()); - } - - push_consumer->disconnect_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER); + this->container_->disconnect_event_consumer (0 ACE_ENV_ARG_PARAMETER); ACE_CHECK; return ::BasicSP::TimeOutConsumer::_nil (); - // END new event code - */ - // START old event code /* ::BasicSP::TimeOutConsumer_var retv; ACE_Active_Map_Manager_Key key; @@ -423,7 +278,6 @@ namespace CIAO_GLUE_BasicSP return retv._retn (); */ - // END old event code } @@ -459,6 +313,8 @@ namespace CIAO_GLUE_BasicSP EC_Servant::~EC_Servant (void) { + ACE_DEBUG ((LM_DEBUG, "EC_Servant::~EC_Servant\n")); + ACE_TRY_NEW_ENV { ::Components::SessionComponent_var scom = @@ -489,8 +345,8 @@ namespace CIAO_GLUE_BasicSP ::Components::ExceededConnectionLimit)) { return this->context_->subscribe_timeout ( - c - ACE_ENV_ARG_PARAMETER); + c + ACE_ENV_ARG_PARAMETER); } ::BasicSP::TimeOutConsumer_ptr @@ -502,8 +358,8 @@ namespace CIAO_GLUE_BasicSP ::Components::InvalidConnection)) { return this->context_->unsubscribe_timeout ( - ck - ACE_ENV_ARG_PARAMETER); + ck + ACE_ENV_ARG_PARAMETER); } ::CORBA::Long @@ -515,7 +371,7 @@ namespace CIAO_GLUE_BasicSP ACE_ENV_SINGLE_ARG_PARAMETER); } - void + void EC_Servant::hertz ( ::CORBA::Long val ACE_ENV_ARG_DECL) @@ -700,7 +556,6 @@ namespace CIAO_GLUE_BasicSP ::Components::InvalidConnection, ::Components::ExceededConnectionLimit)) { - if (publisher_name == 0) { ACE_THROW_RETURN (::Components::InvalidName (), 0); @@ -737,7 +592,6 @@ namespace CIAO_GLUE_BasicSP ::Components::InvalidName, ::Components::InvalidConnection)) { - if (publisher_name == 0) { ACE_THROW_RETURN ( @@ -842,6 +696,23 @@ namespace CIAO_GLUE_BasicSP // Operations for CCMObject interface. + void + EC_Servant::component_UUID ( + const char * new_component_UUID + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + this->component_UUID_ = new_component_UUID; + } + + CIAO::CONNECTION_ID + EC_Servant::component_UUID ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + return CORBA::string_dup (this->component_UUID_.c_str ()); + } + CORBA::IRObject_ptr EC_Servant::get_component_def ( ACE_ENV_SINGLE_ARG_DECL) @@ -1219,6 +1090,9 @@ namespace CIAO_GLUE_BasicSP } } + // Supported operations. + + } extern "C" EC_SVNT_Export ::PortableServer::Servant @@ -1248,3 +1122,4 @@ ACE_ENV_ARG_DECL) x.in (), c); } + diff --git a/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC_svnt.h b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC_svnt.h index 308736c61eb..1dc78f54344 100644 --- a/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC_svnt.h +++ b/TAO/CIAO/examples/handcrafted/BasicSP_EC/EC/EC_svnt.h @@ -20,8 +20,7 @@ #ifndef CIAO_GLUE_SESSION_EC_SVNT_H #define CIAO_GLUE_SESSION_EC_SVNT_H -#include /**/ "ace/pre.h" -#include "tao/ORB_Core.h" +#include "ace/pre.h" #include "ECS.h" #include "ECEC.h" @@ -31,15 +30,6 @@ #include "tao/PortableServer/Key_Adapters.h" #include "ace/Active_Map_Manager_T.h" -// START new event code -#include "orbsvcs/RtecEventCommS.h" -#include "orbsvcs/RtecEventChannelAdminC.h" -#include "Event_Utilities.h" -#include "orbsvcs/Event/EC_Event_Channel.h" -#include "orbsvcs/Event/EC_Default_Factory.h" -#include "CIAO_ValueC.h" -// END new event code - #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ @@ -137,34 +127,11 @@ namespace CIAO_GLUE_BasicSP ::CORBA::SystemException, ::Components::InvalidConnection)); - // START new event code - /* - ::Components::Cookie * - subscribe_timeout_consumer ( - ::BasicSP::TimeOutConsumer_ptr c); - - void - create_event_channel (void); - */ - // END new event code - protected: - - // START old event code - /* + /* ACE_Active_Map_Manager< ::BasicSP::TimeOutConsumer_var> ciao_publishes_timeout_map_; - */ - // END old event code - - /* - // START new event code - RtecEventChannelAdmin::ProxyPushConsumer_var - ciao_proxy_timeout_consumer_; - - RtecEventChannelAdmin::EventChannel_var ciao_event_channel_; - // END new event code */ ::Components::CCMHome_var @@ -178,9 +145,6 @@ namespace CIAO_GLUE_BasicSP ::BasicSP::EC_var component_; - - ::Components::Cookie * push_timeout_cookie_; - }; class EC_SVNT_Export EC_Servant @@ -226,7 +190,7 @@ namespace CIAO_GLUE_BasicSP ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); - virtual void + virtual void hertz ( ::CORBA::Long ACE_ENV_ARG_DECL_WITH_DEFAULTS) @@ -400,6 +364,17 @@ namespace CIAO_GLUE_BasicSP // Operations for CCMObject interface. + virtual void + component_UUID ( + const char * new_component_UUID + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CIAO::CONNECTION_ID + component_UUID ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual CORBA::IRObject_ptr get_component_def ( ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) @@ -464,6 +439,8 @@ namespace CIAO_GLUE_BasicSP ::CIAO::Session_Container * container_; + ACE_CString component_UUID_; + }; class EC_SVNT_Export ECHome_Servant @@ -553,6 +530,7 @@ namespace CIAO_GLUE_BasicSP ACE_Equal_To<PortableServer::ObjectId>, ACE_SYNCH_MUTEX> component_map_; + }; extern "C" EC_SVNT_Export ::PortableServer::Servant @@ -563,5 +541,6 @@ namespace CIAO_GLUE_BasicSP } -#include /**/ "ace/post.h" +#include "ace/post.h" #endif /* CIAO_GLUE_SESSION_EC_SVNT_H */ + diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Impl.cpp b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Impl.cpp index 08f452d843f..653df8d4ea1 100644 --- a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Impl.cpp +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Impl.cpp @@ -5,6 +5,7 @@ #include "Cookies.h" #include "../XML_Helpers/Assembly_Spec.h" #include "../XML_Helpers/XML_Utils.h" +#include "CIAO_EventsS.h" #if !defined (__ACE_INLINE__) # include "Assembly_Impl.inl" @@ -208,22 +209,11 @@ CIAO::Assembly_Impl::build (ACE_ENV_SINGLE_ARG_DECL) } // Setting connections - CIAO::Assembly_Spec::CONNECTION_QUEUE::ITERATOR - conn_iter (this->assembly_spec_->connections_); - - while (!conn_iter.done ()) - { - CIAO::Assembly_Connection::Connect_Info *connection; - conn_iter.next (connection); - - this->make_connection (connection - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - conn_iter.advance (); - } + this->make_connections (ACE_ENV_SINGLE_ARG_PARAMETER); this->state_ = ::Components::Deployment::INSERVICE; + + ACE_DEBUG ((LM_DEBUG, "All connections established.\n")); } void @@ -286,76 +276,160 @@ CIAO::Assembly_Impl::get_state (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) } void -CIAO::Assembly_Impl::make_connection (CIAO::Assembly_Connection::Connect_Info *info - ACE_ENV_ARG_DECL) +CIAO::Assembly_Impl::make_connections (ACE_ENV_SINGLE_ARG_DECL) { - switch (info->type_) + + CIAO::Assembly_Spec::CONNECTION_QUEUE::ITERATOR + conn_iter (this->assembly_spec_->connections_); + + while (!conn_iter.done ()) { - case CIAO::Assembly_Connection::INTERFACE: - { - CORBA::Object_var source - = this->resolve_interface (info->interface_ - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; + CIAO::Assembly_Connection::Connect_Info *connection; + conn_iter.next (connection); - Components::CCMObject_var comp - = this->resolve_component (info->component_ - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; + switch (connection->type_) + { + case CIAO::Assembly_Connection::INTERFACE: + { + CORBA::Object_var source + = this->resolve_interface (connection->dest_iface_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + Components::CCMObject_var comp + = this->resolve_component (connection->src_comp_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + comp->connect (connection->name_.c_str (), + source.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + // @@ Register the connection? How? + } + break; + + case CIAO::Assembly_Connection::EMITTER_CONSUMER: + { + Components::EventConsumerBase_var source + = this->resolve_consumer (connection->dest_iface_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + Components::CCMObject_var comp + = this->resolve_component (connection->src_comp_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + comp->connect_consumer (connection->name_.c_str (), + source.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + break; - comp->connect (info->name_.c_str (), - source.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; + case CIAO::Assembly_Connection::PUBLISHER_CONSUMER: + { + Components::CCMObject_var sink + = this->resolve_component (connection->dest_iface_->nested_resolver () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; - // @@ Register the connection? How? - } - break; + if (CORBA::is_nil (sink)) + ACE_DEBUG ((LM_DEBUG, "Nil sink\n")); - case CIAO::Assembly_Connection::EMITTER_CONSUMER: - { - Components::EventConsumerBase_var source - = this->resolve_consumer (info->interface_ - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; + Components::EventConsumerBase_var consumer + = this->resolve_consumer (connection->dest_iface_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; - Components::CCMObject_var comp - = this->resolve_component (info->component_ - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; + if (CORBA::is_nil (consumer)) + ACE_DEBUG ((LM_DEBUG, "Nil consumer\n")); - comp->connect_consumer (info->name_.c_str (), - source.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } - break; + Components::CCMObject_var source + = this->resolve_component (connection->src_comp_ + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; - case CIAO::Assembly_Connection::PUBLISHER_CONSUMER: - { - Components::EventConsumerBase_var source - = this->resolve_consumer (info->interface_ - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; + if (CORBA::is_nil (source)) + ACE_DEBUG ((LM_DEBUG, "Nil source\n")); - Components::CCMObject_var comp - = this->resolve_component (info->component_ - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; + Components::Deployment::Container_var container; + this->assembly_context_.containers_.find (connection->src_comp_->resolver_info (), + container + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; - comp->subscribe (info->name_.c_str (), - source.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } - break; + CIAO::ContainerEventService_var event_service = + container->get_event_service (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; - case CIAO::Assembly_Connection::HOME: - ACE_THROW (CORBA::NO_IMPLEMENT ()); + if (CORBA::is_nil (event_service)) + ACE_DEBUG ((LM_DEBUG, "Nil event_service\n")); - default: - ACE_THROW (CORBA::INTERNAL ()); + CIAO::EventServiceType type = CIAO::RTEC; + ACE_CString sid = source->component_UUID (ACE_ENV_SINGLE_ARG_DECL); + ACE_CHECK; + + sid += "_"; + sid += connection->name_.c_str (); + sid += "_publisher"; + + ACE_CString cid = sink->component_UUID (ACE_ENV_SINGLE_ARG_DECL); + ACE_CHECK; + + cid += "_"; + cid += connection->name_.c_str (); + cid += "_consumer"; + + ACE_DEBUG ((LM_DEBUG, "Publisher: %s\n", sid.c_str ())); + ACE_DEBUG ((LM_DEBUG, "Subscriber: %s\n", cid.c_str ())); + + if (this->connected_publishers_.find (sid) == -1) + { + CIAO::Supplier_Config_var supplier_config = + event_service->create_supplier_config (type ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + supplier_config->supplier_id (sid.c_str () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + event_service->connect_event_supplier (supplier_config.in () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->connected_publishers_.insert (sid); + } + + CIAO::Consumer_Config_var consumer_config = + event_service->create_consumer_config (type ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + consumer_config->supplier_id (sid.c_str () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + consumer_config->consumer_id (cid.c_str () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + consumer_config->consumer (Components::EventConsumerBase::_duplicate (consumer.in ()) + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + + event_service->connect_event_consumer (consumer_config.in () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + } + break; + + case CIAO::Assembly_Connection::HOME: + ACE_THROW (CORBA::NO_IMPLEMENT ()); + + default: + ACE_THROW (CORBA::INTERNAL ()); + } + + conn_iter.advance (); } + } CORBA::Object_ptr diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Impl.h b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Impl.h index bcb48e687cb..392b4e35208 100644 --- a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Impl.h +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Impl.h @@ -152,8 +152,7 @@ namespace CIAO * Connection establishment helper functions */ /// @{ - void make_connection (Assembly_Connection::Connect_Info *info - ACE_ENV_ARG_DECL_WITH_DEFAULTS); + void make_connections (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); CORBA::Object_ptr resolve_interface (Assembly_Connection::IF_Resolver_Info *info ACE_ENV_ARG_DECL_WITH_DEFAULTS); @@ -190,6 +189,8 @@ namespace CIAO Assembly_Spec *assembly_spec_; Assembly_Context assembly_context_; + + ACE_Unbounded_Set<ACE_CString> connected_publishers_; }; } diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.cpp b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.cpp index 291d555df59..7f76497cffd 100644 --- a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.cpp +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.cpp @@ -197,18 +197,18 @@ CIAO::Assembly_Builder_Visitor::visit_homeplacement // require putting similar policied home together for now. They // have abandoned this implementation already anyway. - Components::Deployment::Container_var container + this->container_ = this->get_container (hp->rtpolicyset_ref () ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (-1); - if (CORBA::is_nil (container.in ())) + if (CORBA::is_nil (this->container_.in ())) ACE_ERROR_RETURN ((LM_DEBUG, "Unable to acquire a reference to ServerActivator\n"), -1); Components::CCMHome_var home = - container->install_home (info.executor_UUID_.c_str (), + this->container_->install_home (info.executor_UUID_.c_str (), info.executor_entrypt_.c_str (), home_config ACE_ENV_ARG_PARAMETER); @@ -231,6 +231,8 @@ CIAO::Assembly_Builder_Visitor::visit_homeplacement // Save the home for component instantiation. this->home_ = klhome; + this->uuid_ = info.servant_UUID_.c_str (); + // @@ Register home according to register spec. // @@ Not implemented yet. } @@ -266,9 +268,16 @@ CIAO::Assembly_Builder_Visitor::visit_componentinstantiation = this->home_->create_component (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (-1); + comp->component_UUID (this->uuid_.c_str () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + this->context_.instantiated_components_.bind (ci->id (), comp); + this->context_.containers_.bind (ci->id (), + this->container_.in ()); + // Registering component. CIAO::Assembly_Placement::componentinstantiation::REGISTRATION_QUEUE::ITERATOR iter (ci->register_info_); diff --git a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.h b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.h index c0b83f7f463..c50ce0eea31 100644 --- a/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.h +++ b/TAO/CIAO/tools/Assembly_Deployer/Assembly_Visitors.h @@ -51,6 +51,13 @@ namespace CIAO ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> COMP_MAP; COMP_MAP instantiated_components_; + + typedef ACE_Hash_Map_Manager_Ex<ACE_CString, + Components::Deployment::Container_var, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> CONTAINER_MAP; + CONTAINER_MAP containers_; typedef ACE_Unbounded_Queue<Components::Deployment::ComponentServer_var> SERVER_QUEUE; SERVER_QUEUE component_servers_; @@ -139,6 +146,9 @@ namespace CIAO /// Deployment Configuration Info. Deployment_Configuration &deployment_config_; + + ACE_CString uuid_; + }; } diff --git a/TAO/CIAO/tools/XML_Helpers/Assembly_Handlers.cpp b/TAO/CIAO/tools/XML_Helpers/Assembly_Handlers.cpp index 9714e9dc4ac..7088714f06e 100644 --- a/TAO/CIAO/tools/XML_Helpers/Assembly_Handlers.cpp +++ b/TAO/CIAO/tools/XML_Helpers/Assembly_Handlers.cpp @@ -751,7 +751,7 @@ CIAO::Connections_Handler::endElement (const ACEXML_Char *namespaceURI, { if (this->resolver_ == 0) ACEXML_THROW (ACEXML_SAXException ("No valide IF resolver available")); - this->info_.component_ = this->resolver_; + this->info_.src_comp_ = this->resolver_; this->resolver_ = 0; this->state_ = SOURCE; } @@ -761,7 +761,7 @@ CIAO::Connections_Handler::endElement (const ACEXML_Char *namespaceURI, if (this->resolver_ == 0) ACEXML_THROW (ACEXML_SAXException ("No valide nested IF resolver available")); - this->info_.component_ = this->resolver_; + this->info_.src_comp_ = this->resolver_; this->resolver_ = 0; } else if (ACE_OS::strcmp (qName, "connectevent") == 0) @@ -779,7 +779,7 @@ CIAO::Connections_Handler::endElement (const ACEXML_Char *namespaceURI, { if (this->resolver_ == 0) ACEXML_THROW (ACEXML_SAXException ("No valide IF resolver available")); - this->info_.interface_ = this->resolver_; + this->info_.dest_iface_ = this->resolver_; this->resolver_ = 0; } else if (ACE_OS::strcmp (qName, "consumesport") == 0) @@ -796,7 +796,7 @@ CIAO::Connections_Handler::endElement (const ACEXML_Char *namespaceURI, nested), ACEXML_SAXException ("No memory left")); ACEXML_CHECK; - this->info_.interface_ = this->resolver_; + this->info_.dest_iface_ = this->resolver_; this->resolver_ = 0; this->state_ = START; } @@ -819,7 +819,7 @@ CIAO::Connections_Handler::endElement (const ACEXML_Char *namespaceURI, nested), ACEXML_SAXException ("No memory left")); ACEXML_CHECK; - this->info_.interface_ = this->resolver_; + this->info_.dest_iface_ = this->resolver_; this->resolver_ = 0; } else if (ACE_OS::strcmp (qName, "connectinterface") == 0 || @@ -985,8 +985,9 @@ CIAO::Connections_Handler::reset_info (ACEXML_Attributes *atts // @@ Potential memory leaks below. Need to ensure the allocated // memory is free when the Assembly_Spec is destroyed. - this->info_.component_ = 0; - this->info_.interface_ = 0; + this->info_.src_comp_ = 0; + //this->info_.dest_comp_ = 0; + this->info_.dest_iface_ = 0; for (size_t i = 0; i < atts->getLength (); ++i) { diff --git a/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.h b/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.h index 19a01e7ebc5..8a3c4a645d3 100644 --- a/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.h +++ b/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.h @@ -381,11 +381,14 @@ namespace CIAO /// The name of the receptacle or consumer. ACE_CString name_; - /// The component that uses the receptacle or consumes the event. - IF_Resolver_Info *component_; + /// The component that provides an interface or event. + IF_Resolver_Info *src_comp_; + + /// The component that receives an interface or event. + //IF_Resolver_Info *dest_comp_; /// The interface that is to be connected to the port. - IF_Resolver_Info *interface_; + IF_Resolver_Info *dest_iface_; } Connect_Info; } diff --git a/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.inl b/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.inl index e524761cc92..8ff2025bb34 100644 --- a/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.inl +++ b/TAO/CIAO/tools/XML_Helpers/Assembly_Spec.inl @@ -190,8 +190,9 @@ CIAO::Assembly_Connection::IF_Resolver_Info::traderquery (void) const ACE_INLINE CIAO::Assembly_Connection::_CII::_CII (void) : type_ (CIAO::Assembly_Connection::INVALID_CONN), - component_ (0), - interface_ (0) + src_comp_ (0), + //dest_comp_ (0), + dest_iface_ (0) { } |