diff options
author | dengg <dengg@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2005-09-24 06:37:17 +0000 |
---|---|---|
committer | dengg <dengg@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2005-09-24 06:37:17 +0000 |
commit | df7bffdf5288b0a880ddb7ac59a9bf225fa3d5c0 (patch) | |
tree | ebd3bcf161ad4605f6123c76b0693b01b7d22d43 | |
parent | d4507cc6460de14c8e734b231e38e0c3278bbec5 (diff) | |
download | ATCD-df7bffdf5288b0a880ddb7ac59a9bf225fa3d5c0.tar.gz |
Sat Sep 24 02:37:20 2005 Gan Deng <dengg@dre.vanderbilt.edu>
18 files changed, 843 insertions, 198 deletions
diff --git a/TAO/CIAO/ChangeLog b/TAO/CIAO/ChangeLog index 40de210e268..920d3788666 100644 --- a/TAO/CIAO/ChangeLog +++ b/TAO/CIAO/ChangeLog @@ -1,3 +1,44 @@ +Sat Sep 24 02:37:20 2005 Gan Deng <dengg@dre.vanderbilt.edu> + + * ciao/Deployment.idl + * ciao/Deployment_Core.idl + * ciao/ServerResources.idl + + Enhanced to support RT-CCM feature. + + * DAnCE/NodeApplicationManager/ImplementationInfo.cpp + * DAnCE/NodeApplicationManager/ImplementationInfo.h + * DAnCE/NodeApplicationManager/NodeApplicationManager.mpc + * DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.cpp + * DAnCE/NodeApplicationManager/Containers_Info_Map.cpp + * DAnCE/NodeApplicationManager/Containers_Info_Map.h + + Refactor the NodeApplicationManager to populate the correct + node level deployment plan info, while taking into account + of the RT-CCM feature. + + * ciao/NodeApplication_Impl.cpp + * ciao/NodeApplication_Impl.h + + Modified to accomodate the change in IDL files. + + * DAnCE/tests/NodeApplicationTest/NodeApp_test_client.cpp + * DAnCE/tests/NodeApplicationTest/NodeApp_test_client_ex.cpp + * DAnCE/tests/NodeApplicationTest/NodeApp_test_client_simple.cpp + + Fixed these tests to make them run with the modified IDL + files. + + * DAnCE/examples/Hello/descriptors/rt-config-example.csr + * DAnCE/examples/Hello/descriptors/rt-config-example.cdp + + An example descriptor files to describe server resource, + and associate server resources and policy set defs with + the deployment plan. + + NOTE: All above code are tested working fine with the existing + examples. + Fri Sep 23 10:05:18 2005 William Otte <wotte@dre.vanderbilt.edu> * DAnCE/tests/NodeApplicationTest/NodeAppTest.mpc diff --git a/TAO/CIAO/DAnCE/NodeApplicationManager/Containers_Info_Map.cpp b/TAO/CIAO/DAnCE/NodeApplicationManager/Containers_Info_Map.cpp new file mode 100644 index 00000000000..9f790eb4d45 --- /dev/null +++ b/TAO/CIAO/DAnCE/NodeApplicationManager/Containers_Info_Map.cpp @@ -0,0 +1,298 @@ +// $Id$ +#include "Containers_Info_Map.h" +#include "ciao/CIAO_Config.h" +#include "ciao/CIAO_common.h" + +namespace CIAO +{ + Containers_Info_Map:: + Containers_Info_Map (const Deployment::DeploymentPlan & plan) + : map_ (CIAO_DEFAULT_MAP_SIZE), + plan_ (plan) + { + this->initialize_map (); + this->build_map (); + } + + Deployment::ContainerImplementationInfos * + Containers_Info_Map::containers_info (void) + { + // Fetch the information from the <containers_info_map_> + // and return the corresponding sequence + Deployment::ContainerImplementationInfos_var retv; + + ACE_NEW_RETURN (retv, + Deployment::ContainerImplementationInfos, + 0); + + Iterator end = this->map_.end (); + CORBA::ULong i = 0; + + for (Iterator b = this->map_.begin (); + b != end; + ++b) + { + retv->length (i + 1); + (*retv)[i] = *((*b).int_id_); + + ++i; + } + return retv._retn (); + } + + void + Containers_Info_Map:: + initialize_map (void) + { + const CORBA::ULong instance_len = this->plan_.instance.length (); + + // Iterate over the instance list and look at the policy set id of each + // component instance. For each policy set, we create a separate container + // to host all the components with such policy set. + for (CORBA::ULong i = 0; i < instance_len; ++i) + { + const char * my_resource_id = ""; + const char * my_policy_set_id = ""; + + if (this->plan_.instance[i].deployedResource.length () != 0) + { + my_resource_id = + this->plan_.instance[i].deployedResource[0].resourceName.in (); + + this->plan_.instance[i].deployedResource[0].resourceValue >>= + my_policy_set_id; + } + + // If we find a different policy_set_id, then we bind it. + if (this->map_.find (my_policy_set_id) == 0) + continue; + else if (ACE_OS::strcmp (my_policy_set_id, "") == 0) + { + // empty policy_set_id + Deployment::ContainerImplementationInfo * info; + ACE_NEW (info, Deployment::ContainerImplementationInfo); + this->map_.bind (my_policy_set_id, info); + continue; + } + else + { + Deployment::ContainerImplementationInfo * info; + ACE_NEW (info, Deployment::ContainerImplementationInfo); + + // Fetch the actual policy_set_def from the infoProperty + // Ugly due to the IDL data structure definition! :( + CORBA::ULong j; + for (j = 0; + j < this->plan_.infoProperty.length (); + ++j) + { + CIAO::DAnCE::ServerResource *server_resource_def = 0; + this->plan_.infoProperty[j].value >>= server_resource_def; + if (ACE_OS::strcmp ((*server_resource_def).Id, + my_resource_id) == 0) + { + // Iterate over the policy_sets + CORBA::ULong k; + for (k = 0; + k < (*server_resource_def).orb_config.policy_set.length (); + ++k) + { + if (ACE_OS::strcmp (my_policy_set_id, + (*server_resource_def).orb_config.policy_set[k].Id) == 0) + { + // Foud the target policy set def + info->container_config.length (1); + info->container_config[0].name = + CORBA::string_dup ("ContainerPolicySet"); + info->container_config[0].value <<= + (*server_resource_def).orb_config.policy_set[k]; + } + } + if (k == (*server_resource_def).orb_config.policy_set.length ()) + { + // No Server Resource Def found? + ACE_DEBUG ((LM_DEBUG, "No matching policy set def found!\n")); + } + } + } // end of for loop for fetching policy_set_def + + if (j == this->plan_.infoProperty.length ()) + { + // No Server Resource Def found?! Inconsistent descriptor files. + ACE_DEBUG ((LM_ERROR, "(%P|%t) Descriptor error: " + "No matching server resrouce def found for component: %s!\n", + this->plan_.instance[i].name.in ())); + } + this->map_.bind (my_policy_set_id, info); + } + } + } + + bool + Containers_Info_Map:: + build_map (void) + { + const CORBA::ULong instance_len = this->plan_.instance.length (); + + for (CORBA::ULong i = 0; i < instance_len; ++i) + { + const Deployment::InstanceDeploymentDescription & instance = + this->plan_.instance[i]; + + if (! this->insert_instance_into_map (instance)) + return false; + } + + return true; + } + + bool + Containers_Info_Map::insert_instance_into_map ( + const Deployment::InstanceDeploymentDescription & instance) + { + Deployment::ContainerImplementationInfo container_info; + + const char * policy_set_id = ""; + if (instance.deployedResource.length () != 0) + { + instance.deployedResource[0].resourceValue >>= policy_set_id; + } + + // Find the ContainerImplementationInfo entry from the map + MAP::ENTRY *entry; + if (this->map_.find (policy_set_id, entry) != 0) + return false; //should never happen + else + { + this->insert_instance_into_container ( + instance, + entry->int_id_->impl_infos); + } + + return true; + } + + bool + Containers_Info_Map::insert_instance_into_container ( + const Deployment::InstanceDeploymentDescription & instance, + Deployment::ComponentImplementationInfos & impl_infos) + { + // Increase the length of the ComponentImplementationInfos by one + CORBA::ULong i = impl_infos.length (); + impl_infos.length (i + 1); + + // Fill in the information about this component instance + // Get the component instance name. + impl_infos[i].component_instance_name = instance.name.in (); + + const Deployment::MonolithicDeploymentDescription & impl = + this->plan_.implementation[instance.implementationRef]; + + const CORBA::ULong artifact_num = impl.artifactRef.length (); + + // Copy Component instance related Properties if there is any. + if (instance.configProperty.length () > 0) + { + impl_infos[i].component_config = instance.configProperty; + } + + bool svnt_found = false; + bool exec_found = false; + + // For svnt artifact + for (CORBA::ULong j = 0; j < artifact_num; ++j) + { + const Deployment::ArtifactDeploymentDescription & arti = + this->plan_.artifact[ impl.artifactRef[j] ]; + + ACE_CString tmp = arti.name.in (); + ssize_t pos; + + //@@ Note: I am not checking for redundancy here. Maybe + // the modeling tool should make sure of + // uniqueness, i.e., one component implementation + // should have only 1 _svnt and 1 _exec libs. + if (!svnt_found && + ((pos = tmp.find ("_svnt")) != ACE_CString::npos || + (pos = tmp.find ("_Svnt")) != ACE_CString::npos)) + { + if (arti.location.length() < 1 ) + { + ACE_DEBUG ((LM_DEBUG, "Servant Artifact must have a location!\n")); + return 0; + } + + svnt_found = true; + // Copy the servant dll/so name. + // @@ Note: I ignore all the other locations except the first one. + impl_infos[i].servant_dll = + CORBA::string_dup (arti.location[0].in ()); + + // Get the entry point. + const CORBA::ULong prop_length = arti.execParameter.length (); + + for (CORBA::ULong prop_num = 0; + prop_num < prop_length; + ++prop_num) + { + ACE_CString name (arti.execParameter[prop_num].name.in ()); + if (name == ACE_CString ("entryPoint")) + { + const char * entry; + (arti.execParameter[prop_num].value) >>= entry; + impl_infos[i].servant_entrypt = CORBA::string_dup (entry); + } + else + { + ACE_DEBUG ((LM_DEBUG, "Found unknown property in the artifact!\n")); + ACE_DEBUG ((LM_DEBUG, "We only support entrypoint at this point in CIAO.\n")); + } + } + } + + // As one can see, code is duplicated here. I will come back for this later. + // For exec artifact + if (!exec_found && + ((pos = tmp.find ("_exec")) != ACE_CString::npos || + (pos = tmp.find ("_Exec")) != ACE_CString::npos)) + { + if (arti.location.length() < 1 ) + { + ACE_DEBUG ((LM_DEBUG, "Executor Artifact must have a location!\n")); + return 0; + } + + exec_found = true; + // Cpoy the servant dll/so name. + // @@ Note: I ignore all the other locations except the first one. + exec_found = true; + impl_infos[i].executor_dll = + CORBA::string_dup (arti.location[0].in ()); + + // Get the entry point. + const CORBA::ULong prop_length = arti.execParameter.length (); + for (CORBA::ULong prop_num = 0; + prop_num < prop_length; + ++prop_num) + { + ACE_CString name (arti.execParameter[prop_num].name.in ()); + if (name == ACE_CString ("entryPoint")) + { + const char * entry; + (arti.execParameter[prop_num].value) >>= entry; + impl_infos[i].executor_entrypt = CORBA::string_dup (entry); + } + else + { + ACE_DEBUG ((LM_DEBUG, "Found unknown property in the artifact!\n")); + ACE_DEBUG ((LM_DEBUG, "We only support entrypoint at this point in CIAO.\n")); + } + } + } + else + // We see artifact other than servant/executor and we ignore them. + continue; + } + return true; + } +} diff --git a/TAO/CIAO/DAnCE/NodeApplicationManager/Containers_Info_Map.h b/TAO/CIAO/DAnCE/NodeApplicationManager/Containers_Info_Map.h new file mode 100644 index 00000000000..253a1f7e767 --- /dev/null +++ b/TAO/CIAO/DAnCE/NodeApplicationManager/Containers_Info_Map.h @@ -0,0 +1,74 @@ +/** + * + * @file Containers_Info_Map.h + * @author Gan Deng <dengg@dre.vanderbilt.edu> + * + * Map of ContainerImplementationInfo sequences. + * + * $Id$ + */ + +#ifndef CIAO_CONTAINERS_INFO_MAP_H +#define CIAO_CONTAINERS_INFO_MAP_H + +#include /**/ "ace/pre.h" + +#include "ace/Null_Mutex.h" +#include "ace/Hash_Map_Manager.h" +#include "ciao/DeploymentC.h" +#include "ace/SString.h" +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +namespace CIAO +{ + /** + * @class Container_Infos_Map + * @brief Implementation of a map of ContainerImplementationInfo sequences. + * + * This is a helper class to populate the NodeImplementationInfo struct from + * a deployment plan.. + */ + class Containers_Info_Map + { + public: + + Containers_Info_Map (const Deployment::DeploymentPlan & plan); + + Deployment::ContainerImplementationInfos * + containers_info (void); + + private: + typedef + ACE_Hash_Map_Manager_Ex <ACE_CString, + Deployment::ContainerImplementationInfo *, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> MAP; + + typedef MAP::iterator Iterator; + + MAP map_; + + const Deployment::DeploymentPlan & plan_; + + //Deployment::ContainerImplementationInfos_var containers_info_; + + private: + + void initialize_map (void); + bool build_map (void); + + bool insert_instance_into_map ( + const Deployment::InstanceDeploymentDescription & instance); + + bool insert_instance_into_container ( + const Deployment::InstanceDeploymentDescription & instance, + Deployment::ComponentImplementationInfos & impl_infos); + }; +} + +#include /**/ "ace/post.h" + +#endif /*CIAO_CONTAINERS_INFO_MAP_H*/ diff --git a/TAO/CIAO/DAnCE/NodeApplicationManager/ImplementationInfo.cpp b/TAO/CIAO/DAnCE/NodeApplicationManager/ImplementationInfo.cpp index c58c0493aad..2602728c520 100644 --- a/TAO/CIAO/DAnCE/NodeApplicationManager/ImplementationInfo.cpp +++ b/TAO/CIAO/DAnCE/NodeApplicationManager/ImplementationInfo.cpp @@ -5,149 +5,81 @@ #include "ImplementationInfo.h" #include "ace/SString.h" -// Specialized operation that we will use for now. -namespace CIAO +CIAO::NodeImplementationInfoHandler:: +NodeImplementationInfoHandler (::Deployment::DeploymentPlan & plan) : + plan_ (plan), + node_info_ (0), + containers_info_map_ (plan) { - bool operator<< (Deployment::NodeImplementationInfo & node_info, - const Deployment::DeploymentPlan & plan) - { - const CORBA::ULong len = plan.instance.length (); - - // @@ Install all the components into a single container. - // @@ Nanbor, I didn't create separate containers since the - // deploymentplan IDL is still unknown at this phase. - - node_info.length (1); //everything is in a single container. - Deployment::ContainerImplementationInfo container_info; - container_info.impl_infos.length (len); - - Deployment::ComponentImplementationInfos impl_infos; - impl_infos.length (len); - - for (CORBA::ULong i = 0; i < len; ++i) - { - const Deployment::InstanceDeploymentDescription & inst = - plan.instance[i]; - - // Get the component instance name. - impl_infos[i].component_instance_name = inst.name.in (); - - const Deployment::MonolithicDeploymentDescription & impl = - plan.implementation[inst.implementationRef]; - - const CORBA::ULong artifact_num = impl.artifactRef.length (); - - // Copy Component instance related Properties if there is any. - if (inst.configProperty.length () > 0) - { - impl_infos[i].component_config = inst.configProperty; - } - - bool svnt_found = false; - bool exec_found = false; - - // For svnt artifact - for (CORBA::ULong j = 0; j < artifact_num; ++j) - { - const Deployment::ArtifactDeploymentDescription & arti = - plan.artifact[ impl.artifactRef[j] ]; - - ACE_CString tmp = arti.name.in (); - ssize_t pos; - - //@@ Note: I am not checking for redundancy here. Maybe - // the modeling tool should make sure of - // uniqueness, i.e., one component implementation - // should have only 1 _svnt and 1 _exec libs. - if (!svnt_found && - ((pos = tmp.find ("_svnt")) != ACE_CString::npos || - (pos = tmp.find ("_Svnt")) != ACE_CString::npos)) - { - if (arti.location.length() < 1 ) - { - ACE_DEBUG ((LM_DEBUG, "Servant Artifact must have a location!\n")); - return 0; - } - - svnt_found = true; - // Copy the servant dll/so name. - // @@ Note: I ignore all the other locations except the first one. - impl_infos[i].servant_dll = - CORBA::string_dup (arti.location[0].in ()); - - // Get the entry point. - const CORBA::ULong prop_length = arti.execParameter.length (); - - for (CORBA::ULong prop_num = 0; - prop_num < prop_length; - ++prop_num) - { - ACE_CString name (arti.execParameter[prop_num].name.in ()); - if (name == ACE_CString ("entryPoint")) - { - const char * entry; - (arti.execParameter[prop_num].value) >>= entry; - impl_infos[i].servant_entrypt = CORBA::string_dup (entry); - } - else - { - ACE_DEBUG ((LM_DEBUG, "Found unknown property in the artifact!\n")); - ACE_DEBUG ((LM_DEBUG, "We only support entrypoint at this point in CIAO.\n")); - } - } - } - - // As one can see, code is duplicated here. I will come back for this later. - // For exec artifact - if (!exec_found && - ((pos = tmp.find ("_exec")) != ACE_CString::npos || - (pos = tmp.find ("_Exec")) != ACE_CString::npos)) - { - if (arti.location.length() < 1 ) - { - ACE_DEBUG ((LM_DEBUG, "Executor Artifact must have a location!\n")); - return 0; - } - - exec_found = true; - // Cpoy the servant dll/so name. - // @@ Note: I ignore all the other locations except the first one. - exec_found = true; - impl_infos[i].executor_dll = - CORBA::string_dup (arti.location[0].in ()); + ACE_NEW (node_info_, ::Deployment::NodeImplementationInfo); + this->populate_server_resource_def (); + this->populate_container_impl_infos (); +} - // Get the entry point. - const CORBA::ULong prop_length = arti.execParameter.length (); - for (CORBA::ULong prop_num = 0; - prop_num < prop_length; - ++prop_num) - { - ACE_CString name (arti.execParameter[prop_num].name.in ()); - if (name == ACE_CString ("entryPoint")) - { - const char * entry; - (arti.execParameter[prop_num].value) >>= entry; - impl_infos[i].executor_entrypt = CORBA::string_dup (entry); - } - else - { - ACE_DEBUG ((LM_DEBUG, "Found unknown property in the artifact!\n")); - ACE_DEBUG ((LM_DEBUG, "We only support entrypoint at this point in CIAO.\n")); - } - } - } +Deployment::NodeImplementationInfo * +CIAO::NodeImplementationInfoHandler::node_impl_info (void) const +{ + Deployment::NodeImplementationInfo_var retv; + ACE_NEW_RETURN (retv, + Deployment::NodeImplementationInfo (this->node_info_.in ()), + 0); + return retv._retn (); +} - else - // We see artifact other than servant/executor and we ignore them. - continue; - } - } +void +CIAO::NodeImplementationInfoHandler::populate_server_resource_def (void) +{ + const CORBA::ULong instance_len = plan_.instance.length (); + const char * target_resource_id; + + CORBA::ULong i; + + // Iterate over the instance list to find whether any server resource + // has been specified + for (i = 0; i < instance_len; ++i) + { + if (this->plan_.instance[i].deployedResource.length () != 0) + { + target_resource_id = + this->plan_.instance[i].deployedResource[0].resourceName.in (); + break; + } + } + + if (i != instance_len) + { + // Some component instance has server resource usage defined, so we + // set the <nodeapp_config> field of the NodeImplementationInfo struct. + for (CORBA::ULong j = 0; j < this->plan_.infoProperty.length (); ++j) + { + CIAO::DAnCE::ServerResource *server_resource_def = 0; + this->plan_.infoProperty[j].value >>= server_resource_def; + + if (ACE_OS::strcmp ((*server_resource_def).Id, + target_resource_id) == 0) + { + // Found the target server resource def, and store it. + this->node_info_->nodeapp_config.length (1); + + this->node_info_->nodeapp_config[0].name = + CORBA::string_dup ("CIAOServerResource"); + + this->node_info_->nodeapp_config[0].value <<= + server_resource_def; + break; + } + } + } +} - container_info.impl_infos = impl_infos; - node_info[0] = container_info; +void +CIAO::NodeImplementationInfoHandler::populate_container_impl_infos (void) +{ + CORBA::ULong curr_len = this->containers_info_map_.containers_info ()->length (); - return 1; - } + // assignment operation + this->node_info_->impl_infos = + *(this->containers_info_map_.containers_info ()); } #endif /* CIAO_IMPLEMENTATION_INFO_CPP */ diff --git a/TAO/CIAO/DAnCE/NodeApplicationManager/ImplementationInfo.h b/TAO/CIAO/DAnCE/NodeApplicationManager/ImplementationInfo.h index a228f4eb68f..1c4825064a6 100644 --- a/TAO/CIAO/DAnCE/NodeApplicationManager/ImplementationInfo.h +++ b/TAO/CIAO/DAnCE/NodeApplicationManager/ImplementationInfo.h @@ -21,10 +21,11 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -//#include "Deployment_CoreS.h" -//#include "ace/os_types.h" #include "ciao/DeploymentC.h" #include "ace/SString.h" +#include "ace/Hash_Map_Manager.h" +#include "Containers_Info_Map.h" + //@@ I wish we could have precompiled header support soon!!! @@ -33,34 +34,28 @@ namespace CIAO { - bool operator<< (Deployment::NodeImplementationInfo & info, - const Deployment::DeploymentPlan & plan); -} - -/* -// Helper function to parse the property. -template < typename OUTPUT> -bool operator<< (OUTPUT & info, - const Deployment::Property & property); - -// Sepcialized for the entry point property -template < > -bool operator<< < TAO_String_Manager> - (TAO_String_Manager & info, - const Deployment::Property & property) -{ - const char * tmp; - if (property.value >>= tmp) - info = CORBA::string_duplicate (tmp); - else + class NodeImplementationInfoHandler { - ACE_DEBUG ((LM_DEBUG, "Property::value >>= TAO_String_Manager failed!\n")); - return 0; - } + public: + NodeImplementationInfoHandler (::Deployment::DeploymentPlan & plan); + + Deployment::NodeImplementationInfo * + node_impl_info (void) const; + + private: + Deployment::DeploymentPlan plan_; + + Deployment::NodeImplementationInfo_var node_info_; + + void populate_server_resource_def (void); + + void populate_container_impl_infos (void); - return 1; + /// Helper class that helps populate the container_impl_infos + /// field. + Containers_Info_Map containers_info_map_; + }; } -*/ //#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) //#include "ImplementationInfo.cpp" diff --git a/TAO/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager.mpc b/TAO/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager.mpc index 0adbadae578..f4c2b0dd4e7 100644 --- a/TAO/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager.mpc +++ b/TAO/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager.mpc @@ -10,5 +10,6 @@ project(NodeApplicationManager): ciao_server_dnc, ciao_deployment_svnt, ciao_dep Source_Files { NodeApplicationManager_Impl.cpp ImplementationInfo.cpp + Containers_Info_Map.cpp } } diff --git a/TAO/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.cpp b/TAO/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.cpp index cc199922beb..47f22999dca 100644 --- a/TAO/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.cpp +++ b/TAO/CIAO/DAnCE/NodeApplicationManager/NodeApplicationManager_Impl.cpp @@ -300,20 +300,24 @@ startLaunch (const Deployment::Properties & configProperty, * 5. get the provided connection endpoints back and return them. */ - Deployment::NodeImplementationInfo node_info; + NodeImplementationInfoHandler handler (this->plan_); + + Deployment::NodeImplementationInfo * node_info = + handler.node_impl_info (); - /* - * What does the << mean here?!? We need to clean this up! -Will - */ - if (!(node_info << (this->plan_))) - { - if (CIAO::debug_level () > 1) - ACE_DEBUG ((LM_DEBUG, "Failed to create Node Implementation Infos!\n")); + ACE_DEBUG ((LM_DEBUG, "********** NodeApplicationManager ***** step 1\n")); + + if (!node_info) + { + if (CIAO::debug_level () > 1) + ACE_DEBUG ((LM_DEBUG, "Failed to create Node Implementation Infos!\n")); + + ACE_THROW_RETURN (Deployment::StartError ("NodeApplicationManager_Imp::startLaunch", + "Unable to populate node level plan"), + Deployment::Application::_nil()); + } - ACE_THROW_RETURN (Deployment::StartError ("NodeApplicationManager_Imp::startLaunch", - "Unable to populate node level plan"), - Deployment::Application::_nil()); - } //@@ I am not sure about which exception to throw. I will come back to this. + ACE_DEBUG ((LM_DEBUG, "********** NodeApplicationManager ***** step 2\n")); // Now spawn the NodeApplication process. // @@TODO: we need to pass arguments to the nodeapplication, ie naming service endpoints, if necessary @@ -323,13 +327,14 @@ startLaunch (const Deployment::Properties & configProperty, create_node_application (cmd_option.c_str () ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - // This is what we will get back, a sequence of compoent object refs. - Deployment::ComponentInfos_var comp_info; // For debugging. if (true) //(CIAO::debug_level () > 1) { - Deployment::ComponentImplementationInfos infos = node_info[0].impl_infos; + CORBA::ULong curr_len = node_info->impl_infos.length (); + + Deployment::ComponentImplementationInfos infos = + ((node_info->impl_infos)[0]).impl_infos; const CORBA::ULong info_len = infos.length (); for (CORBA::ULong i = 0; i < info_len; ++i) @@ -342,10 +347,12 @@ startLaunch (const Deployment::Properties & configProperty, infos[i].servant_entrypt.in () )); } } - + + // This is what we will get back, a sequence of compoent object refs. + Deployment::ComponentInfos_var comp_info; // This will install all homes and components. - comp_info = this->nodeapp_->install (node_info ACE_ENV_ARG_PARAMETER); + comp_info = this->nodeapp_->install (*node_info ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; // Now fill in the map we have for the components. diff --git a/TAO/CIAO/DAnCE/tests/NodeApplicationTest/NodeApp_test_client.cpp b/TAO/CIAO/DAnCE/tests/NodeApplicationTest/NodeApp_test_client.cpp index 3be2416cb47..49688375063 100644 --- a/TAO/CIAO/DAnCE/tests/NodeApplicationTest/NodeApp_test_client.cpp +++ b/TAO/CIAO/DAnCE/tests/NodeApplicationTest/NodeApp_test_client.cpp @@ -181,9 +181,9 @@ main (int argc, char *argv[]) // Create a NodeImplementationInfo sequence Deployment::NodeImplementationInfo node_info; - node_info.length (2); - node_info[0] = container_info_1; - node_info[1] = container_info_2; + node_info.impl_infos.length (2); + node_info.impl_infos[0] = container_info_1; + node_info.impl_infos[1] = container_info_2; // Install test component and its home on NodeApplication Deployment::ComponentInfos_var comp_info = diff --git a/TAO/CIAO/DAnCE/tests/NodeApplicationTest/NodeApp_test_client_ex.cpp b/TAO/CIAO/DAnCE/tests/NodeApplicationTest/NodeApp_test_client_ex.cpp index 64db9fcd240..b3a7abf3451 100644 --- a/TAO/CIAO/DAnCE/tests/NodeApplicationTest/NodeApp_test_client_ex.cpp +++ b/TAO/CIAO/DAnCE/tests/NodeApplicationTest/NodeApp_test_client_ex.cpp @@ -89,8 +89,8 @@ main (int argc, char *argv[]) // Create a NodeImplementationInfo sequence Deployment::NodeImplementationInfo node_info; - node_info.length (1); - node_info[0] = container_info; + node_info.impl_infos.length (1); + node_info.impl_infos[0] = container_info; // Install test component and its home on NodeApplication Deployment::ComponentInfos_var comp_info = diff --git a/TAO/CIAO/DAnCE/tests/NodeApplicationTest/NodeApp_test_client_simple.cpp b/TAO/CIAO/DAnCE/tests/NodeApplicationTest/NodeApp_test_client_simple.cpp index b96403cc0a1..c00b3a9fcac 100644 --- a/TAO/CIAO/DAnCE/tests/NodeApplicationTest/NodeApp_test_client_simple.cpp +++ b/TAO/CIAO/DAnCE/tests/NodeApplicationTest/NodeApp_test_client_simple.cpp @@ -89,8 +89,8 @@ main (int argc, char *argv[]) // Create a NodeImplementationInfo sequence Deployment::NodeImplementationInfo node_info; - node_info.length (1); - node_info[0] = container_info; + node_info.impl_infos.length (1); + node_info.impl_infos[0] = container_info; // Install test component and its home on NodeApplication Deployment::ComponentInfos_var comp_info = diff --git a/TAO/CIAO/ciao/Deployment.idl b/TAO/CIAO/ciao/Deployment.idl index b09b9c3faf6..f37d71aa520 100644 --- a/TAO/CIAO/ciao/Deployment.idl +++ b/TAO/CIAO/ciao/Deployment.idl @@ -1,5 +1,6 @@ // $Id$ #include "Packaging_Data.idl" +#include "ServerResources.idl" module Deployment { diff --git a/TAO/CIAO/ciao/Deployment_Core.idl b/TAO/CIAO/ciao/Deployment_Core.idl index 3e087e0d15c..023c413b1fc 100644 --- a/TAO/CIAO/ciao/Deployment_Core.idl +++ b/TAO/CIAO/ciao/Deployment_Core.idl @@ -112,7 +112,13 @@ module Deployment Properties container_config; }; - typedef sequence <ContainerImplementationInfo> NodeImplementationInfo; + typedef sequence <ContainerImplementationInfo> ContainerImplementationInfos; + + struct NodeImplementationInfo + { + ContainerImplementationInfos impl_infos; + Properties nodeapp_config; + }; //================================== interface Application diff --git a/TAO/CIAO/ciao/NodeApplication_Impl.cpp b/TAO/CIAO/ciao/NodeApplication_Impl.cpp index dd8942e7d16..266b4e7bff5 100644 --- a/TAO/CIAO/ciao/NodeApplication_Impl.cpp +++ b/TAO/CIAO/ciao/NodeApplication_Impl.cpp @@ -22,13 +22,13 @@ CIAO::NodeApplication_Impl::init (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) CORBA::Long CIAO::NodeApplication_Impl::create_all_containers ( - const ::Deployment::NodeImplementationInfo & node_impl_info + const ::Deployment::ContainerImplementationInfos & container_infos ACE_ENV_ARG_DECL_NOT_USED ) ACE_THROW_SPEC ((CORBA::SystemException)) { // Create all the containers here based on the input node_impl_info. - const CORBA::ULong len = node_impl_info.length (); + const CORBA::ULong len = container_infos.length (); for (CORBA::ULong i = 0; i < len; ++i) { @@ -38,7 +38,7 @@ CIAO::NodeApplication_Impl::create_all_containers ( // Also, the factory method will add the container object reference // to the set for us. ::Deployment::Container_var cref = - this->create_container (node_impl_info[i].container_config); + this->create_container (container_infos[i].container_config); } return 0; @@ -211,6 +211,9 @@ CIAO::NodeApplication_Impl::install ( Deployment::ComponentInfos_var retv; ACE_TRY { + const ::Deployment::ContainerImplementationInfos container_infos = + node_impl_info.impl_infos; + ACE_NEW_THROW_EX (retv, Deployment::ComponentInfos, CORBA::NO_MEMORY ()); @@ -219,17 +222,17 @@ CIAO::NodeApplication_Impl::install ( retv->length (0UL); // Call create_all_containers to create all the necessary containers.. - (void) this->create_all_containers (node_impl_info); + (void) this->create_all_containers (container_infos); // For each container, invoke <install> operation, this will return // the ComponentInfo for components installed in each container. // Merge all the returned ComponentInfo, which will be used // as the return value of this method. - const CORBA::ULong num_containers = node_impl_info.length (); + const CORBA::ULong num_containers = container_infos.length (); for (CORBA::ULong i = 0; i < num_containers; ++i) { Deployment::ComponentInfos_var comp_infos = - this->container_set_.at(i)->install (node_impl_info[i] + this->container_set_.at(i)->install (container_infos[i] ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; diff --git a/TAO/CIAO/ciao/NodeApplication_Impl.h b/TAO/CIAO/ciao/NodeApplication_Impl.h index 133ac3a697e..b16e8931ccb 100644 --- a/TAO/CIAO/ciao/NodeApplication_Impl.h +++ b/TAO/CIAO/ciao/NodeApplication_Impl.h @@ -188,7 +188,7 @@ namespace CIAO protected: /// Create and initialize all the containers virtual CORBA::Long create_all_containers ( - const ::Deployment::NodeImplementationInfo & node_impl_info + const ::Deployment::ContainerImplementationInfos & container_infos ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); diff --git a/TAO/CIAO/ciao/ServerResources.idl b/TAO/CIAO/ciao/ServerResources.idl index 3e90b2dfedf..726bb1f8a12 100644 --- a/TAO/CIAO/ciao/ServerResources.idl +++ b/TAO/CIAO/ciao/ServerResources.idl @@ -227,6 +227,8 @@ module CIAO struct ServerResource { + string Id; + CommandlineArgs args; SvcconfURI svcconf; ORBConfigs orb_config; diff --git a/TAO/CIAO/examples/Hello/descriptors/flattened_deploymentplan_without_ns.cdp b/TAO/CIAO/examples/Hello/descriptors/flattened_deploymentplan_without_ns.cdp index 2d9b73b5abc..0b40fc1a265 100644 --- a/TAO/CIAO/examples/Hello/descriptors/flattened_deploymentplan_without_ns.cdp +++ b/TAO/CIAO/examples/Hello/descriptors/flattened_deploymentplan_without_ns.cdp @@ -81,7 +81,7 @@ <instance id="Hello-Receiver-idd"> <name>Hello-Receiver-idd</name> - <node>ReceiverNode</node> + <node>SenderNode</node> <source><!-- @@ What goes here --></source> <implementation>Hello-Receiver-mdd</implementation> <configProperty> diff --git a/TAO/CIAO/examples/Hello/descriptors/rt-config-example.cdp b/TAO/CIAO/examples/Hello/descriptors/rt-config-example.cdp new file mode 100644 index 00000000000..962a24062a8 --- /dev/null +++ b/TAO/CIAO/examples/Hello/descriptors/rt-config-example.cdp @@ -0,0 +1,215 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no" ?> +<Deployment:deploymentPlan + xmlns:Deployment="http://www.omg.org/Deployment" + xmlns:xmi="http://www.omg.org/XMI" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.omg.org/Deployment Modified_Deployment.xsd"> + + <label>Hello-DeploymentPlan</label> + + <UUID>Hello_Plan_UUID_0001</UUID> + + <realizes> + <label>BasicSP-realizes-cid</label> + <UUID>c0965470-7b83-11d9-9669-0800200c9a66</UUID> + <specificType/> + <supportedType>IDL:Hello/Sender:1.0</supportedType> + <port> + <name>read_message</name> + <specificType>IDL:Hello/ReadMessage:1.0</specificType> + <supportedType>IDL:Hello/ReadMessage:1.0</supportedType> + <provider>false</provider> + <exclusiveProvider>false</exclusiveProvider> + <exclusiveUser>true</exclusiveUser> + <optional>false</optional> + <kind>SimplexReceptacle</kind> + </port> + </realizes> + + <implementation id="Hello-Sender-mdd"> + <name>Hello-Sender-mdd</name> + <source/> + <artifact>Hello-Sender_exec</artifact> + <artifact>Hello-Sender_svnt</artifact> + </implementation> + + <implementation id="Hello-Receiver-mdd"> + <name>Hello-Receiver-mdd</name> + <source/> + <artifact>Hello-Receiver_exec</artifact> + <artifact>Hello-Receiver_svnt</artifact> + </implementation> + + <instance id="Hello-Sender-idd"> + <name>Hello-Sender-idd</name> + <node>SenderNode</node> + <source/> + <implementation>Hello-Sender-mdd</implementation> + <configProperty> + <name>ComponentIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Sender.ior</string> + </value> + </value> + </configProperty> + <configProperty> + <name>local_message</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>This is a test message passed in through XML.</string> + </value> + </value> + </configProperty> + <deployedResource> + <resourceUsage>InstanceUsesResource</resourceUsage> + <requirementName>CIAO:PolicySet</requirementName> + <resourceName>test_policy_set_id</resourceName> + <resourceValue> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>test_server_resource_id</string> + </value> + </resourceValue> + </deployedResource> + </instance> + + <instance id="Hello-Receiver-idd"> + <name>Hello-Receiver-idd</name> + <node>ReceiverNode</node> + <source/> + <implementation>Hello-Receiver-mdd</implementation> + <configProperty> + <name>ComponentIOR</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>Receiver.ior</string> + </value> + </value> + </configProperty> + </instance> + + <connection> + <name>hell_event_connection</name> + <internalEndpoint> + <portName>click_out</portName> + <kind>EventPublisher</kind> + <instance>Hello-Sender-idd</instance> + </internalEndpoint> + <internalEndpoint> + <portName>click_in</portName> + <kind>EventConsumer</kind> + <instance>Hello-Receiver-idd</instance> + </internalEndpoint> + </connection> + + <connection> + <name>hello_facet_connection</name> + <internalEndpoint> + <portName>push_message</portName> + <kind>Facet</kind> + <instance>Hello-Sender-idd</instance> + </internalEndpoint> + <internalEndpoint> + <portName>read_message</portName> + <kind>SimplexReceptacle</kind> + <instance>Hello-Receiver-idd</instance> + </internalEndpoint> + </connection> + + <artifact id="Hello-Sender_exec"> + <name>Sender_exec</name> + <source/> + <node/> + <location>Sender_DnC_exec</location> + <execParameter> + <name>entryPoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>createSenderHome_Impl</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact id="Hello-Sender_svnt"> + <name>Sender_svnt</name> + <source/> + <node/> + <location>Sender_DnC_svnt</location> + <execParameter> + <name>entryPoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>createSenderHome_Servant</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact id="Hello-Receiver_exec"> + <name>Receiver_exec</name> + <source/> + <node/> + <location>Receiver_DnC_exec</location> + <execParameter> + <name>entryPoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>createReceiverHome_Impl</string> + </value> + </value> + </execParameter> + </artifact> + + <artifact id="Hello-Receiver_svnt"> + <name>Receiver_svnt</name> + <source/> + <node/> + <location>Receiver_DnC_svnt</location> + <execParameter> + <name>entryPoint</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>createReceiverHome_Servant</string> + </value> + </value> + </execParameter> + </artifact> + + <infoProperty> + <name>CIAOServerResources</name> + <value> + <type> + <kind>tk_string</kind> + </type> + <value> + <string>rt-config-example.csr</string> + </value> + </value> + </infoProperty> + +</Deployment:deploymentPlan> diff --git a/TAO/CIAO/examples/Hello/descriptors/rt-config-example.csr b/TAO/CIAO/examples/Hello/descriptors/rt-config-example.csr new file mode 100644 index 00000000000..a3881225930 --- /dev/null +++ b/TAO/CIAO/examples/Hello/descriptors/rt-config-example.csr @@ -0,0 +1,70 @@ + +<CIAO:ServerResources + xmlns:CIAO="http://www.dre.vanderbilt.edu/ServerResources" + xmlns:xmi="http://www.omg.org/XMI" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.dre.vanderbilt.edu/ServerResources CIAOServerResources.xsd"> + + <cmdline> + <arg> -ORBDebugLevel 10 -ORBEndpoint corbaloc://foo/bar</arg> + </cmdline> + + <svcconf> + <uri> + svcconf.uri + </uri> + </svcconf> + + <orbConfigs> + <resources> + <threadpool id="threadpool-1"> + <stacksize>100</stacksize> + <static_threads>50</static_threads> + <dynamic_threads>25</dynamic_threads> + <default_priority>5</default_priority> + <allow_request_buffering>true</allow_request_buffering> + <max_buffered_requests>10</max_buffered_requests> + <max_request_buffered_size>20</max_request_buffered_size> + </threadpool> + + <threadpoolWithLanes id="threadpool-2"> + <threadpoolLane> + <static_threads>50</static_threads> + <dynamic_threads>25</dynamic_threads> + <priority>36</priority> + </threadpoolLane> + <stacksize>100</stacksize> + <allow_borrowing>true</allow_borrowing> + <allow_request_buffering>true</allow_request_buffering> + <max_buffered_requests>10</max_buffered_requests> + <max_request_buffered_size>20</max_request_buffered_size> + </threadpoolWithLanes> + + <connectionBands id="cb-1"> + <band> + <low>0</low> + <high>10</high> + </band> + <band> + <low>11</low> + <high>20</high> + </band> + </connectionBands> + </resources> + + <policySet id="test_policy_set_id"> + <priorityModel server_priority="10"> + <priority_model>SERVER_DECLARED</priority_model> + </priorityModel> + <priorityModel> + <priority_model>CLIENT_PROPAGATED</priority_model> + </priorityModel> + + <threadpool>threadpool-1</threadpool> + <threadpool>threadpool-2</threadpool> + + <priorityBandedConnection>cb-1</priorityBandedConnection> + + </policySet> + </orbConfigs> +</CIAO:ServerResources>
\ No newline at end of file |