diff options
author | dengg <dengg@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2006-02-10 03:17:42 +0000 |
---|---|---|
committer | dengg <dengg@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2006-02-10 03:17:42 +0000 |
commit | 254ab7baf378e655f5734a2a70a15a84f2b53ca9 (patch) | |
tree | b38345350e66d99b20d85e89891ec1367e1e13ac | |
parent | 5f0940dc4d5870a9c7eb620412c92c0e0a600563 (diff) | |
download | ATCD-254ab7baf378e655f5734a2a70a15a84f2b53ca9.tar.gz |
*** empty log message ***
9 files changed, 786 insertions, 26 deletions
diff --git a/TAO/CIAO/DAnCE/NodeApplication/Container_Impl.cpp b/TAO/CIAO/DAnCE/NodeApplication/Container_Impl.cpp index 30db3d0ba3a..14c18fb79ae 100644 --- a/TAO/CIAO/DAnCE/NodeApplication/Container_Impl.cpp +++ b/TAO/CIAO/DAnCE/NodeApplication/Container_Impl.cpp @@ -47,7 +47,7 @@ CIAO::Container_Impl::init (const CORBA::PolicyList *policies else { ACE_NEW_THROW_EX (this->container_, - CIAO::Session_Container (this->orb_.in (), this, 1, + CIAO::Session_Container (this->orb_.in (), this, 1, this->static_entrypts_maps_), CORBA::INTERNAL ()); ACE_CHECK_RETURN (-1); @@ -78,7 +78,7 @@ CIAO::Container_Impl::install ( CORBA::NO_MEMORY ()); ACE_TRY_CHECK; - // Get the ComponentImplementationInfos from the + // Get the ComponentImplementationInfos from the // ContainerImplementationInfo // to avoid too long syntax representation const ::Deployment::ComponentImplementationInfos impl_infos = @@ -111,7 +111,20 @@ CIAO::Container_Impl::install ( if (CORBA::is_nil (comp.in ())) ACE_TRY_THROW (Deployment::InstallationFailure ()); - if (this->component_map_.bind + ACE_DEBUG((LM_DEBUG, "Narrowing to SessionComponent ...\n")); + + ::Components::SessionComponent_var session_comp + = ::Components::SessionComponent::_narrow(comp.in ()); + + if (CORBA::is_nil(session_comp)) + { + ACE_DEBUG((LM_DEBUG, "session_comp is null\n")); + ACE_THROW (CORBA::INTERNAL ()); + } + else + ACE_DEBUG((LM_DEBUG, "session_comp is good\n")); + + if (this->component_map_.bind (impl_infos[i].component_instance_name.in (), Components::CCMObject::_duplicate (comp.in ()))) { @@ -128,7 +141,7 @@ CIAO::Container_Impl::install ( (*retv)[i].component_instance_name = impl_infos[i].component_instance_name.in (); - (*retv)[i].component_ref = + (*retv)[i].component_ref = Components::CCMObject::_duplicate (comp.in ()); // Deal with Component instance related Properties. @@ -143,7 +156,7 @@ CIAO::Container_Impl::install ( for (CORBA::ULong prop_len = 0; prop_len < clen; ++prop_len) { // Set up the ComponentIOR attribute - if (ACE_OS::strcmp + if (ACE_OS::strcmp (impl_infos[i].component_config[prop_len].name.in (), "ComponentIOR") == 0) { @@ -165,7 +178,7 @@ CIAO::Container_Impl::install ( } // Set up the naming service attribute - if (ACE_OS::strcmp + if (ACE_OS::strcmp (impl_infos[i].component_config[prop_len].name.in (), "RegisterNaming") == 0) { @@ -174,7 +187,7 @@ CIAO::Container_Impl::install ( component_config[prop_len].value >>= naming_context; // Register the component with the naming service - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "Register component with naming service.\n")); bool result = register_with_ns (naming_context, this->orb_.in (), @@ -184,16 +197,16 @@ CIAO::Container_Impl::install ( if (!result) { - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "Failed to register with naming service.\n")); } } // Initialize attributes through StandardConfigurator interface - // @@Todo: Currently I have to manually map - // the Deployment::Properties to - // Components::ConfigValues, we should use a + // @@Todo: Currently I have to manually map + // the Deployment::Properties to + // Components::ConfigValues, we should use a // common data structure in // the future. - Gan CORBA::ULong cur_len = comp_attributes.length (); @@ -206,11 +219,11 @@ CIAO::Container_Impl::install ( comp_attributes[cur_len] = item; } - + if (comp_attributes.length () != 0) { //std_configurator.set_configuration - ::Components::StandardConfigurator_var std_configurator = + ::Components::StandardConfigurator_var std_configurator = comp->get_standard_configurator (); std_configurator->set_configuration (comp_attributes); @@ -395,7 +408,7 @@ CIAO::Container_Impl::remove (ACE_ENV_SINGLE_ARG_DECL) //if (CIAO::debug_level () > 1) if (true) - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "Removed all homes and components from this container!\n")); } @@ -479,9 +492,9 @@ CIAO::Container_Impl::register_with_ns (const char * obj_name, { ACE_TRY { - // Obtain the naming service + // Obtain the naming service CORBA::Object_var naming_obj = - orb->resolve_initial_references ("NameService" + orb->resolve_initial_references ("NameService" ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; @@ -491,10 +504,10 @@ CIAO::Container_Impl::register_with_ns (const char * obj_name, false); CosNaming::NamingContext_var naming_context = - CosNaming::NamingContext::_narrow (naming_obj.in () + CosNaming::NamingContext::_narrow (naming_obj.in () ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - + // Create a Naming Sequence CosNaming::Name name (1); name.length (1); @@ -509,7 +522,7 @@ CIAO::Container_Impl::register_with_ns (const char * obj_name, } ACE_CATCHANY { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "CIAO (%P|%t) Container_Impl.cpp -" "CIAO::Container_Impl::register_with_ns -" "NodeApplication: failed to register " @@ -527,9 +540,9 @@ CIAO::Container_Impl::unregister_with_ns (const char * obj_name, { ACE_TRY { - // Obtain the naming service + // Obtain the naming service CORBA::Object_var naming_obj = - orb->resolve_initial_references ("NameService" + orb->resolve_initial_references ("NameService" ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; @@ -539,10 +552,10 @@ CIAO::Container_Impl::unregister_with_ns (const char * obj_name, false); CosNaming::NamingContext_var naming_context = - CosNaming::NamingContext::_narrow (naming_obj.in () + CosNaming::NamingContext::_narrow (naming_obj.in () ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - + // Create a Naming Sequence CosNaming::Name name (1); name.length (1); @@ -550,8 +563,8 @@ CIAO::Container_Impl::unregister_with_ns (const char * obj_name, name[0].kind = CORBA::string_dup (""); // Register with the Name Server - ACE_DEBUG ((LM_DEBUG, - "Unregister component with the name server : %s!\n", + ACE_DEBUG ((LM_DEBUG, + "Unregister component with the name server : %s!\n", obj_name)); naming_context->unbind (name ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; @@ -560,7 +573,7 @@ CIAO::Container_Impl::unregister_with_ns (const char * obj_name, } ACE_CATCHANY { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "CIAO (%P|%t) Container_Impl.cpp -" "CIAO::Container_Impl::unregister_with_ns -" "NodeApplication: failed to unregister " diff --git a/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent.cpp b/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent.cpp new file mode 100644 index 00000000000..016cb449faf --- /dev/null +++ b/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent.cpp @@ -0,0 +1,224 @@ +// $Id$ + +#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)) + { + Components::EventConsumerBase_var consumer = + consumer_config->consumer (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->consumer_array_.size (this->consumer_array_.size () + 1); + + this->consumer_array_.set (Components::EventConsumerBase::_duplicate (consumer.in ()), + this->consumer_array_.size () - 1); + + } + + 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 (); // Is this needed or not? + this->consumer_array_[iter]->push_event ( + ev + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + } + + Direct_Consumer_Config_impl::Direct_Consumer_Config_impl (PortableServer::POA_ptr poa) : + service_type_ (DIRECT), + poa_ (PortableServer::POA::_duplicate (poa)) + { + } + + Direct_Consumer_Config_impl::~Direct_Consumer_Config_impl (void) + { + ACE_DEBUG ((LM_DEBUG, "Direct_Consumer_Config_impl::~Direct_Consumer_Config_impl\n")); + } + + 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_ = Components::EventConsumerBase::_duplicate (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 ()); + } + + void + Direct_Consumer_Config_impl::destroy ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + PortableServer::ObjectId_var oid = this->poa_->servant_to_id (this); + this->poa_->deactivate_object (oid); + this->_remove_ref (); + } + + Direct_Supplier_Config_impl::Direct_Supplier_Config_impl (PortableServer::POA_ptr poa) + : service_type_ (DIRECT), + poa_ (PortableServer::POA::_duplicate (poa)) + { + } + + Direct_Supplier_Config_impl::~Direct_Supplier_Config_impl (void) + { + ACE_DEBUG ((LM_DEBUG, "Direct_Supplier_Config_impl::~Direct_Supplier_Config_impl\n")); + } + + 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_; + } + + void + Direct_Supplier_Config_impl::destroy ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + PortableServer::ObjectId_var oid = this->poa_->servant_to_id (this); + this->poa_->deactivate_object (oid); + this->_remove_ref (); + } + +} diff --git a/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent.h b/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent.h new file mode 100644 index 00000000000..1ac246919b8 --- /dev/null +++ b/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent.h @@ -0,0 +1,202 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CIAO_DirectEvent.h + * + * $Id$ + * + * @author George Edwards <g.edwards@vanderbilt.edu> + * @author Gan Deng <dengg@dre.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 "ciaosvcs/Events/CIAO_EventServiceBase.h" +#include "CIAO_DirectEventS.h" + +#include "ace/Array.h" + +namespace CIAO +{ + /** + * @class DirectEventService + * + * An implementation of EventServiceBase using direct communication. + */ + class CIAO_EVENTS_Export DirectEventService : + public virtual EventServiceBase + { + public: + + DirectEventService (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa); + + virtual void + connect_event_supplier ( + Supplier_Config_ptr supplier_config + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( CORBA::SystemException)); + + virtual void + connect_event_consumer ( + CIAO::Consumer_Config_ptr consumer_config + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + virtual void + disconnect_event_consumer ( + const char * connection_id + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)); + + virtual void + disconnect_event_supplier ( + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + CORBA::SystemException, + Components::InvalidName, + Components::InvalidConnection)); + + virtual void + push_event ( + Components::EventBase * ev + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + 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. + */ + /// @@ George, this is cool! Do you want to use a _var or _ptr? + ACE_Array<Components::EventConsumerBase_var> 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 virtual PortableServer::RefCountServantBase + { + + public: + + Direct_Consumer_Config_impl (PortableServer::POA_ptr poa); + + virtual ~Direct_Consumer_Config_impl (void); + + virtual void consumer_id (const char * consumer_id + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual CONNECTION_ID consumer_id (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + 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_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void consumer (Components::EventConsumerBase_ptr consumer ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual Components::EventConsumerBase_ptr consumer (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + // @@ george, probably this should be const'ified? + virtual EventServiceType service_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + private: + + ACE_CString consumer_id_; + + ACE_CString supplier_id_; + + Components::EventConsumerBase_var consumer_; + + EventServiceType service_type_; + + PortableServer::POA_var poa_; + + }; + + /** + * @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 virtual PortableServer::RefCountServantBase + { + + public: + + Direct_Supplier_Config_impl (PortableServer::POA_ptr poa); + + virtual ~Direct_Supplier_Config_impl (void); + + void supplier_id (const char * supplier_id ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + char * supplier_id (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + EventServiceType service_type (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void destroy (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException)); + + private: + + ACE_CString supplier_id_; + + EventServiceType service_type_; + + PortableServer::POA_var poa_; + + }; + +} + +#include /**/ "ace/post.h" +#endif /* CIAO_DIRECTEVENT_H */ diff --git a/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent.idl b/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent.idl new file mode 100644 index 00000000000..3baed93687d --- /dev/null +++ b/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent.idl @@ -0,0 +1,29 @@ +// $Id$ + +/** + * @file CIAO_DirectEvent.idl + * + * @author George Edwards + * @author Gan Deng <dengg@dre.vanderbilt.edu> + * + * @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/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent.mpc b/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent.mpc new file mode 100644 index 00000000000..583ba46ecd1 --- /dev/null +++ b/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent.mpc @@ -0,0 +1,31 @@ +// -*- MPC -*- +// $Id$ + +project (CIAO_Direct_Event) : orbsvcslib, ciao_events_dnc { + + after += CIAO_DnC_Events_Base + sharedname = CIAO_Direct_Event + idlflags += -Wb,export_include=CIAO_Events_Export.h -Wb,export_macro=CIAO_EVENTS_Export + dynamicflags = CIAO_EVENTS_BUILD_DLL + + IDL_Files { + CIAO_DirectEvent.idl + } + + Source_Files { + CIAO_DirectEventS.cpp + CIAO_DirectEventC.cpp + CIAO_DirectEvent.cpp + CIAO_DirectEvent_Factory.cpp + } + + Header_Files { + CIAO_DirectEventS.h + CIAO_DirectEventC.h + CIAO_DirectEvent.h + CIAO_DirectEvent_Factory.h + } +} + + + diff --git a/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent_Factory.cpp b/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent_Factory.cpp new file mode 100644 index 00000000000..9344b1aa335 --- /dev/null +++ b/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent_Factory.cpp @@ -0,0 +1,91 @@ +// $Id$ + +#include "CIAO_DirectEvent_Factory.h" +#include "CIAO_DirectEvent.h" + +/// Initialize the DirectEventService 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 +{ + + CIAO_DirectEvent_Factory::CIAO_DirectEvent_Factory (void) + { + } + + CIAO_DirectEvent_Factory::~CIAO_DirectEvent_Factory (void) + { + } + + Consumer_Config_ptr + CIAO_DirectEvent_Factory::create_consumer_config () + { + Direct_Consumer_Config_impl * consumer_config = 0; + ACE_NEW_RETURN (consumer_config, + Direct_Consumer_Config_impl (this->root_poa_.in ()), + Consumer_Config::_nil ()); + Direct_Consumer_Config_var return_direct = + consumer_config->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + return return_direct._retn (); + } + + + Supplier_Config_ptr + CIAO_DirectEvent_Factory::create_supplier_config () + { + Direct_Supplier_Config_impl * supplier_config = 0; + ACE_NEW_RETURN (supplier_config, + Direct_Supplier_Config_impl (this->root_poa_.in ()), + Supplier_Config::_nil ()); + Direct_Supplier_Config_var return_direct = + supplier_config->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + return return_direct._retn (); + } + + + EventServiceBase * + CIAO_DirectEvent_Factory::create () + { + ACE_DEBUG ((LM_DEBUG, "CIAO::EventService_Factory_impl::create_event_service\n")); + + DirectEventService * event_service = 0; + ACE_NEW_RETURN (event_service, + DirectEventService (this->orb_.in (), + this->root_poa_.in ()), + 0); + return event_service; + } + + int + CIAO_DirectEvent_Factory::Initializer (void) + { + return + ACE_Service_Config::process_directive ( + ace_svc_desc_CIAO_DirectEvent_Factory + ); + } + + void CIAO_DirectEvent_Factory::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 ( + CIAO_DirectEvent_Factory, + ACE_TEXT ("CIAO_DirectEvent_Factory"), + ACE_SVC_OBJ_T, + &ACE_SVC_NAME (CIAO_DirectEvent_Factory), + ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, + 0 + ) + + ACE_FACTORY_DEFINE (CIAO_EVENTS, CIAO_DirectEvent_Factory) + +} // namespace CIAO diff --git a/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent_Factory.h b/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent_Factory.h new file mode 100644 index 00000000000..f9303e310ef --- /dev/null +++ b/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent_Factory.h @@ -0,0 +1,81 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CIAO_EventService_Factory_impl.h + * + * $Id$ + * + * @author Gan Deng <dengg@dre.vanderbilt.edu> + */ +//============================================================================= + +#ifndef CIAO_EVENTSERVICE_FACTORY_IMPL_H +#define CIAO_EVENTSERVICE_FACTORY_IMPL_H +#include /**/ "ace/pre.h" + +#include "CIAO_EventService_Factory_Base.h" + +#include "tao/PortableServer/PortableServer.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO +{ + + class CIAO_EVENTS_Export CIAO_DirectEvent_Factory + : public virtual EventService_Factory + { + + public: + // @@ George, why don't you initialize with the POA pointer. Just + // curious. + CIAO_DirectEvent_Factory (void); + + virtual ~CIAO_DirectEvent_Factory (void); + + virtual Consumer_Config_ptr create_consumer_config (void); + + virtual Supplier_Config_ptr create_supplier_config (void); + + virtual EventServiceBase * create (void); + + virtual void init (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa); + + // Used to force the initialization. + static int Initializer (void); + + private: + + /// Reference to the ORB + CORBA::ORB_var orb_; + + /// Reference to the Root POA + PortableServer::POA_var root_poa_; + }; + +ACE_STATIC_SVC_DECLARE (CIAO_DirectEvent_Factory) +ACE_FACTORY_DECLARE (CIAO_EVENTS, CIAO_DirectEvent_Factory) + +} + +#if defined (ACE_HAS_BROKEN_STATIC_CONSTRUCTORS) + +typedef int (*CIAO_Module_Initializer) (void); + +static CIAO_Module_Initializer +CIAO_Requires_EventService_Initializer = + &CIAO::CIAO_DirectEvent_Factory::Initializer; + +#else + +static int +CIAO_Requires_EventService_Initializer = + CIAO::CIAO_DirectEvent_Factory::Initializer (); + +#endif /* ACE_HAS_BROKEN_STATIC_CONSTRUCTORS */ + +#include /**/ "ace/post.h" +#endif /* CIAO_EVENTSERVICE_FACTORY_IMPL_H */ diff --git a/TAO/CIAO/ciaosvcs/Events/CIAO_Events.idl b/TAO/CIAO/ciaosvcs/Events/CIAO_Events.idl new file mode 100644 index 00000000000..6f2ee1d1e33 --- /dev/null +++ b/TAO/CIAO/ciaosvcs/Events/CIAO_Events.idl @@ -0,0 +1,62 @@ +// $Id$ + +/** + * @file CIAO_Events.idl + * + * @author George Edwards <g.edwards@vanderbilt.edu> + * @author Gan Deng <dengg@dre.vanderbilt.edu> + * + * @brief Interfaces for configuring CIAO's event mechanism. + */ + +#include "ciao/CCM_Event.idl" + +module CIAO +{ + /// A component's UUID + port name. + typedef string CONNECTION_ID; + + enum EventServiceType + { + DIRECT, + EC, + RTEC, + NOTIFY, + RTNOTIFY + }; + + interface Supplier_Config + { + attribute CONNECTION_ID supplier_id; + + readonly attribute EventServiceType service_type; + + void destroy (); + }; + + interface Consumer_Config : Supplier_Config + { + attribute CONNECTION_ID consumer_id; + attribute Components::EventConsumerBase consumer; + }; + + 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_conf); + + void disconnect_event_supplier (in CONNECTION_ID conn_id) + raises (Components::InvalidConnection, Components::InvalidName); + + void connect_event_consumer (in Consumer_Config consumer_conf); + + void disconnect_event_consumer (in CONNECTION_ID conn_id) + raises (Components::InvalidConnection, Components::InvalidName); + + void push_event (in Components::EventBase ev, + in CONNECTION_ID conn_id); + }; +}; diff --git a/TAO/CIAO/ciaosvcs/Events/CIAO_Events.mpc b/TAO/CIAO/ciaosvcs/Events/CIAO_Events.mpc new file mode 100644 index 00000000000..9f68aeb6cee --- /dev/null +++ b/TAO/CIAO/ciaosvcs/Events/CIAO_Events.mpc @@ -0,0 +1,27 @@ +// -*- MPC -*- +// $Id$ + + +project (CIAO_DnC_Events_Base) : orbsvcslib, ciao_events_dnc { + + after += CIAO_DnC_Client + sharedname = CIAO_DnC_Events + idlflags += -Wb,export_include=CIAO_Events_Export.h -Wb,export_macro=CIAO_EVENTS_Export + dynamicflags = CIAO_EVENTS_BUILD_DLL + + IDL_Files { + CIAO_Events.idl + } + + Source_Files { + CIAO_EventService_Factory_Base.cpp + } + + Header_Files { + CIAO_EventService_Factory_Base.h + CIAO_EventServiceBase.h + } +} + + + |