summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornilabjar <nilabjar@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2007-02-10 20:14:28 +0000
committernilabjar <nilabjar@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2007-02-10 20:14:28 +0000
commitf11da3f924c7db3c50fb119392a536de5bc5883c (patch)
treee4a321a4a0ad632e30ac3a1292a5ae1176c172aa
parent075b56d73cd619c897ee72d7cce390c5c49519e7 (diff)
downloadATCD-TargetManager_Ext.tar.gz
ChangeLogTag: Sat Feb 10 20:13:35 UTC 2007 Nilabja R <nilabjar@dre.vanderbilt.edu>TargetManager_Ext
-rw-r--r--ChangeLog8
-rw-r--r--DAnCE/TargetManager/ResourceCommitmentManager.cpp58
-rw-r--r--DAnCE/TargetManager/ResourceCommitmentManager.h61
3 files changed, 126 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 5d98a3e2a2e..079ae5183f5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,13 @@
+Sat Feb 10 20:13:35 UTC 2007 Nilabja R <nilabjar@dre.vanderbilt.edu>
+
+ * DAnCE/TargetManager/ResourceCommitmentManager.h:
+ * DAnCE/TargetManager/ResourceCommitmentManager.cpp:
+ Added the above files.
+
Sat Feb 10 20:09:29 UTC 2007 Nilabja R <nilabjar@dre.vanderbilt.edu>
* ciao/Deployment_ResourceCommitmentManager.idl:
- Added id tag
+ Added id tag
Fri Feb 9 20:39:25 UTC 2007 Nilabja R <nilabjar@dre.vanderbilt.edu>
diff --git a/DAnCE/TargetManager/ResourceCommitmentManager.cpp b/DAnCE/TargetManager/ResourceCommitmentManager.cpp
new file mode 100644
index 00000000000..321f739899d
--- /dev/null
+++ b/DAnCE/TargetManager/ResourceCommitmentManager.cpp
@@ -0,0 +1,58 @@
+//$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
+ )
+ ACE_THROW_SPEC ((::CORBA::SystemException,
+ ::Deployment::ResourceCommitmentFailure))
+{
+ 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
+ )
+ ACE_THROW_SPEC ((::CORBA::SystemException,
+ ::Deployment::ResourceCommitmentFailure))
+{
+ ::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/DAnCE/TargetManager/ResourceCommitmentManager.h b/DAnCE/TargetManager/ResourceCommitmentManager.h
new file mode 100644
index 00000000000..c29dea0c59f
--- /dev/null
+++ b/DAnCE/TargetManager/ResourceCommitmentManager.h
@@ -0,0 +1,61 @@
+//$Id$
+//
+#ifndef DEPLOYMENT_RESOURCECOMMITMENTMANAGERI_H_
+#define DEPLOYMENT_RESOURCECOMMITMENTMANAGERI_H_
+
+#include "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
+ )
+ ACE_THROW_SPEC ((::CORBA::SystemException,
+ ::Deployment::ResourceCommitmentFailure));
+
+ virtual
+ void releaseResources (
+ const ::Deployment::ResourceAllocations & resources
+ )
+ ACE_THROW_SPEC ((::CORBA::SystemException,
+ ::Deployment::ResourceCommitmentFailure));
+
+ 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_ */