summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbala <balanatarajan@users.noreply.github.com>2004-10-10 23:02:53 +0000
committerbala <balanatarajan@users.noreply.github.com>2004-10-10 23:02:53 +0000
commit9e94db8ea9473cb96de1e70e7ade28afeb19a571 (patch)
treeb8e4e3552588e0aa2fbe37ade45ceec6ca9ba630
parent04f42c5a674d77efc730728a75135b5c46fe215e (diff)
downloadATCD-9e94db8ea9473cb96de1e70e7ade28afeb19a571.tar.gz
ChangeLogTag:Sun Oct 10 22:58:59 2004 Balachandran Natarajan <bala@dre.vanderbilt.edu>
-rw-r--r--TAO/CIAO/DAnCE/ChangeLog33
-rw-r--r--TAO/CIAO/DAnCE/ExecutionManager/DAM_Map.cpp112
-rw-r--r--TAO/CIAO/DAnCE/ExecutionManager/DAM_Map.h71
-rw-r--r--TAO/CIAO/DAnCE/ExecutionManager/ExecutionManager.mpc14
-rw-r--r--TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager.cpp419
-rw-r--r--TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.cpp137
-rw-r--r--TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.h103
-rw-r--r--TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.cpp21
-rw-r--r--TAO/CIAO/DAnCE/ciao/CIAO_Config.h20
9 files changed, 703 insertions, 227 deletions
diff --git a/TAO/CIAO/DAnCE/ChangeLog b/TAO/CIAO/DAnCE/ChangeLog
index 32775ff22d3..59d58220593 100644
--- a/TAO/CIAO/DAnCE/ChangeLog
+++ b/TAO/CIAO/DAnCE/ChangeLog
@@ -1,3 +1,36 @@
+Sun Oct 10 22:58:59 2004 Balachandran Natarajan <bala@dre.vanderbilt.edu>
+
+ * ExecutionManager/DAM_Map.cpp:
+ * ExecutionManager/DAM_Map.h:
+
+ New files that stores the map of UUID of a plan to the reference
+ to DomainApplicationManager.
+
+ * ExecutionManager/ExecutionManager.mpc:
+
+ Added new files.
+
+ * ExecutionManager/Execution_Manager.cpp:
+
+ Removed a bunch of bogus options which contributed nothing. Made
+ the implementation a bit cleaner and simpler.
+
+ * ExecutionManager/Execution_Manager_Impl.cpp:
+ * ExecutionManager/Execution_Manager_Impl.h:
+
+ Total revamp of the implementation. We can now handle multiple
+ domains. We now use UUID in the plan to make an informed
+ decision on whether we are dealing with the same plan or a
+ different plan.
+
+ * Plan_Launcher/Plan_Launcher.cpp:
+
+ Cosmetic fixes.
+
+ * ciao/CIAO_Config.h:
+
+ A configuration file having compile time options.
+
Fri Oct 8 15:24:50 2004 Balachandran Natarajan <bala@dre.vanderbilt.edu>
* DAnCE/Config_Handlers/Config_Handlers.mpc:
diff --git a/TAO/CIAO/DAnCE/ExecutionManager/DAM_Map.cpp b/TAO/CIAO/DAnCE/ExecutionManager/DAM_Map.cpp
new file mode 100644
index 00000000000..933b95401ee
--- /dev/null
+++ b/TAO/CIAO/DAnCE/ExecutionManager/DAM_Map.cpp
@@ -0,0 +1,112 @@
+#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)
+ {
+ if (this->map_.find (str) == 0)
+ return true;
+
+ return false;
+ }
+
+ ::Deployment::DomainApplicationManager_ptr
+ DAM_Map::fetch_dam_reference (const ACE_CString &str)
+ {
+ 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 () > 10)
+ {
+ 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)
+ {
+ 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)
+ {
+ 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)
+ {
+ int retval =
+ this->map_.unbind (str);
+
+ if (retval != 0)
+ return false;
+
+ return true;
+ }
+ }
+}
diff --git a/TAO/CIAO/DAnCE/ExecutionManager/DAM_Map.h b/TAO/CIAO/DAnCE/ExecutionManager/DAM_Map.h
new file mode 100644
index 00000000000..bb135292af2
--- /dev/null
+++ b/TAO/CIAO/DAnCE/ExecutionManager/DAM_Map.h
@@ -0,0 +1,71 @@
+/*=======================================================================
+ *
+ * @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"
+
+
+
+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/ExecutionManager/ExecutionManager.mpc b/TAO/CIAO/DAnCE/ExecutionManager/ExecutionManager.mpc
index 36e9cdba2c1..3f4f91901b9 100644
--- a/TAO/CIAO/DAnCE/ExecutionManager/ExecutionManager.mpc
+++ b/TAO/CIAO/DAnCE/ExecutionManager/ExecutionManager.mpc
@@ -2,8 +2,12 @@
// $Id$
project (ExecutionManager_stub): ciao_deployment_stub, ciao_server_dnc {
+
sharedname = ExecutionManager_stub
- idlflags += -Wb,stub_export_macro=ExecutionManager_stub_Export -Wb,stub_export_include=ExecutionManager_stub_export.h
+
+ idlflags += -Wb,stub_export_macro=ExecutionManager_stub_Export
+ idlflags += -Wb,stub_export_include=ExecutionManager_stub_export.h
+
dynamicflags = EXECUTIONMANAGER_STUB_BUILD_DLL
IDL_Files {
@@ -15,9 +19,12 @@ project (ExecutionManager_stub): ciao_deployment_stub, ciao_server_dnc {
}
}
-project(Execution_Manager): ciao_server_dnc, ciao_deployment_svnt, ciao_deployment_stub, iortable, naming, ifr_client {
+project(Execution_Manager): ciao_deployment_svnt, naming, ifr_client {
+
exename = Execution_Manager
+
after += DomainApplicationManager ExecutionManager_stub
+
libs += DomainApplicationManager ExecutionManager_stub
IDL_Files {
@@ -26,6 +33,7 @@ project(Execution_Manager): ciao_server_dnc, ciao_deployment_svnt, ciao_deployme
Source_Files {
ExecutionManagerS.cpp
Execution_Manager.cpp
- ExecutionManager_Impl.cpp
+ Execution_Manager_Impl.cpp
+ DAM_Map.cpp
}
}
diff --git a/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager.cpp b/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager.cpp
index 7c8101ee800..fc4ad3d9e3d 100644
--- a/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager.cpp
+++ b/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager.cpp
@@ -1,250 +1,241 @@
//--*C++*--
-
-//==============================================================
-/**
- * @file Execution_Manager.cpp
- *
- * @brief CIAO's Execution Manager implementation
- *
- * $Id$
- *
- * ExecutionManager is the DnC entity which is the starting point for
- * the deployment process. This entity collaborates with other entities
- * including Logging Facility, TargetManager, and
- * DomainApplicationManager entities to facilitate the deployment and
- * launching of components. In our current design, the ExecutionManager
- * is started as an executable on a give host and registered with the
- * name service. The Executor/client obtains this reference and starts
- * the deployment process.
- *
- *
- * @author Arvind S. Krishna <arvindk@dre.vanderbilt.edu>
- * @author Tao Lu <lu@dre.vanderbilt.edu>
- */
-//===============================================================
-
-#include "ExecutionManager_Impl.h"
-#include "Server_init.h"
-#include "tao/IORTable/IORTable.h"
+// $Id$
+#include "Execution_Manager_Impl.h"
// Include Name Service header
#include "orbsvcs/CosNamingC.h"
+#include "tao/Utils/Implicit_Deactivator.h"
#include "ace/SString.h"
#include "ace/Read_Buffer.h"
#include "ace/Get_Opt.h"
#include "ace/OS_NS_unistd.h"
-const char *ior_file_name_ = "executionManager.ior";
-char * default_svcconf_ = 0;
-char * svcconf_config_ = 0;
-const char * name = "ExecutionManager";
-const char * init_file_name = "deployment.dat";
-
-int write_to_ior_ = 0;
-int register_with_ns_ = 0;
-
-int
-parse_args (int argc, char *argv[])
+namespace CIAO
{
- ACE_Get_Opt get_opts (argc, argv, "o:c:m:i:n");
- int c;
- while ((c = get_opts ()) != -1)
- switch (c)
- {
- case 'o': // get the file name to write to
- ior_file_name_ = get_opts.opt_arg ();
- write_to_ior_ = 1;
- break;
-
- case 'c': // get the default svc.conf filename
- default_svcconf_ = get_opts.opt_arg ();
- break;
-
- case 'i': // get the svc.conf map configuration filename
- init_file_name = get_opts.opt_arg ();
- break;
-
- case 'n':
- register_with_ns_ = 1;
- break;
-
- case '?': // display help for use of the server.
- default:
- ACE_ERROR_RETURN ((LM_ERROR,
- "usage: %s\n"
- "-o <ior_output_file>\n"
- "-c <svc.conf file>\n"
- "-i <installation data filename>\n"
- "-n <use naming service>\n"
- "\n",
- argv [0]),
- -1);
- }
+ namespace Execution_Manager
+ {
+ const char *ior_file_name_ = "executionManager.ior";
+ const char *init_file_name = "deployment.dat";
- return 0;
-}
-
-int
-write_IOR(const char* ior)
-{
- FILE* ior_output_file_ =
- ACE_OS::fopen (ior_file_name_, "w");
+ bool register_with_ns_ = 0;
- if (ior_output_file_)
+ bool
+ parse_args (int argc, char *argv[])
{
- ACE_OS::fprintf (ior_output_file_,
- "%s",
- ior);
- ACE_OS::fclose (ior_output_file_);
+ ACE_Get_Opt get_opts (argc, argv, "o:m:i:n");
+ int c;
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'o':
+ ior_file_name_ = get_opts.opt_arg ();
+ break;
+ case 'i':
+ init_file_name = get_opts.opt_arg ();
+ break;
+ case 'n':
+ register_with_ns_ = 1;
+ break;
+ case '?': // display help for use of the server.
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s\n"
+ "-o <ior_output_file>\n"
+ "-i <installation data filename>\n"
+ "-n <use naming service>\n"
+ "\n",
+ argv [0]),
+ false);
+ }
+
+ return true;
}
- return 0;
-}
+ bool
+ write_ior_file (CORBA::ORB_ptr orb,
+ CIAO::ExecutionManagerDaemon_ptr obj
+ ACE_ENV_ARG_DECL)
+ {
+ CORBA::String_var ior =
+ orb->object_to_string (obj
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
-bool
-register_with_ns (const char * name_context,
- CORBA::ORB_ptr orb,
- CIAO::ExecutionManagerDaemon_ptr obj
- ACE_ENV_ARG_DECL)
-{
- // Naming Service related operations
- CORBA::Object_var naming_context_object =
- orb->resolve_initial_references ("NameService"
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (false);
-
- CosNaming::NamingContext_var naming_context =
- CosNaming::NamingContext::_narrow (naming_context_object.in ());
-
- // Initialize the Naming Sequence
- CosNaming::Name name (1);
- name.length (1);
- // Register the name with the NS
- name[0].id = name_context;
-
- // Register the servant with the Naming Service
- naming_context->bind (name,
- obj
- ACE_ENV_ARG_PARAMETER);
- ACE_CHECK_RETURN (false);
+ FILE* ior_output_file_ =
+ ACE_OS::fopen (ior_file_name_, "w");
- return true;
-}
+ if (ior_output_file_)
+ {
+ ACE_OS::fprintf (ior_output_file_,
+ "%s",
+ ior.in ());
+ ACE_OS::fclose (ior_output_file_);
+ }
+ else
+ return false;
-int
-main (int argc, char *argv[])
-{
- ACE_TRY_NEW_ENV
+ return true;
+ }
+
+ bool
+ register_with_ns (CORBA::ORB_ptr orb,
+ CIAO::ExecutionManagerDaemon_ptr obj
+ ACE_ENV_ARG_DECL)
{
- // @@ Error checking is very bad! Need to be fixed!
- // -- bala
- // Initialize orb
- CORBA::ORB_var orb = CORBA::ORB_init (argc,
- argv,
- ""
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- if (parse_args (argc, argv) != 0)
- return -1;
-
- // Get reference to Root POA.
- CORBA::Object_var obj
- = orb->resolve_initial_references ("RootPOA"
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- PortableServer::POA_var poa
- = PortableServer::POA::_narrow (obj.in ()
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- CORBA::Object_var table_object =
- orb->resolve_initial_references ("IORTable"
+ // Naming Service related operations
+ CORBA::Object_var naming_context_object =
+ orb->resolve_initial_references ("NameService"
ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ ACE_CHECK_RETURN (false);
- IORTable::Table_var adapter =
- IORTable::Table::_narrow (table_object.in ()
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- if (CORBA::is_nil (adapter.in ()))
- ACE_ERROR_RETURN ((LM_ERROR, "Nil IORTable\n"), -1);
-
- // Create and install the CIAO Daemon servant
- CIAO::ExecutionManager_Impl *daemon_servant = 0;
- ACE_NEW_RETURN (daemon_servant,
- CIAO::ExecutionManager_Impl(orb.in (),
- poa.in (),
- init_file_name),
- -1);
-
- // Implicit activation
- PortableServer::ServantBase_var safe_daemon (daemon_servant);
- CIAO::ExecutionManagerDaemon_var daemon =
- daemon_servant->_this ();
-
- // Now register daemon with IOR table and write its IOR.
- CORBA::String_var str =
- orb->object_to_string (daemon.in ()
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ CosNaming::NamingContext_var naming_context =
+ CosNaming::NamingContext::_narrow (naming_context_object.in ());
+
+ // Initialize the Naming Sequence
+ CosNaming::Name name (2);
+ name.length (2);
- adapter->bind ("ExecutionManager",
- str.in ()
- ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ // String dup required for MSVC6
+ name[0].id = CORBA::string_dup ("CIAO");
+ name[1].id = CORBA::string_dup ("ExecutionManager");
- if (write_to_ior_)
- write_IOR (str.in ());
- else if (register_with_ns_)
+ // Register the servant with the Naming Service
+ naming_context->bind (name,
+ obj
+ ACE_ENV_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false);
+
+ return true;
+ }
+
+ int
+ run_main (int argc, char *argv[])
+ {
+ ACE_DECLARE_NEW_CORBA_ENV;
+
+ ACE_TRY
{
- // Register this name with the Naming Service
- (void) register_with_ns (name,
- orb.in (),
- daemon.in ()
- ACE_ENV_ARG_PARAMETER);
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc,
+ argv,
+ ""
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (!parse_args (argc, argv))
+ return -1;
+
+ // Get reference to Root POA.
+ CORBA::Object_var obj
+ = orb->resolve_initial_references ("RootPOA"
+ ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
- }
-#if 0
- ACE_DEBUG ((LM_INFO,
- "CIAO_ExecutionMananger IOR: %s\n", str.in ()));
-#endif /*if 0*/
+ PortableServer::POA_var poa =
+ PortableServer::POA::_narrow (obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
- // Activate POA manager
- PortableServer::POAManager_var mgr
- = poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
- mgr->activate (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ if (poa.in () == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%P|%t) CIAO_ExecutionManager: "
+ "Nil POA panic error, returning \n"),
+ -1);
- // End Deployment part
- ACE_DEBUG ((LM_DEBUG,
- "CIAO_ExecutionManager is running...\n"));
+ // Create and install the CIAO Daemon servant
+ Execution_Manager_Impl *daemon_servant = 0;
+ ACE_NEW_RETURN (daemon_servant,
+ Execution_Manager_Impl(orb.in (),
+ poa.in (),
+ init_file_name),
+ -1);
- // Run the main event loop for the ORB.
- orb->run (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK
+ // Implicit activation
+ PortableServer::ServantBase_var safe_daemon (daemon_servant);
- poa->destroy (1, 1 ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
+ CIAO::ExecutionManagerDaemon_var daemon =
+ daemon_servant->_this ();
- orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
- }
- ACE_CATCHANY
- {
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "CIAO_ExecutionManager::main\t\n");
- return 1;
+ TAO::Utils::Implicit_Deactivator de (daemon_servant
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ bool retval = false;
+
+ if (register_with_ns_)
+ {
+ retval =
+ register_with_ns (orb.in (),
+ daemon.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ else
+ {
+ retval =
+ write_ior_file (orb.in (),
+ daemon.in ()
+ ACE_ENV_ARG_PARAMETER);
+ }
+
+ if (!retval)
+ return -1;
+
+ // Activate POA manager
+ PortableServer::POAManager_var mgr =
+ poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (mgr.in () == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%P|%t) CIAO_ExecutionManager: "
+ "Nil POA Manager error, returning \n"),
+ -1);
+
+ mgr->activate (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // End Deployment part
+ ACE_DEBUG ((LM_DEBUG,
+ "CIAO_ExecutionManager is running...\n"));
+
+ // Run the main event loop for the ORB.
+ orb->run (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // Forget the pointer. The POA will take care of it during
+ // destroy.
+ (void) de.release ();
+
+ poa->destroy (1,
+ 1
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "CIAO_ExecutionManager::main\t\n");
+ return -1;
+ }
+ ACE_ENDTRY;
+
+ ACE_DEBUG ((LM_DEBUG,
+ "CIAO_ExecutionManager has closed\n"));
+ return 0;
}
- ACE_ENDTRY;
- ACE_DEBUG ((LM_DEBUG,
- "CIAO_ExecutionManager has closed\n"));
- return 0;
+ }
+}
+
+int
+main (int argc, char *argv[])
+{
+ return CIAO::Execution_Manager::run_main (argc,
+ argv);
}
diff --git a/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.cpp b/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.cpp
new file mode 100644
index 00000000000..cef270a33c2
--- /dev/null
+++ b/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.cpp
@@ -0,0 +1,137 @@
+// $Id$
+#include "Execution_Manager_Impl.h"
+#include "ciao/CIAO_common.h"
+#include "DomainApplicationManager/DomainApplicationManager_Impl.h"
+
+ACE_RCSID (ExecutionManager,
+ Execution_Manager_Impl,
+ "$Id$")
+
+namespace CIAO
+{
+ namespace Execution_Manager
+ {
+ Execution_Manager_Impl::Execution_Manager_Impl (
+ CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ const char * init_file)
+ : orb_ (CORBA::ORB::_duplicate (orb))
+ , poa_ (PortableServer::POA::_duplicate (poa))
+ , init_file_ (init_file)
+ {
+ }
+
+ Execution_Manager_Impl::~Execution_Manager_Impl (void)
+ {
+ }
+
+ Deployment::DomainApplicationManager_ptr
+ Execution_Manager_Impl::preparePlan (
+ const Deployment::DeploymentPlan &plan,
+ CORBA::Boolean
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Deployment::ResourceNotAvailable,
+ Deployment::PlanError,
+ Deployment::StartError
+ ))
+ {
+ if (CIAO::debug_level () > 10)
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) CIAO_Execution_Manager: preparePlan "
+ " invoked \n"));
+
+ if (this->map_.is_plan_available (plan.UUID.in ()))
+ return this->map_.fetch_dam_reference (plan.UUID.in ());
+
+
+
+ CIAO::DomainApplicationManager_Impl *dam_servant = 0;
+
+ // Create a new DomainApplicationMananager servant
+ ACE_NEW_THROW_EX (
+ dam_servant,
+ CIAO::DomainApplicationManager_Impl (
+ this->orb_.in (),
+ this->poa_.in (),
+ ::Deployment::TargetManager::_nil (),
+ plan,
+ this->init_file_.c_str ()),
+ CORBA::NO_MEMORY ());
+
+ ACE_CHECK_RETURN (::Deployment::DomainApplicationManager::_nil ());
+
+ PortableServer::ServantBase_var safe_daemon (dam_servant);
+
+ dam_servant->init (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (::Deployment::DomainApplicationManager::_nil ());
+
+ /// @@ Can be removed -- Bala
+ dam_servant->set_uuid (plan.UUID.in ());
+
+ Deployment::DomainApplicationManager_var dam =
+ dam_servant->_this ();
+
+ /// @@ TODO:Need to check the return value......
+ this->map_.bind_dam_reference (
+ plan.UUID.in (),
+ Deployment::DomainApplicationManager::_duplicate (dam.in ()));
+
+ // Return the ApplicationManager instance
+ return dam._retn ();
+ }
+
+ Deployment::DomainApplicationManagers *
+ Execution_Manager_Impl::getManagers (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ return this->map_.get_dams (ACE_ENV_SINGLE_ARG_PARAMETER);
+ }
+
+ void
+ Execution_Manager_Impl::destroyManager (
+ Deployment::DomainApplicationManager_ptr manager
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Deployment::StopError))
+ {
+ ACE_TRY
+ {
+ ::Deployment::DeploymentPlan_var plan =
+ manager->getPlan (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ (void) this->map_.unbind_dam (plan->UUID.in ());
+
+ manager->destroyApplication (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+#if 0
+ PortableServer::ObjectId_var oid =
+ this->poa_->reference_to_id (manager
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ this->poa_->deactivate_object (oid.in ()
+ ACE_ENV_ARG_PARAMETER);
+#endif /*if 0*/
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Execution_Manager_Impl::destroyManager\t\n");
+ ACE_THROW (Deployment::StopError ());
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+ }
+
+ void
+ Execution_Manager_Impl::shutdown (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+ {
+ // Shutdown the ORB on which it is runing
+ this->orb_->shutdown (0 ACE_ENV_ARG_PARAMETER);
+ }
+ }
+}
diff --git a/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.h b/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.h
new file mode 100644
index 00000000000..f432da36638
--- /dev/null
+++ b/TAO/CIAO/DAnCE/ExecutionManager/Execution_Manager_Impl.h
@@ -0,0 +1,103 @@
+/*=======================================================================
+ *
+ * @file ExecutionManager_Impl.h
+ *
+ * $Id$
+ *
+ * @brief This file contains implementation for
+ * Deployment::ExecutionManager interface.
+ *
+ * @author Arvind S. Krishna <arvindk@dre.vanderbilt.edu>
+ * @auther Tao Lu <lu@dre.vanderbilt.edu>
+ *
+ *======================================================================*/
+
+#ifndef CIAO_EXECUTION_MANAGER_IMPL_H
+#define CIAO_EXECUTION_MANAGER_IMPL_H
+#include /**/ "ace/pre.h"
+
+#include "ExecutionManagerS.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "DAM_Map.h"
+
+#if defined(_MSC_VER)
+#if (_MSC_VER >= 1200)
+#pragma warning(push)
+#endif /* _MSC_VER >= 1200 */
+#pragma warning(disable:4250)
+#endif /* _MSC_VER */
+
+namespace CIAO
+{
+ namespace Execution_Manager
+ {
+ /**
+ *
+ * @class Execution_Manager_Impl
+ *
+ * @brief This class implements the
+ * ExecutionManger. ExecutionManager starts the execution process
+ * after the planning stage.
+ *
+ */
+ class Execution_Manager_Impl
+ : public virtual POA_CIAO::ExecutionManagerDaemon,
+ public virtual PortableServer::RefCountServantBase
+ {
+ public:
+ Execution_Manager_Impl (CORBA::ORB_ptr orb,
+ PortableServer::POA_ptr poa,
+ const char * init_file);
+
+ /// Template methods from ExecutionManagerDaemon, please see
+ /// $CIAO_ROOT/ciao/Deployment.idl for documentation
+ virtual Deployment::DomainApplicationManager_ptr
+ preparePlan (const Deployment::DeploymentPlan & plan,
+ CORBA::Boolean commitResources
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Deployment::ResourceNotAvailable,
+ Deployment::PlanError,
+ Deployment::StartError));
+
+ virtual Deployment::DomainApplicationManagers *
+ getManagers (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ virtual void
+ destroyManager (Deployment::DomainApplicationManager_ptr manager
+ ACE_ENV_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException,
+ Deployment::StopError));
+
+ virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL)
+ ACE_THROW_SPEC ((CORBA::SystemException));
+
+ protected:
+ /// Destructor.
+ ~Execution_Manager_Impl (void);
+
+ /// Cached ORB pointer
+ CORBA::ORB_var orb_;
+
+ /// Cached POA pointer
+ PortableServer::POA_var poa_;
+
+ // Path to the initialization file
+ const ACE_CString init_file_;
+
+ DAM_Map map_;
+ };
+ }
+}
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+#pragma warning(pop)
+#endif /* _MSC_VER */
+
+#include /**/ "ace/post.h"
+#endif /* EXECUTIONMANAGER_IMPL_H */
diff --git a/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.cpp b/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.cpp
index 010ad82af9a..855ed7f5fec 100644
--- a/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.cpp
+++ b/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher.cpp
@@ -90,12 +90,6 @@ namespace CIAO
int
run_main_implementation (int argc, char *argv[])
{
- if (package_url == 0)
- {
- usage (argv[0]);
- return -1;
- }
-
ACE_DECLARE_NEW_CORBA_ENV;
ACE_TRY
@@ -107,6 +101,12 @@ namespace CIAO
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
+ if (!parse_args || package_url == 0)
+ {
+ usage (argv[0]);
+ return -1;
+ }
+
CORBA::Object_var obj;
if (use_naming)
@@ -133,7 +133,7 @@ namespace CIAO
if (CORBA::is_nil (exec_mgr.in ()))
{
ACE_ERROR ((LM_ERROR,
- "(%P|%t) CIAO_Executor: nil Execution"
+ "(%P|%t) CIAO_PlanLauncher: nil Execution"
" Manager reference, narrow failed\n"));
return -1;
}
@@ -149,21 +149,22 @@ namespace CIAO
intf.get_plan ();
::Deployment::DomainApplicationManager_var dapp_mgr =
- exec_mgr->preparePlan (plan, 1);
+ exec_mgr->preparePlan (plan,
+ 1);
if (CORBA::is_nil (dapp_mgr.in ()))
{
ACE_DEBUG ((LM_DEBUG,
"(%P|%t) CIAO_Executor:preparePlan call failed:nil "
"DomainApplicationManager reference\n"));
- return 0;
+ return -1;
}
if (CIAO::debug_level () > 10)
ACE_DEBUG ((LM_DEBUG,
"CIAO_Executor: Obtained DAM ref \n"));
- ///===== BALA
+ // == BALA check some bogus things here..
// Create a dummy set of properties and start the
// Launching of applications
::Deployment::Properties_var properties;
diff --git a/TAO/CIAO/DAnCE/ciao/CIAO_Config.h b/TAO/CIAO/DAnCE/ciao/CIAO_Config.h
new file mode 100644
index 00000000000..42b04622520
--- /dev/null
+++ b/TAO/CIAO/DAnCE/ciao/CIAO_Config.h
@@ -0,0 +1,20 @@
+// -*- C++ -*-
+//=============================================================================
+/**
+ * @file CIAO_Config.h
+ *
+ * $Id$
+ *
+ * CIAO compile time configuration file.
+ *
+ * @author Bala Natarajan <bala @ dre.vanderbilt.edu>
+ */
+//=============================================================================
+#ifndef CIAO_CONFIG_H
+#define CIAO_CONFIG_H
+
+#if !defined (CIAO_DEFAULT_MAP_SIZE)
+# define CIAO_DEFAULT_MAP_SIZE 64
+#endif /* CIAO_DEFAULT_MAP_SIZE */
+
+#endif /*CIAO_CONFIG_H*/