From 49ba9cabd8b7884b64b4861c3ecaf47916f73899 Mon Sep 17 00:00:00 2001 From: dengg Date: Fri, 17 Mar 2006 22:45:10 +0000 Subject: *** empty log message *** --- TAO/CIAO/CIAO_DAnCE.mwc | 1 + TAO/CIAO/CIAO_TAO_DAnCE.mwc | 4 + .../DomainApplicationManager_Impl.cpp | 313 +++++--- .../DomainApplicationManager_Impl.h | 43 +- .../ExecutionManager/Execution_Manager_Impl.cpp | 22 +- .../DAnCE/NodeApplication/NodeApplication_Impl.cpp | 797 +++++++++++++++------ .../DAnCE/NodeApplication/NodeApplication_Impl.h | 92 ++- .../DAnCE/NodeApplication/NodeApplication_Impl.inl | 1 + .../NodeApplicationManager_Impl.cpp | 13 +- TAO/CIAO/ciao/CCM_Core.mpc | 8 +- TAO/CIAO/ciao/CCM_Event.idl | 21 +- TAO/CIAO/ciao/Container_Base.cpp | 16 +- TAO/CIAO/ciao/Container_Base.h | 4 +- TAO/CIAO/ciao/Deployment_Core.idl | 44 +- .../Events/CIAO_Direct/CIAO_DirectEvent.cpp | 45 +- .../ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent.h | 32 +- .../Events/CIAO_Direct/CIAO_DirectEvent.idl | 5 +- .../Events/CIAO_Direct/CIAO_DirectEvent.mpc | 26 + .../Events/CIAO_Direct/CIAO_DirectEvent_Export.h | 58 ++ TAO/CIAO/ciaosvcs/Events/CIAO_EventServiceBase.cpp | 23 + TAO/CIAO/ciaosvcs/Events/CIAO_EventServiceBase.h | 116 +++ .../Events/CIAO_EventService_Factory_impl.cpp | 95 +++ .../Events/CIAO_EventService_Factory_impl.h | 77 ++ TAO/CIAO/ciaosvcs/Events/CIAO_Events.idl | 17 +- TAO/CIAO/ciaosvcs/Events/CIAO_Events.mpc | 46 ++ .../ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.cpp | 555 ++++++++++++++ TAO/CIAO/ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.h | 326 +++++++++ .../ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.idl | 44 ++ .../ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.mpc | 28 + 29 files changed, 2448 insertions(+), 424 deletions(-) create mode 100644 TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent.mpc create mode 100644 TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent_Export.h create mode 100644 TAO/CIAO/ciaosvcs/Events/CIAO_EventServiceBase.cpp create mode 100644 TAO/CIAO/ciaosvcs/Events/CIAO_EventServiceBase.h create mode 100644 TAO/CIAO/ciaosvcs/Events/CIAO_EventService_Factory_impl.cpp create mode 100644 TAO/CIAO/ciaosvcs/Events/CIAO_EventService_Factory_impl.h create mode 100644 TAO/CIAO/ciaosvcs/Events/CIAO_Events.mpc create mode 100644 TAO/CIAO/ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.cpp create mode 100644 TAO/CIAO/ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.h create mode 100644 TAO/CIAO/ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.idl create mode 100644 TAO/CIAO/ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.mpc diff --git a/TAO/CIAO/CIAO_DAnCE.mwc b/TAO/CIAO/CIAO_DAnCE.mwc index c2d2aa82e6b..97e79d5b9a2 100644 --- a/TAO/CIAO/CIAO_DAnCE.mwc +++ b/TAO/CIAO/CIAO_DAnCE.mwc @@ -3,5 +3,6 @@ workspace { ciao DAnCE + ciaosvcs tools/Config_Handlers } diff --git a/TAO/CIAO/CIAO_TAO_DAnCE.mwc b/TAO/CIAO/CIAO_TAO_DAnCE.mwc index a947d53aa09..54512e87735 100644 --- a/TAO/CIAO/CIAO_TAO_DAnCE.mwc +++ b/TAO/CIAO/CIAO_TAO_DAnCE.mwc @@ -14,7 +14,11 @@ workspace { ../orbsvcs/orbsvcs/Svc_Utils.mpc ../orbsvcs/orbsvcs/Security.mpc ../orbsvcs/orbsvcs/IFRService.mpc + ../orbsvcs/orbsvcs/RTEvent.mpc + ../orbsvcs/orbsvcs/RTEvent_Serv.mpc + ../orbsvcs/orbsvcs/RTEvent_Skel.mpc ciao DAnCE + ciaosvcs tools/Config_Handlers } diff --git a/TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.cpp b/TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.cpp index f9d05ef013e..8fcd4b4bf62 100644 --- a/TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.cpp +++ b/TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.cpp @@ -635,6 +635,99 @@ startLaunch (const ::Deployment::Properties & configProperty, ACE_CHECK; } + +void +CIAO::DomainApplicationManager_Impl:: +install_all_es (void) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::StartError)) +{ + ACE_TRY + { + for (CORBA::ULong i = 0; i < this->num_child_plans_; ++i) + { + ACE_Hash_Map_Entry *entry = 0; + + if (this->artifact_map_.find (this->node_manager_names_[i], + entry) != 0) + { + ACE_ERROR ((LM_ERROR, + "DAnCE (%P|%t) DomainApplicationManager_Impl.cpp -" + "CIAO::DomainApplicationManager_Impl::install_all_es -" + "ERROR while finding the node specific plan " + "for the node [%s] \n", + this->node_manager_names_[i].c_str ())); + + ACE_CString error + ("Unable to resolve a reference to NodeManager: "); + error += this->node_manager_names_[i]; + + ACE_TRY_THROW + (Deployment::StartError + ("DomainApplicationManager_Impl::install_all_es", + error.c_str ())); + } + + // Invoke install_es () operation on each cached NodeApplication object. + ::Deployment::NodeApplication_ptr my_na = + (entry->int_id_).node_application_.in (); + + // @@TODO: Need to populate the node-specific ESInstallationInfos? + Deployment::ESInstallationInfos_var es_infos; + ACE_NEW (es_infos, + Deployment::ESInstallationInfos); + + es_infos->length (1); + (*es_infos)[0].id = "ES_001"; + (*es_infos)[0].type = CIAO::RTEC; + + ::Deployment::CIAO_Event_Services_var event_services = + my_na->install_es (es_infos); + + // Add these returned ES objects into the cached map + this->add_es_to_map (es_infos, event_services); + } + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "DomainApplicationManager_Impl::post_finishLaunch.\n"); + ACE_RE_THROW; + } + ACE_ENDTRY; + + ACE_CHECK; +} + +void +CIAO::DomainApplicationManager_Impl:: +add_es_to_map (Deployment::ESInstallationInfos * es_infos, + Deployment::CIAO_Event_Services * event_services) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::StartError)) +{ + ACE_TRY + { + CORBA::ULong es_length = event_services->length (); + + for (CORBA::ULong i = 0; i < es_length; ++i) + { + this->es_map_.bind ( + (*es_infos)[i].id.in (), + CIAO::CIAO_Event_Service::_duplicate ((*event_services)[i])); + } + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "DomainApplicationManager_Impl::add_to_es_table.\n"); + ACE_RE_THROW; + } + ACE_ENDTRY; + + ACE_CHECK; +} + void CIAO::DomainApplicationManager_Impl:: finishLaunch (CORBA::Boolean start, @@ -646,10 +739,13 @@ finishLaunch (CORBA::Boolean start, CIAO_TRACE("CIAO::DomainApplicationManager_Impl::finishLaunch"); ACE_TRY { + // Install all the CIAO_Event_Services within the Deployment Plan + this->install_all_es (); + // Invoke finishLaunch() operation on each cached NodeApplication object. // This will establish bindings for only those internal components, but // NOT for those external/shared components, which requires special - // handle, since these components are outside the control of this + // handling, since these components are outside the control of this // DomainApplicationManager. for (CORBA::ULong i = 0; i < this->num_child_plans_; ++i) { @@ -798,14 +894,14 @@ finishLaunch (CORBA::Boolean start, ACE_ASSERT (!CORBA::is_nil (entry->int_id_.node_application_.in ())); entry->int_id_.node_application_->finishLaunch (*unnecessary_connections, - start, - false // false ==> remove unnecessary connections - ACE_ENV_ARG_PARAMETER); + start, + false // false ==> remove unnecessary connections + ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; } //============================================================= - // Remove Old Components Logic + // Remove Old Components //============================================================= // Finally we need to remove those to-be-removed components ::Deployment::Properties_var configProperty; @@ -1078,107 +1174,116 @@ get_outgoing_connections_i (const char * instname, // Search for all the connections in the plan. const CORBA::ULong total_length = tmp_plan.connection.length(); for (CORBA::ULong i = 0; i < total_length; ++i) - { - CORBA::ULong len = retv.length (); - - // Current connection that we are looking at. - const Deployment::PlanConnectionDescription & curr_conn = - tmp_plan.connection[i]; + { + // Current binding that we are looking at. + const Deployment::PlanConnectionDescription & binding = + tmp_plan.connection[i]; + + // If this is a ReDaC case, then we ignore the connection if it + // already exists in the old_plan + if (already_exists (binding) && + !is_getting_all_connections) + continue; + + this->populate_connection_for_binding (instname, + binding, + tmp_plan, + retv); + } + return true; +} - if (already_exists (curr_conn) && - !is_getting_all_connections) // ignore existing connections - continue; +bool +CIAO::DomainApplicationManager_Impl:: +populate_connection_for_binding ( + const char * instname, + const Deployment::PlanConnectionDescription & binding, + const Deployment::DeploymentPlan & plan, + Deployment::Connections & retv) + ACE_THROW_SPEC ((Deployment::StartError)) +{ + // The initial retv might have something inside + CORBA::ULong len = retv.length (); - //The modeling tool should make sure there are always 2 endpoints - //in a connection. - const CORBA::ULong curr_conn_len = curr_conn.internalEndpoint.length (); - for (CORBA::ULong p_index = 0; - p_index < curr_conn_len; - ++p_index) + // The modeling tool should make sure there are always 2 ports in a binding + const CORBA::ULong binding_len = binding.internalEndpoint.length (); + for (CORBA::ULong i = 0; i < binding_len; ++i) { const Deployment::PlanSubcomponentPortEndpoint & endpoint = - curr_conn.internalEndpoint[p_index]; + binding.internalEndpoint[i]; - // If the component name matches the name of one of the - // endpoints in the connection. - if (ACE_OS::strcmp (tmp_plan.instance[endpoint.instanceRef].name.in (), - instname) == 0 ) - { - //Look at the port kind to make sure it's what we are interested in. - if (endpoint.kind != Deployment::Facet && - endpoint.kind != Deployment::EventConsumer) - { - // The other endpoints in this connection is what we want. - CORBA::ULong index = (p_index +1)%2; - - //Cache the name of the other component for later usage (search). - ACE_CString name = - tmp_plan.instance[curr_conn.internalEndpoint[index]. - instanceRef].name.in (); - - // Cache the name of the port from the - // other component for searching later. - ACE_CString port_name = - curr_conn.internalEndpoint[index].portName.in (); - - ACE_DEBUG ((LM_ERROR, "Looking: %s,%s \n", - name.c_str (), - port_name.c_str ())); - - bool found = false; - // Now we have to search in the received - // connections to get the objRef. - const CORBA::ULong all_conn_len = this->all_connections_->length (); - for (CORBA::ULong conn_index = 0; - conn_index < all_conn_len; - ++conn_index) - { - const Deployment::Connection curr_rev_conn = - this->all_connections_[conn_index]; - - // We need to look at the instance name and the - // port name to confirm. - if (ACE_OS::strcmp (curr_rev_conn.instanceName.in (), - name.c_str ()) == 0 && - ACE_OS::strcmp (curr_rev_conn.portName.in (), - port_name.c_str ()) == 0) - { - //ACE_DEBUG ((LM_DEBUG, "step5\n")); - retv.length (len+1); - retv[len].instanceName = instname; - retv[len].portName = endpoint.portName.in (); - retv[len].kind = endpoint.kind; - retv[len].endpoint = - CORBA::Object::_duplicate(curr_rev_conn.endpoint.in ()); - - retv[len].endpointInstanceName = name.c_str (); - retv[len].endpointPortName = port_name.c_str (); - - ++len; - found = true; - break; - } - } - - // We didnt find the counter part connection even - // we are sure there must be 1. - if (!found) + // If the instance name does NOT match one of the names in the binding + if (ACE_OS::strcmp (instname, + plan.instance[endpoint.instanceRef].name.in ()) != 0) + continue; + + // We are only interested in Facet and EventConsumer port kind + if (endpoint.kind == Deployment::Facet || + endpoint.kind == Deployment::EventConsumer) + { + // Obtain the source index, which is the opposite of the endpoint + CORBA::ULong s_index = (i + 1) % 2; + + ACE_CString source_inst = + plan.instance[binding.internalEndpoint[s_index] + .instanceRef].name.in (); + + ACE_CString source_port = + binding.internalEndpoint[s_index].portName.in (); + + ACE_CString endpoint_inst = + plan.instance[binding.internalEndpoint[i] + .instanceRef].name.in (); + + ACE_CString endpoint_port = + binding.internalEndpoint[i].portName.in (); + + bool found = false; + + // Now we search in the received connections to get the objRef. + const CORBA::ULong all_conn_len = this->all_connections_->length (); + for (CORBA::ULong j = 0; j < all_conn_len; ++j) + { + const Deployment::Connection & curr_recv_conn = + this->all_connections_[j]; + + // We need to look at the instance name and the port name to confirm. + if (ACE_OS::strcmp (curr_recv_conn.instanceName.in (), + endpoint_inst.c_str ()) == 0 && + ACE_OS::strcmp (curr_recv_conn.portName.in (), + endpoint_port.c_str ()) == 0) { - ACE_CString error ("Creating connections for "); - error += instname; - error += ": unable to find object reference for connection "; - error += curr_conn.name.in (); - ACE_THROW_RETURN (Deployment::StartError - ("DomainApplicationManager_Impl::create_connections_i", - error.c_str ()), - false); + retv.length (len+1); + retv[len].instanceName = source_inst.c_str (); + retv[len].portName = source_port.c_str (); + retv[len].endpointInstanceName = endpoint_inst.c_str (); + retv[len].endpointPortName = endpoint_port.c_str (); + + retv[len].endpoint = + CORBA::Object::_duplicate(curr_recv_conn.endpoint.in ()); + retv[len].kind = binding.internalEndpoint[s_index].kind; + + ++len; + found = true; + break; } + } // End of searching received connections - break; - } - } + // We didnt find the objref of the connection ... + if (!found) + { + ACE_CString error ("Creating connections for "); + error += instname; + error += ": unable to find object reference for connection "; + error += binding.name.in (); + ACE_THROW_RETURN (Deployment::StartError + ("DomainApplicationManager_Impl::create_connections_i", + error.c_str ()), + false); + } + break; + } } - } return true; } @@ -1385,12 +1490,19 @@ destroyApplication (ACE_ENV_SINGLE_ARG_DECL) entry->int_id_.node_application_->finishLaunch (connections.in (), - true, // "true" ==> start the components + true, // "true" ==> argument not used anymore false // "false" => remove connections ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - // To invoke operations on NodeManagers is the way to go. + } + + // After all the connections are removed, we actually destroy + for (CORBA::ULong i = 0; i < this->num_child_plans_; ++i) + { + ACE_Hash_Map_Entry *entry = 0; + + this->artifact_map_.find (this->node_manager_names_[i], entry); // Invoke destroyPlan() operation on the NodeManager Deployment::NodeManager_var @@ -1401,7 +1513,8 @@ destroyApplication (ACE_ENV_SINGLE_ARG_DECL) ACE_TRY_CHECK; } - // Invoke destroyManager () operation on the NodeManager, since we need + // ?? + // Shall we invoke destroyManager () operation on the NodeManager, since we need // to clean up all the NodeApplicationManagers associated with this deployment // plan (one NodeApplicationManager per Node per plan). diff --git a/TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.h b/TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.h index 070e7da80bf..9319754dd84 100644 --- a/TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.h +++ b/TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.h @@ -318,7 +318,7 @@ namespace CIAO bool is_getting_all_connections = true, bool is_search_new_plan = true, Connection_Search_Type t = Internal_Connections - ACE_ENV_ARG_DECL_WITH_DEFAULTS); + ACE_ENV_ARG_DECL_WITH_DEFAULTS); /// This is a helper function to find the connection for a component. bool @@ -326,7 +326,15 @@ namespace CIAO Deployment::Connections & retv, bool is_ReDAC, bool is_search_new_plan - ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((Deployment::StartError)); + + bool + populate_connection_for_binding ( + const char * instname, + const Deployment::PlanConnectionDescription & curr_conn, + const Deployment::DeploymentPlan & plan, + Deployment::Connections & retv) ACE_THROW_SPEC ((Deployment::StartError)); /// Dump connections, a static method @@ -340,6 +348,25 @@ namespace CIAO subtract_connections (const Deployment::Connections & left, const Deployment::Connections & right); + /** + * The first step in finish_launching an application in the + * domain-level. We install all the CIAO_Event_Service objects + * as specified in the DeploymentPlan. + * Internally, this operation will invoke an operation on each cached + * NodeApplication object. + */ + virtual void install_all_es (void) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::StartError)); + + /** + * Add all CIAO_Event_Service objects into the cached map. + */ + virtual void + add_es_to_map (Deployment::ESInstallationInfos * es_infos, + Deployment::CIAO_Event_Services * event_services) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::StartError)); protected: /// location of the Domainapplication CORBA::String_var domainapp_path_; @@ -394,6 +421,18 @@ namespace CIAO Chained_Artifacts_Table artifact_map_; + /// Cached information of all the CIAO_Event_Service objects within + /// the deployment plan + /// Key: the string identifier of the CIAO_Event_Service + /// Value: the object reference of the CIAO_Event_Service + typedef ACE_Hash_Map_Manager_Ex, + ACE_Equal_To, + ACE_Null_Mutex> Event_Service_Table; + + Event_Service_Table es_map_; + /// The deployment information data file. const char * deployment_file_; diff --git a/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.cpp b/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.cpp index 4f9ce7f9405..119f5b3a4fa 100644 --- a/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.cpp +++ b/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.cpp @@ -146,7 +146,7 @@ namespace CIAO ACE_TRY_CHECK; // What if we still have components running within this plan? - // + // (void) this->map_.unbind_dam (plan->UUID.in ()); // Where does the POA deactivate happen? @@ -205,7 +205,7 @@ namespace CIAO CORBA::ULong inst_lenth = plan->instance.length (); for (CORBA::ULong i = 0; i < inst_lenth; ++i) { - if (this->is_component_running (plan->instance[i].name.in (), + if (this->is_component_running (plan->instance[i].name.in (), plan_uuid)) return; } @@ -249,7 +249,7 @@ namespace CIAO ACE_CHECK; } - void + void Execution_Manager_Impl::perform_redeployment ( const Deployment::DeploymentPlan & plan ACE_ENV_ARG_DECL) @@ -263,7 +263,7 @@ namespace CIAO ::Components::RemoveFailure)) { CIAO_TRACE ("CIAO::Execution_Manager_Impl::perform_redeployment"); - + ACE_DEBUG ((LM_DEBUG, "CIAO (%P|%t) Dynamic Redeployment: " "invoked CIAO::Execution_Manager_Impl::perform_redeployment \n")); @@ -299,7 +299,7 @@ namespace CIAO ACE_CHECK; } - Deployment::DeploymentPlan * + Deployment::DeploymentPlan * Execution_Manager_Impl::getPlan (const char * plan_uuid ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((::CORBA::SystemException)) @@ -339,10 +339,10 @@ namespace CIAO ::CORBA::SystemException, ::Deployment::InvalidConnection)) { - ACE_DEBUG ((LM_ERROR, + ACE_DEBUG ((LM_ERROR, "Execution_Manage::finalizing global bindings.\n")); - // Find the NodeApplication hosting the component, and then call + // Find the NodeApplication hosting the component, and then call // on it ACE_TRY { @@ -376,7 +376,7 @@ namespace CIAO ACE_ENDTRY; } - Deployment::NodeApplication_ptr + Deployment::NodeApplication_ptr Execution_Manager_Impl:: find_node_application (const Component_Binding_Info & binding) ACE_THROW_SPEC (( @@ -399,7 +399,7 @@ namespace CIAO // Find the NA based on the NodeName field of the binding // This is a CORBA call on the DAM - Deployment::NodeApplication_var + Deployment::NodeApplication_var node_app = dam->get_node_app (binding.node_.c_str ()); if (CORBA::is_nil (node_app.in ())) @@ -414,14 +414,14 @@ namespace CIAO return node_app._retn (); } - void + void Execution_Manager_Impl:: add_shared_component (const Component_Binding_Info & comp) { this->shared_components_.insert (comp); } - void + void Execution_Manager_Impl:: remove_shared_component (const Component_Binding_Info & comp) { diff --git a/TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp b/TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp index bd5eee218e5..abd299dac1a 100644 --- a/TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp +++ b/TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.cpp @@ -71,10 +71,9 @@ CIAO::NodeApplication_Impl::finishLaunch ( this->finishLaunch_i (providedReference, start, add_connection); } -// if , then we shall remove connections. void CIAO::NodeApplication_Impl::finishLaunch_i ( - const Deployment::Connections & providedReference, + const Deployment::Connections & connections, CORBA::Boolean start, CORBA::Boolean add_connection ACE_ENV_ARG_DECL) @@ -86,12 +85,24 @@ CIAO::NodeApplication_Impl::finishLaunch_i ( ACE_TRY { - const CORBA::ULong length = providedReference.length (); + const CORBA::ULong length = connections.length (); // For every connection struct we finish the connection. for (CORBA::ULong i = 0; i < length; ++i) { - ACE_CString name = providedReference[i].instanceName.in (); + // For ES_to_Consumer connection, we simply call + // handle_es_consumer_connection method. + if (connections[i].kind == Deployment::rtecEventConsumer) + { + this->handle_es_consumer_connection ( + connections[i], + add_connection); + continue; + } + + // For other type of connections, we need to fetch the + // objref of the source component + ACE_CString name = connections[i].instanceName.in (); Component_State_Info comp_state; if (this->component_state_map_.find (name, comp_state) != 0) @@ -100,245 +111,50 @@ CIAO::NodeApplication_Impl::finishLaunch_i ( "CIAO (%P|%t) - NodeApplication_Impl.cpp, " "CIAO::NodeApplication_Impl::finishLaunch, " "invalid port name [%s] in instance [%s] \n", - providedReference[i].portName.in (), + connections[i].portName.in (), name.c_str ())); ACE_TRY_THROW (Deployment::InvalidConnection ()); } Components::CCMObject_var comp = comp_state.objref_; - Components::EventConsumerBase_var consumer; - - // Since we know CCMObject inherits from - // navigation/event/receptacle, no need - // to narrow here. - - switch (providedReference[i].kind) + switch (connections[i].kind) { - case Deployment::SimplexReceptacle: - case Deployment::MultiplexReceptacle: - - if (CIAO::debug_level () > 6) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::finishLaunch, " - "working on port name [%s] in instance [%s] \n", - providedReference[i].portName.in (), - name.c_str ())); - } - - if (add_connection) - { - ::Components::Cookie_var cookie = - comp->connect (providedReference[i].portName.in (), - providedReference[i].endpoint.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_CString key = (*create_connection_key (providedReference[i])); - ACE_DEBUG ((LM_ERROR, "[BINGDING KEY]: %s\n", key.c_str ())); - this->cookie_map_.rebind (key, cookie); - - if (CIAO::debug_level () > 6) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::finishLaunch\n" - "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] connected.\n", - providedReference[i].instanceName.in (), - providedReference[i].portName.in (), - providedReference[i].endpointInstanceName.in (), - providedReference[i].endpointPortName.in ())); - } - } - else - { - ACE_CString key = (*create_connection_key (providedReference[i])); - ::Components::Cookie_var cookie; - ACE_DEBUG ((LM_ERROR, "[FINDING KEY]: %s\n", key.c_str ())); - if (this->cookie_map_.find (key, cookie) != 0) - { - ACE_DEBUG ((LM_ERROR, "Error: Cookie Not Found!\n")); - ACE_TRY_THROW (Deployment::InvalidConnection ()); - } - - comp->disconnect (providedReference[i].portName.in (), - cookie.in ()); - this->cookie_map_.unbind (key); - if (CIAO::debug_level () > 6) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::finishLaunch\n" - "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] disconnected.\n", - providedReference[i].instanceName.in (), - providedReference[i].portName.in (), - providedReference[i].endpointInstanceName.in (), - providedReference[i].endpointPortName.in ())); - } - } - break; - - // @@ (GD) A place holder where the Event Channel connections - // should be set up. - - case Deployment::EventEmitter: - - consumer = Components::EventConsumerBase:: - _narrow (providedReference[i].endpoint.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (consumer.in ())) - { - ACE_ERROR ((LM_ERROR, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::finishLaunch, " - "for port name [%s] in instance [%s] ," - "there is an invalid endPoint. \n", - providedReference[i].portName.in (), - name.c_str ())); - ACE_TRY_THROW (Deployment::InvalidConnection ()); - } - - if (CIAO::debug_level () > 6) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::finishLaunch, " - "working on port name [%s] in instance [%s] \n", - providedReference[i].portName.in (), - name.c_str ())); - } - - if (add_connection) - { - comp->connect_consumer (providedReference[i].portName.in (), - consumer.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CIAO::debug_level () > 6) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::finishLaunch\n" - "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] connected.\n", - providedReference[i].instanceName.in (), - providedReference[i].portName.in (), - providedReference[i].endpointInstanceName.in (), - providedReference[i].endpointPortName.in ())); - } - } - else - { -// Operation not implemented by the CIDLC. -// comp->disconnect_consumer (providedReference[i].portName.in (), -// 0 -// ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CIAO::debug_level () > 6) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::finishLaunch\n" - "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] disconnected.\n", - providedReference[i].instanceName.in (), - providedReference[i].portName.in (), - providedReference[i].endpointInstanceName.in (), - providedReference[i].endpointPortName.in ())); - } - } - break; - - case Deployment::EventPublisher: - - consumer = Components::EventConsumerBase:: - _narrow (providedReference[i].endpoint.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - if (CORBA::is_nil (consumer.in ())) - { - ACE_ERROR ((LM_ERROR, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::finishLaunch, " - "for port name [%s] in instance [%s] ," - "there is an invalid endPoint. \n", - providedReference[i].portName.in (), - name.c_str ())); - ACE_TRY_THROW (Deployment::InvalidConnection ()); - } - - if (CIAO::debug_level () > 6) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::finishLaunch, " - "working on port name [%s] in instance [%s] \n", - providedReference[i].portName.in (), - name.c_str ())); - } - - if (add_connection) - { - ::Components::Cookie_var cookie = - comp->subscribe (providedReference[i].portName.in (), - consumer.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_CString key = (*create_connection_key (providedReference[i])); - this->cookie_map_.rebind (key, cookie); - ACE_DEBUG ((LM_ERROR, "[BINGDING KEY]: %s\n", key.c_str ())); - - if (CIAO::debug_level () > 6) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::finishLaunch\n" - "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] connected.\n", - providedReference[i].instanceName.in (), - providedReference[i].portName.in (), - providedReference[i].endpointInstanceName.in (), - providedReference[i].endpointPortName.in ())); - } - } - else - { - ACE_CString key = (*create_connection_key (providedReference[i])); - ::Components::Cookie_var cookie; - ACE_DEBUG ((LM_ERROR, "[FINDING KEY]: %s\n", key.c_str ())); - if (this->cookie_map_.find (key, cookie) != 0) - { - ACE_DEBUG ((LM_ERROR, "Error: Cookie Not Found!\n")); - ACE_TRY_THROW (Deployment::InvalidConnection ()); - } - - comp->unsubscribe (providedReference[i].portName.in (), - cookie.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - this->cookie_map_.unbind (key); - - if (CIAO::debug_level () > 6) - { - ACE_DEBUG ((LM_DEBUG, - "CIAO (%P|%t) - NodeApplication_Impl.cpp, " - "CIAO::NodeApplication_Impl::finishLaunch\n" - "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] disconnected.\n", - providedReference[i].instanceName.in (), - providedReference[i].portName.in (), - providedReference[i].endpointInstanceName.in (), - providedReference[i].endpointPortName.in ())); - } - } - break; - - default: - ACE_TRY_THROW (Deployment::InvalidConnection ()); + case Deployment::SimplexReceptacle: + case Deployment::MultiplexReceptacle: + this->handle_facet_receptable_connection ( + comp.in (), + connections[i], + add_connection); + break; + + case Deployment::EventEmitter: + this->handle_emitter_consumer_connection ( + comp.in (), + connections[i], + add_connection); + break; + + case Deployment::EventPublisher: + this->handle_publisher_consumer_connection ( + comp.in (), + connections[i], + add_connection); + break; + + case Deployment::rtecEventPublisher: + this->handle_publisher_es_connection ( + comp.in (), + connections[i], + add_connection); + break; + + default: + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::finishLaunch_i: " + "Unsupported event port type encounted\n")); + ACE_TRY_THROW (CORBA::NO_IMPLEMENT ()); } } } @@ -467,7 +283,6 @@ CIAO::NodeApplication_Impl::install ( "creating all the containers. \n")); } - CORBA::ULong old_set_size = this->container_set_.size (); (void) this->create_all_containers (container_infos); @@ -711,6 +526,36 @@ CIAO::NodeApplication_Impl::get_containers (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) return 0; } +::Deployment::CIAO_Event_Services * +CIAO::NodeApplication_Impl:: +install_es (const ::Deployment::ESInstallationInfos & es_infos + ACE_ENV_ARG_DECL) +ACE_THROW_SPEC ((::CORBA::SystemException, + ::Deployment::InstallationFailure)) +{ + Deployment::CIAO_Event_Services_var retv; + ACE_NEW_RETURN (retv, + Deployment::CIAO_Event_Services, + 0); + + CORBA::ULong total_lenth = es_infos.length (); + + for (CORBA::ULong i = 0; i < total_lenth; ++i) + { + CIAO_Event_Service_var temp = + //es_factory_.create (CIAO::DIRECT); + es_factory_.create (es_infos[i].type); + + CORBA::ULong curr_len = retv->length (); + retv->length (curr_len + 1); + + retv[curr_len] = + CIAO::CIAO_Event_Service::_duplicate (temp.in ()); + } + return retv._retn (); +} + + ACE_CString * CIAO::NodeApplication_Impl:: create_connection_key (const Deployment::Connection & connection) @@ -725,3 +570,481 @@ create_connection_key (const Deployment::Connection & connection) ACE_DEBUG ((LM_ERROR, "The key is: %s\n", (*retv).c_str ())); return retv; } + + +void +CIAO::NodeApplication_Impl:: +handle_facet_receptable_connection ( + Components::CCMObject_ptr comp, + const Deployment::Connection & connection, + CORBA::Boolean add_connection) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::InvalidConnection)) +{ + if (CIAO::debug_level () > 6) + { + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::finishLaunch, " + "working on port name [%s] in instance [%s] \n", + connection.portName.in (), + connection.instanceName.in ())); + } + + if (add_connection) + { + ::Components::Cookie_var cookie = + comp->connect (connection.portName.in (), + connection.endpoint.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_CString key = (*create_connection_key (connection)); + ACE_DEBUG ((LM_ERROR, "[BINDING KEY]: %s\n", key.c_str ())); + this->cookie_map_.rebind (key, cookie); + + if (CIAO::debug_level () > 6) + { + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::finishLaunch\n" + "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] connected.\n", + connection.instanceName.in (), + connection.portName.in (), + connection.endpointInstanceName.in (), + connection.endpointPortName.in ())); + } + } + else + { + ACE_CString key = (*create_connection_key (connection)); + ::Components::Cookie_var cookie; + ACE_DEBUG ((LM_ERROR, "[FINDING KEY]: %s\n", key.c_str ())); + if (this->cookie_map_.find (key, cookie) != 0) + { + ACE_DEBUG ((LM_ERROR, "Error: Cookie Not Found!\n")); + ACE_TRY_THROW (Deployment::InvalidConnection ()); + } + + comp->disconnect (connection.portName.in (), + cookie.in ()); + this->cookie_map_.unbind (key); + if (CIAO::debug_level () > 6) + { + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::finishLaunch\n" + "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] disconnected.\n", + connection.instanceName.in (), + connection.portName.in (), + connection.endpointInstanceName.in (), + connection.endpointPortName.in ())); + } + } +} + + +void +CIAO::NodeApplication_Impl:: +handle_emitter_consumer_connection ( + Components::CCMObject_ptr comp, + const Deployment::Connection & connection, + CORBA::Boolean add_connection) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::InvalidConnection)) +{ + Components::EventConsumerBase_var consumer = + Components::EventConsumerBase::_narrow (connection.endpoint.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (consumer.in ())) + { + ACE_ERROR ((LM_ERROR, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::handle_emitter_consumer_connection, " + "for port name [%s] in instance [%s] ," + "there is an invalid endPoint. \n", + connection.portName.in (), + connection.instanceName.in ())); + ACE_TRY_THROW (Deployment::InvalidConnection ()); + } + + if (CIAO::debug_level () > 6) + { + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::handle_emitter_consumer_connection, " + "working on port name [%s] in instance [%s] \n", + connection.portName.in (), + connection.instanceName.in ())); + } + + if (add_connection) + { + comp->connect_consumer (connection.portName.in (), + consumer.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CIAO::debug_level () > 6) + { + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::handle_emitter_consumer_connection\n" + "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] connected.\n", + connection.instanceName.in (), + connection.portName.in (), + connection.endpointInstanceName.in (), + connection.endpointPortName.in ())); + } + } + else + { +// Operation not implemented by the CIDLC. +// comp->disconnect_consumer (connection.portName.in (), +// 0 +// ACE_ENV_ARG_PARAMETER); +// ACE_TRY_CHECK; + + if (CIAO::debug_level () > 6) + { + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::handle_emitter_consumer_connection\n" + "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] disconnected.\n", + connection.instanceName.in (), + connection.portName.in (), + connection.endpointInstanceName.in (), + connection.endpointPortName.in ())); + } + } +} + + +void +CIAO::NodeApplication_Impl:: +handle_publisher_consumer_connection ( + Components::CCMObject_ptr comp, + const Deployment::Connection & connection, + CORBA::Boolean add_connection) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::InvalidConnection)) +{ + Components::EventConsumerBase_var consumer = + Components::EventConsumerBase::_narrow (connection.endpoint.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (consumer.in ())) + { + ACE_ERROR ((LM_ERROR, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::handle_publisher_consumer_connection, " + "for port name [%s] in instance [%s] ," + "there is an invalid endPoint. \n", + connection.portName.in (), + connection.instanceName.in ())); + ACE_TRY_THROW (Deployment::InvalidConnection ()); + } + + if (CIAO::debug_level () > 6) + { + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::handle_publisher_consumer_connection, " + "working on port name [%s] in instance [%s] \n", + connection.portName.in (), + connection.instanceName.in ())); + } + + if (add_connection) + { + ::Components::Cookie_var cookie = + comp->subscribe (connection.portName.in (), + consumer.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_CString key = (*create_connection_key (connection)); + this->cookie_map_.rebind (key, cookie); + ACE_DEBUG ((LM_ERROR, "[BINDING KEY]: %s\n", key.c_str ())); + + if (CIAO::debug_level () > 6) + { + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::handle_publisher_consumer_connection\n" + "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] connected.\n", + connection.instanceName.in (), + connection.portName.in (), + connection.endpointInstanceName.in (), + connection.endpointPortName.in ())); + } + } + else // remove the connection + { + ACE_CString key = (*create_connection_key (connection)); + ::Components::Cookie_var cookie; + ACE_DEBUG ((LM_ERROR, "[FINDING KEY]: %s\n", key.c_str ())); + if (this->cookie_map_.find (key, cookie) != 0) + { + ACE_DEBUG ((LM_ERROR, "Error: Cookie Not Found!\n")); + ACE_TRY_THROW (Deployment::InvalidConnection ()); + } + + comp->unsubscribe (connection.portName.in (), + cookie.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + this->cookie_map_.unbind (key); + + if (CIAO::debug_level () > 6) + { + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::handle_publisher_consumer_connection\n" + "[INSTANCE:PORT] : [%s:%s] --> [%s:%s] disconnected.\n", + connection.instanceName.in (), + connection.portName.in (), + connection.endpointInstanceName.in (), + connection.endpointPortName.in ())); + } + } +} + + +void +CIAO::NodeApplication_Impl:: +handle_publisher_es_connection ( + Components::CCMObject_ptr comp, + const Deployment::Connection & connection, + CORBA::Boolean add_connection) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::InvalidConnection)) +{ + if (connection.type != CIAO::RTEC) + { + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::handle_publisher_es_connection: " + "Unsupported event connection type\n")); + ACE_THROW (CORBA::NO_IMPLEMENT ()); + } + + const CIAO::CIAO_Event_Service_ptr event_service = + connection.event_service; + + if (CORBA::is_nil (event_service)) + { + ACE_DEBUG ((LM_DEBUG, "Nil event_service\n")); + ACE_THROW (Deployment::InvalidConnection ()); + } + + // supplier ID + ACE_CString sid (connection.instanceName.in ()); + sid += "_"; + sid += connection.portName.in (); + sid += "_publisher"; + + if (add_connection) + { + // Cache the ES into component servant + comp->ciao_connect_es (connection.portName.in (), + event_service); + + // Create a supplier_config and register it to ES + CIAO::Supplier_Config_var supplier_config = + event_service->create_supplier_config (); + + supplier_config->supplier_id (sid.c_str ()); + event_service->connect_event_supplier (supplier_config.in ()); + supplier_config->destroy (); + } + else // remove the connection + { + // @@@ + // comp->ciao_disconnect_es (connection.portName.in (), + // event_service); + event_service->disconnect_event_supplier (sid.c_str ()); + } +} + + +void +CIAO::NodeApplication_Impl:: +handle_es_consumer_connection ( + const Deployment::Connection & connection, + CORBA::Boolean add_connection) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::InvalidConnection)) +{ + if (connection.type != CIAO::RTEC) + { + ACE_DEBUG ((LM_DEBUG, + "CIAO (%P|%t) - NodeApplication_Impl.cpp, " + "CIAO::NodeApplication_Impl::handle_es_consumer_connection: " + "Unsupported event connection type\n")); + ACE_THROW (CORBA::NO_IMPLEMENT ()); + } + + // Get ES object + const CIAO::CIAO_Event_Service_ptr event_service = + connection.event_service; + + if (CORBA::is_nil (event_service)) + { + ACE_DEBUG ((LM_DEBUG, "Nil event_service\n")); + ACE_THROW (Deployment::InvalidConnection ()); + } + + // Get consumer object + Components::EventConsumerBase_var consumer = + Components::EventConsumerBase::_narrow (connection.endpoint.in ()); + + if (CORBA::is_nil (consumer.in ())) + { + ACE_DEBUG ((LM_DEBUG, "Nil consumer port object reference\n")); + ACE_THROW (Deployment::InvalidConnection ()); + } + + // supplier ID + ACE_CString sid (connection.instanceName.in ()); + sid += "_"; + sid += connection.portName.in (); + sid += "_publisher"; + + // consumer ID + ACE_CString cid (connection.endpointInstanceName.in ()); + cid += "_"; + cid += connection.endpointPortName.in (); + cid += "_consumer"; + + if (add_connection) + { + CIAO::Consumer_Config_var consumer_config = + event_service->create_consumer_config (); + + //consumer_config->supplier_id ("dummy"); + consumer_config->supplier_id (sid.c_str ()); + consumer_config->consumer_id (cid.c_str ()); + consumer_config->consumer (consumer.in ()); + + event_service->connect_event_consumer (consumer_config.in ()); + consumer_config->destroy (); + } + else // remove the connection + { + event_service->disconnect_event_consumer (cid.c_str ()); + } +} + +void +CIAO::NodeApplication_Impl::build_event_connection ( + const Deployment::Connection & connection, + bool add_or_remove + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((Deployment::InvalidConnection, + CORBA::SystemException)) +{ + ACE_DEBUG ((LM_DEBUG, "CIAO::NodeApplication_Impl::build_connection ()!!!\n")); + + ACE_DEBUG ((LM_DEBUG, "instanceName: %s\n", connection.instanceName.in ())); + ACE_DEBUG ((LM_DEBUG, "portName: %s\n", connection.portName.in ())); + + ACE_DEBUG ((LM_DEBUG, "consumer Component Name: %s\n", connection.endpointInstanceName.in ())); + ACE_DEBUG ((LM_DEBUG, "consumer Port Name: %s\n", connection.endpointPortName.in ())); + + ACE_DEBUG ((LM_DEBUG, "portkind: ")); + switch (connection.kind) { + case Deployment::Facet: ACE_DEBUG ((LM_DEBUG, "Facet\n")); break; + case Deployment::SimplexReceptacle: ACE_DEBUG ((LM_DEBUG, "SimplexReceptacle\n")); break; + case Deployment::MultiplexReceptacle: ACE_DEBUG ((LM_DEBUG, "MultiplexReceptacle\n")); break; + case Deployment::EventEmitter: ACE_DEBUG ((LM_DEBUG, "EventEmitter\n")); break; + case Deployment::EventPublisher: ACE_DEBUG ((LM_DEBUG, "EventPublisher\n")); break; + case Deployment::EventConsumer: ACE_DEBUG ((LM_DEBUG, "EventConsumer\n")); break; + } + + const CIAO::CIAO_Event_Service_ptr event_service = + connection.event_service; + + + // Get the consumer port object reference and put it into "consumer" + Components::EventConsumerBase_var consumer = + Components::EventConsumerBase::_narrow (connection.endpoint.in () + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + if (CORBA::is_nil (consumer.in ())) + { + ACE_DEBUG ((LM_DEBUG, "Nil consumer port object reference\n")); + ACE_THROW (Deployment::InvalidConnection ()); + } + + // Get the supplier component object reference. + ACE_CString supplier_comp_name = connection.instanceName.in (); + + ACE_DEBUG ((LM_DEBUG, "source component name is: %s\n", supplier_comp_name.c_str ())); + Component_State_Info comp_state; + if (this->component_state_map_.find (supplier_comp_name, comp_state) != 0) + { + ACE_DEBUG ((LM_DEBUG, "Nil source component object reference\n")); + ACE_THROW (Deployment::InvalidConnection ()); + } + + // Get the consumer component object reference. + ACE_CString consumer_comp_name = connection.endpointInstanceName.in (); + + ACE_DEBUG ((LM_DEBUG, "consumer component name is: %s\n", consumer_comp_name.c_str ())); + + if (CORBA::is_nil (event_service)) + { + ACE_DEBUG ((LM_DEBUG, "Nil event_service\n")); + ACE_THROW (Deployment::InvalidConnection ()); + } + + // supplier ID + ACE_CString sid (connection.instanceName.in ()); + sid += "_"; + sid += connection.portName.in (); + sid += "_publisher"; + + // consumer ID + ACE_CString cid (connection.endpointInstanceName.in ()); + cid += "_"; + cid += connection.endpointPortName.in (); + cid += "_consumer"; + + //ACE_DEBUG ((LM_DEBUG, "Publisher: %s\n", sid.c_str ())); + ACE_DEBUG ((LM_DEBUG, "Subscriber: %s\n", cid.c_str ())); + + + if (add_or_remove == true) + { + CIAO::Supplier_Config_var supplier_config = + event_service->create_supplier_config (); + + //supplier_config->supplier_id (sid.c_str ()); + event_service->connect_event_supplier (supplier_config.in ()); + supplier_config->destroy (); + + CIAO::Consumer_Config_var consumer_config = + event_service->create_consumer_config (); + + //@@@ + consumer_config->supplier_id ("dummy"); + consumer_config->consumer_id (cid.c_str ()); + consumer_config->consumer (consumer.in ()); + + event_service->connect_event_consumer (consumer_config.in ()); + + consumer_config->destroy (); + } + else + { + event_service->disconnect_event_supplier (sid.c_str ()); + event_service->disconnect_event_consumer (cid.c_str ()); + } + + ACE_DEBUG ((LM_DEBUG, "CIAO::NodeApplication_Impl::build_connection () completed!!!!\n")); +} diff --git a/TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.h b/TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.h index 8ca1f415cab..b59209ccb7e 100644 --- a/TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.h +++ b/TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.h @@ -20,15 +20,18 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ciao/Deployment_CoreS.h" -#include "ciao/Server_init.h" -#include "ciao/CIAO_common.h" -#include "ciao/Object_Set_T.h" -#include "tao/ORB.h" #include "ace/Synch.h" #include "ace/Synch_Traits.h" #include "ace/SString.h" #include "ace/Hash_Map_Manager_T.h" +#include "tao/ORB.h" +#include "ciao/Deployment_CoreS.h" +#include "ciao/Server_init.h" +#include "ciao/CIAO_common.h" +#include "ciao/Object_Set_T.h" +#include "ciaosvcs/Events/CIAO_EventService_Factory_impl.h" +#include "ciaosvcs/Events/CIAO_EventsS.h" + #include "NodeApp_Configurator.h" #include "Container_Base.h" @@ -94,7 +97,7 @@ namespace CIAO * However the name field stores the name of the port on the local component. */ virtual void - finishLaunch (const Deployment::Connections & providedReference, + finishLaunch (const Deployment::Connections & connections, CORBA::Boolean start, CORBA::Boolean add_connection ACE_ENV_ARG_DECL_WITH_DEFAULTS) @@ -152,6 +155,13 @@ namespace CIAO ::Deployment::InstallationFailure, ::Components::InvalidConfiguration)); + /// Install a number of CIAO_Event_Service objects within the NA + virtual ::Deployment::CIAO_Event_Services * + install_es (const ::Deployment::ESInstallationInfos & es_infos + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((::CORBA::SystemException, + ::Deployment::InstallationFailure)); + /// Get the object reference of the NodeApplicationManager. /// This might come in handy later. virtual ::CORBA::Object_ptr @@ -205,9 +215,28 @@ namespace CIAO ::Deployment::NodeApplication_ptr get_objref (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS); + /*------- CIAO helper functions for pub/sub service ------/* + * + *--------------------------------------------------------*/ + + /// Set up a connection using the CIAO_Event_Service, which + /// is available as a field in the + /// struct type. + /// If input parameter is true, then we will + /// add the event connection, otherwise we will remove the + /// event connection. + void build_event_connection ( + const Deployment::Connection & connection, + bool add_or_remove + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((Deployment::InvalidConnection, + CORBA::SystemException)); + protected: + /// If is "false", then we shall "remove" + /// the connections, otherwise we will add these connections. virtual void - finishLaunch_i (const Deployment::Connections & providedReference, + finishLaunch_i (const Deployment::Connections & connections, CORBA::Boolean start, CORBA::Boolean add_connection ACE_ENV_ARG_DECL_WITH_DEFAULTS) @@ -215,6 +244,49 @@ namespace CIAO Deployment::StartError, Deployment::InvalidConnection)); + virtual void + handle_facet_receptable_connection ( + Components::CCMObject_ptr comp, + const Deployment::Connection & connection, + CORBA::Boolean add_connection) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::InvalidConnection)); + + virtual void + handle_emitter_consumer_connection ( + Components::CCMObject_ptr comp, + const Deployment::Connection & connection, + CORBA::Boolean add_connection) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::InvalidConnection)); + + virtual void + handle_publisher_consumer_connection ( + Components::CCMObject_ptr comp, + const Deployment::Connection & connection, + CORBA::Boolean add_connection) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::InvalidConnection)); + + /// Register the publisher to the CIAO event service + /// The only fields of struct used in this method + /// are: , , , . + virtual void + handle_publisher_es_connection ( + Components::CCMObject_ptr comp, + const Deployment::Connection & connection, + CORBA::Boolean add_connection) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::InvalidConnection)); + + /// Register the consumer to the CIAO event service + virtual void + handle_es_consumer_connection ( + const Deployment::Connection & connection, + CORBA::Boolean add_connection) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::InvalidConnection)); + /// Create and initialize all the containers virtual CORBA::Long create_all_containers ( const ::Deployment::ContainerImplementationInfos & container_infos @@ -235,7 +307,8 @@ namespace CIAO Component_Container_Map component_container_map_; - /// To store all created Component object as well as their state. + /// To store all created Component objects as well as their lifecycle + /// states.. typedef ACE_Hash_Map_Manager_Ex, @@ -280,6 +353,9 @@ namespace CIAO /// Cache the object reference (of ourselves). ::Deployment::NodeApplication_var objref_; + /// A factory to create CIAO event services + EventService_Factory_impl es_factory_; + const Static_Config_EntryPoints_Maps* static_entrypts_maps_; private: /// Default constructor, noop diff --git a/TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.inl b/TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.inl index 49e9881ac54..b041af3b9f1 100644 --- a/TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.inl +++ b/TAO/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.inl @@ -13,6 +13,7 @@ NodeApplication_Impl (CORBA::ORB_ptr o, : orb_ (CORBA::ORB::_duplicate (o)), poa_ (PortableServer::POA::_duplicate (p)), configurator_ (c), + es_factory_ (o, p), static_entrypts_maps_ (static_entrypts_maps) { } diff --git a/TAO/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.cpp b/TAO/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.cpp index 33e712f19e5..22d14b1d2b2 100644 --- a/TAO/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.cpp +++ b/TAO/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.cpp @@ -2,6 +2,8 @@ #include "NodeApplicationManager_Impl.h" #include "ace/Process.h" +#include "ace/Process_Manager.h" +#include "ace/Reactor.h" #include "ace/OS_NS_stdio.h" #include "ace/Vector_T.h" #include "ciao/Container_Base.h" @@ -759,8 +761,10 @@ create_node_application (const ACE_CString & options ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (Deployment::NodeApplication::_nil()); - ACE_Process node_application; ACE_Process_Options p_options; + ACE_Process_Manager process_manager; + + process_manager.open (10, ACE_Reactor::instance ()); ACE_TRY { @@ -788,7 +792,7 @@ create_node_application (const ACE_CString & options p_options.avoid_zombies (1); - if (node_application.spawn (p_options) == -1) + if (process_manager.spawn (p_options) == -1) { if (CIAO::debug_level () > 1) { @@ -807,8 +811,7 @@ create_node_application (const ACE_CString & options // wait for nodeApp to pass back its object reference. with a // timeout value. using perform_work and stuff. - - int looping = 1; + bool looping = true; ACE_Time_Value timeout (this->spawn_delay_, 0); @@ -821,7 +824,7 @@ create_node_application (const ACE_CString & options retval = callback_servant->get_nodeapp_ref (); if (timeout == ACE_Time_Value::zero || !CORBA::is_nil (retval.in ())) - looping = 0; + looping = false; } if (CORBA::is_nil (retval.in ())) diff --git a/TAO/CIAO/ciao/CCM_Core.mpc b/TAO/CIAO/ciao/CCM_Core.mpc index c55a290a111..1b48e2f80a4 100644 --- a/TAO/CIAO/ciao/CCM_Core.mpc +++ b/TAO/CIAO/ciao/CCM_Core.mpc @@ -76,10 +76,10 @@ project(Deployment_stub) : taolib_with_idl, valuetype, ifr_client { sharedname = CIAO_Deployment_stub after += CIAO_DnC_Client - libs += CIAO_DnC_Client + libs += CIAO_DnC_Client CIAO_DnC_Events // This is necessary for MPC to pull in rules.ciao.GNU - includes += $(CIAO_ROOT)/DAnCE + includes += $(CIAO_ROOT)/DAnCE $(CIAO_ROOT) idlflags += -Wb,stub_export_macro=Deployment_stub_Export idlflags += -Wb,stub_export_include=Deployment_stub_export.h @@ -127,14 +127,14 @@ project(Deployment_svnt) : taolib_with_idl, portableserver, valuetype, ifr_clien after += Deployment_stub sharedname = CIAO_Deployment_svnt dynamicflags = DEPLOYMENT_SVNT_BUILD_DLL - libs += CIAO_Deployment_stub CIAO_DnC_Client + libs += CIAO_Deployment_stub CIAO_DnC_Client CIAO_DnC_Events idlflags += -Wb,stub_export_macro=Deployment_stub_Export idlflags += -Wb,stub_export_include=Deployment_stub_export.h idlflags += -Wb,skel_export_macro=Deployment_svnt_Export idlflags += -Wb,skel_export_include=Deployment_svnt_export.h // This is necessary for MPC to pull in rules.ciao.GNU - includes += $(CIAO_ROOT)/DAnCE + includes += $(CIAO_ROOT)/DAnCE $(CIAO_ROOT) IDL_Files { } diff --git a/TAO/CIAO/ciao/CCM_Event.idl b/TAO/CIAO/ciao/CCM_Event.idl index 575220a0283..6f322c55690 100644 --- a/TAO/CIAO/ciao/CCM_Event.idl +++ b/TAO/CIAO/ciao/CCM_Event.idl @@ -27,7 +27,7 @@ module Components interface EventConsumerBase { void push_event (in EventBase evt) raises (BadEventType); - + // CIAO-specific operation to help support the capability // to subscribe to eventtypes more derived than the type // consumed. @@ -76,6 +76,25 @@ module Components raises (InvalidName, InvalidConnection); + // CIAO specific operations to connect a component to + // CIAO_Event_Service + // We have to use generic "Object" interface instead of the + // CIAO_Event_Service interface type, since CIAO_Event_Service + // relies on EventConsumerBase defined within this file, which + // causes circular dependencies. -Gan + Cookie ciao_connect_es (in FeatureName publisher_name, + in Object es) + raises (InvalidName, + AlreadyConnected, + InvalidConnection, + ExceededConnectionLimit); + + //Object + //ciao_disconnect_es (in FeatureName publisher_name, + // in Cookie ck) + // raises (InvalidName, + // InvalidConnection); + void connect_consumer (in FeatureName emitter_name, in EventConsumerBase consumer) raises (InvalidName, diff --git a/TAO/CIAO/ciao/Container_Base.cpp b/TAO/CIAO/ciao/Container_Base.cpp index 56a0e4d6fb7..1a2be113863 100644 --- a/TAO/CIAO/ciao/Container_Base.cpp +++ b/TAO/CIAO/ciao/Container_Base.cpp @@ -6,7 +6,6 @@ #include "tao/Utils/PolicyList_Destroyer.h" #include "ace/OS_NS_stdio.h" #include "Servant_Activator.h" -#include "ace/SString.h" #if !defined (__ACE_INLINE__) # include "Container_Base.inl" @@ -14,8 +13,7 @@ namespace CIAO { - -//////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////// Container::Container (CORBA::ORB_ptr o) : orb_ (CORBA::ORB::_duplicate (o)), @@ -325,7 +323,7 @@ namespace CIAO ACE_THROW_RETURN (Deployment::UnknownImplId ( "Session_Container::ciao_install_home", - exception.c_str ()), + exception.c_str ()), Components::CCMHome::_nil ()); } @@ -627,16 +625,6 @@ namespace CIAO PortableServer::ObjectId_var oid = PortableServer::string_to_ObjectId (obj_id); - CORBA::String_var str = - PortableServer::ObjectId_to_string (oid.in ()); - - if (t == Container::Facet_Consumer) - { - //if (CIAO::debug_level () > 9) - // ACE_DEBUG ((LM_DEBUG, "STRING in container is %s\n", - // str.in ())); - } - CORBA::Object_var objref = tmp->create_reference_with_id (oid.in (), repo_id diff --git a/TAO/CIAO/ciao/Container_Base.h b/TAO/CIAO/ciao/Container_Base.h index d791aae6b21..cbde8a4d6c0 100644 --- a/TAO/CIAO/ciao/Container_Base.h +++ b/TAO/CIAO/ciao/Container_Base.h @@ -9,6 +9,7 @@ * Header file for CIAO's container implementations * * @author Nanbor Wang + * @author Gan Deng */ //============================================================================= @@ -29,7 +30,6 @@ #include "ace/Hash_Map_Manager_T.h" - #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ @@ -118,6 +118,7 @@ namespace CIAO ACE_THROW_SPEC ((CORBA::SystemException)) = 0; protected: + /// Reference to the ORB CORBA::ORB_var orb_; /// POA within which all the components in this container will be @@ -131,6 +132,7 @@ namespace CIAO * are distinct from the component. */ PortableServer::POA_var facet_cons_poa_; + PortableServer::POA_var home_servant_poa_; Container_Impl *container_impl_; private: diff --git a/TAO/CIAO/ciao/Deployment_Core.idl b/TAO/CIAO/ciao/Deployment_Core.idl index 831b41752cd..38e27231d64 100644 --- a/TAO/CIAO/ciao/Deployment_Core.idl +++ b/TAO/CIAO/ciao/Deployment_Core.idl @@ -4,6 +4,7 @@ #define DEPLOYMENT_CORE_IDL #include "CCM_Component.idl" +#include // *************** Packaging and Deployment *************** module Deployment @@ -97,6 +98,12 @@ module Deployment // the endpoints member is change to endpoint. // Since we will not have more than 1 objref in there. Object endpoint; + + // A wrapper facade interface to provision different event + // communication mechanisms, including RTEC, etc. + CIAO::CIAO_Event_Service event_service; + + CIAO::EventServiceType type; }; typedef sequence < Connection > Connections; @@ -205,6 +212,20 @@ module Deployment }; typedef sequence Containers; + typedef sequence CIAO_Event_Services; + + /// CIAO specific extension + /// This struct captures the installation information of a particular + /// CIAO_Event_Service, as defined in + struct ESInstallationInfo + { + string id; + CIAO::EventServiceType type; + Properties es_config; + }; + + /// CIAO specific extension + typedef sequence ESInstallationInfos; interface NodeApplication : Application { @@ -227,45 +248,52 @@ module Deployment ::Components::InvalidConfiguration, ::Components::RemoveFailure); + /// CIAO specific extension + /// This operation will create one or more CIAO_Event_Service objects + /// within the NodeApplication, which will be used to mediate the + /// communication of CCM events + CIAO_Event_Services install_es (in ESInstallationInfos es_infos) + raises (InstallationFailure); + /// CIAO specific extensions ///@@ We know that Deployment::NodeApplicationManager will be returned, /// however to avoid the size of the shared object of CIAO_Server. /// we return an Object. Object get_node_application_manager (); - /// CIAO specific extensions + /// CIAO specific extension Container create_container (in ::Deployment::Properties properties) raises (::Components::CreateFailure, ::Components::InvalidConfiguration); - /// CIAO specific extensions + /// CIAO specific extension void remove_container (in Container cref) raises (::Components::RemoveFailure); - /// CIAO specific extensions + /// CIAO specific extension Containers get_containers (); - /// CIAO specific extensions + /// CIAO specific extension /// Remove a component instance from the NodeApplication void remove_component (in string inst_name) raises (::Components::RemoveFailure); - /// CIAO specific extensions + /// CIAO specific extension /// Remove all containers, components and component homes. /// Shuts down the ORB of the NodeApplication to terminate the process. oneway void remove (); - /// CIAO specific extensions. This will enforce the component to + /// CIAO specific extension. This will enforce the component to /// be activated (preactivate, activate, postactivated) before the assembly /// is established void ciao_preactivate () raises (StartError); - /// CIAO specific extensions + /// CIAO specific extension void ciao_postactivate () raises (StartError); - /// CIAO specific extensions + /// CIAO specific extension void ciao_passivate () raises (StopError); }; diff --git a/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent.cpp b/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent.cpp index 016cb449faf..fd9db749e41 100644 --- a/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent.cpp +++ b/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent.cpp @@ -4,7 +4,6 @@ namespace CIAO { - DirectEventService::DirectEventService ( CORBA::ORB_ptr orb, PortableServer::POA_ptr poa) @@ -13,6 +12,34 @@ namespace CIAO { } + Supplier_Config_ptr + DirectEventService::create_supplier_config (void) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + 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 (); + } + + Consumer_Config_ptr + DirectEventService::create_consumer_config (void) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + 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 (); + } + void DirectEventService::connect_event_supplier ( Supplier_Config_ptr supplier_config @@ -32,13 +59,19 @@ namespace CIAO consumer_config->consumer (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; + //@@@ Needs some reference counting logic here, since we really + // don't want an EventConsumerBase object to be cached more + // than once. We could use two ACE_Hash_Manager_Maps, one to + // cache the object reference, and the other one keeps track of + // the reference count of each object. + this->consumer_array_.size (this->consumer_array_.size () + 1); this->consumer_array_.set (Components::EventConsumerBase::_duplicate (consumer.in ()), this->consumer_array_.size () - 1); - } + // @@ Need to implement this logic. void DirectEventService::disconnect_event_consumer ( const char * connection_id @@ -48,11 +81,16 @@ namespace CIAO Components::InvalidName, Components::InvalidConnection)) { + // The connection_id is used to find the event consumer object + ACE_DEBUG ((LM_DEBUG, + "Direct_Consumer_Config_impl::disconnect_event_consumer() of ID [%s]\n", + connection_id)); } void DirectEventService::disconnect_event_supplier ( - ACE_ENV_SINGLE_ARG_DECL) + const char * connection_id + ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException, Components::InvalidName, @@ -220,5 +258,4 @@ namespace CIAO 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 index 7ae8a8d916a..a09e0cb73a2 100644 --- a/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent.h +++ b/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent.h @@ -6,8 +6,8 @@ * * $Id$ * - * @author George Edwards * @author Gan Deng + * @author George Edwards */ //============================================================================= @@ -31,14 +31,21 @@ namespace CIAO * * An implementation of EventServiceBase using direct communication. */ - class CIAO_EVENTS_Export DirectEventService : + class CIAO_DIRECTEVENT_Export DirectEventService : public virtual EventServiceBase { public: - DirectEventService (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa); + virtual Supplier_Config_ptr + create_supplier_config (void) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual Consumer_Config_ptr + create_consumer_config (void) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual void connect_event_supplier ( Supplier_Config_ptr supplier_config @@ -53,8 +60,8 @@ namespace CIAO CORBA::SystemException)); virtual void - disconnect_event_consumer ( - const char * connection_id + disconnect_event_supplier ( + const char * consumer_id ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC (( CORBA::SystemException, @@ -62,8 +69,9 @@ namespace CIAO Components::InvalidConnection)); virtual void - disconnect_event_supplier ( - ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + disconnect_event_consumer ( + const char * connection_id + ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC (( CORBA::SystemException, Components::InvalidName, @@ -77,7 +85,6 @@ namespace CIAO CORBA::SystemException)); private: - // Reference to the ORB CORBA::ORB_var orb_; @@ -89,9 +96,8 @@ namespace CIAO * * List of consumers. */ - /// @@ George, this is cool! Do you want to use a _var or _ptr? + // @@TODO: We need to change the array to set! ACE_Array consumer_array_; - }; @@ -106,9 +112,7 @@ namespace CIAO class Direct_Consumer_Config_impl : public virtual POA_CIAO::Direct_Consumer_Config { - public: - Direct_Consumer_Config_impl (PortableServer::POA_ptr poa); virtual ~Direct_Consumer_Config_impl (void); @@ -141,7 +145,6 @@ namespace CIAO ACE_THROW_SPEC ((CORBA::SystemException)); private: - ACE_CString consumer_id_; ACE_CString supplier_id_; @@ -184,15 +187,12 @@ namespace CIAO ACE_THROW_SPEC ((CORBA::SystemException)); private: - ACE_CString supplier_id_; EventServiceType service_type_; PortableServer::POA_var poa_; - }; - } #include /**/ "ace/post.h" diff --git a/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent.idl b/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent.idl index 3baed93687d..2e33af5a6a1 100644 --- a/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent.idl +++ b/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent.idl @@ -3,17 +3,15 @@ /** * @file CIAO_DirectEvent.idl * - * @author George Edwards * @author Gan Deng * * @brief Interfaces for configuring CIAO's direct event service. */ -#include "../CIAO_Events.idl" +#include module CIAO { - interface Direct_Consumer_Config : Consumer_Config { @@ -25,5 +23,4 @@ module CIAO { }; - }; 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..92d4b2f3885 --- /dev/null +++ b/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent.mpc @@ -0,0 +1,26 @@ +// -*- MPC -*- +// $Id$ + +project (CIAO_DirectEvent) : orbsvcslib, ciao_events_dnc { + + requires += dummy_label + after += CIAO_DnC_Events_Base + sharedname = CIAO_DirectEvent + libs += CIAO_DnC_Events_Base + idlflags += -Wb,export_include=CIAO_DIRECTEVENT_Export.h -Wb,export_macro=CIAO_DIRECTEVENT_Export + dynamicflags = CIAO_DIRECTEVENT_BUILD_DLL + + IDL_Files { + CIAO_DirectEvent.idl + } + + Source_Files { + CIAO_DirectEventS.cpp + CIAO_DirectEventC.cpp + CIAO_DirectEvent.cpp + } + + Header_Files { + CIAO_DirectEvent.h + } +} diff --git a/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent_Export.h b/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent_Export.h new file mode 100644 index 00000000000..39823ff0434 --- /dev/null +++ b/TAO/CIAO/ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent_Export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl CIAO_DIRECTEVENT +// ------------------------------ +#ifndef CIAO_DIRECTEVENT_EXPORT_H +#define CIAO_DIRECTEVENT_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (CIAO_DIRECTEVENT_HAS_DLL) +# define CIAO_DIRECTEVENT_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && CIAO_DIRECTEVENT_HAS_DLL */ + +#if !defined (CIAO_DIRECTEVENT_HAS_DLL) +# define CIAO_DIRECTEVENT_HAS_DLL 1 +#endif /* ! CIAO_DIRECTEVENT_HAS_DLL */ + +#if defined (CIAO_DIRECTEVENT_HAS_DLL) && (CIAO_DIRECTEVENT_HAS_DLL == 1) +# if defined (CIAO_DIRECTEVENT_BUILD_DLL) +# define CIAO_DIRECTEVENT_Export ACE_Proper_Export_Flag +# define CIAO_DIRECTEVENT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define CIAO_DIRECTEVENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* CIAO_DIRECTEVENT_BUILD_DLL */ +# define CIAO_DIRECTEVENT_Export ACE_Proper_Import_Flag +# define CIAO_DIRECTEVENT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define CIAO_DIRECTEVENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* CIAO_DIRECTEVENT_BUILD_DLL */ +#else /* CIAO_DIRECTEVENT_HAS_DLL == 1 */ +# define CIAO_DIRECTEVENT_Export +# define CIAO_DIRECTEVENT_SINGLETON_DECLARATION(T) +# define CIAO_DIRECTEVENT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* CIAO_DIRECTEVENT_HAS_DLL == 1 */ + +// Set CIAO_DIRECTEVENT_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (CIAO_DIRECTEVENT_NTRACE) +# if (ACE_NTRACE == 1) +# define CIAO_DIRECTEVENT_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define CIAO_DIRECTEVENT_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !CIAO_DIRECTEVENT_NTRACE */ + +#if (CIAO_DIRECTEVENT_NTRACE == 1) +# define CIAO_DIRECTEVENT_TRACE(X) +#else /* (CIAO_DIRECTEVENT_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define CIAO_DIRECTEVENT_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (CIAO_DIRECTEVENT_NTRACE == 1) */ + +#endif /* CIAO_DIRECTEVENT_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/CIAO/ciaosvcs/Events/CIAO_EventServiceBase.cpp b/TAO/CIAO/ciaosvcs/Events/CIAO_EventServiceBase.cpp new file mode 100644 index 00000000000..9c2563477b2 --- /dev/null +++ b/TAO/CIAO/ciaosvcs/Events/CIAO_EventServiceBase.cpp @@ -0,0 +1,23 @@ +//============================================================================= +/** + * @file CIAO_Event_Service.cpp + * + * $Id$ + * + * @author Gan Deng + */ +//============================================================================= + +#include "CIAO_EventServiceBase.h" + +namespace CIAO +{ + EventServiceBase:: + EventServiceBase (void) + { + } + + EventServiceBase::~EventServiceBase (void) + { + } +} diff --git a/TAO/CIAO/ciaosvcs/Events/CIAO_EventServiceBase.h b/TAO/CIAO/ciaosvcs/Events/CIAO_EventServiceBase.h new file mode 100644 index 00000000000..ea9fe669704 --- /dev/null +++ b/TAO/CIAO/ciaosvcs/Events/CIAO_EventServiceBase.h @@ -0,0 +1,116 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CIAO_EventServiceBase.h + * + * $Id$ + * + * @author Gan Deng + * @author George Edwards + */ +//============================================================================= + +#ifndef CIAO_EVENTSERVICEBASE_H +#define CIAO_EVENTSERVICEBASE_H +#include /**/ "ace/pre.h" + +#include "CIAO_EventsS.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO +{ + /** + * @class EventServiceBase + * + * An abstract base servant class to implement the CIAO_Event_Service + * interface. The derived classes will provide appropriate + * implementations of the connect, disconnect, and push methods depending on + * the event mechanism used. + */ + class CIAO_EVENTS_Export EventServiceBase : + public virtual POA_CIAO::CIAO_Event_Service + { + public: + EventServiceBase (void); + + virtual ~EventServiceBase (void); + + /// A factory method for Supplier_Config objects + virtual Supplier_Config_ptr + create_supplier_config (void) + ACE_THROW_SPEC ((CORBA::SystemException)) = 0; + + /// A factory method for Consumer_Config objects + virtual Consumer_Config_ptr + create_consumer_config (void) + ACE_THROW_SPEC ((CORBA::SystemException)) = 0; + + /** + * @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_WITH_DEFAULTS) + 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_WITH_DEFAULTS) + ACE_THROW_SPEC (( + CORBA::SystemException)) = 0; + + /** + * @fn void disconnect_event_supplier () + * + * Disconnects the event supplier associated with this object. + */ + virtual void disconnect_event_supplier ( + const char * consumer_id + ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) + 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_WITH_DEFAULTS) + 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_WITH_DEFAULTS) + ACE_THROW_SPEC (( + CORBA::SystemException)) = 0; + }; +} + +#include /**/ "ace/post.h" +#endif /* CIAO_EVENTSERVICEBASE_H */ diff --git a/TAO/CIAO/ciaosvcs/Events/CIAO_EventService_Factory_impl.cpp b/TAO/CIAO/ciaosvcs/Events/CIAO_EventService_Factory_impl.cpp new file mode 100644 index 00000000000..26b0ea6d94b --- /dev/null +++ b/TAO/CIAO/ciaosvcs/Events/CIAO_EventService_Factory_impl.cpp @@ -0,0 +1,95 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CIAO_EventService_Factory_impl.cpp + * + * $Id$ + * + * @author George Edwards + */ +//============================================================================= + +#include "CIAO_EventService_Factory_impl.h" +#include "ciaosvcs/Events/CIAO_Direct/CIAO_DirectEvent.h" +#include "ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.h" + +namespace CIAO +{ + EventService_Factory_impl::EventService_Factory_impl (void) + { + } + + EventService_Factory_impl::EventService_Factory_impl ( + CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa) : + orb_ (CORBA::ORB::_duplicate (orb)), + poa_ (PortableServer::POA::_duplicate (poa)) + { + } + + EventService_Factory_impl::~EventService_Factory_impl (void) + { + } + + CIAO_Event_Service_ptr + EventService_Factory_impl::create (EventServiceType type) + { + ACE_DEBUG ((LM_DEBUG, "CIAO::EventService_Factory_impl::create_event_service\n")); + + EventServiceBase * event_service = 0; + + switch (type) + { + case DIRECT: + { + ACE_NEW_RETURN (event_service, + DirectEventService (this->orb_.in (), + this->poa_.in ()), + 0); + break; + } + + case RTEC: + { + ACE_NEW_RETURN (event_service, + RTEventService (this->orb_.in (), + this->poa_.in ()), + 0); + break; + } + } + + // Activate the servant + CIAO_Event_Service_var service = event_service->_this (); + return service._retn (); + } + + 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->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/ciaosvcs/Events/CIAO_EventService_Factory_impl.h b/TAO/CIAO/ciaosvcs/Events/CIAO_EventService_Factory_impl.h new file mode 100644 index 00000000000..043f4592eb2 --- /dev/null +++ b/TAO/CIAO/ciaosvcs/Events/CIAO_EventService_Factory_impl.h @@ -0,0 +1,77 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CIAO_EventService_Factory_impl.h + * + * $Id$ + * + * @author George Edwards + */ +//============================================================================= + +#ifndef CIAO_EVENTSERVICE_FACTORY_IMPL_H +#define CIAO_EVENTSERVICE_FACTORY_IMPL_H +#include /**/ "ace/pre.h" + +#include "tao/PortableServer/PortableServer.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "CIAO_Events_Export.h" +#include "CIAO_EventServiceBase.h" + +namespace CIAO +{ + class CIAO_EVENTS_Export EventService_Factory_impl : + public ACE_Service_Object + { + public: + EventService_Factory_impl (void); + + EventService_Factory_impl (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa); + + virtual ~EventService_Factory_impl (void); + + /// A factory method which creates an CIAO_Event_Service object + virtual CIAO_Event_Service_ptr create (EventServiceType type); + + 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 poa_; + }; + +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/ciaosvcs/Events/CIAO_Events.idl b/TAO/CIAO/ciaosvcs/Events/CIAO_Events.idl index 6f2ee1d1e33..b946437095f 100644 --- a/TAO/CIAO/ciaosvcs/Events/CIAO_Events.idl +++ b/TAO/CIAO/ciaosvcs/Events/CIAO_Events.idl @@ -40,23 +40,22 @@ module CIAO attribute Components::EventConsumerBase consumer; }; - interface ContainerEventService + interface CIAO_Event_Service { - Supplier_Config create_supplier_config (in EventServiceType type); + Supplier_Config create_supplier_config (); - Consumer_Config create_consumer_config (in EventServiceType type); + Consumer_Config create_consumer_config (); 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_supplier (in CONNECTION_ID conn_id) + raises (Components::InvalidConnection); + void disconnect_event_consumer (in CONNECTION_ID conn_id) - raises (Components::InvalidConnection, Components::InvalidName); + raises (Components::InvalidConnection); - void push_event (in Components::EventBase ev, - in CONNECTION_ID conn_id); + void push_event (in Components::EventBase ev); }; }; diff --git a/TAO/CIAO/ciaosvcs/Events/CIAO_Events.mpc b/TAO/CIAO/ciaosvcs/Events/CIAO_Events.mpc new file mode 100644 index 00000000000..d6484618fe6 --- /dev/null +++ b/TAO/CIAO/ciaosvcs/Events/CIAO_Events.mpc @@ -0,0 +1,46 @@ +// -*- MPC -*- +// $Id$ + + +project (CIAO_DnC_Events_Base) : orbsvcslib, ciao_events_dnc { + + requires += dummy_label + after += CIAO_DnC_Client + sharedname = CIAO_DnC_Events_Base + 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_EventServiceBase.cpp + CIAO_EventsC.cpp + CIAO_EventsS.cpp + } + + Header_Files { + CIAO_EventsC.h + CIAO_EventsS.h + CIAO_EventServiceBase.h + } +} + +project (CIAO_DnC_Events) : orbsvcslib, ciao_events_dnc { + + requires += dummy_label + after += CIAO_DnC_Events CIAO_RTEvent CIAO_DirectEvent + sharedname = CIAO_DnC_Events + libs += CIAO_DnC_Events_Base CIAO_RTEvent CIAO_DirectEvent + idlflags += -Wb,export_include=CIAO_Events_Export.h -Wb,export_macro=CIAO_EVENTS_Export + dynamicflags = CIAO_EVENTS_BUILD_DLL + + Source_Files { + CIAO_EventService_Factory_impl.cpp + } + + Header_Files { + CIAO_EventService_Factory_impl.h + } +} \ No newline at end of file diff --git a/TAO/CIAO/ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.cpp b/TAO/CIAO/ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.cpp new file mode 100644 index 00000000000..bce61f11a33 --- /dev/null +++ b/TAO/CIAO/ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.cpp @@ -0,0 +1,555 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CIAO_RTEvent.cpp + * + * $Id$ + * + * @author Gan Deng + * @author George Edwards + */ +//============================================================================= + +#include "CIAO_RTEvent.h" + +namespace CIAO +{ + + RTEventService::RTEventService (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa) : + orb_ (CORBA::ORB::_duplicate (orb)), + root_poa_ (PortableServer::POA::_duplicate (poa)), + type_id_ (ACE_ES_EVENT_ANY), + source_id_ (ACE_ES_EVENT_SOURCE_ANY) + { + this->create_rt_event_channel (); + } + + + RTEventService::~RTEventService (void) + { + } + + + Supplier_Config_ptr + RTEventService::create_supplier_config (void) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + RTEvent_Supplier_Config_impl * supplier_config = 0; + ACE_NEW_RETURN (supplier_config, + RTEvent_Supplier_Config_impl (this->root_poa_.in ()), + Supplier_Config::_nil ()); + RTEvent_Supplier_Config_var return_rtec = + supplier_config->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + return return_rtec._retn (); + } + + + Consumer_Config_ptr + RTEventService::create_consumer_config (void) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + RTEvent_Consumer_Config_impl * consumer_config = 0; + ACE_NEW_RETURN (consumer_config, + RTEvent_Consumer_Config_impl (this->root_poa_.in ()), + Consumer_Config::_nil ()); + RTEvent_Consumer_Config_var return_rtec = + consumer_config->_this (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + return return_rtec._retn (); + } + + + 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 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 (root_poa_.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)) + 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 ( + root_poa_.in (), + 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 ()); + } + + //@@@ + rt_config->start_disjunction_group (1); + + 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 ( + const char * connection_id + ACE_ENV_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; + } + + void + RTEventService::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")); + + // @@ (GD) Anything else to do to get the svc.conf file options? + TAO_EC_Default_Factory::init_svcs (); + + 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; + } + + + RTEventServiceSupplier_impl::RTEventServiceSupplier_impl ( + PortableServer::POA_ptr poa) : + poa_ (PortableServer::POA::_duplicate (poa)) + { + } + + void + RTEventServiceSupplier_impl::disconnect_push_supplier (void) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + PortableServer::ObjectId_var oid = this->poa_->servant_to_id (this); + this->poa_->deactivate_object (oid); + this->_remove_ref (); + } + + RTEventServiceConsumer_impl::RTEventServiceConsumer_impl ( + PortableServer::POA_ptr poa, + Components::EventConsumerBase_ptr consumer) : + poa_ (PortableServer::POA::_duplicate (poa)), + event_consumer_ (Components::EventConsumerBase::_duplicate (consumer)) + { + } + + void + RTEventServiceConsumer_impl::push (const RtecEventComm::EventSet& events) + ACE_THROW_SPEC ((CORBA::SystemException)) + { + 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")); + + PortableServer::ObjectId_var oid = this->poa_->servant_to_id (this); + this->poa_->deactivate_object (oid); + this->_remove_ref (); + } + + RTEvent_Consumer_Config_impl::RTEvent_Consumer_Config_impl (PortableServer::POA_ptr poa) : + service_type_ (RTEC), + poa_ (PortableServer::POA::_duplicate (poa)) + { + } + + 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 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::set_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::set_supplier_id\n")); + + this->supplier_id_ = supplier_id; + + ACE_Hash 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_ = Components::EventConsumerBase::_duplicate (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)) + { + + ACE_DEBUG ((LM_DEBUG, "RTEvent_Consumer_Config_impl::get_supplier_id\n")); + + 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)) + { + ACE_DEBUG ((LM_DEBUG, "RTEvent_Consumer_Config_impl::get_consumer\n")); + + 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); + + + // @@@ Hard coded + this->qos_.start_disjunction_group (1); + this->qos_.insert_type (ACE_ES_EVENT_ANY, 0); + + return consumer_qos; + } + + void + RTEvent_Consumer_Config_impl::destroy ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)) + { + ACE_DEBUG + ((LM_DEBUG, "RTEvent_Consumer_Config_impl::destroy\n")); + + PortableServer::ObjectId_var oid = this->poa_->servant_to_id (this); + this->poa_->deactivate_object (oid); + this->_remove_ref (); + } + + RTEvent_Supplier_Config_impl::RTEvent_Supplier_Config_impl (PortableServer::POA_ptr poa) : + service_type_ (RTEC), + poa_ (PortableServer::POA::_duplicate (poa)) + { + } + + 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 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; + } + + void + RTEvent_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_RTEC/CIAO_RTEvent.h b/TAO/CIAO/ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.h new file mode 100644 index 00000000000..9c70aaf4e0c --- /dev/null +++ b/TAO/CIAO/ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.h @@ -0,0 +1,326 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file CIAO_RTEvent.h + * + * $Id$ + * + * @author Gan Deng + * @author George Edwards + */ +//============================================================================= + +#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 "ciaosvcs/Events/CIAO_EventServiceBase.h" +#include "CIAO_RTEventS.h" + +#include "ace/Hash_Map_Manager.h" +#include "orbsvcs/orbsvcs/Event_Utilities.h" +#include "orbsvcs/orbsvcs/Event/EC_Event_Channel.h" +#include "orbsvcs/orbsvcs/Event/EC_Default_Factory.h" + +namespace CIAO +{ + + /** + * @class RTEventService + * + * An implementation of EventServiceBase using the RT event channel. + * + * @@ (GD) There should be a place where the deployment tool could + * specify the RT Event Channel service configuration file. + * This should be the place where the RtecEventChannel servant was + * first time initialized. + */ + class CIAO_RTEVENT_Export RTEventService : + public virtual EventServiceBase + { + public: + + RTEventService (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa); + + virtual ~RTEventService (void); + + virtual Supplier_Config_ptr + create_supplier_config (void) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual Consumer_Config_ptr + create_consumer_config (void) + ACE_THROW_SPEC ((CORBA::SystemException)); + + 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 ( + const char * consumer_id + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + 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: + // @@ (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) + 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_ + * @@@ Need to change this into a map, since multiple sources + * could be connected to the event channel. + * + * 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_Equal_To, + ACE_Null_Mutex> proxy_supplier_map_; + + }; + + /** + * @class RTEventServiceSupplier_impl + * + * An implementation of the PushSupplier interface. + */ + class RTEventServiceSupplier_impl : + public virtual POA_RtecEventComm::PushSupplier + { + public: + + RTEventServiceSupplier_impl ( + PortableServer::POA_ptr poa); + + virtual void disconnect_push_supplier ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + private: + + PortableServer::POA_var poa_; + }; + + /** + * @class RTEventServiceConsumer_impl + * + * An implementation of the PushConsumer interface. + */ + class RTEventServiceConsumer_impl : + public virtual POA_RtecEventComm::PushConsumer + { + public: + + RTEventServiceConsumer_impl ( + PortableServer::POA_ptr poa, + Components::EventConsumerBase_ptr consumer); + + virtual void push ( + const RtecEventComm::EventSet& events) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + virtual void disconnect_push_consumer ( + ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException)); + + private: + + PortableServer::POA_var poa_; + + 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 (PortableServer::POA_ptr poa); + + virtual ~RTEvent_Consumer_Config_impl (void); + + 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)); + + //@@ (GD) There should be a place where the deployment tool could + // set up the rt_event_qos properties for Consumer Config. + + virtual RtecEventChannelAdmin::ConsumerQOS * rt_event_qos (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void destroy (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_; + + PortableServer::POA_var poa_; + }; + + /** + * @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 (PortableServer::POA_ptr poa); + + virtual ~RTEvent_Supplier_Config_impl (void); + + 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)); + + //@@ (GD) There should be a place where the deployment tool could + // set up the rt_event_qos properties for Supplier Config. + + RtecEventChannelAdmin::SupplierQOS * rt_event_qos (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + virtual void destroy (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + + private: + ACE_CString supplier_id_; + + EventServiceType service_type_; + + ACE_SupplierQOS_Factory qos_; + + PortableServer::POA_var poa_; + }; +} + +#include /**/ "ace/post.h" +#endif /* CIAO_RTEVENT_H */ diff --git a/TAO/CIAO/ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.idl b/TAO/CIAO/ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.idl new file mode 100644 index 00000000000..5a58335556a --- /dev/null +++ b/TAO/CIAO/ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.idl @@ -0,0 +1,44 @@ +// $Id$ + +/** + * @file CIAO_RTEvent.idl + * + * @author Gan Deng + * @author George Edwards + * + * @brief Interfaces for configuring CIAO's RT event channel. + */ + +#include "CIAO_Events.idl" +#include + +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/ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.mpc b/TAO/CIAO/ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.mpc new file mode 100644 index 00000000000..0f079a0fde0 --- /dev/null +++ b/TAO/CIAO/ciaosvcs/Events/CIAO_RTEC/CIAO_RTEvent.mpc @@ -0,0 +1,28 @@ +// -*- MPC -*- +// $Id$ + +project (CIAO_RTEvent) : rtevent_serv, ciao_events_dnc { + + requires += dummy_label + after += CIAO_DnC_Events_Base + sharedname = CIAO_RTEvent + libs += CIAO_DnC_Events_Base + idlflags += -Wb,export_include=CIAO_RTEVENT_Export.h -Wb,export_macro=CIAO_RTEVENT_Export + dynamicflags = CIAO_RTEVENT_BUILD_DLL + + IDL_Files { + CIAO_RTEvent.idl + } + + Source_Files { + CIAO_RTEvent.cpp + CIAO_RTEventC.cpp + CIAO_RTEventS.cpp + } + + Header_Files { + CIAO_RTEvent.h + CIAO_RTEventC.h + CIAO_RTEventS.h + } +} -- cgit v1.2.1