diff options
author | dengg <dengg@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2006-01-24 01:20:06 +0000 |
---|---|---|
committer | dengg <dengg@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2006-01-24 01:20:06 +0000 |
commit | 6ea146a260ce475aa80f346ecdc15778ba54f12a (patch) | |
tree | 9f34ee66904789e4aea8bf9d7d8013f108893882 | |
parent | 5c89a74445c83fc84fdc8e151baa016ec824af38 (diff) | |
download | ATCD-6ea146a260ce475aa80f346ecdc15778ba54f12a.tar.gz |
*** empty log message ***
9 files changed, 175 insertions, 52 deletions
diff --git a/TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.cpp b/TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.cpp index 580bb00d904..3a56f1a8994 100644 --- a/TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.cpp +++ b/TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.cpp @@ -691,7 +691,8 @@ finishLaunch (CORBA::Boolean start, this->get_outgoing_connections ( (entry->int_id_).child_plan_.in (), !is_ReDAC, - true // we search *new* plan + true, // we search *new* plan + DomainApplicationManager_Impl::Internal_Connections ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; @@ -745,7 +746,8 @@ finishLaunch (CORBA::Boolean start, this->get_outgoing_connections ( (entry->int_id_).old_child_plan_.in (), true, // yes, get *all* the connections - false // search in the *old* plan + false, // search in the *old* plan + DomainApplicationManager_Impl::Internal_Connections ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; @@ -755,7 +757,8 @@ finishLaunch (CORBA::Boolean start, this->get_outgoing_connections ( (entry->int_id_).child_plan_.in (), true, // yes, get *all* the connections - true // search in the *new* plan + true, // search in the *new* plan + DomainApplicationManager_Impl::Internal_Connections ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; @@ -902,6 +905,30 @@ populate_binding_info (const ACE_CString& name, return retv; } +CIAO::Execution_Manager::Execution_Manager_Impl::Component_Binding_Info * +CIAO::DomainApplicationManager_Impl:: +populate_binding_info (const ACE_CString& name) +{ + Execution_Manager::Execution_Manager_Impl::Component_Binding_Info * retv; + ACE_NEW_RETURN (retv, + Execution_Manager::Execution_Manager_Impl::Component_Binding_Info (), + 0); + + // Looking for the child plan uuid through the shared compoonent list + for (CORBA::ULong i = 0; i < this->shared_->length (); ++i) + { + if (ACE_OS::strcmp (this->shared_[i].name.in (), + name.c_str ()) == 0) + { + ACE_CString child_uuid = this->shared_[i].plan_uuid.in (); + retv = this->populate_binding_info (name, child_uuid); + return retv; + } + } + + return 0; // If no matching is found (should never happen). +} + void CIAO::DomainApplicationManager_Impl:: add_shared_components (const Deployment::ComponentPlans & shared) @@ -975,7 +1002,8 @@ Deployment::Connections * CIAO::DomainApplicationManager_Impl:: get_outgoing_connections (const Deployment::DeploymentPlan &plan, bool is_getting_all_connections, - bool is_search_new_plan + bool is_search_new_plan, + Connection_Search_Type t ACE_ENV_ARG_DECL) { CIAO_TRACE("CIAO::DomainApplicationManager_Impl::get_outgoing_connections"); @@ -987,7 +1015,9 @@ get_outgoing_connections (const Deployment::DeploymentPlan &plan, // For each component instance in the child plan ... for (CORBA::ULong i = 0; i < plan.instance.length (); ++i) { - if (this->is_shared_component (plan.instance[i].name.in ())) + + if (t == Internal_Connections && + this->is_shared_component (plan.instance[i].name.in ())) continue; // Get the outgoing connections of the component @@ -1278,25 +1308,64 @@ destroyApplication (ACE_ENV_SINGLE_ARG_DECL) my_na->ciao_passivate (); - Deployment::Connections * my_connections = + Deployment::Connections_var connections = this->get_outgoing_connections ( (entry->int_id_).child_plan_.in (), true, // yes, get *all* the connections - true // yes, we search the current plan + true, // yes, we search the current plan + DomainApplicationManager_Impl::External_Connections ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; // Invoke finishLaunch() on NodeApplication to remove bindings. - if (my_connections->length () != 0) + // If this NodeApplication is not within the control of this DAM, + // then we should delegate the call to the correct DAM through EM. + + // Iterave over the returned connection list in <connections>, + // (1) If this is a shared component, then we remove this connection + // from <connections>, and then populate a "Component_Binding_Info" + // struct for it and send to EM for remove. + // (2) For the rest of the connections, we send them to the NAs + // managed by the local DAM to remove. + + for (CORBA::ULong j = 0; j < connections->length (); ++j) { - entry->int_id_.node_application_->finishLaunch - (*my_connections, - start, - false // "false" => remove new connections only - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + if (this->is_shared_component (connections[j].instanceName.in ())) + { + // ask EM to remove the binding for us + Execution_Manager::Execution_Manager_Impl:: + Component_Binding_Info * + binding = this->populate_binding_info ( + connections[j].instanceName.in ()); + + this->execution_manager_->finalize_global_binding ( + *binding, false); + + // If this element is the last one in the sequence + if (j == connections->length () - 1) + { + connections->length (connections->length () - 1); + break; + } + + // otherwise, remove this element from the list + for (CORBA::ULong k = j; k < connections->length (); ++k) + { + connections[k] = connections [k + 1]; + connections->length (connections->length () - 1); + } + } } + entry->int_id_.node_application_->finishLaunch + (connections.in (), + start, + false // "false" => remove connections + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // To invoke <destroy> operations on NodeManagers is the way to go. + // Invoke destroyPlan() operation on the NodeManager Deployment::NodeManager_var my_node_manager = (entry->int_id_).node_manager_; diff --git a/TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.h b/TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.h index f0f206e4f61..c159f948785 100644 --- a/TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.h +++ b/TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.h @@ -52,6 +52,16 @@ namespace CIAO : public virtual POA_Deployment::DomainApplicationManager { public: + + // External_Connections means we search all the connections including + // the connectiosn for external/shared components of this plan which hold + // port objrefs of components within this plan + enum Connection_Search_Type + { + External_Connections, + Internal_Connections + }; + /// Define the type which contains a list of DnC artifacts. /// @@ Assumption: Each NodeApplicationManager create only one /// NodeApplication when the startLaunch() operation is invoked, @@ -254,6 +264,15 @@ namespace CIAO populate_binding_info (const ACE_CString& name, const ACE_CString& child_uuid); + /** + * Construct <Component_Binding_Info> struct for the component instance. + * Fetch the plan_uuid info from the internally cached shared component + * list. + * + * @para name component instance name + */ + Execution_Manager::Execution_Manager_Impl::Component_Binding_Info * + populate_binding_info (const ACE_CString& name); /** * Contact each NodeManager to get shared compnents information @@ -292,8 +311,9 @@ namespace CIAO Deployment::Connections * get_outgoing_connections (const Deployment::DeploymentPlan &plan, bool is_getting_all_connections = true, - bool is_search_new_plan = true - ACE_ENV_ARG_DECL); + bool is_search_new_plan = true, + Connection_Search_Type t = Internal_Connections + ACE_ENV_ARG_DECL_WITH_DEFAULTS); /// This is a helper function to find the connection for a component. bool @@ -301,7 +321,7 @@ namespace CIAO Deployment::Connections & retv, bool is_ReDAC, bool is_search_new_plan - ACE_ENV_ARG_DECL) + ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((Deployment::StartError)); /// Dump connections, a static method diff --git a/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.cpp b/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.cpp index 86c1fc1e5d3..46801e2293d 100644 --- a/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.cpp +++ b/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.cpp @@ -268,7 +268,7 @@ namespace CIAO void Execution_Manager_Impl::finalize_global_binding ( const Component_Binding_Info & binding, - CORBA::Boolean add_connection) + CORBA::Boolean add_or_remove) ACE_THROW_SPEC (( ::CORBA::SystemException, ::Deployment::InvalidConnection)) @@ -293,7 +293,7 @@ namespace CIAO node_app->finishLaunch (binding.providedReference_.in (), true, // start - true); // add_connection + add_or_remove); } ACE_CATCHANY { diff --git a/TAO/CIAO/DAnCE/NodeApplication/NodeApplication.cpp b/TAO/CIAO/DAnCE/NodeApplication/NodeApplication.cpp index c49162b94c7..4ceab08ebdb 100644 --- a/TAO/CIAO/DAnCE/NodeApplication/NodeApplication.cpp +++ b/TAO/CIAO/DAnCE/NodeApplication/NodeApplication.cpp @@ -30,6 +30,6 @@ main (int argc, char *argv[]) } ACE_ENDTRY; - ACE_DEBUG ((LM_DEBUG, "This NodeApplication is quitting now!\n")); + ACE_DEBUG ((LM_DEBUG, "CIAO (%P|%t) - This NodeApplication is destroyed!\n")); return 0; } diff --git a/TAO/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.cpp b/TAO/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.cpp index 11ff03aa2c1..e30ff5b6773 100644 --- a/TAO/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.cpp +++ b/TAO/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.cpp @@ -57,8 +57,7 @@ create_connections (ACE_ENV_SINGLE_ARG_DECL) Components::FacetDescriptions_var facets; if (is_shared_component (comp_name)) - facets = const_cast<Components::FacetDescriptions*> - (&(this->node_manager_->get_all_facets (comp_name))); + facets = this->node_manager_->get_all_facets (comp_name); else { facets = ((*iter).int_id_)->get_all_facets (ACE_ENV_SINGLE_ARG_PARAMETER); @@ -79,8 +78,7 @@ create_connections (ACE_ENV_SINGLE_ARG_DECL) Components::ConsumerDescriptions_var consumers; if (is_shared_component (comp_name)) - consumers = const_cast<Components::ConsumerDescriptions*> - (&(this->node_manager_->get_all_consumers (comp_name))); + consumers = this->node_manager_->get_all_consumers (comp_name); else { consumers = @@ -98,8 +96,8 @@ create_connections (ACE_ENV_SINGLE_ARG_DECL) comp_name.c_str ())); } - const CORBA::ULong facet_len = facets->length (); - const CORBA::ULong consumer_len = consumers->length (); + CORBA::ULong facet_len = facets->length (); + CORBA::ULong consumer_len = consumers->length (); CORBA::ULong curr_len = retv->length (); retv->length (curr_len + facet_len + consumer_len); @@ -501,6 +499,10 @@ destroyApplication (Deployment::Application_ptr app if (CORBA::is_nil (this->nodeapp_.in () )) ACE_THROW (Deployment::StopError ()); + // If there are no shared components within this NAM, then kill the NA + + // Otherwise, only remove those components from the NA + this->nodeapp_->remove (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; diff --git a/TAO/CIAO/DAnCE/NodeManager/NodeManager_Impl.cpp b/TAO/CIAO/DAnCE/NodeManager/NodeManager_Impl.cpp index ac2ae8d5cc9..6b48b8fae74 100644 --- a/TAO/CIAO/DAnCE/NodeManager/NodeManager_Impl.cpp +++ b/TAO/CIAO/DAnCE/NodeManager/NodeManager_Impl.cpp @@ -93,24 +93,58 @@ CIAO::NodeManager_Impl_Base::leaveDomain (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW (CORBA::NO_IMPLEMENT ()); } -const ::Components::FacetDescriptions & +::Components::FacetDescriptions * CIAO::NodeManager_Impl_Base:: get_all_facets (ACE_CString & name) { Component_Facets_Map::ENTRY *entry; - this->comp_facets_map_.find (name.c_str (), entry); - return entry->int_id_.in (); + if (this->comp_facets_map_.find (name.c_str (), entry) != 0) + ACE_DEBUG ((LM_ERROR, "(%P|%t) - NodeManager_Impl_Base::get_all_facets - " + "No component with name [%s] was found in the NodeManager\n", name.c_str ())); + + CORBA::ULong facet_len = entry->int_id_->length (); + + Components::FacetDescriptions_var retv; + ACE_NEW_RETURN (retv, + Components::FacetDescriptions, + 0); + + retv->length (facet_len); + + for (CORBA::ULong i = 0; i < facet_len; ++i) + { + retv[i] = entry->int_id_[i]; + } + + return retv._retn (); } -const ::Components::ConsumerDescriptions & +::Components::ConsumerDescriptions * CIAO::NodeManager_Impl_Base:: get_all_consumers (ACE_CString & name) { Component_Consumers_Map::ENTRY *entry; - this->comp_consumers_map_.find (name.c_str (), entry); - return entry->int_id_.in (); + if (this->comp_consumers_map_.find (name.c_str (), entry) != 0) + ACE_DEBUG ((LM_ERROR, "(%P|%t) - NodeManager_Impl_Base::get_all_facets - " + "Component [%s] was not found in the NodeManager\n", name.c_str ())); + + CORBA::ULong consumer_len = entry->int_id_->length (); + + Components::ConsumerDescriptions_var retv; + ACE_NEW_RETURN (retv, + Components::ConsumerDescriptions, + 0); + + retv->length (consumer_len); + + for (CORBA::ULong i = 0; i < consumer_len; ++i) + { + retv[i] = entry->int_id_[i]; + } + + return retv._retn (); } void @@ -334,7 +368,7 @@ destroyPlan (const Deployment::DeploymentPlan & plan // in the deployment plan. // Clean up the cached "Facets" and "Consumers" map of the components - // whose ref count is 0 + // if their ref count become 0 CORBA::ULong const length = plan.instance.length (); for (CORBA::ULong i = 0; i < length; ++i) { @@ -350,26 +384,21 @@ destroyPlan (const Deployment::DeploymentPlan & plan // Unbind this component from the ref_count_map_ this->ref_count_map_.unbind (plan.instance[i].name.in ()); + + // Unbind this component from the facet/consumer maps + if (this->comp_facets_map_.unbind ( + plan.instance[i].name.in ()) != 0 || + this->comp_consumers_map_.unbind ( + plan.instance[i].name.in ()) != 0) + { + ACE_TRY_THROW + (Deployment::StopError ("NodeManager_Impl_Base::destroyPlan ", + "Unable to find component instance")); + } } } - - if (this->comp_facets_map_.unbind (plan.instance[i].name.in ()) != 0 || - this->comp_consumers_map_.unbind (plan.instance[i].name.in ()) != 0) - { - ACE_TRY_THROW - (Deployment::StopError ("NodeManager_Impl_Base::destroyPlan ", - "Unable to find component instance")); - } } - // Create a list of components that are not to be removed, and send - // this list to the NAM, who will delegate to appropriate NAs to - // remove bindings from these components. - - // The problem is that we probably also want to call another NAM, which - // manages the shared components in a different child plan. :( - - // Find the NAM from the map and invoke the destroyPlan() operation on // it, which will actuall remove components and connections in this plan. // If @@ -379,7 +408,7 @@ destroyPlan (const Deployment::DeploymentPlan & plan Deployment::NodeApplicationManager_var nam = Deployment::NodeApplicationManager::_narrow (obj.in ()); - // Convert the ACE Set into CORBA sequence, and reset it. + // Reset each NAM about the shared components information CORBA::StringSeq_var shared = this->shared_components_seq (); nam->set_shared_components (shared.in ()); diff --git a/TAO/CIAO/DAnCE/NodeManager/NodeManager_Impl.h b/TAO/CIAO/DAnCE/NodeManager/NodeManager_Impl.h index 93da1abe2bb..4f042fcefa6 100644 --- a/TAO/CIAO/DAnCE/NodeManager/NodeManager_Impl.h +++ b/TAO/CIAO/DAnCE/NodeManager/NodeManager_Impl.h @@ -118,10 +118,10 @@ namespace CIAO // ********* CIAO Specific Helper functions ************ - virtual const ::Components::FacetDescriptions & + virtual ::Components::FacetDescriptions * get_all_facets (ACE_CString & name); - virtual const ::Components::ConsumerDescriptions & + virtual ::Components::ConsumerDescriptions * get_all_consumers (ACE_CString & name); virtual void diff --git a/TAO/CIAO/examples/Hello/Hello_Base/Hello_Base.idl b/TAO/CIAO/examples/Hello/Hello_Base/Hello_Base.idl index 2cd4a44cf3f..18b300932ee 100644 --- a/TAO/CIAO/examples/Hello/Hello_Base/Hello_Base.idl +++ b/TAO/CIAO/examples/Hello/Hello_Base/Hello_Base.idl @@ -14,6 +14,7 @@ module Hello eventtype TimeOut { + public string data; }; }; diff --git a/TAO/CIAO/examples/Hello/descriptors_shared_components/deploymentplan.cdp b/TAO/CIAO/examples/Hello/descriptors_shared_components/deploymentplan.cdp index 8b42fa056ef..c8bf5543c05 100644 --- a/TAO/CIAO/examples/Hello/descriptors_shared_components/deploymentplan.cdp +++ b/TAO/CIAO/examples/Hello/descriptors_shared_components/deploymentplan.cdp @@ -133,6 +133,7 @@ </internalEndpoint> </connection> +<!-- <connection> <name>hello_facet_connection</name> <internalEndpoint> @@ -146,6 +147,7 @@ <instance>Hello-Receiver-idd</instance> </internalEndpoint> </connection> +--> <!-- @@ Runtime library name must match exactly in "location" tag --> <artifact id="Hello-Sender_exec"> |