From 2f207e7f6f302063c6cd0afcb239f6ff04d4160a Mon Sep 17 00:00:00 2001 From: dengg Date: Mon, 23 Oct 2006 01:42:56 +0000 Subject: Added an option to pass ES name when installing CIAO ES. --- ciaosvcs/Events/CIAO_EventService_Factory_impl.cpp | 6 +++-- ciaosvcs/Events/CIAO_EventService_Factory_impl.h | 3 ++- ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.cpp | 30 +++++++++++++++++----- ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.h | 6 ++--- 4 files changed, 32 insertions(+), 13 deletions(-) diff --git a/ciaosvcs/Events/CIAO_EventService_Factory_impl.cpp b/ciaosvcs/Events/CIAO_EventService_Factory_impl.cpp index 4b1a3a36e96..47f6370cf26 100644 --- a/ciaosvcs/Events/CIAO_EventService_Factory_impl.cpp +++ b/ciaosvcs/Events/CIAO_EventService_Factory_impl.cpp @@ -33,7 +33,8 @@ namespace CIAO } CIAO_Event_Service_ptr - EventService_Factory_impl::create (EventServiceType type) + EventService_Factory_impl::create (EventServiceType type, + const char * ec_name) { ACE_DEBUG ((LM_DEBUG, "CIAO::EventService_Factory_impl::create_event_service\n")); @@ -44,7 +45,8 @@ namespace CIAO case RTEC: ACE_NEW_RETURN (event_service, RTEventService (this->orb_.in (), - this->poa_.in ()), + this->poa_.in (), + ec_name), 0); break; diff --git a/ciaosvcs/Events/CIAO_EventService_Factory_impl.h b/ciaosvcs/Events/CIAO_EventService_Factory_impl.h index e973279330d..7ba36ac9a0d 100644 --- a/ciaosvcs/Events/CIAO_EventService_Factory_impl.h +++ b/ciaosvcs/Events/CIAO_EventService_Factory_impl.h @@ -41,7 +41,8 @@ namespace CIAO virtual ~EventService_Factory_impl (void); /// A factory method which creates an CIAO_Event_Service object - virtual CIAO_Event_Service_ptr create (EventServiceType type); + virtual CIAO_Event_Service_ptr create (EventServiceType type, + const char * ec_name); virtual void initialize (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa); diff --git a/ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.cpp b/ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.cpp index 8541a2f26d9..a3bb71ee65a 100644 --- a/ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.cpp +++ b/ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.cpp @@ -19,15 +19,19 @@ #include + static int iii; + namespace CIAO { + RTEventService::RTEventService (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa) : + PortableServer::POA_ptr poa, + const char * ec_name) : orb_ (CORBA::ORB::_duplicate (orb)), root_poa_ (PortableServer::POA::_duplicate (poa)) { - this->create_rt_event_channel (); + this->create_rt_event_channel (ec_name); } @@ -276,10 +280,11 @@ namespace CIAO ACE_Hash hasher; events[0].header.source = hasher (source_id); - //events[0].header.source = i++; - events[0].header.type = ACE_ES_EVENT_ANY; //this->type_id_; - events[0].data.any_value <<= ev; + //events[0].header.ttl = 1; + //events[0].data.any_value <<= ev; + + events[0].data.any_value <<= CORBA::string_dup( "Hey! Junk Data"); ACE_DEBUG ((LM_DEBUG, "******* push event for source string: %s\n", source_id)); ACE_DEBUG ((LM_DEBUG, "******* push event for source id: %i\n", events[0].header.source)); @@ -299,8 +304,7 @@ namespace CIAO } void - RTEventService::create_rt_event_channel ( - ACE_ENV_SINGLE_ARG_DECL) + RTEventService::create_rt_event_channel (const char * ec_name) ACE_THROW_SPEC (( CORBA::SystemException)) { @@ -319,6 +323,18 @@ namespace CIAO ACE_CHECK; this->rt_event_channel_ = ec_servant->_this (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; + + if (false) + { + // Find the Naming Service. + CORBA::Object_var obj = orb_->resolve_initial_references("NameService"); + CosNaming::NamingContextExt_var root_context = CosNaming::NamingContextExt::_narrow(obj.in()); + + // Bind the Event Channel using Naming Services + CosNaming::Name_var name = root_context->to_name (ec_name); + ACE_DEBUG ((LM_DEBUG, "\nRegister naming: %s\n", ec_name)); + root_context->rebind (name.in(), rt_event_channel_.in()); + } } ::CORBA::Boolean diff --git a/ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.h b/ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.h index 3c217699bb4..075f97b9531 100644 --- a/ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.h +++ b/ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.h @@ -55,7 +55,8 @@ namespace CIAO public: RTEventService (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa); + PortableServer::POA_ptr poa, + const char * ec_name); virtual ~RTEventService (void); @@ -138,8 +139,7 @@ namespace CIAO private: // @@ (GD) This is the place where use could provide a parameter // which specifies the event channel service configuration file. - void create_rt_event_channel ( - ACE_ENV_SINGLE_ARG_DECL) + void create_rt_event_channel (const char * ec_name) ACE_THROW_SPEC (( CORBA::SystemException)); -- cgit v1.2.1