summaryrefslogtreecommitdiff
path: root/CIAO/DAnCE/TargetManager
diff options
context:
space:
mode:
Diffstat (limited to 'CIAO/DAnCE/TargetManager')
-rw-r--r--CIAO/DAnCE/TargetManager/CmpClient.cpp311
-rw-r--r--CIAO/DAnCE/TargetManager/DomainDataManager.cpp664
-rw-r--r--CIAO/DAnCE/TargetManager/DomainDataManager.h291
-rw-r--r--CIAO/DAnCE/TargetManager/DomainEvents.idl25
-rw-r--r--CIAO/DAnCE/TargetManager/ResourceCommitmentManager.cpp52
-rw-r--r--CIAO/DAnCE/TargetManager/ResourceCommitmentManager.h63
-rw-r--r--CIAO/DAnCE/TargetManager/TM_Client.mpc21
-rw-r--r--CIAO/DAnCE/TargetManager/TargetManager.cidl27
-rw-r--r--CIAO/DAnCE/TargetManager/TargetManager.mpc63
-rw-r--r--CIAO/DAnCE/TargetManager/TargetManagerExt.idl84
-rw-r--r--CIAO/DAnCE/TargetManager/TargetManagerImpl.idl32
-rw-r--r--CIAO/DAnCE/TargetManager/TargetManager_exec.cpp277
-rw-r--r--CIAO/DAnCE/TargetManager/TargetManager_exec.h150
-rw-r--r--CIAO/DAnCE/TargetManager/TargetManager_exec_export.h54
-rw-r--r--CIAO/DAnCE/TargetManager/TargetManager_stub_export.h54
-rw-r--r--CIAO/DAnCE/TargetManager/TargetManager_svnt_export.h54
-rw-r--r--CIAO/DAnCE/TargetManager/descriptors/Domain.cdd101
-rw-r--r--CIAO/DAnCE/TargetManager/descriptors/NodeDetails.dat2
-rw-r--r--CIAO/DAnCE/TargetManager/descriptors/NodeManagerMap.dat2
-rw-r--r--CIAO/DAnCE/TargetManager/descriptors/flattened_deploymentplan.cdp92
-rw-r--r--CIAO/DAnCE/TargetManager/descriptors/run_test_TargetManager.pl160
21 files changed, 2579 insertions, 0 deletions
diff --git a/CIAO/DAnCE/TargetManager/CmpClient.cpp b/CIAO/DAnCE/TargetManager/CmpClient.cpp
new file mode 100644
index 00000000000..de1e60fb29d
--- /dev/null
+++ b/CIAO/DAnCE/TargetManager/CmpClient.cpp
@@ -0,0 +1,311 @@
+// $Id$
+/**
+ * @file CmpClient.cpp
+ *
+ * @brief This file contains a client of TargetManager.
+ *
+ * It picks up the TM ior from the Targetmanager.ior file
+ * present in the current directory, and makes the calls on the
+ * TM to getAllResources and getAvailable resources
+ */
+
+#include "DAnCE/Deployment/Deployment_DataC.h"
+#include "DAnCE/Deployment/Deployment_ResourceCommitmentManagerC.h"
+#include "DAnCE/TargetManager/TargetManagerImplC.h"
+#include "ace/streams.h"
+#include "ace/FILE_IO.h"
+#include "ace/FILE_Connector.h"
+#include "ace/FILE_Addr.h"
+#include "ace/Get_Opt.h"
+#include "Config_Handlers/DnC_Dump.h"
+
+/**
+ * TM_Tester contains the code to test the TM Component
+ */
+namespace TM_Tester
+{
+ /**
+ * writes the extracted data to file
+ */
+ void write_to_file (::Deployment::Domain domain);
+
+ /// variable contains IOR of the TM
+ const char * stringified_TM_IOR;
+
+ /// if add or delete from domain
+ bool add_to_domain = true;
+
+ /// whether to test update domain or not
+ bool call_update = false;
+
+ /// contains the host name
+ const char * host_name;
+
+ /// parses the arguments and extracts the params
+ bool parse_args (int argc, char *argv[])
+ {
+ ACE_Get_Opt get_opts (argc, argv, "t:u:d");
+ int c;
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 't':
+ stringified_TM_IOR = get_opts.opt_arg ();
+ break;
+ case 'u':
+ host_name = get_opts.opt_arg ();
+ call_update = true;
+ break;
+ case 'd':
+ add_to_domain = false;
+ break;
+ case '?': // display help for use of the server.
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s\n"
+ "-t <TM_IOR>\n"
+ "-u <host_name in update>\n"
+ "-n <delete , default add>\n"
+ "\n",
+ argv [0]),
+ false);
+ }
+
+ return true;
+ }
+}
+
+ /// The main function
+ int main (int argc, char* argv[])
+ {
+ try {
+ // First initialize the ORB, that will remove some arguments...
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc, argv,
+ "" /* the ORB name, it can be anything! */);
+
+ if (!TM_Tester::parse_args (argc, argv))
+ return -1;
+
+ // Use the first argument to create the factory object reference,
+ // in real applications we use the naming service, but let's do
+ // the easy part first!
+ CORBA::Object_var factory_object =
+ orb->string_to_object (TM_Tester::stringified_TM_IOR);
+
+ // Now downcast the object reference to the appropriate type
+ CIAO::TargetManagerImpl_var targetCmp =
+ CIAO::TargetManagerImpl::_narrow (factory_object.in ());
+
+ // Now get the facet reference from the target Manager Component
+ Deployment::TargetManager_ptr targetI = targetCmp->provide_targetMgr ();
+
+ // Now make calls on the Target Manager facet
+
+ try
+ {
+ Deployment::Domain_var domainV = targetI->getAllResources ();
+ ::Deployment::DnC_Dump::dump (domainV);
+ }
+ catch(CORBA::NO_IMPLEMENT &)
+ {
+ ACE_ERROR ((LM_ERROR ,"Error:TargetManager:CORBA::NO_IMPLEMENT thrown\n"));
+ }
+ catch(CORBA::Exception &)
+ {
+ ACE_ERROR ((LM_ERROR ,"Error:TargetManager:CORBA Generic Exception \n"));
+ ACE_ERROR ((LM_ERROR ,"Error:TargetManager:Exception in TargetManager call\n"));
+ }
+
+
+ // make a call to the commit resources .....
+
+ bool resource_available = true;
+
+ ::Deployment::ResourceAllocations resource_seq;
+
+ resource_seq.length (1);
+
+ resource_seq[0].elementName = CORBA::string_dup ("TargetManagerNode_1");
+
+ resource_seq[0].resourceName = CORBA::string_dup ("Processor");
+
+ resource_seq[0].property.length (1);
+ resource_seq[0].property[0].name =
+ CORBA::string_dup ("LoadAverage");
+
+ CORBA::Long d = 20;
+ resource_seq[0].property[0].value <<= d;
+
+ ::Deployment::ResourceCommitmentManager_ptr manager =
+ ::Deployment::ResourceCommitmentManager::_nil ();
+
+ try
+ {
+ manager = targetI->createResourceCommitment (resource_seq);
+
+ manager->commitResources (resource_seq);
+
+ }
+ catch(CORBA::NO_IMPLEMENT &)
+ {
+ ACE_ERROR ((LM_ERROR, "Error:TargetManager:CORBA::NO_IMPLEMENT thrown\n"));
+ }
+ catch (::Deployment::ResourceCommitmentFailure& e)
+ {
+ resource_available = 0;
+ ACE_ERROR ((LM_ERROR, "TargetManager commitResources ResourceCommitmentFailure Exception\n"));
+
+ ACE_ERROR ((LM_ERROR ,
+ "ResourceCommitmentFailure\n reason=[%s]\n elementName=[%s]\n resourceName=[%s]\n propertyName=[%s]\n",
+ e.reason.in (),
+ resource_seq[e.index].elementName.in (),
+ resource_seq[e.index].resourceName.in (),
+ e.propertyName.in ()));
+ }
+ catch(const CORBA::Exception &)
+ {
+ ACE_ERROR ((LM_ERROR, "Error:TargetManager:commitResources Exception\n"));
+ ACE_ERROR ((LM_ERROR, "Error:TargetManager:CORBA Generic Exception\n"));
+ ACE_ERROR ((LM_ERROR, "Error:TargetManager:Exception in TargetManager call"));
+ }
+
+ // Make a call to release resources , if resource < 0
+ try
+ {
+ {
+ d = 10;
+ resource_seq[0].property[0].value <<= d;
+ manager->releaseResources (resource_seq);
+ }
+ }
+ catch(const CORBA::NO_IMPLEMENT &)
+ {
+ ACE_ERROR ((LM_ERROR, "Error:TargetManager:CORBA::NO_IMPLEMENT thrown\n"));
+ }
+ catch (const Deployment::ResourceCommitmentFailure&)
+ {
+ ACE_ERROR ((LM_ERROR, "Error:TargetManager releaseResources ResourceNotAvailable Exception\n"));
+ }
+ catch(const CORBA::Exception &)
+ {
+ ACE_ERROR ((LM_ERROR, "Error:TargetManager:releaseResources Exception\n"));
+ ACE_ERROR ((LM_ERROR, "Error:TargetManager:CORBA Generic Exception\n"));
+ ACE_ERROR ((LM_ERROR, "Error:TargetManager:Exception in TargetManager call"));
+ }
+
+ // Here make a call on the TM with update domain and node deletion
+
+ ::Deployment::Domain updated;
+ updated.node.length (1);
+ updated.node[0].name = CORBA::string_dup (TM_Tester::host_name);
+
+ ::CORBA::StringSeq elements;
+ elements.length (0);
+
+
+ if (TM_Tester::call_update)
+ {
+ if (TM_Tester::add_to_domain)
+ {
+ try
+ {
+ targetI->updateDomain (elements , updated, ::Deployment::Add);
+ }
+ catch(CORBA::NO_IMPLEMENT &)
+ {
+ ACE_ERROR ((LM_ERROR, "Error:TargetManager:CORBA::NO_IMPLEMENT thrown\n"));
+ }
+ catch(CORBA::Exception &)
+ {
+ ACE_ERROR ((LM_ERROR, "Error:TargetManager:CORBA Generic Exception\n"));
+ ACE_ERROR ((LM_ERROR, "Error:TargetManager:Exception in UpdateDomain call"));
+ }
+ }
+ else
+ {
+ try
+ {
+ targetI->updateDomain (elements , updated, ::Deployment::Delete);
+ }
+ catch(CORBA::NO_IMPLEMENT &)
+ {
+ ACE_ERROR ((LM_ERROR, "Error:TargetManager:CORBA::NO_IMPLEMENT thrown\n"));
+ }
+ catch(CORBA::Exception &)
+ {
+ ACE_ERROR ((LM_ERROR, "Error:TargetManager:CORBA Generic Exception\n"));
+ ACE_ERROR ((LM_ERROR, "Error:TargetManager:Exception in UpdateDomain call"));
+ }
+ }
+ }
+
+ // Now make a call of getAvailableResources on the TargetManager ...
+ try
+ {
+ Deployment::Domain_var domainV = targetI->getAvailableResources();
+
+ // here write things to file ...
+ TM_Tester::write_to_file (domainV.in());
+
+ ::Deployment::DnC_Dump::dump (domainV);
+ }
+ catch(CORBA::NO_IMPLEMENT &)
+ {
+ ACE_ERROR ((LM_ERROR, "Error:TargetManager:CORBA::NO_IMPLEMENT thrown\n"));
+ }
+ catch(CORBA::Exception &)
+ {
+ ACE_ERROR ((LM_ERROR ,"Error:TargetManager:CORBA Generic Exception\n"));
+ ACE_ERROR ((LM_ERROR, "Error:TargetManager:Exception in TargetManager call\n"));
+ }
+
+ // Finally destroy the ORB
+ orb->destroy ();
+ }
+ catch (CORBA::Exception &)
+ {
+ ACE_ERROR ((LM_ERROR, "Error:TargetManager:CORBA exception raised!\n"));
+ }
+ return 0;
+ }
+
+namespace TM_Tester
+{
+ void write_to_file (::Deployment::Domain domain)
+ {
+ for (size_t i = 0;i < domain.node.length ();i++)
+ {
+ std::ofstream out (domain.node[i].name.in ());
+
+
+ // write in the node usage ...
+ for (size_t j = 0;j < domain.node[i].resource.length ();j++)
+ {
+
+ if (!strcmp (domain.node[i].resource[j].name.in (), "Processor"))
+ {
+ CORBA::Double node_cpu;
+ domain.node[i].resource[j].property[0].value >>= node_cpu;
+ out << node_cpu << std::endl;
+ }
+ if (!strcmp (domain.node[i].resource[j].name.in (), "NA_Monitor"))
+ {
+ std::string file_name = "NA_";
+ file_name += domain.node[i].name.in ();
+ ACE_FILE_IO file_io;
+ ACE_FILE_Connector (file_io, ACE_FILE_Addr (file_name.c_str ()));
+ CORBA::Double na_node_cpu;
+ domain.node[i].resource[j].property[0].value >>= na_node_cpu;
+ char buf[BUFSIZ];
+ memset (buf , 0 , BUFSIZ);
+ ACE_OS::sprintf (buf , "%f", na_node_cpu);
+ file_io.send (buf, ACE_OS::strlen (buf));
+ }
+ }
+
+ out.close ();
+ }
+
+ }
+}
diff --git a/CIAO/DAnCE/TargetManager/DomainDataManager.cpp b/CIAO/DAnCE/TargetManager/DomainDataManager.cpp
new file mode 100644
index 00000000000..69ca5d6b9c7
--- /dev/null
+++ b/CIAO/DAnCE/TargetManager/DomainDataManager.cpp
@@ -0,0 +1,664 @@
+// $Id$
+#include "DomainDataManager.h"
+
+#include "Config_Handlers/DD_Handler.h"
+#include "Config_Handlers/DnC_Dump.h"
+#include "ciao/CIAO_common.h"
+
+const char * domain_file_name = "Domain.cdd";
+
+CIAO::DomainDataManager* CIAO::DomainDataManager::global_data_manager_ = 0;
+
+CIAO::DomainDataManager * CIAO::DomainDataManager::create (CORBA::ORB_ptr orb,
+ ::Deployment::TargetManager_ptr target
+ )
+{
+ if (global_data_manager_ == 0)
+ {
+ global_data_manager_ = new DomainDataManager (orb , target);
+ }
+ return global_data_manager_;
+}
+
+// Returns the pointer to the static variable
+CIAO::DomainDataManager*
+CIAO::DomainDataManager::get_data_manager ()
+{
+ return global_data_manager_;
+}
+
+
+void
+CIAO::DomainDataManager::delete_data_manger ()
+{
+ if (global_data_manager_)
+ delete global_data_manager_;
+}
+
+int CIAO::DomainDataManager::update_domain (
+ const ::CORBA::StringSeq &,
+ const ::Deployment::Domain & domainSubset,
+ ::Deployment::DomainUpdateKind update_kind)
+{
+ // Update the subset of the domain which the above
+ // parameter corresponds to
+
+
+ //check the type of update ..
+
+ switch (update_kind)
+ {
+ case ::Deployment::UpdateAll:
+ case ::Deployment::UpdateDynamic:
+ break;
+ case ::Deployment::Add:
+ add_to_domain (domainSubset);
+ break;
+ case ::Deployment::Delete:
+ delete_from_domain (domainSubset);
+ break;
+ default:
+ break;
+ }
+
+ CORBA::ULong const size = current_domain_.node.length ();
+
+ CORBA::ULong i;
+ for (i=0;i < size;i++)
+ {
+ if (!ACE_OS::strcmp (domainSubset.node[0].name ,
+ current_domain_.node[i].name))
+ {
+ // found a match
+ // for now overwrite the entire Node info ...
+ // but later , this has to be changed to overwrite
+ // only the specific part ...
+ current_domain_.node[i] = domainSubset.node[0];
+ break; // finished job ...break
+ }
+ }
+
+ if (i == size)
+ {
+ // thus the node is new .. add it to current_domain_
+ // later change it ...
+ current_domain_.node.length (size+1);
+ current_domain_.node[size]=domainSubset.node[0];
+ }
+ return 0;
+}
+
+CIAO::DomainDataManager::
+DomainDataManager (CORBA::ORB_ptr orb,
+ ::Deployment::TargetManager_ptr target)
+ : orb_ (CORBA::ORB::_duplicate (orb)),
+ deployment_config_ (orb_.in()),
+ target_mgr_ (::Deployment::TargetManager::_duplicate(target))
+{
+ CIAO::Config_Handlers::DD_Handler dd (domain_file_name);
+ ::Deployment::Domain* dmn = dd.domain_idl ();
+
+ if (CIAO::debug_level () > 9)
+ ::Deployment::DnC_Dump::dump (*dmn);
+
+ current_domain_ = *dmn;
+ initial_domain_ = current_domain_;
+
+ // initialize the provisioning domain
+ provisioned_data_ = initial_domain_;
+
+ update_node_status ();
+
+ call_all_node_managers ();
+}
+
+::Deployment::Domain* CIAO::DomainDataManager::get_current_domain ()
+{
+ return new ::Deployment::Domain (provisioned_data_);
+}
+
+::Deployment::Domain* CIAO::DomainDataManager::get_initial_domain ()
+{
+ return new ::Deployment::Domain (initial_domain_);
+}
+
+int CIAO::DomainDataManager::readin_domain_data ()
+{
+ // here read in Domain data ...
+ //
+ return 0;
+}
+
+int CIAO::DomainDataManager::call_all_node_managers ()
+{
+ if ( this->deployment_config_.init ("NodeDetails.dat") == -1 )
+ {
+ ACE_ERROR ((LM_ERROR,
+ "TargetM (%P|%t) DomainDataManager.cpp -"
+ "CIAO::DomainDataManager::call_all_node_managers -"
+ "ERROR while trying to initialize after reading "
+ "node details DAT file \n"));
+ return 0;
+ }
+
+ CORBA::ULong const length = initial_domain_.node.length ();
+
+ for (CORBA::ULong i=0;i < length;i++)
+ {
+
+ ::Deployment::NodeManager_var node_manager;
+
+ try
+ {
+ node_manager =
+ deployment_config_.get_node_manager
+ (initial_domain_.node[i].name.in ());
+ }
+ catch (CORBA::Exception&)
+ {
+ ACE_ERROR ((LM_ERROR, "DANCE::TM (%P|%t) DomainDataManager.cpp: "
+ "Error trying to contact NodeManager %s\n",
+ initial_domain_.node[i].name.in ()));
+ continue;
+ }
+
+
+ if (!CORBA::is_nil (node_manager.in ()))
+ {
+ Deployment::Logger_ptr log =
+ Deployment::Logger::_nil ();
+ ::Deployment::Domain sub_domain;
+ sub_domain.UUID = CORBA::string_dup("Node-Level-domain");
+ sub_domain.label = CORBA::string_dup("Node-level-domain");
+ sub_domain.sharedResource.length(0);
+ sub_domain.interconnect.length(0);
+ sub_domain.bridge.length(0);
+ sub_domain.infoProperty.length(0);
+ sub_domain.node.length (1);
+ sub_domain.node[0] = initial_domain_.node[i];
+ try
+ {
+ node_manager->joinDomain (sub_domain,
+ target_mgr_.in (),
+ log);
+ }
+ catch (CORBA::Exception& ex)
+ {
+ ACE_ERROR ((LM_ERROR , "TM::Error in calling Join Domain==\n"));
+ ex._tao_print_exception (
+ "Exception caught in ""DomainDataManager::joinDomain");
+ }
+ }
+ }
+ return 0;
+
+}
+
+
+void CIAO::DomainDataManager
+::commitResources (
+ const ::Deployment::DeploymentPlan & plan)
+{
+ // commit the resources
+ // parse into the plan and commit resources ...
+
+ // set the action value
+ current_action_ = commit;
+
+ // temporary created to guard against exceptions
+ ::Deployment::Domain temp_provisioned_data =
+ provisioned_data_;
+
+ for (CORBA::ULong i = 0;i < plan.instance.length ();i++)
+ {
+ for (CORBA::ULong j = 0;j < temp_provisioned_data.node.length ();j++)
+ {
+ if (!ACE_OS::strcmp (plan.instance[i].node.in () ,
+ temp_provisioned_data.node[j].name.in ()))
+ {
+ try {
+ match_requirement_resource (
+ plan.instance[i].deployedResource,
+ temp_provisioned_data.node[j].resource);
+ }
+ catch (::Deployment::ResourceCommitmentFailure& ex)
+ {
+ // catch the exception and add parameters
+ throw ex;
+ }
+ }
+ }
+ }
+
+ // here commit the commitresources
+ provisioned_data_ = temp_provisioned_data;
+}
+
+
+void CIAO::DomainDataManager::
+releaseResources (
+ const ::Deployment::DeploymentPlan& plan)
+{
+ // release the resources
+
+
+ // set the action value
+ current_action_ = release;
+
+ for (CORBA::ULong i = 0;i < plan.instance.length ();i++)
+ {
+ for (CORBA::ULong j = 0;j < provisioned_data_.node.length ();j++)
+ {
+ if (!ACE_OS::strcmp (plan.instance[i].node.in () ,
+ provisioned_data_.node[j].name.in ()))
+ {
+ match_requirement_resource (
+ plan.instance[i].deployedResource,
+ provisioned_data_.node[j].resource);
+
+ }
+ }
+ }
+
+}
+
+
+void CIAO::DomainDataManager::
+match_requirement_resource (
+ ::Deployment::InstanceResourceDeploymentDescriptions deployed,
+ ::Deployment::Resources & available
+ )
+{
+ // here match the deployed to the available
+
+ for (CORBA::ULong i = 0;i < deployed.length ();i++)
+ {
+ // for each deployed resource ....search the corresponding
+ // available resource
+ for (CORBA::ULong j = 0;j < available.length ();j++)
+ {
+ if (!ACE_OS::strcmp (deployed[i].requirementName, available[j].name))
+ {
+ if (CIAO::debug_level () > 9)
+ // search for the resourcename in the resourceType
+ for (CORBA::ULong k = 0;k < available[j].resourceType.length ();k++)
+ {
+ if (!ACE_OS::strcmp (deployed[i].resourceName,
+ available[j].resourceType[k]))
+ {
+ try {
+ match_properties (deployed[i].property,
+ available[j].property);
+ }
+ catch (::Deployment::ResourceCommitmentFailure& ex)
+ {
+ // catch the exception and add parameters
+ throw ex;
+ }
+ }
+ }
+ }
+ }
+ }
+
+}
+
+void CIAO::DomainDataManager::
+match_properties (
+ ::Deployment::Properties deployed,
+ ::Deployment::SatisfierProperties & available)
+{
+ bool property_found;
+
+ for (CORBA::ULong i = 0;i < deployed.length ();i++)
+ {
+ property_found = false;
+
+ for (CORBA::ULong j = 0;j < available.length ();j++)
+ {
+ if (!ACE_OS::strcmp (deployed[i].name , available[j].name))
+ {
+ // check kind here ....and then subtract ....
+ // accordingly , ..this is complex ... better to write
+ // some specialised algo
+ // for now assuming Capacity ....
+ // and tk_double ....
+
+ commit_release_resource (deployed[i] , available[j]);
+ property_found = true;
+ }
+ } // internal for ....
+
+ // check if property was found or not
+ if (property_found == false)
+ {
+ // throw an error since property was not found in the Resource
+ ::Deployment::ResourceCommitmentFailure failure;
+
+ failure.reason = CORBA::string_dup ("Property Not Found\n");
+ failure.propertyName = CORBA::string_dup (deployed[i].name);
+ failure.propertyValue.length (0);
+
+ throw failure;
+ }
+ } // outside for ...
+}
+
+void CIAO::DomainDataManager::commit_release_resource (
+ ::Deployment::Property & deployed,
+ ::Deployment::SatisfierProperty & available)
+{
+ if (current_action_ == commit)
+ {
+
+ CORBA::Long required_d;
+
+ if ((deployed.value >>= required_d) == false)
+ ACE_ERROR ((LM_ERROR, "Failed to extract required amount\n"));
+
+ CORBA::Long available_d;
+
+ if ((available.value >>= available_d) == false)
+ ACE_ERROR ((LM_ERROR, "failed to extract available amount\n"));
+
+ if (available_d >= required_d)
+ {
+ available_d = available_d - required_d;
+
+ available.value <<= available_d;
+ }
+ else
+ {
+ ::Deployment::ResourceCommitmentFailure failure;
+
+ failure.reason = CORBA::string_dup ("Insufficient resources!");
+ failure.propertyName = CORBA::string_dup (available.name);
+ failure.propertyValue.length (1);
+ failure.propertyValue[0] = available.value;
+
+ throw failure;
+ }
+ }
+ else
+ {
+ //must be release
+ // @todo check return value of >>=
+ CORBA::Long required_d;
+ deployed.value >>= required_d;
+ CORBA::Long available_d;
+ available.value >>= available_d;
+
+ available_d = available_d + required_d;
+
+ // Should we check for bin > 100 ??????
+
+ available.value <<= available_d;
+ }
+}
+
+void CIAO::DomainDataManager::stop_monitors ()
+{
+
+ CORBA::ULong length = initial_domain_.node.length ();
+
+ for (CORBA::ULong i=0;i < length;i++)
+ {
+ ::Deployment::NodeManager_var node_manager;
+
+ try
+ {
+ node_manager =
+ deployment_config_.get_node_manager
+ (initial_domain_.node[i].name.in ());
+ }
+ catch (CORBA::Exception&)
+ {
+ ACE_ERROR ((LM_ERROR, "DANCE::TM (%P|%t) DomainDataManager.cpp: "
+ "Error in get Node Manager from Deployment Config %s\n",
+ initial_domain_.node[i].name.in ()));
+ continue;
+ }
+
+
+ if (!CORBA::is_nil (node_manager.in ()))
+ {
+ try
+ {
+ node_manager->leaveDomain ();
+ }
+ catch (CORBA::Exception& ex)
+ {
+ ACE_ERROR ((LM_ERROR , "TM::Error in calling Leave Domain\n"));
+ ex._tao_print_exception (
+ "Exception caught in ""DomainDataManager::leaveDomain");
+ }
+ }
+ }
+ return;
+
+}
+
+int CIAO::DomainDataManager::add_to_domain (
+ const ::Deployment::Domain& domain)
+{
+ // here add the domain to the Domain
+ // right now use only a node
+
+ // got to take care of the fact , that a node can be added ,
+ // while it is still in the domain
+
+ //iterate through the supplied domain
+ //for each node
+ // find it in the pristine domain
+ // and copy it back to the provisioned_domain
+
+ for (CORBA::ULong i = 0;i < domain.node.length ();i++)
+ {
+ //find in the pristine domain
+ ::Deployment::Node a_node;
+
+ if (!this->find_in_initial_domain (domain.node[i].name.in (),
+ a_node))
+ continue; // dont know this node
+
+ //check if already present
+ if (!this->find_in_provisioned_domain (domain.node[i].name.in (),
+ a_node))
+ {
+ // add the node to the domain ...
+ provisioned_data_.node.length (provisioned_data_.node.length () + 1);
+ provisioned_data_.node[provisioned_data_.node.length () - 1] =
+ a_node;
+ }
+ }
+
+ return 0;
+}
+
+bool CIAO::DomainDataManager::
+find_in_initial_domain (const char* node_name,
+ ::Deployment::Node& node)
+{
+ for (CORBA::ULong i =0;
+ i < this->initial_domain_.node.length ();
+ i++)
+ {
+ if (ACE_OS::strcmp (node_name, this->initial_domain_.node[i].name.in ()) == 0)
+ {
+ node = this->initial_domain_.node[i];
+ return true;
+ }
+ }
+
+ // not found the node , return a node with an empty name
+ return false;
+}
+
+
+bool CIAO::DomainDataManager::
+find_in_provisioned_domain (const char* node_name,
+ ::Deployment::Node& node)
+{
+ for (CORBA::ULong i =0;
+ i < this->provisioned_data_.node.length ();
+ i++)
+ {
+ if (ACE_OS::strcmp (node_name, this->provisioned_data_.node[i].name.in ()) == 0)
+ {
+ node = this->provisioned_data_.node[i];
+ return true;
+ }
+ }
+
+ // not found the node , return a node with an empty name
+ return false;
+}
+
+int CIAO::DomainDataManager::delete_from_domain (
+ const ::Deployment::Domain& domain)
+{
+ // validate input
+ if (domain.node.length () == 0)
+ return 1;
+
+ if (domain.node.length () >
+ this->provisioned_data_.node.length ())
+ return 0;
+
+ //algo : parse through the provisioned_data
+ // for each node , find in the deleted domain list
+ // if not found add it to the updated nodes list
+
+ ::Deployment::Nodes updated_nodes;
+ bool found = false;
+
+ for (CORBA::ULong j = 0;
+ j < this->provisioned_data_.node.length ();
+ j++)
+ {
+ found = false;
+
+ for (CORBA::ULong i = 0;i < domain.node.length ();i++)
+ {
+ if (ACE_OS::strcmp (domain.node[i].name.in (),
+ this->provisioned_data_.node[j].name.in ()) == 0)
+ {
+ found = true;
+ break; // found the node
+ }
+ }
+ if (found)
+ continue;
+
+ // not found in the deleted list
+
+ // update the length of the list
+ updated_nodes.length (updated_nodes.length () + 1);
+
+ // copy the node info
+ updated_nodes[updated_nodes.length () - 1] =
+ this->provisioned_data_.node[j];
+
+ } // for provisioned_data
+
+ // here update the provisioned data
+ this->provisioned_data_.node = updated_nodes;
+
+ return 1;
+}
+
+int CIAO::DomainDataManager::intimate_planner (
+ const ::Deployment::Domain& domain)
+{
+ // use the connection with the planner and get a reference to the planner
+ // make a call top the planner
+ Deployment::Domain d = domain;
+ return 0;
+
+}
+
+bool CIAO::DomainDataManager::update_node_status ()
+{
+ // update the node status here ...
+ return 0;
+}
+
+void CIAO::DomainDataManager::commitResourceAllocation (
+ const ::Deployment::ResourceAllocations & resources)
+{
+ // commit the resources
+ // parse into the plan and commit resources ...
+
+ // set the action value
+ current_action_ = commit;
+
+ this->commit_release_RA (resources);
+}
+
+void CIAO::DomainDataManager::releaseResourceAllocation (
+ const ::Deployment::ResourceAllocations & resources)
+{
+ // set the action value
+ current_action_ = release;
+
+ this->commit_release_RA (resources);
+}
+
+
+int CIAO::DomainDataManager::
+commit_release_RA (const ::Deployment::ResourceAllocations& resources)
+{
+ // temporary used to guard against exceptions
+ temp_provisioned_data_ = provisioned_data_;
+
+
+ for (CORBA::ULong i = 0;i < resources.length ();i++)
+ {
+ try
+ {
+ ::Deployment::Resource& res = find_resource (resources[i]);
+
+ match_properties (resources[i].property , res.property);
+ }
+ catch (::Deployment::ResourceCommitmentFailure& ex)
+ {
+ // catch the exception and add parameters
+ ACE_ERROR ((LM_ERROR, "Caught the Exception in releaseResourceAllocation\n"));
+ ex.index = i;
+ throw ex;
+ }
+ }
+
+ // here commit the commitresources
+ provisioned_data_ = temp_provisioned_data_;
+
+ return 0;
+}
+
+::Deployment::Resource&
+CIAO::DomainDataManager::find_resource (
+ const ::Deployment::ResourceAllocation& resource)
+{
+ // for now search the resource in the Node sequence; Later need
+ // to add it to the Bridges and Interconnects too according to the
+ // spec
+ for (CORBA::ULong j = 0;j < this->temp_provisioned_data_.node.length ();j++)
+ {
+ if (!ACE_OS::strcmp (resource.elementName.in () ,
+ this->temp_provisioned_data_.node[j].name.in ()))
+ {
+ for (CORBA::ULong k =0;
+ k < this->temp_provisioned_data_.node[j].resource.length ();
+ k++)
+ {
+ if (!ACE_OS::strcmp (this->temp_provisioned_data_.node[j].resource[k].name.in (),
+ resource.resourceName.in ()))
+ return this->temp_provisioned_data_.node[j].resource[k];//resource found here, return
+ }
+
+ // resource not found
+ throw ::Deployment::ResourceCommitmentFailure ().reason = CORBA::string_dup ("Resource Not Found\n");
+ }
+ }
+ throw ::Deployment::ResourceCommitmentFailure ().reason = CORBA::string_dup ("Resource Not Found\n");
+}
diff --git a/CIAO/DAnCE/TargetManager/DomainDataManager.h b/CIAO/DAnCE/TargetManager/DomainDataManager.h
new file mode 100644
index 00000000000..e32ba09a6d0
--- /dev/null
+++ b/CIAO/DAnCE/TargetManager/DomainDataManager.h
@@ -0,0 +1,291 @@
+// $Id$
+//===============================================================
+/**
+ * @file DomainDataManager.h
+ *
+ * @brief Maintains the Domain Information
+ *
+ * It contains the entire Domain information. Both the
+ * initial domain as well as the current available domain.
+ *
+ * @author Nilabja Roy nilabjar@dre.vanderbilt.edu
+ */
+//===============================================================
+#ifndef DOMAIN_DATA_MGRH
+#define DOMAIN_DATA_MGRH
+
+#include "TargetManagerImplC.h"
+#include "DAnCE/DomainApplicationManager/Deployment_Configuration.h"
+#include "DAnCE/Deployment/Deployment_ResourceCommitmentManagerC.h"
+
+/**
+ * @namespace CIAO
+ *
+ * @brief The main CIAO namespace
+ *
+ */
+namespace CIAO
+{
+ /**
+ * @class DomainDataManager
+ *
+ * @brief Responsible for maintaining the Domain Information
+ *
+ * It maintains both the Current Domain Information as well
+ * as the Initial domain at full capacity.
+ */
+ class DomainDataManager
+ {
+
+ public :
+ /**
+ * @brief This function is called by the other classes to update
+ * current domain data.
+ * @param elements The string sequence of elements
+ * being updated
+ * @param domainSubset The subset of the actual Domain to be updated
+ * @param updateKind Specifies the update type eg. add, delete, update
+ *
+ */
+ int update_domain (const ::CORBA::StringSeq & elements,
+ const ::Deployment::Domain & domainSubset,
+ ::Deployment::DomainUpdateKind updateKind
+ );
+ /**
+ * @brief This function is called from the Executor code
+ * to get the Original Domain data.
+ * @return Domain* The Initial Domain
+ *
+ */
+ ::Deployment::Domain* get_initial_domain ();
+
+ /**
+ * @brief This function is called from the Executor code
+ * to get the Current Domain data.
+ * @return Domain* The Current Domain
+ */
+ ::Deployment::Domain* get_current_domain ();
+
+ /**
+ * This function calls the constructor of the
+ * class Domain Data Manager
+ * @brief This function is called to create the Datamanager
+ * @param orb The orb pointer
+ * @param target The Target Manager Object Reference
+ *
+ */
+ static DomainDataManager * create (CORBA::ORB_ptr orb,
+ ::Deployment::TargetManager_ptr target
+ );
+
+ /**
+ * @brief Returns the static pointer to the
+ * data manager.
+ * @return DomainDataManager*
+ * The staic get_data_manger function returning
+ * the data_manager pointer
+ */
+ static DomainDataManager* get_data_manager ();
+
+ /**
+ * @brief deletes the data manager
+ */
+ static void delete_data_manger ();
+
+ /**
+ * @brief returns the sequence of node managers
+ * object reference
+ */
+ void commitResources (
+ const ::Deployment::DeploymentPlan & plan);
+
+ /**
+ * @brief The function releases the resources held by a plan
+ * @param plan ::Deployment::DeploymentPlan the plan whose
+ * resources are to be released
+ */
+ void releaseResources (
+ const ::Deployment::DeploymentPlan& plan);
+
+ /**
+ * The node manager in turn stops the monitor
+ * @brief The function makes a call on the leaveDomain on the
+ * NodeManager
+ */
+ void stop_monitors ();
+
+ /**
+ * @brief The function allocates resources specified in the
+ * parameter
+ *
+ * This function is for the ResourceCommitmentManager
+ *
+ */
+ void commitResourceAllocation (
+ const ::Deployment::ResourceAllocations & resources);
+
+ /**
+ * @brief The function releases resources specified in the
+ * parameter
+ *
+ * This function is for the ResourceCommitmentManager
+ *
+ */
+ void releaseResourceAllocation (
+ const ::Deployment::ResourceAllocations & resources);
+
+ private:
+
+ /**
+ * The constructor made protected so that no one can create
+ * it.
+ * @param orb The orb pointer
+ * @param target The Target Manager Object Reference
+ */
+ DomainDataManager (CORBA::ORB_ptr orb,
+ ::Deployment::TargetManager_ptr target
+ );
+
+ /**
+ * @brief It will read the initial Domain data from
+ * XML files.
+ */
+ int readin_domain_data ();
+
+ /**
+ * @brief Match the deployed resources to the
+ * available resource
+ */
+ void match_requirement_resource (
+ ::Deployment::InstanceResourceDeploymentDescriptions deployed,
+ ::Deployment::Resources& available
+ );
+
+ /**
+ * @brief Match the properties of a Requirement to the
+ * properties of available resource
+ * @param deployed The deployed Properties
+ * @param available The available Properties
+ */
+ void match_properties (
+ ::Deployment::Properties deployed,
+ ::Deployment::SatisfierProperties& available);
+
+
+ /// The different actiona that can take place
+ enum Action {commit , release};
+
+ /**
+ * @brief Either commits or releases the given resource
+ * based on the current Action set.
+ * @param deployed ::Deployment::Property is the resource
+ * to be commited/released
+ * @param available ::Deployment::SatisfierProperty is the
+ * available resource from which committed/released.
+ * @exception ::Deployment::ResourceNotAvailable thrown
+ * when the deployed resources exceeds
+ * the available resource.
+ */
+ void commit_release_resource ( ::Deployment::Property & deployed,
+ ::Deployment::SatisfierProperty & available);
+
+ /**
+ * @brief This function calls all NM and gives them
+ * the sub-domain
+ */
+ int call_all_node_managers ();
+
+ /**
+ * @brief This function add new elements to the
+ * already existing domain
+ *
+ * @param domain Deployment::Domain contians the new
+ * elements
+ */
+ int add_to_domain (const ::Deployment::Domain& domain);
+
+ /**
+ * @brief This function deletes elements from the domain
+ *
+ * @param domain ::Deployment::Domain contains the new elements
+ * in the domain
+ */
+ int delete_from_domain (const ::Deployment::Domain& domain);
+
+ /**
+ * @brief This function intimates the planner about a domain
+ * change
+ *
+ * @param domain ::Deployment::Domain contains the new elements
+ * in the domain
+ */
+ int intimate_planner (const ::Deployment::Domain& domain);
+
+ /**
+ * @brief This function finds a new node in the initial_domain
+ *
+ * @param node The name of the node which is to be searched
+ */
+
+ bool find_in_initial_domain (const char* node_name,
+ ::Deployment::Node& node);
+ /**
+ * @brief This function finds a new node in the proviosiond_domain
+ *
+ * @param node The name of the node which is to be searched
+ */
+ bool find_in_provisioned_domain (const char* node_name,
+ ::Deployment::Node& node);
+
+ /**
+ * @brief updates the node status by reading it from a file
+ */
+ bool update_node_status ();
+
+ /**
+ * @function find_resource
+ * @brief It finds the Resource structure which is respresents the
+ * ResourceAllocation
+ */
+ ::Deployment::Resource& find_resource (
+ const ::Deployment::ResourceAllocation& resource);
+
+ int commit_release_RA (
+ const ::Deployment::ResourceAllocations& resources);
+
+
+ /// The ORB pointer
+ CORBA::ORB_var orb_;
+
+ /// The Deployment Configuration
+ CIAO::Deployment_Configuration deployment_config_;
+
+ /// The Initial Domain - contains resources
+ /// at total capacity
+ ::Deployment::Domain initial_domain_;
+
+ /// The staic data member , replacing a global variable
+ static DomainDataManager* global_data_manager_;
+ /// The Current Domain - contains resources
+ /// at current capacity
+ ::Deployment::Domain current_domain_;
+
+ /// The Target Manager Context
+ ::Deployment::TargetManager_var target_mgr_;
+
+ /**
+ * The static provisioned Domain data
+ */
+ ::Deployment::Domain provisioned_data_;
+
+ /// temporary domain used in commit/release to
+ /// guard against exceptions
+ ::Deployment::Domain temp_provisioned_data_;
+
+ /// The current action
+ Action current_action_;
+ };
+} // CIAO
+
+
+#endif /* DOMAIN_DATA_MGRH */
diff --git a/CIAO/DAnCE/TargetManager/DomainEvents.idl b/CIAO/DAnCE/TargetManager/DomainEvents.idl
new file mode 100644
index 00000000000..bf973ebd0c4
--- /dev/null
+++ b/CIAO/DAnCE/TargetManager/DomainEvents.idl
@@ -0,0 +1,25 @@
+/**
+ * @file DomainEvents.idl
+ * @brief Contains Events in the Domain
+ *
+ * @author Nilabja R <nilabjar@dre.vanderbilt.edu>
+ *
+ * $Id$
+ */
+
+#ifndef DOMAIN_CHANGE_IDL
+#define DOMAIN_CHANGE_IDL
+
+#include "DAnCE/Deployment/Deployment_TargetManager.idl"
+#include "ciao/CCM_Events.idl"
+
+module CIAO
+{
+ eventtype Domain_Changed_Event
+ {
+ public ::Deployment::Domain changes;
+ public ::Deployment::DomainUpdateKind change_kind;
+ };
+};
+
+#endif
diff --git a/CIAO/DAnCE/TargetManager/ResourceCommitmentManager.cpp b/CIAO/DAnCE/TargetManager/ResourceCommitmentManager.cpp
new file mode 100644
index 00000000000..5735e109f0c
--- /dev/null
+++ b/CIAO/DAnCE/TargetManager/ResourceCommitmentManager.cpp
@@ -0,0 +1,52 @@
+// $Id$
+//
+#include "DomainDataManager.h"
+#include "ResourceCommitmentManager.h"
+
+// Implementation skeleton constructor
+CIAO::ResourceCommitmentManager_i::ResourceCommitmentManager_i (void)
+{
+}
+
+// Implementation skeleton destructor
+CIAO::ResourceCommitmentManager_i::~ResourceCommitmentManager_i (void)
+{
+}
+
+void CIAO::ResourceCommitmentManager_i::commitResources (
+ const ::Deployment::ResourceAllocations& resources)
+{
+ CIAO::DomainDataManager::get_data_manager ()->commitResourceAllocation (resources);
+
+ // commit succesful .. add to commited resource
+ this->add_to_commited_resource (resources);
+ return;
+}
+
+void CIAO::ResourceCommitmentManager_i::releaseResources (
+ const ::Deployment::ResourceAllocations & resources)
+{
+ ::Deployment::ResourceAllocations res;
+
+ // if the resources set is null , use the already allocated resources ..
+ if (resources.length () == 0)
+ res = this->resources_;
+ else
+ res = resources;
+
+ CIAO::DomainDataManager::get_data_manager ()->releaseResourceAllocation (res);
+ return;
+}
+
+int CIAO::ResourceCommitmentManager_i::add_to_commited_resource (
+ ::Deployment::ResourceAllocations res)
+{
+ CORBA::ULong current_length = this->resources_.length ();
+
+ this->resources_.length (current_length + res.length ());
+
+ for (CORBA::ULong i =0;i < res.length ();i++)
+ this->resources_[current_length + i] = res[i];
+
+ return 0;
+}
diff --git a/CIAO/DAnCE/TargetManager/ResourceCommitmentManager.h b/CIAO/DAnCE/TargetManager/ResourceCommitmentManager.h
new file mode 100644
index 00000000000..99a21a797bc
--- /dev/null
+++ b/CIAO/DAnCE/TargetManager/ResourceCommitmentManager.h
@@ -0,0 +1,63 @@
+// $Id$
+//
+/**
+ * @file ResourceCommitmentManager.h
+ *
+ * @brief This file declares the ResourceCommitmentManager class
+ *
+ * This class acts as the servant of the interface
+ * ResourceCommitmentManager
+ */
+#ifndef DEPLOYMENT_RESOURCECOMMITMENTMANAGERI_H_
+#define DEPLOYMENT_RESOURCECOMMITMENTMANAGERI_H_
+
+#include "DAnCE/Deployment/Deployment_ResourceCommitmentManagerS.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+#pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+namespace CIAO {
+
+ class ResourceCommitmentManager_i
+ : public virtual POA_Deployment::ResourceCommitmentManager
+ {
+ public:
+ // Constructor
+ ResourceCommitmentManager_i (void);
+
+ // Destructor
+ virtual ~ResourceCommitmentManager_i (void);
+
+ /**
+ * @function commitResources
+ * @brief Commits the resources
+ *
+ * @description This function makes a call to the DomainDataManager in order
+ * to commit the resources mentioned in the ResourceAllocation
+ * sequence. If the resource cannot be allocated throws a
+ * ResourceCommitmentFailed exception
+ */
+ virtual
+ void commitResources (
+ const ::Deployment::ResourceAllocations& resources);
+
+ virtual
+ void releaseResources (
+ const ::Deployment::ResourceAllocations & resources);
+
+ private:
+ /**
+ * @function add_to_commited_resource
+ * @brief This function adds the res to already commited resources.
+ * This is to be called from within commitResources
+ */
+ int add_to_commited_resource (::Deployment::ResourceAllocations res);
+
+ /// The commited resource
+ ::Deployment::ResourceAllocations resources_;
+ };
+
+}
+
+#endif /* DEPLOYMENT_RESOURCECOMMITMENTMANAGERI_H_ */
diff --git a/CIAO/DAnCE/TargetManager/TM_Client.mpc b/CIAO/DAnCE/TargetManager/TM_Client.mpc
new file mode 100644
index 00000000000..0a203ab1476
--- /dev/null
+++ b/CIAO/DAnCE/TargetManager/TM_Client.mpc
@@ -0,0 +1,21 @@
+// $Id$
+
+// Client.mpc,v 1.6 2005/02/18 09:07:06 jwillemsen Exp
+
+project(TMClient): ciao_client_dnc,ciao_deployment_stub, ciao_config_handlers, ciao_events_dnc, ciao_targetmanager_stub {
+ IDL_Files {
+ }
+
+ Source_Files {
+ CmpClient.cpp
+ }
+
+ Header_Files {
+ }
+
+ Inline_Files {
+ }
+
+ Template_Files {
+ }
+}
diff --git a/CIAO/DAnCE/TargetManager/TargetManager.cidl b/CIAO/DAnCE/TargetManager/TargetManager.cidl
new file mode 100644
index 00000000000..6e880c069e9
--- /dev/null
+++ b/CIAO/DAnCE/TargetManager/TargetManager.cidl
@@ -0,0 +1,27 @@
+// $Id$
+
+/*
+ * @file TargetManager.cidl
+ * @brief The file contains the TargetManager component
+ * defination
+ */
+
+#ifndef TARGETMANAGER_CIDL
+#define TARGETMANAGER_CIDL
+
+#include "TargetManagerImpl.idl"
+
+/*
+ * @composition TargetManager_i
+ */
+
+composition session TargetManager_i
+{
+ home executor TargetManagerHome_Exec
+ {
+ implements CIAO::TargetManagerHome;
+ manages TargetManagerImpl_Exec;
+ };
+};
+
+#endif
diff --git a/CIAO/DAnCE/TargetManager/TargetManager.mpc b/CIAO/DAnCE/TargetManager/TargetManager.mpc
new file mode 100644
index 00000000000..a4a03cca6a4
--- /dev/null
+++ b/CIAO/DAnCE/TargetManager/TargetManager.mpc
@@ -0,0 +1,63 @@
+// $Id$
+
+project(CIAO_TargetManager_stub): ciao_client_dnc, ciao_deployment_stub, ciao_nodemanager_stub {
+ sharedname = TargetManager_stub
+ idlflags += -Wb,stub_export_macro=TARGETMANAGER_STUB_Export \
+ -Wb,stub_export_include=TargetManager_stub_export.h \
+ -Wb,skel_export_macro=TARGETMANAGER_SVNT_Export \
+ -Wb,skel_export_include=TargetManager_svnt_export.h
+ dynamicflags = TARGETMANAGER_STUB_BUILD_DLL
+
+ IDL_Files {
+ TargetManagerImpl.idl
+ TargetManagerExt.idl
+ DomainEvents.idl
+ }
+
+ Source_Files {
+ TargetManagerImplC.cpp
+ TargetManagerExtC.cpp
+ DomainEventsC.cpp
+ }
+}
+
+project(CIAO_TargetManager_svnt) : ciao_servant_dnc, ciao_targetmanager_stub {
+ sharedname = TargetManager_svnt
+
+ idlflags += -Wb,export_macro=TARGETMANAGER_SVNT_Export \
+ -Wb,export_include=TargetManager_svnt_export.h
+
+ dynamicflags = TARGETMANAGER_SVNT_BUILD_DLL
+
+ CIDL_Files {
+ TargetManager.cidl
+ }
+
+ IDL_Files {
+ TargetManagerE.idl
+ }
+
+ Source_Files {
+ TargetManagerEC.cpp
+ TargetManagerImplS.cpp
+ TargetManagerExtS.cpp
+ TargetManager_svnt.cpp
+ DomainEventsS.cpp
+ }
+}
+
+
+project(CIAO_TargetManager_exec) : ciao_component_dnc, ciao_config_handlers, ciao_domainapplicationmanager_dnc, ciao_targetmanager_svnt {
+ sharedname = TargetManager_exec
+
+ dynamicflags = TARGETMANAGER_EXEC_BUILD_DLL
+
+ Source_Files {
+ DomainDataManager.cpp
+ TargetManager_exec.cpp
+ ResourceCommitmentManager.cpp
+ }
+
+ IDL_Files {
+ }
+}
diff --git a/CIAO/DAnCE/TargetManager/TargetManagerExt.idl b/CIAO/DAnCE/TargetManager/TargetManagerExt.idl
new file mode 100644
index 00000000000..26d0c336b62
--- /dev/null
+++ b/CIAO/DAnCE/TargetManager/TargetManagerExt.idl
@@ -0,0 +1,84 @@
+// $Id$
+
+/**
+ * @file TargetManagerExt.idl
+ *
+ * @brief The Extensions to the TM interface for ARMS demo
+ *
+ * @author Nilabja R <nilabjar@dre.vanderbilt.edu>
+ * @author Nishanth Shankaran <nshankar@dre.vanderbilt.edu>
+ *
+ * This file declares a interface which will be implemented as
+ * a facet by the TargetManager component
+ */
+
+#include "DAnCE/Interfaces/NodeManagerDaemon.idl"
+
+module CIAO
+{
+ /**
+ * @struct Cpu_Info
+ * @brief Consists of individual host-cpu info
+ */
+ struct Host_Info
+ {
+ string hostname;
+ double cpu_util;
+ };
+
+ /// The sequence of CPU infos
+ typedef sequence<Host_Info> Host_Infos;
+
+ /**
+ * @struct Component_Cpu_Util
+ * @brief Contains a component CPU Util
+ */
+ struct Component_Info
+ {
+ string component_name;
+ double cpu_util;
+ };
+
+ /// The sequence of component cpu utilization
+ typedef sequence <Component_Info> Component_Infos;
+
+
+ /**
+ * @struct Host_NodeManager
+ * @brief Contains the node manager to host reference
+ */
+ struct Host_NodeManager
+ {
+ /// host name
+ string host_;
+
+ /// the node manager IOR
+ ::CIAO::NodeManagerDaemon node_mgr_;
+ };
+
+ /// Sequence of NodeManager.
+ typedef sequence <Host_NodeManager> Host_NodeManager_seq;
+
+ /**
+ * @interface TargetManagerExt
+ * @brief The Target Manager Extension
+ *
+ * Contains the interface used by the RACE
+ * controller.
+ */
+ interface TargetManagerExt
+ {
+ ///Returns the pid in which a component runs
+ long get_pid (in string component_uuid);
+
+ /// returns the cpu usage for each host in the
+ /// last cycle
+ Host_Infos get_host_cpu ();
+
+ /// Return the detail of the components
+ Component_Infos get_component_cpu ();
+
+ /// Returns the OR of the Node managers
+ Host_NodeManager_seq get_all_node_managers ();
+ };
+};
diff --git a/CIAO/DAnCE/TargetManager/TargetManagerImpl.idl b/CIAO/DAnCE/TargetManager/TargetManagerImpl.idl
new file mode 100644
index 00000000000..484b1e53d20
--- /dev/null
+++ b/CIAO/DAnCE/TargetManager/TargetManagerImpl.idl
@@ -0,0 +1,32 @@
+// $Id$
+
+/**
+ * @file TargetManagerImpl.idl
+ * @brief TargetManager interface defintion
+ *
+ * @author Nilabja R <nilabjar@dre.vanderbilt.edu>
+ */
+
+#ifndef TARGETMGR_IDL
+#define TARGETMGR_IDL
+
+#include "ciao/Components.idl"
+#include "DAnCE/Deployment/Deployment_PlanError.idl"
+#include "DAnCE/TargetManager/TargetManagerExt.idl"
+#include "DAnCE/TargetManager/DomainEvents.idl"
+
+module CIAO
+{
+ component TargetManagerImpl
+ {
+ provides ::Deployment::TargetManager targetMgr;
+
+ publishes Domain_Changed_Event changes;
+ };
+
+ home TargetManagerHome manages TargetManagerImpl
+ {
+ };
+};
+
+#endif
diff --git a/CIAO/DAnCE/TargetManager/TargetManager_exec.cpp b/CIAO/DAnCE/TargetManager/TargetManager_exec.cpp
new file mode 100644
index 00000000000..0f3e30f37b0
--- /dev/null
+++ b/CIAO/DAnCE/TargetManager/TargetManager_exec.cpp
@@ -0,0 +1,277 @@
+// $Id$
+#include "TargetManager_exec.h"
+#include "ciao/CIAO_common.h"
+#include <orbsvcs/CosNamingC.h>
+#include "Config_Handlers/DD_Handler.h"
+#include "Config_Handlers/DnC_Dump.h"
+
+#include "DomainEventsC.h"
+
+#include "ResourceCommitmentManager.h"
+
+namespace CIDL_TargetManager_i
+{
+ //==================================================================
+ // Facet Executor Implementation Class: TargetManager_exec_i
+ //==================================================================
+
+ TargetManager_exec_i::
+ TargetManager_exec_i (TargetManagerImpl_exec_i* exec ,
+ CORBA::ORB_ptr orb,
+ TargetManagerImpl_Context *context)
+ : _exec (exec),
+ orb_ (CORBA::ORB::_duplicate (orb)),
+ context_ (context)
+ {
+ // The DomainDataManager created here ...
+
+ // get its own obj ref , then call
+
+ CORBA::Object_var object = context_->get_CCM_object ();
+ CIAO::TargetManagerImpl_var target_impl =
+ CIAO::TargetManagerImpl::_narrow (object.in ());
+ ::Deployment::TargetManager_var target =
+ target_impl->provide_targetMgr ();
+
+ // Create Domain Data here
+
+ CIAO::DomainDataManager::create (orb_.in (), target.in ());
+// CIAO::Domain_Singleton::instance ();
+ }
+
+ TargetManager_exec_i::~TargetManager_exec_i (void)
+ {
+ }
+
+ // Operations from ::Deployment::TargetManager
+
+ ::Deployment::Domain *
+ TargetManager_exec_i::getAllResources ()
+ {
+ return CIAO::DomainDataManager::
+ get_data_manager ()->get_initial_domain ();
+ }
+
+ ::Deployment::Domain *
+ TargetManager_exec_i::getAvailableResources ()
+ {
+ return CIAO::DomainDataManager::
+ get_data_manager ()->get_current_domain ();
+ }
+
+ void
+ TargetManager_exec_i::commitResources (
+ const ::Deployment::DeploymentPlan & plan)
+ {
+ return CIAO::DomainDataManager::
+ get_data_manager ()->commitResources (plan);
+ }
+
+ void
+ TargetManager_exec_i::releaseResources (
+ const ::Deployment::DeploymentPlan & plan)
+ {
+ return CIAO::DomainDataManager::
+ get_data_manager ()->releaseResources (plan);
+ }
+
+ void
+ TargetManager_exec_i::updateDomain (
+ const ::CORBA::StringSeq & elements ,
+ const ::Deployment::Domain & domainSubset ,
+ ::Deployment::DomainUpdateKind updateKind)
+ {
+ // Your code here.
+ CIAO::DomainDataManager::
+ get_data_manager ()->update_domain (
+ elements,
+ domainSubset,
+ updateKind);
+
+ // here tell the planner about the changes
+
+ // first get the node names which have failed ...
+ // assuming nodes to only fail , for now
+
+ if (updateKind == ::Deployment::Delete ||
+ updateKind == ::Deployment::Add)
+ {
+ CIAO::Domain_Changed_Event_var changed_event =
+ new OBV_CIAO::Domain_Changed_Event ();
+
+ ::Deployment::Domain_var temp_domain =
+ new ::Deployment::Domain (domainSubset);
+
+ changed_event->changes (temp_domain);
+ changed_event->change_kind (updateKind);
+
+ context_->push_changes (changed_event);
+ }
+
+ }
+
+ ::Deployment::ResourceCommitmentManager_ptr
+ TargetManager_exec_i::createResourceCommitment (
+ const ::Deployment::ResourceAllocations& manager)
+ {
+
+ CIAO::ResourceCommitmentManager_i *commit_servant =
+ new CIAO::ResourceCommitmentManager_i ();
+
+ // Standard owner transfer mechanisms.
+ //
+ PortableServer::ServantBase_var safe_daemon (commit_servant);
+
+ commit_servant->commitResources (manager);
+
+ Deployment::ResourceCommitmentManager_var mgrv =
+ commit_servant->_this ();
+
+ return mgrv._retn ();
+ }
+
+ void
+ TargetManager_exec_i::destroyResourceCommitment (
+ ::Deployment::ResourceCommitmentManager_ptr resources)
+ {
+ ::Deployment::ResourceAllocations res;
+ res.length (0);
+ resources->releaseResources (res);
+ return;
+ }
+ //==================================================================
+ // Component Executor Implementation Class: TargetManagerImpl_exec_i
+ //==================================================================
+
+ TargetManagerImpl_exec_i::TargetManagerImpl_exec_i (void)
+ : exec_object_ (0)
+ {
+ }
+
+ TargetManagerImpl_exec_i::~TargetManagerImpl_exec_i (void)
+ {
+ }
+
+ // Supported or inherited operations.
+
+ // Attribute operations.
+
+ // Port operations.
+
+ ::Deployment::CCM_TargetManager_ptr
+ TargetManagerImpl_exec_i::get_targetMgr ()
+ {
+ // Your code here.
+
+ if (CORBA::is_nil (this->exec_object_.in ()))
+ {
+ this->exec_object_ = new TargetManager_exec_i(this,
+ context_->_ciao_the_Container()->the_ORB(),
+ context_);
+ }
+
+ return ::Deployment::CCM_TargetManager::_duplicate (this->exec_object_.in ());
+ }
+
+ // Operations from Components::SessionComponent
+
+ void
+ TargetManagerImpl_exec_i::set_session_context (
+ ::Components::SessionContext_ptr ctx)
+ {
+ this->context_ =
+ TargetManagerImpl_Context::_narrow (ctx);
+
+ if (this->context_ == 0)
+ {
+ throw CORBA::INTERNAL ();
+ }
+ }
+
+ void
+ TargetManagerImpl_exec_i::ciao_preactivate ()
+ {
+ // Your code here.
+ }
+
+ void
+ TargetManagerImpl_exec_i::ciao_postactivate ()
+ {
+ // Your code here.
+ }
+
+
+ void
+ TargetManagerImpl_exec_i::ccm_activate ()
+ {
+ // Your code here.
+ this->get_targetMgr ();
+ }
+
+ void
+ TargetManagerImpl_exec_i::ccm_passivate ()
+ {
+ // Your code here.
+ }
+
+ void
+ TargetManagerImpl_exec_i::ccm_remove ()
+ {
+ // Your code here.
+
+ //CIAO::DomainDataManager::get_data_manager ()->stop_monitors ();
+
+ return;
+ }
+
+
+ //==================================================================
+ // Home Executor Implementation Class: TargetManagerHome_exec_i
+ //==================================================================
+
+ TargetManagerHome_exec_i::TargetManagerHome_exec_i (void)
+ {
+ }
+
+ TargetManagerHome_exec_i::~TargetManagerHome_exec_i (void)
+ {
+ }
+
+ // Supported or inherited operations.
+
+ // Home operations.
+
+ // Factory and finder operations.
+
+ // Attribute operations.
+
+ // Implicit operations.
+
+ ::Components::EnterpriseComponent_ptr
+ TargetManagerHome_exec_i::create ()
+ {
+ ::Components::EnterpriseComponent_ptr retval =
+ ::Components::EnterpriseComponent::_nil ();
+
+ ACE_NEW_THROW_EX (
+ retval,
+ TargetManagerImpl_exec_i,
+ CORBA::NO_MEMORY ());
+
+ return retval;
+ }
+
+ extern "C" TARGETMANAGER_EXEC_Export ::Components::HomeExecutorBase_ptr
+ create_CIAO_TargetManagerHome_Impl (void)
+ {
+ ::Components::HomeExecutorBase_ptr retval =
+ ::Components::HomeExecutorBase::_nil ();
+
+ ACE_NEW_RETURN (
+ retval,
+ TargetManagerHome_exec_i,
+ ::Components::HomeExecutorBase::_nil ());
+
+ return retval;
+ }
+}
diff --git a/CIAO/DAnCE/TargetManager/TargetManager_exec.h b/CIAO/DAnCE/TargetManager/TargetManager_exec.h
new file mode 100644
index 00000000000..0e1b32ea68b
--- /dev/null
+++ b/CIAO/DAnCE/TargetManager/TargetManager_exec.h
@@ -0,0 +1,150 @@
+// $Id$
+//===============================================================
+/**
+ * @file TargetManager_exec.h
+ *
+ * @brief TargetManager Executor code
+ *
+ * @author Nilabja Roy nilabjar@dre.vanderbilt.edu
+ */
+//===============================================================
+
+#ifndef CIAO_TARGETMANAGER_EXEC_H
+#define CIAO_TARGETMANAGER_EXEC_H
+
+#include /**/ "ace/pre.h"
+
+#include "TargetManager_svnt.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "TargetManager_exec_export.h"
+#include "tao/LocalObject.h"
+#include "DomainDataManager.h"
+
+/**
+ * TargetManager Executor namespace
+ */
+namespace CIDL_TargetManager_i
+{
+ class TargetManager_exec_i;
+
+ class TARGETMANAGER_EXEC_Export TargetManagerImpl_exec_i
+ : public virtual TargetManagerImpl_Exec,
+ public virtual TAO_Local_RefCounted_Object
+ {
+ public:
+ TargetManagerImpl_exec_i (void);
+ virtual ~TargetManagerImpl_exec_i (void);
+
+ // Supported or inherited operations.
+
+ // Attribute operations.
+
+ // Port operations.
+
+ virtual ::Deployment::CCM_TargetManager_ptr
+ get_targetMgr ();
+
+ // Operations from Components::SessionComponent
+
+ virtual void
+ set_session_context (
+ ::Components::SessionContext_ptr ctx);
+
+ virtual void ciao_preactivate ();
+
+ virtual void ciao_postactivate ();
+
+ virtual void ccm_activate ();
+
+ virtual void ccm_passivate ();
+
+ virtual void ccm_remove ();
+
+ protected:
+ /// The service context pointer
+ TargetManagerImpl_Context *context_;
+
+ /// The exec Object
+ ::Deployment::CCM_TargetManager_var exec_object_;
+ };
+ class TARGETMANAGER_EXEC_Export TargetManager_exec_i
+ : public virtual ::Deployment::CCM_TargetManager,
+ public virtual TAO_Local_RefCounted_Object
+ {
+ public:
+ TargetManager_exec_i (TargetManagerImpl_exec_i* exec,
+ CORBA::ORB_ptr orb,
+ TargetManagerImpl_Context *context);
+ virtual ~TargetManager_exec_i (void);
+
+ // Operations from ::Deployment::TargetManager
+
+ virtual ::Deployment::Domain * getAllResources ();
+
+ virtual ::Deployment::Domain * getAvailableResources ();
+
+ virtual void commitResources (const ::Deployment::DeploymentPlan & plan);
+
+ virtual void releaseResources (const ::Deployment::DeploymentPlan & argname);
+
+ virtual void
+ updateDomain (
+ const ::CORBA::StringSeq & elements,
+ const ::Deployment::Domain & domainSubset,
+ ::Deployment::DomainUpdateKind updateKind);
+
+ virtual ::Deployment::ResourceCommitmentManager_ptr
+ createResourceCommitment (const ::Deployment::ResourceAllocations& manager);
+
+ virtual void
+ destroyResourceCommitment (
+ ::Deployment::ResourceCommitmentManager_ptr resources);
+
+ private:
+ TargetManagerImpl_exec_i * _exec;
+
+ /// The pointer to the Domain Manager
+ auto_ptr<CIAO::DomainDataManager> dataManager_;
+
+ /// The CORBA ORB ...
+ CORBA::ORB_var orb_;
+
+ /// The context object ...
+ TargetManagerImpl_Context *context_;
+ };
+
+
+
+ class TARGETMANAGER_EXEC_Export TargetManagerHome_exec_i
+ : public virtual TargetManagerHome_Exec,
+ public virtual TAO_Local_RefCounted_Object
+ {
+ public:
+ TargetManagerHome_exec_i (void);
+ virtual ~TargetManagerHome_exec_i (void);
+
+ // Supported or inherited operations.
+
+ // Home operations.
+
+ // Factory and finder operations.
+
+ // Attribute operations.
+
+ // Implicit operations.
+
+ virtual ::Components::EnterpriseComponent_ptr
+ create ();
+ };
+
+ extern "C" TARGETMANAGER_EXEC_Export ::Components::HomeExecutorBase_ptr
+ create_CIAO_TargetManagerHome_Impl (void);
+}
+
+#include /**/ "ace/post.h"
+
+#endif /* CIAO_TARGETMANAGER_EXEC_H */
diff --git a/CIAO/DAnCE/TargetManager/TargetManager_exec_export.h b/CIAO/DAnCE/TargetManager/TargetManager_exec_export.h
new file mode 100644
index 00000000000..690e5b6136e
--- /dev/null
+++ b/CIAO/DAnCE/TargetManager/TargetManager_exec_export.h
@@ -0,0 +1,54 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl TARGETMANAGER_EXEC
+// ------------------------------
+#ifndef TARGETMANAGER_EXEC_EXPORT_H
+#define TARGETMANAGER_EXEC_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if !defined (TARGETMANAGER_EXEC_HAS_DLL)
+# define TARGETMANAGER_EXEC_HAS_DLL 1
+#endif /* ! TARGETMANAGER_EXEC_HAS_DLL */
+
+#if defined (TARGETMANAGER_EXEC_HAS_DLL) && (TARGETMANAGER_EXEC_HAS_DLL == 1)
+# if defined (TARGETMANAGER_EXEC_BUILD_DLL)
+# define TARGETMANAGER_EXEC_Export ACE_Proper_Export_Flag
+# define TARGETMANAGER_EXEC_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TARGETMANAGER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TARGETMANAGER_EXEC_BUILD_DLL */
+# define TARGETMANAGER_EXEC_Export ACE_Proper_Import_Flag
+# define TARGETMANAGER_EXEC_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TARGETMANAGER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TARGETMANAGER_EXEC_BUILD_DLL */
+#else /* TARGETMANAGER_EXEC_HAS_DLL == 1 */
+# define TARGETMANAGER_EXEC_Export
+# define TARGETMANAGER_EXEC_SINGLETON_DECLARATION(T)
+# define TARGETMANAGER_EXEC_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TARGETMANAGER_EXEC_HAS_DLL == 1 */
+
+// Set TARGETMANAGER_EXEC_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (TARGETMANAGER_EXEC_NTRACE)
+# if (ACE_NTRACE == 1)
+# define TARGETMANAGER_EXEC_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define TARGETMANAGER_EXEC_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !TARGETMANAGER_EXEC_NTRACE */
+
+#if (TARGETMANAGER_EXEC_NTRACE == 1)
+# define TARGETMANAGER_EXEC_TRACE(X)
+#else /* (TARGETMANAGER_EXEC_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define TARGETMANAGER_EXEC_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (TARGETMANAGER_EXEC_NTRACE == 1) */
+
+#endif /* TARGETMANAGER_EXEC_EXPORT_H */
+
+// End of auto generated file.
diff --git a/CIAO/DAnCE/TargetManager/TargetManager_stub_export.h b/CIAO/DAnCE/TargetManager/TargetManager_stub_export.h
new file mode 100644
index 00000000000..d362f4f4ac8
--- /dev/null
+++ b/CIAO/DAnCE/TargetManager/TargetManager_stub_export.h
@@ -0,0 +1,54 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl TARGETMANAGER_STUB
+// ------------------------------
+#ifndef TARGETMANAGER_STUB_EXPORT_H
+#define TARGETMANAGER_STUB_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if !defined (TARGETMANAGER_STUB_HAS_DLL)
+# define TARGETMANAGER_STUB_HAS_DLL 1
+#endif /* ! TARGETMANAGER_STUB_HAS_DLL */
+
+#if defined (TARGETMANAGER_STUB_HAS_DLL) && (TARGETMANAGER_STUB_HAS_DLL == 1)
+# if defined (TARGETMANAGER_STUB_BUILD_DLL)
+# define TARGETMANAGER_STUB_Export ACE_Proper_Export_Flag
+# define TARGETMANAGER_STUB_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TARGETMANAGER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TARGETMANAGER_STUB_BUILD_DLL */
+# define TARGETMANAGER_STUB_Export ACE_Proper_Import_Flag
+# define TARGETMANAGER_STUB_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TARGETMANAGER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TARGETMANAGER_STUB_BUILD_DLL */
+#else /* TARGETMANAGER_STUB_HAS_DLL == 1 */
+# define TARGETMANAGER_STUB_Export
+# define TARGETMANAGER_STUB_SINGLETON_DECLARATION(T)
+# define TARGETMANAGER_STUB_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TARGETMANAGER_STUB_HAS_DLL == 1 */
+
+// Set TARGETMANAGER_STUB_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (TARGETMANAGER_STUB_NTRACE)
+# if (ACE_NTRACE == 1)
+# define TARGETMANAGER_STUB_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define TARGETMANAGER_STUB_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !TARGETMANAGER_STUB_NTRACE */
+
+#if (TARGETMANAGER_STUB_NTRACE == 1)
+# define TARGETMANAGER_STUB_TRACE(X)
+#else /* (TARGETMANAGER_STUB_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define TARGETMANAGER_STUB_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (TARGETMANAGER_STUB_NTRACE == 1) */
+
+#endif /* TARGETMANAGER_STUB_EXPORT_H */
+
+// End of auto generated file.
diff --git a/CIAO/DAnCE/TargetManager/TargetManager_svnt_export.h b/CIAO/DAnCE/TargetManager/TargetManager_svnt_export.h
new file mode 100644
index 00000000000..f57ce799949
--- /dev/null
+++ b/CIAO/DAnCE/TargetManager/TargetManager_svnt_export.h
@@ -0,0 +1,54 @@
+
+// -*- C++ -*-
+// $Id$
+// Definition for Win32 Export directives.
+// This file is generated automatically by generate_export_file.pl TARGETMANAGER_SVNT
+// ------------------------------
+#ifndef TARGETMANAGER_SVNT_EXPORT_H
+#define TARGETMANAGER_SVNT_EXPORT_H
+
+#include "ace/config-all.h"
+
+#if !defined (TARGETMANAGER_SVNT_HAS_DLL)
+# define TARGETMANAGER_SVNT_HAS_DLL 1
+#endif /* ! TARGETMANAGER_SVNT_HAS_DLL */
+
+#if defined (TARGETMANAGER_SVNT_HAS_DLL) && (TARGETMANAGER_SVNT_HAS_DLL == 1)
+# if defined (TARGETMANAGER_SVNT_BUILD_DLL)
+# define TARGETMANAGER_SVNT_Export ACE_Proper_Export_Flag
+# define TARGETMANAGER_SVNT_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
+# define TARGETMANAGER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# else /* TARGETMANAGER_SVNT_BUILD_DLL */
+# define TARGETMANAGER_SVNT_Export ACE_Proper_Import_Flag
+# define TARGETMANAGER_SVNT_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
+# define TARGETMANAGER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+# endif /* TARGETMANAGER_SVNT_BUILD_DLL */
+#else /* TARGETMANAGER_SVNT_HAS_DLL == 1 */
+# define TARGETMANAGER_SVNT_Export
+# define TARGETMANAGER_SVNT_SINGLETON_DECLARATION(T)
+# define TARGETMANAGER_SVNT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
+#endif /* TARGETMANAGER_SVNT_HAS_DLL == 1 */
+
+// Set TARGETMANAGER_SVNT_NTRACE = 0 to turn on library specific tracing even if
+// tracing is turned off for ACE.
+#if !defined (TARGETMANAGER_SVNT_NTRACE)
+# if (ACE_NTRACE == 1)
+# define TARGETMANAGER_SVNT_NTRACE 1
+# else /* (ACE_NTRACE == 1) */
+# define TARGETMANAGER_SVNT_NTRACE 0
+# endif /* (ACE_NTRACE == 1) */
+#endif /* !TARGETMANAGER_SVNT_NTRACE */
+
+#if (TARGETMANAGER_SVNT_NTRACE == 1)
+# define TARGETMANAGER_SVNT_TRACE(X)
+#else /* (TARGETMANAGER_SVNT_NTRACE == 1) */
+# if !defined (ACE_HAS_TRACE)
+# define ACE_HAS_TRACE
+# endif /* ACE_HAS_TRACE */
+# define TARGETMANAGER_SVNT_TRACE(X) ACE_TRACE_IMPL(X)
+# include "ace/Trace.h"
+#endif /* (TARGETMANAGER_SVNT_NTRACE == 1) */
+
+#endif /* TARGETMANAGER_SVNT_EXPORT_H */
+
+// End of auto generated file.
diff --git a/CIAO/DAnCE/TargetManager/descriptors/Domain.cdd b/CIAO/DAnCE/TargetManager/descriptors/Domain.cdd
new file mode 100644
index 00000000000..fe21a4b48f5
--- /dev/null
+++ b/CIAO/DAnCE/TargetManager/descriptors/Domain.cdd
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Deployment:domain
+ 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 Deployment.xsd">
+
+<UUID>effd4bd0-6db0-4c50-9bb7-db9decebae1c</UUID>
+<label>Hello Domain</label>
+
+
+<node>
+ <name>TargetManagerNode_1</name>
+ <label>Sender's Node</label>
+ <resource>
+ <name>Processor</name>
+ <resourceType>CPULoad</resourceType>
+ <property>
+ <name>LoadAverage</name>
+ <kind>Quantity</kind>
+ <dynamic>true</dynamic>
+ <value>
+ <type>
+ <kind>tk_long</kind>
+ </type>
+ <value><long>99</long></value>
+ </value>
+ </property>
+ </resource>
+</node>
+<node>
+ <name>TargetManagerNode_2</name>
+ <label>Receiver's Node</label>
+ <resource>
+ <name>Processor</name>
+ <resourceType>CPULoad</resourceType>
+ <property>
+ <name>LoadAverage</name>
+ <kind>Quantity</kind>
+ <dynamic>true</dynamic>
+ <value>
+ <type>
+ <kind>tk_long</kind>
+ </type>
+ <value><long>99</long></value>
+ </value>
+ </property>
+ </resource>
+</node>
+
+
+<interconnect>
+ <name>NoBridgeInterConnect</name>
+ <connect>
+ <name>Receiver</name>
+ <resource>
+ <name>Processor</name>
+ <resourceType>CPULoad</resourceType>
+ <property>
+ <name>LoadAverage</name>
+ <kind>Quantity</kind>
+ <dynamic>true</dynamic>
+ <value>
+ <type>
+ <kind>tk_long</kind>
+ </type>
+ <value><long>99</long></value>
+ </value>
+ </property>
+ </resource>
+ </connect>
+</interconnect>
+
+
+<bridge>
+ <name>NoBridge</name>
+ <connect>
+ <name>NoBridgeInterConnect</name>
+ <connect>
+ <name>Receiver</name>
+ <resource>
+ <name>Processor</name>
+ <resourceType>CPULoad</resourceType>
+ <property>
+ <name>LoadAverage</name>
+ <kind>Quantity</kind>
+ <dynamic>true</dynamic>
+ <value>
+ <type>
+ <kind>tk_long</kind>
+ </type>
+ <value><long>99</long></value>
+ </value>
+ </property>
+ </resource>
+ </connect>
+ </connect>
+</bridge>
+
+
+</Deployment:domain>
diff --git a/CIAO/DAnCE/TargetManager/descriptors/NodeDetails.dat b/CIAO/DAnCE/TargetManager/descriptors/NodeDetails.dat
new file mode 100644
index 00000000000..0ca8bfefd8b
--- /dev/null
+++ b/CIAO/DAnCE/TargetManager/descriptors/NodeDetails.dat
@@ -0,0 +1,2 @@
+TargetManagerNode_1 corbaloc:iiop:localhost:40000/NodeManager
+TargetManagerNode_2 corbaloc:iiop:localhost:30000/NodeManager
diff --git a/CIAO/DAnCE/TargetManager/descriptors/NodeManagerMap.dat b/CIAO/DAnCE/TargetManager/descriptors/NodeManagerMap.dat
new file mode 100644
index 00000000000..0ca8bfefd8b
--- /dev/null
+++ b/CIAO/DAnCE/TargetManager/descriptors/NodeManagerMap.dat
@@ -0,0 +1,2 @@
+TargetManagerNode_1 corbaloc:iiop:localhost:40000/NodeManager
+TargetManagerNode_2 corbaloc:iiop:localhost:30000/NodeManager
diff --git a/CIAO/DAnCE/TargetManager/descriptors/flattened_deploymentplan.cdp b/CIAO/DAnCE/TargetManager/descriptors/flattened_deploymentplan.cdp
new file mode 100644
index 00000000000..fae71c39fa1
--- /dev/null
+++ b/CIAO/DAnCE/TargetManager/descriptors/flattened_deploymentplan.cdp
@@ -0,0 +1,92 @@
+<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>
+ <!-- Could be ZERO -->
+ <realizes>
+ <label>BasicSP-realizes-cid</label>
+ <UUID>c0965470-7b83-11d9-9669-0800200c9a66</UUID>
+ <specificType><!-- @@ What does here? --></specificType>
+ <supportedType>IDL:BasicSP/EC: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="TargetManager-mdd">
+ <name>TargetManager-mdd</name>
+ <source><!-- @@ Don't know what goes here --></source>
+ <artifact>TargetManager_exec</artifact>
+ <artifact>TargetManager_svnt</artifact>
+ <!--
+ <execParameter></execParameter>
+ <deployRequirement></deployRequirement>
+ -->
+ </implementation>
+
+ <instance id="TargetManager-idd">
+ <name>TargetManager-idd</name>
+ <node>TargetManagerNode_1</node>
+ <source><!-- @@ What goes here --></source>
+ <implementation>TargetManager-mdd</implementation>
+ <configProperty>
+ <name>ComponentIOR</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>TargetManager.ior</string>
+ </value>
+ </value>
+ </configProperty>
+ </instance>
+
+ <!-- @@ Runtime library name must match exactly in "location" tag -->
+
+ <artifact id="TargetManager_exec">
+ <name>TargetManager_exec</name>
+ <source><!-- @@ Not sure about this--></source>
+ <node><!-- blank --></node>
+ <location>TargetManager_exec</location>
+ <execParameter>
+ <name>entryPoint</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>create_CIAO_TargetManagerHome_Impl</string>
+ </value>
+ </value>
+ </execParameter>
+ </artifact>
+
+ <artifact id="TargetManager_svnt">
+ <name>TargetManager_svnt</name>
+ <source><!-- @@ Not sure --></source>
+ <node><!-- blank --></node>
+ <location>TargetManager_svnt</location>
+ <execParameter>
+ <name>entryPoint</name>
+ <value>
+ <type>
+ <kind>tk_string</kind>
+ </type>
+ <value>
+ <string>create_CIAO_TargetManagerHome_Servant</string>
+ </value>
+ </value>
+ </execParameter>
+ </artifact>
+</Deployment:deploymentPlan>
diff --git a/CIAO/DAnCE/TargetManager/descriptors/run_test_TargetManager.pl b/CIAO/DAnCE/TargetManager/descriptors/run_test_TargetManager.pl
new file mode 100644
index 00000000000..760a67d063b
--- /dev/null
+++ b/CIAO/DAnCE/TargetManager/descriptors/run_test_TargetManager.pl
@@ -0,0 +1,160 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
+# $Id$
+# -*- perl -*-
+
+use lib "$ENV{'ACE_ROOT'}/bin";
+use PerlACE::Run_Test;
+$CIAO_ROOT = "$ENV{'CIAO_ROOT'}";
+$DAnCE = "$ENV{'CIAO_ROOT'}/DAnCE";
+
+$daemons_running = 0;
+$em_running = 0;
+$daemons = 2;
+@ports = ( 40000, 30000 );
+@iorfiles = ( "NodeApp1.ior", "NodeApp2.ior" );
+$status = 0;
+$dat_file = "NodeDetails.dat";
+$cdp_file = "flattened_DeploymentPlan.cdp";
+
+$E = 0;
+$EM = 0;
+
+# Delete if there are any .ior files.
+sub delete_ior_files {
+ for ($i = 0; $i < $daemons; ++$i) {
+ unlink $iorfiles[$i];
+ }
+ unlink PerlACE::LocalFile ("EM.ior");
+ unlink PerlACE::LocalFile ("TargetManager.ior");
+ unlink PerlACE::LocalFile ("DAM.ior");
+}
+
+sub kill_node_daemons {
+ for ($i = 0; $i < $daemons; ++$i) {
+ $Daemons[$i]->Kill (); $Daemons[$i]->TimedWait (1);
+ }
+}
+
+sub kill_open_processes {
+ if ($daemons_running == 1) {
+ kill_node_daemons ();
+ }
+
+ if ($em_running == 1) {
+ $EM->Kill ();
+ $EM->TimedWait (1);
+ }
+}
+
+sub run_node_daemons {
+ for ($i = 0; $i < $daemons; ++$i)
+ {
+ $iorfile = $iorfiles[$i];
+ $port = $ports[$i];
+
+ $iiop = "iiop://localhost:$port";
+ $node_app = "$CIAO_ROOT/bin/NodeApplication";
+
+ $d_cmd = "$CIAO_ROOT/bin/NodeManager";
+ $d_param = "-ORBEndpoint $iiop -s $node_app -o $iorfile";
+
+ $Daemons[$i] = new PerlACE::Process ($d_cmd, $d_param);
+ $result = $Daemons[$i]->Spawn ();
+ push(@processes, $Daemons[$i]);
+
+ if (PerlACE::waitforfile_timed ($iorfile,
+ $PerlACE::wait_interval_for_process_creation) == -1) {
+ print STDERR
+ "ERROR: The ior file of node daemon $i could not be found\n";
+ for (; $i > 0; --$i) {
+ $Daemons[$i]->Kill (); $Daemons[$i]->TimedWait (1);
+ }
+ return -1;
+ }
+ }
+ $daemons_running = 1;
+ return 0;
+}
+
+delete_ior_files ();
+
+# Invoke node daemons.
+print "Invoking node daemons\n";
+$status = run_node_daemons ();
+
+if ($status != 0) {
+ print STDERR "ERROR: Unable to execute the node daemons\n";
+ exit 1;
+}
+
+$ns_running = 1;
+
+# Invoke execution manager.
+print "Invoking execution manager\n";
+$EM = new PerlACE::Process ("$CIAO_ROOT/bin/Execution_Manager",
+ "-o EM.ior -i $dat_file");
+$EM->Spawn ();
+
+if (PerlACE::waitforfile_timed ("EM.ior",
+ $PerlACE::wait_interval_for_process_creation) == -1) {
+ print STDERR
+ "ERROR: The ior file of execution manager could not be found\n";
+ kill_open_processes ();
+ exit 1;
+}
+
+$em_running = 1;
+
+# Invoke executor - start the application -.
+print "Invoking executor - start the application -\n";
+$E =
+ new PerlACE::Process ("$CIAO_ROOT/bin/plan_launcher",
+ "-p flattened_deploymentplan.cdp -k file://EM.ior -o DAM.ior");
+
+$E->SpawnWaitKill (5000);
+
+if (PerlACE::waitforfile_timed (
+ "TargetManager.ior",
+ $PerlACE::wait_interval_for_process_creation) == -1) {
+ print STDERR "ERROR: The ior file of receiver could not be found\n";
+ kill_open_processes ();
+ exit 1;
+}
+
+print "Waiting for 15 secs then invoking client ===\n";
+sleep (15);
+
+print "Making 5 such calls \n";
+
+$call_num = 5;
+
+for ($i = 0; $i < $call_num; ++$i)
+{
+ print "Invoking the client\n";
+ $tmclient = new PerlACE::Process ("../CmpClient", "-t file://TargetManager.ior");
+ $result = $tmclient->SpawnWaitKill (3000);
+
+ if ($result != 0) {
+ print STDERR "ERROR: The client returned $result\n";
+ $status = 1;
+ }
+ sleep (15);
+}
+
+# Invoke executor - stop the application -.
+print "Invoking executor - stop the application -\n";
+$E =
+ new PerlACE::Process ("$CIAO_ROOT/bin/plan_launcher",
+ "-k file://EM.ior -i file://DAM.ior");
+$E->SpawnWaitKill (3000);
+
+print "Executor returned.\n";
+print "Shutting down rest of the processes.\n";
+
+delete_ior_files ();
+kill_open_processes ();
+
+exit $status;