diff options
author | dengg <dengg@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2006-01-18 22:01:27 +0000 |
---|---|---|
committer | dengg <dengg@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2006-01-18 22:01:27 +0000 |
commit | 9fc914bc8ac3a7f971691c4d3fa5ad0eee47b9d5 (patch) | |
tree | 3a840da0ac5c1e78f2bd3a3aa871b46223b05e01 | |
parent | 6d2ce51fadde13121ce0c0aca93cebc313c079c4 (diff) | |
download | ATCD-9fc914bc8ac3a7f971691c4d3fa5ad0eee47b9d5.tar.gz |
*** empty log message ***
-rw-r--r-- | TAO/CIAO/DAnCE/Plan_Launcher/DAM_Map.cpp | 117 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/Plan_Launcher/DAM_Map.h | 71 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.cpp | 67 | ||||
-rw-r--r-- | TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Impl.cpp | 12 |
4 files changed, 51 insertions, 216 deletions
diff --git a/TAO/CIAO/DAnCE/Plan_Launcher/DAM_Map.cpp b/TAO/CIAO/DAnCE/Plan_Launcher/DAM_Map.cpp deleted file mode 100644 index 10a85560237..00000000000 --- a/TAO/CIAO/DAnCE/Plan_Launcher/DAM_Map.cpp +++ /dev/null @@ -1,117 +0,0 @@ -#include "DAM_Map.h" -#include "ciao/CIAO_Config.h" -#include "ciao/CIAO_common.h" - -ACE_RCSID (ExecutionManager, - DAM_Map, - "$Id$") - -namespace CIAO -{ - namespace Execution_Manager - { - DAM_Map::DAM_Map (void) - : map_ (CIAO_DEFAULT_MAP_SIZE) - { - } - - bool - DAM_Map::is_plan_available (const ACE_CString &str) - { - CIAO_TRACE("Execution_Manager::DAM_Map::is_plan_available"); - if (this->map_.find (str) == 0) - return true; - - return false; - } - - ::Deployment::DomainApplicationManager_ptr - DAM_Map::fetch_dam_reference (const ACE_CString &str) - { - CIAO_TRACE("Execution_Manager::DAM_Map::fetch_dam_reference"); - if (!this->is_plan_available (str)) - return ::Deployment::DomainApplicationManager::_nil (); - - ::Deployment::DomainApplicationManager_var tmp; - - /// There should be duplicate when assigning a _var to an _var. - int retval = this->map_.find (str, - tmp); - - if (CIAO::debug_level () > 9) - { - ACE_DEBUG ((LM_DEBUG, - "(%P|%t) CIAO_ExecutionManager: fetch_dam_reference, " - "result from find is [%d] \n", - retval)); - } - - return tmp._retn (); - } - - - bool - DAM_Map::bind_dam_reference ( - const ACE_CString &str, - ::Deployment::DomainApplicationManager_ptr dam) - { - CIAO_TRACE("Execution_Manager::DAM_Map::bind_dam_reference"); - int retval = - this->map_.bind (str, - dam); - - if (retval != 0) - return false; - - return true; - } - - - Deployment::DomainApplicationManagers * - DAM_Map::get_dams (ACE_ENV_SINGLE_ARG_DECL) - { - CIAO_TRACE("Execution_Manager::DAM_Map::get_dams"); - CORBA::ULong sz = - this->map_.current_size (); - - // Initialize the list of DomainApplication Managers - Deployment::DomainApplicationManagers_var list; - ACE_NEW_THROW_EX (list, - Deployment::DomainApplicationManagers (sz), - CORBA::NO_MEMORY()); - ACE_CHECK_RETURN (0); - - // Add the manager to the list - list->length (sz); - - Iterator end = - this->map_.end (); - - CORBA::ULong i = 0; - - for (Iterator b = - this->map_.begin (); b != end; ++b) - { - list [i] = - Deployment::DomainApplicationManager::_duplicate ((*b).int_id_.in ()); - - ++i; - } - - return list._retn (); - } - - bool - DAM_Map::unbind_dam (const ACE_CString &str) - { - CIAO_TRACE("Execution_Manager::DAM_Map::unbind_dam"); - int retval = - this->map_.unbind (str); - - if (retval != 0) - return false; - - return true; - } - } -} diff --git a/TAO/CIAO/DAnCE/Plan_Launcher/DAM_Map.h b/TAO/CIAO/DAnCE/Plan_Launcher/DAM_Map.h deleted file mode 100644 index 21d8dee5de9..00000000000 --- a/TAO/CIAO/DAnCE/Plan_Launcher/DAM_Map.h +++ /dev/null @@ -1,71 +0,0 @@ -/*======================================================================= - * - * @file DAM_Map.h - * - * $Id$ - * - * @brief Map of DomainApplicationManager to UUID's - * - * @author Bala Natarajan <bala @ dre.vanderbilt.edu> - * - *======================================================================*/ -#ifndef CIAO_DAM_MAP_H -#define CIAO_DAM_MAP_H -#include /**/ "ace/pre.h" - -#include "ace/Null_Mutex.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Hash_Map_Manager.h" -#include "ciao/DeploymentC.h" -#include "ace/SString.h" - - -namespace CIAO -{ - namespace Execution_Manager - { - /** - * @class DAM_Map - * - * @brief Map of DomainApplicationManager to ACE_CStrings - * - */ - class DAM_Map - { - public: - DAM_Map (void); - - bool is_plan_available (const ACE_CString &str); - - ::Deployment::DomainApplicationManager_ptr - fetch_dam_reference (const ACE_CString &str); - - bool bind_dam_reference ( - const ACE_CString &str, - ::Deployment::DomainApplicationManager_ptr tmp); - - Deployment::DomainApplicationManagers * - get_dams (ACE_ENV_SINGLE_ARG_DECL); - - bool unbind_dam (const ACE_CString &str); - - private: - typedef - ACE_Hash_Map_Manager_Ex < ACE_CString, - ::Deployment::DomainApplicationManager_var, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> MAP; - typedef MAP::iterator Iterator; - - MAP map_; - }; - } -} - -#include /**/ "ace/post.h" -#endif /*CIAO_DAM_MAP_H*/ diff --git a/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.cpp b/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.cpp index 5408bfaf8dd..e0f63e25116 100644 --- a/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.cpp +++ b/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.cpp @@ -14,16 +14,21 @@ namespace CIAO // deployment plan URL const char* package_url = 0; const char* new_package_url = 0; + const char* plan_uuid = 0; bool use_naming = false; const char* ior_file = "file://em.ior"; const char* dap_ior_filename = 0; const char* dap_ior = 0; + enum mode_type { pl_mode_start, - pl_mode_stop, - pl_mode_interactive + pl_mode_interactive, + pl_mode_stop_by_dam, + pl_mode_stop_by_uuid, + pl_mode_redeployment }; + // default mode mode_type mode = pl_mode_interactive; static void @@ -36,6 +41,7 @@ namespace CIAO ACE_TEXT (" : Default file://em.ior\n") ACE_TEXT ("-n : Use naming service to fetch") ACE_TEXT (" Execution Manager IOR Alternative to -k\n") + ACE_TEXT ("-t <PLAN_UUID>\n") ACE_TEXT ("-o <DOMAIN_APPLICATION_MANAGER_IOR_OUTPUT_FILE>\n") ACE_TEXT ("-i <DOMAIN_APPLICATION_MANAGER_IOR_FOR_INPUT>\n") ACE_TEXT ("-r <NEW_PLAN_DESCRIPTOR_FOR_REDEPLOYMENT>\n") @@ -49,7 +55,7 @@ namespace CIAO { ACE_Get_Opt get_opt (argc, argv, - ACE_TEXT ("p:nk:o:i:r:h")); + ACE_TEXT ("p:nk:t:o:i:r:h")); int c; while ((c = get_opt ()) != EOF) @@ -71,10 +77,15 @@ namespace CIAO break; case 'i': dap_ior = get_opt.opt_arg (); - mode = pl_mode_stop; + mode = pl_mode_stop_by_dam; + break; + case 't': + plan_uuid = get_opt.opt_arg (); + mode = pl_mode_stop_by_uuid; break; case 'r': new_package_url = get_opt.opt_arg (); + mode = pl_mode_redeployment; break; case 'h': default: @@ -83,7 +94,8 @@ namespace CIAO } } - if ((mode != pl_mode_stop) && + if ((mode != pl_mode_stop_by_dam) && + (mode != pl_mode_stop_by_uuid) && (package_url == 0) && (new_package_url ==0)) { @@ -154,7 +166,7 @@ namespace CIAO ::Deployment::DomainApplicationManager_var dapp_mgr; - if (mode != pl_mode_stop && new_package_url == 0) // do initial deployment + if (mode == pl_mode_start || mode == pl_mode_interactive) // initial deployment { const char* uuid = launcher.launch_plan (package_url); @@ -178,8 +190,10 @@ namespace CIAO std::cin.getline (dummy, 256); } } - else if (mode != pl_mode_stop && new_package_url != 0) // do redeployment + else if (mode == pl_mode_redeployment && new_package_url != 0) // do redeployment { + ACE_DEBUG ((LM_DEBUG, + "Plan_Launcher: reconfigure application assembly.....")); const char* uuid = launcher.re_launch_plan (new_package_url); if (uuid == 0) @@ -188,33 +202,36 @@ namespace CIAO return -1; } } - else + else if (mode == pl_mode_stop_by_dam) // tear down by DAM { dapp_mgr = read_dap_ior (orb.in () ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; + + if (CORBA::is_nil (dapp_mgr.in ())) + { + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) CIAO_PlanLauncher:tear down assembly failed: " + "nil DomainApplicationManager reference\n")); + return -1; + } + + // Tear down the assembly + ACE_DEBUG ((LM_DEBUG, + "Plan_Launcher: destroy the application.....")); + launcher.teardown_plan (dapp_mgr.in ()); } - - if (CORBA::is_nil (dapp_mgr.in ())) + else if (mode == pl_mode_stop_by_uuid) // tear down by plan_uuid { + // Tear down the assembly ACE_DEBUG ((LM_DEBUG, - "(%P|%t) CIAO_PlanLauncher:preparePlan call failed: " - "nil DomainApplicationManager reference\n")); - return -1; + "Plan_Launcher: destroy the application.....")); + if (! launcher.teardown_plan (plan_uuid)) + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) CIAO_PlanLauncher:tear down assembly failed: " + "unkonw plan uuid.\n")); } - if (CIAO::debug_level () > 9) - ACE_DEBUG ((LM_DEBUG, - "CIAO_PlanLauncher: Obtained DAM ref \n")); - - if (mode != pl_mode_start) - { - // Tear down the assembly - ACE_DEBUG ((LM_DEBUG, - "Plan_Launcher: destroy the application.....")); - launcher.teardown_plan (dapp_mgr.in ()); - } - orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; } diff --git a/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Impl.cpp b/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Impl.cpp index dac78f283fe..c31d32be127 100644 --- a/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Impl.cpp +++ b/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Impl.cpp @@ -228,13 +228,18 @@ namespace CIAO bool Plan_Launcher_i::teardown_plan (const char *uuid) { + size_t map_size = this->map_.size (); + if (!this->map_.is_plan_available (uuid)) return false; ::Deployment::DomainApplicationManager_var dapp_mgr (this->map_.fetch_dam_reference (uuid)); - + dapp_mgr->destroyApplication (); + if (CIAO::debug_level ()) + ACE_DEBUG ((LM_DEBUG, "[success]\n")); + this->map_.unbind_dam (uuid); return true; @@ -242,11 +247,12 @@ namespace CIAO bool Plan_Launcher_i::teardown_plan (::Deployment::DomainApplicationManager_ptr dam - ACE_ENV_ARG_DECL) + ACE_ENV_ARG_DECL) { if (CIAO::debug_level ()) ACE_DEBUG ((LM_DEBUG, "CIAO_PlanLauncher: destroy the application.....\n")); + dam->destroyApplication (); if (CIAO::debug_level ()) @@ -259,7 +265,7 @@ namespace CIAO void Plan_Launcher_i::destroy_dam (::Deployment::DomainApplicationManager_ptr dam - ACE_ENV_ARG_DECL) + ACE_ENV_ARG_DECL) { if (CIAO::debug_level ()) ACE_DEBUG ((LM_DEBUG, |