summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvenkita <venkita@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2005-08-01 13:43:23 +0000
committervenkita <venkita@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2005-08-01 13:43:23 +0000
commit6dd021d20b046c118f0ee08c70aca8f53541eecd (patch)
tree06f7fbd10706b7d8b41138e69cab4dffa621dd37
parent6cd5beec77636a0be151c3aaaf035752443ed850 (diff)
downloadATCD-6dd021d20b046c118f0ee08c70aca8f53541eecd.tar.gz
*** empty log message ***
-rw-r--r--TAO/CIAO/DAnCE/StaticConfigurator/StaticDAnCEApp.cpp156
-rw-r--r--TAO/CIAO/DAnCE/StaticConfigurator/StaticDAnCEApp.mpc28
-rw-r--r--TAO/CIAO/DAnCE/StaticConfigurator/StaticDAnCEParser.cpp201
-rw-r--r--TAO/CIAO/DAnCE/StaticConfigurator/StaticDAnCEParser.mpc16
4 files changed, 401 insertions, 0 deletions
diff --git a/TAO/CIAO/DAnCE/StaticConfigurator/StaticDAnCEApp.cpp b/TAO/CIAO/DAnCE/StaticConfigurator/StaticDAnCEApp.cpp
new file mode 100644
index 00000000000..4713063bdf0
--- /dev/null
+++ b/TAO/CIAO/DAnCE/StaticConfigurator/StaticDAnCEApp.cpp
@@ -0,0 +1,156 @@
+// $Id$
+
+#include "NodeApplication_Impl.h"
+#include "DeploymentC.h"
+#include "CIAO/DAnCE/NodeApplicationManager/ImplementationInfo.h"
+//#include "CIAO/DAnCE/RepositoryManager/RepositoryManager_Impl.h"
+//#include "CIAO/DAnCE/RepositoryManager/Update_Plan.h"
+#include "CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.h"
+#include "CIAO/DAnCE/NodeManager/NodeDaemon_Impl.h"
+//#include "Config_Handlers/DnC_Dump.h"
+//#include "orbsvcs/orbsvcs/Naming/Transient_Naming_Context.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/streams.h"
+#include "ace/Get_Opt.h"
+#include "tao/IORTable/IORTable.h"
+#include "tao/CDR.h"
+#include "plan.h"
+
+
+const char * exec_ior = "file://exec_mgr.ior";
+const char * node_daemon_ior = 0;
+const char * init_file = "deployment.dat";
+
+static void
+usage (const ACE_TCHAR* program)
+{
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Usage: %s -p <URI> -d <URI> -k <EX_IOR> \
+ -t <NODE_MANAGER_IOR> \n")
+ ACE_TEXT (" <URI>: URI identifying the package\n"),
+ program));
+}
+
+int
+ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+{
+ // top level package URL
+ char* package_url = 0;
+
+ // deployment plan URL
+ char* plan_url = 0;
+
+ // Initialize the ORB so that CORBA::Any will work
+ //
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc,
+ argv,
+ "");
+ try
+ {
+ Deployment::DeploymentPlan plan;
+
+ TAO_InputCDR in_cdr(plan_cdr_buffer, sizeof(plan_cdr_buffer)-1 );
+
+ in_cdr >> plan;
+
+ //ACE_DEBUG ((LM_DEBUG, "Dumping deployment plan===start\n"));
+ //Deployment::DnC_Dump::dump (plan);
+ //ACE_DEBUG ((LM_DEBUG, "Dumping deployment plan===end\n"));
+
+ // Pass the parsed plan to the Execution Manager to start the
+ // Deployment Process.
+
+ // 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;
+
+ // 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;
+
+ int homes_table_size =
+ sizeof (homes_table)/sizeof(HomeAttributes);
+
+ CIAO::HOMECREATOR_FUNCPTR_MAP home_creator_fptr_map;
+ CIAO::HOMESERVANTCREATOR_FUNCPTR_MAP homesvnt_creator_fptr_map;
+ CIAO::Static_Config_EntryPoints_Maps maps;
+ maps.home_creator_funcptr_map_ = &home_creator_fptr_map;
+ maps.home_servant_creator_funcptr_map_ = &homesvnt_creator_fptr_map;
+
+ int i=0;
+ for (i=0; i<homes_table_size; ++i)
+ {
+ home_creator_fptr_map.bind (homes_table[i].executor_entrypt_,
+ homes_table[i].executor_fptr_);
+
+ homesvnt_creator_fptr_map.bind (homes_table[i].servant_entrypt_,
+ homes_table[i].servant_fptr_);
+ }
+
+ CIAO::Static_DomainApplicationManager_Impl* dapp_mgr =
+ new CIAO::Static_DomainApplicationManager_Impl
+ (orb.in (),
+ poa.in (),
+ Deployment::TargetManager::_nil (),
+ plan,
+ init_file,
+ &maps);
+
+ dapp_mgr->init (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (Deployment::DomainApplicationManager::_nil());
+
+ dapp_mgr->set_uuid (plan.UUID.in ());
+
+ // Create a dummy set of properties and start the
+ // Launching of applications
+ Deployment::Properties_var properties;
+ ACE_NEW_RETURN (properties,
+ Deployment::Properties,
+ 1);
+ ACE_DEBUG ((LM_DEBUG, "Executor: start Launch application....."));
+ // Start the Application immediately
+ int start = 1;
+ dapp_mgr->startLaunch (properties.in (), start);
+ ACE_DEBUG ((LM_DEBUG, "[success]\n"));
+
+ ACE_DEBUG ((LM_DEBUG, "Executor: finish Launch application....."));
+ // Call finish Launch to complete the connections
+ dapp_mgr->finishLaunch (start);
+ ACE_DEBUG ((LM_DEBUG, "[success]\n"));
+
+ ACE_DEBUG ((LM_DEBUG, "Executor: Application Deployed successfully \n"));
+
+ // Run the main event loop for the ORB.
+ orb->run (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG, "Executor: destroy the application....."));
+ dapp_mgr->destroyApplication ();
+ ACE_DEBUG ((LM_DEBUG, "[success]\n"));
+
+ poa->destroy (1, 1 ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ catch (CORBA::Exception& ex)
+ {
+ ACE_PRINT_EXCEPTION (ex, "Caught CORBA Exception: ");
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/TAO/CIAO/DAnCE/StaticConfigurator/StaticDAnCEApp.mpc b/TAO/CIAO/DAnCE/StaticConfigurator/StaticDAnCEApp.mpc
new file mode 100644
index 00000000000..b9da59c32c9
--- /dev/null
+++ b/TAO/CIAO/DAnCE/StaticConfigurator/StaticDAnCEApp.mpc
@@ -0,0 +1,28 @@
+// -*- MPC -*-
+// $Id$
+
+project(StaticDAnCEApp): ciao_deployment_stub, ciao_deployment_svnt, ciao_server_dnc, taoexe, iortable, xerces {
+ exename = StaticDAnCEApp
+ requires += exceptions
+ includes += /usr/include
+ includes += ../NodeApplicationManager ../DomainApplicationManager ../NodeManager
+ libpaths += /usr/lib
+ libs += XSC_Config_Handlers
+ after += XSC_Config_Handlers
+ libs += DomainApplicationManager Node_Daemon NodeDaemon_stub NodeApplicationManager
+ after += DomainApplicationManager Node_Daemon NodeDaemon_stub NodeApplicationManager
+
+ libs += Hello_Base_DnC_stub
+ libs += Hello_Base_DnC_svnt
+ libs += Receiver_DnC_stub
+ libs += Receiver_DnC_svnt
+ libs += Receiver_DnC_exec
+ libs += Sender_DnC_stub
+ libs += Sender_DnC_svnt
+ libs += Sender_DnC_exec
+
+ Source_Files {
+ StaticDAnCEApp.cpp
+ }
+}
+
diff --git a/TAO/CIAO/DAnCE/StaticConfigurator/StaticDAnCEParser.cpp b/TAO/CIAO/DAnCE/StaticConfigurator/StaticDAnCEParser.cpp
new file mode 100644
index 00000000000..f8c92f5c396
--- /dev/null
+++ b/TAO/CIAO/DAnCE/StaticConfigurator/StaticDAnCEParser.cpp
@@ -0,0 +1,201 @@
+// $Id$
+
+#include "NodeApplication_Impl.h"
+//#include "Deployment_CoreC.h"
+//#include "Deployment_DataC.h"
+#include "CIAO/DAnCE/NodeApplicationManager/ImplementationInfo.h"
+//#include "CIAO/DAnCE/RepositoryManager/RepositoryManager_Impl.h"
+#include "CIAO/DAnCE/RepositoryManager/Update_Plan.h"
+#include "CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.h"
+#include "Config_Handlers/DnC_Dump.h"
+#include "orbsvcs/orbsvcs/Naming/Transient_Naming_Context.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/streams.h"
+#include "ace/Get_Opt.h"
+#include "tao/IORTable/IORTable.h"
+#include "tao/CDR.h"
+#include "Config_Handlers/XML_File_Intf.h"
+
+
+//using namespace std;
+using namespace CIAO;
+
+const char * exec_ior = "file://exec_mgr.ior";
+const char * node_daemon_ior = 0;
+const char * init_file = "deployment.dat";
+
+static void
+usage (const ACE_TCHAR* program)
+{
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("Usage: %s -p <URI> -d <URI> -k <EX_IOR> \
+ -t <NODE_MANAGER_IOR> \n")
+ ACE_TEXT (" <URI>: URI identifying the package\n"),
+ program));
+}
+
+int
+ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+{
+ // top level package URL
+ char* package_url = 0;
+
+ // deployment plan URL
+ char* plan_url = 0;
+
+ // Initialize the ORB so that CORBA::Any will work
+ //
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc,
+ argv,
+ "");
+
+ ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("p:d:"));
+ int c;
+
+ while ((c = get_opt ()) != EOF)
+ {
+ switch (c)
+ {
+ case 'p':
+ package_url = get_opt.opt_arg ();
+ break;
+
+ case 'd':
+ plan_url = get_opt.opt_arg ();
+ break;
+
+ default:
+ usage(argv[0]);
+ return -1;
+ }
+ }
+
+ if (package_url == 0) {
+ usage(argv[0]);
+ return -1;
+ }
+ /*
+ if (plan_url == 0) {
+ usage(argv[0]);
+ return -1;
+ }
+ */
+ CIAO::Config_Handlers::XML_File_Intf intf (package_url);
+
+ ::Deployment::DeploymentPlan_var plan =
+ intf.get_plan ();
+ /*
+ // call the PackageConfiguration handler to parse the XML descriptor.
+ Deployment::PackageConfiguration* pc;
+
+ CIAO::RepositoryManager_Impl *rep_impl = 0;
+ ACE_NEW_RETURN (rep_impl,
+ CIAO::RepositoryManager_Impl (),
+ -1);
+ PortableServer::ServantBase_var owner_transfer (rep_impl);
+
+ rep_impl->installPackage ("PC", package_url);
+ pc = rep_impl->findPackageByName ("PC");
+ //ACE_DEBUG ((LM_DEBUG, "Dumping package configuration===start\n"));
+ //Deployment::DnC_Dump::dump (*pc);
+ //ACE_DEBUG ((LM_DEBUG, "Dumping package configuration===end\n"));
+
+ CIAO::REF_MAP ref_map;
+ CIAO::REF_MAP primary_ref_map;
+
+ // traverse the PackageConfiguration IDL data structure and
+ // update the deployment plan IDL data structure.
+ CIAO::traverse_package (pc, plan.out(), ref_map, primary_ref_map);
+ */
+ char out_char_array[100000];
+ TAO_OutputCDR out_cdr(out_char_array, sizeof(out_char_array) );
+
+ out_cdr << plan;
+
+ ::Deployment::NodeImplementationInfo node_impl_info;
+
+ //ImplementationInfo impl_info;
+
+ if (!(node_impl_info << plan.in ()))
+ {
+ if (CIAO::debug_level () > 1)
+ ACE_DEBUG ((LM_DEBUG, "Failed to create Node Implementation Info!\n"));
+
+ }
+
+ Deployment::ComponentImplementationInfos& impl_infos = node_impl_info[0].impl_infos;
+
+ CORBA::ULong i;
+ const CORBA::ULong info_len = impl_infos.length ();
+ for (i = 0; i < info_len; ++i)
+ {
+ ACE_DEBUG ((LM_DEBUG, "The info for installation: \n\t%s\n\t%s\n\t%s\n\t%s\n\t%s\n",
+ impl_infos[i].component_instance_name.in (),
+ impl_infos[i].executor_dll.in (),
+ impl_infos[i].executor_entrypt.in (),
+ impl_infos[i].servant_dll.in (),
+ impl_infos[i].servant_entrypt.in () ));
+ }
+
+
+ FILE* fp = fopen ("plan.h", "w");
+
+ for (i=0;i < info_len; ++i)
+ {
+ ACE_OS::fprintf (fp,
+ "extern \"C\" ::Components::HomeExecutorBase_ptr %s (void);\n",
+ impl_infos[i].executor_entrypt.in ());
+ ACE_OS::fprintf (fp,
+ "extern \"C\" ::PortableServer::Servant %s \n",
+ impl_infos[i].servant_entrypt.in ());
+ ACE_OS::fprintf (fp,
+ "\t\t(::Components::HomeExecutorBase_ptr p,\n");
+ ACE_OS::fprintf (fp,
+ "\t\t::CIAO::Session_Container *c,\n");
+ ACE_OS::fprintf (fp,
+ "\t\tconst char*\n");
+ ACE_OS::fprintf (fp,
+ "\t\tACE_ENV_ARG_DECL_WITH_DEFAULTS);\n");
+ }
+
+ ACE_OS::fprintf (fp, "struct HomeAttributes\n");
+ ACE_OS::fprintf (fp, "{\n");
+ ACE_OS::fprintf (fp, " ACE_TString component_instance_name_;\n");
+ ACE_OS::fprintf (fp, " /// Specify the entrypoint to component executor DLL.\n");
+ ACE_OS::fprintf (fp, " ACE_TString executor_entrypt_;\n");
+ ACE_OS::fprintf (fp, " ::CIAO::HomeFactory executor_fptr_;\n");
+ ACE_OS::fprintf (fp, " /// Specify the entrypoint to component servant DLL.\n");
+ ACE_OS::fprintf (fp, " ACE_TString servant_entrypt_;\n");
+ ACE_OS::fprintf (fp, " ::CIAO::ServantFactory servant_fptr_;\n");
+ ACE_OS::fprintf (fp, "};\n");
+ ACE_OS::fprintf (fp, "//Homes\n");
+ ACE_OS::fprintf (fp, "HomeAttributes homes_table[]= \n");
+ ACE_OS::fprintf (fp, "{\n");
+ for (i=0;i < info_len; ++i)
+ {
+ ACE_OS::fprintf (fp, "\t{\"%s\", \"%s\", %s, \"%s\", %s}",
+ impl_infos[i].component_instance_name.in (),
+ impl_infos[i].executor_entrypt.in (),
+ impl_infos[i].executor_entrypt.in (),
+ impl_infos[i].servant_entrypt.in (),
+ impl_infos[i].servant_entrypt.in () );
+
+ if (i != info_len-1)
+ ACE_OS::fprintf (fp, ",\n");
+ }
+ ACE_OS::fprintf (fp, "};\n\n");
+
+ ACE_OS::fprintf (fp, "char plan_cdr_buffer[%d] = {", out_cdr.total_length ());
+ for (int i=0; i < out_cdr.total_length (); ++i)
+ {
+ ACE_OS::fprintf(fp, "0x%X", out_char_array[i]);
+ if (i<out_cdr.total_length ())
+ ACE_OS::fprintf(fp, ",\n");
+ }
+ ACE_OS::fprintf (fp, "};\n\n");
+
+ fclose (fp);
+
+ return 0;
+}
diff --git a/TAO/CIAO/DAnCE/StaticConfigurator/StaticDAnCEParser.mpc b/TAO/CIAO/DAnCE/StaticConfigurator/StaticDAnCEParser.mpc
new file mode 100644
index 00000000000..2c899103d37
--- /dev/null
+++ b/TAO/CIAO/DAnCE/StaticConfigurator/StaticDAnCEParser.mpc
@@ -0,0 +1,16 @@
+// -*- MPC -*-
+// $Id$
+
+project(StaticDAnCEParser): ciao_deployment_stub, ciao_deployment_svnt, ciao_server_dnc, taoexe, xerces {
+ exename = StaticDAnCEParser
+ requires += exceptions
+ includes += /usr/include
+ includes += ../NodeApplicationManager ../DomainApplicationManager ../NodeManager
+ libpaths += /usr/lib
+ libs += TAO_IORTable NodeApplicationManager DomainApplicationManager Node_Daemon XSC_Config_Handlers
+ after += TAO_IORTable NodeApplicationManager DomainApplicationManager Node_Daemon XSC_Config_Handlers
+
+ Source_Files {
+ StaticDAnCEParser.cpp
+ }
+}