diff options
Diffstat (limited to 'DAnCE/dance')
204 files changed, 0 insertions, 27443 deletions
diff --git a/DAnCE/dance/.gitignore b/DAnCE/dance/.gitignore deleted file mode 100644 index e6845b1a219..00000000000 --- a/DAnCE/dance/.gitignore +++ /dev/null @@ -1,18 +0,0 @@ -/DAnCE_ArtifactInstallationC.cpp -/DAnCE_ArtifactInstallationC.h -/DAnCE_ArtifactInstallationC.inl -/DAnCE_ArtifactInstallationS.cpp -/DAnCE_ArtifactInstallationS.h -/DAnCE_DeploymentInterceptorsC.cpp -/DAnCE_DeploymentInterceptorsC.h -/DAnCE_DeploymentInterceptorsS.h -/DAnCE_LocalityManagerC.cpp -/DAnCE_LocalityManagerC.h -/DAnCE_LocalityManagerC.inl -/DAnCE_LocalityManagerS.cpp -/DAnCE_LocalityManagerS.h -/DAnCE_PropertiesC.cpp -/DAnCE_PropertiesC.h -/DAnCE_PropertiesS.h -/DAnCE_skel_export.h -/DAnCE_stub_export.h diff --git a/DAnCE/dance/DAnCE_ArtifactInstallation.idl b/DAnCE/dance/DAnCE_ArtifactInstallation.idl deleted file mode 100644 index 999b8782b60..00000000000 --- a/DAnCE/dance/DAnCE_ArtifactInstallation.idl +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef DANCE_ARTIFACT_INSTALLATION_IDL -#define DANCE_ARTIFACT_INSTALLATION_IDL - -#include "Deployment/Deployment_DeploymentPlan.idl" -#include "Deployment/Deployment_PlanError.idl" - -module DAnCE -{ - interface ArtifactInstallation - { - void initialize () - raises (::Deployment::PlanError); - - void clear () - raises (::Deployment::PlanError); - - /// Acts as a front end to the ArtifactInstallationHandlers - /// that were installed at object creation. Each InstallationHandler - /// is capable of handling a single URI type; - void install (in string plan_uuid, - in ::Deployment::ArtifactDeploymentDescription artifact) - raises (::Deployment::PlanError); - - void remove (in string plan_uuid, - in string artifact_name) - raises (::Deployment::PlanError); - - void remove_all (in string plan_uuid) - raises (::Deployment::PlanError); - - /// Used by component/locality server to query location of a given artifact - string get_artifact_location (in string uuid, - in string artifact_name); - }; -}; - -#endif /* DANCE_ARTIFACT_INSTALLATION_IDL */ diff --git a/DAnCE/dance/DAnCE_Core.mpc b/DAnCE/dance/DAnCE_Core.mpc deleted file mode 100644 index 827536dba9a..00000000000 --- a/DAnCE/dance/DAnCE_Core.mpc +++ /dev/null @@ -1,89 +0,0 @@ -project(DAnCE_IDL) : dancelib_with_idl, dance_output, valuetype, gen_ostream, \ - dance_deployment_stub, install { - custom_only = 1 - idlflags += -Wb,stub_export_macro=DANCE_STUB_Export \ - -Wb,stub_export_include=DAnCE_stub_export.h \ - -Wb,skel_export_macro=DANCE_SKEL_Export \ - -Wb,skel_export_include=DAnCE_skel_export.h - - IDL_Files { - idlflags += -SS -Sci - DAnCE_DeploymentInterceptors.idl - DAnCE_Properties.idl - } - - IDL_Files { - idlflags += -Gxhst -Gxhsk - DAnCE_LocalityManager.idl - } - - IDL_Files { - DAnCE_ArtifactInstallation.idl - } -} - -project (DAnCE_stub) : dancelib_with_idl, dance_output, \ - dance_applicationmanager_stub, dance_deployment_stub, \ - dance_logger, install \ -{ - after += DAnCE_IDL - dynamicflags += DANCE_STUB_BUILD_DLL - IDL_Files { - } - - Source_Files { - DAnCE_DeploymentInterceptorsC.cpp - DAnCE_PropertiesC.cpp - DAnCE_LocalityManagerC.cpp - DAnCE_ArtifactInstallationC.cpp - DAnCE_Utility.cpp - DAnCE_DeploymentInterceptors_Base_Impl.cpp - } - - Inline_Files { - DAnCE_LocalityManagerC.inl - DAnCE_ArtifactInstallationC.inl - } - - Header_Files { - DAnCE_Utility.h - DAnCE_stub_export.h - DAnCE_DeploymentInterceptorsC.h - DAnCE_PropertiesC.h - DAnCE_LocalityManagerC.h - DAnCE_ArtifactInstallationC.h - Version.h - } - - Template_Files { - DAnCE_Utility.tpp - } - - InstallData_Files { - gendir = bin - ../bin/ciao.localityconfig - ../bin/nodemanager.localityconfig - } -} - -project (DAnCE_skel) : dancelib_with_idl, dance_output, dance_stub, \ - dance_applicationmanager_skel, dance_deployment_skel, install \ -{ - dynamicflags += DANCE_SKEL_BUILD_DLL - IDL_Files { - } - - Source_Files { - DAnCE_LocalityManagerS.cpp - DAnCE_ArtifactInstallationS.cpp - } - - Inline_Files { - } - - Header_Files { - DAnCE_LocalityManagerS.h - DAnCE_ArtifactInstallationS.h - DAnCE_skel_export.h - } -} diff --git a/DAnCE/dance/DAnCE_DeploymentInterceptors.idl b/DAnCE/dance/DAnCE_DeploymentInterceptors.idl deleted file mode 100644 index 1f61ce57032..00000000000 --- a/DAnCE/dance/DAnCE_DeploymentInterceptors.idl +++ /dev/null @@ -1,99 +0,0 @@ -#ifndef DANCE_DEPLOYMENTINTERCEPTOR_IDL -#define DANCE_DEPLOYMENTINTERCEPTOR_IDL - -#include "Deployment/Deployment_DeploymentPlan.idl" -#include "Deployment/Deployment_PlanError.idl" -#include "Deployment/Deployment_InvalidProperty.idl" -#include "Deployment/Deployment_InvalidNodeExecParameter.idl" -#include "Deployment/Deployment_InvalidComponentExecParameter.idl" -#include "Deployment/Deployment_InvalidConnection.idl" -#include "Deployment/Deployment_StartError.idl" -#include "Deployment/Deployment_StopError.idl" - -module DAnCE -{ - local interface DeploymentInterceptor - { - /// Invoked when the interceptor is loaded, before any other - /// event. - void configure (in ::Deployment::Properties config); - - - void preprocess_plan (inout ::Deployment::DeploymentPlan plan) - raises (::Deployment::PlanError); - - void pre_install (inout ::Deployment::DeploymentPlan plan, - in unsigned long instanceRef) - raises (::Deployment::PlanError, - ::Deployment::InvalidProperty, - ::Deployment::InvalidNodeExecParameter, - ::Deployment::InvalidComponentExecParameter); - - void post_install (in ::Deployment::DeploymentPlan plan, - in unsigned long instance_index, - in any instance_reference, - in any exception_thrown) - raises (::Deployment::PlanError, - ::Deployment::InvalidProperty, - ::Deployment::InvalidNodeExecParameter, - ::Deployment::InvalidComponentExecParameter); - - void post_endpoint_reference (in ::Deployment::DeploymentPlan plan, - in unsigned long connectionRef, - in any endpoint_reference, - in any exception_thrown) - raises (::Deployment::InvalidConnection); - - void pre_connect (inout ::Deployment::DeploymentPlan plan, - in unsigned long connection_index, - inout any provided_reference) - raises (::Deployment::InvalidConnection); - - void post_connect (in Deployment::DeploymentPlan plan, - in unsigned long connectionRef, - in any exceptionThrown) - raises (::Deployment::InvalidConnection); - - void pre_disconnect (inout ::Deployment::DeploymentPlan plan, - in unsigned long connection_index) - raises (::Deployment::InvalidConnection); - - void post_disconnect (in Deployment::DeploymentPlan plan, - in unsigned long connectionRef, - in any exceptionThrown) - raises (::Deployment::InvalidConnection); - - void post_configured (in ::Deployment::DeploymentPlan plan, - in unsigned long instanceRef, - in any exception_thrown) - raises (::Deployment::StartError); - - void post_activate (in ::Deployment::DeploymentPlan plan, - in unsigned long instanceRef, - in any exception_thrown) - raises (::Deployment::StartError); - - void post_passivate (in ::Deployment::DeploymentPlan plan, - in unsigned long instanceRef, - in any exception_thrown) - raises (::Deployment::StopError); - void post_remove (in ::Deployment::DeploymentPlan plan, - in unsigned long instanceRef, - in any exception_thrown) - raises (::Deployment::StopError); - - /** - * @brief Invoked on an unexpected event, not usually during normal deployment activity. - * @param plan The deployment plan which the instance is a part of. - * @param instanceRef The instance on which this unexpected event took place. - * @param exception_thrown An exception that was thrown, if any, which should not be re-thrown. - * @param error A human-readable error message, if appropriate - */ - void unexpected_event (in ::Deployment::DeploymentPlan plan, - in unsigned long instanceRef, - in any exception_thrown, - in string error); - }; -}; - -#endif diff --git a/DAnCE/dance/DAnCE_DeploymentInterceptors_Base_Impl.cpp b/DAnCE/dance/DAnCE_DeploymentInterceptors_Base_Impl.cpp deleted file mode 100644 index 4a31e06dfc9..00000000000 --- a/DAnCE/dance/DAnCE_DeploymentInterceptors_Base_Impl.cpp +++ /dev/null @@ -1,119 +0,0 @@ -// -*- C++ -*- -#include "DAnCE_DeploymentInterceptors_Base_Impl.h" - -namespace DAnCE -{ - // Implementation skeleton constructor - DeploymentInterceptor_Base::DeploymentInterceptor_Base (void) - { - } - - // Implementation skeleton destructor - DeploymentInterceptor_Base::~DeploymentInterceptor_Base (void) - { - } - - void - DeploymentInterceptor_Base::configure (const ::Deployment::Properties &) - { - // Add your implementation here - } - - void - DeploymentInterceptor_Base::preprocess_plan (::Deployment::DeploymentPlan &) - { - // Add your implementation here - } - - void - DeploymentInterceptor_Base::pre_install (::Deployment::DeploymentPlan &, - ::CORBA::ULong) - { - // Add your implementation here - } - - void - DeploymentInterceptor_Base::post_install (const ::Deployment::DeploymentPlan &, - ::CORBA::ULong, - const ::CORBA::Any & , - const ::CORBA::Any & ) - { - // Add your implementation here - } - - void - DeploymentInterceptor_Base::post_endpoint_reference (const ::Deployment::DeploymentPlan & , - ::CORBA::ULong , - const ::CORBA::Any & , - const ::CORBA::Any & ) - { - // Add your implementation here - } - - void - DeploymentInterceptor_Base::pre_connect (::Deployment::DeploymentPlan & , - ::CORBA::ULong , - ::CORBA::Any & ) - { - // Add your implementation here - } - - void - DeploymentInterceptor_Base::post_connect (const ::Deployment::DeploymentPlan & , - ::CORBA::ULong , - const ::CORBA::Any & ) - { - // Add your implementation here - } - - void - DeploymentInterceptor_Base::pre_disconnect (::Deployment::DeploymentPlan &, - ::CORBA::ULong) - { - // Add your implementation here - } - - void - DeploymentInterceptor_Base::post_disconnect (const ::Deployment::DeploymentPlan &, - ::CORBA::ULong, - const ::CORBA::Any &) - { - // Add your implementation here - } - - void DeploymentInterceptor_Base::post_configured (const ::Deployment::DeploymentPlan & , - ::CORBA::ULong , - const ::CORBA::Any &) - { - // Add your implementation here - } - - void DeploymentInterceptor_Base::post_activate (const ::Deployment::DeploymentPlan & , - ::CORBA::ULong , - const ::CORBA::Any & ) - { - // Add your implementation here - } - - void DeploymentInterceptor_Base::post_passivate (const ::Deployment::DeploymentPlan & , - ::CORBA::ULong , - const ::CORBA::Any &) - { - // Add your implementation here - } - - void DeploymentInterceptor_Base::post_remove (const ::Deployment::DeploymentPlan & , - ::CORBA::ULong , - const ::CORBA::Any & ) - { - // Add your implementation here - } - - void DeploymentInterceptor_Base::unexpected_event (const ::Deployment::DeploymentPlan &, - ::CORBA::ULong, - const ::CORBA::Any &, - const char *) - { - } -} - diff --git a/DAnCE/dance/DAnCE_DeploymentInterceptors_Base_Impl.h b/DAnCE/dance/DAnCE_DeploymentInterceptors_Base_Impl.h deleted file mode 100644 index 20533f11e44..00000000000 --- a/DAnCE/dance/DAnCE_DeploymentInterceptors_Base_Impl.h +++ /dev/null @@ -1,109 +0,0 @@ -// -*- C++ -*- -/** - * @file DAnCE_DeploymentInterceptors_Base_Impl.h - * - * Base, no-op interceptor. - **/ - -// TAO_IDL - Generated from -// be/be_codegen.cpp:1571 - -#ifndef DANCE_DEPLOYMENTINTERCEPTORSI_DHYD9F_H_ -#define DANCE_DEPLOYMENTINTERCEPTORSI_DHYD9F_H_ - -#include "dance/DAnCE_DeploymentInterceptorsC.h" -#include "dance/DAnCE_stub_export.h" -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/LocalObject.h" - -namespace DAnCE -{ - /** - * @class DAnCE_DeploymentInterceptor_Base - * @brief Base, no-op interceptor implementation. - */ - class DANCE_STUB_Export DeploymentInterceptor_Base - : public virtual DAnCE::DeploymentInterceptor, - public virtual ::CORBA::LocalObject - { - public: - // Constructor - DeploymentInterceptor_Base (void); - - // Destructor - virtual ~DeploymentInterceptor_Base (void); - - virtual - void configure (const ::Deployment::Properties & config); - - virtual - void preprocess_plan (::Deployment::DeploymentPlan & plan); - - virtual - void pre_install (::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef); - - virtual - void post_install (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong index, - const ::CORBA::Any & reference, - const ::CORBA::Any & exception_thrown); - - virtual - void post_endpoint_reference (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong connectionRef, - const ::CORBA::Any & endpoint_reference, - const ::CORBA::Any & exception_thrown); - - virtual - void pre_connect (::Deployment::DeploymentPlan & plan, - ::CORBA::ULong connection_index, - ::CORBA::Any & provided_reference); - - virtual - void post_connect (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong connectionRef, - const ::CORBA::Any & exceptionThrown); - - virtual - void pre_disconnect (::Deployment::DeploymentPlan & plan, - ::CORBA::ULong connection_index_); - - virtual - void post_disconnect (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong connectionRef, - const ::CORBA::Any & exceptionThrown); - - virtual - void post_configured (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const ::CORBA::Any & exception_thrown); - - virtual - void post_activate (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const ::CORBA::Any & exception_thrown); - - virtual - void post_passivate (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const ::CORBA::Any & exception_thrown); - - virtual - void post_remove (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const ::CORBA::Any & exception_thrown); - - virtual - void unexpected_event (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const ::CORBA::Any & exception_thrown, - const char *error); - }; -} - - -#endif /* DANCE_DEPLOYMENTINTERCEPTORSI_H_ */ diff --git a/DAnCE/dance/DAnCE_LocalityManager.idl b/DAnCE/dance/DAnCE_LocalityManager.idl deleted file mode 100644 index a910bd26170..00000000000 --- a/DAnCE/dance/DAnCE_LocalityManager.idl +++ /dev/null @@ -1,115 +0,0 @@ -#ifndef DANCE_LOCALITYMANAGER_IDL -#define DANCE_LOCALITYMANAGER_IDL - -#include "Deployment/Deployment_Application.idl" -#include "Deployment/Deployment_ApplicationManager.idl" -#include "Deployment/Deployment_InvalidProperty.idl" -#include "Deployment/Deployment_InvalidNodeExecParameter.idl" -#include "Deployment/Deployment_InvalidComponentExecParameter.idl" -#include "Deployment/Deployment_InvalidConnection.idl" -#include "Deployment/Deployment_StopError.idl" -#include "Deployment/Deployment_StopError.idl" -#include "Deployment/Deployment_PlanError.idl" -#include "Deployment/Deployment_ResourceNotAvailable.idl" -#include "Deployment/Deployment_ResourceCommitmentManager.idl" - -module DAnCE -{ - /** - * @interface InstanceDeploymentHandler - * @brief Interface used to manage the lifecycle of instances. - * - * This interface is used by the LocalityManager to manage the lifecycle - * of various instance types. Each instance type requires a separate IDH. - */ - local interface InstanceDeploymentHandler - { - readonly attribute string instance_type; - - readonly attribute ::CORBA::StringSeq dependencies; - - void configure (in ::Deployment::Properties config); - - void install_instance (in ::Deployment::DeploymentPlan plan, - in unsigned long instanceRef, - out any instance_reference) - raises (Deployment::StartError, - Deployment::InvalidProperty, - Deployment::InvalidNodeExecParameter, - Deployment::InvalidComponentExecParameter); - - void provide_endpoint_reference (in ::Deployment::DeploymentPlan plan, - in unsigned long connectionRef, - out any endpoint_reference) - raises (Deployment::StartError, - Deployment::InvalidProperty); - - void connect_instance (in ::Deployment::DeploymentPlan plan, - in unsigned long connectionRef, - in any provided_reference) - raises (Deployment::StartError, - Deployment::InvalidConnection); - - void disconnect_instance (in ::Deployment::DeploymentPlan plan, - in unsigned long connectionRef) - raises (::Deployment::StopError); - - void instance_configured (in ::Deployment::DeploymentPlan plan, - in unsigned long instanceRef) - raises (Deployment::StartError); - - void activate_instance (in ::Deployment::DeploymentPlan plan, - in unsigned long instanceRef, - in any instance_reference) - raises (Deployment::StartError); - - void passivate_instance (in ::Deployment::DeploymentPlan plan, - in unsigned long instanceRef, - in any instance_reference) - raises (Deployment::StopError); - - void remove_instance (in ::Deployment::DeploymentPlan plan, - in unsigned long instanceRef, - in any instance_reference) - raises (::Deployment::StopError); - - /// Instruct the handler to release any resources prior to deallocation. - void close (); - }; - - interface LocalityManager : - Deployment::Application, - Deployment::ApplicationManager - { - readonly attribute ::Deployment::Properties configuration; - - Deployment::ApplicationManager - preparePlan (in Deployment::DeploymentPlan plan, - in Deployment::ResourceCommitmentManager resourceCommitment) - raises (Deployment::StartError, - Deployment::PlanError); - - void destroyManager (in ::Deployment::ApplicationManager manager) - raises (Deployment::StopError); - - oneway void shutdown (); - }; - - local interface LocalityConfiguration - { - readonly attribute string type; - - void configure (in ::Deployment::Property prop); - }; - - interface LocalityManagerActivator - { - void locality_manager_callback (in LocalityManager ref, - in string uuid, - out Deployment::Properties config); - - void configuration_complete (in string uuid); - }; -}; - -#endif diff --git a/DAnCE/dance/DAnCE_Properties.idl b/DAnCE/dance/DAnCE_Properties.idl deleted file mode 100644 index 7e1ac3d8161..00000000000 --- a/DAnCE/dance/DAnCE_Properties.idl +++ /dev/null @@ -1,101 +0,0 @@ -/** - * @file DAnCE_Properties.idl - * @author William R. Otte <wotte@dre.vanderbilt.edu> - * - * Codifies properties used to configure the deployment engine. - */ - -module DAnCE -{ - // Home Configuration Properties - /// Describes the entrypoint for the home executor. Property value is string. - const string HOME_FACTORY = "home factory"; - - // Component Configuration Properties - /// Describes the entrypoint for the component executor. Property value is string. - const string COMPONENT_FACTORY = "component factory"; - - /// Indicates that the component instance should be deployed using specified home ID. - /// Property value is string. - const string EXPLICIT_HOME = "edu.vanderbilt.dre.DAnCE.ExplicitHome"; - - // Instance (i.e., Home or Component) Properties - /// Indicates that the instance object reference should be registered in the - /// Instance naming context using a specified name. Property value is string. - const string REGISTER_NAMING = "edu.vanderbilt.dre.DAnCE.RegisterNaming"; - - /// Indicates that the instance object reference should be printed to a specified - /// file. Property value is string. - const string INSTANCE_IOR_FILE = "edu.vanderbilt.dre.DAnCE.InstanceIOR"; - - /// Indicates the naming context for domain objects, which includes infrastructure - /// and redirection. - const string DOMAIN_NC = "edu.vanderbilt.dre.DAnCE.DomainNC"; - - /// Indicates the naming context used for instance objects. - const string INSTANCE_NC = "edu.vanderbilt.dre.DAnCE.InstanceNC"; - - /// Indicates node address used in Node_Locator. - const string NODE_RESOURCE_TYPE = "edu.vanderbilt.dre.DAnCE.NodeAddress"; - const string NODE_IOR = "edu.vanderbilt.dre.DAnCE.StringIOR"; - - /// Indicates the POA in use for this entity. - const string ENTITY_POA = "edu.dre.vanderbilt.DAnCE.POA"; - - /// Indicates the maximum time that the locality manager will wait for any - /// deployment step to complete, in seconds. - const string LOCALITY_TIMEOUT = "edu.vanderbilt.dre.DAnCE.LocalityTimeout"; - - /// Indicates the UUID that should be assigned to a locality instance - const string LOCALITY_UUID = "edu.vanderbilt.dre.DAnCE.LocalityUUID"; - - /// Indicates command line arguments that should be passed to locality managers - /// when spawned. - const string LOCALITY_ARGUMENTS = "edu.vanderbilt.dre.DAnCE.LocalityArguments"; - - /// Indicates the executable name that should be used when spawing a locality manager - const string LOCALITY_EXECUTABLE = "edu.vanderbilt.dre.DAnCE.LocalityExec"; - - const string LOCALITY_MULTITHREAD = "edu.vanderbilt.dre.DAnCE.LocalityMultithread"; - - /// Stringified IOR to be used as the naming context for a locality instance. - const string LOCALITY_NAMINGCONTEXT = "edu.vanderbilt.dre.DAnCE.LocalityNamingContext"; - - /// @Temporary: Indicate that the node/locality manager should load best-effort - /// interceptors rather than first-failure semantics. - const string LOCALITY_BESTEFFORT = "edu.vanderbilt.dre.DAnCE.BestEffort"; - - // Implementation Types - /// Property describing the implementation type of a monolithic implementation - const string IMPL_TYPE = "edu.vanderbilt.dre.DAnCE.ImplementationType"; - - const string CCM_CONTAINER = "edu.vanderbilt.dre.CCM.Container"; - const string CCM_HOME = "edu.vanderbilt.dre.CCM.Home"; - const string CCM_COMPONENT = "edu.vanderbilt.dre.CCM.Component"; - const string CCM_HOMEDCOMPONENT = "edu.vanderbilt.dre.CCM.HomedComponent"; - const string CCM_CONNECTOR = "edu.vanderbilt.dre.CCM.Connector"; - - const string DANCE_LOCALITYMANAGER = "edu.vanderbilt.dre.DAnCE.LocalityManager"; - const string DANCE_INSTALLATIONHANDLER = "edu.vanderbilt.dre.DAnCE.InstanceHandler"; - const string DANCE_DEPLOYMENTINTERCEPTOR = "edu.vanderbilt.dre.DAnCE.DeploymentInterceptor"; - const string DANCE_CONFIGPLUGIN = "edu.vanderbilt.dre.DAnCE.ConfigPlugin"; - - // Locality Manager execParameter properties - const string DANCE_LM_PATH = "edu.vanderbilt.dre.DAnCE.LocalityManager.path"; - const string DANCE_LM_LIBPATH = "edu.vanderbilt.dre.DAnCE.LocalityManager.libpath"; - const string DANCE_LM_INSTALLER = "edu.vanderbilt.dre.DAnCE.LocalityManager.installer"; - const string DANCE_LM_PROCESSNAME = "edu.vanderbilt.dre.DAnCE.LocalityManager.ProcessName"; - const string DANCE_LM_CPUAFFINITY = "edu.vanderbilt.dre.DAnCE.LocalityManager.CPUAffinity"; - const string DANCE_LM_PROCESSPRIORITY = "edu.vanderbilt.dre.DAnCE.LocalityManager.ProcessPriority"; - const string DANCE_LM_CONFIGFILE = "edu.vanderbilt.dre.DAnCE.LocalityManager.ConfigFile"; - - // Instance Deployment Handler installation properties - - /// Instance types that must be installed before the instance handled by the decorated handler - const string DANCE_PLUGIN_ENTRYPT = "edu.vanderbilt.dre.DAnCE.InstanceHandler.EntryPoint"; - const string DANCE_PLUGIN_ARTIFACT = "edu.vanderbilt.dre.DAnCE.InstanceHandler.Artifact"; - const string DANCE_PLUGIN_OPENMODE = "edu.vanderbilt.dre.DAnCE.InstanceHandler.OpenMode"; - const string DANCE_IDH_DEPENDSON = "edu.vanderbilt.dre.DAnCE.InstanceHandler.DependsOn"; - -}; - diff --git a/DAnCE/dance/DAnCE_Properties.mpc b/DAnCE/dance/DAnCE_Properties.mpc deleted file mode 100644 index eb0d465241d..00000000000 --- a/DAnCE/dance/DAnCE_Properties.mpc +++ /dev/null @@ -1,29 +0,0 @@ -// -*- MPC -*- -project(DAnCE_Properties_IDL) : install, dancelib_with_idl, dance_output { - custom_only = 1 - - IDL_Files { - idlflags += -SS -Sci - DAnCE_Properties.idl - } - - InstallData_Files { - gendir = . - ../docs - ../MPC - } - InstallData_Files { - gendir = RepositoryManager - RepositoryManager/README - } - InstallData_Files { - gendir = NodeManager - NodeManager/README - } - - verbatim(gnuace, postinstall) { -" cp ../rules.dance.GNU $(INSTALL_PREFIX)/share/dance" -" perl -i -pe's!\\$$[{(]DANCE_ROOT[})]!$(INSTALL_PREFIX)/include!g;' $(INSTALL_PREFIX)/share/dance/rules.dance.GNU" -" echo export DANCE_ROOT=$(INSTALL_PREFIX)/share/dance> $(INSTALL_PREFIX)/share/dance/dance-devel.sh" - } -} diff --git a/DAnCE/dance/DAnCE_Utility.cpp b/DAnCE/dance/DAnCE_Utility.cpp deleted file mode 100644 index cb2595e48a0..00000000000 --- a/DAnCE/dance/DAnCE_Utility.cpp +++ /dev/null @@ -1,671 +0,0 @@ -#ifndef DAnCE_Utility_CPP -#define DAnCE_Utility_CPP - -#include "dance/DAnCE_Utility.h" -#include "ace/OS_NS_stdio.h" -#include "dance/DAnCE_PropertiesC.h" -#include "Deployment/Deployment_PlanErrorC.h" -#include "Deployment/Deployment_StartErrorC.h" -#include "Deployment/Deployment_StopErrorC.h" -#include "Deployment/Deployment_InvalidConnectionC.h" -#include "Deployment/Deployment_InvalidNodeExecParameterC.h" -#include "Deployment/Deployment_InvalidPropertyC.h" -#include "tao/SystemException.h" -#include "tao/AnyTypeCode/Any_Impl.h" -#include "tao/AnyTypeCode/ExceptionA.h" - -namespace DAnCE -{ - namespace Utility - { - void build_property_map (PROPERTY_MAP &map, - const ::Deployment::Properties &prop) - { - DANCE_TRACE("DAnCE::Utility::build_property_map"); - - for (CORBA::ULong i = 0; i < prop.length (); ++i) - { - int const retval = map.rebind (prop[i].name.in (), prop[i].value); - - if (retval == 1) - { - DANCE_ERROR (DANCE_LOG_WARNING, - (LM_WARNING, DLINFO - ACE_TEXT ("build_property_map: Duplicate value ") - ACE_TEXT ("for %C encountered, ") - ACE_TEXT ("old value overwritten.\n"), - prop[i].name.in ())); - } - else if (retval == -1) - { - DANCE_ERROR (DANCE_LOG_WARNING, - (LM_WARNING, DLINFO - ACE_TEXT ("build_property_map: ") - ACE_TEXT ("Error binding value for %C, ignoring.\n"), - prop[i].name.in ())); - } - else - { - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("build_property_map: ") - ACE_TEXT ("Bound value for config value %C\n"), - prop[i].name.in ())); - } - } - } - - void build_property_sequence (::Deployment::Properties &prop, - const PROPERTY_MAP &pmap) - { - CORBA::ULong pos = prop.length (); - - prop.length (pos + pmap.current_size ()); - - for (PROPERTY_MAP::const_iterator i = pmap.begin (); - i != pmap.end (); - ++i) - { - prop[pos].name = (*i).ext_id_.c_str (); - prop[pos++].value = (*i).int_id_; - } - } - - int write_IOR (const ACE_TCHAR *pathname, const char *ior) - { - FILE* ior_output_file_ = ACE_OS::fopen (pathname, ACE_TEXT("w")); - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT ("DAnCE::Utility::write_IOR - ") - ACE_TEXT ("Writing ior <%C> to file <%s>\n"), - ior, pathname)); - - if (ior_output_file_) - { - ACE_OS::fprintf (ior_output_file_, - "%s", - ior); - ACE_OS::fclose (ior_output_file_); - return 0; - } - - return -1; - } - - void append_properties (::Deployment::Properties &dest, - const ::Deployment::Properties &src) - { - CORBA::ULong pos = dest.length (); - dest.length (pos + src.length ()); - - for (CORBA::ULong i = 0; i < src.length (); ++i) - { - dest[pos].name = CORBA::string_dup (src[i].name.in ()); - dest[pos].value = src[i].value; - ++pos; - } - } - - template<> - bool get_property_value (const char *name, - const PROPERTY_MAP &properties, - bool &val) - { - DANCE_TRACE ("DAnCE::Utility::get_property_value<bool>"); - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::get_property_value<bool> - ") - ACE_TEXT("Finding property value for name '%C'\n"), - name)); - - CORBA::Any any; - if (properties.find (name, any) == 0) - { - if (any >>= CORBA::Any::to_boolean(val)) - { - return true; - } - else - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_WARNING, DLINFO - ACE_TEXT("DAnCE::Utility::get_property_value<T> - ") - ACE_TEXT("Failed to extract property value for %C\n"), name)); - return false; - } - } - - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::get_property_value<bool> - ") - ACE_TEXT("Property value for name '%C' has no value\n"), - name)); - - return false; - } - - template<> - bool get_property_value (const char *name, - const PROPERTY_MAP &properties, - const char *&val) - { - DANCE_TRACE ("DAnCE::Utility::get_property_value<const char *>"); - CORBA::Any any; - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::get_property_value<const char *> - ") - ACE_TEXT("Finding property value for name '%C'\n"), - name)); - - if (properties.find (name, any) == 0) - { - if (any >>= CORBA::Any::to_string(val, 0)) - { - return true; - } - else - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_WARNING, DLINFO - ACE_TEXT("DAnCE::Utility::get_property_value<const char *> - ") - ACE_TEXT("Failed to extract property value for %C\n"), name)); - return false; - } - } - - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::get_property_value<const char *> - ") - ACE_TEXT("Property value for name '%C' has no value\n"), name)); - - return false; - } - - template<> - bool get_property_value (const char *name, - const ::Deployment::Properties &properties, - const char * &val) - { - DANCE_TRACE ("DAnCE::Utility::get_property_value<const char *>"); - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::get_property_value<const char *> - ") - ACE_TEXT("Finding property value for name '%C'\n"), - name)); - - for (CORBA::ULong i = 0; i < properties.length (); ++i) - { - if (ACE_OS::strcmp (properties[i].name.in (), name) == 0) - { - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::get_property_value<const char *> - ") - ACE_TEXT("Found property '%C'\n"), name)); - if (properties[i].value >>= CORBA::Any::to_string (val, 0)) - { - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::get_property_value<const char *> - ") - ACE_TEXT("Value is %C\n"), val)); - return true; - } - else - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_WARNING, DLINFO - ACE_TEXT("DAnCE::Utility::get_property_value<const char *> - ") - ACE_TEXT("Failed to extract property value for %C\n"), - name)); - return false; - } - } - } - - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::get_property_value<const char *> - ") - ACE_TEXT("Unable to find property named %C\n"), name)); - - return false; - } - - template<> - bool get_satisfierproperty_value (const char *name, - const ::Deployment::SatisfierProperties &properties, - const char * &val) - { - DANCE_TRACE ("DAnCE::Utility::get_satisfierproperty_value<const char *>"); - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::get_satisfierproperty_value<const char *> - ") - ACE_TEXT("Finding property value for name '%C'\n"), - name)); - - for (CORBA::ULong i = 0; i < properties.length (); ++i) - { - if (ACE_OS::strcmp (properties[i].name.in (), name) == 0) - { - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::get_satisfierproperty_value<const char *> - ") - ACE_TEXT("Found property '%C'\n"), name)); - if (properties[i].value >>= CORBA::Any::to_string (val, 0)) - { - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::get_satisfierproperty_value<const char *> - ") - ACE_TEXT("Value is %C\n"), val)); - return true; - } - else - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_WARNING, DLINFO - ACE_TEXT("DAnCE::Utility::get_satisfierproperty_value<const char *> - ") - ACE_TEXT("Failed to extract property value for %C\n"), - name)); - return false; - } - } - } - - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::get_satisfierproperty_value<const char *> - ") - ACE_TEXT("Unable to find property named %C\n"), name)); - - return false; - } - - bool - get_resource_value (const char *type, - const ::Deployment::Resources &resources, - ::Deployment::Resource &val) - { - DANCE_TRACE ("DAnCE::Utility::get_resource_value<const char *>"); - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::get_resource_value - ") - ACE_TEXT("Finding resource for type '%C'\n"), - type)); - - for (CORBA::ULong i = 0; i < resources.length (); ++i) - { - // search for the resource with resourceType - for (CORBA::ULong k = 0;k < resources[i].resourceType.length ();k++) - { - if (ACE_OS::strcmp (type, - resources[i].resourceType[k]) == 0) - { - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::get_resource_value - ") - ACE_TEXT("Found resource for type '%C'\n"), - type)); - - val = resources[i]; - return true; - } - } - } - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_WARNING, DLINFO - ACE_TEXT("DAnCE::Utility::get_resource_value - ") - ACE_TEXT("Failed to extract resource for %C\n"), - type)); - return false; - } - - template<> - bool get_property_value (const char *name, - const ::Deployment::Properties &properties, - bool &val) - { - DANCE_TRACE ("DAnCE::Utility::get_property_value<bool>"); - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::get_property_value<bool> - ") - ACE_TEXT("Finding property value for name '%C'\n"), - name)); - - for (CORBA::ULong i = 0; i < properties.length (); ++i) - { - if (ACE_OS::strcmp (properties[i].name.in (), name) == 0) - { - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::get_property_value<bool> - ") - ACE_TEXT("Found property '%C'\n"), name)); - if (properties[i].value >>= CORBA::Any::to_boolean (val)) - { - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::get_property_value<bool> - ") - ACE_TEXT("Value is %C\n"), val)); - return true; - } - else - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_WARNING, DLINFO - ACE_TEXT("DAnCE::Utility::get_property_value<bool> - ") - ACE_TEXT("Failed to extract property value for %C\n"), - name)); - return false; - } - } - } - - - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::get_property_value<bool> - ") - ACE_TEXT("Unable to find property named %C\n"), name)); - - return false; - } - - template<char*> - void update_property_value (const char *name, - ::Deployment::Properties &properties, - const char* &val) - { - DANCE_TRACE ("DAnCE::Utility::update_property_value<char*>"); - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO ACE_TEXT("DAnCE::Utility::update_property_value<char*> - ") - ACE_TEXT("Finding property value for name '%C'\n"), - name)); - - for (CORBA::ULong i = 0; i < properties.length (); ++i) - { - if (ACE_OS::strcmp (properties[i].name.in (), name) == 0) - { - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO ACE_TEXT("DAnCE::Utility::update_property_value<char*> - ") - ACE_TEXT("Found property '%C'\n"), name)); - properties[i].value <<= val; - return; - } - } - - - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO ACE_TEXT("DAnCE::Utility::update_property_value<char*> - ") - ACE_TEXT("Property for name '%C' not found; adding property\n"), name)); - - properties.length (properties.length () + 1); - properties[properties.length () - 1].name = CORBA::string_dup (name); - properties[properties.length () - 1].value <<= val; - } - - const char * - get_instance_type (const ::Deployment::Properties& prop) - { - DANCE_TRACE ("DAnCE::Utility::get_instance_type"); - - for (CORBA::ULong i = 0; i < prop.length (); ++i) - { - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::get_instance_type - ") - ACE_TEXT("Checking property %C\n"), - prop[i].name.in ())); - - if (ACE_OS::strcmp (prop[i].name.in (), - DAnCE::HOME_FACTORY) == 0) - { - DANCE_TRACE_LOG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::get_instance_type - ") - ACE_TEXT("Found Home type\n"))); - return DAnCE::CCM_HOME; - } - if (ACE_OS::strcmp (prop[i].name.in (), - DAnCE::COMPONENT_FACTORY) == 0) - { - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::get_instance_type - ") - ACE_TEXT("Found unmanaged component type.\n"))); - return DAnCE::CCM_COMPONENT; - } - if (ACE_OS::strcmp (prop[i].name.in (), - DAnCE::EXPLICIT_HOME) == 0) - { - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::get_instance_type - ") - ACE_TEXT("Found explicit home component type.\n"))); - return DAnCE::CCM_HOMEDCOMPONENT;; - } - - if (ACE_OS::strcmp (prop[i].name.in (), - DAnCE::IMPL_TYPE) == 0) - { - const char *val = 0; - if (get_property_value (DAnCE::IMPL_TYPE, prop, val)) - { - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::get_instance_type - ") - ACE_TEXT("Found instance type %C\n"), val)); - return val; - } - } - } - - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DAnCE::Utility::get_instance_type - ") - ACE_TEXT("Unable to determine instance type, instance will be ignored.\n"))); - return 0; - } - - bool - throw_exception_from_any (const CORBA::Any &excep) - { - CORBA::TypeCode_ptr tc = excep._tao_get_typecode (); - std::string ex_id = tc->id (); - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::throw_exception_from_any - ") - ACE_TEXT("Found typecode %C\n"), ex_id.c_str ())); - if (ex_id == Deployment::_tc_PlanError->id ()) - { - extract_and_throw_exception<Deployment::PlanError> (excep); - } - else if (ex_id == Deployment::_tc_StartError->id ()) - { - extract_and_throw_exception<Deployment::StartError> (excep); - } - else if (ex_id == Deployment::_tc_StopError->id ()) - { - extract_and_throw_exception<Deployment::StopError> (excep); - } - else if (ex_id == Deployment::_tc_InvalidConnection->id ()) - { - extract_and_throw_exception<Deployment::InvalidConnection> (excep); - } - else if (ex_id == Deployment::_tc_InvalidNodeExecParameter->id ()) - { - extract_and_throw_exception<Deployment::InvalidNodeExecParameter> (excep); - } - else if (ex_id == Deployment::_tc_InvalidProperty->id ()) - { - extract_and_throw_exception<Deployment::InvalidProperty> (excep); - } - /* We don't need these, yet. - else if (ex_id == Deployment::_tc_NameExists->id ()) - { - extract_and_throw_exception<Deployment::NameExists> (excep); - } - else if (ex_id == Deployment::_tc_PackageError->id ()) - { - extract_and_throw_exception<Deployment::PackageError> (excep); - } - else if (ex_id == Deployment::_tc_NoSuchName->id ()) - { - extract_and_throw_exception<Deployment::NoSuchName> (excep); - } - else if (ex_id == Deployment::_tc_ResourceCommitmentFailure->id ()) - { - extract_and_throw_exception<Deployment::ResourceCommitmentFailure> (excep); - } - else if (ex_id == Deployment::_tc_ResourceNotAvailable->id ()) - { - extract_and_throw_exception<Deployment::ResourceNotAvailable> (excep); - } - */ - else if (ex_id.find ("IDL:omg.org/CORBA/") == 0) - { - CORBA::SystemException* sysex = TAO::create_system_exception (ex_id.c_str ()); - if (sysex) - { - // Without this, the call to create_system_exception() above - // causes a memory leak. - auto_ptr<CORBA::SystemException> safety (sysex); - TAO_OutputCDR cdr_out; - cdr_out << excep; - TAO_InputCDR cdr_in(cdr_out); - sysex->_tao_decode (cdr_in); - sysex->_raise (); - } - } - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::throw_exception_from_any - ") - ACE_TEXT("Exception with typecode %C unknown\n"), ex_id.c_str ())); - throw CORBA::UNKNOWN (); - } - - CORBA::Any* - create_any_from_user_exception (const CORBA::UserException& ex) - { - CORBA::Any ex_any; - ex_any <<= ex; - TAO_OutputCDR cdr_out; - cdr_out << ex_any; - TAO_InputCDR cdr_in (cdr_out); - - CORBA::Any *tmp = 0; - ACE_NEW_THROW_EX (tmp, - CORBA::Any, - CORBA::NO_MEMORY ()); - cdr_in >> *tmp; - return tmp; - } - - DANCE_STUB_Export bool - stringify_exception_from_any (const CORBA::Any &excep, - std::string &result) - { - CORBA::TypeCode_ptr tc = excep._tao_get_typecode (); - std::string ex_id = tc->id (); - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::throw_exception_from_any - ") - ACE_TEXT("Found typecode %C\n"), ex_id.c_str ())); - bool flag (false); - - if (ex_id == Deployment::_tc_PlanError->id ()) - { - result += "PlanError exception -"; - flag = stringify_exception<Deployment::PlanError> (excep, - result); - } - else if (ex_id == Deployment::_tc_StartError->id ()) - { - result += "StartError exception -"; - flag = stringify_exception<Deployment::StartError> (excep, - result); - } - else if (ex_id == Deployment::_tc_StopError->id ()) - { - result += "StopError exception -"; - flag = stringify_exception<Deployment::StopError> (excep, - result); - } - else if (ex_id == Deployment::_tc_InvalidConnection->id ()) - { - result += "InvalidConnection exception -"; - flag = stringify_exception<Deployment::InvalidConnection> (excep, - result); - } - else if (ex_id == Deployment::_tc_InvalidNodeExecParameter->id ()) - { - result += "InvalidNodeExecParameter exception -"; - flag = stringify_exception<Deployment::InvalidNodeExecParameter> (excep, - result); - } - else if (ex_id == Deployment::_tc_InvalidProperty->id ()) - { - result += "InvalidProperty exception -"; - flag = stringify_exception<Deployment::InvalidProperty> (excep, - result); - } - /* We don't need these, yet. - else if (ex_id == Deployment::_tc_NameExists->id ()) - { - stringify_exception<Deployment::NameExists> (excep, - result); - } - else if (ex_id == Deployment::_tc_PackageError->id ()) - { - stringify_exception<Deployment::PackageError> (excep, - result); - } - else if (ex_id == Deployment::_tc_NoSuchName->id ()) - { - stringify_exception<Deployment::NoSuchName> (excep, - result); - } - else if (ex_id == Deployment::_tc_ResourceCommitmentFailure->id ()) - { - stringify_exception<Deployment::ResourceCommitmentFailure> (excep, - result); - } - else if (ex_id == Deployment::_tc_ResourceNotAvailable->id ()) - { - stringify_exception<Deployment::ResourceNotAvailable> (excep, - result); - } - */ - else if (ex_id.find ("IDL:omg.org/CORBA/") == 0) - { - CORBA::SystemException* sysex = TAO::create_system_exception (ex_id.c_str ()); - if (sysex) - { - // Without this, the call to create_system_exception() above - // causes a memory leak. - auto_ptr<CORBA::SystemException> safety (sysex); - - TAO_OutputCDR cdr_out; - cdr_out << excep; - TAO_InputCDR cdr_in(cdr_out); - sysex->_tao_decode (cdr_in); - - result += "CORBA System Exception: "; - result += sysex->_info ().c_str (); - flag = true; - } - } - - if (!flag) - { - result += "Unable to decode exception meta-data for ID "; - result += ex_id; - } - - return flag; - } - - } /* namespace Utility */ -} -#endif /*DAnCE_Utility_CPP*/ diff --git a/DAnCE/dance/DAnCE_Utility.h b/DAnCE/dance/DAnCE_Utility.h deleted file mode 100644 index f5b7460c23a..00000000000 --- a/DAnCE/dance/DAnCE_Utility.h +++ /dev/null @@ -1,161 +0,0 @@ -/** - * @file DAnCE_Utility.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - * - * Utility methods used throughout DAnCE. - - */ - -#ifndef DAnCE_Utility_H -#define DAnCE_Utility_H - -#include /**/ "ace/pre.h" - -#include "dance/DAnCE_stub_export.h" - -#include "ace/config-all.h" -#include "ace/Hash_Map_Manager_T.h" -#include "ace/Refcounted_Auto_Ptr.h" -#include "tao/AnyTypeCode/Any.h" -#include "dance/Deployment/Deployment_DeploymentPlanC.h" -#include "dance/Deployment/Deployment_TargetDataC.h" -#include "dance/Logger/Log_Macros.h" - -namespace DAnCE -{ - namespace Utility - { - typedef ACE_Hash_Map_Manager_Ex<ACE_CString, - CORBA::Any, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_Null_Mutex> PROPERTY_MAP; - - typedef ACE_Refcounted_Auto_Ptr <PROPERTY_MAP, - TAO_SYNCH_MUTEX> PMAP_PTR; - - DANCE_STUB_Export void build_property_map (PROPERTY_MAP &map, - const ::Deployment::Properties &prop); - - DANCE_STUB_Export void build_property_sequence (::Deployment::Properties &prop, - const PROPERTY_MAP &map); - - template<class T> - bool - get_property_value (const char *name, - const PROPERTY_MAP &properties, - T &val); - - template<class T> - bool - get_property_value (const char *name, - const ::Deployment::Properties &properties, - T &val); - - template<class T> - bool - get_satisfierproperty_value (const char *name, - const ::Deployment::SatisfierProperties &properties, - T &val); - - DANCE_STUB_Export bool get_resource_value (const char *type, - const ::Deployment::Resources &resources, - ::Deployment::Resource &val); - - template<class T> - void - update_property_value (const char *name, - ::Deployment::Properties &properties, - const T &val); - - template <typename EXCEPTION> - void test_and_set_exception (bool &flag, EXCEPTION &exception, - const char *name, const char *reason); - - DANCE_STUB_Export const char * - get_instance_type (const ::Deployment::Properties& prop); - - DANCE_STUB_Export void append_properties (::Deployment::Properties &dest, - const ::Deployment::Properties &src); - - /// Write a string (usually a stringified IOR) to a file - /// designated by the @a pathname. The file named will always get - /// overwritten. - DANCE_STUB_Export int write_IOR (const ACE_TCHAR *pathname, - const char *IOR); - - /// Attempt to extract the any into EXCEPTION type and - /// throw. Returns 'false' if extraction fails. - template <typename EXCEPTION> - bool extract_and_throw_exception (const CORBA::Any &excep); - - DANCE_STUB_Export bool - throw_exception_from_any (const CORBA::Any &excep); - - template <typename EXCEPTION> - CORBA::Any* create_any_from_exception (const EXCEPTION& ex); - - DANCE_STUB_Export CORBA::Any* - create_any_from_user_exception (const CORBA::UserException& ex); - - template <typename EXCEPTION> - bool stringify_exception (const CORBA::Any &excep, - std::string &result); - - DANCE_STUB_Export bool - stringify_exception_from_any (const CORBA::Any &excep, std::string &result); - } -} - -// Template specializations. -namespace DAnCE -{ - namespace Utility - { - template<> - DANCE_STUB_Export bool - get_property_value (const char *name, - const PROPERTY_MAP &properties, bool &val); - - template<> - DANCE_STUB_Export bool - get_property_value (const char *name, - const PROPERTY_MAP &properties, const char *&val); - - template<> - DANCE_STUB_Export bool - get_property_value (const char *name, - const ::Deployment::Properties &properties, - const char * &val); - - template<> - DANCE_STUB_Export bool - get_satisfierproperty_value (const char *name, - const ::Deployment::SatisfierProperties &properties, - const char * &val); - - template<> - DANCE_STUB_Export bool - get_property_value (const char *name, - const ::Deployment::Properties &properties, - bool &val); - - template<char*> - DANCE_STUB_Export void - update_property_value (const char *name, - ::Deployment::Properties &properties, - const char * &val); - } -} - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "dance/DAnCE_Utility.tpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("dance/DAnCE_Utility.tpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - - -#include /**/ "ace/post.h" -#endif diff --git a/DAnCE/dance/DAnCE_Utility.tpp b/DAnCE/dance/DAnCE_Utility.tpp deleted file mode 100644 index 0a5fdb57f5b..00000000000 --- a/DAnCE/dance/DAnCE_Utility.tpp +++ /dev/null @@ -1,178 +0,0 @@ -#ifndef DAnCE_Utility_TPP -#define DAnCE_Utility_TPP - -#include "dance/DAnCE_Utility.h" - -#include <sstream> - -namespace DAnCE -{ - namespace Utility - { - template<class T> - bool get_property_value (const char *name, const PROPERTY_MAP &properties, T &val) - { - DANCE_TRACE ("DAnCE::Utility::get_property_value<T>"); - CORBA::Any any; - - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::get_property_value<T> - ") - ACE_TEXT("Finding property value for name '%C'\n"), - name)); - - if (properties.find (name, any) == 0) - { - if (any >>= val) - { - return true; - } - else - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_WARNING, DLINFO - ACE_TEXT("DAnCE::Utility::get_property_value<T> - ") - ACE_TEXT("Failed to extract property value for %C\n"), name)); - return false; - } - } - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::get_property_value<T> - ") - ACE_TEXT("Property value for name '%C' has no value\n"), name)); - - return false; - } - - template<class T> - bool get_property_value (const char *name, const ::Deployment::Properties &properties, T &val) - { - DANCE_TRACE ("DAnCE::Utility::get_property_value<T>"); - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO ACE_TEXT("DAnCE::Utility::get_property_value<T> - ") - ACE_TEXT("Finding property value for name '%C'\n"), - name)); - - for (CORBA::ULong i = 0; i < properties.length (); ++i) - { - if (ACE_OS::strcmp (properties[i].name.in (), name) == 0) - { - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO ACE_TEXT("DAnCE::Utility::get_property_value<T> - ") - ACE_TEXT("Found property '%C'\n"), name)); - if (properties[i].value >>= val) - return true; - else - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_WARNING, - DLINFO ACE_TEXT("DAnCE::Utility::get_property_value<T> - ") - ACE_TEXT("Failed to extract property value for %C\n"), name)); - return false; - } - } - } - - - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO ACE_TEXT("DAnCE::Utility::get_property_value<T> - ") - ACE_TEXT("Property value for name '%C' has no value\n"), name)); - - return false; - } - - template<class T> - void update_property_value (const char *name, ::Deployment::Properties &properties, const T &val) - { - DANCE_TRACE ("DAnCE::Utility::update_property_value<T>"); - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO ACE_TEXT("DAnCE::Utility::update_property_value<T> - ") - ACE_TEXT("Finding property value for name '%C'\n"), - name)); - - for (CORBA::ULong i = 0; i < properties.length (); ++i) - { - if (ACE_OS::strcmp (properties[i].name.in (), name) == 0) - { - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::update_property_value<T> - ") - ACE_TEXT("Found property '%C'\n"), name)); - properties[i].value <<= val; - return; - } - } - - - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE::Utility::update_property_value<T> - ") - ACE_TEXT("Property for name '%C' not found; adding property\n"), name)); - - properties.length (properties.length () + 1); - properties[properties.length () - 1].name = CORBA::string_dup (name); - properties[properties.length () - 1].value <<= val; - } - - /// Tests flag, if false, sets it to true and replaces the name and - /// reason flags of the exception. - template <typename EXCEPTION> - void test_and_set_exception (bool &flag, EXCEPTION &exception, - const char *name, const char *reason) - { - if (!flag) - { - flag = true; - exception.name = name; - exception.reason = reason; - } - } - - template <typename EXCEPTION> - bool extract_and_throw_exception (const CORBA::Any &excep) - { - const EXCEPTION *ex_holder = 0; - - if ((excep >>= ex_holder)) - ex_holder->_raise (); - - return false; - } - - template <typename EXCEPTION> - bool stringify_exception (const CORBA::Any &excep, - std::string &result) - { - const EXCEPTION *ex_holder = 0; - - if ((excep >>= ex_holder)) - { - std::ostringstream excep_stream; - - excep_stream << " Name: " << ex_holder->name.in () - << " Reason: " << ex_holder->reason.in (); - - result += excep_stream.str (); - return true; - } - - return false; - } - - template <typename EXCEPTION> - CORBA::Any* create_any_from_exception (const EXCEPTION& ex) - { - CORBA::Any *tmp = 0; - ACE_NEW_THROW_EX (tmp, - CORBA::Any, - CORBA::NO_MEMORY ()); - *tmp <<= ex; - return tmp; - } - } -} - -#endif diff --git a/DAnCE/dance/Deployment/.gitignore b/DAnCE/dance/Deployment/.gitignore deleted file mode 100644 index 8aa9e09fdb2..00000000000 --- a/DAnCE/dance/Deployment/.gitignore +++ /dev/null @@ -1,121 +0,0 @@ -/Deployment_ApplicationC.cpp -/Deployment_ApplicationC.h -/Deployment_ApplicationC.inl -/Deployment_ApplicationManager_skel_export.h -/Deployment_ApplicationManager_stub_export.h -/Deployment_ApplicationManagerC.cpp -/Deployment_ApplicationManagerC.h -/Deployment_ApplicationManagerC.inl -/Deployment_ApplicationManagerS.cpp -/Deployment_ApplicationManagerS.h -/Deployment_ApplicationS.cpp -/Deployment_ApplicationS.h -/Deployment_BaseC.cpp -/Deployment_BaseC.h -/Deployment_BaseC.inl -/Deployment_BaseS.h -/Deployment_ConnectionC.cpp -/Deployment_ConnectionC.h -/Deployment_ConnectionS.h -/Deployment_DataC.cpp -/Deployment_DataC.h -/Deployment_DataS.h -/Deployment_DeploymentPlanC.cpp -/Deployment_DeploymentPlanC.h -/Deployment_DeploymentPlanS.h -/Deployment_DomainApplication_skel_export.h -/Deployment_DomainApplication_stub_export.h -/Deployment_DomainApplicationC.cpp -/Deployment_DomainApplicationC.h -/Deployment_DomainApplicationC.inl -/Deployment_DomainApplicationManager_skel_export.h -/Deployment_DomainApplicationManager_stub_export.h -/Deployment_DomainApplicationManagerC.cpp -/Deployment_DomainApplicationManagerC.h -/Deployment_DomainApplicationManagerC.inl -/Deployment_DomainApplicationManagerS.cpp -/Deployment_DomainApplicationManagerS.h -/Deployment_DomainApplicationS.cpp -/Deployment_DomainApplicationS.h -/Deployment_ExecutionManager_skel_export.h -/Deployment_ExecutionManager_stub_export.h -/Deployment_ExecutionManagerC.cpp -/Deployment_ExecutionManagerC.h -/Deployment_ExecutionManagerC.inl -/Deployment_ExecutionManagerS.cpp -/Deployment_ExecutionManagerS.h -/Deployment_InvalidComponentExecParameterC.cpp -/Deployment_InvalidComponentExecParameterC.h -/Deployment_InvalidComponentExecParameterS.h -/Deployment_InvalidConnectionC.cpp -/Deployment_InvalidConnectionC.h -/Deployment_InvalidConnectionS.h -/Deployment_InvalidNodeExecParameterC.cpp -/Deployment_InvalidNodeExecParameterC.h -/Deployment_InvalidNodeExecParameterS.h -/Deployment_InvalidPropertyC.cpp -/Deployment_InvalidPropertyC.h -/Deployment_InvalidPropertyS.h -/Deployment_NodeApplication_skel_export.h -/Deployment_NodeApplication_stub_export.h -/Deployment_NodeApplicationC.cpp -/Deployment_NodeApplicationC.h -/Deployment_NodeApplicationC.inl -/Deployment_NodeApplicationManager_skel_export.h -/Deployment_NodeApplicationManager_stub_export.h -/Deployment_NodeApplicationManagerC.cpp -/Deployment_NodeApplicationManagerC.h -/Deployment_NodeApplicationManagerC.inl -/Deployment_NodeApplicationManagerS.cpp -/Deployment_NodeApplicationManagerS.h -/Deployment_NodeApplicationS.cpp -/Deployment_NodeApplicationS.h -/Deployment_NodeManager_skel_export.h -/Deployment_NodeManager_stub_export.h -/Deployment_NodeManagerC.cpp -/Deployment_NodeManagerC.h -/Deployment_NodeManagerC.inl -/Deployment_NodeManagerS.cpp -/Deployment_NodeManagerS.h -/Deployment_Packaging_DataC.cpp -/Deployment_Packaging_DataC.h -/Deployment_Packaging_DataS.h -/Deployment_PlanErrorC.cpp -/Deployment_PlanErrorC.h -/Deployment_PlanErrorS.h -/Deployment_RepositoryManager_skel_export.h -/Deployment_RepositoryManager_stub_export.h -/Deployment_RepositoryManagerC.cpp -/Deployment_RepositoryManagerC.h -/Deployment_RepositoryManagerC.inl -/Deployment_RepositoryManagerS.cpp -/Deployment_RepositoryManagerS.h -/Deployment_ResourceCommitmentManagerC.cpp -/Deployment_ResourceCommitmentManagerC.h -/Deployment_ResourceCommitmentManagerC.inl -/Deployment_ResourceCommitmentManagerS.cpp -/Deployment_ResourceCommitmentManagerS.h -/Deployment_ResourceNotAvailableC.cpp -/Deployment_ResourceNotAvailableC.h -/Deployment_ResourceNotAvailableS.h -/Deployment_skel_export.h -/Deployment_StartErrorC.cpp -/Deployment_StartErrorC.h -/Deployment_StartErrorS.h -/Deployment_StopErrorC.cpp -/Deployment_StopErrorC.h -/Deployment_StopErrorS.h -/Deployment_stub_export.h -/Deployment_TargetDataC.cpp -/Deployment_TargetDataC.h -/Deployment_TargetDataS.h -/Deployment_TargetManager_skel_export.h -/Deployment_TargetManager_stub_export.h -/Deployment_TargetManagerC.cpp -/Deployment_TargetManagerC.h -/Deployment_TargetManagerC.inl -/Deployment_TargetManagerS.cpp -/Deployment_TargetManagerS.h -/DeploymentC.cpp -/DeploymentC.h -/DeploymentS.h diff --git a/DAnCE/dance/Deployment/Deployment.idl b/DAnCE/dance/Deployment/Deployment.idl deleted file mode 100644 index f697d699123..00000000000 --- a/DAnCE/dance/Deployment/Deployment.idl +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef DEPLOYMENT_IDL -#define DEPLOYMENT_IDL - -module Deployment { - /* - * This exception is listed in OMG 07-02-01 but not in 06-04-01 and 06-04-02 - */ - exception LastConfiguration { - }; - - /* - * This exception is listed in OMG 07-02-01 and in the text of 06-04-02 but never - * used in idl - */ - exception InvalidReference { - }; -}; - -#endif /* DEPLOYMENT_IDL */ - diff --git a/DAnCE/dance/Deployment/Deployment_Application.idl b/DAnCE/dance/Deployment/Deployment_Application.idl deleted file mode 100644 index 3bc5812b147..00000000000 --- a/DAnCE/dance/Deployment/Deployment_Application.idl +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef DEPLOYMENT_APPLICATION_IDL -#define DEPLOYMENT_APPLICATION_IDL - -#include "dance/Deployment/Deployment_Connection.idl" -#include "dance/Deployment/Deployment_StartError.idl" -#include "dance/Deployment/Deployment_StopError.idl" -#include "dance/Deployment/Deployment_InvalidConnection.idl" - -module Deployment -{ - interface Application { - void finishLaunch (in Connections providedReference, in boolean start) - raises (StartError, InvalidConnection); - - void start () - raises (StartError); - }; - - typedef sequence < Application > Applications; -}; - -#endif /* DEPLOYMENT_APPLICATION_IDL */ diff --git a/DAnCE/dance/Deployment/Deployment_ApplicationManager.idl b/DAnCE/dance/Deployment/Deployment_ApplicationManager.idl deleted file mode 100644 index 8450e76dab5..00000000000 --- a/DAnCE/dance/Deployment/Deployment_ApplicationManager.idl +++ /dev/null @@ -1,30 +0,0 @@ -// Compliant with OMG 06-04-01 section 15 - -#ifndef DEPLOYMENT_APPLICATIONMANAGER_IDL -#define DEPLOYMENT_APPLICATIONMANAGER_IDL - -#include "dance/Deployment/Deployment.idl" -#include "dance/Deployment/Deployment_InvalidProperty.idl" -#include "dance/Deployment/Deployment_Application.idl" -#include "dance/Deployment/Deployment_Connection.idl" -#include "dance/Deployment/Deployment_ResourceNotAvailable.idl" -#include "dance/Deployment/Deployment_InvalidNodeExecParameter.idl" -#include "dance/Deployment/Deployment_InvalidComponentExecParameter.idl" - -module Deployment { - - interface ApplicationManager { - Application startLaunch (in Properties configProperty, - out Connections providedReference) - raises (ResourceNotAvailable, - StartError, - InvalidProperty, - InvalidNodeExecParameter, - InvalidComponentExecParameter); - - void destroyApplication (in Application app) - raises (StopError); - }; -}; - -#endif /* DEPLOYMENT_APPLICATIONMANAGER_IDL */ diff --git a/DAnCE/dance/Deployment/Deployment_Base.idl b/DAnCE/dance/Deployment/Deployment_Base.idl deleted file mode 100644 index 6e8e4394d74..00000000000 --- a/DAnCE/dance/Deployment/Deployment_Base.idl +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef DEPLOYMENT_BASE_IDL -#define DEPLOYMENT_BASE_IDL - -module Deployment { - struct Property { - string name; - any value; - }; - - typedef sequence < Property > Properties; - - struct Requirement { - string name; - string resourceType; - Properties property; - }; - - typedef sequence < Requirement > Requirements; - - enum SatisfierPropertyKind { - Quantity, - Capacity, - Minimum, - Maximum, - _Attribute, - Selection - }; - - struct SatisfierProperty { - string name; - SatisfierPropertyKind kind; - boolean dynamic; - any value; - }; - - typedef sequence < SatisfierProperty > SatisfierProperties; -}; - -#endif /* DEPLOYMENT_BASE_IDL */ diff --git a/DAnCE/dance/Deployment/Deployment_Connection.idl b/DAnCE/dance/Deployment/Deployment_Connection.idl deleted file mode 100644 index 34df86b5b18..00000000000 --- a/DAnCE/dance/Deployment/Deployment_Connection.idl +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef DEPLOYMENT_CONNECTION_IDL -#define DEPLOYMENT_CONNECTION_IDL - -#include "dance/Deployment/Deployment_DeploymentPlan.idl" - -module Deployment -{ - typedef sequence < Object > Endpoints; - struct Connection { - string name; - Endpoints endpoint; - }; - - typedef sequence < Connection > Connections; -}; -#endif /* DEPLOYMENT_CONNECTION_IDL */ diff --git a/DAnCE/dance/Deployment/Deployment_Core.mpc b/DAnCE/dance/Deployment/Deployment_Core.mpc deleted file mode 100644 index 2d7f7c6456b..00000000000 --- a/DAnCE/dance/Deployment/Deployment_Core.mpc +++ /dev/null @@ -1,680 +0,0 @@ -// -*- MPC -*- -project(Deployment_IDL) : install, dancelib_with_idl, dance_output, valuetype, gen_ostream, ami, amh { - custom_only = 1 - idlflags += -Wb,stub_export_macro=DEPLOYMENT_STUB_Export \ - -Wb,stub_export_include=Deployment_stub_export.h \ - -Wb,skel_export_macro=DEPLOYMENT_SKEL_Export \ - -Wb,skel_export_include=Deployment_skel_export.h - after += DAnCE_Properties_IDL - - IDL_Files { - idlflags += -SS -Sci - Deployment_Packaging_Data.idl - Deployment_PlanError.idl - Deployment_InvalidProperty.idl - Deployment_InvalidNodeExecParameter.idl - Deployment_InvalidComponentExecParameter.idl - Deployment_InvalidConnection.idl - Deployment_ResourceNotAvailable.idl - Deployment_Connection.idl - Deployment_StopError.idl - Deployment_StartError.idl - Deployment_DeploymentPlan.idl - Deployment_Data.idl - Deployment_TargetData.idl - Deployment.idl - } - - IDL_Files { - idlflags += -SS - Deployment_Base.idl - } - - IDL_Files { - idlflags += -Gxhst -Gxhsk - Deployment_Application.idl - } - - IDL_Files { - Deployment_ResourceCommitmentManager.idl - } - specific { - install_dir = dance/Deployment - } -} - -project(Deployment_ApplicationManager_IDL) : install, dancelib_with_idl, dance_output, valuetype, gen_ostream, ami, amh { - custom_only = 1 - idlflags += -Wb,stub_export_macro=DEPLOYMENT_APPLICATIONMANAGER_STUB_Export \ - -Wb,stub_export_include=Deployment_ApplicationManager_stub_export.h \ - -Wb,skel_export_macro=DEPLOYMENT_APPLICATIONMANAGER_SKEL_Export \ - -Wb,skel_export_include=Deployment_ApplicationManager_skel_export.h \ - -Gxhst -Gxhsk - - idlflags += -GC - IDL_Files { - Deployment_ApplicationManager.idl - } - specific { - install_dir = dance/Deployment - } -} - -project(Deployment_TargetManager_IDL) : install, dancelib_with_idl, dance_output, valuetype, gen_ostream { - custom_only = 1 - idlflags += -Wb,stub_export_macro=DEPLOYMENT_TARGETMANAGER_STUB_Export \ - -Wb,stub_export_include=Deployment_TargetManager_stub_export.h \ - -Wb,skel_export_macro=DEPLOYMENT_TARGETMANAGER_SKEL_Export \ - -Wb,skel_export_include=Deployment_TargetManager_skel_export.h \ - -Gxhst -Gxhsk - - IDL_Files { - Deployment_TargetManager.idl - } - specific { - install_dir = dance/Deployment - } -} - -project(Deployment_RepositoryManager_IDL) : install, dancelib_with_idl, dance_output, valuetype, gen_ostream { - custom_only = 1 - idlflags += -Wb,stub_export_macro=DEPLOYMENT_REPOSITORYMANAGER_STUB_Export \ - -Wb,stub_export_include=Deployment_RepositoryManager_stub_export.h \ - -Wb,skel_export_macro=DEPLOYMENT_REPOSITORYMANAGER_SKEL_Export \ - -Wb,skel_export_include=Deployment_RepositoryManager_skel_export.h \ - -Gxhst -Gxhsk - IDL_Files { - Deployment_RepositoryManager.idl - } - specific { - install_dir = dance/Deployment - } -} - -project(Deployment_ExecutionManager_IDL) : install, dancelib_with_idl, dance_output, valuetype, gen_ostream, amh { - custom_only = 1 - idlflags += -Wb,stub_export_macro=DEPLOYMENT_EXECUTIONMANAGER_STUB_Export \ - -Wb,stub_export_include=Deployment_ExecutionManager_stub_export.h \ - -Wb,skel_export_macro=DEPLOYMENT_EXECUTIONMANAGER_SKEL_Export \ - -Wb,skel_export_include=Deployment_ExecutionManager_skel_export.h \ - -Gxhst -Gxhsk - - IDL_Files { - Deployment_ExecutionManager.idl - } - specific { - install_dir = dance/Deployment - } -} - -project(Deployment_DAM_IDL) : install, dancelib_with_idl, dance_output, valuetype, gen_ostream, amh { - custom_only = 1 - idlflags += -Wb,stub_export_macro=DEPLOYMENT_DOMAINAPPLICATIONMANAGER_STUB_Export \ - -Wb,stub_export_include=Deployment_DomainApplicationManager_stub_export.h \ - -Wb,skel_export_macro=DEPLOYMENT_DOMAINAPPLICATIONMANAGER_SKEL_Export \ - -Wb,skel_export_include=Deployment_DomainApplicationManager_skel_export.h \ - -Gxhst -Gxhsk - - IDL_Files { - Deployment_DomainApplicationManager.idl - } - specific { - install_dir = dance/Deployment - } -} - -project(Deployment_DomainApplication_IDL) : install, dancelib_with_idl, dance_output, valuetype, gen_ostream, amh { - custom_only = 1 - idlflags += -Wb,stub_export_macro=DEPLOYMENT_DOMAINAPPLICATION_STUB_Export \ - -Wb,stub_export_include=Deployment_DomainApplication_stub_export.h \ - -Wb,skel_export_macro=DEPLOYMENT_DOMAINAPPLICATION_SKEL_Export \ - -Wb,skel_export_include=Deployment_DomainApplication_skel_export.h \ - -Gxhst -Gxhsk - - IDL_Files { - Deployment_DomainApplication.idl - } - specific { - install_dir = dance/Deployment - } -} - -project(Deployment_NAM_IDL) : install, dancelib_with_idl, dance_output, valuetype, gen_ostream, ami { - custom_only = 1 - idlflags += -Wb,stub_export_macro=DEPLOYMENT_NODEAPPLICATIONMANAGER_STUB_Export \ - -Wb,stub_export_include=Deployment_NodeApplicationManager_stub_export.h \ - -Wb,skel_export_macro=DEPLOYMENT_NODEAPPLICATIONMANAGER_SKEL_Export \ - -Wb,skel_export_include=Deployment_NodeApplicationManager_skel_export.h \ - -Gxhst -Gxhsk - - IDL_Files { - Deployment_NodeApplicationManager.idl - } - specific { - install_dir = dance/Deployment - } -} - -project(Deployment_NodeManager_IDL) : install, dancelib_with_idl, dance_output, valuetype, gen_ostream, ami { - custom_only = 1 - idlflags += -Wb,stub_export_macro=DEPLOYMENT_NODEMANAGER_STUB_Export \ - -Wb,stub_export_include=Deployment_NodeManager_stub_export.h \ - -Wb,skel_export_macro=DEPLOYMENT_NODEMANAGER_SKEL_Export \ - -Wb,skel_export_include=Deployment_NodeManager_skel_export.h \ - -Gxhst -Gxhsk - - IDL_Files { - Deployment_NodeManager.idl - } - specific { - install_dir = dance/Deployment - } -} - -project(Deployment_NodeApplication_IDL) : install, dancelib_with_idl, dance_output, valuetype, gen_ostream { - custom_only = 1 - idlflags += -Wb,stub_export_macro=DEPLOYMENT_NODEAPPLICATION_STUB_Export \ - -Wb,stub_export_include=Deployment_NodeApplication_stub_export.h \ - -Wb,skel_export_macro=DEPLOYMENT_NODEAPPLICATION_SKEL_Export \ - -Wb,skel_export_include=Deployment_NodeApplication_skel_export.h \ - -Gxhst -Gxhsk - - IDL_Files { - Deployment_NodeApplication.idl - } - specific { - install_dir = dance/Deployment - } -} - -// Valuetype library must be linked for this project. -// Please don't remove. -project(Deployment_stub) : install, dancelib_with_idl, dance_output, valuetype, ifr_client, messaging, dance_lib, dance_logger, gen_ostream, ami, amh { - sharedname = DAnCE_Deployment_stub - after += Deployment_IDL - - dynamicflags += DEPLOYMENT_STUB_BUILD_DLL - - IDL_Files { - } - Source_Files { - Deployment_StopErrorC.cpp - Deployment_StartErrorC.cpp - Deployment_BaseC.cpp - Deployment_ConnectionC.cpp - Deployment_DataC.cpp - Deployment_DeploymentPlanC.cpp - Deployment_TargetDataC.cpp - Deployment_ApplicationC.cpp - Deployment_Packaging_DataC.cpp - Deployment_PlanErrorC.cpp - DeploymentC.cpp - Deployment_ResourceCommitmentManagerC.cpp - Deployment_InvalidPropertyC.cpp - Deployment_InvalidNodeExecParameterC.cpp - Deployment_InvalidComponentExecParameterC.cpp - Deployment_InvalidConnectionC.cpp - Deployment_ResourceNotAvailableC.cpp - } - - Header_Files { - Deployment_StopErrorC.h - Deployment_StartErrorC.h - Deployment_BaseC.h - Deployment_ConnectionC.h - Deployment_DataC.h - Deployment_DeploymentPlanC.h - Deployment_TargetDataC.h - Deployment_ApplicationC.h - Deployment_Packaging_DataC.h - Deployment_PlanErrorC.h - DeploymentC.h - Deployment_ResourceCommitmentManagerC.h - Deployment_InvalidPropertyC.h - Deployment_InvalidNodeExecParameterC.h - Deployment_InvalidComponentExecParameterC.h - Deployment_InvalidConnectionC.h - Deployment_ResourceNotAvailableC.h - - Deployment_StopErrorS.h - Deployment_StartErrorS.h - Deployment_BaseS.h - Deployment_ConnectionS.h - Deployment_DataS.h - Deployment_DeploymentPlanS.h - Deployment_TargetDataS.h - Deployment_ApplicationS.h - Deployment_Packaging_DataS.h - Deployment_PlanErrorS.h - DeploymentS.h - Deployment_ResourceCommitmentManagerS.h - Deployment_InvalidPropertyS.h - Deployment_InvalidNodeExecParameterS.h - Deployment_InvalidComponentExecParameterS.h - Deployment_InvalidConnectionS.h - Deployment_ResourceNotAvailableS.h - - Deployment_stub_export.h - } - - Inline_Files { - Deployment_ApplicationC.inl - Deployment_BaseC.inl - Deployment_ResourceCommitmentManagerC.inl - } - - specific { - install_dir = dance/Deployment - } -} - -project(Deployment_AM_stub) : install, dance_output, dance_deployment_stub, amh { - sharedname = DAnCE_ApplicationManager_stub - after += Deployment_ApplicationManager_IDL - dynamicflags += DEPLOYMENT_APPLICATIONMANAGER_STUB_BUILD_DLL - - IDL_Files { - } - - Source_Files { - Deployment_ApplicationManagerC.cpp - } - Header_Files { - Deployment_ApplicationManagerC.h - Deployment_ApplicationManager_stub_export.h - } - Inline_Files { - Deployment_ApplicationManagerC.inl - } - specific { - install_dir = dance/Deployment - } -} - -project(Deployment_AM_skel) : install, dance_output, dance_deployment_skel, dance_applicationmanager_stub, amh { - sharedname = DAnCE_ApplicationManager_skel - after += Deployment_AM_stub - dynamicflags += DEPLOYMENT_APPLICATIONMANAGER_SKEL_BUILD_DLL - - IDL_Files { - } - - Source_Files { - Deployment_ApplicationManagerS.cpp - } - - Inline_Files { - } - - Header_Files { - Deployment_ApplicationManagerS.h - Deployment_ApplicationManager_skel_export.h - } - - specific { - install_dir = dance/Deployment - } -} - - -project(Deployment_DAM_stub) : install, dance_output, dance_applicationmanager_stub, amh { - sharedname = DAnCE_DomainApplicationManager_stub - after += Deployment_DAM_IDL - dynamicflags += DEPLOYMENT_DOMAINAPPLICATIONMANAGER_STUB_BUILD_DLL - - IDL_Files { - } - - Source_Files { - Deployment_DomainApplicationManagerC.cpp - } - Header_Files { - Deployment_DomainApplicationManagerC.h - Deployment_DomainApplicationManager_stub_export.h - } - Inline_Files { - Deployment_DomainApplicationManagerC.inl - } - specific { - install_dir = dance/Deployment - } -} - -project(Deployment_DAM_skel) : install, dance_output, dance_applicationmanager_skel, dance_domainapplicationmanager_stub, amh { - sharedname = DAnCE_DomainApplicationManager_skel - after += Deployment_DAM_stub - dynamicflags += DEPLOYMENT_DOMAINAPPLICATIONMANAGER_SKEL_BUILD_DLL - - IDL_Files { - } - - Source_Files { - Deployment_DomainApplicationManagerS.cpp - } - - Inline_Files { - } - - specific { - install_dir = dance/Deployment - } -} - -project(Deployment_ExecutionManager_stub) : install, dance_output, dance_deployment_stub, dance_domainapplicationmanager_stub, amh { - sharedname = DAnCE_ExecutionManager_stub - after += Deployment_ExecutionManager_IDL - dynamicflags += DEPLOYMENT_EXECUTIONMANAGER_STUB_BUILD_DLL - - IDL_Files { - } - - Source_Files { - Deployment_ExecutionManagerC.cpp - } - Header_Files { - Deployment_ExecutionManagerC.h - Deployment_ExecutionManager_stub_export.h - } - Inline_Files { - Deployment_ExecutionManagerC.inl - } - specific { - install_dir = dance/Deployment - } -} - -project(Deployment_ExecutionManager_skel) : install, dance_output, dance_deployment_skel, dance_executionmanager_stub, amh { - sharedname = DAnCE_ExecutionManager_skel - after += Deployment_ExecutionManager_stub - dynamicflags += DEPLOYMENT_EXECUTIONMANAGER_SKEL_BUILD_DLL - - IDL_Files { - } - - Source_Files { - Deployment_ExecutionManagerS.cpp - } - specific { - install_dir = dance/Deployment - } -} - -project(Deployment_DomainApplication_stub) : install, dance_output, dance_deployment_stub, amh { - sharedname = DAnCE_DomainApplication_stub - after += Deployment_DomainApplication_IDL - dynamicflags += DEPLOYMENT_DOMAINAPPLICATION_STUB_BUILD_DLL - - IDL_Files { - } - - Source_Files { - Deployment_DomainApplicationC.cpp - } - Header_Files { - Deployment_DomainApplicationC.h - Deployment_DomainApplication_stub_export.h - } - Inline_Files { - Deployment_DomainApplicationC.inl - } - specific { - install_dir = dance/Deployment - } -} - -project(Deployment_DomainApplication_skel) : install, dance_output, dance_deployment_skel, dance_domainapplication_stub, amh { - sharedname = DAnCE_DomainApplication_skel - after += Deployment_DomainApplication_stub - dynamicflags += DEPLOYMENT_DOMAINAPPLICATION_SKEL_BUILD_DLL - - IDL_Files { - } - - Source_Files { - Deployment_DomainApplicationS.cpp - } - - Inline_Files { - } - - specific { - install_dir = dance/Deployment - } -} - -project(Deployment_NAM_stub) : install, dance_output, dance_applicationmanager_stub, ami { - sharedname = DAnCE_NodeApplicationManager_stub - after += Deployment_NAM_IDL - dynamicflags += DEPLOYMENT_NODEAPPLICATIONMANAGER_STUB_BUILD_DLL - - IDL_Files { - } - - Source_Files { - Deployment_NodeApplicationManagerC.cpp - } - Header_Files { - Deployment_NodeApplicationManagerC.h - Deployment_NodeApplicationManager_stub_export.h - } - Inline_Files { - Deployment_NodeApplicationManagerC.inl - } - specific { - install_dir = dance/Deployment - } -} - -project(Deployment_NAM_skel) : install, dance_output, dance_applicationmanager_skel, dance_nodeapplicationmanager_stub, ami { - sharedname = DAnCE_NodeApplicationManager_skel - after += Deployment_NAM_stub - dynamicflags += DEPLOYMENT_NODEAPPLICATIONMANAGER_SKEL_BUILD_DLL - - IDL_Files { - } - - Source_Files { - Deployment_NodeApplicationManagerS.cpp - } - - Inline_Files { - } - - specific { - install_dir = dance/Deployment - } -} - -project(Deployment_NodeManager_stub) : install, dance_output, dance_deployment_stub, dance_nodeapplicationmanager_stub, dance_targetmanager_stub, ami { - sharedname = DAnCE_NodeManager_stub - after += Deployment_NodeManager_IDL - dynamicflags += DEPLOYMENT_NODEMANAGER_STUB_BUILD_DLL - - IDL_Files { - } - - Source_Files { - Deployment_NodeManagerC.cpp - } - Header_Files { - Deployment_NodeManagerC.h - Deployment_NodeManager_stub_export.h - } - Inline_Files { - Deployment_NodeManagerC.inl - } - specific { - install_dir = dance/Deployment - } -} - -project(Deployment_NodeManager_skel) : install, dance_output, dance_deployment_skel, dance_nodemanager_stub, dance_nodeapplicationmanager_skel, ami { - sharedname = DAnCE_NodeManager_skel - after += Deployment_NodeManager_stub - dynamicflags += DEPLOYMENT_NODEMANAGER_SKEL_BUILD_DLL - - IDL_Files { - } - - Source_Files { - Deployment_NodeManagerS.cpp - } - - Inline_Files { - } - - specific { - install_dir = dance/Deployment - } -} - -project(Deployment_TargetManager_stub) : install, dance_output, dance_deployment_stub { - sharedname = DAnCE_TargetManager_stub - after += Deployment_TargetManager_IDL - dynamicflags += DEPLOYMENT_TARGETMANAGER_STUB_BUILD_DLL - - IDL_Files { - } - - Source_Files { - Deployment_TargetManagerC.cpp - } - Header_Files { - Deployment_TargetManagerC.h - Deployment_TargetManager_stub_export.h - } - Inline_Files { - Deployment_TargetManagerC.inl - } - specific { - install_dir = dance/Deployment - } -} - -project(Deployment_TargetManager_skel) : install, dance_output, dance_deployment_skel, dance_targetmanager_stub { - sharedname = DAnCE_TargetManager_skel - after += Deployment_TargetManager_stub - dynamicflags += DEPLOYMENT_TARGETMANAGER_SKEL_BUILD_DLL - - IDL_Files { - } - - Source_Files { - Deployment_TargetManagerS.cpp - } - specific { - install_dir = dance/Deployment - } -} - -project(Deployment_RepositoryManager_stub) : install, dance_output, dance_deployment_stub { - sharedname = DAnCE_RepositoryManager_stub - after += Deployment_RepositoryManager_IDL - dynamicflags += DEPLOYMENT_REPOSITORYMANAGER_STUB_BUILD_DLL - - IDL_Files { - } - - Source_Files { - Deployment_RepositoryManagerC.cpp - } - Header_Files { - Deployment_RepositoryManagerC.h - Deployment_RepositoryManager_stub_export.h - } - Inline_Files { - Deployment_RepositoryManagerC.inl - } - specific { - install_dir = dance/Deployment - } -} - -project(Deployment_RepositoryManager_skel) : install, dance_output, dance_deployment_skel, dance_repositorymanager_stub { - sharedname = DAnCE_RepositoryManager_skel - after += Deployment_RepositoryManager_stub - dynamicflags += DEPLOYMENT_REPOSITORYMANAGER_SKEL_BUILD_DLL - - IDL_Files { - } - - Source_Files { - Deployment_RepositoryManagerS.cpp - } - - Inline_Files { - } - - specific { - install_dir = dance/Deployment - } -} - -project(Deployment_NodeApplication_stub) : install, dance_output, dance_deployment_stub { - sharedname = DAnCE_NodeApplication_stub - after += Deployment_NodeApplication_IDL - dynamicflags += DEPLOYMENT_NODEAPPLICATION_STUB_BUILD_DLL - - IDL_Files { - } - - Source_Files { - Deployment_NodeApplicationC.cpp - } - Header_Files { - Deployment_NodeApplicationC.h - Deployment_NodeApplication_stub_export.h - } - Inline_Files { - Deployment_NodeApplicationC.inl - } - specific { - install_dir = dance/Deployment - } -} - -project(Deployment_NodeApplication_skel) : install, dance_output, dance_deployment_skel, dance_nodeapplication_stub { - sharedname = DAnCE_NodeApplication_skel - after += Deployment_NodeApplication_stub - dynamicflags += DEPLOYMENT_NODEAPPLICATION_SKEL_BUILD_DLL - - IDL_Files { - } - - Source_Files { - Deployment_NodeApplicationS.cpp - } - - Inline_Files { - } - - specific { - install_dir = dance/Deployment - } -} - -project(Deployment_skel) : install, dance_deployment_stub, dance_output, dancelib_with_idl, portableserver, valuetype, \ - ifr_client, naming, dance_lib, dance_logger, messaging, gen_ostream, ami, amh { - sharedname = DAnCE_Deployment_skel - dynamicflags += DEPLOYMENT_SKEL_BUILD_DLL - after += Deployment_IDL - - IDL_Files { - } - - Source_Files { - Deployment_ApplicationS.cpp - Deployment_ResourceCommitmentManagerS.cpp - } - - Header_Files { - Deployment_skel_export.h - } - - Inline_Files { - } - - specific { - install_dir = dance/Deployment - } -} diff --git a/DAnCE/dance/Deployment/Deployment_Data.idl b/DAnCE/dance/Deployment/Deployment_Data.idl deleted file mode 100644 index ff8a5728031..00000000000 --- a/DAnCE/dance/Deployment/Deployment_Data.idl +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef DEPLOYMENT_DATA_IDL -#define DEPLOYMENT_DATA_IDL - -#include "dance/Deployment/Deployment_DeploymentPlan.idl" - -module Deployment { - struct ComponentPackageReference { - string requiredUUID; - string requiredName; - ComponentInterfaceDescription requiredType; - }; - - typedef sequence < ComponentPackageReference > ComponentPackageReferences; - - typedef sequence < ResourceUsageKind > ResourceUsageKinds; - - struct ImplementationRequirement { - ResourceUsageKinds resourceUsage; - string resourcePort; - string componentPort; - string name; - string resourceType; - Properties property; - }; - - typedef sequence < ImplementationRequirement > ImplementationRequirements; - - struct Capability { - string name; - CORBA::StringSeq resourceType; - SatisfierProperties property; - }; - - typedef sequence < Capability > Capabilities; -}; - -#endif /* DEPLOYMENT_DATA_IDL */ - - diff --git a/DAnCE/dance/Deployment/Deployment_DeploymentPlan.idl b/DAnCE/dance/Deployment/Deployment_DeploymentPlan.idl deleted file mode 100644 index 078befb58ea..00000000000 --- a/DAnCE/dance/Deployment/Deployment_DeploymentPlan.idl +++ /dev/null @@ -1,208 +0,0 @@ -#ifndef DEPLOYMENT_DEPLOYMENTPLAN_IDL -#define DEPLOYMENT_DEPLOYMENTPLAN_IDL - -#include "tao/orb.idl" -#include "dance/Deployment/Deployment_Base.idl" - -module Deployment { - enum CCMComponentPortKind { - Facet, - SimplexReceptacle, - MultiplexReceptacle, - EventEmitter, - EventPublisher, - EventConsumer, - ExtendedPort, // New from DDS4CCM - _MirrorPort // New from DDS4CCM - }; - - struct ComponentPortDescription { - string name; - string specificType; - CORBA::StringSeq supportedType; - boolean provider; - boolean exclusiveProvider; - boolean exclusiveUser; - boolean optional; - CCMComponentPortKind kind; - CORBA::StringSeq templateParam; // New from DDS4CCM - }; - - typedef sequence < ComponentPortDescription > ComponentPortDescriptions; - - struct ComponentPropertyDescription { - string name; - CORBA::TypeCode type; - }; - - typedef sequence < ComponentPropertyDescription > ComponentPropertyDescriptions; - - struct ComponentInterfaceDescription { - string label; - string UUID; - string specificType; - CORBA::StringSeq supportedType; - CORBA::StringSeq idlFile; - Properties configProperty; - ComponentPortDescriptions _port; - ComponentPropertyDescriptions property; - Properties infoProperty; - }; - - struct MonolithicDeploymentDescription { - string name; - CORBA::StringSeq source; - CORBA::ULongSeq artifactRef; - Properties execParameter; - Requirements deployRequirement; - }; - - typedef sequence < MonolithicDeploymentDescription > MonolithicDeploymentDescriptions; - - enum ResourceUsageKind { - None, - InstanceUsesResource, - ResourceUsesInstance, - PortUsesResource, - ResourceUsesPort - }; - - struct InstanceResourceDeploymentDescription { - ResourceUsageKind resourceUsage; - string requirementName; - string resourceName; - Properties property; - }; - - typedef sequence < InstanceResourceDeploymentDescription > InstanceResourceDeploymentDescriptions; - - struct InstanceDeploymentDescription { - string name; - string node; - CORBA::StringSeq source; - unsigned long implementationRef; - Properties configProperty; - InstanceResourceDeploymentDescriptions deployedResource; - InstanceResourceDeploymentDescriptions deployedSharedResource; - }; - - typedef sequence < InstanceDeploymentDescription > InstanceDeploymentDescriptions; - - struct ComponentExternalPortEndpoint { - string portName; - }; - - typedef sequence < ComponentExternalPortEndpoint > ComponentExternalPortEndpoints; - - struct PlanSubcomponentPortEndpoint { - string portName; - boolean provider; - CCMComponentPortKind kind; - unsigned long instanceRef; - }; - - typedef sequence < PlanSubcomponentPortEndpoint > PlanSubcomponentPortEndpoints; - - struct ExternalReferenceEndpoint { - string location; - boolean provider; - string portName; - CORBA::StringSeq supportedType; - }; - - typedef sequence < ExternalReferenceEndpoint > ExternalReferenceEndpoints; - - struct ConnectionResourceDeploymentDescription { - string targetName; - string requirementName; - string resourceName; - Properties property; - }; - - typedef sequence < ConnectionResourceDeploymentDescription > ConnectionResourceDeploymentDescriptions; - - struct PlanConnectionDescription { - string name; - CORBA::StringSeq source; - Requirements deployRequirement; - ComponentExternalPortEndpoints externalEndpoint; - PlanSubcomponentPortEndpoints internalEndpoint; - ExternalReferenceEndpoints externalReference; - ConnectionResourceDeploymentDescriptions deployedResource; - }; - - typedef sequence < PlanConnectionDescription > PlanConnectionDescriptions; - - struct PlanSubcomponentPropertyReference { - string propertyName; - unsigned long instanceRef; - }; - - typedef sequence < PlanSubcomponentPropertyReference > PlanSubcomponentPropertyReferences; - - struct PlanPropertyMapping { - string name; - CORBA::StringSeq source; - string externalName; - PlanSubcomponentPropertyReferences delegatesTo; - }; - - typedef sequence < PlanPropertyMapping > PlanPropertyMappings; - - struct ImplementationDependency { - string requiredType; - }; - - typedef sequence < ImplementationDependency > ImplementationDependencies; - - struct ResourceDeploymentDescription { - string requirementName; - string resourceName; - Properties property; - }; - - typedef sequence < ResourceDeploymentDescription > ResourceDeploymentDescriptions; - - struct ArtifactDeploymentDescription { - string name; - CORBA::StringSeq location; - string node; - CORBA::StringSeq source; - Properties execParameter; - Requirements deployRequirement; - ResourceDeploymentDescriptions deployedResource; - }; - - typedef sequence < ArtifactDeploymentDescription > ArtifactDeploymentDescriptions; - - // OMG 06-04-02 has this without Plan prefix but that results in illegal IDL - // because LocalityKind also has DifferentProcess as value - enum PlanLocalityKind { - PlanSameProcess, - PlanDifferentProcess, - PlanNoConstraint - }; - - struct PlanLocality { - PlanLocalityKind constraint; - CORBA::ULongSeq constrainedInstanceRef; - }; - - typedef sequence < PlanLocality > PlanLocalities; - - struct DeploymentPlan { - string label; - string UUID; - ComponentInterfaceDescription realizes; - MonolithicDeploymentDescriptions implementation; - InstanceDeploymentDescriptions instance; - PlanConnectionDescriptions connection; - PlanPropertyMappings externalProperty; - ImplementationDependencies dependsOn; - ArtifactDeploymentDescriptions artifact; - Properties infoProperty; - PlanLocalities localityConstraint; - }; -}; - -#endif /* DEPLOYMENT_DATA_IDL */ diff --git a/DAnCE/dance/Deployment/Deployment_DomainApplication.idl b/DAnCE/dance/Deployment/Deployment_DomainApplication.idl deleted file mode 100644 index 275c3bcbdc9..00000000000 --- a/DAnCE/dance/Deployment/Deployment_DomainApplication.idl +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef DEPLOYMENT_DOMAINAPPLICATION_IDL -#define DEPLOYMENT_DOMAINAPPLICATION_IDL - -#include "dance/Deployment/Deployment_Application.idl" - -module Deployment -{ - interface DomainApplication : - Application - { - }; -}; - - -#endif //DEPLOYMENT_DOMAINAPPLICATION_IDL diff --git a/DAnCE/dance/Deployment/Deployment_DomainApplicationManager.idl b/DAnCE/dance/Deployment/Deployment_DomainApplicationManager.idl deleted file mode 100644 index d96f41622d9..00000000000 --- a/DAnCE/dance/Deployment/Deployment_DomainApplicationManager.idl +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef DOMAINAPPLICATIONMANAGER_IDL -#define DOMAINAPPLICATIONMANAGER_IDL - -#include "dance/Deployment/Deployment_DeploymentPlan.idl" -#include "dance/Deployment/Deployment_ApplicationManager.idl" - -module Deployment { - interface DomainApplicationManager : ApplicationManager - { - Applications getApplications (); - DeploymentPlan getPlan (); - }; - - typedef sequence < DomainApplicationManager > DomainApplicationManagers; -}; - -#endif /* DOMAINAPPLICATIONMANAGER_IDL */ diff --git a/DAnCE/dance/Deployment/Deployment_ExecutionManager.idl b/DAnCE/dance/Deployment/Deployment_ExecutionManager.idl deleted file mode 100644 index 259b5e7ee9f..00000000000 --- a/DAnCE/dance/Deployment/Deployment_ExecutionManager.idl +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef EXECUTIONMANAGER_IDL -#define EXECUTIONMANAGER_IDL - -#include "dance/Deployment/Deployment_DomainApplicationManager.idl" -#include "dance/Deployment/Deployment_ResourceCommitmentManager.idl" -#include "dance/Deployment/Deployment_PlanError.idl" - -module Deployment { - interface ExecutionManager { - DomainApplicationManager preparePlan (in DeploymentPlan plan, - in ResourceCommitmentManager resourceCommitment) - raises (ResourceNotAvailable, PlanError, StartError); - DomainApplicationManagers getManagers (); - void destroyManager (in DomainApplicationManager manager) - raises (StopError); - }; -}; - -#endif /* EXECUTIONMANAGER_IDL */ diff --git a/DAnCE/dance/Deployment/Deployment_InvalidComponentExecParameter.idl b/DAnCE/dance/Deployment/Deployment_InvalidComponentExecParameter.idl deleted file mode 100644 index bd301adbcd4..00000000000 --- a/DAnCE/dance/Deployment/Deployment_InvalidComponentExecParameter.idl +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef DEPLOYMENT_INVALIDCOMPONENTEXECPARAMETER_IDL -#define DEPLOYMENT_INVALIDCOMPONENTEXECPARAMETER_IDL - -module Deployment { - exception InvalidComponentExecParameter { - string name; - string reason; - }; -}; - -#endif diff --git a/DAnCE/dance/Deployment/Deployment_InvalidConnection.idl b/DAnCE/dance/Deployment/Deployment_InvalidConnection.idl deleted file mode 100644 index 54fb295b6ff..00000000000 --- a/DAnCE/dance/Deployment/Deployment_InvalidConnection.idl +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef DEPLOYMENT_INVALIDCONNECTION_IDL -#define DEPLOYMENT_INVALIDCONNECTION_IDL - -module Deployment { - exception InvalidConnection { - string name; - string reason; - }; -}; - -#endif diff --git a/DAnCE/dance/Deployment/Deployment_InvalidNodeExecParameter.idl b/DAnCE/dance/Deployment/Deployment_InvalidNodeExecParameter.idl deleted file mode 100644 index d550bc1835f..00000000000 --- a/DAnCE/dance/Deployment/Deployment_InvalidNodeExecParameter.idl +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef DEPLOYMENT_INVALIDNODEEXECPARAMETER_IDL -#define DEPLOYMENT_INVALIDNODEEXECPARAMETER_IDL - -module Deployment { - exception InvalidNodeExecParameter { - string name; - string reason; - }; -}; - -#endif diff --git a/DAnCE/dance/Deployment/Deployment_InvalidProperty.idl b/DAnCE/dance/Deployment/Deployment_InvalidProperty.idl deleted file mode 100644 index 765f55c902d..00000000000 --- a/DAnCE/dance/Deployment/Deployment_InvalidProperty.idl +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef DEPLOYMENT_INVALIDPROPERTY_IDL -#define DEPLOYMENT_INVALIDPROPERTY_IDL - -module Deployment { - exception InvalidProperty { - string name; - string reason; - }; -}; - -#endif diff --git a/DAnCE/dance/Deployment/Deployment_NodeApplication.idl b/DAnCE/dance/Deployment/Deployment_NodeApplication.idl deleted file mode 100644 index ada2a1c24b6..00000000000 --- a/DAnCE/dance/Deployment/Deployment_NodeApplication.idl +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef DEPLOYMENT_NODEAPPLICATION_IDL -#define DEPLOYMENT_NODEAPPLICATION_IDL - -#include "dance/Deployment/Deployment_Application.idl" - -module Deployment { - interface NodeApplication : Application - { - }; -}; -#endif /* DEPLOYMENT_NODEAPPLICATION_IDL */ - diff --git a/DAnCE/dance/Deployment/Deployment_NodeApplicationManager.idl b/DAnCE/dance/Deployment/Deployment_NodeApplicationManager.idl deleted file mode 100644 index f30ebbfbb4c..00000000000 --- a/DAnCE/dance/Deployment/Deployment_NodeApplicationManager.idl +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef NODEAPPLICATIONMANAGER_IDL -#define NODEAPPLICATIONMANAGER_IDL - -#include "dance/Deployment/Deployment_ApplicationManager.idl" - -module Deployment { - interface NodeApplicationManager : - ApplicationManager - { - }; -}; - -#endif /* NODEAPPLICATIONMANAGER_IDL */ diff --git a/DAnCE/dance/Deployment/Deployment_NodeManager.idl b/DAnCE/dance/Deployment/Deployment_NodeManager.idl deleted file mode 100644 index ad08858c289..00000000000 --- a/DAnCE/dance/Deployment/Deployment_NodeManager.idl +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef DEPLOYMENT_NODEMANAGER_IDL -#define DEPLOYMENT_NODEMANAGER_IDL - -#include "dance/Deployment/Deployment.idl" -#include "dance/Deployment/Deployment_TargetManager.idl" -#include "dance/Deployment/Deployment_NodeApplicationManager.idl" -#include "dance/Deployment/Deployment_PlanError.idl" - -module Deployment { - - interface Logger { - }; - - interface NodeManager { - void joinDomain (in Domain theDomain, - in TargetManager manager, - in Logger log, - in long updateInterval); - - void leaveDomain (); - - NodeApplicationManager preparePlan (in DeploymentPlan plan, - in ResourceCommitmentManager resourceCommitment) - raises (StartError, PlanError); - - void destroyManager (in NodeApplicationManager appManager) - raises (StopError); - - Resources getDynamicResources (); - }; -}; - -#endif /* DEPLOYMENT_NODEMANAGER_IDL */ diff --git a/DAnCE/dance/Deployment/Deployment_Packaging_Data.idl b/DAnCE/dance/Deployment/Deployment_Packaging_Data.idl deleted file mode 100644 index 74b11b2f02b..00000000000 --- a/DAnCE/dance/Deployment/Deployment_Packaging_Data.idl +++ /dev/null @@ -1,199 +0,0 @@ -#ifndef PACKAGING_DATA_IDL -#define PACKAGING_DATA_IDL - -#include "dance/Deployment/Deployment_Data.idl" - -module Deployment { - - struct ComponentPackageDescription; - - typedef sequence < ComponentPackageDescription > ComponentPackageDescriptions; - - struct PackageConfiguration; - - typedef sequence < PackageConfiguration > PackageConfigurations; - - struct ComponentPackageImport { - CORBA::StringSeq location; - }; - - typedef sequence < ComponentPackageImport > ComponentPackageImports; - - struct SubcomponentInstantiationDescription { - string name; - ComponentPackageDescriptions basePackage; - PackageConfigurations specializedConfig; - Requirements selectRequirement; - Properties configProperty; - ComponentPackageReferences referencedPackage; - ComponentPackageImports importedPackage; - }; - - typedef sequence < SubcomponentInstantiationDescription > SubcomponentInstantiationDescriptions; - - struct SubcomponentPortEndpoint { - string portName; - unsigned long instanceRef; - }; - - typedef sequence < SubcomponentPortEndpoint > SubcomponentPortEndpoints; - - struct AssemblyConnectionDescription { - string name; - Requirements deployRequirement; - ComponentExternalPortEndpoints externalEndpoint; - SubcomponentPortEndpoints internalEndpoint; - ExternalReferenceEndpoints externalReference; - }; - - typedef sequence < AssemblyConnectionDescription > AssemblyConnectionDescriptions; - - struct SubcomponentPropertyReference { - string propertyName; - unsigned long instanceRef; - }; - - typedef sequence < SubcomponentPropertyReference > SubcomponentPropertyReferences; - - struct AssemblyPropertyMapping { - string name; - string externalName; - SubcomponentPropertyReferences delegatesTo; - }; - - typedef sequence < AssemblyPropertyMapping > AssemblyPropertyMappings; - - struct NamedImplementationArtifact; - - typedef sequence < NamedImplementationArtifact > NamedImplementationArtifacts; - - struct ImplementationArtifactDescription { - string label; - string UUID; - CORBA::StringSeq location; - Properties execParameter; - Requirements deployRequirement; - NamedImplementationArtifacts dependsOn; - Properties infoProperty; - }; - - struct NamedImplementationArtifact { - string name; - ImplementationArtifactDescription referencedArtifact; - }; - - struct MonolithicImplementationDescription { - Properties nodeExecParameter; - NamedImplementationArtifacts primaryArtifact; - ImplementationRequirements deployRequirement; - Properties componentExecParameter; - }; - - typedef sequence < MonolithicImplementationDescription > MonolithicImplementationDescriptions; - - enum LocalityKind { - SameNodeAnyProcess, - SameNodeSameProcess, - SameNodeDifferentProcess, - DifferentNode, - DifferentProcess, - NoConstraint - }; - - struct Locality { - LocalityKind constraint; - CORBA::ULongSeq constrainedInstanceRef; - }; - - typedef sequence < Locality > Localities; - - struct ComponentAssemblyDescription { - SubcomponentInstantiationDescriptions instance; - AssemblyConnectionDescriptions connection; - AssemblyPropertyMappings externalProperty; - Localities localityConstraint; - }; - - typedef sequence < ComponentAssemblyDescription > ComponentAssemblyDescriptions; - - struct ComponentImplementationDescription { - string label; - string UUID; - ComponentInterfaceDescription implements; - ComponentAssemblyDescriptions assemblyImpl; - MonolithicImplementationDescriptions monolithicImpl; - Properties configProperty; - Capabilities capability; - ImplementationDependencies dependsOn; - Properties infoProperty; - }; - - // From DDS4CCM - struct ConnectorImplementationDescription { - string label; - string UUID; - ComponentInterfaceDescription implements; - ComponentAssemblyDescriptions assemblyImpl; - MonolithicImplementationDescriptions monolithicImpl; - Properties configProperty; - Capabilities capability; - ImplementationDependencies dependsOn; - Properties infoProperty; - }; - - struct PackagedComponentImplementation { - string name; - ComponentImplementationDescription referencedImplementation; - }; - - typedef sequence < PackagedComponentImplementation > PackagedComponentImplementations; - - struct ComponentPackageDescription { - string label; - string UUID; - ComponentInterfaceDescription realizes; - Properties configProperty; - PackagedComponentImplementations implementation; - Properties infoProperty; - }; - - // From DDS4CCM - struct ConnectorPackageDescription { - string label; - string UUID; - ComponentInterfaceDescription realizes; - Properties configProperty; - ConnectorImplementationDescription implementation; - Properties infoProperty; - }; - - struct PackageConfiguration { - string label; - string UUID; - ComponentPackageDescriptions basePackage; - PackageConfigurations specializedConfig; - Requirements selectRequirement; - Properties configProperty; - ComponentPackageReferences referencedPackage; - ComponentPackageImports importedPackage; - }; - - struct ComponentUsageDescription { - ComponentPackageDescriptions basePackage; - ConnectorPackageDescription baseConnectorPackage; // From DDS4CCM - PackageConfigurations specializedConfig; - Requirements selectRequirement; - Properties configProperty; - ComponentPackageReferences referencedPackage; - ComponentPackageImports importedPackage; - }; - - struct RequirementSatisfier { - string name; - CORBA::StringSeq resourceType; - SatisfierProperties property; - }; - -}; - -#endif /* PACKAGING_DATA_IDL */ diff --git a/DAnCE/dance/Deployment/Deployment_PlanError.idl b/DAnCE/dance/Deployment/Deployment_PlanError.idl deleted file mode 100644 index ff2d7d577a1..00000000000 --- a/DAnCE/dance/Deployment/Deployment_PlanError.idl +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef DEPLOYMENT_PLANERROR_IDL -#define DEPLOYMENT_PLANERROR_IDL - -module Deployment { - exception PlanError { - string name; - string reason; - }; -}; - -#endif /* DEPLOYMENT_PLANERROR_IDL */ diff --git a/DAnCE/dance/Deployment/Deployment_RepositoryManager.idl b/DAnCE/dance/Deployment/Deployment_RepositoryManager.idl deleted file mode 100644 index 2ffba296e61..00000000000 --- a/DAnCE/dance/Deployment/Deployment_RepositoryManager.idl +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef REPOSITORY_MANAGER_IDL -#define REPOSITORY_MANAGER_IDL - -#include "dance/Deployment/Deployment_Packaging_Data.idl" -#include "dance/Deployment/Deployment.idl" - -module Deployment { - - exception NameExists { - }; - - exception PackageError { - string source; - string reason; - }; - - exception NoSuchName { - }; - - interface RepositoryManager { - void installPackage (in string installationName, - in string location, - in boolean replace) - raises (NameExists, PackageError); - - void createPackage (in string installationName, - in PackageConfiguration package, - in string baseLocation, - in boolean replace) - raises (NameExists, PackageError); - - PackageConfiguration findPackageByName (in string name) - raises (NoSuchName); - - PackageConfiguration findPackageByUUID (in string UUID) - raises (NoSuchName); - - CORBA::StringSeq findNamesByType (in string type); - - CORBA::StringSeq getAllNames (); - - CORBA::StringSeq getAllTypes (); - - void deletePackage (in string installationName) - raises (NoSuchName); - }; -}; - -#endif /* REPOSITOR_MANAGER_IDL */ diff --git a/DAnCE/dance/Deployment/Deployment_ResourceCommitmentManager.idl b/DAnCE/dance/Deployment/Deployment_ResourceCommitmentManager.idl deleted file mode 100644 index 6d8569c0741..00000000000 --- a/DAnCE/dance/Deployment/Deployment_ResourceCommitmentManager.idl +++ /dev/null @@ -1,33 +0,0 @@ -// -#ifndef RESOURCE_COMMITMENT_MANAGER_IDL -#define RESOURCE_COMMITMENT_MANAGER_IDL - -#include "dance/Deployment/Deployment_Base.idl" -#include "tao/AnyTypeCode/AnySeq.pidl" - -module Deployment { - struct ResourceAllocation { - string elementName; - string resourceName; - Properties property; - }; - - typedef sequence < ResourceAllocation > ResourceAllocations; - - exception ResourceCommitmentFailure { - string reason; - long index; - string propertyName; - CORBA::AnySeq propertyValue; - }; - - interface ResourceCommitmentManager { - void commitResources (in ResourceAllocations resources) - raises (ResourceCommitmentFailure); - void releaseResources (in ResourceAllocations resources) - raises (ResourceCommitmentFailure); - }; -}; - -#endif //RESOURCE_COMMITMENT_MANAGER_IDL - diff --git a/DAnCE/dance/Deployment/Deployment_ResourceNotAvailable.idl b/DAnCE/dance/Deployment/Deployment_ResourceNotAvailable.idl deleted file mode 100644 index 9ead9292713..00000000000 --- a/DAnCE/dance/Deployment/Deployment_ResourceNotAvailable.idl +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef DEPLOYMENT_RESOURCENOTAVAILABLE_IDL -#define DEPLOYMENT_RESOURCENOTAVAILABLE_IDL - -module Deployment { - exception ResourceNotAvailable { - string name; - string resourceType; - string propertyName; - string elementName; - string resourceName; - }; -}; - -#endif diff --git a/DAnCE/dance/Deployment/Deployment_StartError.idl b/DAnCE/dance/Deployment/Deployment_StartError.idl deleted file mode 100644 index d5d361a23ed..00000000000 --- a/DAnCE/dance/Deployment/Deployment_StartError.idl +++ /dev/null @@ -1,13 +0,0 @@ -// Compliant with OMG 06-04-01 section 15 - -#ifndef DEPLOYMENT_STARTERROR_IDL -#define DEPLOYMENT_STARTERROR_IDL - -module Deployment { - exception StartError { - string name; - string reason; - }; -}; -#endif /* DEPLOYMENT_STARTERROR_IDL */ - diff --git a/DAnCE/dance/Deployment/Deployment_StopError.idl b/DAnCE/dance/Deployment/Deployment_StopError.idl deleted file mode 100644 index 125e1a0152a..00000000000 --- a/DAnCE/dance/Deployment/Deployment_StopError.idl +++ /dev/null @@ -1,13 +0,0 @@ -// Compliant with OMG 06-04-01 section 15 - -#ifndef DEPLOYMENT_STOPERROR_IDL -#define DEPLOYMENT_STOPERROR_IDL - -module Deployment { - exception StopError { - string name; - string reason; - }; -}; -#endif /* DEPLOYMENT_STOPERROR_IDL */ - diff --git a/DAnCE/dance/Deployment/Deployment_TargetData.idl b/DAnCE/dance/Deployment/Deployment_TargetData.idl deleted file mode 100644 index 7dd199e0f00..00000000000 --- a/DAnCE/dance/Deployment/Deployment_TargetData.idl +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef DEPLOYMENT_TARGETDATA_IDL -#define DEPLOYMENT_TARGETDATA_IDL - -#include "dance/Deployment/Deployment_Base.idl" -#include "tao/StringSeq.pidl" -#include "tao/ULongSeq.pidl" - -module Deployment { - struct Resource { - string name; - CORBA::StringSeq resourceType; - SatisfierProperties property; - }; - - typedef sequence < Resource > Resources; - - struct SharedResource { - string name; - CORBA::StringSeq resourceType; - CORBA::ULongSeq nodeRef; - SatisfierProperties property; - }; - - typedef sequence < SharedResource > SharedResources; - - struct Node { - string name; - string label; - CORBA::ULongSeq sharedResourceRef; - CORBA::ULongSeq connectionRef; - Resources resource; - }; - - typedef sequence < Node > Nodes; - - struct Interconnect { - string name; - string label; - CORBA::ULongSeq connectionRef; - CORBA::ULongSeq connectRef; - Resources resource; - }; - - typedef sequence < Interconnect > Interconnects; - - struct Bridge { - string name; - string label; - CORBA::ULongSeq connectRef; - Resources resource; - }; - - typedef sequence < Bridge > Bridges; - - struct Domain { - string UUID; - string label; - SharedResources sharedResource; - Nodes node; - Interconnects interconnect; - Bridges bridge; - Properties infoProperty; - }; -}; - -#endif /* DEPLOYMENT_TARGETDATA_IDL */ diff --git a/DAnCE/dance/Deployment/Deployment_TargetManager.idl b/DAnCE/dance/Deployment/Deployment_TargetManager.idl deleted file mode 100644 index bb72ec6fa5a..00000000000 --- a/DAnCE/dance/Deployment/Deployment_TargetManager.idl +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef TARGETMANAGER_IDL -#define TARGETMANAGER_IDL - -#include "dance/Deployment/Deployment_TargetData.idl" -#include "dance/Deployment/Deployment_DeploymentPlan.idl" -#include "dance/Deployment/Deployment_ResourceCommitmentManager.idl" - -module Deployment { - enum DomainUpdateKind { - Add, - Delete, - UpdateAll, - UpdateDynamic - }; - - interface TargetManager { - Domain getAllResources (); - - Domain getAvailableResources (); - - ResourceCommitmentManager createResourceCommitment (in ResourceAllocations resources) - raises (ResourceCommitmentFailure); - - void destroyResourceCommitment (in ResourceCommitmentManager manager); - - void updateDomain ( in CORBA::StringSeq elements, - in Domain domainSubset, - in DomainUpdateKind updateKind); - }; -}; - -#endif /* TARGETMANAGER_IDL */ diff --git a/DAnCE/dance/DomainApplication/DomainApplication.mpc b/DAnCE/dance/DomainApplication/DomainApplication.mpc deleted file mode 100644 index ecb330d65e7..00000000000 --- a/DAnCE/dance/DomainApplication/DomainApplication.mpc +++ /dev/null @@ -1,16 +0,0 @@ -// -*- MPC -*- -project: install, dance_lib, dance_output, dance_domainapplication_skel, \ - dance_nodeapplicationmanager_stub, \ - dance_nodeapplicationmanager_skel, \ - dance_tools, dance_logger { - sharedname = DAnCE_DomainApplication - dynamicflags += DOMAIN_APPLICATION_BUILD_DLL - - Source_Files { - Domain_Application_Impl.cpp - } - - specific { - install_dir = dance/DomainApplication - } -} diff --git a/DAnCE/dance/DomainApplication/Domain_Application_Export.h b/DAnCE/dance/DomainApplication/Domain_Application_Export.h deleted file mode 100644 index cf2d5459e9e..00000000000 --- a/DAnCE/dance/DomainApplication/Domain_Application_Export.h +++ /dev/null @@ -1,57 +0,0 @@ - -// -*- C++ -*- -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl Domain_Application -// ------------------------------ -#ifndef DOMAIN_APPLICATION_EXPORT_H -#define DOMAIN_APPLICATION_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (DOMAIN_APPLICATION_HAS_DLL) -# define DOMAIN_APPLICATION_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && DOMAIN_APPLICATION_HAS_DLL */ - -#if !defined (DOMAIN_APPLICATION_HAS_DLL) -# define DOMAIN_APPLICATION_HAS_DLL 1 -#endif /* ! DOMAIN_APPLICATION_HAS_DLL */ - -#if defined (DOMAIN_APPLICATION_HAS_DLL) && (DOMAIN_APPLICATION_HAS_DLL == 1) -# if defined (DOMAIN_APPLICATION_BUILD_DLL) -# define Domain_Application_Export ACE_Proper_Export_Flag -# define DOMAIN_APPLICATION_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define DOMAIN_APPLICATION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* DOMAIN_APPLICATION_BUILD_DLL */ -# define Domain_Application_Export ACE_Proper_Import_Flag -# define DOMAIN_APPLICATION_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define DOMAIN_APPLICATION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* DOMAIN_APPLICATION_BUILD_DLL */ -#else /* DOMAIN_APPLICATION_HAS_DLL == 1 */ -# define Domain_Application_Export -# define DOMAIN_APPLICATION_SINGLETON_DECLARATION(T) -# define DOMAIN_APPLICATION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* DOMAIN_APPLICATION_HAS_DLL == 1 */ - -// Set DOMAIN_APPLICATION_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (DOMAIN_APPLICATION_NTRACE) -# if (ACE_NTRACE == 1) -# define DOMAIN_APPLICATION_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define DOMAIN_APPLICATION_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !DOMAIN_APPLICATION_NTRACE */ - -#if (DOMAIN_APPLICATION_NTRACE == 1) -# define DOMAIN_APPLICATION_TRACE(X) -#else /* (DOMAIN_APPLICATION_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define DOMAIN_APPLICATION_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (DOMAIN_APPLICATION_NTRACE == 1) */ - -#endif /* DOMAIN_APPLICATION_EXPORT_H */ - -// End of auto generated file. diff --git a/DAnCE/dance/DomainApplication/Domain_Application_Impl.cpp b/DAnCE/dance/DomainApplication/Domain_Application_Impl.cpp deleted file mode 100644 index 8ab09b797f1..00000000000 --- a/DAnCE/dance/DomainApplication/Domain_Application_Impl.cpp +++ /dev/null @@ -1,977 +0,0 @@ -#include "Domain_Application_Impl.h" -#include "dance/Logger/Log_Macros.h" -#include <sstream> - -namespace DAnCE -{ - DomainApplication_Impl::DomainApplication_Impl ( - const char* plan_uuid, - PortableServer::POA_ptr poa, - TNam2Nm & nams, - TNm2Id& node_ids) - : poa_ (PortableServer::POA::_duplicate (poa)), - planUUID_ (plan_uuid), - nams_ (nams), - node_ids_ (node_ids) - { - DANCE_TRACE("DomainApplication_Impl::DomainApplication_Impl"); - } - - DomainApplication_Impl::~DomainApplication_Impl() - { - DANCE_TRACE ("DomainApplication_Impl::~DomainApplication_Impl()"); - - this->node_applications_.unbind_all(); - } - - void - DomainApplication_Impl::finishLaunch (::Deployment::AMH_ApplicationResponseHandler_ptr _tao_rh, - const ::Deployment::Connections & connections, - CORBA::Boolean start) - { - DANCE_TRACE ("DomainApplication_Impl::finishLaunch"); - - try - { - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO ACE_TEXT("DomainApplication_impl::finishLaunch - ") - ACE_TEXT("Plan %C DomainApplication[%@] : %u applications to finish launching\n"), - this->planUUID_.c_str (), - this, - this->node_applications_.current_size ())); - - // create completion counter - DA_NA_ReplyHandlerImpl::Counter* _cp = 0; - ACE_NEW_THROW_EX (_cp, - DA_NA_ReplyHandlerImpl::Counter (node_applications_.current_size (), - this, - _tao_rh), - CORBA::NO_MEMORY ()); - DA_NA_ReplyHandlerImpl::Counter_AutoPtr _counter_ptr (_cp); - - for (TApp2Mgr::iterator iter = this->node_applications_.begin(); - iter != this->node_applications_.end(); - ++iter) - { - ACE_CString node_id; - this->app_node_ids_.find ((*iter).ext_id_, node_id); - try - { - // create and activate reply handler - DA_NA_ReplyHandlerImpl* da_na_rh_servant = 0; - ACE_NEW_THROW_EX (da_na_rh_servant, - DA_NA_ReplyHandlerImpl (this, - node_id.c_str (), - _counter_ptr), - CORBA::NO_MEMORY ()); - - PortableServer::ObjectId_var id = this->poa_->activate_object (da_na_rh_servant); - - CORBA::Object_var ref = this->poa_->id_to_reference (id.in()); - - ::Deployment::AMI_ApplicationHandler_var da_na_handler = - ::Deployment::AMI_ApplicationHandler::_narrow (ref.in ()); - - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_TRACE, DLINFO ACE_TEXT("DomainApplication_Impl::finishLaunch - ") - ACE_TEXT("Plan %C DomainApplication[%@] node %C : ") - ACE_TEXT("calling finishLaunch on a node application\n"), - this->planUUID_.c_str (), - this, - node_id.c_str ())); - - (*iter).ext_id_->sendc_finishLaunch (da_na_handler.in (), - connections, - start); - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO ACE_TEXT("DomainApplication_Impl::finishLaunch - ") - ACE_TEXT("finishLaunch has been called on a node application\n"))); - } - catch (const CORBA::Exception& ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplication_Impl::finishLaunch - ") - ACE_TEXT("DomainApplication[%@] caught a CORBA exception handling node %C : %C\n"), - this, - node_id.c_str (), - ex._info ().c_str ())); - std::ostringstream err; - err << node_id.c_str () - << " - CORBA exception starting finishLaunch : " - << ex._info ().c_str (); - // mark failure - _counter_ptr->increment_fail_count (err.str ().c_str ()); - // mark off node - _counter_ptr->decrement_exec_count (); - // continue for next node - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplication_Impl::finishLaunch - ") - ACE_TEXT("DomainApplication[%@] caught a unknown exception handling node %C\n"), - this, - node_id.c_str ())); - std::ostringstream err; - err << node_id.c_str () - << " - unknown exception starting finishLaunch"; - // mark failure - _counter_ptr->increment_fail_count (err.str ().c_str ()); - // mark off node - _counter_ptr->decrement_exec_count (); - // continue for next node - } - } - } - catch (const CORBA::Exception& ex) - { - CORBA::Exception* local_ex = ex._tao_duplicate (); - ::Deployment::AMH_ApplicationExceptionHolder amh_exholder (local_ex); - _tao_rh->finishLaunch_excep (&amh_exholder); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplication_Impl::finishLaunch - ") - ACE_TEXT("Propagating StartError for unknown exception caught here\n"))); - CORBA::Exception* start_ex = - new Deployment::StartError(this->planUUID_.c_str (), - "unknown exception in finishLaunch"); - ::Deployment::AMH_ApplicationExceptionHolder amh_exholder (start_ex); - _tao_rh->finishLaunch_excep (&amh_exholder); - } - } - - void - DomainApplication_Impl::start (::Deployment::AMH_ApplicationResponseHandler_ptr _tao_rh) - { - DANCE_TRACE ("DomainApplication_Impl::start"); - try - { - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO ACE_TEXT("DomainApplication_impl::start - ") - ACE_TEXT("Plan %C DomainApplication[%@] : %u applications to start\n"), - this->planUUID_.c_str (), - this, - this->node_applications_.current_size ())); - - // create completion counter - DA_NA_ReplyHandlerImpl::Counter* _cp = 0; - ACE_NEW_THROW_EX (_cp, - DA_NA_ReplyHandlerImpl::Counter (node_applications_.current_size (), - this, - _tao_rh), - CORBA::NO_MEMORY ()); - DA_NA_ReplyHandlerImpl::Counter_AutoPtr _counter_ptr (_cp); - - for (TApp2Mgr::iterator iter = this->node_applications_.begin(); - iter != this->node_applications_.end(); - ++iter) - { - ACE_CString node_id; - this->app_node_ids_.find ((*iter).ext_id_, node_id); - - try - { - // create and activate reply handler - DA_NA_ReplyHandlerImpl* da_na_rh_servant = 0; - ACE_NEW_THROW_EX (da_na_rh_servant, - DAnCE::DA_NA_ReplyHandlerImpl (this, - node_id.c_str (), - _counter_ptr), - CORBA::NO_MEMORY ()); - - PortableServer::ObjectId_var id = this->poa_->activate_object (da_na_rh_servant); - - CORBA::Object_var ref = this->poa_->id_to_reference (id.in()); - - ::Deployment::AMI_ApplicationHandler_var da_na_handler = - ::Deployment::AMI_ApplicationHandler::_narrow (ref.in ()); - - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_TRACE, DLINFO ACE_TEXT("DomainApplication_Impl::start - ") - ACE_TEXT("Plan %C DomainApplication[%@] node %C : ") - ACE_TEXT("calling start on a node application\n"), - this->planUUID_.c_str (), - this, - node_id.c_str ())); - - (*iter).ext_id_->sendc_start (da_na_handler.in ()); - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO ACE_TEXT("DomainApplication_Impl::start - ") - ACE_TEXT("start has been called on an application\n"))); - } - catch (const CORBA::Exception& ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplication_Impl::start - ") - ACE_TEXT("DomainApplication[%@] caught a CORBA exception handling node %C : %C\n"), - this, - node_id.c_str (), - ex._info ().c_str ())); - std::ostringstream err; - err << node_id.c_str () - << " - CORBA exception starting : " - << ex._info ().c_str (); - // mark failure - _counter_ptr->increment_fail_count (err.str ().c_str ()); - // mark off node - _counter_ptr->decrement_exec_count (); - // continue for next node - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplication_Impl::start - ") - ACE_TEXT("DomainApplication[%@] caught a unknown exception handling node %C\n"), - this, - node_id.c_str ())); - std::ostringstream err; - err << node_id.c_str () - << " - unknown exception starting"; - // mark failure - _counter_ptr->increment_fail_count (err.str ().c_str ()); - // mark off node - _counter_ptr->decrement_exec_count (); - // continue for next node - } - } - } - catch (const CORBA::Exception& ex) - { - CORBA::Exception* local_ex = ex._tao_duplicate (); - ::Deployment::AMH_ApplicationExceptionHolder amh_exholder (local_ex); - _tao_rh->start_excep (&amh_exholder); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplication_Impl::start - ") - ACE_TEXT("Propagating StartError for unknown exception caught here\n"))); - CORBA::Exception* start_ex = - new Deployment::StartError(this->planUUID_.c_str (), - "unknown exception in start"); - ::Deployment::AMH_ApplicationExceptionHolder amh_exholder (start_ex); - _tao_rh->start_excep (&amh_exholder); - } - } - - void - DomainApplication_Impl::startLaunch ( - const Deployment::Properties & configProperty, - DA_CompletionHandler* completion_handler) - { - DANCE_TRACE ("DomainApplication_Impl::startLaunch"); - - DA_CompletionHandler_AutoPtr _ch_ptr (completion_handler); // manage handler - - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_TRACE, DLINFO ACE_TEXT("DomainApplication_Impl::startLaunch - ") - ACE_TEXT("Plan %C DomainApplication[%@] : %u nodes to launch\n"), - this->planUUID_.c_str (), - this, - nams_.current_size ())); - - // create completion counter - DA_NAM_ReplyHandlerImpl::Counter* _cp = 0; - ACE_NEW_THROW_EX (_cp, - DA_NAM_ReplyHandlerImpl::Counter (nams_.current_size (), - this, - _ch_ptr), - CORBA::NO_MEMORY ()); - DA_NAM_ReplyHandlerImpl::Counter_AutoPtr _counter_ptr (_cp); - - for (TNam2Nm::iterator iter = this->nams_.begin(); - iter != this->nams_.end(); - ++iter) - { - ACE_CString node_id; - this->node_ids_.find ((*iter).int_id_, node_id); - - try - { - // create and activate reply handler - DA_NAM_ReplyHandlerImpl* da_nam_rh_servant = 0; - ACE_NEW_THROW_EX (da_nam_rh_servant, - DA_NAM_ReplyHandlerImpl (this, - (*iter).ext_id_, - node_id.c_str (), - _counter_ptr), - CORBA::NO_MEMORY ()); - - PortableServer::ObjectId_var id = this->poa_->activate_object (da_nam_rh_servant); - - CORBA::Object_var ref = this->poa_->id_to_reference (id.in()); - - ::Deployment::AMI_NodeApplicationManagerHandler_var da_nam_handler = - ::Deployment::AMI_NodeApplicationManagerHandler::_narrow (ref.in ()); - - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_TRACE, DLINFO ACE_TEXT("DomainApplication_Impl::startLaunch - ") - ACE_TEXT("Plan %C DomainApplication[%@] : ") - ACE_TEXT("calling startLaunch on node application manager for node %C\n"), - this->planUUID_.c_str (), - this, - node_id.c_str ())); - - (*iter).ext_id_->sendc_startLaunch (da_nam_handler.in (), - configProperty); - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO ACE_TEXT("DomainApplication_Impl::startLaunch - ") - ACE_TEXT("startLaunch has been called on an application\n"))); - } - catch (const CORBA::Exception& ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplication_Impl::startLaunch - ") - ACE_TEXT("DomainApplication[%@] caught a CORBA exception handling node %C : %C\n"), - this, - node_id.c_str (), - ex._info ().c_str ())); - std::ostringstream err; - err << node_id.c_str () - << " - CORBA exception starting startLaunch : " - << ex._info ().c_str (); - // mark failure - _counter_ptr->increment_fail_count (err.str ().c_str ()); - // mark off node - _counter_ptr->decrement_exec_count (); - // continue for next node - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplication_Impl::startLaunch - ") - ACE_TEXT("DomainApplication[%@] caught a unknown exception handling node %C\n"), - this, - node_id.c_str ())); - std::ostringstream err; - err << node_id.c_str () - << " - unknown exception starting startLaunch"; - // mark failure - _counter_ptr->increment_fail_count (err.str ().c_str ()); - // mark off node - _counter_ptr->decrement_exec_count (); - // continue for next node - } - } - } - - void - DomainApplication_Impl::destroyApplication ( - const DA_CompletionHandler_AutoPtr& _ch_ptr) - { - DANCE_TRACE ("DomainApplication_Impl::destroyApplication"); - - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_TRACE, DLINFO ACE_TEXT("DomainApplication_Impl::destroyApplication - ") - ACE_TEXT("Plan %C DomainApplication[%@] : %u node applications to destroy\n"), - this->planUUID_.c_str (), - this, - this->node_applications_.current_size ())); - - if (this->node_applications_.current_size () > 0) - { - // create completion counter - DA_NAM_ReplyHandlerImpl::Counter* _cp = 0; - ACE_NEW_THROW_EX (_cp, - DA_NAM_ReplyHandlerImpl::Counter (this->node_applications_.current_size (), - this, - _ch_ptr), - CORBA::NO_MEMORY ()); - DA_NAM_ReplyHandlerImpl::Counter_AutoPtr _counter_ptr (_cp); - - for (TApp2Mgr::iterator iter = this->node_applications_.begin(); - iter != this->node_applications_.end(); - ++iter) - { - ACE_CString node_id; - this->app_node_ids_.find ((*iter).ext_id_, node_id); - - try - { - // create and activate reply handler - DA_NAM_ReplyHandlerImpl* da_nam_rh_servant = 0; - ACE_NEW_THROW_EX (da_nam_rh_servant, - DAnCE::DA_NAM_ReplyHandlerImpl (this, - (*iter).int_id_, - node_id.c_str (), - _counter_ptr), - CORBA::NO_MEMORY ()); - - PortableServer::ObjectId_var id = this->poa_->activate_object (da_nam_rh_servant); - - CORBA::Object_var ref = this->poa_->id_to_reference (id.in()); - - ::Deployment::AMI_NodeApplicationManagerHandler_var da_nam_handler = - ::Deployment::AMI_NodeApplicationManagerHandler::_narrow (ref.in ()); - - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_TRACE, DLINFO ACE_TEXT("DomainApplication_Impl::destroyApplication - ") - ACE_TEXT("Plan %C DomainApplication[%@] : ") - ACE_TEXT("calling destroyApplication on node application manager for node %C\n"), - this->planUUID_.c_str (), - this, - node_id.c_str ())); - - (*iter).int_id_->sendc_destroyApplication (da_nam_handler.in (), - (*iter).ext_id_.in()); - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO ACE_TEXT("DomainApplication_Impl::destroyApplication - ") - ACE_TEXT("destroyApplication has been called on node application manager\n"))); - } - catch (const CORBA::Exception& ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplication_Impl::destroyApplication - ") - ACE_TEXT("DomainApplication[%@] caught a CORBA exception handling node %C : %C\n"), - this, - node_id.c_str (), - ex._info ().c_str ())); - std::ostringstream err; - err << this->planUUID_.c_str () - << " - CORBA exception starting destroyApplication on node " - << node_id.c_str () << " : " << ex._info ().c_str (); - // mark failure - _counter_ptr->increment_fail_count (err.str ().c_str ()); - // mark off node - _counter_ptr->decrement_exec_count (); - // continue for next node - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplication_Impl::destroyApplication - ") - ACE_TEXT("DomainApplication[%@] caught a unknown exception handling node %C\n"), - this, - node_id.c_str ())); - std::ostringstream err; - err << this->planUUID_.c_str () - << " - unknown exception starting destroyApplication on node " - << node_id.c_str (); - // mark failure - _counter_ptr->increment_fail_count (err.str ().c_str ()); - // mark off node - _counter_ptr->decrement_exec_count (); - // continue for next node - } - } - } - else - { - // no node applications to clean up so finish immediately - _ch_ptr->handle_completion (this); - } - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DomainApplication_Impl::destroyApplication - finished\n"))); - } - - void - DomainApplication_Impl::getConnections (Deployment::Connections& conn) - { - conn = this->connections_; - } - - const char* - DomainApplication_Impl::getPlanUUID (void) - { - return this->planUUID_.c_str (); - } - - DA_NAM_ReplyHandlerImpl::Counter::Counter ( - unsigned int exec_count, - DomainApplication_Impl* da_servant, - const DA_CompletionHandler_AutoPtr& dam_completion_handler) - : Completion_Counter_Base<ACE_Null_Mutex> (exec_count, 0), - da_servant_ (DomainApplication_Impl_var::_duplicate (da_servant)), - dam_ch_ptr_ (dam_completion_handler) - { - } - - void - DA_NAM_ReplyHandlerImpl::Counter::on_all_completed () - { - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT("DA_NAM_ReplyHandlerImpl::Counter::on_all_completed - ") - ACE_TEXT("Plan %C DomainApplication[%@] successfully finished all nodes\n"), - this->da_servant_->getPlanUUID (), - this->da_servant_.in ())); - - this->dam_ch_ptr_->handle_completion (da_servant_.in ()); - } - - void - DA_NAM_ReplyHandlerImpl::Counter::on_all_completed_with_failure () - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DA_NAM_ReplyHandlerImpl::Counter::on_all_completed_with_failure - ") - ACE_TEXT("Plan %C DomainApplication[%@] : %u errors from nodemanagers\n"), - this->da_servant_->getPlanUUID (), - this->da_servant_.in (), - this->fail_count ())); - - std::ostringstream err; - err << this->fail_count () << " errors from nodemanagers:\n"; - for (DA_NAM_ReplyHandlerImpl::Counter::errors_type::const_iterator it = this->errors ().begin (); - it != this->errors ().end (); - ++it) - { - err << "\t" << *it << "\n"; - } - this->dam_ch_ptr_->handle_exception ( - new Deployment::StartError(this->da_servant_->getPlanUUID (), - err.str ().c_str ())); - } - - DA_NAM_ReplyHandlerImpl::DA_NAM_ReplyHandlerImpl ( - DomainApplication_Impl* da_servant, - ::Deployment::NodeApplicationManager_ptr nam, - const char* node_id, - const Counter_AutoPtr& counter) - : da_servant_ (DomainApplication_Impl_var::_duplicate (da_servant)), - node_id_ (node_id), - nam_ (::Deployment::NodeApplicationManager::_duplicate (nam)), - counter_ (counter) - { - } - - void - DA_NAM_ReplyHandlerImpl::startLaunch ( - ::Deployment::Application_ptr na, - const ::Deployment::Connections & conn) - { - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DA_NAM_ReplyHandlerImpl::startLaunch called.\n"))); - - if (CORBA::is_nil (na)) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DA_NAM_ReplyHandlerImpl::startLaunch -") - ACE_TEXT("Plan %C DomainApplication[%@] node %C startLaunch returned nil object reference.\n"), - this->da_servant_->getPlanUUID (), - this->da_servant_.in (), - this->node_id_.c_str ())); - - std::ostringstream err; - err << this->node_id_.c_str () << " - startLaunch returned nil"; - this->counter_->increment_fail_count (err.str ().c_str ()); - } - else - { - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_TRACE, DLINFO - ACE_TEXT("DA_NAM_ReplyHandlerImpl::startLaunch - ") - ACE_TEXT("Plan %C DomainApplication[%@] node %C startLaunch succeeded, ") - ACE_TEXT("received %u connections\n"), - this->da_servant_->getPlanUUID (), - this->da_servant_.in (), - this->node_id_.c_str (), - conn.length ())); - - this->da_servant_->node_applications_.bind ( - ::Deployment::Application::_duplicate (na), - ::Deployment::NodeApplicationManager::_duplicate (this->nam_.in ())); - this->da_servant_->app_node_ids_.bind ( - ::Deployment::Application::_duplicate (na), - this->node_id_); - - CORBA::ULong const before = this->da_servant_->connections_.length(); - this->da_servant_->connections_.length (before + conn.length()); - for (CORBA::ULong i = 0; i < conn.length(); ++i) - { - this->da_servant_->connections_[before+i] = conn[i]; - } - } - - // mark off one node - this->counter_->decrement_exec_count (); - - // deactivate AMI response handler - PortableServer::ObjectId_var oid = this->da_servant_->poa_->servant_to_id (this); - this->da_servant_->poa_->deactivate_object (oid.in ()); - } - void - DA_NAM_ReplyHandlerImpl::startLaunch_excep ( - ::Messaging::ExceptionHolder * excep_holder) - { - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DA_NAM_ReplyHandlerImpl::startLaunch_excep called\n"))); - - std::ostringstream err; - err << this->node_id_.c_str () << " - startLaunch raised "; - try - { - excep_holder->raise_exception (); - } - catch (Deployment::StartError &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO - ACE_TEXT("DA_NAM_ReplyHandlerImpl::startLaunch_excep - ") - ACE_TEXT("Plan %C DomainApplication[%@] node %C : StartError exception caught.\n"), - this->da_servant_->getPlanUUID (), - this->da_servant_.in (), - this->node_id_.c_str ())); - err << "StartError : " << ex.name.in () << "." << ex.reason.in (); - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DA_NAM_ReplyHandlerImpl::startLaunch_excep - ") - ACE_TEXT("Plan %C DomainApplication[%@] node %C : Caught a CORBA exception: %C\n"), - this->da_servant_->getPlanUUID (), - this->da_servant_.in (), - this->node_id_.c_str (), - ex._info ().c_str ())); - err << "CORBA exception : " << ex._info ().c_str (); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DA_NAM_ReplyHandlerImpl::startLaunch_excep - ") - ACE_TEXT("Plan %C DomainApplication[%@] node %C : Caught unknown exception.\n"), - this->da_servant_->getPlanUUID (), - this->da_servant_.in (), - this->node_id_.c_str ())); - err << "unknown exception"; - } - - // add failure - this->counter_->increment_fail_count (err.str ().c_str ()); - - // mark off node - this->counter_->decrement_exec_count (); - - // deactivate AMI response handler - PortableServer::ObjectId_var oid = this->da_servant_->poa_->servant_to_id (this); - this->da_servant_->poa_->deactivate_object (oid.in ()); - } - - void - DA_NAM_ReplyHandlerImpl::destroyApplication (void) - { - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DA_NAM_ReplyHandlerImpl::destroyApplication called.\n"))); - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_TRACE, DLINFO - ACE_TEXT("DA_NAM_ReplyHandlerImpl::destroyApplication - ") - ACE_TEXT("Plan %C DomainApplication[%@] node %C : Node application destroy succeeded\n"), - this->da_servant_->getPlanUUID (), - this->da_servant_.in (), - this->node_id_.c_str ())); - - // mark off one application - this->counter_->decrement_exec_count (); - - // deactivate AMI response handler - PortableServer::ObjectId_var oid = this->da_servant_->poa_->servant_to_id (this); - this->da_servant_->poa_->deactivate_object (oid.in ()); - } - void - DA_NAM_ReplyHandlerImpl::destroyApplication_excep ( - ::Messaging::ExceptionHolder * excep_holder) - { - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DA_NAM_ReplyHandlerImpl::destroyApplication_excep called\n"))); - - std::ostringstream err; - err << this->node_id_.c_str () << " - destroyApplication raised "; - try - { - excep_holder->raise_exception (); - } - catch (Deployment::StopError &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DA_NAM_ReplyHandlerImpl::destroyApplication_excep - ") - ACE_TEXT("Plan %C DomainApplication[%@] node %C : StopError exception caught.\n"), - this->da_servant_->planUUID_.c_str (), - this->da_servant_.in (), - this->node_id_.c_str ())); - err << "StopError : " << ex.name.in () << "." << ex.reason.in (); - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DA_NAM_ReplyHandlerImpl::destroyApplication_excep - ") - ACE_TEXT("Plan %C DomainApplication[%@] node %C : Caught a CORBA exception: %C\n"), - this->da_servant_->planUUID_.c_str (), - this->da_servant_.in (), - this->node_id_.c_str (), - ex._info ().c_str ())); - err << "CORBA exception : " << ex._info ().c_str (); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DA_NAM_ReplyHandlerImpl::destroyApplication_excep - ") - ACE_TEXT("Plan %C DomainApplication[%@] node %C : Caught unknown exception.\n"), - this->da_servant_->planUUID_.c_str (), - this->da_servant_.in (), - this->node_id_.c_str ())); - err << "unknown exception"; - } - - // add failure - this->counter_->increment_fail_count (err.str ().c_str ()); - - // mark off application - this->counter_->decrement_exec_count (); - - // deactivate AMI response handler - PortableServer::ObjectId_var oid = this->da_servant_->poa_->servant_to_id (this); - this->da_servant_->poa_->deactivate_object (oid.in ()); - } - - DA_NA_ReplyHandlerImpl::Counter::Counter ( - unsigned int exec_count, - DomainApplication_Impl* da_servant, - ::Deployment::AMH_ApplicationResponseHandler_ptr _tao_rh) - : Completion_Counter_Base<ACE_Null_Mutex> (exec_count, 0), - da_servant_ (DomainApplication_Impl_var::_duplicate (da_servant)), - da_rh_ (::Deployment::AMH_ApplicationResponseHandler::_duplicate (_tao_rh)) - { - } - - void - DA_NA_ReplyHandlerImpl::Counter::on_all_completed () - { - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT("DA_NA_ReplyHandlerImpl::finishLaunch - ") - ACE_TEXT("Plan %C DomainApplication[%@] : Successfully finished all nodes\n"), - this->da_servant_->getPlanUUID (), - this->da_servant_.in ())); - - this->da_rh_->finishLaunch (); - } - - void - DA_NA_ReplyHandlerImpl::Counter::on_all_completed_with_failure () - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DA_NA_ReplyHandlerImpl::Counter::on_all_completed_with_failure - ") - ACE_TEXT("Plan %C DomainApplication[%@] : %u errors from node applications\n"), - this->da_servant_->getPlanUUID (), - this->da_servant_.in (), - this->fail_count ())); - - std::ostringstream err; - err << this->fail_count () << " errors from node applications:\n"; - for (DA_NA_ReplyHandlerImpl::Counter::errors_type::const_iterator it = this->errors ().begin (); - it != this->errors ().end (); - ++it) - { - err << "\t" << *it << "\n"; - } - CORBA::Exception* start_ex = - new Deployment::StartError(this->da_servant_->getPlanUUID (), - err.str ().c_str ()); - ::Deployment::AMH_ApplicationExceptionHolder amh_exholder (start_ex); - this->da_rh_->finishLaunch_excep (&amh_exholder); - } - - DA_NA_ReplyHandlerImpl::DA_NA_ReplyHandlerImpl ( - DomainApplication_Impl* da_servant, - const char* node_id, - const Counter_AutoPtr& counter) - : da_servant_ (DomainApplication_Impl_var::_duplicate (da_servant)), - node_id_ (node_id), - counter_ (counter) - { - } - - void DA_NA_ReplyHandlerImpl::finishLaunch () - { - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO ACE_TEXT("DA_NA_ReplyHandlerImpl::finishLaunch - ") - ACE_TEXT("Plan %C DomainApplication[%@] node %C.\n"), - this->da_servant_->planUUID_.c_str (), - this->da_servant_.in (), - this->node_id_.c_str ())); - - // mark off one node - this->counter_->decrement_exec_count (); - - // deactivate AMI response handler - PortableServer::ObjectId_var oid = this->da_servant_->poa_->servant_to_id (this); - this->da_servant_->poa_->deactivate_object (oid.in ()); - } - - void DA_NA_ReplyHandlerImpl::finishLaunch_excep ( - ::Messaging::ExceptionHolder * excep_holder) - { - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DA_NA_ReplyHandlerImpl::finishLaunch_excep called\n"))); - - std::ostringstream err; - err << this->node_id_.c_str () << " - finishLaunch raised "; - try - { - excep_holder->raise_exception (); - } - catch (Deployment::StartError &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DA_NA_ReplyHandlerImpl::finishLaunch_excep - ") - ACE_TEXT("Plan %C DomainApplication[%@] node %C : StartError exception caught.\n"), - this->da_servant_->planUUID_.c_str (), - this->da_servant_.in (), - this->node_id_.c_str ())); - err << "StartError : " << ex.name.in () << "." << ex.reason.in (); - } - catch (Deployment::InvalidConnection &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DA_NA_ReplyHandlerImpl::finishLaunch_excep - ") - ACE_TEXT("Plan %C DomainApplication[%@] node %C : InvalidConnection exception caught.\n"), - this->da_servant_->planUUID_.c_str (), - this->da_servant_.in (), - this->node_id_.c_str ())); - err << "InvalidConnection : " << ex.name.in () << "." << ex.reason.in (); - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DA_NA_ReplyHandlerImpl::finishLaunch_excep - ") - ACE_TEXT("Plan %C DomainApplication[%@] node %C : Caught a CORBA exception: %C\n"), - this->da_servant_->planUUID_.c_str (), - this->da_servant_.in (), - this->node_id_.c_str (), - ex._info ().c_str ())); - err << "CORBA exception : " << ex._info ().c_str (); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DA_NA_ReplyHandlerImpl::finishLaunch_excep - ") - ACE_TEXT("Plan %C DomainApplication[%@] node %C : Caught unknown exception.\n"), - this->da_servant_->planUUID_.c_str (), - this->da_servant_.in (), - this->node_id_.c_str ())); - err << "unknown exception"; - } - - // add failure - this->counter_->increment_fail_count (err.str ().c_str ()); - - // mark off node - this->counter_->decrement_exec_count (); - - // deactivate AMI response handler - PortableServer::ObjectId_var oid = this->da_servant_->poa_->servant_to_id (this); - this->da_servant_->poa_->deactivate_object (oid.in ()); - } - - void DA_NA_ReplyHandlerImpl::start (void) - { - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_TRACE, DLINFO ACE_TEXT("DA_NA_ReplyHandlerImpl::start - ") - ACE_TEXT("Plan %C DomainApplication[%@] node %C.\n"), - this->da_servant_->planUUID_.c_str (), - this->da_servant_.in (), - this->node_id_.c_str ())); - - // mark off one node - this->counter_->decrement_exec_count (); - - // deactivate AMI response handler - PortableServer::ObjectId_var oid = this->da_servant_->poa_->servant_to_id (this); - this->da_servant_->poa_->deactivate_object (oid.in ()); - } - - void DA_NA_ReplyHandlerImpl::start_excep ( - ::Messaging::ExceptionHolder * excep_holder) - { - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DA_NA_ReplyHandlerImpl::start_excep called\n"))); - - std::ostringstream err; - err << this->node_id_.c_str () << " - start raised "; - try - { - excep_holder->raise_exception (); - } - catch (Deployment::StartError &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DA_NA_ReplyHandlerImpl::start_excep - ") - ACE_TEXT("Plan %C DomainApplication[%@] node %C : StartError exception caught.\n"), - this->da_servant_->planUUID_.c_str (), - this->da_servant_.in (), - this->node_id_.c_str ())); - err << "StartError : " << ex.name.in () << "." << ex.reason.in (); - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DA_NA_ReplyHandlerImpl::start_excep - ") - ACE_TEXT("Plan %C DomainApplication[%@] node %C : Caught a CORBA exception: %C\n"), - this->da_servant_->planUUID_.c_str (), - this->da_servant_.in (), - this->node_id_.c_str (), - ex._info ().c_str ())); - err << "CORBA exception : " << ex._info ().c_str (); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DA_NA_ReplyHandlerImpl::start_excep - ") - ACE_TEXT("Plan %C DomainApplication[%@] node %C : Caught unknown exception.\n"), - this->da_servant_->planUUID_.c_str (), - this->da_servant_.in (), - this->node_id_.c_str ())); - err << "unknown exception"; - } - - // add failure - this->counter_->increment_fail_count (err.str ().c_str ()); - - // mark off node - this->counter_->decrement_exec_count (); - - // deactivate AMI response handler - PortableServer::ObjectId_var oid = this->da_servant_->poa_->servant_to_id (this); - this->da_servant_->poa_->deactivate_object (oid.in ()); - } - -} // DAnCE - diff --git a/DAnCE/dance/DomainApplication/Domain_Application_Impl.h b/DAnCE/dance/DomainApplication/Domain_Application_Impl.h deleted file mode 100644 index 8938c89724c..00000000000 --- a/DAnCE/dance/DomainApplication/Domain_Application_Impl.h +++ /dev/null @@ -1,202 +0,0 @@ -/**======================================================== - * - * @file Domain_Application_Impl.h - * - * @brief This file contains the implementation of - * the DomainApplication interface. - * - * @author Vinzenz Tornow <vt@prismtech.com> - *========================================================*/ - -#ifndef DOMAIN_APPLICATION_H -#define DOMAIN_APPLICATION_H -#include /**/ "ace/pre.h" - -#include "Domain_Application_Export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "dance/Deployment/Deployment_DomainApplicationS.h" -#include "dance/Deployment/Deployment_NodeApplicationManagerC.h" -#include "dance/Deployment/Deployment_NodeApplicationManagerS.h" -#include "dance/Deployment/Deployment_NodeManagerC.h" -#include "Completion/CompletionHandler_T.h" -#include "Completion/Completion_Counter_Base.h" -#include "ace/Map_Manager.h" -#include "ace/Refcounted_Auto_Ptr.h" - -namespace DAnCE - { - class DomainApplication_Impl; - - typedef CompletionHandler<DomainApplication_Impl> DA_CompletionHandler; - - typedef ACE_Refcounted_Auto_Ptr<DA_CompletionHandler, ACE_Null_Mutex> DA_CompletionHandler_AutoPtr; - - typedef PortableServer::Servant_var<DomainApplication_Impl> DomainApplication_Impl_var; - - class DA_NAM_ReplyHandlerImpl; - class DA_NA_ReplyHandlerImpl; - - /** - * @class DomainApplication_Impl - * - * @brief This class implements the DomainApplication interface. - **/ - class Domain_Application_Export DomainApplication_Impl - : public virtual POA_Deployment::AMH_DomainApplication - { - public: - typedef ACE_Map_Manager < ::Deployment::NodeApplicationManager_var, - ::Deployment::NodeManager_var, - ACE_Null_Mutex > TNam2Nm; - typedef ACE_Map_Manager< - ::Deployment::NodeManager_var, - ACE_CString, - ACE_Null_Mutex> TNm2Id; - typedef ACE_Map_Manager < ::Deployment::Application_var, - ::Deployment::NodeApplicationManager_var, - ACE_Null_Mutex > TApp2Mgr; - typedef ACE_Map_Manager < ::Deployment::Application_var, - ACE_CString, - ACE_Null_Mutex > TApp2Id; - - DomainApplication_Impl (const char* plan_uuid, - PortableServer::POA_ptr poa, - TNam2Nm& nams, - TNm2Id& node_ids); - - virtual ~DomainApplication_Impl(); - - void startLaunch (const ::Deployment::Properties & configProperty, - DA_CompletionHandler* dam_handler); - - void destroyApplication (const DA_CompletionHandler_AutoPtr& _ch_ptr); - - void getConnections (::Deployment::Connections& conn); - - const char* getPlanUUID (void); - - /** - * The second step in launching an application in the - * domain-level. If the start parameter is true, the application - * is started as well. Raises the StartError exception if - * launching or starting the application fails. - */ - virtual void - finishLaunch (::Deployment::AMH_ApplicationResponseHandler_ptr _tao_rh, - const ::Deployment::Connections & connections, - CORBA::Boolean start); - /** - * Starts the application. Raises the StartError exception if - * starting the application fails. - */ - virtual void start (::Deployment::AMH_ApplicationResponseHandler_ptr _tao_rh); - - private: - friend class DA_NAM_ReplyHandlerImpl; - friend class DA_NA_ReplyHandlerImpl; - - PortableServer::POA_var poa_; - ACE_CString planUUID_; - TApp2Mgr node_applications_; - TApp2Id app_node_ids_; - ::Deployment::Connections connections_; - TNam2Nm & nams_; - TNm2Id & node_ids_; - }; - - class DA_NAM_ReplyHandlerImpl - : public POA_Deployment::AMI_NodeApplicationManagerHandler - { - public: - class Counter - : public Completion_Counter_Base<ACE_Null_Mutex> - { - public: - Counter (unsigned int exec_count, - DomainApplication_Impl* da_servant, - const DA_CompletionHandler_AutoPtr& dam_completion_handler); - - protected: - virtual void on_all_completed (); - virtual void on_all_completed_with_failure (); - - private: - DomainApplication_Impl_var da_servant_; - DA_CompletionHandler_AutoPtr dam_ch_ptr_; - }; - - typedef ACE_Refcounted_Auto_Ptr<Counter, ACE_Null_Mutex> Counter_AutoPtr; - - DA_NAM_ReplyHandlerImpl (DomainApplication_Impl* da_servant, - ::Deployment::NodeApplicationManager_ptr nam, - const char* node_id, - const Counter_AutoPtr& counter); - - virtual void startLaunch ( - ::Deployment::Application_ptr ami_return_val, - const ::Deployment::Connections & providedReference); - virtual void startLaunch_excep ( - ::Messaging::ExceptionHolder * excep_holder); - - virtual void destroyApplication (void); - virtual void destroyApplication_excep ( - ::Messaging::ExceptionHolder * excep_holder); - - private: - DomainApplication_Impl_var da_servant_; - ACE_CString node_id_; - ::Deployment::NodeApplicationManager_var nam_; - Counter_AutoPtr counter_; - }; - - class DA_NA_ReplyHandlerImpl - : public POA_Deployment::AMI_ApplicationHandler - { - public: - class Counter - : public Completion_Counter_Base<ACE_Null_Mutex> - { - public: - Counter (unsigned int exec_count, - DomainApplication_Impl* da_servant, - ::Deployment::AMH_ApplicationResponseHandler_ptr _tao_rh); - - protected: - virtual void on_all_completed (); - virtual void on_all_completed_with_failure (); - - private: - DomainApplication_Impl_var da_servant_; - ::Deployment::AMH_ApplicationResponseHandler_var da_rh_; - }; - - typedef ACE_Refcounted_Auto_Ptr<Counter, ACE_Null_Mutex> Counter_AutoPtr; - - DA_NA_ReplyHandlerImpl (DomainApplication_Impl* da_servant, - const char* node_id, - const Counter_AutoPtr& counter); - - virtual void finishLaunch (); - virtual void finishLaunch_excep ( - ::Messaging::ExceptionHolder * excep_holder); - - virtual void start (void); - virtual void start_excep ( - ::Messaging::ExceptionHolder * excep_holder); - - private: - DomainApplication_Impl_var da_servant_; - ACE_CString node_id_; - Counter_AutoPtr counter_; - }; - -} // DAnCE - -#include /**/ "ace/post.h" -#endif // DOMAIN_APPLICATION_H - - diff --git a/DAnCE/dance/DomainApplicationManager/DomainApplicationManager.mpc b/DAnCE/dance/DomainApplicationManager/DomainApplicationManager.mpc deleted file mode 100644 index 229c1ba1589..00000000000 --- a/DAnCE/dance/DomainApplicationManager/DomainApplicationManager.mpc +++ /dev/null @@ -1,23 +0,0 @@ -// -*- MPC -*- -project : install, dance_lib, dance_output, dance_domainapplicationmanager_skel, \ - dance_domainapplication, dance_nodemanager_stub, \ - dance_nodemanager_skel, naming, \ - dance_split_plan, dance_tools, dance_config_handlers { - sharedname = DAnCE_DomainApplicationManager - dynamicflags += DOMAINAPPLICATIONMANAGER_BUILD_DLL - - Source_Files { - DomainApplicationManager_Impl.cpp - Node_Locator.cpp - } - - Header_Files { - Node_Locator.h - DomainApplicationManager_Impl.h - DomainApplicationManager_Export.h - } - - specific { - install_dir = dance/DomainApplicationManager - } -} diff --git a/DAnCE/dance/DomainApplicationManager/DomainApplicationManager_Export.h b/DAnCE/dance/DomainApplicationManager/DomainApplicationManager_Export.h deleted file mode 100644 index 52b54c2f96c..00000000000 --- a/DAnCE/dance/DomainApplicationManager/DomainApplicationManager_Export.h +++ /dev/null @@ -1,57 +0,0 @@ - -// -*- C++ -*- -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl -s DomainApplicationManager -// ------------------------------ -#ifndef DOMAINAPPLICATIONMANAGER_EXPORT_H -#define DOMAINAPPLICATIONMANAGER_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (DOMAINAPPLICATIONMANAGER_HAS_DLL) -# define DOMAINAPPLICATIONMANAGER_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && DOMAINAPPLICATIONMANAGER_HAS_DLL */ - -#if !defined (DOMAINAPPLICATIONMANAGER_HAS_DLL) -# define DOMAINAPPLICATIONMANAGER_HAS_DLL 1 -#endif /* ! DOMAINAPPLICATIONMANAGER_HAS_DLL */ - -#if defined (DOMAINAPPLICATIONMANAGER_HAS_DLL) && (DOMAINAPPLICATIONMANAGER_HAS_DLL == 1) -# if defined (DOMAINAPPLICATIONMANAGER_BUILD_DLL) -# define DomainApplicationManager_Export ACE_Proper_Export_Flag -# define DOMAINAPPLICATIONMANAGER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define DOMAINAPPLICATIONMANAGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* DOMAINAPPLICATIONMANAGER_BUILD_DLL */ -# define DomainApplicationManager_Export ACE_Proper_Import_Flag -# define DOMAINAPPLICATIONMANAGER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define DOMAINAPPLICATIONMANAGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* DOMAINAPPLICATIONMANAGER_BUILD_DLL */ -#else /* DOMAINAPPLICATIONMANAGER_HAS_DLL == 1 */ -# define DomainApplicationManager_Export -# define DOMAINAPPLICATIONMANAGER_SINGLETON_DECLARATION(T) -# define DOMAINAPPLICATIONMANAGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* DOMAINAPPLICATIONMANAGER_HAS_DLL == 1 */ - -// Set DOMAINAPPLICATIONMANAGER_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (DOMAINAPPLICATIONMANAGER_NTRACE) -# if (ACE_NTRACE == 1) -# define DOMAINAPPLICATIONMANAGER_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define DOMAINAPPLICATIONMANAGER_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !DOMAINAPPLICATIONMANAGER_NTRACE */ - -#if (DOMAINAPPLICATIONMANAGER_NTRACE == 1) -# define DOMAINAPPLICATIONMANAGER_TRACE(X) -#else /* (DOMAINAPPLICATIONMANAGER_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define DOMAINAPPLICATIONMANAGER_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (DOMAINAPPLICATIONMANAGER_NTRACE == 1) */ - -#endif /* DOMAINAPPLICATIONMANAGER_EXPORT_H */ - -// End of auto generated file. diff --git a/DAnCE/dance/DomainApplicationManager/DomainApplicationManager_Impl.cpp b/DAnCE/dance/DomainApplicationManager/DomainApplicationManager_Impl.cpp deleted file mode 100644 index c3e18907d9f..00000000000 --- a/DAnCE/dance/DomainApplicationManager/DomainApplicationManager_Impl.cpp +++ /dev/null @@ -1,1194 +0,0 @@ -#include "DomainApplicationManager_Impl.h" -#include "dance/Deployment/Deployment_ConnectionC.h" -#include "dance/Logger/Log_Macros.h" -#include "Split_Plan/Split_Plan.h" -#include "Split_Plan/Node_Splitter.h" -#include <sstream> - -using namespace DAnCE; - -DomainApplicationManager_Impl::DomainApplicationManager_Impl ( - CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - const Deployment::DeploymentPlan& plan, - Node_Locator & nodes) - : orb_ (CORBA::ORB::_duplicate (orb)) - , poa_ (PortableServer::POA::_duplicate (poa)) - , plan_ (plan) - , nodes_ (nodes) -{ - DANCE_TRACE( "DomainApplicationManager_Impl::DomainApplicationManager_Impl"); -} - -DomainApplicationManager_Impl::~DomainApplicationManager_Impl() -{ - DANCE_TRACE( "DomainApplicationManager_Impl::~DomainApplicationManager_Impl()"); - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::~DomainApplicationManager_Impl - ") - ACE_TEXT("Deleting %u applications for plan %C\n"), - this->running_app_.size(), - this->getPlanUUID ())); - while (0 < this->running_app_.size()) - { - DomainApplication_Impl* p = this->running_app_[this->running_app_.size()-1]; - Deployment::DomainApplication_var app = - Deployment::DomainApplication::_narrow (this->poa_->servant_to_reference (p)); - PortableServer::ObjectId_var id = this->poa_->reference_to_id (app); - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_TRACE, DLINFO ACE_TEXT("DomainApplicationManager_impl::~DomainApplicationManager_impl - ") - ACE_TEXT("deactivating DomainApplication[%@] object...\n"), - p)); - this->poa_->deactivate_object (id); - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT("DomainApplicationManager_impl::~DomainApplicationManager_impl - ") - ACE_TEXT("deleting DomainApplication.\n"))); - this->running_app_.pop_back(); - delete p; - } - - this->sub_app_mgr_.unbind_all(); - this->node_ids_.unbind_all (); -} - -void -DomainApplicationManager_Impl::startLaunch ( - ::Deployment::AMH_ApplicationManagerResponseHandler_ptr _tao_rh, - const ::Deployment::Properties & configProperty) -{ - DANCE_TRACE("DomainApplicationManager_Impl::startLaunch"); - - try - { - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_TRACE, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::startLaunch - ") - ACE_TEXT("Creating DomainApplication for plan %C\n"), - this->getPlanUUID ())); - - DomainApplication_Impl* app = 0; - ACE_NEW_THROW_EX (app, - DomainApplication_Impl (this->getPlanUUID (), - this->poa_.in (), - this->sub_app_mgr_, - this->node_ids_), - CORBA::NO_MEMORY()); - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::startLaunch - ") - ACE_TEXT("Successfully created DomainApplication for plan %C\n"), - this->getPlanUUID ())); - - StartLaunchCompletionHandler* slch = 0; - ACE_NEW_THROW_EX (slch, - StartLaunchCompletionHandler (this, - _tao_rh), - CORBA::NO_MEMORY ()); - - app->startLaunch (configProperty, slch); - - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_TRACE, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::startLaunch - ") - ACE_TEXT("DomainApplication startLaunch has been called\n"))); - } - catch (const CORBA::Exception& ex) - { - CORBA::Exception* local_ex = ex._tao_duplicate (); - ::Deployment::AMH_ApplicationManagerExceptionHolder amh_exholder (local_ex); - _tao_rh->startLaunch_excep (&amh_exholder); - } - catch (...) - { - CORBA::Exception* start_ex = new Deployment::StartError (this->getPlanUUID (), - "unknown exception"); - ::Deployment::AMH_ApplicationManagerExceptionHolder amh_exholder (start_ex); - _tao_rh->startLaunch_excep (&amh_exholder); - } -} - -void -DomainApplicationManager_Impl::finish_startLaunch ( - ::Deployment::AMH_ApplicationManagerResponseHandler_ptr _tao_rh, - DomainApplication_Impl *da_servant, - const ::Deployment::Connections & providedReference) -{ - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_NOTICE, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::finish_startLaunch - ") - ACE_TEXT("DomainApplication[%u] for plan %C created %u provided references.\n"), - this->running_app_.size (), - this->getPlanUUID (), - providedReference.length ())); - - PortableServer::ObjectId_var id = this->poa_->activate_object (da_servant); - this->running_app_.push_back(da_servant); - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::finish_startLaunch - ") - ACE_TEXT("DomainApplication was successfully activated.\n"))); - - CORBA::Object_var ref = this->poa_->id_to_reference (id.in()); - _tao_rh->startLaunch (Deployment::DomainApplication::_narrow (ref.in ()), providedReference); -} - -void -DomainApplicationManager_Impl::fail_startLaunch ( - ::Deployment::AMH_ApplicationManagerResponseHandler_ptr _tao_rh, - CORBA::Exception* local_ex) -{ - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_NOTICE, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::fail_startLaunch for plan %C called\n"), - this->getPlanUUID ())); - - ::Deployment::AMH_ApplicationManagerExceptionHolder amh_exholder (local_ex); - _tao_rh->startLaunch_excep (&amh_exholder); -} - -void -DomainApplicationManager_Impl::destroyApplication ( - ::Deployment::AMH_ApplicationManagerResponseHandler_ptr _tao_rh, - ::Deployment::Application_ptr application) -{ - DANCE_TRACE ( "DomainApplicationManager_Impl::destroyApplication"); - - try - { - for (TApplications::size_type i = 0; i < this->running_app_.size(); ++i) - { - DomainApplication_Impl* p = this->running_app_[i]; - Deployment::DomainApplication_var app = - Deployment::DomainApplication::_narrow (this->poa_->servant_to_reference (p)); - if (application->_is_equivalent (app.in())) - { - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_TRACE, DLINFO - ACE_TEXT("DomainApplicationManager_impl::destroyApplication - ") - ACE_TEXT("destroying DomainApplication[%u] for plan %C\n"), - i, - this->getPlanUUID ())); - - // create completion handler - DestroyApplicationCompletionHandler* dach_ptr = 0; - ACE_NEW_THROW_EX (dach_ptr, - DestroyApplicationCompletionHandler (this, - _tao_rh, - p), - CORBA::NO_MEMORY ()); - DA_CompletionHandler_AutoPtr dach (dach_ptr); - - // deactivate servant - PortableServer::ObjectId_var id = this->poa_->reference_to_id (application); - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DomainApplicationManager_impl::destroyApplication - ") - ACE_TEXT("deactivating application object\n"))); - this->poa_->deactivate_object (id); - // remove registration - for (TApplications::size_type j = i + 1; j < this->running_app_.size(); ++j) - { - this->running_app_[j-1] = this->running_app_[j]; - } - this->running_app_.pop_back(); - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DomainApplicationManager_impl::destroyApplication - ") - ACE_TEXT("deleting application object\n"))); - - // remove default ref so servant will be deleted when - // var in DestroyApplicationCompletionHandler gets destructed - // at the finish of DomainApplication_Impl::destroyApplication - p->_remove_ref (); - - // destruct - p->destroyApplication (dach); - - return; - } - } - } - catch (const CORBA::Exception& ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplicationManager_impl::destroyApplication - ") - ACE_TEXT("Propagating StopError for CORBA exception caught here: %C\n"), - ex._info ().c_str ())); - CORBA::Exception* local_ex = new Deployment::StopError(this->getPlanUUID (), - ex._info ().c_str ()); - ::Deployment::AMH_ApplicationManagerExceptionHolder amh_exholder (local_ex); - _tao_rh->destroyApplication_excep (&amh_exholder); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplicationManager_impl::destroyApplication - ") - ACE_TEXT("Propagating StopError for unknown exception caught here\n"))); - CORBA::Exception* stop_ex = new Deployment::StopError(this->getPlanUUID (), - "unknown exception"); - ::Deployment::AMH_ApplicationManagerExceptionHolder amh_exholder (stop_ex); - _tao_rh->destroyApplication_excep (&amh_exholder); - } - - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplicationManager_impl::destroyApplication - ") - ACE_TEXT("Provided application reference unknown\n"))); - CORBA::Exception* stop_ex = new Deployment::StopError(this->getPlanUUID (), - "domain application reference unknown"); - ::Deployment::AMH_ApplicationManagerExceptionHolder amh_exholder (stop_ex); - _tao_rh->destroyApplication_excep (&amh_exholder); -} - -void -DomainApplicationManager_Impl::getApplications ( - ::Deployment::AMH_DomainApplicationManagerResponseHandler_ptr _tao_rh) -{ - DANCE_TRACE ("DomainApplicationManager_Impl::getApplications ()"); - - try - { - Deployment::Applications* running_app_ptr = 0; - ACE_NEW_THROW_EX (running_app_ptr, - Deployment::Applications(), - CORBA::NO_MEMORY()); - Deployment::Applications_var running_app (running_app_ptr); - running_app->length (this->running_app_.size()); - CORBA::ULong index = 0; - for (TApplications::size_type i = 0; i < this->running_app_.size(); ++i) - { - CORBA::Object_var ref = this->poa_->servant_to_reference (this->running_app_[i]); - (*running_app) [index++] = - Deployment::DomainApplication::_narrow (ref.in ()); - } - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_DEBUG, DLINFO ACE_TEXT("DomainApplicationManager_impl::getApplications - ") - ACE_TEXT("Returning %u running applications for plan %C\n"), - running_app->length (), - this->getPlanUUID ())); - _tao_rh->getApplications (running_app); - return; - } - catch (const CORBA::Exception& ex) - { - CORBA::Exception* local_ex = ex._tao_duplicate (); - ::Deployment::AMH_DomainApplicationManagerExceptionHolder amh_exholder (local_ex); - _tao_rh->getApplications_excep (&amh_exholder); - } - catch (...) - { - CORBA::Exception* unknown_ex = new CORBA::UNKNOWN; - ::Deployment::AMH_DomainApplicationManagerExceptionHolder amh_exholder (unknown_ex); - _tao_rh->getApplications_excep (&amh_exholder); - } -} - -void -DomainApplicationManager_Impl::getPlan ( - ::Deployment::AMH_DomainApplicationManagerResponseHandler_ptr _tao_rh) -{ - DANCE_TRACE ("DomainApplicationManager_Impl::getPlan ()"); - - try - { - Deployment::DeploymentPlan* plan_ptr = 0; - ACE_NEW_THROW_EX (plan_ptr, - Deployment::DeploymentPlan (this->plan_), - CORBA::NO_MEMORY()); - Deployment::DeploymentPlan_var plan (plan_ptr); - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT("DomainApplicationManager_impl::getApplications - ") - ACE_TEXT("Returning plan %C\n"), - this->getPlanUUID ())); - - _tao_rh->getPlan (plan); - return; - } - catch (const CORBA::Exception& ex) - { - CORBA::Exception* local_ex = ex._tao_duplicate (); - ::Deployment::AMH_DomainApplicationManagerExceptionHolder amh_exholder (local_ex); - _tao_rh->getApplications_excep (&amh_exholder); - } - catch (...) - { - CORBA::Exception* unknown_ex = new CORBA::UNKNOWN; - ::Deployment::AMH_DomainApplicationManagerExceptionHolder amh_exholder (unknown_ex); - _tao_rh->getApplications_excep (&amh_exholder); - } -} - -const char* -DomainApplicationManager_Impl::getPlanUUID (void) -{ - return this->plan_.UUID.in (); -} - -void -DomainApplicationManager_Impl::preparePlan(DAM_CompletionHandler* completion_handler) -{ - DANCE_TRACE ("DomainApplicationManager_Impl::preparePlan()"); - - DAM_CompletionHandler_AutoPtr _ch_ptr (completion_handler); // manage handler - - try - { - // Map of sub plans for each node - Split_Plan<Node_Splitter> split_plan; - split_plan.split_plan (this->plan_); - Split_Plan<Node_Splitter>::TSubPlans &sub_plans = split_plan.plans (); - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_TRACE, DLINFO ACE_TEXT("DomainApplicationManager_Impl::preparePlan - ") - ACE_TEXT("Plan %C successfully split. %u nodes to prepare.\n"), - this->getPlanUUID (), - sub_plans.current_size ())); - - // create completion counter - DAM_NM_ReplyHandlerImpl::Counter* _cp = 0; - ACE_NEW_THROW_EX (_cp, - DAM_NM_ReplyHandlerImpl::Counter (sub_plans.current_size (), - this, - _ch_ptr), - CORBA::NO_MEMORY ()); - DAM_NM_ReplyHandlerImpl::Counter_AutoPtr _counter_ptr (_cp); - - // Executing preparePlan on each NodeManager described in DeploymentPlan - for (Split_Plan<Node_Splitter>::TSubPlanIterator iter_plans = sub_plans.begin(); - iter_plans != sub_plans.end(); - ++iter_plans) - { - try - { - // Finding correspondent NodeManager - Deployment::NodeManager_var nm = this->nodes_.locate_node ((*iter_plans).ext_id_.c_str ());; - // If NodeManager not found throw StartError exception - if (CORBA::is_nil (nm.in ())) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::preparePlan - ") - ACE_TEXT("Deployment::StartError exception. NodeManager %C cannot be found\n"), - (*iter_plans).ext_id_.c_str())); - throw Deployment::StartError ( (*iter_plans).ext_id_.c_str(), - "NodeManager not found"); - } - - // create and activate reply handler - DAM_NM_ReplyHandlerImpl* dam_nm_rh_servant = 0; - ACE_NEW_THROW_EX (dam_nm_rh_servant, - DAnCE::DAM_NM_ReplyHandlerImpl (this, - nm.in (), - (*iter_plans).ext_id_.c_str(), - _counter_ptr), - CORBA::NO_MEMORY ()); - - PortableServer::ObjectId_var id = this->poa_->activate_object (dam_nm_rh_servant); - - CORBA::Object_var ref = this->poa_->id_to_reference (id.in()); - - ::Deployment::AMI_NodeManagerHandler_var dam_nm_handler = - ::Deployment::AMI_NodeManagerHandler::_narrow (ref.in ()); - - // Calling preparePlan for node, specified in current sub plan - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_TRACE, DLINFO ACE_TEXT("DomainApplicationManager_Impl::preparePlan - ") - ACE_TEXT("Calling preparePlan on node %C\n"), - (*iter_plans).ext_id_.c_str())); - - nm->sendc_preparePlan (dam_nm_handler.in (), - (*iter_plans).int_id_, - Deployment::ResourceCommitmentManager::_nil()); - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO ACE_TEXT("DomainApplicationManager_Impl::preparePlan - ") - ACE_TEXT("preparePlan on node %C has been called\n"), - (*iter_plans).ext_id_.c_str())); - } - catch (Deployment::PlanError &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::preparePlan - ") - ACE_TEXT("Caught a PlanError exception handling node %C : %C\n"), - (*iter_plans).ext_id_.c_str(), - ex._info ().c_str ())); - std::ostringstream err; - err << (*iter_plans).ext_id_.c_str() - << " - PlanError exception starting preparePlan : " - << ex.name.in () << ", " << ex.reason.in (); - // mark failure - _counter_ptr->increment_fail_count (err.str ().c_str ()); - // mark off node - _counter_ptr->decrement_exec_count (); - // continue for next node - } - catch (Deployment::StartError &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::preparePlan - ") - ACE_TEXT("Caught a StartLaunch exception handling node %C : %C\n"), - (*iter_plans).ext_id_.c_str(), - ex._info ().c_str ())); - std::ostringstream err; - err << (*iter_plans).ext_id_.c_str() - << " - StartLaunch exception starting preparePlan : " - << ex.name.in () << ", " << ex.reason.in (); - // mark failure - _counter_ptr->increment_fail_count (err.str ().c_str ()); - // mark off node - _counter_ptr->decrement_exec_count (); - // continue for next node - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::preparePlan - ") - ACE_TEXT("Caught a CORBA exception handling node %C : %C\n"), - (*iter_plans).ext_id_.c_str(), - ex._info ().c_str ())); - std::ostringstream err; - err << (*iter_plans).ext_id_.c_str() - << " - CORBA exception starting preparePlan : " - << ex._info ().c_str (); - // mark failure - _counter_ptr->increment_fail_count (err.str ().c_str ()); - // mark off node - _counter_ptr->decrement_exec_count (); - // continue for next node - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::preparePlan - ") - ACE_TEXT("Caught unknown exception handling node %C\n"), - (*iter_plans).ext_id_.c_str())); - std::ostringstream err; - err << (*iter_plans).ext_id_.c_str() - << " - unknown exception starting preparePlan"; - // mark failure - _counter_ptr->increment_fail_count (err.str ().c_str ()); - // mark off node - _counter_ptr->decrement_exec_count (); - // continue for next node - } - } - } - catch (Deployment::StartError &e) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::preparePlan - ") - ACE_TEXT("Propagating StartError exception caught here\n"))); - throw e; - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::preparePlan - ") - ACE_TEXT("Caught a CORBA exception, propagating StartError: %C\n"), - ex._info ().c_str ())); - throw ::Deployment::StartError (this->plan_.UUID.in (), - ex._info ().c_str ()); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::preparePlan - ") - ACE_TEXT("Caught unknown exception. Propagating StartError\n"))); - throw ::Deployment::StartError (this->plan_.UUID.in (), - "Unknown C++ exception"); - } - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::preparePlan - finished\n"))); -} - -void -DomainApplicationManager_Impl::destroyManager (DAM_CompletionHandler* completion_handler) -{ - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::destroyManager - ") - ACE_TEXT("Destroying %u applications for plan %C\n"), - this->running_app_.size (), - this->getPlanUUID ())); - - DAM_CompletionHandler_AutoPtr _ch_ptr (completion_handler); // manage handler - - try - { - if (this->running_app_.size() > 0) - { - // create our completionhandler - DestroyManagerCompletionHandler* dmch = 0; - ACE_NEW_THROW_EX (dmch, - DestroyManagerCompletionHandler (this, - _ch_ptr, - running_app_.size ()), - CORBA::NO_MEMORY ()); - DA_CompletionHandler_AutoPtr da_ch_ptr (dmch); - - while (0 < this->running_app_.size()) - { - DomainApplication_Impl* p = this->running_app_[this->running_app_.size()-1]; - try - { - Deployment::DomainApplication_var app = - Deployment::DomainApplication::_narrow (this->poa_->servant_to_reference (p)); - PortableServer::ObjectId_var id = this->poa_->reference_to_id (app); - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DomainApplicationManager_impl::destroyManager - ") - ACE_TEXT("deactivating DomainApplication[%@] object...\n"), - p)); - this->poa_->deactivate_object (id); - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT("DomainApplicationManager_impl::destroyManager - ") - ACE_TEXT("calling destroyApplication for DomainApplication[%@].\n"), - p)); - p->destroyApplication (da_ch_ptr); - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::destroyManager - ") - ACE_TEXT("Caught a CORBA exception for DomainApplication[%@]: %C\n"), - p, - ex._info ().c_str ())); - std::ostringstream err; - err << "CORBA exception starting destroyManager : " - << ex._info ().c_str (); - // mark failure - dmch->increment_fail_count (err.str ().c_str ()); - // mark off app - dmch->decrement_exec_count (); - // continue - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::destroyManager - ") - ACE_TEXT("Caught unknown exception for DomainApplication[%@].\n"), - p)); - // mark failure - dmch->increment_fail_count ("unknown exception starting destroyManager"); - // mark off app - dmch->decrement_exec_count (); - // continue - } - this->running_app_.pop_back(); - } - } - else - { - // no applications to destroy so finish immediately - this->finishDestroyManager (_ch_ptr); - } - } - catch (Deployment::StopError &e) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::destroyManager - ") - ACE_TEXT("Propagating StopError exception caught here\n"))); - throw e; - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::destroyManager - ") - ACE_TEXT("Caught a CORBA exception, propagating StopError: %C\n"), - ex._info ().c_str ())); - throw ::Deployment::StopError (this->plan_.UUID.in (), - ex._info ().c_str ()); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::destroyManager - ") - ACE_TEXT("Caught unknown exception. Propagating StopError\n"))); - throw ::Deployment::StopError (this->plan_.UUID.in (), - "Unknown C++ exception"); - } - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::destroyManager - finished\n"))); -} - -void -DomainApplicationManager_Impl::finishDestroyManager (const DAM_CompletionHandler_AutoPtr& ch_ptr) -{ - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::finishDestroyManager - ") - ACE_TEXT("Destroying %u node managers for plan %C\n"), - this->sub_app_mgr_.current_size (), - this->getPlanUUID ())); - - try - { - // create counters - DAM_NM_ReplyHandlerImpl::Counter* _cp = 0; - ACE_NEW_THROW_EX (_cp, - DAM_NM_ReplyHandlerImpl::Counter (sub_app_mgr_.current_size (), - this, - ch_ptr), - CORBA::NO_MEMORY ()); - DAM_NM_ReplyHandlerImpl::Counter_AutoPtr _counter_ptr (_cp); - - for (DomainApplication_Impl::TNam2Nm::iterator iter = this->sub_app_mgr_.begin(); - iter != this->sub_app_mgr_.end(); - ++iter) - { - ACE_CString node_id; - this->node_ids_.find ((*iter).int_id_, node_id); - - DAM_NM_ReplyHandlerImpl* dam_nm_rh_servant = 0; - try - { - // create and activate reply handler - ACE_NEW_THROW_EX (dam_nm_rh_servant, - DAnCE::DAM_NM_ReplyHandlerImpl (this, - (*iter).int_id_.in (), - node_id.c_str (), - _counter_ptr), - CORBA::NO_MEMORY ()); - - PortableServer::ObjectId_var id = this->poa_->activate_object (dam_nm_rh_servant); - - CORBA::Object_var ref = this->poa_->id_to_reference (id.in()); - - ::Deployment::AMI_NodeManagerHandler_var dam_nm_handler = - ::Deployment::AMI_NodeManagerHandler::_narrow (ref.in ()); - - // Calling destroyManager for node - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_TRACE, DLINFO ACE_TEXT("DomainApplicationManager_Impl::finishDestroyManager - ") - ACE_TEXT("Calling destroyManager on node manager for node %C\n"), - node_id.c_str ())); - - (*iter).int_id_->sendc_destroyManager (dam_nm_handler.in (), - (*iter).ext_id_.in()); - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::finishDestroyManager - ") - ACE_TEXT("Caught a CORBA exception attempting to call destroyManager on node %C: %C\n"), - node_id.c_str (), - ex._info ().c_str ())); - std::ostringstream err; - err << node_id.c_str () - << " - CORBA exception starting destroyManager : " - << ex._info ().c_str (); - // mark failure - _counter_ptr->increment_fail_count (err.str ().c_str ()); - // mark of node - _counter_ptr->decrement_exec_count (); - // continue to next node - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::finishDestroyManager - ") - ACE_TEXT("Caught unknown exception attempting to call destroyManager on node %C\n"), - node_id.c_str ())); - std::ostringstream err; - err << node_id.c_str () - << " - unknown exception starting destroyManager"; - // mark failure - _counter_ptr->increment_fail_count (err.str ().c_str ()); - // mark of node - _counter_ptr->decrement_exec_count (); - // continue to next node - } - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO ACE_TEXT("DomainApplicationManager_Impl::finishDestroyManager - ") - ACE_TEXT("destroyManager has been called on node manager\n"))); - } - } - catch (Deployment::StopError &e) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::finishDestroyManager - ") - ACE_TEXT("Propagating StopError exception caught here\n"))); - CORBA::Exception* local_ex = e._tao_duplicate (); - ch_ptr->handle_exception (local_ex); - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::finishDestroyManager - ") - ACE_TEXT("Caught a CORBA exception, propagating StopError: %C\n"), - ex._info ().c_str ())); - ch_ptr->handle_exception (new ::Deployment::StopError ()); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::finishDestroyManager - ") - ACE_TEXT("Caught unknown exception. Propagating StopError\n"))); - ch_ptr->handle_exception (new ::Deployment::StopError ()); - } - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::finishDestroyManager - finished\n"))); -} - -DAM_NM_ReplyHandlerImpl::Counter::Counter ( - unsigned int exec_count, - DomainApplicationManager_Impl* dam_servant, - const DAM_CompletionHandler_AutoPtr& em_completion_handler) - : Completion_Counter_Base<ACE_Null_Mutex> (exec_count, 0), - dam_servant_ (DomainApplicationManager_Impl_var::_duplicate (dam_servant)), - em_ch_ptr_ (em_completion_handler) -{ -} - -void -DAM_NM_ReplyHandlerImpl::Counter::on_all_completed () -{ - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT("DAM_NM_ReplyHandlerImpl::Counter::on_all_completed - ") - ACE_TEXT("Successfully completed operation for plan: %C\n"), - this->dam_servant_->getPlanUUID ())); - - this->em_ch_ptr_->handle_completion (dam_servant_.in ()); -} - -void -DAM_NM_ReplyHandlerImpl::Counter::on_all_completed_with_failure () -{ - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DAM_NM_ReplyHandlerImpl::Counter::on_all_completed_with_failure - ") - ACE_TEXT("%u errors for plan: %C\n"), - this->fail_count (), - this->dam_servant_->getPlanUUID ())); - - std::ostringstream err; - err << this->fail_count () << " errors executing operation:\n"; - for (DAM_NM_ReplyHandlerImpl::Counter::errors_type::const_iterator it = this->errors ().begin (); - it != this->errors ().end (); - ++it) - { - err << "\t" << *it << "\n"; - } - this->em_ch_ptr_->handle_exception ( - new ::Deployment::StartError(this->dam_servant_->getPlanUUID (), - err.str ().c_str ())); -} - -DAM_NM_ReplyHandlerImpl::DAM_NM_ReplyHandlerImpl ( - DomainApplicationManager_Impl* dam_servant, - ::Deployment::NodeManager_ptr nm, - const char* node_id, - const Counter_AutoPtr& counter) - : dam_servant_ (DomainApplicationManager_Impl_var::_duplicate (dam_servant)), - nm_ (::Deployment::NodeManager::_duplicate (nm)), - node_id_ (node_id), - counter_ (counter) -{ -} - -DAM_NM_ReplyHandlerImpl::~DAM_NM_ReplyHandlerImpl () -{ -} - -void DAM_NM_ReplyHandlerImpl::joinDomain (void) -{ -} -void DAM_NM_ReplyHandlerImpl::joinDomain_excep ( - ::Messaging::ExceptionHolder * /*excep_holder*/) -{ -} - -void DAM_NM_ReplyHandlerImpl::leaveDomain (void) -{ -} -void DAM_NM_ReplyHandlerImpl::leaveDomain_excep ( - ::Messaging::ExceptionHolder * /*excep_holder*/) -{ -} - -void DAM_NM_ReplyHandlerImpl::preparePlan ( - ::Deployment::NodeApplicationManager_ptr nam) -{ - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAM_NM_ReplyHandlerImpl::preparePlan - ") - ACE_TEXT("Finished preparePlan on node %C\n"), - this->node_id_.c_str())); - - if (CORBA::is_nil (nam)) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DAM_NM_ReplyHandlerImpl::preparePlan - ") - ACE_TEXT("PreparePlan failed for node %C, returning a nil ") - ACE_TEXT("NodeApplicationManager pointer.\n"), - this->node_id_.c_str ())); - std::ostringstream err; - err << "preparePlan failed for node " - << this->node_id_.c_str () - << ", returned nil"; - // add failure - this->counter_->increment_fail_count (err.str ().c_str ()); - } - else - { - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_INFO, DLINFO - ACE_TEXT("DAM_NM_ReplyHandlerImpl::preparePlan - ") - ACE_TEXT("Sucessfully prepared node %C for deployment\n"), - this->node_id_.c_str())); - - // We save NAM reference ptr in TNodes vector were it places to var variable - this->dam_servant_->sub_app_mgr_.bind (::Deployment::NodeApplicationManager::_duplicate (nam), - ::Deployment::NodeManager::_duplicate (this->nm_.in ())); - // nm to node Id table - this->dam_servant_->node_ids_.bind (::Deployment::NodeManager::_duplicate (this->nm_.in ()), - this->node_id_); - - } - - // mark off node - this->counter_->decrement_exec_count (); - - // deactivate AMI response handler - PortableServer::ObjectId_var oid = this->dam_servant_->poa_->servant_to_id (this); - this->dam_servant_->poa_->deactivate_object (oid.in ()); -} - -void DAM_NM_ReplyHandlerImpl::preparePlan_excep ( - ::Messaging::ExceptionHolder * excep_holder) -{ - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAM_NM_ReplyHandlerImpl::preparePlan_excep - ") - ACE_TEXT("Finished preparePlan on node %C\n"), - this->node_id_.c_str())); - - std::ostringstream err; - err << this->node_id_.c_str () << " - preparePlan raised "; - try - { - excep_holder->raise_exception (); - } - catch (Deployment::StartError &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DAM_NM_ReplyHandlerImpl::preparePlan_excep - ") - ACE_TEXT("StartError exception caught for node %C.\n"), - this->node_id_.c_str())); - err << "StartError : " << ex.name.in () << "." << ex.reason.in (); - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DAM_NM_ReplyHandlerImpl::preparePlan_excep - ") - ACE_TEXT("Caught a CORBA exception for node %C: %C\n"), - this->node_id_.c_str(), - ex._info ().c_str ())); - err << "CORBA exception : " << ex._info ().c_str (); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DAM_NM_ReplyHandlerImpl::preparePlan_excep - ") - ACE_TEXT("Caught unknown exception for node %C.\n"), - this->node_id_.c_str())); - err << "unknown exception"; - } - - // add failure - this->counter_->increment_fail_count (err.str ().c_str ()); - - // mark off node - this->counter_->decrement_exec_count (); - - // deactivate AMI response handler - PortableServer::ObjectId_var oid = this->dam_servant_->poa_->servant_to_id (this); - this->dam_servant_->poa_->deactivate_object (oid.in ()); -} - -void DAM_NM_ReplyHandlerImpl::destroyManager (void) -{ - DANCE_TRACE ("DAM_NM_ReplyHandlerImpl::destroyManager"); - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_TRACE, DLINFO - ACE_TEXT("DAM_NM_ReplyHandlerImpl::destroyApplication - ") - ACE_TEXT("Plan %C node %C node application manager destroy succeeded\n"), - this->dam_servant_->getPlanUUID (), - this->node_id_.c_str ())); - - // mark off one node - this->counter_->decrement_exec_count (); - - // deactivate AMI response handler - PortableServer::ObjectId_var oid = this->dam_servant_->poa_->servant_to_id (this); - this->dam_servant_->poa_->deactivate_object (oid.in ()); -} -void DAM_NM_ReplyHandlerImpl::destroyManager_excep ( - ::Messaging::ExceptionHolder * excep_holder) -{ - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAM_NM_ReplyHandlerImpl::destroyApplication_excep called for plan %C node %C"), - this->dam_servant_->getPlanUUID (), - this->node_id_.c_str ())); - - std::ostringstream err; - err << this->node_id_.c_str () << " - destroyApplication raised "; - try - { - excep_holder->raise_exception (); - } - catch (Deployment::StopError &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DAM_NM_ReplyHandlerImpl::destroyApplication_excep - ") - ACE_TEXT("StopError exception caught.\n"))); - err << "StopError : " << ex.name.in () << "." << ex.reason.in (); - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DAM_NM_ReplyHandlerImpl::destroyApplication_excep - ") - ACE_TEXT("Caught a CORBA exception: %C\n"), - ex._info ().c_str ())); - err << "CORBA exception : " << ex._info ().c_str (); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DAM_NM_ReplyHandlerImpl::destroyApplication_excep - ") - ACE_TEXT("Caught unknown exception.\n"))); - err << "unknown exception"; - } - - // add failure - this->counter_->increment_fail_count (err.str ().c_str ()); - - // mark off node - this->counter_->decrement_exec_count (); - - // deactivate AMI response handler - PortableServer::ObjectId_var oid = this->dam_servant_->poa_->servant_to_id (this); - this->dam_servant_->poa_->deactivate_object (oid.in ()); -} - -void DAM_NM_ReplyHandlerImpl::getDynamicResources ( - const ::Deployment::Resources & /*ami_return_val*/) -{ -} -void DAM_NM_ReplyHandlerImpl::getDynamicResources_excep ( - ::Messaging::ExceptionHolder * /*excep_holder*/) -{ -} - -DomainApplicationManager_Impl::StartLaunchCompletionHandler::StartLaunchCompletionHandler ( - DomainApplicationManager_Impl *dam_servant, - ::Deployment::AMH_ApplicationManagerResponseHandler_ptr _tao_rh) - : dam_servant_ (DomainApplicationManager_Impl_var::_duplicate (dam_servant)), - dam_rh_ (::Deployment::AMH_ApplicationManagerResponseHandler::_duplicate (_tao_rh)) -{ -} - -DomainApplicationManager_Impl::StartLaunchCompletionHandler::~StartLaunchCompletionHandler () -{ -} - -void -DomainApplicationManager_Impl::StartLaunchCompletionHandler::handle_completion (DomainApplication_Impl *da_servant) -{ - try - { - ::Deployment::Connections_var connections; - ACE_NEW_THROW_EX (connections, - Deployment::Connections (), - CORBA::NO_MEMORY ()); - - da_servant->getConnections (connections.inout ()); - - this->dam_servant_->finish_startLaunch ( - this->dam_rh_.in (), - da_servant, - connections); - } - catch (const CORBA::Exception& ex) - { - CORBA::Exception* local_ex = ex._tao_duplicate (); - this->dam_servant_->fail_startLaunch (this->dam_rh_.in (), - local_ex); - } - catch (...) - { - CORBA::Exception* unknown_ex = new CORBA::UNKNOWN; - this->dam_servant_->fail_startLaunch (this->dam_rh_.in (), - unknown_ex); - } -} - -void -DomainApplicationManager_Impl::StartLaunchCompletionHandler::handle_exception (CORBA::Exception* local_ex) -{ - this->dam_servant_->fail_startLaunch (this->dam_rh_.in (), - local_ex); -} - -DomainApplicationManager_Impl::DestroyManagerCompletionHandler::DestroyManagerCompletionHandler ( - DomainApplicationManager_Impl *dam_servant, - const DAM_CompletionHandler_AutoPtr& ch_ptr, - unsigned int exec_count) - : Completion_Counter_Base<ACE_Null_Mutex> (exec_count, 0), - dam_servant_ (DomainApplicationManager_Impl_var::_duplicate (dam_servant)), - dam_ch_ (ch_ptr) -{ -} - -void -DomainApplicationManager_Impl::DestroyManagerCompletionHandler::handle_completion ( - DomainApplication_Impl *da_servant) -{ - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::DestroyManagerCompletionHandler::handle_completion - ") - ACE_TEXT("Finished destroyApplication on DomainApplication[%@] for plan %C\n"), - da_servant, - this->dam_servant_->getPlanUUID ())); - - try - { - da_servant->_remove_ref (); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::DestroyManagerCompletionHandler::handle_completion - ") - ACE_TEXT("UNEXPECTED exception while decrementing servant reference\n"))); - } - - // mark of application - this->decrement_exec_count (); -} - -void -DomainApplicationManager_Impl::DestroyManagerCompletionHandler::handle_exception ( - CORBA::Exception* local_ex) -{ - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::DestroyManagerCompletionHandler::handle_exception - ") - ACE_TEXT("CORBA exception %C for destroyApplication on domain application for plan %C\n"), - local_ex->_info ().c_str (), - this->dam_servant_->getPlanUUID ())); - - std::ostringstream err; - err << "CORBA exception for destroyApplication : " - << local_ex->_info ().c_str (); - - delete local_ex; // clean up - - // add failure - this->increment_fail_count (err.str ().c_str ()); - - // mark of application - this->decrement_exec_count (); -} - -void -DomainApplicationManager_Impl::DestroyManagerCompletionHandler::on_all_completed () -{ - // all applications gone, now finish it - this->dam_servant_->finishDestroyManager (dam_ch_); -} - -void -DomainApplicationManager_Impl::DestroyManagerCompletionHandler::on_all_completed_with_failure () -{ - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::DestroyManagerCompletionHandler::on_all_completed_with_failure - ") - ACE_TEXT("%u errors destroying domain applications\n"), - this->fail_count_i ())); - - std::ostringstream err; - err << this->fail_count () << " errors destroying domain applications:\n"; - for (DomainApplicationManager_Impl::DestroyManagerCompletionHandler::errors_type::const_iterator it = this->errors ().begin (); - it != this->errors ().end (); - ++it) - { - err << "\t" << *it << "\n"; - } - this->dam_ch_->handle_exception ( - new ::Deployment::StopError(this->dam_servant_->getPlanUUID (), - err.str ().c_str ())); -} - -DomainApplicationManager_Impl::DestroyApplicationCompletionHandler::DestroyApplicationCompletionHandler ( - DomainApplicationManager_Impl *dam_servant, - ::Deployment::AMH_ApplicationManagerResponseHandler_ptr _tao_rh, - DomainApplication_Impl *da_servant) - : dam_servant_ (DomainApplicationManager_Impl_var::_duplicate (dam_servant)), - dam_rh_ (::Deployment::AMH_ApplicationManagerResponseHandler::_duplicate (_tao_rh)), - da_servant_ (DomainApplication_Impl_var::_duplicate (da_servant)) -{ -} - -void DomainApplicationManager_Impl::DestroyApplicationCompletionHandler::handle_completion ( - DomainApplication_Impl * /*da_servant*/) -{ - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_INFO, DLINFO - ACE_TEXT("DomainApplicationManager_Impl::DestroyApplicationCompletionHandler::handle_completion - ") - ACE_TEXT("finished\n"))); - dam_rh_->destroyApplication (); -} - -void DomainApplicationManager_Impl::DestroyApplicationCompletionHandler::handle_exception ( - CORBA::Exception* local_ex) -{ - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, - DLINFO ACE_TEXT("ExecutionManager_Impl::DestroyManagerCompletionHandler::handle_exception - ") - ACE_TEXT("propagating exception\n"))); - ::Deployment::AMH_ApplicationManagerExceptionHolder amh_exholder (local_ex); - dam_rh_->destroyApplication_excep (&amh_exholder); -} diff --git a/DAnCE/dance/DomainApplicationManager/DomainApplicationManager_Impl.h b/DAnCE/dance/DomainApplicationManager/DomainApplicationManager_Impl.h deleted file mode 100644 index 1cd079ce8f9..00000000000 --- a/DAnCE/dance/DomainApplicationManager/DomainApplicationManager_Impl.h +++ /dev/null @@ -1,215 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file DomainApplicationManager_Impl.h - * - * @brief Implementation of POA_Deployment::DomainApplicationManager - * - * @author Erwin Gottlieb <eg@prismtech.com> - */ -//============================================================================= - -#ifndef DOMAINAPPLICATIONMANAGER_IMPL_H_ -#define DOMAINAPPLICATIONMANAGER_IMPL_H_ - -#include "ace/Vector_T.h" -#include "ace/SStringfwd.h" -#include "ace/Map_Manager.h" -#include "ace/Refcounted_Auto_Ptr.h" -#include "DomainApplicationManager_Export.h" -#include "Node_Locator.h" -#include "dance/Deployment/Deployment_NodeManagerC.h" -#include "dance/Deployment/Deployment_NodeManagerS.h" -#include "dance/DomainApplication/Domain_Application_Impl.h" -#include "Completion/CompletionHandler_T.h" -#include "Completion/Completion_Counter_Base.h" -#include "dance/Deployment/Deployment_DomainApplicationManagerS.h" - -namespace DAnCE - { - class DomainApplicationManager_Impl; - - typedef PortableServer::Servant_var<DomainApplicationManager_Impl> DomainApplicationManager_Impl_var; - - typedef CompletionHandler<DomainApplicationManager_Impl> DAM_CompletionHandler; - - typedef ACE_Refcounted_Auto_Ptr<DAM_CompletionHandler, ACE_Null_Mutex> DAM_CompletionHandler_AutoPtr; - - class DAM_NM_ReplyHandlerImpl; - - class DomainApplicationManager_Export DomainApplicationManager_Impl - : public virtual POA_Deployment::AMH_DomainApplicationManager - { - public: - DomainApplicationManager_Impl (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - const ::Deployment::DeploymentPlan& plan, - Node_Locator &nodes); - - virtual ~DomainApplicationManager_Impl(); - - virtual void startLaunch ( - ::Deployment::AMH_ApplicationManagerResponseHandler_ptr _tao_rh, - const ::Deployment::Properties & configProperty); - - virtual void destroyApplication ( - ::Deployment::AMH_ApplicationManagerResponseHandler_ptr _tao_rh, - ::Deployment::Application_ptr); - - virtual void getApplications ( - ::Deployment::AMH_DomainApplicationManagerResponseHandler_ptr _tao_rh); - - virtual void getPlan ( - ::Deployment::AMH_DomainApplicationManagerResponseHandler_ptr _tao_rh); - - const char* getPlanUUID (void); - - void preparePlan (DAM_CompletionHandler* em_handler); - - void destroyManager (DAM_CompletionHandler* em_handler); - - class StartLaunchCompletionHandler - : public CompletionHandler<DomainApplication_Impl> - { - public: - StartLaunchCompletionHandler ( - DomainApplicationManager_Impl *dam_servant, - ::Deployment::AMH_ApplicationManagerResponseHandler_ptr _tao_rh); - ~StartLaunchCompletionHandler (); - - virtual void handle_completion (DomainApplication_Impl *da_servant); - virtual void handle_exception (CORBA::Exception* local_ex); - - private: - DomainApplicationManager_Impl_var dam_servant_; - ::Deployment::AMH_ApplicationManagerResponseHandler_var dam_rh_; - }; - - class DestroyManagerCompletionHandler - : public CompletionHandler<DomainApplication_Impl>, - public Completion_Counter_Base<ACE_Null_Mutex> - { - public: - DestroyManagerCompletionHandler ( - DomainApplicationManager_Impl *dam_servant, - const DAM_CompletionHandler_AutoPtr& ch_ptr, - unsigned int exec_count); - - virtual void handle_completion (DomainApplication_Impl *da_servant); - virtual void handle_exception (CORBA::Exception* local_ex); - - protected: - virtual void on_all_completed (); - virtual void on_all_completed_with_failure (); - - private: - DomainApplicationManager_Impl_var dam_servant_; - DAM_CompletionHandler_AutoPtr dam_ch_; - }; - - class DestroyApplicationCompletionHandler - : public CompletionHandler<DomainApplication_Impl> - { - public: - DestroyApplicationCompletionHandler ( - DomainApplicationManager_Impl *dam_servant, - ::Deployment::AMH_ApplicationManagerResponseHandler_ptr _tao_rh, - DomainApplication_Impl *da_servant); - - virtual void handle_completion (DomainApplication_Impl *da_servant); - virtual void handle_exception (CORBA::Exception* local_ex); - - private: - DomainApplicationManager_Impl_var dam_servant_; - ::Deployment::AMH_ApplicationManagerResponseHandler_var dam_rh_; - DomainApplication_Impl_var da_servant_; - }; - - private: - void finish_startLaunch ( - ::Deployment::AMH_ApplicationManagerResponseHandler_ptr _tao_rh, - DomainApplication_Impl *da_servant, - const ::Deployment::Connections & providedReference); - void fail_startLaunch ( - ::Deployment::AMH_ApplicationManagerResponseHandler_ptr _tao_rh, - CORBA::Exception* local_ex); - - void finishDestroyManager (const DAM_CompletionHandler_AutoPtr& ch_ptr); - - friend class StartLaunchCompletionHandler; - friend class DestroyManagerCompletionHandler; - - friend class DAM_NM_ReplyHandlerImpl; - - CORBA::ORB_var orb_; - PortableServer::POA_var poa_; - const Deployment::DeploymentPlan plan_; - DomainApplication_Impl::TNam2Nm sub_app_mgr_; - DomainApplication_Impl::TNm2Id node_ids_; - Node_Locator &nodes_; - typedef ACE_Vector<DomainApplication_Impl*> TApplications; - TApplications running_app_; - }; - - class DAM_NM_ReplyHandlerImpl - : public POA_Deployment::AMI_NodeManagerHandler - { - public: - class Counter - : public Completion_Counter_Base<ACE_Null_Mutex> - { - public: - Counter (unsigned int exec_count, - DomainApplicationManager_Impl* dam_servant, - const DAM_CompletionHandler_AutoPtr& em_completion_handler); - - protected: - virtual void on_all_completed (); - virtual void on_all_completed_with_failure (); - - private: - DomainApplicationManager_Impl_var dam_servant_; - DAM_CompletionHandler_AutoPtr em_ch_ptr_; - }; - - typedef ACE_Refcounted_Auto_Ptr<Counter, ACE_Null_Mutex> Counter_AutoPtr; - - DAM_NM_ReplyHandlerImpl (DomainApplicationManager_Impl* dam_servant, - Deployment::NodeManager_ptr nm, - const char* node_id, - const Counter_AutoPtr& counter); - virtual ~DAM_NM_ReplyHandlerImpl (); - - virtual void joinDomain (void); - virtual void joinDomain_excep ( - ::Messaging::ExceptionHolder * excep_holder); - - virtual void leaveDomain (void); - virtual void leaveDomain_excep ( - ::Messaging::ExceptionHolder * excep_holder); - - virtual void preparePlan ( - ::Deployment::NodeApplicationManager_ptr ami_return_val); - virtual void preparePlan_excep ( - ::Messaging::ExceptionHolder * excep_holder); - - virtual void destroyManager (void); - virtual void destroyManager_excep ( - ::Messaging::ExceptionHolder * excep_holder); - - virtual void getDynamicResources ( - const ::Deployment::Resources & ami_return_val); - virtual void getDynamicResources_excep ( - ::Messaging::ExceptionHolder * excep_holder); - - private: - DomainApplicationManager_Impl_var dam_servant_; - Deployment::NodeManager_var nm_; - ACE_CString node_id_; - Counter_AutoPtr counter_; - }; - - }//DAnCE - -#endif /*DOMAINAPPLICATIONMANAGER_IMPL_H_*/ diff --git a/DAnCE/dance/DomainApplicationManager/Node_Locator.cpp b/DAnCE/dance/DomainApplicationManager/Node_Locator.cpp deleted file mode 100644 index 85e0f9f5f67..00000000000 --- a/DAnCE/dance/DomainApplicationManager/Node_Locator.cpp +++ /dev/null @@ -1,237 +0,0 @@ -#include "Node_Locator.h" -#include "ace/Read_Buffer.h" -#include "dance/Logger/Log_Macros.h" -#include "Config_Handlers/XML_File_Intf.h" -#include "Config_Handlers/Common.h" -#include "dance/DAnCE_Utility.h" -#include "dance/DAnCE_PropertiesC.h" - - -namespace DAnCE -{ - Node_Locator::Node_Locator (CORBA::ORB_ptr orb, - CosNaming::NamingContext_ptr nc) - : orb_ (CORBA::ORB::_duplicate (orb)), - nc_ (CosNaming::NamingContext::_duplicate (nc)) - { - } - - ::Deployment::NodeManager_ptr - Node_Locator::locate_node (const char *name) - { - ACE_CString ior; - - if (this->nodes_.find (name, ior) == 0) - { - return this->resolve_ior (name, ior.c_str ()); - } - else - { - return this->ns_lookup (name); - } - } - - bool - Node_Locator::process_cdd (const ACE_TCHAR *filename) - { - DANCE_TRACE ("Node_Locator::process_cdd"); - - if (!filename) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Node_Locator::process_cdd - ") - ACE_TEXT("Error: Provided with nil filename\n"))); - return false; - } - - ::DAnCE::Config_Handlers::XML_File_Intf file (filename); - file.add_search_path (ACE_TEXT ("DANCE_ROOT"), ACE_TEXT ("/docs/schema/")); - ::Deployment::Domain *plan = file.release_domain (); - - if (!plan) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Node_Locator::process_cdd - ") - ACE_TEXT("Error: Processing file <%C>\n"), filename)); - return false; - } - - // install nodes - for (CORBA::ULong i=0; i < plan->node.length (); ++i) - { - ::Deployment::Resource resource; - - if (!get_resource_value (DAnCE::NODE_RESOURCE_TYPE, - plan->node[i].resource, - resource)) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, - DLINFO ACE_TEXT("Node_Locator::process_cdd - ") - ACE_TEXT("Error: Resource <%C> not found.\n"), - DAnCE::NODE_RESOURCE_TYPE)); - return false; - } - const ACE_TCHAR *val = 0; - if (!::DAnCE::Utility::get_satisfierproperty_value (DAnCE::NODE_IOR, - resource.property, - val)) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, - DLINFO ACE_TEXT("Node_Locator::process_cdd - ") - ACE_TEXT("Error: Property <%C> not found.\n"), - DAnCE::NODE_IOR)); - return false; - - } - ACE_CString ior(val); - ior += "/"; - ior += plan->node[i].name; - ior += ".NodeManager"; - - ACE_CString destination (plan->node[i].name); - - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_INFO, DLINFO ACE_TEXT("Node_Locator::process_cdd - ") - ACE_TEXT("Storing IOR %C for destination %C\n"), - ior.c_str (), destination.c_str ())); - - this->nodes_.bind (destination, ior); - } - - return true; - } - - ::Deployment::NodeManager_ptr - Node_Locator::resolve_ior (const char *name, const char *ior) - { - DANCE_TRACE ("Node_Locator::resolve_ior"); - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT("Node_Locator::resolve_ior - ") - ACE_TEXT("Resolving ior %C for destination %C\n"), - ior, name)); - - CORBA::Object_var obj = this->orb_->string_to_object (ior); - - ::Deployment::NodeManager_var nm = ::Deployment::NodeManager::_narrow (obj.in ()); - - if (CORBA::is_nil (nm.in ())) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO ACE_TEXT("Node_Locator::resolve_ior - ") - ACE_TEXT("Error: Unable to retrieve reference for destination ") - ACE_TEXT("%C and ior %C\n"), - name, ior)); - } - - return nm._retn (); - } - - void - Node_Locator::store_ior (const char *name, const char *ior) - { - DANCE_TRACE ("Node_Locator::store_ior"); - this->nodes_.bind (name, ior); - } - - ::Deployment::NodeManager_ptr - Node_Locator::ns_lookup (const char *nodename) - { - DANCE_TRACE ("Node_Locator::ns_lookup"); - - if (CORBA::is_nil (this->nc_.in ())) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO ACE_TEXT("Node_Locator::ns_lookup - ") - ACE_TEXT("Nameservice lookup of %C failed because there is no naming service.\n"), - nodename)); - return ::Deployment::NodeManager::_nil (); - } - - try - { - CosNaming::Name name; - name.length (1); - - name[0].id = nodename; - name[0].kind = "NodeManager"; - - CORBA::Object_var obj = this->nc_->resolve (name); - - ::Deployment::NodeManager_var nm = ::Deployment::NodeManager::_narrow (obj.in ()); - - if (CORBA::is_nil (nm.in ())) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO ACE_TEXT("Node_Locator::ns_lookup - ") - ACE_TEXT("Unable to narrow provided reference for node %C\n"), - nodename)); - } - - return nm._retn (); - } - catch (const CORBA::Exception &e) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO ACE_TEXT("Node_Locator::ns_lookup - ") - ACE_TEXT("Caught CORBA exception while looking up name %C:%C\n"), - nodename, e._info ().c_str ())); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO ACE_TEXT("Node_Locator::ns_lookup - ") - ACE_TEXT("Caught unexpected exception while looking up name %C\n"), - nodename)); - } - - return ::Deployment::NodeManager::_nil (); - } - - bool - Node_Locator::get_resource_value (const char *type, - const ::Deployment::Resources &resources, - ::Deployment::Resource &val) - { - DANCE_TRACE ("Node_Locator::get_resource_value<const char *>"); - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("Node_Locator::get_resource_value - ") - ACE_TEXT("Finding resource for type '%C'\n"), - type)); - - for (CORBA::ULong i = 0; i < resources.length (); ++i) - { - // search for the resource with resourceType - for (CORBA::ULong k = 0;k < resources[i].resourceType.length ();k++) - { - if (ACE_OS::strcmp (type, - resources[i].resourceType[k]) == 0) - { - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("Node_Locator::get_resource_value - ") - ACE_TEXT("Found resource for type '%C'\n"), - type)); - - val = resources[i]; - return true; - } - } - } - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_WARNING, DLINFO - ACE_TEXT("Node_Locator::get_resource_value - ") - ACE_TEXT("Failed to extract resource for %C\n"), - type)); - return false; - } - -} - diff --git a/DAnCE/dance/DomainApplicationManager/Node_Locator.h b/DAnCE/dance/DomainApplicationManager/Node_Locator.h deleted file mode 100644 index 4d58608d6b8..00000000000 --- a/DAnCE/dance/DomainApplicationManager/Node_Locator.h +++ /dev/null @@ -1,58 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Node_Locator.h - * - * @brief Locates NodeManager instances. - * - * @author William R. Otte <wotte@dre.vanderbilt.edu> - */ -//============================================================================= - -#ifndef NODE_LOCATOR_H_ -#define NODE_LOCATOR_H_ - -#include "ace/Map_Manager.h" -#include "orbsvcs/orbsvcs/CosNamingC.h" -#include "tao/ORB.h" -#include "dance/Deployment/Deployment_NodeManagerC.h" -#include "dance/DomainApplicationManager/DomainApplicationManager_Export.h" - -namespace DAnCE -{ - class DomainApplicationManager_Export Node_Locator - { - public: - Node_Locator (CORBA::ORB_ptr orb, - CosNaming::NamingContext_ptr nc); - - ::Deployment::NodeManager_ptr locate_node (const char *name); - - bool process_cdd (const ACE_TCHAR *file); - - void store_ior (const char *name, const char *ior); - - private: - ::Deployment::NodeManager_ptr resolve_ior (const char *name, - const char *ior); - - ::Deployment::NodeManager_ptr ns_lookup (const char *name); - - bool get_resource_value (const char *type, - const ::Deployment::Resources &resources, - ::Deployment::Resource &val); - - - typedef ACE_Map_Manager<ACE_CString, - ACE_CString, - ACE_Null_Mutex> NODEMAP; - - NODEMAP nodes_; - CORBA::ORB_var orb_; - CosNaming::NamingContext_var nc_; - }; - -} - -#endif /* NODE_LOCATOR_H_ */ diff --git a/DAnCE/dance/ExecutionManager/.gitignore b/DAnCE/dance/ExecutionManager/.gitignore deleted file mode 100644 index f92af7afb5c..00000000000 --- a/DAnCE/dance/ExecutionManager/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/dance_execution_manager diff --git a/DAnCE/dance/ExecutionManager/ExecutionManager.mpc b/DAnCE/dance/ExecutionManager/ExecutionManager.mpc deleted file mode 100644 index adb3b68e413..00000000000 --- a/DAnCE/dance/ExecutionManager/ExecutionManager.mpc +++ /dev/null @@ -1,14 +0,0 @@ -// -*- MPC -*- -project(Execution_Manager_Exec) : install, dance_exe, naming, \ - dance_domainapplicationmanager, \ - dance_executionmanager_skel, \ - utils, dance_logger, avoids_minimum_corba, \ - iortable, dance_split_plan, dance_tools { - exename = dance_execution_manager - - Source_Files { - ExecutionManager_Impl.cpp - ExecutionManager_Module.cpp - Execution_Manager.cpp - } -} diff --git a/DAnCE/dance/ExecutionManager/ExecutionManager_Impl.cpp b/DAnCE/dance/ExecutionManager/ExecutionManager_Impl.cpp deleted file mode 100644 index 37fd5f18474..00000000000 --- a/DAnCE/dance/ExecutionManager/ExecutionManager_Impl.cpp +++ /dev/null @@ -1,333 +0,0 @@ -//--*C++*-- -#include "ExecutionManager_Impl.h" - -#include "Config_Handlers/DnC_Dump.h" -#include "dance/Logger/Log_Macros.h" - -using namespace DAnCE; - -ExecutionManager_Impl::ExecutionManager_Impl (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - CosNaming::NamingContext_ptr nc) - : orb_ (CORBA::ORB::_duplicate (orb)), - poa_ (PortableServer::POA::_duplicate (poa)), - locator_ (orb, nc) -{ - DANCE_TRACE ( "ExecutionManager_Impl::ExecutionManager_Impl"); -} - -ExecutionManager_Impl::~ExecutionManager_Impl() -{ - DANCE_TRACE ( "ExecutionManager_Impl::~ExecutionManager_Impl"); - for (TDomainManagers::iterator iter = this->managers_.begin(); - iter != this->managers_.end(); - ++iter) - { - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("ExecutionManager_Impl::~ExecutionManager_Impl - ") - ACE_TEXT("deactivating DAM \"%C\"\n"), (*iter).ext_id_.c_str())); - PortableServer::ObjectId_var id = this->poa_->servant_to_id ( (*iter).int_id_); - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("ExecutionManager_Impl::~ExecutionManager_Impl - ") - ACE_TEXT("before deactivate_object...\n"))); - this->poa_->deactivate_object (id.in()); - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("ExecutionManager_Impl::~ExecutionManager_Impl - ") - ACE_TEXT("deleting DomainApplicationManager\n"))); - delete (*iter).int_id_; - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("ExecutionManager_Impl::~ExecutionManager_Impl - ") - ACE_TEXT("DomainApplicationManager deleted\n"))); - } -} - -void -ExecutionManager_Impl::preparePlan (::Deployment::AMH_ExecutionManagerResponseHandler_ptr _tao_rh, - const ::Deployment::DeploymentPlan & plan, - ::Deployment::ResourceCommitmentManager_ptr /*resourceCommitment*/) -{ - DANCE_TRACE ( "ExecutionManager_Impl::preparePlan"); - - // Check if plan is already deployed. - DomainApplicationManager_Impl * dam = 0; - if (0 == this->managers_.find (plan.UUID.in(), dam)) - { - DANCE_ERROR (DANCE_LOG_WARNING, - (LM_NOTICE, DLINFO - ACE_TEXT("ExecutionManager_Impl::preparePlan - ") - ACE_TEXT("DomainApplicationManager with specified UUID already exists\n"))); - // Should we return on this situation reference on existed DomainApplicationManager or - // we should throw PlanError exception? - CORBA::Object_var ref = this->poa_->servant_to_reference (dam); - _tao_rh->preparePlan (Deployment::DomainApplicationManager::_narrow (ref.in ())); - return; - } - - try { - DomainApplicationManager_Impl* dam_servant_ptr = 0; - ACE_NEW_THROW_EX (dam_servant_ptr, - DAnCE::DomainApplicationManager_Impl (this->orb_.in (), - this->poa_.in (), - plan, - this->locator_), - CORBA::NO_MEMORY ()); - DomainApplicationManager_Impl_var dam_servant (dam_servant_ptr); - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO ACE_TEXT("ExecutionManager_Impl::preparePlan - ") - ACE_TEXT("Domain Application Manager was successfully created.\n"))); - - PreparePlanCompletionHandler* ppch = 0; - ACE_NEW_THROW_EX (ppch, - PreparePlanCompletionHandler (this, - _tao_rh), - CORBA::NO_MEMORY ()); - - dam_servant->preparePlan (ppch); - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_TRACE, DLINFO - ACE_TEXT("ExecutionManager_Impl::preparePlan - ") - ACE_TEXT("Domain Application Manager preparePlan has been called.\n"))); - } - catch (const CORBA::Exception& ex) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("ExecutionManager_Impl::preparePlan - ") - ACE_TEXT("Propagating CORBA exception caught here\n"))); - CORBA::Exception* local_ex = ex._tao_duplicate (); - ::Deployment::AMH_ExecutionManagerExceptionHolder amh_exholder (local_ex); - _tao_rh->preparePlan_excep (&amh_exholder); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("ExecutionManager_Impl::preparePlan - ") - ACE_TEXT("Propagating exception caught here\n"))); - CORBA::Exception* unknown_ex = new CORBA::UNKNOWN; - ::Deployment::AMH_ExecutionManagerExceptionHolder amh_exholder (unknown_ex); - _tao_rh->preparePlan_excep (&amh_exholder); - } - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("ExecutionManager_Impl::preparePlan - finished\n"))); -} - -void -ExecutionManager_Impl::finish_preparePlan (::Deployment::AMH_ExecutionManagerResponseHandler_ptr _tao_rh, - DomainApplicationManager_Impl *dam_servant) -{ - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_NOTICE, DLINFO - ACE_TEXT("ExecutionManager_Impl::finish_preparePlan - ") - ACE_TEXT("Plan with UUID %C was successfully prepared.\n"), - dam_servant->getPlanUUID ())); - - this->managers_.rebind (dam_servant->getPlanUUID (), dam_servant); - - PortableServer::ObjectId_var id = this->poa_->activate_object (dam_servant); - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("ExecutionManager_Impl::finish_preparePlan - ") - ACE_TEXT("Domain Application Manager was successfully activated.\n"))); - - CORBA::Object_var ref = this->poa_->id_to_reference (id.in()); - _tao_rh->preparePlan (Deployment::DomainApplicationManager::_narrow (ref.in ())); -} - -void -ExecutionManager_Impl::fail_preparePlan (::Deployment::AMH_ExecutionManagerResponseHandler_ptr _tao_rh, - CORBA::Exception* local_ex) -{ - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_NOTICE, DLINFO - ACE_TEXT("ExecutionManager_Impl::fail_preparePlan called\n"))); - - ::Deployment::AMH_ExecutionManagerExceptionHolder amh_exholder (local_ex); - _tao_rh->preparePlan_excep (&amh_exholder); -} - -void -ExecutionManager_Impl::getManagers (::Deployment::AMH_ExecutionManagerResponseHandler_ptr _tao_rh) -{ - DANCE_TRACE ( "ExecutionManager_Impl::getManagers ()"); - - try - { - ::Deployment::DomainApplicationManagers_var managers; - ACE_NEW_THROW_EX (managers, - ::Deployment::DomainApplicationManagers(), - CORBA::NO_MEMORY()); - - managers->length (this->managers_.current_size()); - CORBA::ULong index = 0; - for (TDomainManagers::iterator iter = this->managers_.begin(); - iter != this->managers_.end(); - ++iter) - { - CORBA::Object_var ref = this->poa_->servant_to_reference ( (*iter).int_id_); - (*managers) [index] - = Deployment::DomainApplicationManager::_narrow (ref.in ()); - ++index; - } - - _tao_rh->getManagers (managers); - return; - } - catch (const CORBA::Exception& ex) - { - CORBA::Exception* local_ex = ex._tao_duplicate (); - ::Deployment::AMH_ExecutionManagerExceptionHolder amh_exholder (local_ex); - _tao_rh->getManagers_excep (&amh_exholder); - } - catch (...) - { - CORBA::Exception* unknown_ex = new CORBA::UNKNOWN; - ::Deployment::AMH_ExecutionManagerExceptionHolder amh_exholder (unknown_ex); - _tao_rh->getManagers_excep (&amh_exholder); - } -} - -void -ExecutionManager_Impl::destroyManager (::Deployment::AMH_ExecutionManagerResponseHandler_ptr _tao_rh, - ::Deployment::DomainApplicationManager_ptr appManager) -{ - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT("ExecutionManager_Impl::destroyManager - started\n"))); - - try { - for (TDomainManagers::iterator iter = this->managers_.begin(); - iter != this->managers_.end(); - ++iter) - { - CORBA::Object_var app = this->poa_->servant_to_reference ( (*iter).int_id_); - if (appManager->_is_equivalent (app.in ())) - { - DomainApplicationManager_Impl *dam_servant = (*iter).int_id_; - // create completion handler - DestroyManagerCompletionHandler* dmch = 0; - ACE_NEW_THROW_EX (dmch, - DestroyManagerCompletionHandler (this, - _tao_rh, - dam_servant), - CORBA::NO_MEMORY ()); - - // deregister manager - this->managers_.unbind ( (*iter).ext_id_); - PortableServer::ObjectId_var id = this->poa_->reference_to_id (appManager); - this->poa_->deactivate_object (id.in()); - - (*iter).int_id_ = 0; - - // remove default ref so servant will be deleted when - // var in DestroyManagerCompletionHandler gets destructed - // at the finish of DomainApplicationManager_Impl::destroyManager - dam_servant->_remove_ref (); - - dam_servant->destroyManager (dmch); - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("ExecutionManager_Impl::destroyManager - ") - ACE_TEXT("Domain Application Manager destroyManager has been called.\n"))); - return; - } - } - - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO ACE_TEXT("ExecutionManager_Impl::destroyManager - ") - ACE_TEXT("corresponding DomainApplicationManager cannot be found\n"))); - CORBA::Exception* local_ex = - new ::Deployment::StopError("ExecutionManager_Impl::destroyManager", - "corresponding DomainApplicationManager cannot be found"); - ::Deployment::AMH_ExecutionManagerExceptionHolder amh_exholder (local_ex); - _tao_rh->destroyManager_excep (&amh_exholder); - } - catch (const CORBA::Exception& ex) - { - CORBA::Exception* local_ex = ex._tao_duplicate (); - ::Deployment::AMH_ExecutionManagerExceptionHolder amh_exholder (local_ex); - _tao_rh->destroyManager_excep (&amh_exholder); - } - catch (...) - { - CORBA::Exception* unknown_ex = new CORBA::UNKNOWN; - ::Deployment::AMH_ExecutionManagerExceptionHolder amh_exholder (unknown_ex); - _tao_rh->destroyManager_excep (&amh_exholder); - } -} - -void -ExecutionManager_Impl::add_node_manager (const char *name, const char *ior) -{ - DANCE_TRACE ("ExecutionManager_Impl::add_node_manager"); - this->locator_.store_ior (name, ior); -} - -void -ExecutionManager_Impl::load_cdd (const ACE_TCHAR *filename) -{ - DANCE_TRACE ("ExecutionManager_Impl::load_cdd"); - this->locator_.process_cdd (filename); -} - -ExecutionManager_Impl::PreparePlanCompletionHandler::PreparePlanCompletionHandler ( - ExecutionManager_Impl *em_servant, - ::Deployment::AMH_ExecutionManagerResponseHandler_ptr _tao_rh) - : em_servant_ (ExecutionManager_Impl_var::_duplicate (em_servant)), - em_rh_ (::Deployment::AMH_ExecutionManagerResponseHandler::_duplicate (_tao_rh)) -{ -} - -void -ExecutionManager_Impl::PreparePlanCompletionHandler::handle_completion (DomainApplicationManager_Impl *dam_servant) -{ - this->em_servant_->finish_preparePlan (this->em_rh_.in (), - dam_servant); -} - -void ExecutionManager_Impl::PreparePlanCompletionHandler::handle_exception (CORBA::Exception* local_ex) -{ - this->em_servant_->fail_preparePlan (this->em_rh_.in (), - local_ex); -} - -ExecutionManager_Impl::DestroyManagerCompletionHandler::DestroyManagerCompletionHandler ( - ExecutionManager_Impl *em_servant, - ::Deployment::AMH_ExecutionManagerResponseHandler_ptr _tao_rh, - DomainApplicationManager_Impl* dam_servant) - : em_servant_ (ExecutionManager_Impl_var::_duplicate (em_servant)), - em_rh_ (::Deployment::AMH_ExecutionManagerResponseHandler::_duplicate (_tao_rh)), - dam_servant_ (DomainApplicationManager_Impl_var::_duplicate (dam_servant)) -{ -} - -void ExecutionManager_Impl::DestroyManagerCompletionHandler::handle_completion ( - DomainApplicationManager_Impl * /*dam_servant*/) -{ - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_INFO, DLINFO - ACE_TEXT("ExecutionManager_Impl::DestroyManagerCompletionHandler::handle_completion - ") - ACE_TEXT("finished\n"))); - em_rh_->destroyManager (); -} - -void ExecutionManager_Impl::DestroyManagerCompletionHandler::handle_exception ( - CORBA::Exception* local_ex) -{ - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("ExecutionManager_Impl::DestroyManagerCompletionHandler::handle_exception - ") - ACE_TEXT("propagating exception\n"))); - ::Deployment::AMH_ExecutionManagerExceptionHolder amh_exholder (local_ex); - em_rh_->destroyManager_excep (&amh_exholder); -} diff --git a/DAnCE/dance/ExecutionManager/ExecutionManager_Impl.h b/DAnCE/dance/ExecutionManager/ExecutionManager_Impl.h deleted file mode 100644 index ad163242808..00000000000 --- a/DAnCE/dance/ExecutionManager/ExecutionManager_Impl.h +++ /dev/null @@ -1,113 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file ExecutionManager_Impl.h - * - * @brief Implementation of Deployment::ExecutionManager and POA_DAnCE::ExecutionManagerDaemon - * - * @author Erwin Gottlieb <eg@prismtech.com> - */ -//============================================================================= - -#ifndef EXECUTIONMANAGER_IMPL_H_ -#define EXECUTIONMANAGER_IMPL_H_ - -#include "ace/Map_Manager.h" -#include "ace/SStringfwd.h" -#include "orbsvcs/orbsvcs/CosNamingC.h" -#include "dance/Deployment/Deployment_ExecutionManagerS.h" -#include "dance/Deployment/Deployment_NodeManagerC.h" -#include "dance/DomainApplicationManager/DomainApplicationManager_Impl.h" -#include "dance/DomainApplicationManager/Node_Locator.h" -#include "Completion/CompletionHandler_T.h" -#include "Completion/Completion_Counter_Base.h" - -namespace DAnCE - { - class ExecutionManager_Impl; - - typedef PortableServer::Servant_var<ExecutionManager_Impl> ExecutionManager_Impl_var; - - class ExecutionManager_Impl - : public virtual POA_Deployment::AMH_ExecutionManager - { - public: - ExecutionManager_Impl (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - CosNaming::NamingContext_ptr); - - virtual ~ExecutionManager_Impl(void); - - virtual void preparePlan ( - ::Deployment::AMH_ExecutionManagerResponseHandler_ptr _tao_rh, - const ::Deployment::DeploymentPlan & plan, - ::Deployment::ResourceCommitmentManager_ptr resourceCommitment); - - virtual void getManagers ( - ::Deployment::AMH_ExecutionManagerResponseHandler_ptr _tao_rh); - - virtual void destroyManager ( - ::Deployment::AMH_ExecutionManagerResponseHandler_ptr _tao_rh, - ::Deployment::DomainApplicationManager_ptr manager); - - void add_node_manager (const char *name, const char *ior); - - void load_cdd (const ACE_TCHAR *filename); - - class PreparePlanCompletionHandler - : public CompletionHandler<DomainApplicationManager_Impl> - { - public: - PreparePlanCompletionHandler ( - ExecutionManager_Impl *em_servant, - ::Deployment::AMH_ExecutionManagerResponseHandler_ptr _tao_rh); - - virtual void handle_completion (DomainApplicationManager_Impl *dam_servant); - virtual void handle_exception (CORBA::Exception* local_ex); - - private: - ExecutionManager_Impl_var em_servant_; - ::Deployment::AMH_ExecutionManagerResponseHandler_var em_rh_; - }; - - class DestroyManagerCompletionHandler - : public CompletionHandler<DomainApplicationManager_Impl> - { - public: - DestroyManagerCompletionHandler ( - ExecutionManager_Impl *em_servant, - ::Deployment::AMH_ExecutionManagerResponseHandler_ptr _tao_rh, - DomainApplicationManager_Impl* dam_servant); - - virtual void handle_completion (DomainApplicationManager_Impl *dam_servant); - virtual void handle_exception (CORBA::Exception* local_ex); - - private: - ExecutionManager_Impl_var em_servant_; - ::Deployment::AMH_ExecutionManagerResponseHandler_var em_rh_; - DomainApplicationManager_Impl_var dam_servant_; - }; - - private: - void finish_preparePlan ( - ::Deployment::AMH_ExecutionManagerResponseHandler_ptr _tao_rh, - DomainApplicationManager_Impl *dam_servant); - void fail_preparePlan ( - ::Deployment::AMH_ExecutionManagerResponseHandler_ptr _tao_rh, - CORBA::Exception* local_ex); - - friend class PreparePlanCompletionHandler; - - typedef ACE_Map_Manager< - ACE_CString, - DomainApplicationManager_Impl*, - ACE_Null_Mutex> TDomainManagers; - CORBA::ORB_var orb_; - PortableServer::POA_var poa_; - TDomainManagers managers_; - Node_Locator locator_; - }; -}//DAnCE - -#endif /*EXECUTIONMANAGER_IMPL_H_*/ diff --git a/DAnCE/dance/ExecutionManager/ExecutionManager_Module.cpp b/DAnCE/dance/ExecutionManager/ExecutionManager_Module.cpp deleted file mode 100644 index 05696e1d2b8..00000000000 --- a/DAnCE/dance/ExecutionManager/ExecutionManager_Module.cpp +++ /dev/null @@ -1,387 +0,0 @@ -// -*- C++ -*- -#include "ace/Get_Opt.h" -#include "ace/OS_NS_stdio.h" -#include "tao/StringSeqC.h" -#include "tao/IORTable/IORTable.h" -#include "tao/Utils/PolicyList_Destroyer.h" -#include "orbsvcs/CosNamingC.h" -#include "ExecutionManager_Module.h" -#include "ExecutionManager_Impl.h" -#include "dance/Logger/Log_Macros.h" - -namespace DAnCE -{ - namespace ExecutionManager - { - bool - write_IOR (const ACE_TCHAR * ior_file_name, const char* ior) - { - FILE* ior_output_file_ = - ACE_OS::fopen (ior_file_name, ACE_TEXT("w")); - - if (ior_output_file_) - { - ACE_OS::fprintf (ior_output_file_, - "%s", - ior); - ACE_OS::fclose (ior_output_file_); - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("ExectionManager::write_IOR - EM's ior was written into file \"%C\"\n"), ior_file_name)); - return true; - } - else - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, - ACE_TEXT("[%M%] DAnCE_ExecutionManager::write_ior-file - ") - ACE_TEXT("Unable to open ExecutionManager IOR output file %C : %m\n"), - ior_file_name)); - return false; - } - return true; - } - } -} - -DAnCE_ExecutionManager_Module::DAnCE_ExecutionManager_Module (void) - : em_impl_ (0) -{ -} - -DAnCE_ExecutionManager_Module::~DAnCE_ExecutionManager_Module (void) -{ - delete this->em_impl_; -} - -bool -DAnCE_ExecutionManager_Module::parse_args (int argc, ACE_TCHAR *argv[]) -{ - DANCE_TRACE ("DAnCE_ExecutionManager_Module::parse_args"); - - ACE_Get_Opt get_opts (argc, - argv, - "n:e::p::c::r::ifh", - 0, - 0, - 0, - ACE_Get_Opt::RETURN_IN_ORDER); - - get_opts.long_option (ACE_TEXT("exec-mgr"), 'e', ACE_Get_Opt::ARG_OPTIONAL); - get_opts.long_option (ACE_TEXT("node-mgr"), 'n', ACE_Get_Opt::ARG_REQUIRED); - get_opts.long_option (ACE_TEXT("process-ns"), 'p', ACE_Get_Opt::ARG_OPTIONAL); - get_opts.long_option (ACE_TEXT("create-plan-ns"), 'c', ACE_Get_Opt::ARG_OPTIONAL); - get_opts.long_option (ACE_TEXT("rebind-plan-ns"), 'r', ACE_Get_Opt::ARG_OPTIONAL); - get_opts.long_option (ACE_TEXT("port-indirection"), 'i', ACE_Get_Opt::NO_ARG); - get_opts.long_option (ACE_TEXT("ignore-failure"), 'f', ACE_Get_Opt::NO_ARG); - get_opts.long_option (ACE_TEXT("help"), 'h', ACE_Get_Opt::NO_ARG); - get_opts.long_option (ACE_TEXT("domain-nc"), ACE_Get_Opt::ARG_REQUIRED); - get_opts.long_option (ACE_TEXT("cdd"), ACE_Get_Opt::ARG_REQUIRED); - - - - //get_opts.long_option ("help", '?'); - - int c; - while ( (c = get_opts ()) != -1) - { - switch (c) - { - case 'e': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_TRACE, DLINFO ACE_TEXT("DAnCE_ExecutionManager_Module::parse_args - ") - ACE_TEXT("Output filename is %s\n"), - get_opts.opt_arg ())); - this->options_.exec_mgr_file_ = get_opts.opt_arg (); - break; - case 'n': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE_ExecutionManager_Module::parse_args - ") - ACE_TEXT("--node-mgr option was parsed out for EM\n"))); - this->options_.node_managers_.push_back (get_opts.opt_arg ()); - break; - - case 'p': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE_ExecutionManager_Module::parse_args - ") - ACE_TEXT("--process-ns enabled for EM\n"))); - this->options_.process_ns_ = true; - this->options_.process_ns_file_ = get_opts.opt_arg (); - break; - - case 'c': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE_ExecutionManager_Module::parse_args - ") - ACE_TEXT("--create-plan-ns enabled for EM\n"))); - this->options_.create_plan_ns_ = true; - this->options_.create_plan_ns_ior_ = get_opts.opt_arg (); - break; - - case 'r': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE_ExecutionManager_Module::parse_args - ") - ACE_TEXT("--rebind-plan-ns enabled for EM\n"))); - this->options_.rebind_plan_ns_ = true; - this->options_.rebind_plan_ns_ior_ = get_opts.opt_arg (); - break; - - case 'i': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE_ExecutionManager_Module::parse_args - ") - ACE_TEXT("--port-indirection enabled for EM\n"))); - this->options_.port_indirection_ = true; - break; - - case 'f': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE_ExecutionManager_Module::parse_args - ") - ACE_TEXT("--ignore-failure enabled for EM\n"))); - this->options_.ignore_failure_ = true; - break; - - case 0: - if (ACE_OS::strcmp (get_opts.long_option (), - ACE_TEXT("domain-nc")) == 0) - { - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT("Node_Manager_Module::parse_args - ") - ACE_TEXT("Binding to domain naming context %s.\n"), - get_opts.opt_arg ())); - this->options_.domain_nc_ = get_opts.opt_arg (); - break; - } - else if (ACE_OS::strcmp (get_opts.long_option (), - ACE_TEXT("cdd")) == 0) - { - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT("Node_Manager_Module::parse_args - ") - ACE_TEXT("Found Node map filename %s.\n"), - get_opts.opt_arg ())); - this->options_.cdd_ = get_opts.opt_arg (); - break; - } - - case 'h': - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, - "usage: %s\n" - "\t--exec-mgr,-e [execution manager ior file name]\n" - "\t--node-mgr,-n <node name>[=node manager ior file name]\n" - "\t--domain-nc <nc ior> \t\tIOR for the Domain Naming Context\n" - //"-p|--process-ns [file name] \t\tcreate process name service and store its ior to file name\n" - //"-c|--create-plan-ns [NC] \t\tcreate plan objects (components and ports) representation in name context with ior NC\n" - //"-r|--rebind-plan-ns [NC] \t\tbind plan representation name context to NC\n" - //"-i \t\t\t\tenable plan objects indirection via servant locator\n", - ,argv [0])); - return false; - break; - } - } - return true; -} - -CORBA::Object_ptr -DAnCE_ExecutionManager_Module::init (CORBA::ORB_ptr orb, - int argc, - ACE_TCHAR *argv[]) -{ - DANCE_TRACE ("DAnCE_ExecutionManager_Module::init"); - - try - { - if (this->em_impl_ != 0) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, - DLINFO ACE_TEXT("DAnCE_ExecutionManager_Module::init - ") - ACE_TEXT("Error: ExecutionManager already exists.\n"))); - return CORBA::Object::_nil (); - } - - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE_ExecutionManager_Module::init - ") - ACE_TEXT("before parsing arguments.\n"))); - - if (!this->parse_args (argc, argv)) - return CORBA::Object::_nil (); - - // Get reference to Root POA. - CORBA::Object_var poa_obj - = orb->resolve_initial_references ("RootPOA"); - - PortableServer::POA_var poa - = PortableServer::POA::_narrow (poa_obj.in ()); - - PortableServer::POAManager_var mgr = poa->the_POAManager (); - PortableServer::POA_var persistent_poa; - TAO::Utils::PolicyList_Destroyer policies (2); - policies.length (2); - try - { - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE_ExecutionManager_Module::init - ") - ACE_TEXT("before creating the \"Managers\" POA.\n"))); - - policies[0] = poa->create_id_assignment_policy (PortableServer::USER_ID); - policies[1] = poa->create_lifespan_policy (PortableServer::PERSISTENT); - persistent_poa = poa->create_POA ("Managers", - mgr.in(), - policies); - } - catch (const PortableServer::POA::AdapterAlreadyExists &) - { - persistent_poa = poa->find_POA ("Managers", 0); - } - - CosNaming::NamingContext_var domain_nc; - - // Resolve DomainNC - try - { - if (this->options_.domain_nc_) - { - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE_ExecutionManager_Module::init - ") - ACE_TEXT("before resolving \"DomainNC\".\n"))); - CORBA::Object_var domain_obj = orb->string_to_object (this->options_.domain_nc_); - if (!CORBA::is_nil (domain_obj.in ())) - { - domain_nc = CosNaming::NamingContext::_narrow (domain_obj.in()); - if (CORBA::is_nil (domain_nc.in ())) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Narrow to NamingContext return nil for DomainNC.\n"))); - return CORBA::Object::_nil (); - } - } - } - } - catch (const CORBA::Exception&) - { - DANCE_DEBUG (DANCE_LOG_NONFATAL_ERROR, - (LM_DEBUG, - DLINFO ACE_TEXT("DomainNC context not found!\n"))); - } - - // Initialize IOR table - CORBA::Object_var table_object - = orb->resolve_initial_references ("IORTable"); - - IORTable::Table_var adapter - = IORTable::Table::_narrow (table_object.in ()); - - if (CORBA::is_nil (adapter.in ())) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, - DLINFO ACE_TEXT("Nil IORTable\n"))); - return CORBA::Object::_nil (); - } - - // Create and install the DAnCE Daemon servant on child POA - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE_ExecutionManager_Module::init - before creating EM servant.\n"))); - ACE_NEW_RETURN (this->em_impl_, - DAnCE::ExecutionManager_Impl (orb, - poa.in (), - domain_nc.in ()), - CORBA::Object::_nil ()); - - // Explicit activation through the persistent POA - PortableServer::ObjectId_var oid = - PortableServer::string_to_ObjectId ("ExecutionManager"); - persistent_poa->activate_object_with_id (oid, this->em_impl_); - - CORBA::Object_var em_obj = persistent_poa->id_to_reference (oid.in ()); - CORBA::String_var em_ior = orb->object_to_string (em_obj.in ()); - - Deployment::ExecutionManager_var em_daemon - = Deployment::ExecutionManager::_narrow (em_obj.in ()); - - // Binding ior to IOR Table - adapter->bind ("ExecutionManager", em_ior.in ()); - - // End ExecutionManager initialization part - - // Initializing NodeManagers - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE_ExecutionManager_Module::init - ") - ACE_TEXT("before processing --node-mgr options(%u).\n"), - this->options_.node_managers_.size())); - - for (size_t i = 0; i < this->options_.node_managers_.size(); ++i) - { - size_t const pos = this->options_.node_managers_[i].find ('='); - ACE_TString node_name = this->options_.node_managers_[i]; - ACE_TString nm_ior; - - if (ACE_CString::npos == pos) - { - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("DAnCE_ExecutionManager_Module::init - ") - ACE_TEXT("Execution manager received --node-mgr without IOR\n"))); - continue; - } - - node_name = this->options_.node_managers_[i].substring (0, pos); - nm_ior = this->options_.node_managers_[i].substring (pos + 1); - - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_TRACE, DLINFO - ACE_TEXT("Placing node \"%s\" to EM's map.\n"), node_name.c_str())); - this->em_impl_->add_node_manager (ACE_TEXT_ALWAYS_CHAR(node_name.c_str()), ACE_TEXT_ALWAYS_CHAR(nm_ior.c_str ())); - } - - if (this->options_.cdd_ != 0) - { - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE_ExecutionManager_Module::init - ") - ACE_TEXT("Parsing cdd file %C\n"), - this->options_.cdd_)); - this->em_impl_->load_cdd (this->options_.cdd_); - } - - mgr->activate (); - - // Saving execution manager ior - if (0 != this->options_.exec_mgr_file_) - { - DAnCE::ExecutionManager::write_IOR (this->options_.exec_mgr_file_, em_ior.in ()); - } - - // Binding execution manager to name service - if (!CORBA::is_nil (domain_nc.in ())) - { - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_TRACE, DLINFO ACE_TEXT("Registering EM in NC.\n"))); - CosNaming::Name name (1); - name.length (1); - name[0].id = CORBA::string_dup ("ExecutionManager"); - domain_nc->rebind (name, em_daemon.in()); - } - - return em_obj._retn (); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("DAnCE_ExecutionManager::run_main\n"); - return CORBA::Object::_nil (); - } -} - diff --git a/DAnCE/dance/ExecutionManager/ExecutionManager_Module.h b/DAnCE/dance/ExecutionManager/ExecutionManager_Module.h deleted file mode 100644 index 33182fc90f2..00000000000 --- a/DAnCE/dance/ExecutionManager/ExecutionManager_Module.h +++ /dev/null @@ -1,90 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file ExecutionManager_Module.h - * - * @brief - * - * @author Vinzenz Tornow <vt@prismtech.com> - */ -//============================================================================= - -#ifndef EXECUTION_MANAGER_MODULE_H -#define EXECUTION_MANAGER_MODULE_H - -#include /**/ "ace/pre.h" - -#include "ace/Vector_T.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -namespace DAnCE -{ - class ExecutionManager_Impl; -} - -/** - * @class Execution_Manager_Module - * - * This class implements the execution manager instance - */ -class DAnCE_ExecutionManager_Module - { - public: - /// Constructor. - DAnCE_ExecutionManager_Module (void); - - /// Destructor. - ~DAnCE_ExecutionManager_Module (void); - - /// Setup our infrastructure - CORBA::Object_ptr init (CORBA::ORB_ptr orb, - int argc, - ACE_TCHAR *argv []); - - private: - bool parse_args (int argc, ACE_TCHAR *argv []); - - struct SOptions - { - const ACE_TCHAR* exec_mgr_file_; - bool process_ns_; - const ACE_TCHAR* process_ns_file_; - bool create_plan_ns_; - const ACE_TCHAR* create_plan_ns_ior_; - bool rebind_plan_ns_; - const ACE_TCHAR* rebind_plan_ns_ior_; - bool port_indirection_; - ACE_Vector<ACE_TString> node_managers_; - bool ignore_failure_; - const ACE_TCHAR *domain_nc_; - const ACE_TCHAR *cdd_; - - SOptions() - : exec_mgr_file_ (0), - process_ns_ (false), - process_ns_file_ (0), - create_plan_ns_ (false), - create_plan_ns_ior_ (0), - rebind_plan_ns_ (false), - rebind_plan_ns_ior_ (0), - ignore_failure_ (false), - domain_nc_ (0), - cdd_ (0) - { - } - }; - - SOptions options_; - - /// Storage for ExecutionManager servant. - DAnCE::ExecutionManager_Impl * em_impl_; - }; - -#include /**/ "ace/post.h" - -#endif /* EXECUTION_MANAGER_MODULE_H */ - diff --git a/DAnCE/dance/ExecutionManager/Execution_Manager.cpp b/DAnCE/dance/ExecutionManager/Execution_Manager.cpp deleted file mode 100644 index 14eafe9429e..00000000000 --- a/DAnCE/dance/ExecutionManager/Execution_Manager.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "ace/Dynamic_Service.h" -#include "tao/ORB.h" -#include "tao/Object.h" -#include "dance/Logger/Log_Macros.h" -#include "dance/Logger/Logger_Service.h" -#include "ExecutionManager_Module.h" - -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - DANCE_DISABLE_TRACE (); - - int retval = 0; - - try - { - CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); - - DAnCE::Logger_Service - * dlf = ACE_Dynamic_Service<DAnCE::Logger_Service>::instance ("DAnCE_Logger"); - - if (dlf) - { - dlf->init (argc, argv); - } - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("ExecutionManager - initializing module instance\n"))); - - DAnCE_ExecutionManager_Module em; - CORBA::Object_var obj = em.init (orb.in (), argc, argv); - - if (!CORBA::is_nil (obj.in ())) - { - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("ExecutionManager - running ORB\n"))); - orb->run (); - } - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("ExecutionManager - destroying ORB\n"))); - - orb->destroy (); - } - catch (const CORBA::Exception& ex) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_EMERGENCY, DLINFO - "ExecutionManager - Caught CORBA Exception: %C\n", - ex._info ().c_str ())); - retval = -1; - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, - "ExecutionManager - Error: Unknown exception.\n")); - retval = -1; - } - - return retval; -} - diff --git a/DAnCE/dance/LocalityManager/Configuration/CPU_Affinity.cpp b/DAnCE/dance/LocalityManager/Configuration/CPU_Affinity.cpp deleted file mode 100644 index 72ec2f30d04..00000000000 --- a/DAnCE/dance/LocalityManager/Configuration/CPU_Affinity.cpp +++ /dev/null @@ -1,120 +0,0 @@ -#include "CPU_Affinity.h" -#include "dance/DAnCE_PropertiesC.h" -#include "dance/Deployment/Deployment_StartErrorC.h" -#include "dance/Logger/Log_Macros.h" -#include "ace/os_include/os_sched.h" -#include "ace/Auto_Ptr.h" -#include "ace/Tokenizer_T.h" -#include "ace/OS_NS_unistd.h" -#include <sstream> - -namespace DAnCE -{ - CPU_Affinity::CPU_Affinity (void) - { - } - - // Implementation skeleton destructor - CPU_Affinity::~CPU_Affinity (void) - { - } - - char * CPU_Affinity::type (void) - { - return CORBA::string_dup (DAnCE::DANCE_LM_CPUAFFINITY); - } - - void CPU_Affinity::configure (const ::Deployment::Property & prop) - { -#if defined (ACE_HAS_SCHED_SETAFFINITY) - const char *extracted_affinity = 0; - - if (! (prop.value >>= CORBA::Any::to_string (extracted_affinity, 0))) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("CPU_Affinity::configure - ") - ACE_TEXT ("Unable to extract CPU affinity string"))); - throw ::Deployment::StartError (prop.name.in (), - "Unable to extract CPU affinity string"); - } - - char *affinity = ACE_OS::strdup (extracted_affinity); - - ACE_Tokenizer_T<char> tokenizer(affinity); - tokenizer.delimiter (','); - - char *token = 0; - cpu_set_t mask; - - CPU_ZERO (&mask); - - while ((token = tokenizer.next ())) - { - int i = ACE_OS::atoi (token); - - if (i >= 0) - { - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT ("CPU_Affinity::configure - ") - ACE_TEXT ("Toggling affinity for CPU %i\n"), - i)); - CPU_SET (i, &mask); - } - else - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("CPU_Affinity::configure - ") - ACE_TEXT ("All affinity values should be greater than 0"))); - throw ::Deployment::StartError (prop.name.in (), - "All affinity values should be greater than 0"); - } - } - - ACE_OS::free (affinity); - - pid_t const pid = ACE_OS::getpid (); - - int retval = ::sched_setaffinity (pid, - sizeof (cpu_set_t), - &mask); - - if (retval != 0) - { - std::stringstream str; - ACE_Auto_Basic_Array_Ptr<char> safe_error (ACE_OS::strerror (ACE_OS::last_error ())); - - str << "Unable to set CPU affinity to <" << affinity << ">: " - << safe_error.get (); - std::string message = str.str (); - - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("CPU_Affinity::configure - %C\n"), - message.c_str ())); - - throw ::Deployment::StartError (prop.name.in (), - message.c_str ()); - } -#else - throw ::Deployment::StartError (prop.name.in (), - "CPU Affinity not supported on this platform"); -#endif - } -} - -extern "C" -{ - DAnCE::LocalityConfiguration_ptr create_CPU_Affinity (void) - { - DAnCE::LocalityConfiguration_ptr retval (0); - - ACE_NEW_RETURN (retval, - DAnCE::CPU_Affinity (), - 0); - - return retval; - } -} diff --git a/DAnCE/dance/LocalityManager/Configuration/CPU_Affinity.h b/DAnCE/dance/LocalityManager/Configuration/CPU_Affinity.h deleted file mode 100644 index bcef3771485..00000000000 --- a/DAnCE/dance/LocalityManager/Configuration/CPU_Affinity.h +++ /dev/null @@ -1,46 +0,0 @@ -// -*- C++ -*- -/** - * @file CPU_Affinity.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - * - * A simple configuration plugin that will change the process - * name as represented by PS. It is only functional on Linux - */ - -#ifndef CPU_AFFINITY_H -#define CPU_AFFINITY_H - -#include /**/ "ace/pre.h" - -#include "dance/DAnCE_LocalityManagerC.h" -#include "tao/LocalObject.h" - -#include "CPU_Affinity_export.h" - -namespace DAnCE -{ - class CPU_Affinity_Export CPU_Affinity - : public virtual DAnCE::LocalityConfiguration, - public virtual ::CORBA::LocalObject - { - public: - // Constructor - CPU_Affinity (void); - - // Destructor - virtual ~CPU_Affinity (void); - - virtual char * type (void); - - virtual void configure (const ::Deployment::Property & prop); - }; -} - -extern "C" -{ - DAnCE::LocalityConfiguration_ptr - CPU_Affinity_Export create_CPU_Affinity (void); -} -#include /**/ "ace/post.h" - -#endif diff --git a/DAnCE/dance/LocalityManager/Configuration/CPU_Affinity_export.h b/DAnCE/dance/LocalityManager/Configuration/CPU_Affinity_export.h deleted file mode 100644 index 94d2f0cdaf8..00000000000 --- a/DAnCE/dance/LocalityManager/Configuration/CPU_Affinity_export.h +++ /dev/null @@ -1,55 +0,0 @@ -// -*- C++ -*- -// Definition for Win32 Export directives. -// ------------------------------ -#ifndef CPU_AFFINITY_EXPORT_H -#define CPU_AFFINITY_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (CPU_AFFINITY_HAS_DLL) -# define CPU_AFFINITY_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && CPU_AFFINITY_HAS_DLL */ - -#if !defined (CPU_AFFINITY_HAS_DLL) -# define CPU_AFFINITY_HAS_DLL 1 -#endif /* ! CPU_AFFINITY_HAS_DLL */ - -#if defined (CPU_AFFINITY_HAS_DLL) && (CPU_AFFINITY_HAS_DLL == 1) -# if defined (CPU_AFFINITY_BUILD_DLL) -# define CPU_Affinity_Export ACE_Proper_Export_Flag -# define CPU_AFFINITY_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define CPU_AFFINITY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* CPU_AFFINITY_BUILD_DLL */ -# define CPU_Affinity_Export ACE_Proper_Import_Flag -# define CPU_AFFINITY_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define CPU_AFFINITY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* CPU_AFFINITY_BUILD_DLL */ -#else /* CPU_AFFINITY_HAS_DLL == 1 */ -# define CPU_Affinity_Export -# define CPU_AFFINITY_SINGLETON_DECLARATION(T) -# define CPU_AFFINITY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* CPU_AFFINITY_HAS_DLL == 1 */ - -// Set CPU_AFFINITY_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (CPU_AFFINITY_NTRACE) -# if (ACE_NTRACE == 1) -# define CPU_AFFINITY_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define CPU_AFFINITY_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !CPU_AFFINITY_NTRACE */ - -#if (CPU_AFFINITY_NTRACE == 1) -# define CPU_AFFINITY_TRACE(X) -#else /* (CPU_AFFINITY_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define CPU_AFFINITY_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (CPU_AFFINITY_NTRACE == 1) */ - -#endif /* CPU_AFFINITY_EXPORT_H */ - -// End of auto generated file. diff --git a/DAnCE/dance/LocalityManager/Configuration/Configuration.mpc b/DAnCE/dance/LocalityManager/Configuration/Configuration.mpc deleted file mode 100644 index 82d1f63e759..00000000000 --- a/DAnCE/dance/LocalityManager/Configuration/Configuration.mpc +++ /dev/null @@ -1,19 +0,0 @@ -project (DAnCE_LM_Config_Plugins) : install, dance_deployment_stub, dance_stub, dance_lib, dance_output { - dynamicflags += PROCESS_NAME_BUILD_DLL CPU_AFFINITY_BUILD_DLL PROCESS_PRIORITY_BUILD_DLL - - Source_Files { - Process_Name.cpp - Process_Priority.cpp - CPU_Affinity.cpp - } - - Header_Files { - Process_Name.h - Process_Priority.h - CPU_Affinity.h - } - - specific { - install_dir = dance/LocalityManager/Configuration - } -} diff --git a/DAnCE/dance/LocalityManager/Configuration/Process_Name.cpp b/DAnCE/dance/LocalityManager/Configuration/Process_Name.cpp deleted file mode 100644 index c6cd4d5d63d..00000000000 --- a/DAnCE/dance/LocalityManager/Configuration/Process_Name.cpp +++ /dev/null @@ -1,110 +0,0 @@ -#include "Process_Name.h" -#include "dance/DAnCE_PropertiesC.h" -#include "dance/Deployment/Deployment_StartErrorC.h" - -#include "dance/Logger/Log_Macros.h" - -#if defined (LINUX_VERSION_CODE) && defined (KERNEL_VERSION) -# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,9)) -#include <sys/prctl.h> -#include <sstream> - -#include "ace/Auto_Ptr.h" - -#endif -#endif - -namespace DAnCE -{ - Process_Name::Process_Name (void) - { - } - - // Implementation skeleton destructor - Process_Name::~Process_Name (void) - { - } - - char * Process_Name::type (void) - { - return CORBA::string_dup (DAnCE::DANCE_LM_PROCESSNAME); - } - - void Process_Name::configure (const ::Deployment::Property & prop) - { -#if defined (LINUX_VERSION_CODE) && defined (KERNEL_VERSION) -# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,9)) - const char *pname; - - if (! (prop.value >>= CORBA::Any::to_string (pname, 0))) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Process_Name::configure - ") - ACE_TEXT ("Unable to extract process name string"))); - throw ::Deployment::StartError (prop.name.in (), - "Unable to extract process name string"); - } - unsigned long arg (0); - - ACE_Auto_Basic_Array_Ptr<char> safe_array; - - if (!(ACE_OS::strlen (pname) <= 16)) - { - char *tmp (0); - ACE_NEW_THROW_EX (tmp, - char[16], - CORBA::NO_MEMORY ()); - - safe_array.reset (tmp); - - ACE_OS::strncpy (tmp, pname, 15); - tmp[15] = '\0'; - - arg = reinterpret_cast<unsigned long> (tmp); - } - else - arg = reinterpret_cast<unsigned long> (pname); - - int const retval = ::prctl (PR_SET_NAME, arg); - - if (retval != 0) - { - std::stringstream str; - ACE_Auto_Basic_Array_Ptr<char> safe_error (ACE_OS::strerror (ACE_OS::last_error ())); - - str << "Unable to set process name to <" << pname << ">: " - << safe_error.get (); - std::string message = str.str (); - - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Process_Name::configure - %C\n"), - message.c_str ())); - - throw ::Deployment::StartError (prop.name, - message.c_str ()); - } - - return; -#endif -#endif - - throw ::Deployment::StartError (prop.name, - "Setting process name not supported on this platform"); - } -} - -extern "C" -{ - DAnCE::LocalityConfiguration_ptr create_Process_Name (void) - { - DAnCE::LocalityConfiguration_ptr retval (0); - - ACE_NEW_RETURN (retval, - DAnCE::Process_Name (), - 0); - - return retval; - } -} diff --git a/DAnCE/dance/LocalityManager/Configuration/Process_Name.h b/DAnCE/dance/LocalityManager/Configuration/Process_Name.h deleted file mode 100644 index 9f234fa237f..00000000000 --- a/DAnCE/dance/LocalityManager/Configuration/Process_Name.h +++ /dev/null @@ -1,46 +0,0 @@ -// -*- C++ -*- -/** - * @file Process_Name.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - * - * A simple configuration plugin that will change the process - * name as represented by PS. It is only functional on Linux - */ - -#ifndef PROCESS_NAME_H -#define PROCESS_NAME_H - -#include /**/ "ace/pre.h" - -#include "dance/DAnCE_LocalityManagerC.h" -#include "tao/LocalObject.h" - -#include "Process_Name_export.h" - -namespace DAnCE -{ - class Process_Name_Export Process_Name - : public virtual DAnCE::LocalityConfiguration, - public virtual ::CORBA::LocalObject - { - public: - // Constructor - Process_Name (void); - - // Destructor - virtual ~Process_Name (void); - - virtual char * type (void); - - virtual void configure (const ::Deployment::Property & prop); - }; -} - -extern "C" -{ - DAnCE::LocalityConfiguration_ptr - Process_Name_Export create_Process_Name (void); -} -#include /**/ "ace/post.h" - -#endif diff --git a/DAnCE/dance/LocalityManager/Configuration/Process_Name_export.h b/DAnCE/dance/LocalityManager/Configuration/Process_Name_export.h deleted file mode 100644 index cce0e07d339..00000000000 --- a/DAnCE/dance/LocalityManager/Configuration/Process_Name_export.h +++ /dev/null @@ -1,55 +0,0 @@ -// -*- C++ -*- -// Definition for Win32 Export directives. -// ------------------------------ -#ifndef PROCESS_NAME_EXPORT_H -#define PROCESS_NAME_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (PROCESS_NAME_HAS_DLL) -# define PROCESS_NAME_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && PROCESS_NAME_HAS_DLL */ - -#if !defined (PROCESS_NAME_HAS_DLL) -# define PROCESS_NAME_HAS_DLL 1 -#endif /* ! PROCESS_NAME_HAS_DLL */ - -#if defined (PROCESS_NAME_HAS_DLL) && (PROCESS_NAME_HAS_DLL == 1) -# if defined (PROCESS_NAME_BUILD_DLL) -# define Process_Name_Export ACE_Proper_Export_Flag -# define PROCESS_NAME_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define PROCESS_NAME_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* PROCESS_NAME_BUILD_DLL */ -# define Process_Name_Export ACE_Proper_Import_Flag -# define PROCESS_NAME_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define PROCESS_NAME_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* PROCESS_NAME_BUILD_DLL */ -#else /* PROCESS_NAME_HAS_DLL == 1 */ -# define Process_Name_Export -# define PROCESS_NAME_SINGLETON_DECLARATION(T) -# define PROCESS_NAME_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* PROCESS_NAME_HAS_DLL == 1 */ - -// Set PROCESS_NAME_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (PROCESS_NAME_NTRACE) -# if (ACE_NTRACE == 1) -# define PROCESS_NAME_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define PROCESS_NAME_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !PROCESS_NAME_NTRACE */ - -#if (PROCESS_NAME_NTRACE == 1) -# define PROCESS_NAME_TRACE(X) -#else /* (PROCESS_NAME_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define PROCESS_NAME_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (PROCESS_NAME_NTRACE == 1) */ - -#endif /* PROCESS_NAME_EXPORT_H */ - -// End of auto generated file. diff --git a/DAnCE/dance/LocalityManager/Configuration/Process_Priority.cpp b/DAnCE/dance/LocalityManager/Configuration/Process_Priority.cpp deleted file mode 100644 index ec7e9a3b5e9..00000000000 --- a/DAnCE/dance/LocalityManager/Configuration/Process_Priority.cpp +++ /dev/null @@ -1,82 +0,0 @@ -#include "Process_Priority.h" -#include "dance/DAnCE_PropertiesC.h" -#include "dance/Deployment/Deployment_StartErrorC.h" - -#include "dance/Logger/Log_Macros.h" - -#include <sstream> -#include "ace/Auto_Ptr.h" - -namespace DAnCE -{ - Process_Priority::Process_Priority (void) - { - } - - // Implementation skeleton destructor - Process_Priority::~Process_Priority (void) - { - } - - char * Process_Priority::type (void) - { - return CORBA::string_dup (DAnCE::DANCE_LM_PROCESSPRIORITY); - } - - void Process_Priority::configure (const ::Deployment::Property & prop) - { - CORBA::Long prio; - - if (!(prop.value >>= prio)) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Process_Priority::configure - ") - ACE_TEXT ("Unable to extract priority value from config property\n"))); - throw ::Deployment::PlanError (prop.name.in (), - "Unable to extract priority value from config property."); - } - - ACE_hthread_t handle; - - ACE_OS::thr_self (handle); - - int retval = ACE_OS::thr_setprio (handle, - static_cast<int> (prio), - -1); - - if (retval != 0) - { - std::stringstream str; - const char * safe_error (ACE_OS::strerror (ACE_OS::last_error ())); - - str << "Unable to set process priority to <" << prio << ">: " - << safe_error; - std::string message = str.str (); - - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Process_Priority::configure - %C\n"), - message.c_str ())); - - throw ::Deployment::StartError (prop.name.in (), - message.c_str ()); - - } - - } -} - -extern "C" -{ - DAnCE::LocalityConfiguration_ptr create_Process_Priority (void) - { - DAnCE::LocalityConfiguration_ptr retval (0); - - ACE_NEW_RETURN (retval, - DAnCE::Process_Priority (), - 0); - - return retval; - } -} diff --git a/DAnCE/dance/LocalityManager/Configuration/Process_Priority.h b/DAnCE/dance/LocalityManager/Configuration/Process_Priority.h deleted file mode 100644 index d4d63398747..00000000000 --- a/DAnCE/dance/LocalityManager/Configuration/Process_Priority.h +++ /dev/null @@ -1,46 +0,0 @@ -// -*- C++ -*- -/** - * @file Process_Priority.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - * - * A simple configuration plugin that will change the process - * name as represented by PS. It is only functional on Linux - */ - -#ifndef PROCESS_PRIORITY_H -#define PROCESS_PRIORITY_H - -#include /**/ "ace/pre.h" - -#include "dance/DAnCE_LocalityManagerC.h" -#include "tao/LocalObject.h" - -#include "Process_Priority_export.h" - -namespace DAnCE -{ - class Process_Priority_Export Process_Priority - : public virtual DAnCE::LocalityConfiguration, - public virtual ::CORBA::LocalObject - { - public: - // Constructor - Process_Priority (void); - - // Destructor - virtual ~Process_Priority (void); - - virtual char * type (void); - - virtual void configure (const ::Deployment::Property & prop); - }; -} - -extern "C" -{ - DAnCE::LocalityConfiguration_ptr - Process_Priority_Export create_Process_Priority (void); -} -#include /**/ "ace/post.h" - -#endif diff --git a/DAnCE/dance/LocalityManager/Configuration/Process_Priority_export.h b/DAnCE/dance/LocalityManager/Configuration/Process_Priority_export.h deleted file mode 100644 index b9adc4dc66c..00000000000 --- a/DAnCE/dance/LocalityManager/Configuration/Process_Priority_export.h +++ /dev/null @@ -1,55 +0,0 @@ -// -*- C++ -*- -// Definition for Win32 Export directives. -// ------------------------------ -#ifndef PROCESS_PRIORITY_EXPORT_H -#define PROCESS_PRIORITY_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (PROCESS_PRIORITY_HAS_DLL) -# define PROCESS_PRIORITY_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && PROCESS_PRIORITY_HAS_DLL */ - -#if !defined (PROCESS_PRIORITY_HAS_DLL) -# define PROCESS_PRIORITY_HAS_DLL 1 -#endif /* ! PROCESS_PRIORITY_HAS_DLL */ - -#if defined (PROCESS_PRIORITY_HAS_DLL) && (PROCESS_PRIORITY_HAS_DLL == 1) -# if defined (PROCESS_PRIORITY_BUILD_DLL) -# define Process_Priority_Export ACE_Proper_Export_Flag -# define PROCESS_PRIORITY_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define PROCESS_PRIORITY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* PROCESS_PRIORITY_BUILD_DLL */ -# define Process_Priority_Export ACE_Proper_Import_Flag -# define PROCESS_PRIORITY_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define PROCESS_PRIORITY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* PROCESS_PRIORITY_BUILD_DLL */ -#else /* PROCESS_PRIORITY_HAS_DLL == 1 */ -# define Process_Priority_Export -# define PROCESS_PRIORITY_SINGLETON_DECLARATION(T) -# define PROCESS_PRIORITY_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* PROCESS_PRIORITY_HAS_DLL == 1 */ - -// Set PROCESS_PRIORITY_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (PROCESS_PRIORITY_NTRACE) -# if (ACE_NTRACE == 1) -# define PROCESS_PRIORITY_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define PROCESS_PRIORITY_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !PROCESS_PRIORITY_NTRACE */ - -#if (PROCESS_PRIORITY_NTRACE == 1) -# define PROCESS_PRIORITY_TRACE(X) -#else /* (PROCESS_PRIORITY_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define PROCESS_PRIORITY_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (PROCESS_PRIORITY_NTRACE == 1) */ - -#endif /* PROCESS_PRIORITY_EXPORT_H */ - -// End of auto generated file. diff --git a/DAnCE/dance/LocalityManager/Daemon/.gitignore b/DAnCE/dance/LocalityManager/Daemon/.gitignore deleted file mode 100644 index e21c6ebd399..00000000000 --- a/DAnCE/dance/LocalityManager/Daemon/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/dance_locality_manager diff --git a/DAnCE/dance/LocalityManager/Daemon/Locality_Manager.cpp b/DAnCE/dance/LocalityManager/Daemon/Locality_Manager.cpp deleted file mode 100644 index f6bd6239d6a..00000000000 --- a/DAnCE/dance/LocalityManager/Daemon/Locality_Manager.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/** - * @file Locality_Manager.cpp - * @author William R. Otte - * - * Implementation and main for the DAnCE LocalityManager - */ - -#include "Locality_Manager_Task.h" -#include "dance/Logger/Log_Macros.h" - -int ACE_TMAIN (int argc, ACE_TCHAR **argv) -{ - // Tracing disabled by default - DANCE_DISABLE_TRACE (); - - DANCE_TRACE ("LocalityManager::ACE_TMAIN"); - - int retval = 0; - try - { - DAnCE::LocalityManager_Task cs (argc, argv); - cs.run (); - - // Wait for the threads to exit. - //ACE_Thread_Manager::instance ()->wait (); - } - catch (const DAnCE::LocalityManager_Task::Error &e) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager main: Caught ComponentServer exception: %C\n"), - e.err_.c_str ())); - retval = -1; - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("LocalityManager main: Caught corba exception:"); - retval = -1; - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager main: Caught unknown exception.\n"))); - retval = -1; - } - - return retval; -} diff --git a/DAnCE/dance/LocalityManager/Daemon/Locality_Manager.mpc b/DAnCE/dance/LocalityManager/Daemon/Locality_Manager.mpc deleted file mode 100644 index acd01fa7874..00000000000 --- a/DAnCE/dance/LocalityManager/Daemon/Locality_Manager.mpc +++ /dev/null @@ -1,37 +0,0 @@ -project (DAnCE_LocalityManager_Impl) : dance_lib, dance_output, naming, \ - dance_skel, dance_logger, dance_deployment_scheduler, dance_deployment_scheduler, \ - install, dance_locality_handler { - - dynamicflags += LOCALITY_MANAGER_IMPL_BUILD_DLL - - Source_Files { - Locality_Manager_Impl.cpp - } - - Header_Files { - Locality_Manager_Impl.h - Locality_Manager_Impl_Export.h - } - - specific { - install_dir = dance/LocalityManager/Daemon - } -} - -project (DAnCE_LocalityManager_Exec) : dance_exe, dance_output, \ - dance_locality_manager, dance_logger, install { - exename = dance_locality_manager - - Source_Files { - Locality_Manager_Task.cpp - Locality_Manager.cpp - } - - specific { - install_dir = dance/LocalityManager/Daemon - } - - verbatim(gnuace, postinstall) { -" cp Locality_Manager_Task.cpp Locality_Manager.cpp Locality_Manager_Task.h $(INSTALL_PREFIX)/include/dance/LocalityManager/Daemon" - } -} diff --git a/DAnCE/dance/LocalityManager/Daemon/Locality_Manager_Impl.cpp b/DAnCE/dance/LocalityManager/Daemon/Locality_Manager_Impl.cpp deleted file mode 100644 index 32942a7e661..00000000000 --- a/DAnCE/dance/LocalityManager/Daemon/Locality_Manager_Impl.cpp +++ /dev/null @@ -1,1142 +0,0 @@ -// -*- C++ -*- -#include "Locality_Manager_Impl.h" -#include "dance/Logger/Log_Macros.h" - -#include "dance/DAnCE_Utility.h" -#include "dance/DAnCE_PropertiesC.h" -#include "dance/LocalityManager/Handler/Plugin_Conf.h" -#include "dance/LocalityManager/Scheduler/Plugin_Manager.h" -#include "dance/LocalityManager/Scheduler/Deployment_Completion.h" -#include "dance/LocalityManager/Scheduler/Events/Install.h" -#include "dance/LocalityManager/Scheduler/Events/Connect.h" -#include "dance/LocalityManager/Scheduler/Events/Endpoint.h" -#include "dance/LocalityManager/Scheduler/Events/Start.h" -#include "dance/LocalityManager/Scheduler/Events/Configured.h" -#include "dance/LocalityManager/Scheduler/Events/Remove.h" -#include "dance/LocalityManager/Scheduler/Events/Passivate.h" -#include "dance/LocalityManager/Scheduler/Events/Disconnect.h" -#include "ace/Auto_Ptr.h" - -namespace DAnCE -{ - // Implementation skeleton constructor - LocalityManager_i::LocalityManager_i (const ACE_TString &uuid, - std::list < std::string > plugin_config, - CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa) - : uuid_ (uuid), - plugin_config_files_ (plugin_config), - orb_ (CORBA::ORB::_duplicate (orb)), - poa_ (PortableServer::POA::_duplicate (poa)), - spawn_delay_ (30) - { - DANCE_TRACE ("LocalityManager_i::LocalityManager_i"); - this->scheduler_.activate_scheduler (0); - } - - LocalityManager_i::~LocalityManager_i (void) - { - DANCE_TRACE ("LocalityManager_i::~LocalityManager_i"); - - this->scheduler_.terminate_scheduler (); - - PLUGIN_MANAGER::instance ()->set_orb (::CORBA::ORB::_nil ()); - } - - void - LocalityManager_i::init (const Deployment::Properties &props) - { - DANCE_TRACE ("LocalityManager_i::init"); - - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("LocalityManager_i::init - ") - ACE_TEXT ("Received %u properties from init\n"), - props.length ())); - - PLUGIN_MANAGER::instance ()->set_configuration (props); - - PLUGIN_MANAGER::instance ()->set_orb (this->orb_.in ()); - - Plugin_Configurator config; - - DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT ("LocalityManager_i::init - ") - ACE_TEXT ("Loading %u plugin configuration files\n"), - this->plugin_config_files_.size ())); - - for (std::list < std::string >::const_iterator i = - this->plugin_config_files_.begin (); - i != this->plugin_config_files_.end (); ++i) - { - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT ("LocalityManager_i::init - ") - ACE_TEXT ("Loading plugin file <%C>\n"), - i->c_str ())); - config.load_from_text_file (ACE_TEXT_CHAR_TO_TCHAR (i->c_str ())); - } - - if (props.length () != 0) - { - if (DAnCE::Utility::get_property_value (DAnCE::LOCALITY_TIMEOUT, - props, - this->spawn_delay_)) - { - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("LocalityManager_i::init - ") - ACE_TEXT ("Using provided spawn delay %u\n"), - this->spawn_delay_)); - } - - DANCE_DEBUG (DANCE_LOG_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT ("LocalityManager_i::init - ") - ACE_TEXT ("Number of LM configuration properties: %u\n"), - props.length ())); - - for (CORBA::ULong i = 0; i < props.length (); ++i) - { - DANCE_DEBUG (DANCE_LOG_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT ("LocalityManager_i::init - ") - ACE_TEXT ("Looking up configuration handler for <%C>\n"), - props[i].name.in ())); - - ::DAnCE::LocalityConfiguration_var config = - PLUGIN_MANAGER::instance ()->get_configuration_handler (props[i].name.in ()); - - if (config.in ()) - { - DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT ("LocalityManager_i::init - ") - ACE_TEXT ("Invoking configuration handler for <%C>\n"), - props[i].name.in ())); - config->configure (props[i]); - } - } - } - else - { - DANCE_ERROR (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_WARNING, DLINFO - ACE_TEXT ("LocalityManager_i::init - ") - ACE_TEXT ("Warning: No configuration properties\n"))); - } - } - - ::Deployment::Properties * - LocalityManager_i::configuration (void) - { - DANCE_TRACE ("LocalityManager_i::configuration"); - throw CORBA::NO_IMPLEMENT (); - } - - ::Deployment::ApplicationManager_ptr - LocalityManager_i::preparePlan (const ::Deployment::DeploymentPlan & plan, - ::Deployment::ResourceCommitmentManager_ptr) - { - DANCE_TRACE ("LocalityManager_i::preparePlan"); - - this->plan_ = plan; - - Plugin_Manager::INTERCEPTORS interceptors = - PLUGIN_MANAGER::instance ()->fetch_interceptors (); - - for (Plugin_Manager::INTERCEPTORS::iterator i = interceptors.begin (); - i != interceptors.end (); - ++i) - { - if (!CORBA::is_nil (*i)) - { - (*i)->preprocess_plan (this->plan_); - } - } - - // populate the impl_type_table. - for (CORBA::ULong i = 0; - i < plan_.instance.length (); - ++i) - { - CORBA::ULong const implRef = plan.instance[i].implementationRef; - - const char *instance_type = - Utility::get_instance_type (plan.implementation[implRef].execParameter); - - instance_handlers_[instance_type].push_back (i); - } - - return this->_this (); - } - - ::Deployment::Application_ptr - LocalityManager_i::startLaunch (const ::Deployment::Properties &prop, - ::Deployment::Connections_out providedReference) - { - DANCE_TRACE ("LocalityManager_i::startLaunch"); - - PLUGIN_MANAGER::instance ()->get_installation_order (this->handler_order_); - - this->install_instances (prop); - - this->collect_references (providedReference); - - return this->_this (); - } - - void - LocalityManager_i::install_instances (const ::Deployment::Properties &) - { - DANCE_TRACE ("LocalityManager_i::install_instances"); - - CORBA::ULong dispatched (0); - - Deployment_Completion completion (this->scheduler_); - - for (Plugin_Manager::INSTALL_ORDER::const_iterator i = this->handler_order_.begin (); - i != this->handler_order_.end (); - ++i) - { - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("LocalityManager_i::install_instances - ") - ACE_TEXT ("Starting installation of %C type instances\n"), - i->c_str ())); - - INSTANCE_LIST &inst_list = this->instance_handlers_[*i]; - - for (INSTANCE_LIST::const_iterator j = inst_list.begin (); - j != inst_list.end (); - ++j) - { - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("LocalityManager_i::install_instances - ") - ACE_TEXT ("Starting installation of instance %C\n"), - this->plan_.instance[*j].name.in ())); - - Install_Instance *event (0); - Event_Future result; - completion.accept (result); - - ACE_NEW_THROW_EX (event, - Install_Instance (this->plan_, - *j, - i->c_str (), - result), - CORBA::NO_MEMORY ()); - - this->scheduler_.schedule_event (event); - ++dispatched; - } - } - - ACE_Time_Value tv (ACE_OS::gettimeofday () + ACE_Time_Value (this->spawn_delay_)); - - if (!completion.wait_on_completion (&tv)) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager_i::install_instances - ") - ACE_TEXT ("Timed out while waiting on completion of scheduler\n"))); - } - - tv = ACE_Time_Value::zero; - - Event_List completed_events; - completion.completed_events (completed_events); - - if (completed_events.size () != dispatched) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_WARNING, DLINFO - ACE_TEXT ("LocalityManager_i::install_instances - ") - ACE_TEXT ("Received only %u completed events, expected %u\n"), - dispatched, - completed_events.size ())); - } - - for (Event_List::iterator i = completed_events.begin (); - i != completed_events.end (); - ++i) - { - Event_Result event; - if (i->get (event, &tv) != 0) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager_i::install_instances - ") - ACE_TEXT ("Failed to get future value for current instance\n"))); - continue; - } - - if (event.exception_ && - !(DAnCE::Utility::extract_and_throw_exception < Deployment::StartError > - (event.contents_.in ()) || - DAnCE::Utility::extract_and_throw_exception < Deployment::InvalidProperty > - (event.contents_.in ()) || - DAnCE::Utility::extract_and_throw_exception < Deployment::InvalidNodeExecParameter > - (event.contents_.in ()) || - DAnCE::Utility::extract_and_throw_exception < Deployment::InvalidComponentExecParameter > - (event.contents_.in ())) - ) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager_i::install_instances - ") - ACE_TEXT ("Error: Unknown exception propagated\n"))); - throw ::Deployment::StartError (event.id_.c_str (), - "Unknown exception"); - } - - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_INFO, DLINFO - ACE_TEXT ("LocalityManager_i::install_instances - ") - ACE_TEXT ("Instance <%C> successfully deployed\n"), - event.id_.c_str ())); - - this->instance_references_[event.id_] = event.contents_; - } - } - - void - LocalityManager_i::collect_references (::Deployment::Connections_out &providedReference) - { - DANCE_TRACE ("LocalityManager_i::collect_references"); - - CORBA::ULong dispatched (0); - Deployment_Completion completion (this->scheduler_); - - ::Deployment::Connections *conn_cmp = 0; - ACE_NEW_THROW_EX (conn_cmp, - ::Deployment::Connections (this->plan_.connection.length ()), - CORBA::NO_MEMORY ()); - ACE_Auto_Ptr< ::Deployment::Connections > conn_safe (conn_cmp); - CORBA::ULong conn_pos (0); - - for (CORBA::ULong i = 0; - i < this->plan_.connection.length (); - ++i) - { - const ::Deployment::PlanConnectionDescription &conn = - this->plan_.connection[i]; - - if (conn.externalReference.length () > 0) - { - // connections with external reference endpoints - // we do not know how to resolve here; we just - // collect them and allow connect handlers/interceptors - // to handle them later - conn_cmp->length (conn_pos + 1); - (*conn_cmp)[conn_pos].name = conn.name.in (); - (*conn_cmp)[conn_pos].endpoint.length (1); - (*conn_cmp)[conn_pos].endpoint[0] = CORBA::Object::_nil (); - ++conn_pos; - } - else - for (CORBA::ULong j = 0; - j != conn.internalEndpoint.length (); - ++j) - { - if (conn.internalEndpoint[j].provider) - { - CORBA::ULong instRef = - conn.internalEndpoint[j].instanceRef; - CORBA::ULong implRef = - this->plan_.instance[instRef].implementationRef; - - const char *inst_type = - Utility::get_instance_type (this->plan_.implementation[implRef].execParameter); - - Endpoint_Reference *event (0); - Event_Future result; - completion.accept (result); - - ACE_NEW_THROW_EX (event, - Endpoint_Reference (this->plan_, - i, - inst_type, - result), - CORBA::NO_MEMORY ()); - - this->scheduler_.schedule_event (event); - ++dispatched; - } - } - } - - ACE_Time_Value tv (ACE_OS::gettimeofday () + ACE_Time_Value (this->spawn_delay_)); - - if (!completion.wait_on_completion (&tv)) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager_i::collect_references - ") - ACE_TEXT ("Timed out while waiting on completion of scheduler\n"))); - } - - tv = ACE_Time_Value::zero; - - Event_List completed_events; - completion.completed_events (completed_events); - - if (completed_events.size () != dispatched) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_WARNING, DLINFO - ACE_TEXT ("LocalityManager_i::collect_references - ") - ACE_TEXT ("Received only %u completed events, expected %u\n"), - dispatched, - completed_events.size ())); - } - - for (Event_List::iterator i = completed_events.begin (); - i != completed_events.end (); - ++i) - { - Event_Result event; - if (i->get (event, &tv) != 0) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager_i::collect_references - ") - ACE_TEXT ("Failed to get future value for current instance\n"))); - continue; - } - - if (event.exception_ && - !(DAnCE::Utility::extract_and_throw_exception < Deployment::StartError > - (event.contents_.in ()) || - DAnCE::Utility::extract_and_throw_exception < Deployment::InvalidProperty > - (event.contents_.in ()))) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager_i::collect_references - ") - ACE_TEXT ("Error: Unknown exception propagated\n"))); - throw ::Deployment::StartError (event.id_.c_str (), - "Unknown exception"); - } - - CORBA::Object_var obj_ref; - - if (event.contents_.ptr () != 0) - event.contents_ >>= CORBA::Any::to_object (obj_ref); - else - { - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("LocalityManager_i::collect_references - ") - ACE_TEXT ("No reference returned for connection <%C>\n"), - event.id_.c_str ())); - } - - conn_cmp->length (conn_pos + 1); - (*conn_cmp)[conn_pos].name = event.id_.c_str (); - (*conn_cmp)[conn_pos].endpoint.length (1); - (*conn_cmp)[conn_pos].endpoint[0] = obj_ref; - ++conn_pos; - } - - providedReference = conn_safe.release (); - } - - void - LocalityManager_i::finishLaunch (const ::Deployment::Connections & providedReference, - ::CORBA::Boolean start) - { - DANCE_TRACE ("LocalityManager_i::finishLaunch"); - - typedef std::map < std::string, CORBA::ULong > ConnMap; - ConnMap conns; - - Deployment_Completion completion (this->scheduler_); - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_TRACE, DLINFO - ACE_TEXT ("LocalityManager_i::finishLaunch - ") - ACE_TEXT ("Starting finishLaunch, received %u references, ") - ACE_TEXT ("have %u connections\n"), - providedReference.length (), - this->plan_.connection.length () - )); - - for (CORBA::ULong i = 0; i < this->plan_.connection.length (); ++i) - { - conns[this->plan_.connection[i].name.in ()] = i; - } - - CORBA::ULong dispatched (0); - - for (CORBA::ULong i = 0; i < providedReference.length (); ++i) - { - const char * name = providedReference[i].name.in (); - ConnMap::const_iterator conn_ref = conns.find (name); - - if (conn_ref == conns.end ()) - continue; - - CORBA::ULong j (0); - - const ::Deployment::PlanConnectionDescription &conn = - this->plan_.connection[conn_ref->second]; - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("LocalityManager_i::finishLaunch - ") - ACE_TEXT ("Connection <%C> has %u endpoints\n"), - conn.name.in (), - conn.internalEndpoint.length ())); - - if (conn.internalEndpoint.length () == 2) - { - if (!conn.internalEndpoint[1].provider) - j = 1; - } - else if (conn.internalEndpoint[0].provider && - conn.externalReference.length () == 0) - { - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("LocalityManager_i::finishLaunch - ") - ACE_TEXT ("Skipping connection <%C>\n"), - conn.name.in ())); - continue; - } - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT ("LocalityManager_i::finishLaunch - ") - ACE_TEXT ("Starting connection <%C>\n"), - name)); - - CORBA::Any reference; - - reference <<= providedReference[i].endpoint[0]; - - CORBA::ULong instRef = - conn.internalEndpoint[j].instanceRef; - CORBA::ULong implRef = - this->plan_.instance[instRef].implementationRef; - - const char *inst_type = - Utility::get_instance_type (this->plan_.implementation[implRef].execParameter); - - Connect_Instance *event (0); - Event_Future result; - completion.accept (result); - - ACE_NEW_THROW_EX (event, - Connect_Instance (this->plan_, - conn_ref->second, - reference, - inst_type, - result), - CORBA::NO_MEMORY ()); - - this->scheduler_.schedule_event (event); - ++dispatched; - } - - ACE_Time_Value tv (ACE_OS::gettimeofday () + ACE_Time_Value (this->spawn_delay_)); - - if (!completion.wait_on_completion (&tv)) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager_i::finishLaunch - ") - ACE_TEXT ("Timed out while waiting on completion of scheduler\n"))); - } - - tv = ACE_Time_Value::zero; - - Event_List completed_events; - completion.completed_events (completed_events); - - if (completed_events.size () != dispatched) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_WARNING, DLINFO - ACE_TEXT ("LocalityManager_i::finishLaunch - ") - ACE_TEXT ("Received only %u completed events, expected %u\n"), - dispatched, - completed_events.size ())); - } - - for (Event_List::iterator i = completed_events.begin (); - i != completed_events.end (); - ++i) - { - Event_Result event; - if (i->get (event, &tv) != 0) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager_i::finishLaunch - ") - ACE_TEXT ("Failed to get future value for current instance\n"))); - continue; - } - - if (event.exception_ && - !(DAnCE::Utility::extract_and_throw_exception < Deployment::StartError > - (event.contents_.in ()) || - DAnCE::Utility::extract_and_throw_exception < Deployment::InvalidConnection > - (event.contents_.in ())) - ) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager_i::finishLaunch - ") - ACE_TEXT ("Error: Unknown exception propagated\n"))); - throw ::Deployment::StartError (event.id_.c_str (), - "Unknown exception"); - } - } - - dispatched = 0; - - for (Plugin_Manager::INSTALL_ORDER::const_iterator i = this->handler_order_.begin (); - i != this->handler_order_.end (); - ++i) - { - INSTANCE_LIST &inst_list = this->instance_handlers_[*i]; - - for (INSTANCE_LIST::const_iterator j = inst_list.begin (); - j != inst_list.end (); - ++j) - { - Instance_Configured *event (0); - Event_Future result; - completion.accept (result); - - ACE_NEW_THROW_EX (event, - Instance_Configured (this->plan_, - *j, - i->c_str (), - result), - CORBA::NO_MEMORY ()); - - this->scheduler_.schedule_event (event); - ++dispatched; - } - } - - tv = ACE_OS::gettimeofday () + ACE_Time_Value (this->spawn_delay_); - - if (!completion.wait_on_completion (&tv)) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager_i::finishLaunch - ") - ACE_TEXT ("Timed out while waiting on completion of scheduler\n"))); - } - - tv = ACE_Time_Value::zero; - - completion.completed_events (completed_events); - - if (completed_events.size () != dispatched) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_WARNING, DLINFO - ACE_TEXT ("LocalityManager_i::finishLaunch - ") - ACE_TEXT ("Received only %u completed events, expected %u\n"), - dispatched, - completed_events.size ())); - } - - for (Event_List::iterator i = completed_events.begin (); - i != completed_events.end (); - ++i) - { - Event_Result event; - if (i->get (event, &tv) != 0) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager_i::finishLaunch - ") - ACE_TEXT ("Failed to get future value for current instance\n"))); - continue; - } - - if (event.exception_ && - !(DAnCE::Utility::extract_and_throw_exception < Deployment::StartError > - (event.contents_.in ())) - ) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager_i::finishLaunch - ") - ACE_TEXT ("Error: Unknown exception propagated\n"))); - throw ::Deployment::StartError (event.id_.c_str (), - "Unknown exception from instance_configured"); - } - } - - if (start) - this->start (); - } - - void - LocalityManager_i::disconnect_connections (void) - { - DANCE_TRACE ("LocalityManager_i::disconnect_connections"); - - Deployment_Completion completion (this->scheduler_); - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_TRACE, DLINFO - ACE_TEXT ("LocalityManager_i::disconnect_connections - ") - ACE_TEXT ("Starting disconnect_connections, ") - ACE_TEXT ("have %u connections\n"), - this->plan_.connection.length () - )); - - CORBA::ULong dispatched (0); - - for (CORBA::ULong i = 0; i < this->plan_.connection.length (); ++i) - { - const char * name = this->plan_.connection[i].name.in (); - CORBA::ULong j (0); - - const ::Deployment::PlanConnectionDescription &conn = - this->plan_.connection[i]; - - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, (LM_TRACE, DLINFO - ACE_TEXT ("LocalityManager_i::disconnect_connections - ") - ACE_TEXT ("Connection <%C> has %u endpoints\n"), - conn.name.in (), - conn.internalEndpoint.length ())); - - if (conn.internalEndpoint.length () == 2) - { - if (conn.internalEndpoint[1].provider) - j = 1; - } - else if (conn.internalEndpoint[0].provider && - conn.externalReference.length () == 0) - { - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("LocalityManager_i::disconnect_connections - ") - ACE_TEXT ("Skipping connection <%C>\n"), - conn.name.in ())); - continue; - } - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT ("LocalityManager_i::disconnect_connections - ") - ACE_TEXT ("Starting disconnect connection <%C>\n"), - name)); - - CORBA::ULong instRef = - conn.internalEndpoint[j].instanceRef; - CORBA::ULong implRef = - this->plan_.instance[instRef].implementationRef; - - const char *inst_type = - Utility::get_instance_type (this->plan_.implementation[implRef].execParameter); - - Disconnect_Instance *event (0); - Event_Future result; - completion.accept (result); - - ACE_NEW_THROW_EX (event, - Disconnect_Instance (this->plan_, - i, - inst_type, - result), - CORBA::NO_MEMORY ()); - - this->scheduler_.schedule_event (event); - ++dispatched; - } - - ACE_Time_Value tv (ACE_OS::gettimeofday () + ACE_Time_Value (this->spawn_delay_)); - - if (!completion.wait_on_completion (&tv)) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager_i::disconnect_connections - ") - ACE_TEXT ("Timed out while waiting on completion of scheduler\n"))); - } - - tv = ACE_Time_Value::zero; - - Event_List completed_events; - completion.completed_events (completed_events); - - if (completed_events.size () != dispatched) - { - DANCE_ERROR (DANCE_LOG_WARNING, - (LM_WARNING, DLINFO - ACE_TEXT ("LocalityManager_i::disconnect_connections - ") - ACE_TEXT ("Received only %u completed events, expected %u\n"), - dispatched, - completed_events.size ())); - } - - for (Event_List::iterator i = completed_events.begin (); - i != completed_events.end (); - ++i) - { - Event_Result event; - if (i->get (event, &tv) != 0) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager_i::disconnect_connections - ") - ACE_TEXT ("Failed to get future value for current instance\n"))); - continue; - } - - if (event.exception_ && - !(DAnCE::Utility::extract_and_throw_exception < Deployment::StartError > - (event.contents_.in ()) || - DAnCE::Utility::extract_and_throw_exception < Deployment::InvalidConnection > - (event.contents_.in ())) - ) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager_i::disconnect_connections - ") - ACE_TEXT ("Error: Unknown exception propagated\n"))); - throw ::Deployment::StartError (event.id_.c_str (), - "Unknown exception"); - } - } - } - - void - LocalityManager_i::start (void) - { - DANCE_TRACE ("LocalityManager_i::start"); - - Deployment_Completion completion (this->scheduler_); - CORBA::ULong dispatched (0); - - for (Plugin_Manager::INSTALL_ORDER::const_iterator i = this->handler_order_.begin (); - i != this->handler_order_.end (); - ++i) - { - INSTANCE_LIST &inst_list = this->instance_handlers_[*i]; - - for (INSTANCE_LIST::const_iterator j = inst_list.begin (); - j != inst_list.end (); - ++j) - { - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT ("LocalityManager_i::start - ") - ACE_TEXT ("Scheduling start for instance %C\n"), - plan_.instance[*j].name.in ())); - - Start_Instance *event (0); - Event_Future result; - completion.accept (result); - - const char *name = this->plan_.instance[*j].name.in (); - - ACE_NEW_THROW_EX (event, - Start_Instance (this->plan_, - *j, - this->instance_references_[name].in (), - i->c_str (), - result), - CORBA::NO_MEMORY ()); - - this->scheduler_.schedule_event (event); - ++dispatched; - } - } - - ACE_Time_Value tv (ACE_OS::gettimeofday () + ACE_Time_Value (this->spawn_delay_)); - - if (!completion.wait_on_completion (&tv)) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager_i::start - ") - ACE_TEXT ("Timed out while waiting on completion of scheduler\n"))); - } - - tv = ACE_Time_Value::zero; - - Event_List completed_events; - completion.completed_events (completed_events); - - if (completed_events.size () != dispatched) - { - DANCE_ERROR (DANCE_LOG_WARNING, - (LM_WARNING, DLINFO - ACE_TEXT ("LocalityManager_i::start - ") - ACE_TEXT ("Received only %u completed events, expected %u\n"), - dispatched, - completed_events.size ())); - } - - for (Event_List::iterator i = completed_events.begin (); - i != completed_events.end (); - ++i) - { - Event_Result event; - if (i->get (event, &tv) != 0) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager_i::start - ") - ACE_TEXT ("Failed to get future value for current instance\n"))); - continue; - } - - if (event.exception_ && - !(DAnCE::Utility::extract_and_throw_exception < Deployment::StartError > - (event.contents_.in ())) - ) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager_i::start - ") - ACE_TEXT ("Error: Unknown exception propagated\n"))); - throw ::Deployment::StartError (event.id_.c_str (), - "Unknown exception"); - } - - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_INFO, DLINFO - ACE_TEXT ("LocalityManager_i::start - ") - ACE_TEXT ("Instance <%C> successfully activated\n"), - event.id_.c_str ())); - } - } - - void - LocalityManager_i::destroyApplication (::Deployment::Application_ptr) - { - DANCE_TRACE ("LocalityManager_i::destroyApplication"); - - Deployment_Completion completion (this->scheduler_); - CORBA::ULong dispatched (0); - - for (size_t i = this->handler_order_.size (); - i > 0; - --i) - { - INSTANCE_LIST &inst_list = this->instance_handlers_[this->handler_order_[i-1]]; - - for (INSTANCE_LIST::const_iterator j = inst_list.begin (); - j != inst_list.end (); - ++j) - { - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT ("LocalityManager_i::destroyApplication - ") - ACE_TEXT ("Scheduling passivation for instance %C\n"), - this->plan_.instance[*j].name.in ())); - - Passivate_Instance *event (0); - Event_Future result; - completion.accept (result); - - const char *name = this->plan_.instance[*j].name.in (); - - ACE_NEW_THROW_EX (event, - Passivate_Instance (this->plan_, - *j, - this->instance_references_[name].in (), - this->handler_order_[i-1].c_str (), - result), - CORBA::NO_MEMORY ()); - - this->scheduler_.schedule_event (event); - ++dispatched; - } - } - - ACE_Time_Value tv (ACE_OS::gettimeofday () + ACE_Time_Value (this->spawn_delay_)); - - if (!completion.wait_on_completion (&tv)) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager_i::destroyApplication - ") - ACE_TEXT ("Timed out while waiting on completion of scheduler\n"))); - } - - tv = ACE_Time_Value::zero; - - Event_List completed_events; - completion.completed_events (completed_events); - - if (completed_events.size () != dispatched) - { - DANCE_ERROR (DANCE_LOG_WARNING, - (LM_WARNING, DLINFO - ACE_TEXT ("LocalityManager_i::destroyApplication - ") - ACE_TEXT ("Received only %u completed events, expected %u\n"), - dispatched, - completed_events.size ())); - } - - dispatched = 0; - - for (Event_List::iterator i = completed_events.begin (); - i != completed_events.end (); - ++i) - { - Event_Result event; - if (i->get (event, &tv) != 0) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager_i::destroyApplication - ") - ACE_TEXT ("Failed to get future value for current instance\n"))); - continue; - } - - if (event.exception_ && - !(DAnCE::Utility::extract_and_throw_exception < Deployment::StopError > - (event.contents_.in ())) - ) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager_i::destroyApplication - ") - ACE_TEXT ("Error: Unknown exception propagated\n"))); - throw ::Deployment::StopError (event.id_.c_str (), - "Unknown exception"); - } - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_INFO, DLINFO - ACE_TEXT ("LocalityManager_i::destroyApplication - ") - ACE_TEXT ("Instance <%C> successfully passivated\n"), - event.id_.c_str ())); - } - - // Now disconnect all connections in the plan - this->disconnect_connections(); - - for (size_t i = this->handler_order_.size (); - i > 0; - --i) - { - INSTANCE_LIST &inst_list = this->instance_handlers_[this->handler_order_[i-1]]; - - for (INSTANCE_LIST::const_iterator j = inst_list.begin (); - j != inst_list.end (); - ++j) - { - Remove_Instance *event (0); - Event_Future result; - completion.accept (result); - - const char *name = this->plan_.instance[*j].name.in (); - - REFERENCE_MAP::iterator ref = this->instance_references_.find (name); - - ACE_NEW_THROW_EX (event, - Remove_Instance (this->plan_, - *j, - ref->second.in (), - this->handler_order_[i-1].c_str (), - result), - CORBA::NO_MEMORY ()); - - this->instance_references_.erase (ref); - - this->scheduler_.schedule_event (event); - ++dispatched; - } - } - - tv = ACE_OS::gettimeofday () + ACE_Time_Value (this->spawn_delay_); - - if (!completion.wait_on_completion (&tv)) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager_i::destroyApplication - ") - ACE_TEXT ("Timed out while waiting on completion of scheduler\n"))); - } - - tv = ACE_Time_Value::zero; - - completion.completed_events (completed_events); - - if (completed_events.size () != dispatched) - { - DANCE_ERROR (DANCE_LOG_WARNING, - (LM_WARNING, DLINFO - ACE_TEXT ("LocalityManager_i::destroyApplication - ") - ACE_TEXT ("Received only %u completed events, expected %u\n"), - dispatched, - completed_events.size ())); - } - - dispatched = 0; - - for (Event_List::iterator i = completed_events.begin (); - i != completed_events.end (); - ++i) - { - Event_Result event; - if (i->get (event, &tv) != 0) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager_i::destroyApplication - ") - ACE_TEXT ("Failed to get future value for current instance\n"))); - continue; - } - - if (event.exception_ && - !(DAnCE::Utility::extract_and_throw_exception < Deployment::StopError > - (event.contents_.in ())) - ) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager_i::destroyApplication - ") - ACE_TEXT ("Error: Unknown exception propagated\n"))); - throw ::Deployment::StopError (event.id_.c_str (), - "Unknown exception"); - } - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, (LM_INFO, DLINFO - ACE_TEXT ("LocalityManager_i::destroyApplication - ") - ACE_TEXT ("Instance <%C> successfully removed\n"), - event.id_.c_str ())); - } - } - - - void - LocalityManager_i::destroyManager (::Deployment::ApplicationManager_ptr) - { - DANCE_TRACE ("LocalityManager_i::destroyManager"); - // Add your implementation here - } - - - void - LocalityManager_i::shutdown (void) - { - DANCE_TRACE ("LocalityManager_i::shutdown"); - - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT ("DAnCE LocalityManager shutdown request received for UUID <%C>\n"), - uuid_.c_str ())); - - this->orb_->shutdown (); - - // Explicitly close the plugin manager to release memory. - PLUGIN_MANAGER::close (); - - this->poa_ = PortableServer::POA::_nil (); - this->orb_ = CORBA::ORB::_nil (); - } -} diff --git a/DAnCE/dance/LocalityManager/Daemon/Locality_Manager_Impl.h b/DAnCE/dance/LocalityManager/Daemon/Locality_Manager_Impl.h deleted file mode 100644 index 9e41964691b..00000000000 --- a/DAnCE/dance/LocalityManager/Daemon/Locality_Manager_Impl.h +++ /dev/null @@ -1,115 +0,0 @@ -// -*- C++ -*- -/** - * @file Locality_Manager_Impl.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - **/ - -// TAO_IDL - Generated from -// be/be_codegen.cpp:1521 - -#ifndef DANCE_LOCALITYMANAGERI_PDD6RP_H_ -#define DANCE_LOCALITYMANAGERI_PDD6RP_H_ - -#include "dance/DAnCE_LocalityManagerS.h" -#include "dance/DAnCE_DeploymentInterceptorsC.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/LocalObject.h" - - -#include "dance/LocalityManager/Daemon/Locality_Manager_Impl_Export.h" -#include "dance/LocalityManager/Scheduler/Deployment_Scheduler.h" -#include "dance/LocalityManager/Scheduler/Plugin_Manager.h" - -#include <map> -#include <vector> -#include <list> -#include <string> - -namespace DAnCE -{ - - class Locality_Manager_Impl_Export LocalityManager_i - : public virtual POA_DAnCE::LocalityManager - { - public: - // Constructor - LocalityManager_i (const ACE_TString &uuid, - std::list <std::string> plugin_config_files, - CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa); - - void init (const Deployment::Properties &prop); - // Destructor - virtual ~LocalityManager_i (void); - - virtual - ::Deployment::Properties * configuration (void); - - virtual - ::Deployment::ApplicationManager_ptr preparePlan ( - const ::Deployment::DeploymentPlan & plan, - ::Deployment::ResourceCommitmentManager_ptr resourceCommitment); - - virtual - void destroyManager (::Deployment::ApplicationManager_ptr manager); - - virtual - void shutdown (void); - - virtual - void finishLaunch (const ::Deployment::Connections & providedReference, - ::CORBA::Boolean start); - - virtual - void start (void); - - virtual - ::Deployment::Application_ptr startLaunch (const ::Deployment::Properties & configProperty, - ::Deployment::Connections_out providedReference); - - virtual - void destroyApplication (::Deployment::Application_ptr app); - - private: - void install_instances (const ::Deployment::Properties &prop); - - void collect_references (::Deployment::Connections_out &providedReference); - - void disconnect_connections (void); - - const char * determine_instance_type (const ::Deployment::PlanConnectionDescription &conn, - const ::Deployment::Connection & providedReference); - - ACE_TString uuid_; - - std::list< std::string > plugin_config_files_; - - CORBA::ORB_var orb_; - PortableServer::POA_var poa_; - - typedef std::list< CORBA::ULong > INSTANCE_LIST; - - typedef std::map <std::string, - INSTANCE_LIST> HANDLER_TABLE; - - HANDLER_TABLE instance_handlers_; - - Plugin_Manager::INSTALL_ORDER handler_order_; - - typedef std::map < std::string, CORBA::Any_var > REFERENCE_MAP; - - REFERENCE_MAP instance_references_; - - ::Deployment::DeploymentPlan plan_; - - DAnCE::Deployment_Scheduler scheduler_; - - CORBA::ULong spawn_delay_; - }; - -} -#endif /* DANCE_LOCALITYMANAGERI_H_ */ diff --git a/DAnCE/dance/LocalityManager/Daemon/Locality_Manager_Impl_Export.h b/DAnCE/dance/LocalityManager/Daemon/Locality_Manager_Impl_Export.h deleted file mode 100644 index c5f3e726167..00000000000 --- a/DAnCE/dance/LocalityManager/Daemon/Locality_Manager_Impl_Export.h +++ /dev/null @@ -1,57 +0,0 @@ - -// -*- C++ -*- -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl Locality_Manager_Impl -// ------------------------------ -#ifndef LOCALITY_MANAGER_IMPL_EXPORT_H -#define LOCALITY_MANAGER_IMPL_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (LOCALITY_MANAGER_IMPL_HAS_DLL) -# define LOCALITY_MANAGER_IMPL_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && LOCALITY_MANAGER_IMPL_HAS_DLL */ - -#if !defined (LOCALITY_MANAGER_IMPL_HAS_DLL) -# define LOCALITY_MANAGER_IMPL_HAS_DLL 1 -#endif /* ! LOCALITY_MANAGER_IMPL_HAS_DLL */ - -#if defined (LOCALITY_MANAGER_IMPL_HAS_DLL) && (LOCALITY_MANAGER_IMPL_HAS_DLL == 1) -# if defined (LOCALITY_MANAGER_IMPL_BUILD_DLL) -# define Locality_Manager_Impl_Export ACE_Proper_Export_Flag -# define LOCALITY_MANAGER_IMPL_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define LOCALITY_MANAGER_IMPL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* LOCALITY_MANAGER_IMPL_BUILD_DLL */ -# define Locality_Manager_Impl_Export ACE_Proper_Import_Flag -# define LOCALITY_MANAGER_IMPL_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define LOCALITY_MANAGER_IMPL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* LOCALITY_MANAGER_IMPL_BUILD_DLL */ -#else /* LOCALITY_MANAGER_IMPL_HAS_DLL == 1 */ -# define Locality_Manager_Impl_Export -# define LOCALITY_MANAGER_IMPL_SINGLETON_DECLARATION(T) -# define LOCALITY_MANAGER_IMPL_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* LOCALITY_MANAGER_IMPL_HAS_DLL == 1 */ - -// Set LOCALITY_MANAGER_IMPL_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (LOCALITY_MANAGER_IMPL_NTRACE) -# if (ACE_NTRACE == 1) -# define LOCALITY_MANAGER_IMPL_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define LOCALITY_MANAGER_IMPL_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !LOCALITY_MANAGER_IMPL_NTRACE */ - -#if (LOCALITY_MANAGER_IMPL_NTRACE == 1) -# define LOCALITY_MANAGER_IMPL_TRACE(X) -#else /* (LOCALITY_MANAGER_IMPL_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define LOCALITY_MANAGER_IMPL_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (LOCALITY_MANAGER_IMPL_NTRACE == 1) */ - -#endif /* LOCALITY_MANAGER_IMPL_EXPORT_H */ - -// End of auto generated file. diff --git a/DAnCE/dance/LocalityManager/Daemon/Locality_Manager_Task.cpp b/DAnCE/dance/LocalityManager/Daemon/Locality_Manager_Task.cpp deleted file mode 100644 index 11bbaf633ed..00000000000 --- a/DAnCE/dance/LocalityManager/Daemon/Locality_Manager_Task.cpp +++ /dev/null @@ -1,375 +0,0 @@ -/** - * @file Locality_Manager_Task.cpp - * @author William R. Otte - * - * Implementation and main for LocalityManager. - */ - -#include "Locality_Manager_Task.h" - -#include "ace/OS_NS_string.h" -#include "ace/Log_Msg.h" -#include "ace/Get_Opt.h" -#include "ace/Env_Value_T.h" -#include "tao/ORB.h" -#include "tao/PortableServer/PortableServer.h" -#include "dance/Logger/Logger_Service.h" -#include "dance/Logger/Log_Macros.h" -#include "dance/DAnCE_Utility.h" -#include "dance/LocalityManager/Daemon/Locality_Manager_Impl.h" - -namespace DAnCE -{ - LocalityManager_Task::Error::Error(const ACE_CString &err) : err_(err) - { - } - - LocalityManager_Task::LocalityManager_Task (int argc, ACE_TCHAR **argv) - { - DANCE_TRACE ("DAnCE_LocalityManager_Task::DAnCE_LocalityManager_Task ()"); - - this->orb_ = CORBA::ORB_init (argc, argv); - - Logger_Service - *dlf = ACE_Dynamic_Service<Logger_Service>::instance ("DAnCE_Logger"); - - if (dlf) - { - dlf->init (argc, argv); - } - - this->parse_args (argc, argv); - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_TRACE, DLINFO - ACE_TEXT ("DAnCE_LocalityManager_Task::DAnCE_LocalityManager_Task - ") - ACE_TEXT ("DAnCE_LocalityManager_Task_ object created.\n"))); - } - - int - LocalityManager_Task::svc (void) - { - DANCE_TRACE ("LocalityManager_Task::svc"); - - DANCE_DEBUG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("LocalityManager_Task::svc - ") - ACE_TEXT ("Activating the root POA\n"))); - - CORBA::Object_var object = - this->orb_->resolve_initial_references ("RootPOA"); - - PortableServer::POA_var root_poa = - PortableServer::POA::_narrow (object.in ()); - - { - PortableServer::POAManager_var poa_manager = - root_poa->the_POAManager (); - - poa_manager->activate (); - - DANCE_DEBUG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("LocalityManager_Task::svc - ") - ACE_TEXT ("Creating server implementation object\n"))); - - DAnCE::LocalityManager_i *lm_srv = 0; - ACE_NEW_NORETURN (lm_srv, - LocalityManager_i (this->uuid_, - this->plugin_config_, - this->orb_.in (), - root_poa.in ())); - - if (lm_srv == 0) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_CRITICAL, - ACE_TEXT ("LocalityManager_Task::run - ") - ACE_TEXT ("Out of memory error while allocating servant."))); - throw Error ("Out of memory whilst allocating servant."); - } - - PortableServer::ServantBase_var safe_config = lm_srv; - PortableServer::ObjectId_var id = - root_poa->activate_object (lm_srv); - CORBA::Object_var lm_object = root_poa->id_to_reference (id.in ()); - DAnCE::LocalityManager_var lm = - DAnCE::LocalityManager::_narrow (lm_object.in ()); - - if (this->output_file_ != ACE_TEXT("")) - { - CORBA::String_var ior = this->orb_->object_to_string (lm.in ()); - ::DAnCE::Utility::write_IOR (this->output_file_.c_str (), ior.in ()); - } - - if (this->callback_ior_str_ != ACE_TEXT("")) - { - DANCE_DEBUG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("LocalityManager_Task::run - ") - ACE_TEXT ("Resolving callback IOR\n"))); - CORBA::Object_var obj = - this->orb_->string_to_object (this->callback_ior_str_.c_str ()); - LocalityManagerActivator_var sa (LocalityManagerActivator::_narrow (obj)); - - if (CORBA::is_nil (sa.in ())) - { - DANCE_DEBUG (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager_Task::svc - ") - ACE_TEXT ("Failed to narrow callback IOR [%s]\n"), - this->callback_ior_str_.c_str ())); - throw Error ("Failed to narrow callback IOR"); - } - - { - Deployment::Properties *cf = 0; - ACE_NEW_NORETURN (cf, Deployment::Properties (0)); - - if (cf == 0) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_CRITICAL, ACE_TEXT ("LocalityManager_Task::run - ") - ACE_TEXT ("Out of memory error while allocating config ") - ACE_TEXT ("values."))); - } - else - { - this->config_ = cf; - } - } - - // Make callback. - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("LocalityManager_Task::svc - ") - ACE_TEXT ("Making callback on my Activator\n"))); - - try - { - // Callback to NodeApplication to get configuration - sa->locality_manager_callback (lm.in (), - ACE_TEXT_ALWAYS_CHAR (this->uuid_.c_str ()), - this->config_.out ()); - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("LocalityManager_Task::svc - ") - ACE_TEXT ("Configuration received, got %u values\n"), - this->config_->length ())); - - lm_srv->init (this->config_.in ()); - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_NOTICE, DLINFO - ACE_TEXT ("LocalityManager_Task::svc - ") - ACE_TEXT ("Configuration complete for component server %C\n"), - this->uuid_.c_str ())); - - sa->configuration_complete (ACE_TEXT_ALWAYS_CHAR (this->uuid_.c_str ())); - } - catch (const CORBA::BAD_PARAM &) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager_Task::svc - ") - ACE_TEXT ("The Callback IOR provided pointed to the ") - ACE_TEXT ("wrong Activator\n"))); - throw Error ("Bad callback IOR"); - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager_Task::svc - ") - ACE_TEXT ("Caught CORBA Exception while ") - ACE_TEXT ("calling back: %C\n"), - ex._info ().c_str ())); - throw Error (ex._info ().c_str ()); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("LocalityManager_Task::svc - ") - ACE_TEXT ("Caught exception while calling back\n"))); - throw Error ("Caught exception while calling back"); - } - } - else - { - DANCE_DEBUG (DANCE_LOG_WARNING, - (LM_WARNING, DLINFO - ACE_TEXT ("LocalityManager_Task::svc - ") - ACE_TEXT ("Initializing ComponentServer without ServantActivator ") - ACE_TEXT ("callback\n"))); - lm_srv->init (0); - } - - this->orb_->run (); - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("LocalityManager_Task::svc - ") - ACE_TEXT ("ORB Event loop completed.\n"))); - } - - root_poa->destroy (1, 1); - root_poa = ::PortableServer::POA::_nil (); - - this->orb_->destroy (); - this->orb_ = ::CORBA::ORB::_nil (); - - return 0; - } - - void - LocalityManager_Task::run (void) - { - DANCE_TRACE ("LocalityManager_Task::run"); - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT ("LocalityManager_Task::run - Starting ORB\n"))); - this->svc (); - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_INFO, - DLINFO ACE_TEXT ("LocalityManager_Task::run - ORB has ") - ACE_TEXT ("shutdown, terminating ComponentServer\n"))); - } - - void - LocalityManager_Task::parse_args (int argc, ACE_TCHAR **argv) - { - DANCE_TRACE ("LocalityManager_Task::parse_args"); - - DANCE_DEBUG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("LocalityManager_Task::parse_args - ") - ACE_TEXT ("parsing arguments...\n"))); - - ACE_Get_Opt opts (argc, argv, ACE_TEXT("hu:c:p:"), 1, 0, - ACE_Get_Opt::RETURN_IN_ORDER); - opts.long_option (ACE_TEXT("uuid"), 'u', ACE_Get_Opt::ARG_REQUIRED); - opts.long_option (ACE_TEXT("callback-ior"), 'c', ACE_Get_Opt::ARG_REQUIRED); - opts.long_option (ACE_TEXT("help"), 'h'); - opts.long_option (ACE_TEXT("log-level"),'l', ACE_Get_Opt::ARG_REQUIRED); - opts.long_option (ACE_TEXT("trace"),'t', ACE_Get_Opt::NO_ARG); - opts.long_option (ACE_TEXT("output-ior"),'o', ACE_Get_Opt::ARG_REQUIRED); - opts.long_option (ACE_TEXT("plugin-config"),'p', ACE_Get_Opt::ARG_REQUIRED); - - int c = 0; - while ((c = opts ()) != -1) - { - DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("LocalityManager_Task::parse_args - ") - ACE_TEXT ("Found option: \"%s\" with argument \"%s\"\n"), - opts.last_option (), opts.opt_arg ())); - - switch (c) - { - case 'u': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("LocalityManager_Task::parse_args - ") - ACE_TEXT ("uuid is %s\n"), - opts.opt_arg ())); - this->uuid_ = opts.opt_arg (); - break; - - case 'c': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("LocalityManager_Task::parse_args - ") - ACE_TEXT ("callback ior is %s\n"), - opts.opt_arg ())); - this->callback_ior_str_ = opts.opt_arg (); - break; - - case 'l': - { - continue; // no-op, already taken care of - } - - case 't': - continue; // already taken care of - - case 'o': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("LocalityManager_Task::parse_args - ") - ACE_TEXT ("IOR Output file: %s\n"), - opts.opt_arg ())); - this->output_file_ = opts.opt_arg (); - break; - - case 'p': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("LocalityManager_Task::parse_args - ") - ACE_TEXT ("Adding <%s> to plugin config list\n"), - opts.opt_arg ())); - this->plugin_config_.push_back (ACE_TEXT_ALWAYS_CHAR (opts.opt_arg ())); - break; - - case 'h': - this->usage (); - throw Error ("Command line help requested, bailing out...."); - - default: - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO - ACE_TEXT (" Unknown option: %s\n"), - opts.last_option ())); - this->usage (); - ACE_CString err ("Unknown option "); - err += ACE_TEXT_ALWAYS_CHAR (opts.last_option ()); - throw Error (err); - } - } - - // check required options. - if (this->uuid_ == ACE_TEXT ("")) - throw Error ("Option required: -u|--uuid"); - if (this->callback_ior_str_ == ACE_TEXT("")) - { - DANCE_ERROR (DANCE_LOG_WARNING, - (LM_WARNING, DLINFO - ACE_TEXT ("LocalityManager_Task::parse_args - ") - ACE_TEXT ("Starting ComponentServer without a callback IOR\n"))); - } - - if (this->plugin_config_.size () == 0) - { - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("LocalityManager_Task::parse_args - ") - ACE_TEXT ("No plugin config specified, adding default at ") - ACE_TEXT ("DANCE_ROOT/bin/ciao.localityconfig\n"))); - - ACE_Env_Value<const ACE_TCHAR *> dance_env (ACE_TEXT ("DANCE_ROOT"), - ACE_TEXT ("")); - std::string filename (ACE_TEXT_ALWAYS_CHAR (dance_env)); - filename += "/bin/ciao.localityconfig"; - this->plugin_config_.push_back (filename.c_str ()); - } - } - - void - LocalityManager_Task::usage (void) - { - DANCE_TRACE ("LocalityManager_Task::usage"); - // Shouldn't be subject to CIAO's logging policy - ACE_ERROR ((LM_EMERGENCY, - ACE_TEXT ("Usage: dance_locality_manager <options>\n") - ACE_TEXT ("Options:\n") - ACE_TEXT ("\t-h|--help\t\t\t\tShow help\n") - ACE_TEXT ("\t-l|--log-level <level>\t\t\tSets log level (default 5). 1 - most detailed.\n") - ACE_TEXT ("\t-u|--uuid <uuid> \t\t\tSets UUID of spawned component server (required)\n") - ACE_TEXT ("\t-c|--callback-ior <string ior>\t\tSets callback url for the spawning Activator.\n") - ACE_TEXT ("\t-o|--output-ior <filename>\t\tOutputs the IOR of the component server object to file\n") - ACE_TEXT ("\t-p|--plugin-config <filename>\t\tReads specified file to configure plugins\n") - )); - - } -} diff --git a/DAnCE/dance/LocalityManager/Daemon/Locality_Manager_Task.h b/DAnCE/dance/LocalityManager/Daemon/Locality_Manager_Task.h deleted file mode 100644 index 3591129c84c..00000000000 --- a/DAnCE/dance/LocalityManager/Daemon/Locality_Manager_Task.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @file Locality_Manager_Task.h - * @author William R. Otte - * - * Defines interface for the bootstrap element of the Locality Manager. - */ - -#ifndef DAnCE_LOCALITY_TASK_H_ -#define DAnCE_LOCALITY_TASK_H_ - -#include "ace/String_Base.h" -#include "ace/Task.h" -#include "tao/ORB.h" -#include "dance/Deployment/Deployment_BaseC.h" - -#include <list> -#include <string> - -namespace DAnCE -{ - class LocalityManager_Task : ACE_Task_Base - { - public: - LocalityManager_Task (int argc, ACE_TCHAR **argv); - - int svc (void); - - struct Error - { - Error (const ACE_CString &err); - ACE_CString err_; - }; - - void run (void); - - private: - void parse_args (int argc, ACE_TCHAR **argv); - - void usage (void); - - CORBA::ORB_var orb_; - ::Deployment::Properties_var config_; - - ACE_TString uuid_; - ACE_TString callback_ior_str_; - ACE_TString output_file_; - - std::list < std::string > plugin_config_; - }; -} - -#endif diff --git a/DAnCE/dance/LocalityManager/Handler/Config_Handler_Impl.cpp b/DAnCE/dance/LocalityManager/Handler/Config_Handler_Impl.cpp deleted file mode 100644 index ba661da2c4a..00000000000 --- a/DAnCE/dance/LocalityManager/Handler/Config_Handler_Impl.cpp +++ /dev/null @@ -1,184 +0,0 @@ -// -*- C++ -*- -// TAO_IDL - Generated from -// be/be_codegen.cpp:1560 - -#include "tao/ORB_Core.h" -#include "Config_Handler_Impl.h" -#include "LocalityActivator_Impl.h" -#include "dance/LocalityManager/Scheduler/Plugin_Manager.h" - -#include "dance/DAnCE_PropertiesC.h" - -#ifdef GEN_OSTREAM_OPS -#include <iostream> -#include <sstream> -#endif /* GEN_OSTREAM_OPS */ - -namespace DAnCE -{ - const char * - Config_Handler_Impl::instance_type_ = - "edu.vanderbilt.dre.DAnCE.InstanceHandler"; - - // Implementation skeleton constructor - Config_Handler_Impl:: - Config_Handler_Impl (void) - { - } - - // Implementation skeleton destructor - Config_Handler_Impl::~Config_Handler_Impl (void) - { - } - - ::CORBA::StringSeq * - Config_Handler_Impl::dependencies (void) - { - ::CORBA::StringSeq *retval (0); - ACE_NEW_THROW_EX (retval, - ::CORBA::StringSeq (0), - CORBA::NO_MEMORY ()); - return retval; - } - - void - Config_Handler_Impl::close (void) - { - - } - - char * Config_Handler_Impl::instance_type (void) - { - DANCE_TRACE ("Config_Handler_Impl::instance_type"); - return CORBA::string_dup (Config_Handler_Impl::instance_type_); - } - - void - Config_Handler_Impl::install_instance (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - ::CORBA::Any_out instance_reference) - { - CORBA::Any *outany (0); - ACE_NEW_THROW_EX (outany, - CORBA::Any (), - CORBA::NO_MEMORY ()); - instance_reference = outany; - - if (plan.instance.length () <= instanceRef) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Config_Handler_Impl::install_instance - ") - ACE_TEXT ("Invalid instance reference %u provided ") - ACE_TEXT ("to install_instance\n"), - instanceRef)); - throw ::Deployment::PlanError (plan.UUID.in (), - "Invalid instance reference"); - } - - const ::Deployment::InstanceDeploymentDescription &idd = - plan.instance[instanceRef]; - - if (plan.implementation.length () <= idd.implementationRef) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Config_Handler_Impl::install_instance - ") - ACE_TEXT ("Invalid implementation reference %u provided ") - ACE_TEXT ("to install_instance\n"), - idd.implementationRef)); - throw ::Deployment::PlanError (plan.UUID.in (), - "Invalid Implementation reference"); - } - - const ::Deployment::MonolithicDeploymentDescription &mdd = - plan.implementation[idd.implementationRef]; - - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_TRACE, DLINFO - ACE_TEXT ("Config_Handler_Impl::install_instance - ") - ACE_TEXT ("Starting installation of instance <%C>\n"), - idd.name.in ())); - - const char *entrypt (0); - if (!DAnCE::Utility::get_property_value (DAnCE::DANCE_PLUGIN_ENTRYPT, - mdd.execParameter, - entrypt)) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Config_Handler_Impl::install_instance - ") - ACE_TEXT ("No entrypoint found for plug-in initialization\n"))); - throw ::Deployment::StartError (idd.name.in (), - "No entrypoint found for plug-in initialization\n"); - } - - const char *artifact (0); - if (!DAnCE::Utility::get_property_value (DAnCE::DANCE_PLUGIN_ARTIFACT, - mdd.execParameter, - artifact)) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Config_Handler_Impl::install_instance - ") - ACE_TEXT ("No artifact found for plug-in initialization\n"))); - throw ::Deployment::StartError (idd.name.in (), - "No artifact found for plug-in initialization\n"); - } - - int open_mode = ACE_DEFAULT_SHLIB_MODE; - if (!DAnCE::Utility::get_property_value (DAnCE::DANCE_PLUGIN_OPENMODE, - mdd.execParameter, - open_mode)) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Config_Handler_Impl::install_instance - ") - ACE_TEXT ("No open mode found for plug-in initialization\n"))); - throw ::Deployment::StartError (idd.name.in (), - "No open mode found for plug-in initialization\n"); - } - - PLUGIN_MANAGER::instance ()->register_configuration_plugin (ACE_TEXT_CHAR_TO_TCHAR (artifact), - ACE_TEXT_CHAR_TO_TCHAR (entrypt), - open_mode); - } - - void - Config_Handler_Impl::remove_instance (const ::Deployment::DeploymentPlan &, - ::CORBA::ULong, - const ::CORBA::Any &) - { - } - - void - Config_Handler_Impl::connect_instance (const ::Deployment::DeploymentPlan &, - ::CORBA::ULong, - const ::CORBA::Any &) - { - throw CORBA::NO_IMPLEMENT (); - } - - void - Config_Handler_Impl::disconnect_instance (const ::Deployment::DeploymentPlan &, - ::CORBA::ULong) - { - throw CORBA::NO_IMPLEMENT (); - } - - void - Config_Handler_Impl::configure (const ::Deployment::Properties &prop) - { - ::DAnCE::Utility::PROPERTY_MAP pmap (prop.length ()); - - ::DAnCE::Utility::build_property_map (pmap, prop); - } -} - -extern "C" -{ - ::DAnCE::InstanceDeploymentHandler_ptr create_Config_Handler (void) - { - return new DAnCE::Config_Handler_Impl (); - } -} diff --git a/DAnCE/dance/LocalityManager/Handler/Config_Handler_Impl.h b/DAnCE/dance/LocalityManager/Handler/Config_Handler_Impl.h deleted file mode 100644 index 2a4b8ec73e3..00000000000 --- a/DAnCE/dance/LocalityManager/Handler/Config_Handler_Impl.h +++ /dev/null @@ -1,94 +0,0 @@ -// -*- C++ -*- -/** - * @file Config_Handler_Impl.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - * - * Installation handler implementation for spawning LocalityManagers. - */ - -#ifndef DANCE_CONFIG_HANDLER_H -#define DANCE_CONFIG_HANDLER_H - -#include "dance/DAnCE_LocalityManagerC.h" -#include "dance/DAnCE_Utility.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "dance/LocalityManager/Handler/DAnCE_Locality_Handler_export.h" -#include "tao/LocalObject.h" - -namespace DAnCE -{ - class DAnCE_Locality_Handler_Export Config_Handler_Impl - : public virtual DAnCE::InstanceDeploymentHandler, - public virtual ::CORBA::LocalObject - { - public: - // Constructor - Config_Handler_Impl (void); - - // Destructor - virtual ~Config_Handler_Impl (void); - - virtual - char * instance_type (void); - - ::CORBA::StringSeq * - dependencies (void); - - virtual - void install_instance (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - ::CORBA::Any_out instance_reference); - - virtual - void activate_instance (const ::Deployment::DeploymentPlan & , - ::CORBA::ULong , - const ::CORBA::Any &) {}; - virtual - void passivate_instance (const ::Deployment::DeploymentPlan & , - ::CORBA::ULong , - const ::CORBA::Any &) {}; - - virtual - void remove_instance (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const ::CORBA::Any & instance_reference); - - virtual - void provide_endpoint_reference (const ::Deployment::DeploymentPlan &, - ::CORBA::ULong, - ::CORBA::Any_out) {}; - - virtual - void connect_instance (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong connectionRef, - const ::CORBA::Any & provided_reference); - - virtual - void disconnect_instance (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong connectionRef); - - virtual - void instance_configured (const ::Deployment::DeploymentPlan &, - ::CORBA::ULong) {}; - - virtual - void configure(const Deployment::Properties&); - - virtual void close (void); - - private: - static const char *instance_type_; - }; -} - -extern "C" -{ - ::DAnCE::InstanceDeploymentHandler_ptr - DAnCE_Locality_Handler_Export create_Config_Handler (void); -} - -#endif diff --git a/DAnCE/dance/LocalityManager/Handler/DAnCE_Locality_Handler_export.h b/DAnCE/dance/LocalityManager/Handler/DAnCE_Locality_Handler_export.h deleted file mode 100644 index 00813f7b390..00000000000 --- a/DAnCE/dance/LocalityManager/Handler/DAnCE_Locality_Handler_export.h +++ /dev/null @@ -1,55 +0,0 @@ -// -*- C++ -*- -// Definition for Win32 Export directives. -// ------------------------------ -#ifndef DANCE_LOCALITY_HANDLER_EXPORT_H -#define DANCE_LOCALITY_HANDLER_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (DANCE_LOCALITY_HANDLER_HAS_DLL) -# define DANCE_LOCALITY_HANDLER_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && DANCE_LOCALITY_HANDLER_HAS_DLL */ - -#if !defined (DANCE_LOCALITY_HANDLER_HAS_DLL) -# define DANCE_LOCALITY_HANDLER_HAS_DLL 1 -#endif /* ! DANCE_LOCALITY_HANDLER_HAS_DLL */ - -#if defined (DANCE_LOCALITY_HANDLER_HAS_DLL) && (DANCE_LOCALITY_HANDLER_HAS_DLL == 1) -# if defined (DANCE_LOCALITY_HANDLER_BUILD_DLL) -# define DAnCE_Locality_Handler_Export ACE_Proper_Export_Flag -# define DANCE_LOCALITY_HANDLER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define DANCE_LOCALITY_HANDLER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* DANCE_LOCALITY_HANDLER_BUILD_DLL */ -# define DAnCE_Locality_Handler_Export ACE_Proper_Import_Flag -# define DANCE_LOCALITY_HANDLER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define DANCE_LOCALITY_HANDLER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* DANCE_LOCALITY_HANDLER_BUILD_DLL */ -#else /* DANCE_LOCALITY_HANDLER_HAS_DLL == 1 */ -# define DAnCE_Locality_Handler_Export -# define DANCE_LOCALITY_HANDLER_SINGLETON_DECLARATION(T) -# define DANCE_LOCALITY_HANDLER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* DANCE_LOCALITY_HANDLER_HAS_DLL == 1 */ - -// Set DANCE_LOCALITY_HANDLER_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (DANCE_LOCALITY_HANDLER_NTRACE) -# if (ACE_NTRACE == 1) -# define DANCE_LOCALITY_HANDLER_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define DANCE_LOCALITY_HANDLER_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !DANCE_LOCALITY_HANDLER_NTRACE */ - -#if (DANCE_LOCALITY_HANDLER_NTRACE == 1) -# define DANCE_LOCALITY_HANDLER_TRACE(X) -#else /* (DANCE_LOCALITY_HANDLER_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define DANCE_LOCALITY_HANDLER_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (DANCE_LOCALITY_HANDLER_NTRACE == 1) */ - -#endif /* DANCE_LOCALITY_HANDLER_EXPORT_H */ - -// End of auto generated file. diff --git a/DAnCE/dance/LocalityManager/Handler/Inst_Handler_Impl.cpp b/DAnCE/dance/LocalityManager/Handler/Inst_Handler_Impl.cpp deleted file mode 100644 index bb853dfe9ac..00000000000 --- a/DAnCE/dance/LocalityManager/Handler/Inst_Handler_Impl.cpp +++ /dev/null @@ -1,212 +0,0 @@ -// -*- C++ -*- -// TAO_IDL - Generated from -// be/be_codegen.cpp:1560 - -#include "tao/ORB_Core.h" -#include "Inst_Handler_Impl.h" -#include "LocalityActivator_Impl.h" -#include "dance/LocalityManager/Scheduler/Plugin_Manager.h" - -#include "dance/DAnCE_PropertiesC.h" - -#ifdef GEN_OSTREAM_OPS -#include <iostream> -#include <sstream> -#endif /* GEN_OSTREAM_OPS */ - -namespace DAnCE -{ - const char * - Inst_Handler_Impl::instance_type_ = - "edu.vanderbilt.dre.DAnCE.InstanceHandler"; - - // Implementation skeleton constructor - Inst_Handler_Impl:: - Inst_Handler_Impl (void) - { - } - - // Implementation skeleton destructor - Inst_Handler_Impl::~Inst_Handler_Impl (void) - { - } - - ::CORBA::StringSeq * - Inst_Handler_Impl::dependencies (void) - { - ::CORBA::StringSeq *retval (0); - ACE_NEW_THROW_EX (retval, - ::CORBA::StringSeq (0), - CORBA::NO_MEMORY ()); - return retval; - } - - void - Inst_Handler_Impl::close (void) - { - } - - char * Inst_Handler_Impl::instance_type (void) - { - DANCE_TRACE ("Inst_Handler_Impl::instance_type"); - return CORBA::string_dup (Inst_Handler_Impl::instance_type_); - } - - void - Inst_Handler_Impl::install_instance (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - ::CORBA::Any_out instance_reference) - { - CORBA::Any *outany (0); - ACE_NEW_THROW_EX (outany, - CORBA::Any (), - CORBA::NO_MEMORY ()); - instance_reference = outany; - - if (plan.instance.length () <= instanceRef) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Inst_Handler_Impl::install_instance - ") - ACE_TEXT ("Invalid instance reference %u provided ") - ACE_TEXT ("to install_instance\n"), - instanceRef)); - throw ::Deployment::PlanError (plan.UUID.in (), - "Invalid instance reference"); - } - - const ::Deployment::InstanceDeploymentDescription &idd = - plan.instance[instanceRef]; - - if (plan.implementation.length () <= idd.implementationRef) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Inst_Handler_Impl::install_instance - ") - ACE_TEXT ("Invalid implementation reference %u provided ") - ACE_TEXT ("to install_instance\n"), - idd.implementationRef)); - throw ::Deployment::PlanError (plan.UUID.in (), - "Invalid Implementation reference"); - } - - const ::Deployment::MonolithicDeploymentDescription &mdd = - plan.implementation[idd.implementationRef]; - - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_TRACE, DLINFO - ACE_TEXT ("Inst_Handler_Impl::install_instance - ") - ACE_TEXT ("Starting installation of instance <%C>\n"), - idd.name.in ())); - - const char *entrypt (0); - if (!DAnCE::Utility::get_property_value (DAnCE::DANCE_PLUGIN_ENTRYPT, - mdd.execParameter, - entrypt)) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Inst_Handler_Impl::install_instance - ") - ACE_TEXT ("No entrypoint found for plug-in initialization\n"))); - throw ::Deployment::StartError (idd.name.in (), - "No entrypoint found for plug-in initialization\n"); - } - - const char *artifact (0); - if (!DAnCE::Utility::get_property_value (DAnCE::DANCE_PLUGIN_ARTIFACT, - mdd.execParameter, - artifact)) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Inst_Handler_Impl::install_instance - ") - ACE_TEXT ("No artifact found for plug-in initialization\n"))); - throw ::Deployment::StartError (idd.name.in (), - "No artifact found for plug-in initialization\n"); - } - - int open_mode = ACE_DEFAULT_SHLIB_MODE; - if (!DAnCE::Utility::get_property_value (DAnCE::DANCE_PLUGIN_OPENMODE, - mdd.execParameter, - open_mode)) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Inst_Handler_Impl::install_instance - ") - ACE_TEXT ("No open mode found for plug-in initialization\n"))); - throw ::Deployment::StartError (idd.name.in (), - "No open mode found for plug-in initialization\n"); - } - - Plugin_Manager::IH_DEPS deps; - - for (CORBA::ULong i = 0; i < idd.configProperty.length (); ++i) - { - if (ACE_OS::strcmp (idd.configProperty[i].name.in (), - DAnCE::DANCE_IDH_DEPENDSON) == 0) - { - const char *id (0); - - if (idd.configProperty[i].value >>= CORBA::Any::to_string (id, 0)) - { - deps.insert (id); - } - else - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Inst_Handler_Impl::install_instance - ") - ACE_TEXT ("Unable to extract dependency order from string"))); - throw ::Deployment::StartError (idd.name.in (), - "Unable to extract dependency order from string"); - } - } - } - - CORBA::String_var plugin_id = - PLUGIN_MANAGER::instance ()->register_installation_handler (ACE_TEXT_CHAR_TO_TCHAR (artifact), - ACE_TEXT_CHAR_TO_TCHAR (entrypt), - deps, - open_mode); - - (*outany) <<= CORBA::Any::from_string (plugin_id.in (), 0); - } - - void - Inst_Handler_Impl::remove_instance (const ::Deployment::DeploymentPlan &, - ::CORBA::ULong, - const ::CORBA::Any &) - { - } - - void - Inst_Handler_Impl::connect_instance (const ::Deployment::DeploymentPlan &, - ::CORBA::ULong, - const ::CORBA::Any &) - { - throw CORBA::NO_IMPLEMENT (); - } - - void - Inst_Handler_Impl::disconnect_instance (const ::Deployment::DeploymentPlan &, - ::CORBA::ULong) - { - throw CORBA::NO_IMPLEMENT (); - } - - void - Inst_Handler_Impl::configure (const ::Deployment::Properties &prop ) - { - ::DAnCE::Utility::PROPERTY_MAP pmap (prop.length ()); - - ::DAnCE::Utility::build_property_map (pmap, prop); - } -} - -extern "C" -{ - ::DAnCE::InstanceDeploymentHandler_ptr create_Inst_Handler (void) - { - return new DAnCE::Inst_Handler_Impl (); - } -} diff --git a/DAnCE/dance/LocalityManager/Handler/Inst_Handler_Impl.h b/DAnCE/dance/LocalityManager/Handler/Inst_Handler_Impl.h deleted file mode 100644 index ca1a966205c..00000000000 --- a/DAnCE/dance/LocalityManager/Handler/Inst_Handler_Impl.h +++ /dev/null @@ -1,94 +0,0 @@ -// -*- C++ -*- -/** - * @file Inst_Handler_Impl.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - * - * Installation handler implementation for spawning LocalityManagers. - */ - -#ifndef DANCE_INST_HANDLER_H -#define DANCE_INST_HANDLER_H - -#include "dance/DAnCE_LocalityManagerC.h" -#include "dance/DAnCE_Utility.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "dance/LocalityManager/Handler/DAnCE_Locality_Handler_export.h" -#include "tao/LocalObject.h" - -namespace DAnCE -{ - class DAnCE_Locality_Handler_Export Inst_Handler_Impl - : public virtual DAnCE::InstanceDeploymentHandler, - public virtual ::CORBA::LocalObject - { - public: - // Constructor - Inst_Handler_Impl (void); - - // Destructor - virtual ~Inst_Handler_Impl (void); - - virtual - char * instance_type (void); - - ::CORBA::StringSeq * - dependencies (void); - - virtual - void install_instance (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - ::CORBA::Any_out instance_reference); - - virtual - void activate_instance (const ::Deployment::DeploymentPlan & , - ::CORBA::ULong , - const ::CORBA::Any &) {}; - virtual - void passivate_instance (const ::Deployment::DeploymentPlan & , - ::CORBA::ULong , - const ::CORBA::Any &) {}; - - virtual - void remove_instance (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const ::CORBA::Any & instance_reference); - - virtual - void provide_endpoint_reference (const ::Deployment::DeploymentPlan &, - ::CORBA::ULong, - ::CORBA::Any_out) {}; - - virtual - void connect_instance (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong connectionRef, - const ::CORBA::Any & provided_reference); - - virtual - void disconnect_instance (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong connectionRef); - - virtual - void instance_configured (const ::Deployment::DeploymentPlan &, - ::CORBA::ULong) {}; - - virtual - void configure(const Deployment::Properties&); - - virtual void close (void); - - private: - static const char *instance_type_; - }; -} - -extern "C" -{ - ::DAnCE::InstanceDeploymentHandler_ptr - DAnCE_Locality_Handler_Export create_Inst_Handler (void); -} - -#endif diff --git a/DAnCE/dance/LocalityManager/Handler/Interceptor_Handler_Impl.cpp b/DAnCE/dance/LocalityManager/Handler/Interceptor_Handler_Impl.cpp deleted file mode 100644 index c636a03a3b4..00000000000 --- a/DAnCE/dance/LocalityManager/Handler/Interceptor_Handler_Impl.cpp +++ /dev/null @@ -1,185 +0,0 @@ -// -*- C++ -*- -// TAO_IDL - Generated from -// be/be_codegen.cpp:1560 - -#include "tao/ORB_Core.h" -#include "Interceptor_Handler_Impl.h" -#include "LocalityActivator_Impl.h" -#include "dance/LocalityManager/Scheduler/Plugin_Manager.h" - -#include "dance/DAnCE_PropertiesC.h" - -#ifdef GEN_OSTREAM_OPS -#include <iostream> -#include <sstream> -#endif /* GEN_OSTREAM_OPS */ - -namespace DAnCE -{ - const char * - Interceptor_Handler_Impl::instance_type_ = - DAnCE::DANCE_DEPLOYMENTINTERCEPTOR; - - // Implementation skeleton constructor - Interceptor_Handler_Impl:: - Interceptor_Handler_Impl (void) - { - } - - // Implementation skeleton destructor - Interceptor_Handler_Impl::~Interceptor_Handler_Impl (void) - { - } - - ::CORBA::StringSeq * - Interceptor_Handler_Impl::dependencies (void) - { - ::CORBA::StringSeq *retval (0); - ACE_NEW_THROW_EX (retval, - ::CORBA::StringSeq (0), - CORBA::NO_MEMORY ()); - return retval; - } - - void - Interceptor_Handler_Impl::close (void) - { - - } - - char * Interceptor_Handler_Impl::instance_type (void) - { - DANCE_TRACE ("Interceptor_Handler_Impl::instance_type"); - return CORBA::string_dup (Interceptor_Handler_Impl::instance_type_); - } - - void - Interceptor_Handler_Impl::install_instance (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - ::CORBA::Any_out instance_reference) - { - CORBA::Any *outany (0); - ACE_NEW_THROW_EX (outany, - CORBA::Any (), - CORBA::NO_MEMORY ()); - instance_reference = outany; - - if (plan.instance.length () <= instanceRef) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Interceptor_Handler_Impl::install_instance - ") - ACE_TEXT ("Invalid instance reference %u provided ") - ACE_TEXT ("to install_instance\n"), - instanceRef)); - throw ::Deployment::PlanError (plan.UUID.in (), - "Invalid instance reference"); - } - - const ::Deployment::InstanceDeploymentDescription &idd = - plan.instance[instanceRef]; - - if (plan.implementation.length () <= idd.implementationRef) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Interceptor_Handler_Impl::install_instance - ") - ACE_TEXT ("Invalid implementation reference %u provided ") - ACE_TEXT ("to install_instance\n"), - idd.implementationRef)); - throw ::Deployment::PlanError (plan.UUID.in (), - "Invalid Implementation reference"); - } - - const ::Deployment::MonolithicDeploymentDescription &mdd = - plan.implementation[idd.implementationRef]; - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("Interceptor_Handler_Impl::install_instance - ") - ACE_TEXT ("Starting installation of instance <%C>\n"), - idd.name.in ())); - - const char *entrypt (0); - if (!DAnCE::Utility::get_property_value (DAnCE::DANCE_PLUGIN_ENTRYPT, - mdd.execParameter, - entrypt)) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Interceptor_Handler_Impl::install_instance - ") - ACE_TEXT ("No entrypoint found for plug-in initialization\n"))); - throw ::Deployment::StartError (idd.name.in (), - "No entrypoint found for plug-in initialization\n"); - } - - const char *artifact (0); - if (!DAnCE::Utility::get_property_value (DAnCE::DANCE_PLUGIN_ARTIFACT, - mdd.execParameter, - artifact)) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Interceptor_Handler_Impl::install_instance - ") - ACE_TEXT ("No artifact found for plug-in initialization\n"))); - throw ::Deployment::StartError (idd.name.in (), - "No artifact found for plug-in initialization\n"); - } - - int open_mode = ACE_DEFAULT_SHLIB_MODE; - if (!DAnCE::Utility::get_property_value (DAnCE::DANCE_PLUGIN_OPENMODE, - mdd.execParameter, - open_mode)) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Interceptor_Handler_Impl::install_instance - ") - ACE_TEXT ("No open mode found for plug-in initialization\n"))); - throw ::Deployment::StartError (idd.name.in (), - "No open mode found for plug-in initialization\n"); - } - - PLUGIN_MANAGER::instance ()->register_interceptor (ACE_TEXT_CHAR_TO_TCHAR (artifact), - ACE_TEXT_CHAR_TO_TCHAR (entrypt), - open_mode); - } - - void - Interceptor_Handler_Impl::remove_instance (const ::Deployment::DeploymentPlan &, - ::CORBA::ULong, - const ::CORBA::Any &) - { - } - - void - Interceptor_Handler_Impl::connect_instance (const ::Deployment::DeploymentPlan &, - ::CORBA::ULong, - const ::CORBA::Any &) - { - throw CORBA::NO_IMPLEMENT (); - } - - void - Interceptor_Handler_Impl::disconnect_instance (const ::Deployment::DeploymentPlan &, - ::CORBA::ULong) - { - throw CORBA::NO_IMPLEMENT (); - } - - void - Interceptor_Handler_Impl::configure (const ::Deployment::Properties &prop ) - { - ::DAnCE::Utility::PROPERTY_MAP pmap (prop.length ()); - - ::DAnCE::Utility::build_property_map (pmap, - prop); - } -} - -extern "C" -{ - ::DAnCE::InstanceDeploymentHandler_ptr create_Interceptor_Handler (void) - { - return new DAnCE::Interceptor_Handler_Impl (); - } -} diff --git a/DAnCE/dance/LocalityManager/Handler/Interceptor_Handler_Impl.h b/DAnCE/dance/LocalityManager/Handler/Interceptor_Handler_Impl.h deleted file mode 100644 index f3065575a49..00000000000 --- a/DAnCE/dance/LocalityManager/Handler/Interceptor_Handler_Impl.h +++ /dev/null @@ -1,94 +0,0 @@ -// -*- C++ -*- -/** - * @file Interceptor_Handler_Impl.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - * - * Installation handler implementation for spawning LocalityManagers. - */ - -#ifndef DANCE_INTERCEPTOR_HANDLER_H -#define DANCE_INTERCEPTOR_HANDLER_H - -#include "dance/DAnCE_LocalityManagerC.h" -#include "dance/DAnCE_Utility.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "dance/LocalityManager/Handler/DAnCE_Locality_Handler_export.h" -#include "tao/LocalObject.h" - -namespace DAnCE -{ - class DAnCE_Locality_Handler_Export Interceptor_Handler_Impl - : public virtual DAnCE::InstanceDeploymentHandler, - public virtual ::CORBA::LocalObject - { - public: - // Constructor - Interceptor_Handler_Impl (void); - - // Destructor - virtual ~Interceptor_Handler_Impl (void); - - virtual - char * instance_type (void); - - ::CORBA::StringSeq * - dependencies (void); - - virtual - void install_instance (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - ::CORBA::Any_out instance_reference); - - virtual - void activate_instance (const ::Deployment::DeploymentPlan & , - ::CORBA::ULong , - const ::CORBA::Any &) {}; - virtual - void passivate_instance (const ::Deployment::DeploymentPlan & , - ::CORBA::ULong , - const ::CORBA::Any &) {}; - - virtual - void remove_instance (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const ::CORBA::Any & instance_reference); - - virtual - void provide_endpoint_reference (const ::Deployment::DeploymentPlan &, - ::CORBA::ULong, - ::CORBA::Any_out) {}; - - virtual - void connect_instance (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong connectionRef, - const ::CORBA::Any & provided_reference); - - virtual - void disconnect_instance (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong connectionRef); - - virtual - void instance_configured (const ::Deployment::DeploymentPlan &, - ::CORBA::ULong) {}; - - virtual - void configure(const Deployment::Properties&); - - virtual void close (void); - - private: - static const char *instance_type_; - }; -} - -extern "C" -{ - ::DAnCE::InstanceDeploymentHandler_ptr - DAnCE_Locality_Handler_Export create_Interceptor_Handler (void); -} - -#endif diff --git a/DAnCE/dance/LocalityManager/Handler/LocalityActivator_Impl.cpp b/DAnCE/dance/LocalityManager/Handler/LocalityActivator_Impl.cpp deleted file mode 100644 index 65593212880..00000000000 --- a/DAnCE/dance/LocalityManager/Handler/LocalityActivator_Impl.cpp +++ /dev/null @@ -1,763 +0,0 @@ -#include "LocalityActivator_Impl.h" -#include "ace/Log_Msg.h" -#include "ace/UUID.h" -#include "dance/Logger/Log_Macros.h" -#include "dance/DAnCE_PropertiesC.h" -#include "tao/ORB_Core.h" -#include "dance/LocalityManager/Scheduler/Plugin_Manager.h" - -namespace DAnCE -{ - DAnCE_LocalityActivator_i::DAnCE_LocalityActivator_i (CORBA::ULong def_spawn_delay, - const char * default_cs_path, - const char * cs_args, - bool multithreaded, - CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa) - : spawn_delay_ (def_spawn_delay), - multithreaded_ (multithreaded), - orb_ (CORBA::ORB::_duplicate (orb)), - poa_ (PortableServer::POA::_duplicate (poa)), - cs_path_ (default_cs_path), - cs_args_ (cs_args), - mutex_ (), - condition_ (mutex_) - { - DANCE_TRACE ("DAnCE_LocalityActivator_i::DAnCE_LocalityActivator_i"); - ACE_Utils::UUID_GENERATOR::instance ()->init (); - - // initialize the process manager with the ORBs reactor - // so the exit handlers get triggered when needed - this->process_manager_.open (ACE_Process_Manager::DEFAULT_SIZE, - this->orb_->orb_core ()->reactor ()); - } - - DAnCE_LocalityActivator_i::~DAnCE_LocalityActivator_i(void) - { - } - - void - DAnCE_LocalityActivator_i::locality_manager_callback ( - ::DAnCE::LocalityManager_ptr serverref, - const char * server_UUID, - ::Deployment::Properties_out config) - { - DANCE_TRACE("DAnCE_LocalityActivator_i::locality_manager_callback"); - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_TRACE, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::locality_manager_callback - ") - ACE_TEXT ("Received callback from LocalityManager %C\n"), - server_UUID)); - - Server_Info *info = 0; - - { - ACE_GUARD_THROW_EX ( TAO_SYNCH_MUTEX, - guard, - this->container_mutex_, - CORBA::NO_RESOURCES ()); - for (SERVER_INFOS::iterator i (this->server_infos_.begin ()); - i != this->server_infos_.end (); ++i) - { - DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::locality_manager_callback - ") - ACE_TEXT ("Comparing %C with %C\n"), - (*i)->uuid_.c_str (), server_UUID)); - if ((*i)->uuid_ == server_UUID) - { - info = (*i).get (); - } - } - } - - if (!info) - { - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, - (LM_WARNING, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::locality_manager_callback - ") - ACE_TEXT ("Received callback from LocalityManager %C, which doesn't belong to me.\n"), - server_UUID)); - throw ::CORBA::BAD_PARAM (); - } - - if (info->status_ == Server_Info::ACTIVE) - { - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::locality_manager_callback - ") - ACE_TEXT ("Received callback from LocalityManager %C, ") - ACE_TEXT ("which has already been configured.\n"), - server_UUID)); - throw ::CORBA::BAD_INV_ORDER (); - } - - if (!CORBA::is_nil (info->ref_)) - { - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::locality_manager_callback - ") - ACE_TEXT ("Received callback from LocalityManager %C, ") - ACE_TEXT ("which has already called back.\n"), - server_UUID)); - throw ::CORBA::BAD_INV_ORDER (); - } - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::locality_manager_callback - ") - ACE_TEXT ("Received callback from LocalityManager %C\n"), - server_UUID)); - - info->ref_ = ::DAnCE::LocalityManager::_duplicate (serverref); - - this->create_properties (*info, config); - - // @@TODO: May want to print out configvalues here. - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::locality_manager_callback - ") - ACE_TEXT ("Generated %u Properties for LocalityManager %C\n"), - config->length (), server_UUID)); - } - - void - DAnCE_LocalityActivator_i::configuration_complete (const char *server_UUID) - { - DANCE_TRACE ("DAnCE_LocalityActivator_i::configuration_complete"); - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_TRACE, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::configuration_complete - ") - ACE_TEXT ("Received configuration_complete from LocalityManager %C\n"), - server_UUID)); - - try - { - Server_Info *info = 0; - - { - ACE_GUARD_THROW_EX ( TAO_SYNCH_MUTEX, - guard, - this->container_mutex_, - CORBA::NO_RESOURCES ()); - for (SERVER_INFOS::iterator j (this->server_infos_.begin ()); - j != this->server_infos_.end (); ++j) - { - if ((*j)->uuid_ == server_UUID) - { - info = (*j).get (); - } - } - } - - if (!info) - { - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, - (LM_WARNING, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::configuration_complete - ") - ACE_TEXT ("Received configuration_complete from LocalityManager %C, which doesn't belong to me.\n"), - server_UUID)); - throw ::CORBA::BAD_PARAM (); - } - - if (info->status_ == Server_Info::ACTIVE) - { - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::configuration_complete - ") - ACE_TEXT ("Received configuration_complete from LocalityManager %C, ") - ACE_TEXT ("which has already been completed.\n"), - server_UUID)); - throw ::CORBA::BAD_INV_ORDER (); - } - - if (CORBA::is_nil (info->ref_.in ())) - { - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::configuration_complete - ") - ACE_TEXT ("Received configuration_complete from LocalityManager %C, ") - ACE_TEXT ("which has not called back.\n"), - server_UUID)); - throw ::CORBA::BAD_INV_ORDER (); - } - - ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, - guard, - info->mutex_, - CORBA::NO_RESOURCES ()); - info->status_ = Server_Info::ACTIVE; - info->condition_.signal (); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::configuration_complete - ") - ACE_TEXT ("Caught unknown exception while processing ") - ACE_TEXT ("configuration_complete\n"))); - throw; - } - } - - ::DAnCE::LocalityManager_ptr - DAnCE_LocalityActivator_i::create_locality_manager (const ::Deployment::DeploymentPlan &plan, - CORBA::ULong instanceRef, - const ::Deployment::Properties & config) - { - DANCE_TRACE("DAnCE_LocalityActivator_i::create_locality_manager"); - - Safe_Server_Info server (new Server_Info (plan, - instanceRef, - config.length () + 1)); - - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::create_locality_manager - ") - ACE_TEXT ("Received %u config properties\n"), - config.length ())); - - DAnCE::Utility::build_property_map (*server->cmap_, config); - - ACE_CString cmd_options = this->construct_command_line (*server); - - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::create_locality_manager - ") - ACE_TEXT ("LocalityManager arguments: %C\n"), - cmd_options.c_str ())); - - { - ACE_GUARD_THROW_EX ( TAO_SYNCH_MUTEX, - guard, - this->container_mutex_, - CORBA::NO_RESOURCES ()); - server_infos_.insert (server); - } - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::create_locality_manager - ") - ACE_TEXT ("Attempting to spawn LocalityManager with UUID %C\n"), - server->uuid_.c_str ())); - - // Now we need to get a copy of the one that was inserted... - pid_t const pid = this->spawn_locality_manager (new Server_Child_Handler (server), - cmd_options); - - ACE_Time_Value timeout (this->spawn_delay_); - - CORBA::Any val; - - if (server->cmap_->find (DAnCE::LOCALITY_TIMEOUT, val) == 0) - { - CORBA::ULong t; - if (val >>= t) - { - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::create_locality_manager - ") - ACE_TEXT ("Using provided non-default server timeout of %u\n"), t)); - timeout = ACE_Time_Value (t); - } - else - { - DANCE_ERROR (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_WARNING, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::create_locality_manager - ") - ACE_TEXT ("Failed to extract provided non-default server timeout ") - ACE_TEXT ("from property '%C', ") - ACE_TEXT ("falling back to default timeout of %u\n"), - this->spawn_delay_)); - } - } - - if (this->multithreaded_) - this->multi_threaded_wait_for_callback (*server, timeout); - else - this->single_threaded_wait_for_callback (*server, timeout); - - server->pid_ = pid; // register pid of successfully started lm processkate - - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::create_locality_manager - ") - ACE_TEXT ("LocalityManager %C successfully spawned and configured!\n"), - server->uuid_.c_str ())); - - return ::DAnCE::LocalityManager::_duplicate (server->ref_.in ()); - } - - ACE_CString - DAnCE_LocalityActivator_i::construct_command_line (Server_Info &server) - { - DANCE_TRACE ("DAnCE_LocalityActivator_i::construct_command_line"); - - // Build our command line to launch the component server - ACE_CString cmd_options (this->cs_args_); - - CORBA::Any val; - - if (server.cmap_->find (DAnCE::LOCALITY_UUID, val) == 0) - { - // Nodeapplication has requested a custom uuid - DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::construct_command_line - ") - ACE_TEXT ("Using provided UUID\n"))); - const char *uuid = 0; - val >>= uuid; - server.uuid_ = uuid; - } - else - { - DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::construct_command_line - ") - ACE_TEXT ("Using generated UUID\n"))); - ACE_Utils::UUID uuid; - ACE_Utils::UUID_GENERATOR::instance ()->generate_UUID (uuid); - server.uuid_ = *uuid.to_string (); - } - - if (server.cmap_->find (DAnCE::LOCALITY_ARGUMENTS, val) == 0) - { - const char *args = 0; - val >>= args; - - DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, (LM_TRACE, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::construct_command_line - ") - ACE_TEXT ("Adding provided server arguments %C\n"), args)); - - cmd_options += ' '; - cmd_options += args; - cmd_options += ' '; - } - - if (server.cmap_->find (DAnCE::DANCE_LM_CONFIGFILE, val) == 0) - { - const char *args = 0; - val >>= args; - - DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, (LM_TRACE, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::construct_command_line - ") - ACE_TEXT ("Adding provided locality configuration file %C\n"), args)); - - cmd_options += " --plugin-config "; - cmd_options += args; - cmd_options += ' '; - } - - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::construct_command_line - ") - ACE_TEXT ("Creating component server") - ACE_TEXT (" with UUID %C\n"), server.uuid_.c_str ())); - - cmd_options += " -u "; - cmd_options += server.uuid_; - - return cmd_options; - } - - pid_t - DAnCE_LocalityActivator_i::spawn_locality_manager (Server_Child_Handler* exit_handler, - const ACE_CString &cmd_line) - { - DANCE_TRACE ("DAnCE_LocalityActivator_i::spawn_locality_manager"); - - const Server_Info &si = exit_handler->server_info (); - - // Get my object reference - CORBA::Object_var obj = this->poa_->servant_to_reference (this); - CORBA::String_var ior = this->orb_->object_to_string (obj.in ()); - CORBA::Any val; - - const char *path = this->cs_path_.c_str (); - - if (si.cmap_->find (DAnCE::LOCALITY_EXECUTABLE, val) == 0) - { - val >>= path; - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::spawn_locality_manager - ") - ACE_TEXT ("Using provided component server executable: %C\n"), - path)); - } - else - { - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::spawn_locality_manager - ") - ACE_TEXT ("Using default component server executable\n"))); - } - - ACE_Process_Options options (true, - ACE_OS::strlen (path) + ACE_OS::strlen (cmd_line.c_str()) + ACE_OS::strlen (ior.in ()) + 15); - if (options.command_line ("%s %s -c %s", - path, - cmd_line.c_str (), - ior.in ()) != 0) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO - ACE_TEXT ("Failed to create commandline\n"))); - throw Deployment::StartError ("locality_manager", - "Failed to create command line for server"); - } - - options.avoid_zombies (0); - - // check for customized PATH addition - if (si.cmap_->find (DANCE_LM_PATH, val) == 0) - { - path = 0; - val >>= path; - if (path) - { - ACE_CString newpath (ACE_OS::getenv ("PATH")); - newpath += ACE_TEXT_ALWAYS_CHAR (ACE_LD_SEARCH_PATH_SEPARATOR_STR); - newpath += path; - options.setenv (ACE_TEXT("PATH"), ACE_TEXT_CHAR_TO_TCHAR (newpath.c_str ())); - - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_TRACE, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::spawn_locality_manager - ") - ACE_TEXT ("configured customized PATH environment: %C\n"), - newpath.c_str ())); - } - } - - // check for customized LD search path addition - if (si.cmap_->find (DANCE_LM_LIBPATH, val) == 0) - { - path = 0; - val >>= path; - if (path) - { - ACE_CString newpath (ACE_OS::getenv (ACE_TEXT_ALWAYS_CHAR (ACE_LD_SEARCH_PATH))); - newpath += ACE_TEXT_ALWAYS_CHAR (ACE_LD_SEARCH_PATH_SEPARATOR_STR); - newpath += path; - options.setenv (ACE_LD_SEARCH_PATH, ACE_TEXT_CHAR_TO_TCHAR (newpath.c_str ())); - - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_TRACE, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::spawn_locality_manager - ") - ACE_TEXT ("configured customized %s environment: %C\n"), - ACE_LD_SEARCH_PATH, - newpath.c_str ())); - } - } - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::spawn_locality_manager - ") - ACE_TEXT ("Spawning process, command line is %s\n"), - options.command_line_buf ())); - - pid_t const pid = this->process_manager_.spawn (options, - exit_handler); - - if (pid == ACE_INVALID_PID) - { - // clean up as in this case the handler did not get registered - delete exit_handler; - - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::spawn_locality_manager - ") - ACE_TEXT ("Failed to spawn a LocalityManager process\n"))); - throw Deployment::StartError ("locality_manager", - "Failed to spawn process"); - } - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_TRACE, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::spawn_locality_manager - ") - ACE_TEXT ("Process successfully spawned with pid %u\n"), - pid)); - return pid; - } - - void - DAnCE_LocalityActivator_i:: - single_threaded_wait_for_callback (const Server_Info &si, - ACE_Time_Value &timeout) - { - DANCE_TRACE ("DAnCE_LocalityActivator_i::single_threaded_wait_for_callback"); - - // Below code is broken for thread-per-connection concurrency model, - // since the main thread is running ORB event loop and will spawn - // a different thread to handle the call <register_node_application>, - // the <perform_work> operation will not be invoked and finally - // a timeout will occur. For a similar reason, it won't work - // for thread-pool concurrency model. - while (true) - { - if (si.status_ != Server_Info::ACTIVE && si.status_ != Server_Info::TERMINATED) - { - ACE_GUARD_THROW_EX ( TAO_SYNCH_MUTEX, - guard, - this->mutex_, - CORBA::NO_RESOURCES ()); - // The next guy to acquire the mutex may have already - // been activated by the previous leader's perform_work, - // so let's check to make sure that only non-activated - // folks are hanging on perform_work. - if (si.status_ != Server_Info::ACTIVE && si.status_ != Server_Info::TERMINATED) - { - this->orb_->perform_work (timeout); - } - } - - if (si.status_ == Server_Info::TERMINATED) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::single_threaded_wait_for_callback - ") - ACE_TEXT ("Startup failed for LocalityManager %C; process exited before activation.\n"), - si.uuid_.c_str ())); - throw ::Deployment::StartError ("locality_manager", - "Failed to startup LocalityManager"); - } - - if (si.status_ == Server_Info::ACTIVE) - { - break; - } - - if (timeout == ACE_Time_Value::zero) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::single_threaded_wait_for_callback - ") - ACE_TEXT ("Timed out while waiting for LocalityManager %C to call back.\n"), - si.uuid_.c_str ())); - throw ::Deployment::StartError ("locality_manager", - "Timed out waiting for LocalityManager"); - } - } - } - - void - DAnCE_LocalityActivator_i:: - multi_threaded_wait_for_callback (Server_Info &si, - ACE_Time_Value &timeout) - { - DANCE_TRACE ("DAnCE_LocalityActivator_i::multi_threaded_wait_for_callback"); - - // Wait for a conditional variable - ACE_GUARD_THROW_EX ( TAO_SYNCH_MUTEX, - guard, - si.mutex_, - CORBA::NO_RESOURCES ()); - - while (si.status_ != Server_Info::ACTIVE) - { - if (si.condition_.wait (&timeout) == -1) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::multi_threaded_wait_for_callback - ") - ACE_TEXT ("Timed out while waiting for LocalityManager %C to call back.\n"), - si.uuid_.c_str ())); - throw Deployment::StartError ("locality_manager", - "timed out waiting for callback"); - } - - if (si.status_ == Server_Info::TERMINATED) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::multi_threaded_wait_for_callback - ") - ACE_TEXT ("Startup failed for LocalityManager %C; process exited before activation.\n"), - si.uuid_.c_str ())); - throw ::Deployment::StartError ("locality_manager", - "Failed to startup LocalityManager"); - } - } - } - - void - DAnCE_LocalityActivator_i::remove_locality_manager (::DAnCE::LocalityManager_ptr server) - { - DANCE_TRACE ("DAnCE_LocalityActivator_i::remove_locality_manager"); - - Safe_Server_Info info; - - { - ACE_GUARD_THROW_EX ( TAO_SYNCH_MUTEX, - guard, - this->container_mutex_, - CORBA::NO_RESOURCES ()); - - SERVER_INFOS::iterator i; - for (i = this->server_infos_.begin (); - i != this->server_infos_.end (); - ++i) - { - if ((!i->null ()) && - (!CORBA::is_nil ((*i)->ref_)) && - (*i)->ref_->_is_equivalent (server)) - { - info = *i; - this->server_infos_.erase (i); - break; - } - } - } - - if (!info) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::remove_locality_manager - ") - ACE_TEXT ("Failed to find equivalent LocalityManager under my management.\n"))); - throw ::Deployment::StopError ("locality manager", - "unable to stop locality manager"); - } - - if (info->status_ == Server_Info::TERMINATED) - { - DANCE_DEBUG (DANCE_LOG_WARNING, - (LM_DEBUG, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::remove_locality_manager - ") - ACE_TEXT ("Locality Manager with UUID <%C> already terminated\n"), - info->uuid_.c_str ())); - return; - } - - try - { - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_TRACE, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::remove_locality_manager - ") - ACE_TEXT ("Calling shutdown on LocalityManager %C\n"), - info->uuid_.c_str ())); - info->status_ = Server_Info::TERMINATE_REQUESTED; - server->shutdown (); - } - catch (::Deployment::StopError &) - { - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, - (LM_WARNING, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::remove_locality_manager - ") - ACE_TEXT ("Received RemoveFailure exception from LocalityManager %C\n"), - info->uuid_.c_str ())); - } - - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_INFO, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::remove_locality_manager - ") - ACE_TEXT ("LocalityManager %C successfully shut down.\n"), - info->uuid_.c_str ())); - } - - void - DAnCE_LocalityActivator_i::create_properties ( - const Server_Info &info, - Deployment::Properties_out config) - { - DANCE_DEBUG (DANCE_LOG_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::create_properties - ") - ACE_TEXT ("Creating property sequence for LocalityManager <%C> with ") - ACE_TEXT ("length %u\n"), - info.uuid_.c_str (), - info.cmap_->current_size ())); - - if (info.cmap_->current_size () == 0) return; - - ACE_NEW_THROW_EX (config, - Deployment::Properties (info.cmap_->current_size ()), - CORBA::NO_MEMORY ()); - - config->length (info.cmap_->current_size ()); - - CORBA::ULong pos = 0; - Utility::PROPERTY_MAP::iterator i = info.cmap_->begin (); - - do { - config[pos].name = i->ext_id_.c_str (); - config[pos].value = i->int_id_; - ++pos; - } while (i.advance () != 0); - } - - DAnCE_LocalityActivator_i::Server_Child_Handler::Server_Child_Handler ( - const Safe_Server_Info& si) - : server_info_ (si) - {} - - DAnCE_LocalityActivator_i::Server_Child_Handler::~Server_Child_Handler () - { - } - - int DAnCE_LocalityActivator_i::Server_Child_Handler::handle_close ( - ACE_HANDLE, ACE_Reactor_Mask) - { - DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::Server_Child_Handler::handle_close\n"))); - - delete this; // clean us up - return 0; - } - - int DAnCE_LocalityActivator_i::Server_Child_Handler::handle_exit ( - ACE_Process *proc) - { - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_INFO, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::Server_Child_Handler::handle_exit") - ACE_TEXT (" - Locality Manager UUID %C, pid=%d: %d\n"), - this->server_info_->uuid_.c_str (), - int (proc->getpid ()), - int (proc->exit_code ()) )); - - // this method is guaranteed to be called synchronously - // so we can safely call anything we like - - // Check if the termination was requested, log an error if not. - if (this->server_info_->status_ != Server_Info::TERMINATE_REQUESTED) - { - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("DAnCE_LocalityActivator_i::Server_Child_Handler::handle_exit - ") - ACE_TEXT ("Error: Unexpected locality shutdown.\n"))); - - const DAnCE::Plugin_Manager::INTERCEPTORS &interceptors = - PLUGIN_MANAGER::instance ()->fetch_interceptors (); - - for (Plugin_Manager::INTERCEPTORS::const_iterator i = interceptors.begin (); - i != interceptors.end (); - ++i) - { - try - { - ::CORBA::Any tmp; - (*i)->unexpected_event (this->server_info_->plan_, - this->server_info_->instanceRef_, - tmp, - "Unexpected component server exit."); - } - catch (...) - { - // swallow - } - } - } - - // flag this process as exited - this->server_info_->status_ = Server_Info::TERMINATED; - - // signal possibly waiting startup thread - this->server_info_->condition_.signal (); - - return 0; - } - -} - - diff --git a/DAnCE/dance/LocalityManager/Handler/LocalityActivator_Impl.h b/DAnCE/dance/LocalityManager/Handler/LocalityActivator_Impl.h deleted file mode 100644 index be0a18cbb83..00000000000 --- a/DAnCE/dance/LocalityManager/Handler/LocalityActivator_Impl.h +++ /dev/null @@ -1,201 +0,0 @@ -/** - * @file LocalityActivator_Impl.h - * @author William R. Otte - */ - -#ifndef DAnCE_LocalityActivator_H_ -#define DAnCE_LocalityActivator_H_ - -#include "ace/Process_Manager.h" -#include "ace/Event_Handler.h" -#include "ace/Condition_T.h" -#include "ace/OS_NS_sys_wait.h" -#include "ace/Refcounted_Auto_Ptr.h" -#include "ace/Unbounded_Set_Ex.h" -#include "ace/Synch_Traits.h" -#include "ace/Condition_T.h" -#include "tao/PortableServer/PortableServer.h" -#include "dance/DAnCE_LocalityManagerS.h" -#include "dance/DAnCE_Utility.h" - -#include <set> - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -namespace DAnCE -{ - /** - * @author William R. Otte <wotte@dre.vanderbilt.edu> - * @brief Default server activator for CIAO component servers. - * - * Implements the default component server activation strategy - * which is to spawn new processes. This is not thread-safe, - * nor is it intended to be. Containers are reated serially, - * so there will be only one actor *modifying* data at a particular - * point in time. - */ - class DAnCE_LocalityActivator_i - : public virtual ::POA_DAnCE::LocalityManagerActivator - { - public: - /// Constructor - DAnCE_LocalityActivator_i (CORBA::ULong def_spawn_delay, - const char * default_cs_path, - const char * cs_args, - bool multithreaded, - CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa_); - - /// Destructor - virtual ~DAnCE_LocalityActivator_i (void); - - virtual - void locality_manager_callback (::DAnCE::LocalityManager_ptr serverref, - const char * server_UUID, - ::Deployment::Properties_out config); - - virtual void configuration_complete (const char *server_UUID); - - ::DAnCE::LocalityManager_ptr - create_locality_manager (const ::Deployment::DeploymentPlan &plan, - CORBA::ULong instanceRef, - const ::Deployment::Properties & config); - - void remove_locality_manager ( - ::DAnCE::LocalityManager_ptr server); - - ::DAnCE::LocalityManager * get_locality_managers (void); - - private: - struct Server_Info; - class Server_Child_Handler; - - /// Builds command line options based on configuration information. - /// May modify the uuid of the component server. - ACE_CString construct_command_line (Server_Info &si); - - /// Spawns the component server process, but does not wait for it - /// to call back. - pid_t spawn_locality_manager (Server_Child_Handler* exit_handler, - const ACE_CString &cmd_line); - - /// This method is only applicable when our program is configured as - /// singled threaded . Internally it uses a @c perform_work blocking - /// call to wait for NA object to call back - void single_threaded_wait_for_callback (const Server_Info &si, - ACE_Time_Value &timeout); - - /// This method is only applicable when our program is configured as - /// multiple threaded. Internally it waits on a conditional variable - /// that could be modified by the callback servant which runs in - /// another thread - void multi_threaded_wait_for_callback (Server_Info &si, - ACE_Time_Value &timeout); - - void create_properties (const Server_Info &info, - Deployment::Properties_out config); - - struct Server_Info - { - enum ProcessStatus - { - ACTIVE, - TERMINATE_REQUESTED, - TERMINATED, - INACTIVE - }; - - Server_Info (const ::Deployment::DeploymentPlan &plan, - CORBA::ULong instanceRef, - size_t cmap_size_hint = 128) - : cmap_ (new DAnCE::Utility::PROPERTY_MAP (cmap_size_hint)), - ref_ (DAnCE::LocalityManager::_nil ()), - pid_ (ACE_INVALID_PID), - status_ (INACTIVE), - mutex_ (), - condition_ (mutex_), - plan_ (plan), - instanceRef_ (instanceRef) - {} - - typedef ACE_Refcounted_Auto_Ptr <DAnCE::Utility::PROPERTY_MAP, - ACE_Null_Mutex> PROPERTY_MAP_PTR; - - ACE_CString uuid_; - PROPERTY_MAP_PTR cmap_; - DAnCE::LocalityManager_var ref_; - pid_t pid_; - ProcessStatus status_; - TAO_SYNCH_MUTEX mutex_; - ACE_Condition<TAO_SYNCH_MUTEX> condition_; - const ::Deployment::DeploymentPlan &plan_; - CORBA::ULong instanceRef_; - }; - - typedef ACE_Refcounted_Auto_Ptr<Server_Info, ACE_Null_Mutex> Safe_Server_Info; - - /** - * @brief The exit handler class for the locality manager child process - * to detect and report process exit - */ - class Server_Child_Handler : public virtual ACE_Event_Handler - { - public: - Server_Child_Handler (const Safe_Server_Info& si); - virtual ~Server_Child_Handler (); - - virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask); - - virtual int handle_exit (ACE_Process *proc); - - const Server_Info& server_info () const - { - return *this->server_info_; - } - private: - Safe_Server_Info server_info_; - }; - - struct _server_info - { - bool operator() (const Safe_Server_Info &a, const Safe_Server_Info &b) const - { - return a->uuid_ < b->uuid_; - } - }; - - // Presumably, there won't be too many component servers per node application - typedef std::set <Safe_Server_Info, _server_info> SERVER_INFOS; - - /// Default args to pass to all componentservers. - ACE_CString default_args_; - - TAO_SYNCH_MUTEX container_mutex_; - - SERVER_INFOS server_infos_; - - ACE_Process_Manager process_manager_; - - CORBA::ULong spawn_delay_; - - /////*******NEW - bool multithreaded_; - - CORBA::ORB_var orb_; - - PortableServer::POA_var poa_; - - ACE_CString cs_path_; - - ACE_CString cs_args_; - - TAO_SYNCH_MUTEX mutex_; - - ACE_Condition<TAO_SYNCH_MUTEX> condition_; - }; - - -} -#endif /* DAnCE_LocalityActivator_H_ */ diff --git a/DAnCE/dance/LocalityManager/Handler/LocalityHandler.mpc b/DAnCE/dance/LocalityManager/Handler/LocalityHandler.mpc deleted file mode 100644 index f1a0cca7dae..00000000000 --- a/DAnCE/dance/LocalityManager/Handler/LocalityHandler.mpc +++ /dev/null @@ -1,25 +0,0 @@ -project(DAnCE_Locality_Handler) : dance_skel, dance_split_plan, dance_lib, dance_output, dance_logger, \ - dance_deployment_scheduler, install { - - dynamicflags += DANCE_LOCALITY_HANDLER_BUILD_DLL - Source_Files { - LocalityActivator_Impl.cpp - Locality_Manager_Handler_Impl.cpp - Inst_Handler_Impl.cpp - Interceptor_Handler_Impl.cpp - Config_Handler_Impl.cpp - Plugin_Conf.cpp - } - - Header_Files { - LocalityActivator_Impl.h - Locality_Manager_Handler_Impl.h - Inst_Handler_Impl.h - Interceptor_Handler_Impl.h - Config_Handler_Impl.h - Plugin_Conf.h - } - specific { - install_dir = dance/LocalityManager/Handler - } -} diff --git a/DAnCE/dance/LocalityManager/Handler/Locality_Manager_Handler_Impl.cpp b/DAnCE/dance/LocalityManager/Handler/Locality_Manager_Handler_Impl.cpp deleted file mode 100644 index 2f30daa75e7..00000000000 --- a/DAnCE/dance/LocalityManager/Handler/Locality_Manager_Handler_Impl.cpp +++ /dev/null @@ -1,255 +0,0 @@ -// -*- C++ -*- -// TAO_IDL - Generated from -// be/be_codegen.cpp:1560 - -#include "tao/ORB_Core.h" -#include "Locality_Manager_Handler_Impl.h" -#include "LocalityActivator_Impl.h" -#include "dance/LocalityManager/Scheduler/Plugin_Manager.h" - -#include "dance/DAnCE_PropertiesC.h" - -#ifdef GEN_OSTREAM_OPS -#include <iostream> -#include <sstream> -#endif /* GEN_OSTREAM_OPS */ - -namespace DAnCE -{ - const char * - Locality_Handler_i::instance_type_ = - "edu.vanderbilt.dre.DAnCE.LocalityManager"; - - // Implementation skeleton constructor - Locality_Handler_i:: - Locality_Handler_i (void) - { - } - - // Implementation skeleton destructor - Locality_Handler_i::~Locality_Handler_i (void) - { - } - - void - Locality_Handler_i::close (void) - { - - } - - ::CORBA::StringSeq * - Locality_Handler_i::dependencies (void) - { - ::CORBA::StringSeq *retval (0); - ACE_NEW_THROW_EX (retval, - ::CORBA::StringSeq (0), - CORBA::NO_MEMORY ()); - return retval; - } - - char * Locality_Handler_i::instance_type (void) - { - DANCE_TRACE ("Locality_Handler_i::instance_type"); - return CORBA::string_dup (Locality_Handler_i::instance_type_); - } - - void - Locality_Handler_i::install_instance (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - ::CORBA::Any_out instance_reference) - { - CORBA::Any *outany (0); - ACE_NEW_THROW_EX (outany, - CORBA::Any (), - CORBA::NO_MEMORY ()); - instance_reference = outany; - -#ifdef GEN_OSTREAM_OPS - { - std::ostringstream plan_stream; - plan_stream << plan << std::endl; - - DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("Locality_Handler_i::install_instance - ") - ACE_TEXT ("Deploying instance %u of plan %C\n"), - instanceRef, - plan_stream.str ().c_str ())); - } -#endif /* GEN_OSTREAM_OPS */ - - if (plan.instance.length () <= instanceRef) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Locality_Handler_i::install_instance - ") - ACE_TEXT ("Invalid instance reference %u provided ") - ACE_TEXT ("to install_instance\n"), - instanceRef)); - throw ::Deployment::PlanError (plan.UUID.in (), - "Invalid instance reference"); - } - - const ::Deployment::InstanceDeploymentDescription &idd = - plan.instance[instanceRef]; - - if (plan.implementation.length () <= idd.implementationRef) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Locality_Handler_i::install_instance - ") - ACE_TEXT ("Invalid implementation reference %u provided ") - ACE_TEXT ("to install_instance\n"), - idd.implementationRef)); - throw ::Deployment::PlanError (plan.UUID.in (), - "Invalid Implementation reference"); - } - - const ::Deployment::MonolithicDeploymentDescription &mdd = - plan.implementation[idd.implementationRef]; - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_TRACE, DLINFO - ACE_TEXT ("Locality_Handler_i::install_instance - ") - ACE_TEXT ("Starting installation of instance <%C>\n"), - idd.name.in ())); - - CORBA::ULong allprops_len = - idd.configProperty.length () + mdd.execParameter.length () + 1; - ::Deployment::Properties allprops (allprops_len); - - Utility::append_properties (allprops, - mdd.execParameter); - Utility::append_properties (allprops, - idd.configProperty); - - DANCE_DEBUG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("Locality_Handler_i::install_instance - ") - ACE_TEXT ("Passing %u properties to activator\n"), - allprops.length ())); - - ::DAnCE::LocalityManager_var lm_ref = - this->activator_->create_locality_manager (plan, - instanceRef, - allprops); - - if (CORBA::is_nil (lm_ref)) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Locality_Handler_i::install_instance - ") - ACE_TEXT ("Received nil reference from LocalityActivator\n"))); - throw ::Deployment::StartError (idd.name.in (), - "Received nil object reference for " - "LocalityManager from Activator\n"); - } - - *instance_reference <<= lm_ref.in (); - } - - void - Locality_Handler_i::remove_instance (const ::Deployment::DeploymentPlan &, - ::CORBA::ULong, - const ::CORBA::Any &instance_reference) - { - LocalityManager_ptr lm_ref; - - if (!(instance_reference >>= lm_ref) || - CORBA::is_nil (lm_ref)) - { - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Locality_Handler_i::remove_instance - "), - ACE_TEXT ("Unable to extract valid LocalityManager ") - ACE_TEXT ("reference from parameter\n"))); - } - this->activator_->remove_locality_manager (lm_ref); - } - - void - Locality_Handler_i::connect_instance (const ::Deployment::DeploymentPlan &, - ::CORBA::ULong, - const ::CORBA::Any &) - { - throw CORBA::NO_IMPLEMENT (); - } - - void - Locality_Handler_i::disconnect_instance (const ::Deployment::DeploymentPlan &, - ::CORBA::ULong) - { - throw CORBA::NO_IMPLEMENT (); - } - - void - Locality_Handler_i::configure (const ::Deployment::Properties &prop ) - { - ::DAnCE::Utility::PROPERTY_MAP pmap (prop.length ()); - - ::DAnCE::Utility::build_property_map (pmap, prop); - - CORBA::ULong spawn = 0; - const char *cs_path = 0; - const char *cs_args = 0; - CORBA::Boolean multithread = false; - PortableServer::POA_var poa; - - Utility::get_property_value (DAnCE::LOCALITY_EXECUTABLE, - pmap, cs_path); - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO ACE_TEXT("Locality_Handler_i - ") - ACE_TEXT("Component server path: %C\n"), cs_path)); - Utility::get_property_value (DAnCE::LOCALITY_ARGUMENTS, - pmap, cs_args); - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO ACE_TEXT("Locality_Handler_i - ") - ACE_TEXT("Component server arguments: %C\n"), cs_args)); - Utility::get_property_value (DAnCE::LOCALITY_TIMEOUT, - pmap, spawn); - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO ACE_TEXT("Locality_Handler_i - ") - ACE_TEXT("Spawn delay: %u\n"), spawn)); - Utility::get_property_value (DAnCE::LOCALITY_MULTITHREAD, - pmap, multithread); - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO ACE_TEXT("Locality_Handler_i - ") - ACE_TEXT("Threading: %C\n"), - multithread ? "Multi" : "Single")); - - Utility::get_property_value (DAnCE::ENTITY_POA, - pmap, poa); - - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO ACE_TEXT("Locality_Handler_i - ") - ACE_TEXT("Threading: %C\n"), - multithread ? "Multi" : "Single")); - - CORBA::ORB_var orb = DAnCE::PLUGIN_MANAGER::instance ()->get_orb (); - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_TRACE, DLINFO ACE_TEXT("Locality_Handler_i - ") - ACE_TEXT("Spawning Locality handler\n"))); - - ACE_NEW_THROW_EX (this->activator_, - DAnCE_LocalityActivator_i (spawn, - cs_path, - cs_args, - false, - orb, - poa), - CORBA::NO_MEMORY ()); - - PortableServer::ServantBase_var safe_servant (this->activator_); - - poa->activate_object (this->activator_); - } -} - -extern "C" -{ - ::DAnCE::InstanceDeploymentHandler_ptr create_Locality_Handler (void) - { - return new DAnCE::Locality_Handler_i (); - } -} diff --git a/DAnCE/dance/LocalityManager/Handler/Locality_Manager_Handler_Impl.h b/DAnCE/dance/LocalityManager/Handler/Locality_Manager_Handler_Impl.h deleted file mode 100644 index 9e6269a43d4..00000000000 --- a/DAnCE/dance/LocalityManager/Handler/Locality_Manager_Handler_Impl.h +++ /dev/null @@ -1,97 +0,0 @@ -// -*- C++ -*- -/** - * @file Locality_Manager_Handler_Impl.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - * - * Installation handler implementation for spawning LocalityManagers. - */ - -#ifndef DANCE_LOCALITYMANAGERI_MIGAYG_H_ -#define DANCE_LOCALITYMANAGERI_MIGAYG_H_ - -#include "dance/DAnCE_LocalityManagerC.h" -#include "dance/DAnCE_Utility.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "dance/LocalityManager/Handler/DAnCE_Locality_Handler_export.h" -#include "tao/LocalObject.h" - -namespace DAnCE -{ - class DAnCE_LocalityActivator_i; - - class DAnCE_Locality_Handler_Export Locality_Handler_i - : public virtual DAnCE::InstanceDeploymentHandler, - public virtual ::CORBA::LocalObject - { - public: - // Constructor - Locality_Handler_i (void); - - // Destructor - virtual ~Locality_Handler_i (void); - - virtual - char * instance_type (void); - - virtual - ::CORBA::StringSeq * dependencies (void); - - virtual - void install_instance (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - ::CORBA::Any_out instance_reference); - - virtual - void activate_instance (const ::Deployment::DeploymentPlan & , - ::CORBA::ULong , - const ::CORBA::Any &) {}; - virtual - void passivate_instance (const ::Deployment::DeploymentPlan & , - ::CORBA::ULong , - const ::CORBA::Any &) {}; - - virtual - void remove_instance (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const ::CORBA::Any & instance_reference); - - virtual - void provide_endpoint_reference (const ::Deployment::DeploymentPlan &, - ::CORBA::ULong, - ::CORBA::Any_out) {}; - - virtual - void connect_instance (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong connectionRef, - const ::CORBA::Any & provided_reference); - - virtual - void disconnect_instance (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong connectionRef); - - virtual - void instance_configured (const ::Deployment::DeploymentPlan &, - ::CORBA::ULong) {}; - - virtual - void configure(const Deployment::Properties&); - - virtual void close (void); - - private: - static const char *instance_type_; - DAnCE_LocalityActivator_i *activator_; - }; -} - -extern "C" -{ - ::DAnCE::InstanceDeploymentHandler_ptr - DAnCE_Locality_Handler_Export create_Locality_Handler (void); -} - -#endif diff --git a/DAnCE/dance/LocalityManager/Handler/Plugin_Conf.cpp b/DAnCE/dance/LocalityManager/Handler/Plugin_Conf.cpp deleted file mode 100644 index 55d2e7a3def..00000000000 --- a/DAnCE/dance/LocalityManager/Handler/Plugin_Conf.cpp +++ /dev/null @@ -1,228 +0,0 @@ -#include "Plugin_Conf.h" -#include "ace/Read_Buffer.h" -#include "ace/Tokenizer_T.h" -#include "dance/Logger/Log_Macros.h" -#include "dance/DAnCE_PropertiesC.h" - -#include "Inst_Handler_Impl.h" -#include "Interceptor_Handler_Impl.h" -#include "Config_Handler_Impl.h" - -#include <vector> -#include <iostream> - -namespace DAnCE -{ - void - Plugin_Configurator::load_from_text_file (const ACE_TCHAR *file) - { - DANCE_TRACE ("Plugin_Configurator::load_from_text_file"); - - if (!file) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO ACE_TEXT("Plugin_Configurator::load_from_text_file - ") - ACE_TEXT("Error: Provided with nil filename\n"))); - return; - } - - FILE *inf = ACE_OS::fopen (file, ACE_TEXT("r")); - - if (!inf) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO ACE_TEXT("Plugin_Configurator::load_from_text_file - ") - ACE_TEXT("Fail to open plugin data file: <%s>\n"), - file)); - return; - } - - ::Deployment::DeploymentPlan plan; - - ACE_Read_Buffer reader (inf, true); - - char * string = 0; - CORBA::ULong pos (0); - - // Read from the file line by line - while ((string = reader.read ('\n')) != 0) - { - try - { - size_t const len = ACE_OS::strlen (string); - - if (len != 0) - { - // If a line starts with # it is a comment line, we skip it, - // but inform the user in case logging has been enabled - if (string[0] == '#') - { - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT ("Plugin_Configurator::load_from_text_file - ") - ACE_TEXT ("Skipping comment line <%C>\n"), - string)); - } - else - { - std::istringstream tokenizer (string); - std::vector< std::string > tokens; - std::copy (std::istream_iterator< std::string > (tokenizer), - std::istream_iterator <std::string > (), - std::back_inserter < std::vector < std::string > > (tokens)); - - if (tokens.size () < 3 || tokens.size () > 4) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Plugin_Configurator::load_from_text_file - ") - ACE_TEXT ("Skipping line <%C>, wrong format. Got %u tokens instead of 3 or 4\n"), - string, - tokens.size ())); - } - else - { - int open_mode = ACE_DEFAULT_SHLIB_MODE; - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT ("Plugin_Configurator::load_from_text_file - ") - ACE_TEXT ("Attempting to load plugin of type <%C>, artifact <%C>, entrypoint <%C>, open_mode <%C>\n"), - tokens[0].c_str (), - tokens[1].c_str (), - tokens[2].c_str (), - tokens.size () == 4 ? tokens[3].c_str() : 0)); - - if (tokens.size() == 4) - { - open_mode = ACE_OS::atoi (tokens[3].c_str()); - } - - if (ACE_OS::strcmp (tokens[0].c_str (), - DAnCE::DANCE_INSTALLATIONHANDLER) == 0) - { - this->create_entry (tokens[1].c_str (), tokens[2].c_str (), - DAnCE::DANCE_INSTALLATIONHANDLER, - open_mode, - plan, pos++); - } - else if (ACE_OS::strcmp (tokens[0].c_str (), - DAnCE::DANCE_DEPLOYMENTINTERCEPTOR) == 0) - { - this->create_entry (tokens[1].c_str (), tokens[2].c_str (), - DAnCE::DANCE_DEPLOYMENTINTERCEPTOR, - open_mode, - plan, pos++); - } - else if (ACE_OS::strcmp (tokens[0].c_str (), - DAnCE::DANCE_CONFIGPLUGIN) == 0) - { - this->create_entry (tokens[1].c_str (), tokens[2].c_str (), - DAnCE::DANCE_CONFIGPLUGIN, - open_mode, - plan, pos++); - } - else - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Plugin_Configurator::load_from_text_file - ") - ACE_TEXT ("Skipping line <%C>, bad type name\n"), - string)); - } - } - } - } - } - catch (...) - { - throw; - } - reader.alloc ()->free (string); - } - - this->deploy_plan (plan); - } - - void - Plugin_Configurator::deploy_plan (::Deployment::DeploymentPlan &plan) - { - DANCE_TRACE ("Plugin_Configurator::deploy_plan"); - - DAnCE::Inst_Handler_Impl inst_handler; - DAnCE::Interceptor_Handler_Impl interceptor_handler; - DAnCE::Config_Handler_Impl config_handler; - - for (CORBA::ULong i = 0; i < plan.instance.length (); ++i) - { - if (plan.instance[i].implementationRef >= plan.implementation.length ()) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Plugin_Configurator::deploy_plan - ") - ACE_TEXT ("Invalid implementationRef for instance <%C>\n"), - plan.instance[i].name.in ())); - continue; - } - - ::Deployment::MonolithicDeploymentDescription &mdd = - plan.implementation[plan.instance[i].implementationRef]; - - CORBA::String_var inst_type = - DAnCE::Utility::get_instance_type (mdd.execParameter); - - if (ACE_OS::strcmp (inst_type.in (), - DAnCE::DANCE_INSTALLATIONHANDLER) == 0) - { - CORBA::Any_var any; - inst_handler.install_instance (plan, i, any.out ()); - } - else if (ACE_OS::strcmp (inst_type.in (), - DAnCE::DANCE_DEPLOYMENTINTERCEPTOR) == 0) - { - CORBA::Any_var any; - interceptor_handler.install_instance (plan, i, any.out ()); - } - else if (ACE_OS::strcmp (inst_type.in (), - DAnCE::DANCE_CONFIGPLUGIN) == 0) - { - CORBA::Any_var any; - config_handler.install_instance (plan, i, any.out ()); - } - } - } - - void - Plugin_Configurator::create_entry (const char *artifact, - const char *entrypoint, - const char *type, - int open_mode, - ::Deployment::DeploymentPlan &plan, - CORBA::ULong pos) - { - DANCE_TRACE ("Plugin_Configurator::create_entry"); - - plan.implementation.length (pos + 1); - plan.implementation[pos].name = artifact; - plan.implementation[pos].execParameter.length (4); - - plan.implementation[pos].execParameter[0].name = DAnCE::DANCE_PLUGIN_ARTIFACT; - plan.implementation[pos].execParameter[0].value <<= - CORBA::Any::from_string (artifact, 0); - - plan.implementation[pos].execParameter[1].name = DAnCE::DANCE_PLUGIN_ENTRYPT; - plan.implementation[pos].execParameter[1].value <<= - CORBA::Any::from_string (entrypoint, 0); - - plan.implementation[pos].execParameter[2].name = DAnCE::DANCE_PLUGIN_OPENMODE; - plan.implementation[pos].execParameter[2].value <<= open_mode; - - plan.implementation[pos].execParameter[3].name = DAnCE::IMPL_TYPE; - plan.implementation[pos].execParameter[3].value <<= - CORBA::Any::from_string (type, 0); - - plan.instance.length (pos + 1); - plan.instance[pos].name = entrypoint; - plan.instance[pos].implementationRef = pos; - } -} diff --git a/DAnCE/dance/LocalityManager/Handler/Plugin_Conf.h b/DAnCE/dance/LocalityManager/Handler/Plugin_Conf.h deleted file mode 100644 index dbe635eafe8..00000000000 --- a/DAnCE/dance/LocalityManager/Handler/Plugin_Conf.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @file Plugin_Conf.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - * - * Handles installation of plugins from a configuration file. - */ - -#ifndef PLUGIN_CONF_H -#define PLUGIN_CONF_H - -#include "dance/Deployment/Deployment_DeploymentPlanC.h" -#include "dance/LocalityManager/Handler/DAnCE_Locality_Handler_export.h" - -namespace DAnCE -{ - class DAnCE_Locality_Handler_Export Plugin_Configurator - { - public: - void load_from_text_file (const ACE_TCHAR *file); - - private: - void deploy_plan (::Deployment::DeploymentPlan &plan); - - void create_entry (const char *artifact, - const char *entrypoint, - const char *type, - int open_mode, - ::Deployment::DeploymentPlan &plan, - CORBA::ULong pos); - }; -} -#endif diff --git a/DAnCE/dance/LocalityManager/Interceptors/Best_Effort.cpp b/DAnCE/dance/LocalityManager/Interceptors/Best_Effort.cpp deleted file mode 100644 index 72d93eb3abf..00000000000 --- a/DAnCE/dance/LocalityManager/Interceptors/Best_Effort.cpp +++ /dev/null @@ -1,158 +0,0 @@ -#include "Best_Effort.h" -#include "dance/Deployment/Deployment_StartErrorC.h" -#include "dance/DAnCE_PropertiesC.h" -#include "dance/DAnCE_Utility.h" -#include "dance/Logger/Log_Macros.h" - -namespace DAnCE -{ - // Implementation skeleton constructor - Best_Effort::Best_Effort (void) - { - } - - // Implementation skeleton destructor - Best_Effort::~Best_Effort (void) - { - } - - void - Best_Effort::configure (const ::Deployment::Properties & ) - { - - } - - void - Best_Effort::post_install (const ::Deployment::DeploymentPlan &plan, - ::CORBA::ULong index, - const ::CORBA::Any &, - const ::CORBA::Any &exception) - { - if (exception.type() != ::CORBA::_tc_null) - { - std::string result; - DAnCE::Utility::stringify_exception_from_any (exception, - result); - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Best_Effort::post_install - ") - ACE_TEXT ("Received exception while installing instance ") - ACE_TEXT ("<%C>:<%C>\n"), - plan.instance[index].name.in (), - result.c_str ())); - } - } - - void - Best_Effort::post_connect (const ::Deployment::DeploymentPlan &plan, - ::CORBA::ULong connection, - const ::CORBA::Any &exception) - { - if (exception.type() != ::CORBA::_tc_null) - { - std::string result; - DAnCE::Utility::stringify_exception_from_any (exception, - result); - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Best_Effort::post_connect - ") - ACE_TEXT ("Received exception while establishing connection ") - ACE_TEXT ("<%C>:<%C>\n"), - plan.connection[connection].name.in (), - result.c_str ())); - } - } - - void - Best_Effort::post_configured (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong index, - const ::CORBA::Any &exception ) - { - if (exception.type() != ::CORBA::_tc_null) - { - std::string result; - DAnCE::Utility::stringify_exception_from_any (exception, - result); - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Best_Effort::post_configured - ") - ACE_TEXT ("Received exception while completing configuration of ") - ACE_TEXT ("instance <%C>:<%C>\n"), - plan.instance[index].name.in (), - result.c_str ())); - } - } - - - void - Best_Effort::post_activate (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong index, - const ::CORBA::Any & exception) - { - if (exception.type() != ::CORBA::_tc_null) - { - std::string result; - DAnCE::Utility::stringify_exception_from_any (exception, - result); - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Best_Effort::post_activate - ") - ACE_TEXT ("Received exception while activating instance ") - ACE_TEXT ("<%C>:<%C>\n"), - plan.instance[index].name.in (), - result.c_str ())); - } - } - - - void - Best_Effort::post_passivate (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong index, - const ::CORBA::Any & exception) - { - if (exception.type() != ::CORBA::_tc_null) - { - std::string result; - DAnCE::Utility::stringify_exception_from_any (exception, - result); - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Best_Effort::post_passivate - ") - ACE_TEXT ("Received exception while passivating instance ") - ACE_TEXT ("<%C>:<%C>\n"), - plan.instance[index].name.in (), - result.c_str ())); - } - } - - - void - Best_Effort::post_remove (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong index, - const ::CORBA::Any & exception) - { - if (exception.type() != ::CORBA::_tc_null) - { - std::string result; - DAnCE::Utility::stringify_exception_from_any (exception, - result); - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Best_Effort::post_remove - ") - ACE_TEXT ("Received exception while removing instance ") - ACE_TEXT ("<%C>:<%C>\n"), - plan.instance[index].name.in (), - result.c_str ())); - - } - } - } - -extern "C" -{ - ::DAnCE::DeploymentInterceptor_ptr - create_DAnCE_Best_Effort (void) - { - return new DAnCE::Best_Effort (); - } -} diff --git a/DAnCE/dance/LocalityManager/Interceptors/Best_Effort.h b/DAnCE/dance/LocalityManager/Interceptors/Best_Effort.h deleted file mode 100644 index 312f2b6a793..00000000000 --- a/DAnCE/dance/LocalityManager/Interceptors/Best_Effort.h +++ /dev/null @@ -1,77 +0,0 @@ -/** - * @file Best_Effort.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - * - * Interceptors which implement a Best Effort error handling mechanism. - */ - -#ifndef DEPLOYMENT_INTERCEPTORS_H -#define DEPLOYMENT_INTERCEPTORS_H - -#include "dance/DAnCE_DeploymentInterceptors_Base_Impl.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/LocalObject.h" -#include "DAnCE_Error_Interceptors_export.h" - -namespace DAnCE -{ - class DAnCE_Error_Interceptors_Export Best_Effort - : public virtual DAnCE::DeploymentInterceptor_Base - { - public: - // Constructor - - Best_Effort (void); - - // Destructor - virtual ~Best_Effort (void); - - virtual - void post_install (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong index, - const ::CORBA::Any & reference, - const ::CORBA::Any & exception_thrown); - - virtual - void post_connect (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong connectionRef, - const ::CORBA::Any & exceptionThrown); - - - virtual - void post_configured (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const ::CORBA::Any & exception_thrown); - - virtual - void post_activate (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const ::CORBA::Any & exception_thrown); - - virtual - void post_passivate (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const ::CORBA::Any & exception_thrown); - - virtual - void post_remove (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const ::CORBA::Any & exception_thrown); - virtual - void configure(const Deployment::Properties&); - - private: - }; -} - -extern "C" -{ - ::DAnCE::DeploymentInterceptor_ptr - DAnCE_Error_Interceptors_Export create_DAnCE_Best_Effort (void); -} - -#endif diff --git a/DAnCE/dance/LocalityManager/Interceptors/DAnCE_Error_Interceptors_export.h b/DAnCE/dance/LocalityManager/Interceptors/DAnCE_Error_Interceptors_export.h deleted file mode 100644 index cae217e604c..00000000000 --- a/DAnCE/dance/LocalityManager/Interceptors/DAnCE_Error_Interceptors_export.h +++ /dev/null @@ -1,55 +0,0 @@ -// -*- C++ -*- -// Definition for Win32 Export directives. -// ------------------------------ -#ifndef DANCE_ERROR_INTERCEPTORS_EXPORT_H -#define DANCE_ERROR_INTERCEPTORS_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (DANCE_ERROR_INTERCEPTORS_HAS_DLL) -# define DANCE_ERROR_INTERCEPTORS_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && DANCE_ERROR_INTERCEPTORS_HAS_DLL */ - -#if !defined (DANCE_ERROR_INTERCEPTORS_HAS_DLL) -# define DANCE_ERROR_INTERCEPTORS_HAS_DLL 1 -#endif /* ! DANCE_ERROR_INTERCEPTORS_HAS_DLL */ - -#if defined (DANCE_ERROR_INTERCEPTORS_HAS_DLL) && (DANCE_ERROR_INTERCEPTORS_HAS_DLL == 1) -# if defined (DANCE_ERROR_INTERCEPTORS_BUILD_DLL) -# define DAnCE_Error_Interceptors_Export ACE_Proper_Export_Flag -# define DANCE_ERROR_INTERCEPTORS_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define DANCE_ERROR_INTERCEPTORS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* DANCE_ERROR_INTERCEPTORS_BUILD_DLL */ -# define DAnCE_Error_Interceptors_Export ACE_Proper_Import_Flag -# define DANCE_ERROR_INTERCEPTORS_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define DANCE_ERROR_INTERCEPTORS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* DANCE_ERROR_INTERCEPTORS_BUILD_DLL */ -#else /* DANCE_ERROR_INTERCEPTORS_HAS_DLL == 1 */ -# define DAnCE_Error_Interceptors_Export -# define DANCE_ERROR_INTERCEPTORS_SINGLETON_DECLARATION(T) -# define DANCE_ERROR_INTERCEPTORS_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* DANCE_ERROR_INTERCEPTORS_HAS_DLL == 1 */ - -// Set DANCE_ERROR_INTERCEPTORS_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (DANCE_ERROR_INTERCEPTORS_NTRACE) -# if (ACE_NTRACE == 1) -# define DANCE_ERROR_INTERCEPTORS_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define DANCE_ERROR_INTERCEPTORS_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !DANCE_ERROR_INTERCEPTORS_NTRACE */ - -#if (DANCE_ERROR_INTERCEPTORS_NTRACE == 1) -# define DANCE_ERROR_INTERCEPTORS_TRACE(X) -#else /* (DANCE_ERROR_INTERCEPTORS_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define DANCE_ERROR_INTERCEPTORS_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (DANCE_ERROR_INTERCEPTORS_NTRACE == 1) */ - -#endif /* DANCE_ERROR_INTERCEPTORS_EXPORT_H */ - -// End of auto generated file. diff --git a/DAnCE/dance/LocalityManager/Interceptors/Error_Interceptors.mpc b/DAnCE/dance/LocalityManager/Interceptors/Error_Interceptors.mpc deleted file mode 100644 index e50daa473be..00000000000 --- a/DAnCE/dance/LocalityManager/Interceptors/Error_Interceptors.mpc +++ /dev/null @@ -1,17 +0,0 @@ -project (DAnCE_Error_Interceptors) : install, dance_skel, dance_lib, dance_output, dance_logger { - dynamicflags += DANCE_ERROR_INTERCEPTORS_BUILD_DLL - - Source_Files { - Standard_Error.cpp - Best_Effort.cpp - } - - Header_Files { - Standard_Error.h - Best_Effort.h - } - - specific { - install_dir = dance/LocalityManager/Interceptors - } -} diff --git a/DAnCE/dance/LocalityManager/Interceptors/Standard_Error.cpp b/DAnCE/dance/LocalityManager/Interceptors/Standard_Error.cpp deleted file mode 100644 index ac1e7c43115..00000000000 --- a/DAnCE/dance/LocalityManager/Interceptors/Standard_Error.cpp +++ /dev/null @@ -1,132 +0,0 @@ -#include "Standard_Error.h" -#include "dance/Deployment/Deployment_StartErrorC.h" -#include "dance/DAnCE_PropertiesC.h" -#include "dance/DAnCE_Utility.h" -#include "dance/Logger/Log_Macros.h" - -namespace DAnCE -{ - // Implementation skeleton constructor - Standard_Error::Standard_Error (void) - { - } - - // Implementation skeleton destructor - Standard_Error::~Standard_Error (void) - { - } - - void - Standard_Error::configure (const ::Deployment::Properties & ) - { - } - - void - Standard_Error::post_install (const ::Deployment::DeploymentPlan &plan, - ::CORBA::ULong index, - const ::CORBA::Any &, - const ::CORBA::Any &exception) - { - if (exception.type() != ::CORBA::_tc_null) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Standard_Error::post_install - ") - ACE_TEXT ("Propagating exception from instance <%C>\n"), - plan.instance[index].name.in ())); - DAnCE::Utility::throw_exception_from_any (exception); - } - } - - void - Standard_Error::post_connect (const ::Deployment::DeploymentPlan &plan, - ::CORBA::ULong connection, - const ::CORBA::Any &exception) - { - if (exception.type() != ::CORBA::_tc_null) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Standard_Error::post_connect - ") - ACE_TEXT ("Propagating exception from connection <%C>\n"), - plan.connection[connection].name.in ())); - DAnCE::Utility::throw_exception_from_any (exception); - } - } - - void - Standard_Error::post_configured (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong index, - const ::CORBA::Any &exception ) - { - if (exception.type() != ::CORBA::_tc_null) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Standard_Error::post_configured - ") - ACE_TEXT ("Propagating exception from configuring instance <%C>\n"), - plan.instance[index].name.in ())); - DAnCE::Utility::throw_exception_from_any (exception); - } - } - - - void - Standard_Error::post_activate (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong index, - const ::CORBA::Any & exception) - { - if (exception.type() != ::CORBA::_tc_null) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Standard_Error::post_activate - ") - ACE_TEXT ("Propagating exception from activation of instance <%C>\n"), - plan.instance[index].name.in ())); - DAnCE::Utility::throw_exception_from_any (exception); - } - } - - - void - Standard_Error::post_passivate (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong index, - const ::CORBA::Any & exception) - { - if (exception.type() != ::CORBA::_tc_null) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Standard_Error::post_passivate - ") - ACE_TEXT ("Propagating exception from passivation of instance <%C>\n"), - plan.instance[index].name.in ())); - DAnCE::Utility::throw_exception_from_any (exception); - } - } - - - void - Standard_Error::post_remove (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong index, - const ::CORBA::Any & exception) - { - if (exception.type() != ::CORBA::_tc_null) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Standard_Error::post_remove - ") - ACE_TEXT ("Propagating exception from removal of instance <%C>\n"), - plan.instance[index].name.in ())); - DAnCE::Utility::throw_exception_from_any (exception); - } - } - } - -extern "C" -{ - ::DAnCE::DeploymentInterceptor_ptr - create_DAnCE_Standard_Error (void) - { - return new DAnCE::Standard_Error (); - } -} diff --git a/DAnCE/dance/LocalityManager/Interceptors/Standard_Error.h b/DAnCE/dance/LocalityManager/Interceptors/Standard_Error.h deleted file mode 100644 index 7c3105b6ff3..00000000000 --- a/DAnCE/dance/LocalityManager/Interceptors/Standard_Error.h +++ /dev/null @@ -1,76 +0,0 @@ -/** - * @file Standard_Error.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - * - * Interceptors which implement a sandard (first failure) error handling mechanism. - */ - -#ifndef DEPLOYMENT_INTERCEPTORS_H -#define DEPLOYMENT_INTERCEPTORS_H - -#include "dance/DAnCE_DeploymentInterceptors_Base_Impl.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/LocalObject.h" -#include "DAnCE_Error_Interceptors_export.h" - -namespace DAnCE -{ - class DAnCE_Error_Interceptors_Export Standard_Error - : public virtual DAnCE::DeploymentInterceptor_Base - { - public: - /// Constructor - Standard_Error (void); - - /// Destructor - virtual ~Standard_Error (void); - - virtual - void post_install (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong index, - const ::CORBA::Any & reference, - const ::CORBA::Any & exception_thrown); - - virtual - void post_connect (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong connectionRef, - const ::CORBA::Any & exceptionThrown); - - - virtual - void post_configured (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const ::CORBA::Any & exception_thrown); - - virtual - void post_activate (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const ::CORBA::Any & exception_thrown); - - virtual - void post_passivate (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const ::CORBA::Any & exception_thrown); - - virtual - void post_remove (const ::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const ::CORBA::Any & exception_thrown); - virtual - void configure(const Deployment::Properties&); - - private: - }; -} - -extern "C" -{ - ::DAnCE::DeploymentInterceptor_ptr - DAnCE_Error_Interceptors_Export create_DAnCE_Standard_Error (void); -} - -#endif diff --git a/DAnCE/dance/LocalityManager/Scheduler/Dependency_Sorter.cpp b/DAnCE/dance/LocalityManager/Scheduler/Dependency_Sorter.cpp deleted file mode 100644 index a6cd5384c70..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Dependency_Sorter.cpp +++ /dev/null @@ -1,92 +0,0 @@ -#include "Dependency_Sorter.h" - -#include <algorithm> -#include <vector> - -namespace DAnCE -{ - /// Add a handler which has no dependencies - void - Dependency_Sorter::add_nondependent (const std::string &subject) - { - this->dep_map_[subject] = IH_DEPS (); - } - - /// Add a dependency to the map. - void - Dependency_Sorter::add_dependency (const std::string &subject, - const IH_DEPS &deps) - { - this->dep_map_[subject] = deps; - } - - - void - Dependency_Sorter::add_dependency (const std::string &subject, - const std::string &install_after) - { - DEP_MAP::iterator after = this->dep_map_.find (install_after); - - if (after == this->dep_map_.end ()) - { - IH_DEPS tmp; - tmp.insert (install_after); - this->dep_map_[subject] = tmp; - } - else - { - after->second.insert (install_after); - } - } - - void - Dependency_Sorter::calculate_order (Dependency_Sorter::INSTALL_ORDER &retval) - { - // Deps which have been added to the install order - IH_DEPS selected; - - DEP_MAP tmp_dep = this->dep_map_; - - while (retval.size () != this->dep_map_.size ()) - { - bool updated (false); - - for (DEP_MAP::iterator i = tmp_dep.begin (); - i != tmp_dep.end (); - ++i) - { - if (i->second.size () == 0) // i.e., no dependencies - { - retval.push_back (i->first); - selected.insert (i->first); - updated = true; - tmp_dep.erase (i); - break; - } - - if (selected.size () >= i->second.size ()) - { - std::vector< std::string > tmp (i->second.size ()); - - std::set_intersection (i->second.begin (), i->second.end (), - selected.begin (), selected.end (), - tmp.begin ()); - - if (tmp.size () == i->second.size ()) // i.e., all deps satisfied - { - retval.push_back (i->first); - selected.insert (i->first); - updated = true; - tmp_dep.erase (i); - break; - } - } - } - - if (!updated) // i.e., we weren't able to add a new dep - { - throw Invalid_Install_Order (); - } - } - } -} diff --git a/DAnCE/dance/LocalityManager/Scheduler/Dependency_Sorter.h b/DAnCE/dance/LocalityManager/Scheduler/Dependency_Sorter.h deleted file mode 100644 index a32e1738570..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Dependency_Sorter.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @file Dependency_Sorter.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - */ -#ifndef DEP_SORTER_H -#define DEP_SORTER_H - -#include <map> -#include <set> -#include <string> -#include <vector> - -namespace DAnCE -{ - class Dependency_Sorter - { - public: - typedef std::vector < std::string > INSTALL_ORDER; - typedef std::set < std::string > IH_DEPS; - class Invalid_Install_Order : std::exception {}; - - /// Add a handler which has no dependencies - void add_nondependent (const std::string &subject); - - /// Add a dependency to the map. - void add_dependency (const std::string &subject, - const IH_DEPS &deps); - - /// Add a dependency to the map. - void add_dependency (const std::string &subject, - const std::string &install_after); - - void calculate_order (INSTALL_ORDER &); - - private: - typedef std::map < std::string, IH_DEPS > DEP_MAP; - - DEP_MAP dep_map_; - }; -} - -#endif diff --git a/DAnCE/dance/LocalityManager/Scheduler/Deployment_Completion.cpp b/DAnCE/dance/LocalityManager/Scheduler/Deployment_Completion.cpp deleted file mode 100644 index 40f8d80a236..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Deployment_Completion.cpp +++ /dev/null @@ -1,95 +0,0 @@ -#include "Deployment_Completion.h" - -#include "dance/Logger/Log_Macros.h" - -namespace DAnCE -{ - Deployment_Completion::Deployment_Completion (Deployment_Scheduler &sched) - : Completion_Counter_Base< TAO_SYNCH_MUTEX > (0, 0), - sched_ (sched), - mutex_ (), - condition_ (this->mutex_) - { - } - - Deployment_Completion::~Deployment_Completion (void) - { - } - - void - Deployment_Completion::accept (Event_Future &future) - { - future.attach (this); - this->increment_exec_count (); - } - - void - Deployment_Completion::update (const Event_Future &evt) - { - this->completed_events_.push_back (evt); - this->decrement_exec_count (); - } - - bool - Deployment_Completion::wait_on_completion (ACE_Time_Value *tv) - { - if (!this->sched_.multithreaded ()) - return this->single_threaded_wait_on_completion (tv); - - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, - guard, - this->mutex_, false); - - while (!this->all_completed ()) - { - int const retval = this->condition_.wait (tv); - - if (retval == -1) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO - ACE_TEXT ("Deployment_Completion::wait_on_completion - ") - ACE_TEXT ("Timed out waiting on event completion\n"))); - return false; - } - } - - DANCE_DEBUG (DANCE_LOG_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT ("Deployment_Completion::wait_on_completion - ") - ACE_TEXT ("All events completed\n"))); - - return true; - } - - void - Deployment_Completion::completed_events (Event_List &event_list) - { - ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, - guard, - this->mutex_, CORBA::NO_RESOURCES ()); - - event_list.swap (this->completed_events_); - this->completed_events_.clear (); - } - - void - Deployment_Completion::on_all_completed () - { - this->condition_.broadcast (); - } - - void - Deployment_Completion::on_all_completed_with_failure () - { - this->condition_.broadcast (); - } - - bool - Deployment_Completion::single_threaded_wait_on_completion (ACE_Time_Value * /*tv*/) - { - while (this->sched_.work_pending ()) - this->sched_.perform_work (); - - return true; - } -} diff --git a/DAnCE/dance/LocalityManager/Scheduler/Deployment_Completion.h b/DAnCE/dance/LocalityManager/Scheduler/Deployment_Completion.h deleted file mode 100644 index 692bc900bde..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Deployment_Completion.h +++ /dev/null @@ -1,62 +0,0 @@ -/** - * @file Deployment_Completion.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - * - * Future observer that signals when the scheduler has completed. - */ - -#ifndef DEPLOYMENT_COMPLETION_H -#define DEPLOYMENT_COMPLETION_H - -#include /**/ "ace/pre.h" - -#include "ace/Condition_T.h" -#include "ace/Future.h" -#include "Completion/Completion_Counter_Base.h" -#include "dance/LocalityManager/Scheduler/Deployment_Event.h" -#include "dance/LocalityManager/Scheduler/Deployment_Scheduler.h" - -namespace DAnCE -{ - /** - * @class Event_Handler - */ - class Deployment_Scheduler_Export Deployment_Completion - : public virtual ACE_Future_Observer< Event_Result >, - public virtual Completion_Counter_Base< TAO_SYNCH_MUTEX > - { - public: - Deployment_Completion (Deployment_Scheduler &sched); - - virtual ~Deployment_Completion (void); - - virtual void update (const Event_Future &future); - - void accept (Event_Future &future); - - /// Waits for completion of all events, with a timeout - bool wait_on_completion (ACE_Time_Value *tv); - - void completed_events (Event_List &event_list); - - protected: - virtual void on_all_completed (); - - virtual void on_all_completed_with_failure (); - - bool single_threaded_wait_on_completion (ACE_Time_Value *tv); - - private: - Deployment_Scheduler &sched_; - - TAO_SYNCH_MUTEX mutex_; - ACE_Condition< TAO_SYNCH_MUTEX > condition_; - - Event_List completed_events_; - }; - -} - -#include /**/ "ace/post.h" - -#endif diff --git a/DAnCE/dance/LocalityManager/Scheduler/Deployment_Event.cpp b/DAnCE/dance/LocalityManager/Scheduler/Deployment_Event.cpp deleted file mode 100644 index 229f447e122..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Deployment_Event.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "Deployment_Event.h" - -#if !defined (__ACE_INLINE__) -#include "dance/LocalityManager/Scheduler/Deployment_Event.inl" -#endif - diff --git a/DAnCE/dance/LocalityManager/Scheduler/Deployment_Event.h b/DAnCE/dance/LocalityManager/Scheduler/Deployment_Event.h deleted file mode 100644 index bd317660b9a..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Deployment_Event.h +++ /dev/null @@ -1,63 +0,0 @@ -/** - * @file Deployment_Event.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - */ - -#ifndef DEPLOYMENT_EVENT_H -#define DEPLOYMENT_EVENT_H - -#include /**/ "ace/pre.h" - -#include "ace/Future.h" -#include "ace/Method_Request.h" -#include "tao/AnyTypeCode/Any.h" -#include "dance/LocalityManager/Scheduler/Deployment_Scheduler_export.h" - -#include <list> - -namespace DAnCE -{ - struct Deployment_Scheduler_Export Event_Result - { - Event_Result (void); - - Event_Result (const std::string &id, - bool exception); - - Event_Result (const std::string &id, - bool exception, - CORBA::Any *any); - - std::string id_; - bool exception_; - CORBA::Any_var contents_; - }; - - typedef ACE_Future< Event_Result > Event_Future; - - typedef std::list <Event_Future> Event_List; - - class Deployment_Scheduler_Export Deployment_Event : - public virtual ACE_Method_Request - { - public: - Deployment_Event (Event_Future holder, - const char *name, - const char *instance_type); - - Event_Future get_future (void); - - protected: - Event_Future holder_; - std::string name_; - std::string instance_type_; - }; -} - -#if defined (__ACE_INLINE__) -#include "dance/LocalityManager/Scheduler/Deployment_Event.inl" -#endif - -#include /**/ "ace/post.h" - -#endif diff --git a/DAnCE/dance/LocalityManager/Scheduler/Deployment_Event.inl b/DAnCE/dance/LocalityManager/Scheduler/Deployment_Event.inl deleted file mode 100644 index d29d6685e17..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Deployment_Event.inl +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef DEPLOYMENT_EVENT_INL -#define DEPLOYMENT_EVENT_INL - -namespace DAnCE -{ - ACE_INLINE - Event_Result::Event_Result (void) - : id_ (""), - exception_ (true) - { - } - - ACE_INLINE - Event_Result::Event_Result (const std::string &id, - bool exception) - : id_ (id), - exception_ (exception) - { - } - - ACE_INLINE - Event_Result::Event_Result (const std::string &id, - bool exception, - ::CORBA::Any *any) - : id_ (id), - exception_ (exception), - contents_ (any) - { - } - - ACE_INLINE - Deployment_Event::Deployment_Event (Event_Future holder, - const char *name, - const char *inst_type) - : holder_ (holder), - name_ (name), - instance_type_ (inst_type) - { - } - - ACE_INLINE - Event_Future - Deployment_Event::get_future (void) - { - return holder_; - } -} - -#endif diff --git a/DAnCE/dance/LocalityManager/Scheduler/Deployment_Scheduler.cpp b/DAnCE/dance/LocalityManager/Scheduler/Deployment_Scheduler.cpp deleted file mode 100644 index 55af2c1d478..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Deployment_Scheduler.cpp +++ /dev/null @@ -1,78 +0,0 @@ -#include "Deployment_Scheduler.h" -#include "dance/Logger/Log_Macros.h" - -#if !defined (__ACE_INLINE__) -#include "dance/LocalityManager/Scheduler/Deployment_Scheduler.inl" -#endif - -namespace DAnCE -{ - Deployment_Scheduler::Deployment_Scheduler (void) - : multithread_ (false) - { - } - - Deployment_Scheduler::~Deployment_Scheduler (void) - { - } - - int - Deployment_Scheduler::schedule_event (Deployment_Event *event) - { - int const retval = this->event_queue_.enqueue (event); - - if (retval == -1) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Deployment_Scheduler::schedule_event - ") - ACE_TEXT ("Error: Unable to schedule event for execution\n"))); - } - - return retval; - } - - void - Deployment_Scheduler::terminate_scheduler (void) - { - this->event_queue_.queue ()->close (); - } - - int - Deployment_Scheduler::svc (void) - { - for ( ; ; ) - { - auto_ptr < ACE_Method_Request > de (this->event_queue_.dequeue ()); - - if (de.get ()) - { - DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("Deployment_Scheduler::svc - ") - ACE_TEXT ("Invoking a deployment event\n"))); - de->call (); - } - else - { - break; - } - } - - return 0; - } - - void Deployment_Scheduler::perform_work (void) - { - auto_ptr < ACE_Method_Request > de (this->event_queue_.dequeue ()); - - if (de.get ()) - { - DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("Deployment_Scheduler::perform_work - ") - ACE_TEXT ("Invoking a deployment event\n"))); - de->call (); - } - } -} diff --git a/DAnCE/dance/LocalityManager/Scheduler/Deployment_Scheduler.h b/DAnCE/dance/LocalityManager/Scheduler/Deployment_Scheduler.h deleted file mode 100644 index 57da3e6c9f8..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Deployment_Scheduler.h +++ /dev/null @@ -1,51 +0,0 @@ -/** - * @file Deployment_Scheduler.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - * - * Active-object based scheduler for deployment events. - */ -#ifndef DEPLOYMENT_SCHEDULER_H -#define DEPLOYMENT_SCHEDULER_H - -#include "ace/Task.h" -#include "ace/Activation_Queue.h" -#include "dance/LocalityManager/Scheduler/Deployment_Event.h" - -namespace DAnCE -{ - class Deployment_Scheduler_Export Deployment_Scheduler : - public ACE_Task_Base - { - public: - Deployment_Scheduler (void); - virtual ~Deployment_Scheduler (void); - - /// Schedule an event for execution - int schedule_event (Deployment_Event *event); - - void activate_scheduler (size_t threads); - - void terminate_scheduler (void); - - bool multithreaded (void); - - bool work_pending (void); - - void perform_work (void); - - protected: - /// Scheduler event loop - virtual int svc (void); - - private: - bool multithread_; - - ACE_Activation_Queue event_queue_; - }; -} - -#if defined (__ACE_INLINE__) -#include "dance/LocalityManager/Scheduler/Deployment_Scheduler.inl" -#endif - -#endif diff --git a/DAnCE/dance/LocalityManager/Scheduler/Deployment_Scheduler.inl b/DAnCE/dance/LocalityManager/Scheduler/Deployment_Scheduler.inl deleted file mode 100644 index 32c36329c13..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Deployment_Scheduler.inl +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef DEPLOYMENT_SCHEDULER_INL -#define DEPLOYMENT_SCHEDULER_INL - -namespace DAnCE -{ - ACE_INLINE - void Deployment_Scheduler::activate_scheduler (size_t threads) - { - this->multithread_ = threads > 0; - if (this->multithread_) - this->activate (THR_DETACHED, - threads); - } - - ACE_INLINE - bool Deployment_Scheduler::multithreaded (void) - { - return this->multithread_; - } - - ACE_INLINE - bool Deployment_Scheduler::work_pending (void) - { - return !this->event_queue_.is_empty (); - } -} - -#endif diff --git a/DAnCE/dance/LocalityManager/Scheduler/Deployment_Scheduler_export.h b/DAnCE/dance/LocalityManager/Scheduler/Deployment_Scheduler_export.h deleted file mode 100644 index c7ce7e74189..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Deployment_Scheduler_export.h +++ /dev/null @@ -1,55 +0,0 @@ -// -*- C++ -*- -// Definition for Win32 Export directives. -// ------------------------------ -#ifndef DEPLOYMENT_SCHEDULER_EXPORT_H -#define DEPLOYMENT_SCHEDULER_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (DEPLOYMENT_SCHEDULER_HAS_DLL) -# define DEPLOYMENT_SCHEDULER_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && DEPLOYMENT_SCHEDULER_HAS_DLL */ - -#if !defined (DEPLOYMENT_SCHEDULER_HAS_DLL) -# define DEPLOYMENT_SCHEDULER_HAS_DLL 1 -#endif /* ! DEPLOYMENT_SCHEDULER_HAS_DLL */ - -#if defined (DEPLOYMENT_SCHEDULER_HAS_DLL) && (DEPLOYMENT_SCHEDULER_HAS_DLL == 1) -# if defined (DEPLOYMENT_SCHEDULER_BUILD_DLL) -# define Deployment_Scheduler_Export ACE_Proper_Export_Flag -# define DEPLOYMENT_SCHEDULER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define DEPLOYMENT_SCHEDULER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* DEPLOYMENT_SCHEDULER_BUILD_DLL */ -# define Deployment_Scheduler_Export ACE_Proper_Import_Flag -# define DEPLOYMENT_SCHEDULER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define DEPLOYMENT_SCHEDULER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* DEPLOYMENT_SCHEDULER_BUILD_DLL */ -#else /* DEPLOYMENT_SCHEDULER_HAS_DLL == 1 */ -# define Deployment_Scheduler_Export -# define DEPLOYMENT_SCHEDULER_SINGLETON_DECLARATION(T) -# define DEPLOYMENT_SCHEDULER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* DEPLOYMENT_SCHEDULER_HAS_DLL == 1 */ - -// Set DEPLOYMENT_SCHEDULER_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (DEPLOYMENT_SCHEDULER_NTRACE) -# if (ACE_NTRACE == 1) -# define DEPLOYMENT_SCHEDULER_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define DEPLOYMENT_SCHEDULER_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !DEPLOYMENT_SCHEDULER_NTRACE */ - -#if (DEPLOYMENT_SCHEDULER_NTRACE == 1) -# define DEPLOYMENT_SCHEDULER_TRACE(X) -#else /* (DEPLOYMENT_SCHEDULER_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define DEPLOYMENT_SCHEDULER_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (DEPLOYMENT_SCHEDULER_NTRACE == 1) */ - -#endif /* DEPLOYMENT_SCHEDULER_EXPORT_H */ - -// End of auto generated file. diff --git a/DAnCE/dance/LocalityManager/Scheduler/Events/Action_Base.cpp b/DAnCE/dance/LocalityManager/Scheduler/Events/Action_Base.cpp deleted file mode 100644 index 301bb0bcb69..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Events/Action_Base.cpp +++ /dev/null @@ -1,181 +0,0 @@ -#include "Action_Base.h" - -#include "tao/AnyTypeCode/ExceptionA.h" -#include "dance/Logger/Log_Macros.h" -#include "dance/DAnCE_Utility.h" - -namespace DAnCE -{ - Action_Base::Action_Base (Event_Future holder, - const char *name, - const char *instance_type) - : Deployment_Event (holder, name, instance_type) - { - CORBA::Any *tmp; - ACE_NEW_THROW_EX (tmp, - ::CORBA::Any (), - CORBA::NO_MEMORY ()); - instance_excep_ = tmp; - } - - Action_Base::~Action_Base (void) - { - - } - - int - Action_Base::call (void) - { - DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("Action_Base::call - ") - ACE_TEXT ("Entering Action_Base\n"))); - - try - { - const Plugin_Manager::INTERCEPTORS &interceptors = - PLUGIN_MANAGER::instance ()->fetch_interceptors (); - - DANCE_DEBUG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("Action_Base::call - ") - ACE_TEXT ("Invoking pre-install interceptors\n"))); - for (Plugin_Manager::INTERCEPTORS::const_iterator i = interceptors.begin (); - i != interceptors.end (); - ++i) - { - this->invoke_pre_interceptor (i); - } - - if (this->instance_type_.c_str () == 0) - { - this->create_unexpected_exception (this->name_, - "Invalid Instance Type"); - } - else - { - ::DAnCE::InstanceDeploymentHandler_var handler = - PLUGIN_MANAGER::instance ()->fetch_installation_handler (this->instance_type_.c_str ()); - - if (CORBA::is_nil (handler)) - { - this->create_unexpected_exception (this->name_, - "Unable to load appropriate instance handler"); - } - else - { - try - { - this->invoke (handler.in ()); - } - catch (const CORBA::UserException &ex) - { - DANCE_ERROR (DANCE_LOG_EVENT_TRACE, - (LM_INFO, DLINFO - ACE_TEXT ("Action_Base::call - ") - ACE_TEXT ("Caught CORBA UserException while processing instance ") - ACE_TEXT ("<%C>\n"), - this->name_.c_str ())); - this->instance_excep_ = DAnCE::Utility::create_any_from_user_exception (ex); - } - catch (const CORBA::SystemException &ex) - { - DANCE_ERROR (DANCE_LOG_EVENT_TRACE, - (LM_INFO, DLINFO - ACE_TEXT ("Action_Base::call - ") - ACE_TEXT ("Caught CORBA SystemException while processing instance ") - ACE_TEXT ("<%C>\n"), - this->name_.c_str ())); - this->instance_excep_ = DAnCE::Utility::create_any_from_exception (ex); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_EVENT_TRACE, - (LM_INFO, DLINFO - ACE_TEXT ("Action_Base::call - ") - ACE_TEXT ("Caught C++ exception while processing instance ") - ACE_TEXT ("<%C>\n"), - this->name_.c_str ())); - - this->create_unexpected_exception (this->name_, - "Caught unknown C++ exception from install"); - } - } - } - Event_Result result (this->name_, this->instance_excep_.ptr () != 0); - if (!interceptors.empty ()) - { - DANCE_DEBUG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO - ACE_TEXT ("Action_Base::call - ") - ACE_TEXT ("Invoking post-action interceptors\n"))); - for (Plugin_Manager::INTERCEPTORS::const_iterator i = interceptors.begin (); - i != interceptors.end (); - ++i) - { - this->invoke_post_interceptor (i); - } - - this->create_valid_result (result); - result.exception_ = false; - } - else - { - DANCE_DEBUG (DANCE_LOG_ERROR, - (LM_TRACE, DLINFO - ACE_TEXT ("Action_Base::call - ") - ACE_TEXT ("No post-install interceptors; directly propagating result\n"))); - if (result.exception_) - result.contents_ = this->instance_excep_._retn (); - else - this->create_valid_result (result); - } - - DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("Action_Base::call - ") - ACE_TEXT ("Signaling result for instance <%C>\n"), - this->name_.c_str ())); - this->holder_.set (result); - } - catch (const CORBA::UserException &ex) - { - DANCE_ERROR (DANCE_LOG_MAJOR_EVENT, - (LM_INFO, DLINFO - ACE_TEXT ("Action_Base::call - ") - ACE_TEXT ("CORBA UserException propagated from interceptors for instance ") - ACE_TEXT ("<%C>\n"), - this->name_.c_str ())); - - Event_Result result (this->name_, true); - - try - { - result.contents_ = DAnCE::Utility::create_any_from_user_exception (ex); - } - catch (...) { } - - this->holder_.set (result); - return -1; - } - catch (const CORBA::SystemException &ex) - { - DANCE_ERROR (DANCE_LOG_MAJOR_EVENT, - (LM_INFO, DLINFO - ACE_TEXT ("Action_Base::call - ") - ACE_TEXT ("CORBA SystemException propagated from interceptors for instance ") - ACE_TEXT ("<%C>\n"), - this->name_.c_str ())); - - Event_Result result (this->name_, true); - - try { - result.contents_ = DAnCE::Utility::create_any_from_exception (ex); - } - catch (...) { } - - this->holder_.set (result); - return -1; - } - return 0; - } -} diff --git a/DAnCE/dance/LocalityManager/Scheduler/Events/Action_Base.h b/DAnCE/dance/LocalityManager/Scheduler/Events/Action_Base.h deleted file mode 100644 index b2557a3a90e..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Events/Action_Base.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @file Action_Base.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - */ - -#ifndef ACTION_BASE_H -#define ACTION_BASE_H - -#include "dance/LocalityManager/Scheduler/Deployment_Event.h" -#include "dance/LocalityManager/Scheduler/Plugin_Manager.h" - -namespace DAnCE -{ - class Deployment_Scheduler_Export Action_Base - : public virtual Deployment_Event - { - public: - Action_Base (Event_Future holder, - const char *name, - const char *instance_type); - - virtual ~Action_Base (void); - - virtual int call (void); - - protected: - virtual void invoke_pre_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &) = 0; - - virtual void invoke (::DAnCE::InstanceDeploymentHandler_ptr) = 0; - - virtual void invoke_post_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &) = 0; - - virtual void create_unexpected_exception (const std::string &, - const std::string &) = 0; - - virtual void create_valid_result (Event_Result &) = 0; - - ::CORBA::Any_var instance_excep_; - }; -} - -#endif diff --git a/DAnCE/dance/LocalityManager/Scheduler/Events/Configured.cpp b/DAnCE/dance/LocalityManager/Scheduler/Events/Configured.cpp deleted file mode 100644 index 2122f67147c..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Events/Configured.cpp +++ /dev/null @@ -1,91 +0,0 @@ -#include "Configured.h" - -#include "tao/AnyTypeCode/ExceptionA.h" -#include "dance/Logger/Log_Macros.h" -#include "dance/Deployment/Deployment_StartErrorC.h" -#include "dance/DAnCE_DeploymentInterceptorsC.h" -#include "dance/DAnCE_LocalityManagerC.h" -#include "dance/DAnCE_Utility.h" -#include "dance/LocalityManager/Scheduler/Deployment_Event.h" -#include "dance/LocalityManager/Scheduler/Plugin_Manager.h" - -namespace DAnCE -{ - Instance_Configured::Instance_Configured (::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const char *inst_type, - Event_Future holder) - : Deployment_Event (holder, - plan.instance[instanceRef].name.in (), - inst_type), - Action_Base (holder, - plan.instance[instanceRef].name.in (), - inst_type), - plan_ (plan), - instanceRef_ (instanceRef) - { - } - - Instance_Configured::~Instance_Configured (void) - { - } - - - void - Instance_Configured::invoke_pre_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &) - { - DANCE_TRACE ("Instance_Configured::invoke_pre_interceptor"); - - //no-op - } - - - void - Instance_Configured::invoke (::DAnCE::InstanceDeploymentHandler_ptr handler) - { - DANCE_TRACE ("Instance_Configured::invoke"); - - DANCE_DEBUG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("Instance_Configured::invoke - ") - ACE_TEXT ("Invoking instance_configured on handler for type <%C>\n"), - this->instance_type_.c_str ())); - handler->instance_configured (this->plan_, - this->instanceRef_); - DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("Instance_Configured::invoke - ") - ACE_TEXT ("instance_configured completed\n"))); - } - - - void - Instance_Configured::invoke_post_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &i) - { - DANCE_TRACE ("Instance_Configured::invoke_post_interceptor"); - - (*i)->post_configured (this->plan_, - this->instanceRef_, - this->instance_excep_.in ()); - } - - - void - Instance_Configured::create_unexpected_exception (const std::string &name, - const std::string &reason) - { - DANCE_TRACE ("Instance_Configured::create_unexpected_exception"); - - ::Deployment::StartError ex_tmp (name.c_str (), - reason.c_str ()); - this->instance_excep_ = - DAnCE::Utility::create_any_from_exception (ex_tmp); - } - - void - Instance_Configured::create_valid_result (Event_Result &) - { - DANCE_TRACE ("Instance_Configured::create_valid_result"); - // no-op - } -} diff --git a/DAnCE/dance/LocalityManager/Scheduler/Events/Configured.h b/DAnCE/dance/LocalityManager/Scheduler/Events/Configured.h deleted file mode 100644 index 4fdc4e935db..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Events/Configured.h +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @file Configured.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - */ - -#ifndef EVENT_CONFIGURED_H -#define EVENT_CONFIGURED_H - -#include "dance/LocalityManager/Scheduler/Deployment_Scheduler_export.h" -#include "dance/LocalityManager/Scheduler/Events/Action_Base.h" -#include "dance/Deployment/Deployment_DeploymentPlanC.h" - -namespace DAnCE -{ - /** - * @class - */ - class Deployment_Scheduler_Export Instance_Configured : - public virtual Action_Base - { - public: - Instance_Configured (::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const char *instance_type, - Event_Future holder); - - virtual ~Instance_Configured (void); - - protected: - virtual void invoke_pre_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &); - - virtual void invoke (::DAnCE::InstanceDeploymentHandler_ptr); - - virtual void invoke_post_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &); - - virtual void create_unexpected_exception (const std::string &, - const std::string &); - - virtual void create_valid_result (Event_Result &); - - private: - ::Deployment::DeploymentPlan &plan_; - ::CORBA::ULong instanceRef_; - }; -} - -#endif diff --git a/DAnCE/dance/LocalityManager/Scheduler/Events/Connect.cpp b/DAnCE/dance/LocalityManager/Scheduler/Events/Connect.cpp deleted file mode 100644 index 67444fe4831..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Events/Connect.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include "Connect.h" - -#include "tao/AnyTypeCode/ExceptionA.h" -#include "dance/Logger/Log_Macros.h" -#include "dance/Deployment/Deployment_StartErrorC.h" -#include "dance/DAnCE_DeploymentInterceptorsC.h" -#include "dance/DAnCE_LocalityManagerC.h" -#include "dance/DAnCE_Utility.h" -#include "dance/LocalityManager/Scheduler/Deployment_Event.h" -#include "dance/LocalityManager/Scheduler/Plugin_Manager.h" - -namespace DAnCE -{ - Connect_Instance::Connect_Instance (::Deployment::DeploymentPlan & plan, - ::CORBA::ULong connectionRef, - const ::CORBA::Any &provided_ref, - const char *inst_type, - Event_Future holder) - : Deployment_Event (holder, - plan.connection[connectionRef].name.in (), - inst_type), - Action_Base (holder, - plan.connection[connectionRef].name.in (), - inst_type), - plan_ (plan), - connectionRef_ (connectionRef), - provided_ref_ (provided_ref) - { - } - - Connect_Instance::~Connect_Instance (void) - { - } - - - void - Connect_Instance::invoke_pre_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &i) - { - DANCE_TRACE ("Connect_Instance::invoke_pre_interceptor"); - - (*i)->pre_connect (this->plan_, - this->connectionRef_, - this->provided_ref_); - } - - - void - Connect_Instance::invoke (::DAnCE::InstanceDeploymentHandler_ptr handler) - { - DANCE_TRACE ("Connect_Instance::invoke"); - - DANCE_DEBUG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("Connect_Instance::invoke - ") - ACE_TEXT ("Invoking connect_instance on handler\n"))); - - handler->connect_instance (this->plan_, - this->connectionRef_, - this->provided_ref_); - - DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("Connect_Instance::invoke - ") - ACE_TEXT ("connect_instance successful completed\n"))); - } - - - void - Connect_Instance::invoke_post_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &i) - { - DANCE_TRACE ("Connect_Instance::invoke_post_interceptor"); - - (*i)->post_connect (this->plan_, - this->connectionRef_, - this->instance_excep_.in ()); - } - - - void - Connect_Instance::create_unexpected_exception (const std::string &name, - const std::string &reason) - { - DANCE_TRACE ("Connect_Instance::create_unexpected_exception"); - - ::Deployment::InvalidConnection ex_tmp (name.c_str (), - reason.c_str ()); - this->instance_excep_ = - DAnCE::Utility::create_any_from_exception (ex_tmp); - } - - void - Connect_Instance::create_valid_result (Event_Result &) - { - DANCE_TRACE ("Connect_Instance::create_valid_result"); - // no-op - } -} diff --git a/DAnCE/dance/LocalityManager/Scheduler/Events/Connect.h b/DAnCE/dance/LocalityManager/Scheduler/Events/Connect.h deleted file mode 100644 index 909cbe63d1f..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Events/Connect.h +++ /dev/null @@ -1,49 +0,0 @@ -/** - * @file Connect.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - */ - -#ifndef EVENT_CONNECT_H -#define EVENT_CONNECT_H - -#include "dance/LocalityManager/Scheduler/Deployment_Scheduler_export.h" -#include "dance/LocalityManager/Scheduler/Events/Action_Base.h" -#include "dance/Deployment/Deployment_DeploymentPlanC.h" - -namespace DAnCE -{ - /** - * @class - */ - class Deployment_Scheduler_Export Connect_Instance : - public virtual Action_Base - { - public: - Connect_Instance (::Deployment::DeploymentPlan & plan, - ::CORBA::ULong connectionRef, - const ::CORBA::Any &provided_ref, - const char *instance_type, - Event_Future holder); - - virtual ~Connect_Instance (void); - - protected: - virtual void invoke_pre_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &); - - virtual void invoke (::DAnCE::InstanceDeploymentHandler_ptr); - - virtual void invoke_post_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &); - - virtual void create_unexpected_exception (const std::string &, - const std::string &); - - virtual void create_valid_result (Event_Result &); - - private: - ::Deployment::DeploymentPlan &plan_; - ::CORBA::ULong connectionRef_; - ::CORBA::Any provided_ref_; - }; -} - -#endif diff --git a/DAnCE/dance/LocalityManager/Scheduler/Events/Disconnect.cpp b/DAnCE/dance/LocalityManager/Scheduler/Events/Disconnect.cpp deleted file mode 100644 index 6e4ab74dd22..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Events/Disconnect.cpp +++ /dev/null @@ -1,91 +0,0 @@ -#include "Disconnect.h" - -#include "tao/AnyTypeCode/ExceptionA.h" -#include "dance/Logger/Log_Macros.h" -#include "dance/Deployment/Deployment_StartErrorC.h" -#include "dance/DAnCE_DeploymentInterceptorsC.h" -#include "dance/DAnCE_LocalityManagerC.h" -#include "dance/DAnCE_Utility.h" -#include "dance/LocalityManager/Scheduler/Deployment_Event.h" -#include "dance/LocalityManager/Scheduler/Plugin_Manager.h" - -namespace DAnCE -{ - Disconnect_Instance::Disconnect_Instance (::Deployment::DeploymentPlan & plan, - ::CORBA::ULong connectionRef, - const char *inst_type, - Event_Future holder) - : Deployment_Event (holder, - plan.connection[connectionRef].name.in (), - inst_type), - Action_Base (holder, - plan.connection[connectionRef].name.in (), - inst_type), - plan_ (plan), - connectionRef_ (connectionRef) - { - } - - Disconnect_Instance::~Disconnect_Instance (void) - { - } - - - void - Disconnect_Instance::invoke_pre_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &i) - { - DANCE_TRACE ("Disconnect_Instance::invoke_pre_interceptor"); - - (*i)->pre_disconnect (this->plan_, this->connectionRef_); - } - - - void - Disconnect_Instance::invoke (::DAnCE::InstanceDeploymentHandler_ptr handler) - { - DANCE_TRACE ("Disconnect_Instance::invoke"); - - DANCE_DEBUG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("Disconnect_Instance::invoke - ") - ACE_TEXT ("Invoking disconnect_instance on handler\n"))); - - handler->disconnect_instance (this->plan_, this->connectionRef_); - - DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("Disconnect_Instance::invoke - ") - ACE_TEXT ("disconnect_instance successful completed\n"))); - } - - - void - Disconnect_Instance::invoke_post_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &i) - { - DANCE_TRACE ("Disconnect_Instance::invoke_post_interceptor"); - - (*i)->post_disconnect (this->plan_, - this->connectionRef_, - this->instance_excep_.in ()); - } - - - void - Disconnect_Instance::create_unexpected_exception (const std::string &name, - const std::string &reason) - { - DANCE_TRACE ("Disconnect_Instance::create_unexpected_exception"); - - ::Deployment::InvalidConnection ex_tmp (name.c_str (), - reason.c_str ()); - this->instance_excep_ = - DAnCE::Utility::create_any_from_exception (ex_tmp); - } - - void - Disconnect_Instance::create_valid_result (Event_Result &) - { - DANCE_TRACE ("Disconnect_Instance::create_valid_result"); - // no-op - } -} diff --git a/DAnCE/dance/LocalityManager/Scheduler/Events/Disconnect.h b/DAnCE/dance/LocalityManager/Scheduler/Events/Disconnect.h deleted file mode 100644 index 72b22d90e41..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Events/Disconnect.h +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @file Disconnect.h - * @author Johnny Willemsen <jwillemsen@remedy.nl> - */ - -#ifndef EVENT_DISCONNECT_H -#define EVENT_DISCONNECT_H - -#include "dance/LocalityManager/Scheduler/Deployment_Scheduler_export.h" -#include "dance/LocalityManager/Scheduler/Events/Action_Base.h" -#include "dance/Deployment/Deployment_DeploymentPlanC.h" - -namespace DAnCE -{ - /** - * @class - */ - class Deployment_Scheduler_Export Disconnect_Instance : - public virtual Action_Base - { - public: - Disconnect_Instance (::Deployment::DeploymentPlan & plan, - ::CORBA::ULong connectionRef, - const char *instance_type, - Event_Future holder); - - virtual ~Disconnect_Instance (void); - - protected: - virtual void invoke_pre_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &); - - virtual void invoke (::DAnCE::InstanceDeploymentHandler_ptr); - - virtual void invoke_post_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &); - - virtual void create_unexpected_exception (const std::string &, - const std::string &); - - virtual void create_valid_result (Event_Result &); - - private: - ::Deployment::DeploymentPlan &plan_; - ::CORBA::ULong connectionRef_; - }; -} - -#endif diff --git a/DAnCE/dance/LocalityManager/Scheduler/Events/Endpoint.cpp b/DAnCE/dance/LocalityManager/Scheduler/Events/Endpoint.cpp deleted file mode 100644 index 2d6fb836902..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Events/Endpoint.cpp +++ /dev/null @@ -1,98 +0,0 @@ -#include "Endpoint.h" - -#include "tao/AnyTypeCode/ExceptionA.h" -#include "dance/Logger/Log_Macros.h" -#include "dance/Deployment/Deployment_StartErrorC.h" -#include "dance/DAnCE_DeploymentInterceptorsC.h" -#include "dance/DAnCE_LocalityManagerC.h" -#include "dance/DAnCE_Utility.h" -#include "dance/LocalityManager/Scheduler/Deployment_Event.h" -#include "dance/LocalityManager/Scheduler/Plugin_Manager.h" - -namespace DAnCE -{ - Endpoint_Reference::Endpoint_Reference (::Deployment::DeploymentPlan & plan, - ::CORBA::ULong connectionRef, - const char *inst_type, - Event_Future holder) - : Deployment_Event (holder, - plan.connection[connectionRef].name.in (), - inst_type), - Action_Base (holder, - plan.connection[connectionRef].name.in (), - inst_type), - plan_ (plan), - connectionRef_ (connectionRef) - { - CORBA::Any *tmp; - ACE_NEW_THROW_EX (tmp, - ::CORBA::Any (), - CORBA::NO_MEMORY ()); - ref_ = tmp; - } - - Endpoint_Reference::~Endpoint_Reference (void) - { - } - - void - Endpoint_Reference::invoke_pre_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &) - { - DANCE_TRACE ("Endpoint_Reference::invoke_pre_interceptor"); - - // no-op - } - - - void - Endpoint_Reference::invoke (::DAnCE::InstanceDeploymentHandler_ptr handler) - { - DANCE_TRACE ("Endpoint_Reference::invoke"); - - DANCE_DEBUG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("Endpoint_Reference::invoke - ") - ACE_TEXT ("Invoking provide_endpoint_reference on handler\n"))); - - handler->provide_endpoint_reference (this->plan_, - this->connectionRef_, - this->ref_.out ()); - DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("Endpoint_Reference::invoke - ") - ACE_TEXT ("provide_endpoint_reference successful completed\n"))); - } - - - void - Endpoint_Reference::invoke_post_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &i) - { - DANCE_TRACE ("Endpoint_Reference::invoke_post_interceptor"); - - (*i)->post_endpoint_reference (this->plan_, - this->connectionRef_, - this->ref_.in (), - this->instance_excep_.in ()); - } - - - void - Endpoint_Reference::create_unexpected_exception (const std::string &name, - const std::string &reason) - { - DANCE_TRACE ("Endpoint_Reference::create_unexpected_exception"); - - ::Deployment::StartError ex_tmp (name.c_str (), - reason.c_str ()); - this->instance_excep_ = - DAnCE::Utility::create_any_from_exception (ex_tmp); - } - - void - Endpoint_Reference::create_valid_result (Event_Result &result) - { - DANCE_TRACE ("Endpoint_Reference::create_valid_result"); - result.contents_ = this->ref_._retn (); - // no-op - } -} diff --git a/DAnCE/dance/LocalityManager/Scheduler/Events/Endpoint.h b/DAnCE/dance/LocalityManager/Scheduler/Events/Endpoint.h deleted file mode 100644 index 4e658d8a3d2..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Events/Endpoint.h +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @file Endpoint.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - */ - -#ifndef EVENT_ENDPOINT_H -#define EVENT_ENDPOINT_H - -#include "dance/LocalityManager/Scheduler/Deployment_Scheduler_export.h" -#include "dance/LocalityManager/Scheduler/Events/Action_Base.h" -#include "dance/Deployment/Deployment_DeploymentPlanC.h" - -namespace DAnCE -{ - /** - * @class - */ - class Deployment_Scheduler_Export Endpoint_Reference : - public virtual Action_Base - { - public: - Endpoint_Reference (::Deployment::DeploymentPlan & plan, - ::CORBA::ULong connectionRef, - const char *instance_type, - Event_Future holder); - - virtual ~Endpoint_Reference (void); - - protected: - virtual void invoke_pre_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &); - - virtual void invoke (::DAnCE::InstanceDeploymentHandler_ptr); - - virtual void invoke_post_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &); - - virtual void create_unexpected_exception (const std::string &, - const std::string &); - - virtual void create_valid_result (Event_Result &); - - private: - ::Deployment::DeploymentPlan &plan_; - ::CORBA::ULong connectionRef_; - ::CORBA::Any_var ref_; - }; -} - -#endif diff --git a/DAnCE/dance/LocalityManager/Scheduler/Events/Install.cpp b/DAnCE/dance/LocalityManager/Scheduler/Events/Install.cpp deleted file mode 100644 index e35aa74c773..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Events/Install.cpp +++ /dev/null @@ -1,99 +0,0 @@ -#include "Install.h" - -#include "tao/AnyTypeCode/ExceptionA.h" -#include "dance/Logger/Log_Macros.h" -#include "dance/Deployment/Deployment_StartErrorC.h" -#include "dance/DAnCE_DeploymentInterceptorsC.h" -#include "dance/DAnCE_LocalityManagerC.h" -#include "dance/DAnCE_Utility.h" -#include "dance/LocalityManager/Scheduler/Deployment_Event.h" -#include "dance/LocalityManager/Scheduler/Plugin_Manager.h" - -namespace DAnCE -{ - Install_Instance::Install_Instance (::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const char *inst_type, - Event_Future holder) - : Deployment_Event (holder, - plan.instance[instanceRef].name.in (), - inst_type), - Action_Base (holder, - plan.instance[instanceRef].name.in (), - inst_type), - plan_ (plan), - instanceRef_ (instanceRef) - { - CORBA::Any *tmp; - ACE_NEW_THROW_EX (tmp, - ::CORBA::Any (), - CORBA::NO_MEMORY ()); - - instance_ = tmp; - } - - Install_Instance::~Install_Instance (void) - { - } - - void - Install_Instance::invoke_pre_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &i) - { - DANCE_TRACE ("Install_Instance::invoke_pre_interceptor"); - - (*i)->pre_install (this->plan_, this->instanceRef_); - } - - - void - Install_Instance::invoke (::DAnCE::InstanceDeploymentHandler_ptr handler) - { - DANCE_TRACE ("Install_Instance::invoke"); - - DANCE_DEBUG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("Install_Instance::invoke - ") - ACE_TEXT ("Invoking install_instance on handler for type <%C>\n"), - this->instance_type_.c_str ())); - - handler->install_instance (this->plan_, - this->instanceRef_, - this->instance_.out ()); - - DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("Install_Instance::invoke - ") - ACE_TEXT ("install_instance completed\n"))); - } - - - void - Install_Instance::invoke_post_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &i) - { - DANCE_TRACE ("Install_Instance::invoke_post_interceptor"); - - (*i)->post_install (this->plan_, - this->instanceRef_, - this->instance_.in (), - this->instance_excep_.in ()); - } - - - void - Install_Instance::create_unexpected_exception (const std::string &name, - const std::string &reason) - { - DANCE_TRACE ("Install_Instance::create_unexpected_exception"); - - ::Deployment::StartError ex_tmp (name.c_str (), - reason.c_str ()); - this->instance_excep_ = - DAnCE::Utility::create_any_from_exception (ex_tmp); - } - - void - Install_Instance::create_valid_result (Event_Result &result) - { - result.contents_ = this->instance_._retn (); - } -} diff --git a/DAnCE/dance/LocalityManager/Scheduler/Events/Install.h b/DAnCE/dance/LocalityManager/Scheduler/Events/Install.h deleted file mode 100644 index 9a59315c10a..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Events/Install.h +++ /dev/null @@ -1,49 +0,0 @@ -/** - * @file Install.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - */ - -#ifndef EVENT_INSTALL_H -#define EVENT_INSTALL_H - -#include "dance/LocalityManager/Scheduler/Deployment_Scheduler_export.h" -#include "dance/LocalityManager/Scheduler/Events/Action_Base.h" -#include "dance/Deployment/Deployment_DeploymentPlanC.h" - -namespace DAnCE -{ - /** - * @class - */ - class Deployment_Scheduler_Export Install_Instance : - public virtual Action_Base - { - public: - Install_Instance (::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const char *instance_type, - Event_Future holder); - - virtual ~Install_Instance (void); - - protected: - virtual void invoke_pre_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &); - - virtual void invoke (::DAnCE::InstanceDeploymentHandler_ptr); - - virtual void invoke_post_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &); - - virtual void create_unexpected_exception (const std::string &, - const std::string &); - - virtual void create_valid_result (Event_Result &); - - private: - ::Deployment::DeploymentPlan &plan_; - ::CORBA::ULong instanceRef_; - - ::CORBA::Any_var instance_; - }; -} - -#endif diff --git a/DAnCE/dance/LocalityManager/Scheduler/Events/Passivate.cpp b/DAnCE/dance/LocalityManager/Scheduler/Events/Passivate.cpp deleted file mode 100644 index acf3a514006..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Events/Passivate.cpp +++ /dev/null @@ -1,94 +0,0 @@ -#include "Passivate.h" - -#include "tao/AnyTypeCode/ExceptionA.h" -#include "dance/Logger/Log_Macros.h" -#include "dance/Deployment/Deployment_StartErrorC.h" -#include "dance/DAnCE_DeploymentInterceptorsC.h" -#include "dance/DAnCE_LocalityManagerC.h" -#include "dance/DAnCE_Utility.h" -#include "dance/LocalityManager/Scheduler/Deployment_Event.h" -#include "dance/LocalityManager/Scheduler/Plugin_Manager.h" - -namespace DAnCE -{ - Passivate_Instance::Passivate_Instance (::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const CORBA::Any &ref, - const char *inst_type, - Event_Future holder) - : Deployment_Event (holder, - plan.instance[instanceRef].name.in (), - inst_type), - Action_Base (holder, - plan.instance[instanceRef].name.in (), - inst_type), - plan_ (plan), - instanceRef_ (instanceRef), - ref_ (ref) - { - } - - Passivate_Instance::~Passivate_Instance (void) - { - } - - - void - Passivate_Instance::invoke_pre_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &) - { - DANCE_TRACE ("Passivate_Instance::invoke_pre_interceptor"); - - //no-op - } - - - void - Passivate_Instance::invoke (::DAnCE::InstanceDeploymentHandler_ptr handler) - { - DANCE_TRACE ("Passivate_Instance::invoke"); - - DANCE_DEBUG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("Passivate_Instance::invoke - ") - ACE_TEXT ("Invoking passivate_instance on handler for type <%C>\n"), - this->instance_type_.c_str ())); - handler->passivate_instance (this->plan_, - this->instanceRef_, - this->ref_); - DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("Passivate_Instance::invoke - ") - ACE_TEXT ("passivate_instance completed\n"))); - } - - - void - Passivate_Instance::invoke_post_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &i) - { - DANCE_TRACE ("Passivate_Instance::invoke_post_interceptor"); - - (*i)->post_passivate (this->plan_, - this->instanceRef_, - this->instance_excep_.in ()); - } - - - void - Passivate_Instance::create_unexpected_exception (const std::string &name, - const std::string &reason) - { - DANCE_TRACE ("Passivate_Instance::create_unexpected_exception"); - - ::Deployment::StopError ex_tmp (name.c_str (), - reason.c_str ()); - this->instance_excep_ = - DAnCE::Utility::create_any_from_exception (ex_tmp); - } - - void - Passivate_Instance::create_valid_result (Event_Result &) - { - DANCE_TRACE ("Passivate_Instance::create_valid_result"); - // no-op - } -} diff --git a/DAnCE/dance/LocalityManager/Scheduler/Events/Passivate.h b/DAnCE/dance/LocalityManager/Scheduler/Events/Passivate.h deleted file mode 100644 index 3e6d4b86246..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Events/Passivate.h +++ /dev/null @@ -1,49 +0,0 @@ -/** - * @file Passivate.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - */ - -#ifndef EVENT_PASSIVATE_H -#define EVENT_PASSIVATE_H - -#include "dance/LocalityManager/Scheduler/Deployment_Scheduler_export.h" -#include "dance/LocalityManager/Scheduler/Events/Action_Base.h" -#include "dance/Deployment/Deployment_DeploymentPlanC.h" - -namespace DAnCE -{ - /** - * @class - */ - class Deployment_Scheduler_Export Passivate_Instance : - public virtual Action_Base - { - public: - Passivate_Instance (::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const CORBA::Any &ref, - const char *instance_type, - Event_Future holder); - - virtual ~Passivate_Instance (void); - - protected: - virtual void invoke_pre_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &); - - virtual void invoke (::DAnCE::InstanceDeploymentHandler_ptr); - - virtual void invoke_post_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &); - - virtual void create_unexpected_exception (const std::string &, - const std::string &); - - virtual void create_valid_result (Event_Result &); - - private: - ::Deployment::DeploymentPlan &plan_; - ::CORBA::ULong instanceRef_; - const ::CORBA::Any &ref_; - }; -} - -#endif diff --git a/DAnCE/dance/LocalityManager/Scheduler/Events/Remove.cpp b/DAnCE/dance/LocalityManager/Scheduler/Events/Remove.cpp deleted file mode 100644 index a27013ba3c1..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Events/Remove.cpp +++ /dev/null @@ -1,93 +0,0 @@ -#include "Remove.h" - -#include "tao/AnyTypeCode/ExceptionA.h" -#include "dance/Logger/Log_Macros.h" -#include "dance/Deployment/Deployment_StartErrorC.h" -#include "dance/DAnCE_DeploymentInterceptorsC.h" -#include "dance/DAnCE_LocalityManagerC.h" -#include "dance/DAnCE_Utility.h" -#include "dance/LocalityManager/Scheduler/Deployment_Event.h" -#include "dance/LocalityManager/Scheduler/Plugin_Manager.h" - -namespace DAnCE -{ - Remove_Instance::Remove_Instance (::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const CORBA::Any &reference, - const char *inst_type, - Event_Future holder) - : Deployment_Event (holder, - plan.instance[instanceRef].name.in (), - inst_type), - Action_Base (holder, - plan.instance[instanceRef].name.in (), - inst_type), - plan_ (plan), - instanceRef_ (instanceRef), - reference_ (reference) - { - } - - Remove_Instance::~Remove_Instance (void) - { - } - - void - Remove_Instance::invoke_pre_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &) - { - DANCE_TRACE ("Remove_Instance::invoke_pre_interceptor"); - - //no-op - } - - - void - Remove_Instance::invoke (::DAnCE::InstanceDeploymentHandler_ptr handler) - { - DANCE_TRACE ("Remove_Instance::invoke"); - - DANCE_DEBUG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("Remove_Instance::invoke - ") - ACE_TEXT ("Invoking remove_instance on handler for type <%C>\n"), - this->instance_type_.c_str ())); - handler->remove_instance (this->plan_, - this->instanceRef_, - this->reference_); - DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("Remove_Instance::invoke - ") - ACE_TEXT ("remove_instance completed\n"))); - } - - - void - Remove_Instance::invoke_post_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &i) - { - DANCE_TRACE ("Remove_Instance::invoke_post_interceptor"); - - (*i)->post_remove (this->plan_, - this->instanceRef_, - this->instance_excep_.in ()); - } - - - void - Remove_Instance::create_unexpected_exception (const std::string &name, - const std::string &reason) - { - DANCE_TRACE ("Remove_Instance::create_unexpected_exception"); - - ::Deployment::StopError ex_tmp (name.c_str (), - reason.c_str ()); - this->instance_excep_ = - DAnCE::Utility::create_any_from_exception (ex_tmp); - } - - void - Remove_Instance::create_valid_result (Event_Result &) - { - DANCE_TRACE ("Remove_Instance::create_valid_result"); - // no-op - } -} diff --git a/DAnCE/dance/LocalityManager/Scheduler/Events/Remove.h b/DAnCE/dance/LocalityManager/Scheduler/Events/Remove.h deleted file mode 100644 index 08c89fd2fd4..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Events/Remove.h +++ /dev/null @@ -1,49 +0,0 @@ -/** - * @file Remove.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - */ - -#ifndef EVENT_REMOVE_H -#define EVENT_REMOVE_H - -#include "dance/LocalityManager/Scheduler/Deployment_Scheduler_export.h" -#include "dance/LocalityManager/Scheduler/Events/Action_Base.h" -#include "dance/Deployment/Deployment_DeploymentPlanC.h" - -namespace DAnCE -{ - /** - * @class - */ - class Deployment_Scheduler_Export Remove_Instance : - public virtual Action_Base - { - public: - Remove_Instance (::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const CORBA::Any &reference, - const char *instance_type, - Event_Future holder); - - virtual ~Remove_Instance (void); - -protected: - virtual void invoke_pre_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &); - - virtual void invoke (::DAnCE::InstanceDeploymentHandler_ptr); - - virtual void invoke_post_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &); - - virtual void create_unexpected_exception (const std::string &, - const std::string &); - - virtual void create_valid_result (Event_Result &); - - private: - ::Deployment::DeploymentPlan & plan_; - ::CORBA::ULong instanceRef_; - ::CORBA::Any reference_; - }; -} - -#endif diff --git a/DAnCE/dance/LocalityManager/Scheduler/Events/Start.cpp b/DAnCE/dance/LocalityManager/Scheduler/Events/Start.cpp deleted file mode 100644 index edd061ba1f1..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Events/Start.cpp +++ /dev/null @@ -1,93 +0,0 @@ -#include "Start.h" - -#include "tao/AnyTypeCode/ExceptionA.h" -#include "dance/Logger/Log_Macros.h" -#include "dance/Deployment/Deployment_StartErrorC.h" -#include "dance/DAnCE_DeploymentInterceptorsC.h" -#include "dance/DAnCE_LocalityManagerC.h" -#include "dance/DAnCE_Utility.h" -#include "dance/LocalityManager/Scheduler/Deployment_Event.h" -#include "dance/LocalityManager/Scheduler/Plugin_Manager.h" - -namespace DAnCE -{ - Start_Instance::Start_Instance (::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const CORBA::Any &ref, - const char *inst_type, - Event_Future holder) - : Deployment_Event (holder, - plan.instance[instanceRef].name.in (), - inst_type), - Action_Base (holder, - plan.instance[instanceRef].name.in (), - inst_type), - plan_ (plan), - instanceRef_ (instanceRef), - ref_ (ref) - { - } - - Start_Instance::~Start_Instance (void) - { - } - - void - Start_Instance::invoke_pre_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &) - { - DANCE_TRACE ("Start_Instance::invoke_pre_interceptor"); - - //no-op - } - - - void - Start_Instance::invoke (::DAnCE::InstanceDeploymentHandler_ptr handler) - { - DANCE_TRACE ("Start_Instance::invoke"); - - DANCE_DEBUG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("Start_Instance::invoke - ") - ACE_TEXT ("Invoking activate_instance on handler for type <%C>\n"), - this->instance_type_.c_str ())); - handler->activate_instance (this->plan_, - this->instanceRef_, - this->ref_); - DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("Start_Instance::invoke - ") - ACE_TEXT ("activate_instance completed\n"))); - } - - - void - Start_Instance::invoke_post_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &i) - { - DANCE_TRACE ("Start_Instance::invoke_post_interceptor"); - - (*i)->post_activate (this->plan_, - this->instanceRef_, - this->instance_excep_.in ()); - } - - - void - Start_Instance::create_unexpected_exception (const std::string &name, - const std::string &reason) - { - DANCE_TRACE ("Start_Instance::create_unexpected_exception"); - - ::Deployment::StartError ex_tmp (name.c_str (), - reason.c_str ()); - this->instance_excep_ = - DAnCE::Utility::create_any_from_exception (ex_tmp); - } - - void - Start_Instance::create_valid_result (Event_Result &) - { - DANCE_TRACE ("Start_Instance::create_valid_result"); - // no-op - } -} diff --git a/DAnCE/dance/LocalityManager/Scheduler/Events/Start.h b/DAnCE/dance/LocalityManager/Scheduler/Events/Start.h deleted file mode 100644 index 7672c63fbaf..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Events/Start.h +++ /dev/null @@ -1,49 +0,0 @@ -/** - * @file Start.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - */ - -#ifndef EVENT_START_H -#define EVENT_START_H - -#include "dance/LocalityManager/Scheduler/Deployment_Scheduler_export.h" -#include "dance/LocalityManager/Scheduler/Events/Action_Base.h" -#include "dance/Deployment/Deployment_DeploymentPlanC.h" - -namespace DAnCE -{ - /** - * @class - */ - class Deployment_Scheduler_Export Start_Instance : - public virtual Action_Base - { - public: - Start_Instance (::Deployment::DeploymentPlan & plan, - ::CORBA::ULong instanceRef, - const CORBA::Any &instance_ref, - const char *instance_type, - Event_Future holder); - - virtual ~Start_Instance (void); - - protected: - virtual void invoke_pre_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &); - - virtual void invoke (::DAnCE::InstanceDeploymentHandler_ptr); - - virtual void invoke_post_interceptor (Plugin_Manager::INTERCEPTORS::const_iterator &); - - virtual void create_unexpected_exception (const std::string &, - const std::string &); - - virtual void create_valid_result (Event_Result &); - - private: - ::Deployment::DeploymentPlan &plan_; - ::CORBA::ULong instanceRef_; - const CORBA::Any &ref_; - }; -} - -#endif diff --git a/DAnCE/dance/LocalityManager/Scheduler/Plugin_Manager.cpp b/DAnCE/dance/LocalityManager/Scheduler/Plugin_Manager.cpp deleted file mode 100644 index c62212271bf..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Plugin_Manager.cpp +++ /dev/null @@ -1,378 +0,0 @@ -#include "Plugin_Manager.h" -#include "dance/Logger/Log_Macros.h" -#include "dance/Deployment/Deployment_PlanErrorC.h" -#include "dance/DAnCE_LocalityManagerC.h" -#include "dance/DAnCE_DeploymentInterceptorsC.h" - -namespace DAnCE -{ - namespace - { - template <typename PLUGIN> - typename PLUGIN::_ptr_type - load_plugin (const ACE_TCHAR *artifact, - const ACE_TCHAR *entrypoint, - int open_mode) - { - if (!artifact || !entrypoint) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Plugin_Manager::load_plugin - ") - ACE_TEXT ("Must provide non-nil artifact and entrypoint names\n"))); - throw ::Deployment::PlanError ("", - "Invalid parameters for plug-in installation"); - } - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT ("Plugin_Manager::load_plugin - ") - ACE_TEXT ("Loading plugin from <%s>:<%s>\n"), - artifact, - entrypoint)); - - ACE_DLL plugin_dll; - - if (plugin_dll.open (artifact, - open_mode, - false) != 0) - { - const ACE_TCHAR *error = plugin_dll.error (); - - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Plugin_Manager::load_plugin - ") - ACE_TEXT ("Error while loading artifact <%s> with mode <%d>: %s\n"), - artifact, - open_mode, - error)); - - throw ::Deployment::PlanError (ACE_TEXT_ALWAYS_CHAR (artifact), - ACE_TEXT_ALWAYS_CHAR (error)); - } - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("Plugin_Manager::load_plugin - ") - ACE_TEXT ("Loading artifact <%s> successfully loaded.\n"), - artifact)); - - void *void_ptr = plugin_dll.symbol (entrypoint); - ptrdiff_t tmp_ptr = reinterpret_cast <ptrdiff_t> (void_ptr); - - typedef typename PLUGIN::_ptr_type (*PluginFactory) (void); - PluginFactory pcreator = reinterpret_cast<PluginFactory> (tmp_ptr); - - if (!pcreator) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Plugin_Manager::load_plugin - ") - ACE_TEXT ("Unable to load plugin <%s>:<%s>\n"), - artifact, - entrypoint)); - throw ::Deployment::PlanError (ACE_TEXT_ALWAYS_CHAR (artifact), - "Invalid entrypoint"); - } - - typename PLUGIN::_var_type plugin = pcreator (); - - if (CORBA::is_nil (plugin)) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Plugin_Manager::load_plugin - ") - ACE_TEXT ("Unable to load plugin <%s>:<%s>, nil result from factory\n"), - artifact, - entrypoint)); - throw ::Deployment::PlanError (ACE_TEXT_ALWAYS_CHAR (artifact), - "Nil result from factory"); - } - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_TRACE, DLINFO - ACE_TEXT ("Plugin_Manager::load_plugin - ") - ACE_TEXT ("Successfully created plugin from <%s> with mode <%d>:<%s>.\n"), - artifact, - open_mode, - entrypoint)); - - return plugin._retn (); - } - } - - Plugin_Manager::Plugin_Manager (void) : - config_ (0) - { - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_INFO, DLINFO - ACE_TEXT ("Plugin_Manager::Plugin_Manager") - ACE_TEXT ("\n"))); - } - - void - Plugin_Manager::set_orb (CORBA::ORB_ptr orb) - { - this->orb_ = CORBA::ORB::_duplicate (orb); - } - - CORBA::ORB_ptr - Plugin_Manager::get_orb (void) - { - return CORBA::ORB::_duplicate (this->orb_); - } - - template<typename T> - struct Closer - { - void operator() (T& item) - { - item.second->close (); - } - }; - - Plugin_Manager::~Plugin_Manager (void) - { - try - { - std::for_each (handler_map_.begin (), - handler_map_.end (), - Closer<HANDLER_MAP::value_type> ()); - - for (INTERCEPTORS::iterator i = this->interceptors_.begin (); - i != this->interceptors_.end (); - ++i) - *i = ::DAnCE::DeploymentInterceptor::_nil (); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Plugin_Manager::~Plugin_Manager - ") - ACE_TEXT ("Caught unknown C++ exception while closing plugin manager\n"))); - } - } - - void - Plugin_Manager::set_configuration (const Deployment::Properties &config) - { - this->config_ = &config; - } - - char * - Plugin_Manager::register_installation_handler (const ACE_TCHAR *artifact, - const ACE_TCHAR *entrypoint, - const Plugin_Manager::IH_DEPS &depends, - int open_mode) - { - ::DAnCE::InstanceDeploymentHandler_var plugin = - load_plugin< ::DAnCE::InstanceDeploymentHandler > (artifact, - entrypoint, - open_mode); - - try - { - plugin->configure (*this->config_); - - CORBA::String_var instance_type = plugin->instance_type (); - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_INFO, DLINFO - ACE_TEXT ("Plugin_Manager::register_installation_handler - ") - ACE_TEXT ("Successfully created installation handler for instance type <%C>\n"), - instance_type.in ())); - - this->ih_dep_.add_dependency (instance_type.in (), depends); - - ::CORBA::StringSeq_var deps = plugin->dependencies (); - - if (!CORBA::is_nil (deps)) - { - for (CORBA::ULong i = 0; i < deps->length (); ++i) - { - this->ih_dep_.add_dependency (instance_type.in (), - deps[i].in ()); - } - } - - this->handler_map_[instance_type.in ()] = plugin._retn (); - - return instance_type._retn (); - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Plugin_Manager::register_installation_handler - ") - ACE_TEXT ("CORBA Exception caught while loading artifact <%s>:<%s> - %C\n"), - artifact, - entrypoint, - ex._info ().c_str ())); - throw ::Deployment::PlanError (ACE_TEXT_ALWAYS_CHAR (artifact), - ex._info ().c_str ()); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Plugin_Manager::register_installation_handler - ") - ACE_TEXT ("Unknown C++ exception while configuring plugin from <%s>:<%s>\n"), - artifact, - entrypoint)); - throw ::Deployment::PlanError (ACE_TEXT_ALWAYS_CHAR (artifact), - "Unknown C++ exception during handler configuration\n"); - } - } - - void - Plugin_Manager::get_installation_order (Plugin_Manager::INSTALL_ORDER &io) - { - this->ih_dep_.calculate_order (io); - } - - void - Plugin_Manager::register_interceptor (const ACE_TCHAR *artifact, - const ACE_TCHAR *entrypoint, - int open_mode) - { - ::DAnCE::DeploymentInterceptor_var plugin = - load_plugin< ::DAnCE::DeploymentInterceptor > (artifact, - entrypoint, - open_mode); - try - { - plugin->configure (*this->config_); - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_INFO, DLINFO - ACE_TEXT ("Plugin_Manager::register_interceptor - ") - ACE_TEXT ("Successfully created deployment interceptor\n"))); - - this->interceptors_.push_back (plugin._retn ()); - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Plugin_Manager::register_interceptor - ") - ACE_TEXT ("CORBA Exception caught while loading artifact <%s>:<%s> - %C\n"), - artifact, - entrypoint, - ex._info ().c_str ())); - throw ::Deployment::PlanError (ACE_TEXT_ALWAYS_CHAR (artifact), - ex._info ().c_str ()); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Plugin_Manager::register_interceptor - ") - ACE_TEXT ("Unknown C++ exception while configuring plugin from <%s>:<%s>\n"), - artifact, - entrypoint)); - throw ::Deployment::PlanError (ACE_TEXT_ALWAYS_CHAR (artifact), - "Unknown C++ exception during handler configuration\n"); - } - } - - ::DAnCE::InstanceDeploymentHandler_ptr - Plugin_Manager::fetch_installation_handler (const char *instance_type) - { - if (instance_type == 0) - { - return 0; - } - HANDLER_MAP::iterator i; - - if ((i = this->handler_map_.find (instance_type)) == - this->handler_map_.end ()) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Plugin_Manager::fetch_installation_handler - ") - ACE_TEXT ("No installation handler for type %C found\n"), - instance_type)); - - return 0; - } - - return ::DAnCE::InstanceDeploymentHandler::_duplicate (i->second); - } - - const - Plugin_Manager::INTERCEPTORS & - Plugin_Manager::fetch_interceptors (void) - { - return this->interceptors_; - } - - void - Plugin_Manager::register_configuration_plugin (const ACE_TCHAR *artifact, - const ACE_TCHAR *entrypoint, - int open_mode) - { - DAnCE::LocalityConfiguration_var plugin = - load_plugin< DAnCE::LocalityConfiguration > (artifact, - entrypoint, - open_mode); - - try - { - CORBA::String_var id = plugin->type (); - - this->config_plugins_[id.in ()] = plugin._retn (); - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Plugin_Manager::register_configuration_plugin - ") - ACE_TEXT ("CORBA Exception caught while loading artifact <%s>:<%s> - %C\n"), - artifact, - entrypoint, - ex._info ().c_str ())); - throw ::Deployment::PlanError (ACE_TEXT_ALWAYS_CHAR (artifact), - ex._info ().c_str ()); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Plugin_Manager::register_configuration_plugin - ") - ACE_TEXT ("Unknown C++ exception while configuring plugin from <%s>:<%s>\n"), - artifact, - entrypoint)); - throw ::Deployment::PlanError (ACE_TEXT_ALWAYS_CHAR (artifact), - "Unknown C++ exception during plugin configuration\n"); - } - } - - ::DAnCE::LocalityConfiguration_ptr - Plugin_Manager::get_configuration_handler (const char *id) - { - if (id == 0) - { - return 0; - } - - CONFIG_MAP::iterator i; - - if ((i = this->config_plugins_.find (id)) == - this->config_plugins_.end ()) - { - DANCE_ERROR (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_TRACE, DLINFO - ACE_TEXT ("Plugin_Manager::get_configuration_handler - ") - ACE_TEXT ("No configuration plugin for type %C found\n"), - id)); - - return 0; - } - - return ::DAnCE::LocalityConfiguration::_duplicate (i->second); - } - -} - -ACE_SINGLETON_TEMPLATE_INSTANTIATE(ACE_Singleton, DAnCE::Plugin_Manager, TAO_SYNCH_MUTEX); - diff --git a/DAnCE/dance/LocalityManager/Scheduler/Plugin_Manager.h b/DAnCE/dance/LocalityManager/Scheduler/Plugin_Manager.h deleted file mode 100644 index 6a8fdb92c82..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Plugin_Manager.h +++ /dev/null @@ -1,106 +0,0 @@ -/** - * @file Plugin_Manager.h - * @author William R. Otte <wotte@dre.vanderbilt.edu - * - * Singleton class to manage the lifecycle of deployment - * interceptors and plug-ins. - */ - -#ifndef PLUGIN_MANAGER_H -#define PLUGIN_MANAGER_H - -#include "ace/Singleton.h" - -#include "dance/LocalityManager/Scheduler/Deployment_Scheduler_export.h" -#include "dance/LocalityManager/Scheduler/Dependency_Sorter.h" -#include "dance/Deployment/Deployment_DeploymentPlanC.h" -#include "dance/DAnCE_LocalityManagerC.h" -#include "dance/DAnCE_DeploymentInterceptorsC.h" - -#include <map> -#include <set> -#include <list> - -namespace DAnCE -{ - /** - * @class Plugin_Manager - * - */ - class Deployment_Scheduler_Export Plugin_Manager - { - public: - Plugin_Manager (void); - - ~Plugin_Manager (void); - - void set_orb (CORBA::ORB_ptr orb); - - CORBA::ORB_ptr get_orb (void); - - /// Set the configuration of the plugin_manager - void set_configuration (const Deployment::Properties &config); - - typedef Dependency_Sorter::IH_DEPS IH_DEPS; - - /// Registers a new installation handler. - char * register_installation_handler (const ACE_TCHAR *artifact, - const ACE_TCHAR *entrypoint, - const IH_DEPS &dependencies, - int open_mode); - - /// Registers a new deployment interceptor - void register_interceptor (const ACE_TCHAR *artifact, - const ACE_TCHAR *entrypoint, - int open_mode); - - - typedef Dependency_Sorter::Invalid_Install_Order Invalid_Install_Order; - typedef Dependency_Sorter::INSTALL_ORDER INSTALL_ORDER; - - void get_installation_order (INSTALL_ORDER &); - - ::DAnCE::InstanceDeploymentHandler_ptr - fetch_installation_handler (const char *instance_type); - - typedef std::list < ::DAnCE::DeploymentInterceptor_var > - INTERCEPTORS; - - const INTERCEPTORS & fetch_interceptors (void); - - void register_configuration_plugin (const ACE_TCHAR *artifact, - const ACE_TCHAR *entrypoint, - int open_mode); - - ::DAnCE::LocalityConfiguration_ptr - get_configuration_handler (const char *id); - - private: - const ::Deployment::Properties *config_; - - typedef std::map < std::string, - ::DAnCE::InstanceDeploymentHandler_var > HANDLER_MAP; - - typedef std::map < std::string, - LocalityConfiguration_var > CONFIG_MAP; - - HANDLER_MAP handler_map_; - - INTERCEPTORS interceptors_; - - CONFIG_MAP config_plugins_; - - Dependency_Sorter ih_dep_; - - CORBA::ORB_var orb_; - }; - - typedef ACE_Singleton <Plugin_Manager, - TAO_SYNCH_MUTEX> PLUGIN_MANAGER; -} - -DEPLOYMENT_SCHEDULER_SINGLETON_DECLARE (ACE_Singleton, - DAnCE::Plugin_Manager, - TAO_SYNCH_MUTEX) -#endif - diff --git a/DAnCE/dance/LocalityManager/Scheduler/Scheduler.mpc b/DAnCE/dance/LocalityManager/Scheduler/Scheduler.mpc deleted file mode 100644 index 7a451f52fc7..00000000000 --- a/DAnCE/dance/LocalityManager/Scheduler/Scheduler.mpc +++ /dev/null @@ -1,45 +0,0 @@ -project(DAnCE_Deployment_Scheduler) : dance_lib, dance_output, dance_skel, dance_logger, install { - dynamicflags += DEPLOYMENT_SCHEDULER_BUILD_DLL - - includes += $(DANCE_ROOT)/tools - - Source_Files { - Deployment_Event.cpp - Plugin_Manager.cpp - Deployment_Scheduler.cpp - Deployment_Completion.cpp - Dependency_Sorter.cpp - Events/Action_Base.cpp - Events/Install.cpp - Events/Remove.cpp - Events/Connect.cpp - Events/Disconnect.cpp - Events/Endpoint.cpp - Events/Start.cpp - Events/Passivate.cpp - Events/Configured.cpp - } - - Inline_Files { - Deployment_Event.inl - } - - Header_Files { - Plugin_Manager.h - Deployment_Event.h - Deployment_Scheduler.h - Deployment_Scheduler_export.h - Deployment_Completion.h - Dependency_Sorter.h - Events/Action_Base.h - Events/Install.h - Events/Remove.h - Events/Connect.h - Events/Disconnect.h - Events/Endpoint.h - } - - specific { - install_dir = dance/LocalityManager/Scheduler - } -} diff --git a/DAnCE/dance/Logger/DAnCE_Logger_Export.h b/DAnCE/dance/Logger/DAnCE_Logger_Export.h deleted file mode 100644 index e2afcdd99ca..00000000000 --- a/DAnCE/dance/Logger/DAnCE_Logger_Export.h +++ /dev/null @@ -1,57 +0,0 @@ - -// -*- C++ -*- -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl DAnCE_Logger -// ------------------------------ -#ifndef DANCE_LOGGER_EXPORT_H -#define DANCE_LOGGER_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (DANCE_LOGGER_HAS_DLL) -# define DANCE_LOGGER_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && DANCE_LOGGER_HAS_DLL */ - -#if !defined (DANCE_LOGGER_HAS_DLL) -# define DANCE_LOGGER_HAS_DLL 1 -#endif /* ! DANCE_LOGGER_HAS_DLL */ - -#if defined (DANCE_LOGGER_HAS_DLL) && (DANCE_LOGGER_HAS_DLL == 1) -# if defined (DANCE_LOGGER_BUILD_DLL) -# define DAnCE_Logger_Export ACE_Proper_Export_Flag -# define DANCE_LOGGER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define DANCE_LOGGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* DANCE_LOGGER_BUILD_DLL */ -# define DAnCE_Logger_Export ACE_Proper_Import_Flag -# define DANCE_LOGGER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define DANCE_LOGGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* DANCE_LOGGER_BUILD_DLL */ -#else /* DANCE_LOGGER_HAS_DLL == 1 */ -# define DAnCE_Logger_Export -# define DANCE_LOGGER_SINGLETON_DECLARATION(T) -# define DANCE_LOGGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* DANCE_LOGGER_HAS_DLL == 1 */ - -// Set DANCE_LOGGER_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (DANCE_LOGGER_NTRACE) -# if (ACE_NTRACE == 1) -# define DANCE_LOGGER_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define DANCE_LOGGER_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !DANCE_LOGGER_NTRACE */ - -#if (DANCE_LOGGER_NTRACE == 1) -# define DANCE_LOGGER_TRACE(X) -#else /* (DANCE_LOGGER_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define DANCE_LOGGER_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (DANCE_LOGGER_NTRACE == 1) */ - -#endif /* DANCE_LOGGER_EXPORT_H */ - -// End of auto generated file. diff --git a/DAnCE/dance/Logger/Log_Macros.cpp b/DAnCE/dance/Logger/Log_Macros.cpp deleted file mode 100644 index 97bb2dd4dfe..00000000000 --- a/DAnCE/dance/Logger/Log_Macros.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "Log_Macros.h" - -DAnCE_Logger_Export unsigned int DAnCE_debug_level = 1; - -DAnCE_Logger_Export ACE_Log_Category DAnCE_log_category ("DAnCE"); diff --git a/DAnCE/dance/Logger/Log_Macros.h b/DAnCE/dance/Logger/Log_Macros.h deleted file mode 100644 index eb7c96173e2..00000000000 --- a/DAnCE/dance/Logger/Log_Macros.h +++ /dev/null @@ -1,160 +0,0 @@ -/** - * @file Log_Macros.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - * * Macros used for logging in DAnCE - */ - - -#ifndef DANCE_LOG_MACROS_H_ -#define DANCE_LOG_MACROS_H_ - -#include "ace/Log_Category.h" - -#include "DAnCE_Logger_Export.h" - -#if !defined (DLINFO) -# define DLINFO ACE_TEXT("(%P|%t) [%M] - %T - ") -#endif - -extern DAnCE_Logger_Export unsigned int DAnCE_debug_level; - -extern DAnCE_Logger_Export ACE_Log_Category DAnCE_log_category; - -// Defines for logging levels - -/// Used for errors that cause the fatal shutdown of any portion -/// of the infrastructure. -#define DANCE_LOG_EMERGENCY 1 -/// Used for deployment errors at the point the error -/// exits the process in question, or when a decision is made to -/// cause the deployment to fail. -#define DANCE_LOG_TERMINAL_ERROR 2 -/// Used for non-fatal deployment errors that do not cause deployment -/// failure. -#define DANCE_LOG_NONFATAL_ERROR 3 -/// Used to log detailed error information at the point of failure -#define DANCE_LOG_ERROR 4 -/// used to indicate that a questionable situation that doesn't cause -/// deployment failure, but can cause undefined conditions. -#define DANCE_LOG_WARNING 5 -/// Used to indicate that a ``significant'' deployment event has completed. -/// A 'major' event will depend heavily on the context in which it -/// occurs. Major will include instance deployments/teardowns, -/// process spawns, etc. -#define DANCE_LOG_MAJOR_EVENT 6 -/// Used to inficate a ``minor'' deployment event has completed. -/// Minor events will usually change the state of a deployed instance, -/// e.g. lifecycle changes (passivation, configuration complete), -/// interceptor invocations, etc. -#define DANCE_LOG_MINOR_EVENT 7 -/// Used to trace significant actions within major/minor events. This -/// will usually include starts for major/minor events. -#define DANCE_LOG_EVENT_TRACE 8 -/// Used to display important configuration information that impacts -/// the deployment process. -#define DANCE_LOG_MAJOR_DEBUG_INFO 9 -/// The following two statements are used to closely trace the -/// execution of DAnCE code. If in doubt, a message should go into -/// these categories. The difference between a TRACE and a -/// DETAILED_TRACE will be largely a judgement call. These messages -/// should be emitted using DANCE_TRACE_LOG (X, Y). -#define DANCE_LOG_TRACE 10 -#define DANCE_LOG_DETAILED_TRACE 11 - -// By default tracing is turned off. -#if !defined (DANCE_NTRACE) -# define DANCE_NTRACE 1 -#endif /* DANCE_NTRACE */ - -#if (DANCE_NTRACE == 1) -# if !defined (ACE_NTRACE) -# define DANCE_TRACE(X) do {} while (0) -# define DANCE_ENABLE_TRACE() do {} while (0) -# define DANCE_DISABLE_TRACE() do {} while (0) -# else -# if (ACE_NTRACE == 0) -# error DANCE_TRACE cannot be disabled if ACE_TRACE is enabled -# else -# define DANCE_TRACE(X) do {} while (0) -# define DANCE_ENABLE_TRACE() do {} while (0) -# define DANCE_DISABLE_TRACE() do {} while (0) -# endif -# endif -#else -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define DANCE_TRACE(X) ACE_TRACE_IMPL (X) -# define DANCE_ENABLE_TRACE() ACE_Trace::start_tracing () -# define DANCE_DISABLE_TRACE() ACE_Trace::stop_tracing () -# undef DLINFO // Make log messages indent with tracing. -# define DLINFO ACE_TEXT("%I(%P|%t) [%M] - %T - ") -# include "ace/Trace.h" -#endif /* DANCE_NTRACE */ - -#if defined (DANCE_NLOGGING) -# define DANCE_ERROR(L, X) do {} while (0) -# define DANCE_DEBUG(L, X) do {} while (0) -# define DANCE_TRACE_LOG(L, X) do {} while (0) -#define DANCE_ERROR_RETURN(L, X, Y) return (Y) -#define DANCE_ERROR_BREAK(L, X) { break; } -#else -# if !defined (DANCE_ERROR) -# define DANCE_ERROR(L, X) \ - do { \ - if (DAnCE_debug_level >= L) \ - { \ - int const __ace_error = ACE_Log_Msg::last_error_adapter (); \ - ACE_Log_Category_TSS *ace___ = DAnCE_log_category.per_thr_obj (); \ - if (ace___ == 0) break; \ - ace___->conditional_set (__FILE__, __LINE__, -1, __ace_error); \ - ace___->log X; \ - } \ - } while (0) -# endif -# if !defined (DANCE_DEBUG) -# define DANCE_DEBUG(L, X) \ - do { \ - if (DAnCE_debug_level >= L) \ - { \ - int const __ace_error = ACE_Log_Msg::last_error_adapter (); \ - ACE_Log_Category_TSS *ace___ = DAnCE_log_category.per_thr_obj (); \ - if (ace___ == 0) break; \ - ace___->conditional_set (__FILE__, __LINE__, 0, __ace_error); \ - ace___->log X; \ - } \ - } while (0) -# endif -# if !defined (DANCE_TRACE_LOG) -# define DANCE_TRACE_LOG(L, X) \ - do { \ - if (DAnCE_debug_level >= L) \ - { \ - int const __ace_error = ACE_Log_Msg::last_error_adapter (); \ - ACE_Log_Category_TSS *ace___ = DAnCE_log_category.per_thr_obj (); \ - if (ace___ == 0) break; \ - ace___->conditional_set (__FILE__, __LINE__, 0, __ace_error); \ - ace___->log X; \ - } \ - } while (0) -# endif -# if !defined (DANCE_ERROR_RETURN) -# define DANCE_ERROR_RETURN(L, X, Y) \ - do { \ - if (DAnCE_debug_level >= L) \ - { \ - int const __ace_error = ACE_Log_Msg::last_error_adapter (); \ - ACE_Log_Category_TSS *ace___ = DAnCE_log_category.per_thr_obj (); \ - if (ace___ == 0) break; \ - ace___->conditional_set (__FILE__, __LINE__, Y, __ace_error); \ - ace___->log X; \ - return Y; \ - } \ - } while (0) -# endif -# if !defined (DANCE_ERROR_BREAK) -# define DANCE_ERROR_BREAK(L, X) { DANCE_ERROR (L, X); break; } -# endif -#endif - -#endif diff --git a/DAnCE/dance/Logger/Logger.mpc b/DAnCE/dance/Logger/Logger.mpc deleted file mode 100644 index a7131712a76..00000000000 --- a/DAnCE/dance/Logger/Logger.mpc +++ /dev/null @@ -1,19 +0,0 @@ -// -*- MPC -*- -project(DAnCE_Logger): install, dance_lib, taolib, acelib { - sharedname = DAnCE_Logger - dynamicflags += DANCE_LOGGER_BUILD_DLL - - Source_Files { - Logger_Service.cpp - Log_Macros.cpp - } - - Header_Files { - DAnCE_Logger_Export.h - } - - specific { - install_dir = dance/Logger - } - -} diff --git a/DAnCE/dance/Logger/Logger_Service.cpp b/DAnCE/dance/Logger/Logger_Service.cpp deleted file mode 100644 index dcfb060613d..00000000000 --- a/DAnCE/dance/Logger/Logger_Service.cpp +++ /dev/null @@ -1,190 +0,0 @@ -#include "Logger_Service.h" -#include "ace/Get_Opt.h" -#include "ace/Env_Value_T.h" -#include "ace/CORBA_macros.h" -#include "ace/Dynamic_Service.h" -#include "tao/SystemException.h" -#include "Log_Macros.h" -#include "ace/Service_Config.h" -#include "ace/Arg_Shifter.h" -#include "ace/Log_Msg_Backend.h" - -#if !defined (ACE_LACKS_IOSTREAM_TOTALLY) - -// FUZZ: disable check_for_streams_include -# include "ace/streams.h" -#endif /* !ACE_LACKS_IOSTREAM_TOTALLY */ - -namespace DAnCE -{ - Logger_Service::Logger_Service (void) - : filename_ (ACE_TEXT("")), - backend_ (ACE_TEXT ("")), - trace_ (false) - { - } - - int - Logger_Service::init (int argc, ACE_TCHAR * argv[]) - { - // Get prospective values from the environment first, those given on - // command line can override - ACE_Env_Value<int> log (ACE_TEXT("DANCE_LOG_LEVEL"), DAnCE_debug_level); - DAnCE_debug_level = log; - - ACE_Env_Value<int> trace (ACE_TEXT("DANCE_TRACE_ENABLE"), 0); - this->trace_ = (trace != 0); - - ACE_Env_Value<const ACE_TCHAR *> filename (ACE_TEXT("DANCE_LOG_FILE"), this->filename_.c_str ()); - this->filename_ = filename; - - ACE_Env_Value<const ACE_TCHAR *> backend (ACE_TEXT("DANCE_LOG_BACKEND"), this->backend_.c_str ()); - this->backend_ = backend; - - this->parse_args (argc, argv); - - if (this->trace_) - { - DANCE_ENABLE_TRACE (); - } - else - { - DANCE_DISABLE_TRACE (); - } - - if (this->filename_.length () > 0) - { -#if defined (ACE_LACKS_IOSTREAM_TOTALLY) - - FILE* output_stream = ACE_OS::fopen (this->filename_.c_str (), ACE_TEXT ("a")); - - ACE_LOG_MSG->msg_ostream (output_stream, 1); - -#else /* ! ACE_LACKS_IOSTREAM_TOTALLY */ - - ofstream* output_stream = 0; - - // - // note: we are allocating dynamic memory here....but - // I assume it will persist for the life of the program - // - - ACE_NEW_THROW_EX (output_stream, - ofstream (), - CORBA::NO_MEMORY ( - CORBA::SystemException::_tao_minor_code (0, - ENOMEM), - CORBA::COMPLETED_NO)); - - output_stream->open (ACE_TEXT_ALWAYS_CHAR (this->filename_.c_str ()), - ios::out | ios::app); - - if (!output_stream->bad ()) - { - ACE_LOG_MSG->msg_ostream (output_stream, 1); - } - -#endif /* ACE_LACKS_IOSTREAM_TOTALLY */ - - ACE_LOG_MSG->clr_flags (ACE_Log_Msg::STDERR | ACE_Log_Msg::LOGGER); - ACE_LOG_MSG->set_flags (ACE_Log_Msg::OSTREAM); - } - - if (this->backend_.length () > 0) - { - ACE_Log_Msg_Backend* logger_be = - ACE_Dynamic_Service<ACE_Log_Msg_Backend>::instance(this->backend_.c_str ()); - - if (logger_be == 0) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_EMERGENCY, DLINFO - ACE_TEXT ("Logger_Service::init - ") - ACE_TEXT ("Unable to load backend %s\n"), - this->backend_.c_str ())); - return -1; - } - else - { - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("Logger_Service::init - ") - ACE_TEXT ("Successfully loaded backend %s\n"), - this->backend_.c_str ())); - } - - ACE_Log_Msg::msg_backend (logger_be); - - ACE_LOG_MSG->clr_flags (ACE_Log_Msg::STDERR | ACE_Log_Msg::LOGGER); - ACE_LOG_MSG->set_flags (ACE_Log_Msg::CUSTOM); - } - - return 0; - } - - void - Logger_Service::parse_args (int argc, ACE_TCHAR **argv) - { - DANCE_TRACE ("Logger_Service::parse_args"); - - ACE_Arg_Shifter arg_shifter (argc, argv); - - while (arg_shifter.is_anything_left ()) - { - const ACE_TCHAR *current_arg = 0; - if (0 != (current_arg = - arg_shifter.get_the_parameter - (ACE_TEXT ("-DAnCELogLevel")))) - { - DAnCE_debug_level = ACE_OS::atoi (current_arg); - - arg_shifter.consume_arg (); - } - else if (0 == arg_shifter.cur_arg_strncasecmp - (ACE_TEXT ("-DAnCETraceEnable"))) - { - this->trace_ = true; - - arg_shifter.consume_arg (); - } - else if (0 != (current_arg = - arg_shifter.get_the_parameter - (ACE_TEXT ("-DAnCELogFile")))) - { - this->filename_ = current_arg; - - arg_shifter.consume_arg (); - } - else if (0 != (current_arg = - arg_shifter.get_the_parameter - (ACE_TEXT ("-DAnCELogBackend")))) - { - this->backend_ = current_arg; - - arg_shifter.consume_arg (); - } - else - { - // Can't interpret this argument. Move on to the next - // argument. Any arguments that don't match are ignored - // so that the caller can still use them. - arg_shifter.ignore_arg (); - } - } - } - - int - Logger_Service::Initializer (void) - { - return ACE_Service_Config::process_directive (ace_svc_desc_DANCE_LOGGER_SERVICE); - } -} // DAnCE - -ACE_STATIC_SVC_DEFINE (DANCE_LOGGER_SERVICE, - ACE_TEXT ("DAnCE_Logger"), - ACE_SVC_OBJ_T, - &ACE_SVC_NAME (DANCE_LOGGER_SERVICE), - ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, - 0) -ACE_FACTORY_DEFINE (DAnCE_Logger, DANCE_LOGGER_SERVICE) - diff --git a/DAnCE/dance/Logger/Logger_Service.h b/DAnCE/dance/Logger/Logger_Service.h deleted file mode 100644 index ba3e1c5ea59..00000000000 --- a/DAnCE/dance/Logger/Logger_Service.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef LOGGER_SERVICE_H_ -#define LOGGER_SERVICE_H_ - -#include "dance/Logger/DAnCE_Logger_Export.h" -#include "ace/Service_Object.h" - -namespace DAnCE -{ - class DAnCE_Logger_Export Logger_Service : public ACE_Service_Object - { - public: - Logger_Service (void); - virtual int init (int argc, ACE_TCHAR * argv[]); - - static int Initializer (void); - private: - void parse_args (int argc, ACE_TCHAR **argv); - - ACE_TString filename_; - ACE_TString backend_; - bool trace_; - }; -} - -static int TAO_Requires_DAnCE_Logger_Service_Initializer = - DAnCE::Logger_Service::Initializer (); - -typedef DAnCE::Logger_Service DANCE_LOGGER_SERVICE; - -ACE_STATIC_SVC_DECLARE (DANCE_LOGGER_SERVICE) -ACE_FACTORY_DECLARE (DAnCE_Logger, DANCE_LOGGER_SERVICE) - -#endif /*LOGGER_SERVICE_H_*/ diff --git a/DAnCE/dance/NodeApplication/NodeApplication.mpc b/DAnCE/dance/NodeApplication/NodeApplication.mpc deleted file mode 100644 index 48bd511a3ad..00000000000 --- a/DAnCE/dance/NodeApplication/NodeApplication.mpc +++ /dev/null @@ -1,20 +0,0 @@ -// -*- MPC -*- -project(DAnCE_NodeApplication): install, dance_lib, \ - dance_nodeapplication_skel, dance_deployment_scheduler, \ - dance_logger, iortable, naming, dance_locality_handler, \ - gen_ostream, avoids_ace_for_tao, dance_applicationmanager_stub { - sharedname = DAnCE_NodeApplication - dynamicflags += NODEAPPLICATION_BUILD_DLL - - Source_Files { - NodeApplication_Impl.cpp - } - - Header_Files { - NodeApplication_Impl.h - } - - specific { - install_dir = dance/NodeApplication - } -} diff --git a/DAnCE/dance/NodeApplication/NodeApplication_Export.h b/DAnCE/dance/NodeApplication/NodeApplication_Export.h deleted file mode 100644 index cae3b83c5ea..00000000000 --- a/DAnCE/dance/NodeApplication/NodeApplication_Export.h +++ /dev/null @@ -1,57 +0,0 @@ - -// -*- C++ -*- -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl NodeApplication -// ------------------------------ -#ifndef NODEAPPLICATION_EXPORT_H -#define NODEAPPLICATION_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (NODEAPPLICATION_HAS_DLL) -# define NODEAPPLICATION_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && NODEAPPLICATION_HAS_DLL */ - -#if !defined (NODEAPPLICATION_HAS_DLL) -# define NODEAPPLICATION_HAS_DLL 1 -#endif /* ! NODEAPPLICATION_HAS_DLL */ - -#if defined (NODEAPPLICATION_HAS_DLL) && (NODEAPPLICATION_HAS_DLL == 1) -# if defined (NODEAPPLICATION_BUILD_DLL) -# define NodeApplication_Export ACE_Proper_Export_Flag -# define NODEAPPLICATION_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define NODEAPPLICATION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* NODEAPPLICATION_BUILD_DLL */ -# define NodeApplication_Export ACE_Proper_Import_Flag -# define NODEAPPLICATION_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define NODEAPPLICATION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* NODEAPPLICATION_BUILD_DLL */ -#else /* NODEAPPLICATION_HAS_DLL == 1 */ -# define NodeApplication_Export -# define NODEAPPLICATION_SINGLETON_DECLARATION(T) -# define NODEAPPLICATION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* NODEAPPLICATION_HAS_DLL == 1 */ - -// Set NODEAPPLICATION_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (NODEAPPLICATION_NTRACE) -# if (ACE_NTRACE == 1) -# define NODEAPPLICATION_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define NODEAPPLICATION_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !NODEAPPLICATION_NTRACE */ - -#if (NODEAPPLICATION_NTRACE == 1) -# define NODEAPPLICATION_TRACE(X) -#else /* (NODEAPPLICATION_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define NODEAPPLICATION_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (NODEAPPLICATION_NTRACE == 1) */ - -#endif /* NODEAPPLICATION_EXPORT_H */ - -// End of auto generated file. diff --git a/DAnCE/dance/NodeApplication/NodeApplication_Impl.cpp b/DAnCE/dance/NodeApplication/NodeApplication_Impl.cpp deleted file mode 100644 index d0782d973a3..00000000000 --- a/DAnCE/dance/NodeApplication/NodeApplication_Impl.cpp +++ /dev/null @@ -1,538 +0,0 @@ -#include "NodeApplication_Impl.h" - -#include "ace/OS_Memory.h" - -#include "ace/iosfwd.h" -#include "tao/AnyTypeCode/Any.h" -#include "tao/Object.h" -#include "tao/ORB.h" -#include "tao/AnyTypeCode/TypeCode.h" -#include "dance/Logger/Log_Macros.h" -#include "dance/Deployment/Deployment_BaseC.h" -#include "dance/Deployment/Deployment_ApplicationC.h" -#include "dance/Deployment/Deployment_PlanErrorC.h" -#include "dance/Deployment/Deployment_ApplicationManagerC.h" -#include "dance/DAnCE_Utility.h" -#include "dance/DAnCE_PropertiesC.h" -#include "dance/DAnCE_LocalityManagerC.h" -#include "dance/LocalityManager/Scheduler/Plugin_Manager.h" -#include "dance/LocalityManager/Scheduler/Deployment_Completion.h" -#include "dance/LocalityManager/Scheduler/Events/Install.h" -#include "dance/LocalityManager/Scheduler/Events/Remove.h" -#include "Split_Plan/Locality_Splitter.h" -#include "Split_Plan/Split_Plan.h" - -#include <string> - -#ifdef GEN_OSTREAM_OPS -#include <iostream> -#include <sstream> -#endif /* GEN_OSTREAM_OPS */ - -using namespace DAnCE; -using namespace DAnCE::Utility; - -NodeApplication_Impl::NodeApplication_Impl (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - DAnCE::ArtifactInstallation_ptr installer, - const ACE_CString& node_name, - const DAnCE::Utility::PROPERTY_MAP &properties) - : orb_ (CORBA::ORB::_duplicate (orb)), - poa_ (PortableServer::POA::_duplicate (poa)), - installer_ (DAnCE::ArtifactInstallation::_duplicate (installer)), - node_name_ (node_name), - scheduler_ (), - spawn_delay_ (30) -{ - DANCE_TRACE ("NodeApplication_Impl::NodeApplication_Impl"); - - Utility::get_property_value (DAnCE::LOCALITY_TIMEOUT, - properties, this->spawn_delay_); - - ::Deployment::Properties prop; - - // Spawn thread pool - // @Todo: We can probably move this up into the NodeManager and - // share the thread pool among several node applications. - this->scheduler_.activate_scheduler (0); -} - -NodeApplication_Impl::~NodeApplication_Impl() -{ - DANCE_TRACE( "NodeApplication_Impl::~NodeApplication_Impl()"); - this->scheduler_.terminate_scheduler (); -} - -void -NodeApplication_Impl::prepare_instances (const LocalitySplitter::TSubPlans& plans) -{ - DANCE_TRACE ("NodeApplication_Impl::prepare_instances"); - - CORBA::ULong plan (0); - std::list < Event_Future > prepared_instances; - Deployment_Completion completion (this->scheduler_); - - // for each sub plan - LocalitySplitter::TSubPlanConstIterator plans_end (plans, 1); - for (LocalitySplitter::TSubPlanConstIterator i (plans); - i != plans_end; - ++i) - { - const ::Deployment::DeploymentPlan &sub_plan = - (*i).int_id_; - - const LocalitySplitter::TSubPlanKey &sub_plan_key = - (*i).ext_id_; - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("NodeApplication_Impl::prepare_instances - ") - ACE_TEXT ("Considering sub-plan %u:%C with %u instances\n"), - plan, - sub_plan.UUID.in (), - sub_plan.instance.length () - )); - - // the locality splitter makes sure every sub plan contains a Locality Manager - // instance (creating default if necessary) and identifies it in the key - - CORBA::ULong loc_manager_instance = sub_plan_key.locality_manager_instance (); - const ::Deployment::InstanceDeploymentDescription &lm_idd - = sub_plan.instance[loc_manager_instance]; - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT ("NodeApplication_Impl::prepare_instances - ") - ACE_TEXT ("Found Locality Manager instance %u:%C, deploying\n"), - loc_manager_instance, - lm_idd.name.in () - )); - - this->sub_plans_ [ lm_idd.name.in () ] = SUB_PLAN (loc_manager_instance, - sub_plan); - - Install_Instance *event (0); - Event_Future result; - completion.accept (result); - - ACE_NEW_THROW_EX (event, - Install_Instance (this->sub_plans_ [ lm_idd.name.in () ].second, - loc_manager_instance, - DAnCE::DANCE_LOCALITYMANAGER, - result - ), - CORBA::NO_MEMORY ()); - - - prepared_instances.push_back (result); - this->scheduler_.schedule_event (event); - ++plan; - } - - ACE_Time_Value tv (ACE_OS::gettimeofday () + ACE_Time_Value (this->spawn_delay_)); - - if (!completion.wait_on_completion (&tv)) - { - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("NodeApplication_Impl::prepare_instances - ") - ACE_TEXT("Timed out while waiting on completion of scheduler\n"))); - } - - tv = ACE_Time_Value::zero; - - plan = 0; - for (std::list < Event_Future >::iterator i = prepared_instances.begin (); - i != prepared_instances.end (); - ++i) - { - Event_Result event; - if (i->get (event, &tv) != 0) - { - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("NodeApplication_Impl::prepare_instances - ") - ACE_TEXT("Failed to get future value for current instance\n"))); - continue; - } - - if (event.exception_) - { - DAnCE::Utility::throw_exception_from_any (event.contents_.in ()); - } - - ::DAnCE::LocalityManager_var lm_ref; - if (event.contents_.ptr () && - event.contents_.in ().impl () && - (event.contents_.in () >>= lm_ref) && - !CORBA::is_nil (lm_ref.in ())) - { - this->localities_[event.id_] = ::DAnCE::LocalityManager::_duplicate (lm_ref); - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_INFO, DLINFO - ACE_TEXT("NodeApplication_Impl::prepare_instances - ") - ACE_TEXT("Successfully started Locality %C\n"), - event.id_.c_str ())); - } - else - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("NodeApplication_Impl::prepare_instances - ") - ACE_TEXT("Unable to resolve LocalityManager object reference\n"))); - throw ::Deployment::StartError (event.id_.c_str (), - "Unable to resolve LocalityManager object ref\n"); - } - - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT ("NodeApplication_Impl::prepare_instances - ") - ACE_TEXT ("Invoking preparePlan on locality %C\n"), - event.id_.c_str ())); - - - this->prepare_instance (event.id_.c_str (), - (this->sub_plans_[event.id_].second)); - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT ("NodeApplication_Impl::prepare_instances - ") - ACE_TEXT ("Successfully executed preparePlan on locality %C\n"), - event.id_.c_str ())); - } -} - -void -NodeApplication_Impl::prepare_instance (const char *name, - const Deployment::DeploymentPlan &plan) -{ - DANCE_TRACE ("NodeApplication_Impl::prepare_instance"); - - ::Deployment::ApplicationManager_var app; - - try - { - app = this->localities_[name]->preparePlan (plan, 0); - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT ("NodeApplication_Impl::prepare_instance - ") - ACE_TEXT ("Locality <%C> successfully prepared.\n"), - name)); - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO - ACE_TEXT ("NodeApplication_Impl::prepare_instance - ") - ACE_TEXT ("Caught unexpected CORBA exception while invoking preparePlan %C\n"), - ex._info ().c_str ())); - } - // @@ TODO: Ouch! We're swallowing exceptions here! - - if (CORBA::is_nil (app.in ())) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO - ACE_TEXT ("NodeApplication_Impl::prepare_instance - ") - ACE_TEXT ("Error: Didn't get a valid reference back from LM preparePlan ") - ACE_TEXT ("for locality %C\n"), - name)); - - // @@ TODO: Ouch! What do we need to do here?!? - } - - // For the time being, we don't need to cache this reference. - // it's the same as the reference we used to invoke preparePlan. -} - -void -NodeApplication_Impl::start_launch_instances (const Deployment::Properties &prop, - Deployment::Connections_out providedReference) -{ - DANCE_TRACE ("NodeApplication_Impl::start_launch_instances"); - Deployment::Connections *tmp (0); - - ACE_NEW_THROW_EX (tmp, - Deployment::Connections (), - CORBA::NO_MEMORY ()); - - providedReference = tmp; - CORBA::ULong retval_pos (0); - - for (LOCALITY_MAP::const_iterator i = this->localities_.begin (); - i != this->localities_.end (); ++i) - { - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_INFO, DLINFO - ACE_TEXT ("NodeApplication_Impl::start_launch_instances - ") - ACE_TEXT ("StartLaunching locality <%C>\n"), - i->first.c_str ())); - - try - { - Deployment::Connections_var instance_references; - i->second->startLaunch (prop, - instance_references.out ()); - - - providedReference->length (retval_pos + instance_references->length ()); - - for (CORBA::ULong ir_pos = 0; - ir_pos < instance_references->length (); - ++ir_pos) - { - providedReference[retval_pos++] = instance_references[ir_pos]; - } - } - catch (const Deployment::PlanError &ex) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("NodeApplication_Impl::start_launch_instances - ") - ACE_TEXT ("Caught PlanError Exception %C:%C\n"), - ex.name.in (), - ex.reason.in ())); - throw; - } - catch (const Deployment::StartError &ex) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("NodeApplication_Impl::start_launch_instances - ") - ACE_TEXT ("Caught StartError Exception %C:%C\n"), - ex.name.in (), - ex.reason.in ())); - throw; - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("NodeApplication_Impl::start_launch_instances - ") - ACE_TEXT ("Caught CORBA Exception %C\n"), - ex._info ().c_str ())); - throw; - } - } -} - -void -NodeApplication_Impl::finishLaunch (const ::Deployment::Connections & providedReference, - ::CORBA::Boolean start) -{ - DANCE_TRACE ("NodeApplication_Impl::finishLaunch"); - - - for (LOCALITY_MAP::const_iterator i = this->localities_.begin (); - i != this->localities_.end (); ++i) - { - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_INFO, DLINFO - ACE_TEXT ("NodeApplication_Impl::finish_launch_instances - ") - ACE_TEXT ("FinishLaunching locality <%C>\n"), - i->first.c_str ())); - - try - { - i->second->finishLaunch (providedReference, start); - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("NodeApplication_Impl::finish_launch_instances - ") - ACE_TEXT ("Caught CORBA Exception %C\n"), - ex._info ().c_str ())); - throw; - } - } -} - -void -NodeApplication_Impl::start () -{ - DANCE_TRACE( "NodeApplication_Impl::start"); - - for (LOCALITY_MAP::const_iterator i = this->localities_.begin (); - i != this->localities_.end (); ++i) - { - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_INFO, DLINFO - ACE_TEXT ("NodeApplication_Impl::start - ") - ACE_TEXT ("Starting locality <%C>\n"), - i->first.c_str ())); - - try - { - i->second->start (); - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("NodeApplication_Impl::start - ") - ACE_TEXT ("Caught CORBA Exception %C\n"), - ex._info ().c_str ())); - throw; - } - } -} - -void -NodeApplication_Impl::remove_instances (void) -{ - DANCE_TRACE ("NodeApplication_Impl::remove_instances"); - - ::Deployment::StopError final_exception; - bool flag (false); - - std::list < Event_Future > removed_instances; - - Deployment_Completion completion (this->scheduler_); - - for (LOCALITY_MAP::iterator i = this->localities_.begin (); - i != this->localities_.end (); ++i) - { - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_INFO, DLINFO - ACE_TEXT ("NodeApplication_Impl::remove_instances - ") - ACE_TEXT ("Removing locality <%C>\n"), - i->first.c_str ())); - - try - { - CORBA::Any ref; - ref <<= ::DAnCE::LocalityManager::_duplicate (i->second); - - i->second->destroyApplication (0); - - Remove_Instance *event (0); - Event_Future result; - - PLAN_MAP::iterator sub_plan; - - if ((sub_plan = this->sub_plans_.find (i->first)) != - this->sub_plans_.end ()) - { - ACE_NEW (event, - Remove_Instance (sub_plan->second.second, - sub_plan->second.first, - ref, - DANCE_LOCALITYMANAGER, - result)); - - removed_instances.push_back (result); - completion.accept (result); - - this->scheduler_.schedule_event (event); - } - else - { - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("NodeApplication_Impl::remove_instances - ") - ACE_TEXT ("Unable to find sub plan for instance <%C>\n"), - i->first.c_str ())); - } - } - catch (::Deployment::StopError &ex) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("NodeApplication_Impl::remove_instances - ") - ACE_TEXT ("Caught StopError final_exception %C, %C\n"), - ex.name.in (), - ex.reason.in ())); - Utility::test_and_set_exception (flag, - final_exception, - ex.name.in (), - ex.reason.in ()); - - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO - ACE_TEXT ("NodeApplication_Impl::remove_instances - ") - ACE_TEXT ("Caught CORBA Final_Exception %C\n"), - ex._info ().c_str ())); - Utility::test_and_set_exception (flag, - final_exception, - "Unknown CORBA Final_Exception", - ex._info ().c_str ()); - } - } - - ACE_Time_Value tv (ACE_OS::gettimeofday () + ACE_Time_Value (this->spawn_delay_)); - - if (!completion.wait_on_completion (&tv)) - { - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, (LM_ERROR, DLINFO - ACE_TEXT("NodeApplication_Impl::remove_instances - ") - ACE_TEXT("Timed out while waiting on completion of scheduler\n"))); - } - - tv = ACE_Time_Value::zero; - - for (std::list < Event_Future >::iterator i = removed_instances.begin (); - i != removed_instances.end (); - ++i) - { - try - { - Event_Result event; - - if (i->get (event, - &tv) != 0) - { - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, (LM_ERROR, DLINFO - ACE_TEXT ("NodeApplication_Impl::remove_instances - ") - ACE_TEXT ("Failed to get future value for current instance\n"))); - continue; - } - - using DAnCE::Utility::extract_and_throw_exception; - - if (event.exception_ && - !(extract_and_throw_exception< ::Deployment::StopError > (event.contents_.in ()))) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("NodeApplication_Impl::remove_instances - ") - ACE_TEXT ("Unexpected exception thrown during removal of ") - ACE_TEXT ("instance <%C>\n"), - event.id_.c_str ())); - - throw ::Deployment::StopError (event.id_.c_str (), - "Unknown exception thrown from remove_instance\n"); - } - - } - catch (::Deployment::StopError &ex) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("NodeApplication_Impl::remove_instances - ") - ACE_TEXT ("Caught StopError final_exception %C, %C\n"), - ex.name.in (), - ex.reason.in ())); - Utility::test_and_set_exception (flag, - final_exception, - ex.name.in (), - ex.reason.in ()); - - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("NodeApplication_Impl::remove_instances - ") - ACE_TEXT ("Caught CORBA Final_Exception %C\n"), - ex._info ().c_str ())); - Utility::test_and_set_exception (flag, - final_exception, - "Unknown CORBA Final_Exception", - ex._info ().c_str ()); - } - - } - if (flag) - throw final_exception; -} diff --git a/DAnCE/dance/NodeApplication/NodeApplication_Impl.h b/DAnCE/dance/NodeApplication/NodeApplication_Impl.h deleted file mode 100644 index 4bf0226be08..00000000000 --- a/DAnCE/dance/NodeApplication/NodeApplication_Impl.h +++ /dev/null @@ -1,95 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file NodeApplication_Impl.h - * - * @brief Implementation of Deployment::NodeApplication - * - * @author Erwin Gottlieb <eg@prismtech.com> - * @author William R. Otte <wotte@dre.vanderbilt.edu> - */ -//============================================================================= - - -#ifndef NODEAPPLICATION_IMPL_H_ -#define NODEAPPLICATION_IMPL_H_ - -#include "NodeApplication_Export.h" - -#include "ace/Containers_T.h" -#include "tao/AnyTypeCode/AnyTypeCode_methods.h" -#include "dance/Deployment/Deployment_NodeApplicationS.h" -#include "dance/Deployment/Deployment_DeploymentPlanC.h" -#include "dance/Deployment/DeploymentC.h" -#include "dance/DAnCE_Utility.h" -#include "dance/DAnCE_LocalityManagerC.h" -#include "dance/LocalityManager/Scheduler/Deployment_Scheduler.h" -#include "dance/DAnCE_ArtifactInstallationC.h" -#include "Split_Plan/Locality_Splitter.h" -#include "Split_Plan/Split_Plan.h" - -#include <map> -#include <vector> - -using namespace DAnCE::Utility; - -namespace DAnCE -{ - - typedef DAnCE::Split_Plan < DAnCE::Locality_Splitter > LocalitySplitter; - - class NodeManager_Impl; - - class NodeApplication_Export NodeApplication_Impl : - public virtual POA_Deployment::NodeApplication - { - public: - NodeApplication_Impl (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - DAnCE::ArtifactInstallation_ptr installer, - const ACE_CString& node_name, - const PROPERTY_MAP &properties); - - virtual ~NodeApplication_Impl(); - - virtual void finishLaunch (const ::Deployment::Connections & providedReference, - ::CORBA::Boolean start); - - virtual void start (void); - - void prepare_instances (const LocalitySplitter::TSubPlans &plans); - - void start_launch_instances (const Deployment::Properties &prop, - Deployment::Connections_out providedReference); - - void remove_instances (void); - - typedef std::map <std::string, ::DAnCE::LocalityManager_var> - LOCALITY_MAP; - - typedef std::pair <CORBA::ULong, ::Deployment::DeploymentPlan> SUB_PLAN; - typedef std::map <std::string, SUB_PLAN> PLAN_MAP; - - protected: - void prepare_instance (const char *name, - const ::Deployment::DeploymentPlan &plan); - - CORBA::ORB_var orb_; - - PortableServer::POA_var poa_; - - DAnCE::ArtifactInstallation_var installer_; - - ACE_CString node_name_; - - LOCALITY_MAP localities_; - - DAnCE::Deployment_Scheduler scheduler_; - - PLAN_MAP sub_plans_; - - CORBA::ULong spawn_delay_; - }; -} -#endif /*NODEAPPLICATION_IMPL_H_*/ diff --git a/DAnCE/dance/NodeApplicationManager/NodeApplicationManager.mpc b/DAnCE/dance/NodeApplicationManager/NodeApplicationManager.mpc deleted file mode 100644 index 907ba156020..00000000000 --- a/DAnCE/dance/NodeApplicationManager/NodeApplicationManager.mpc +++ /dev/null @@ -1,15 +0,0 @@ -// -*- MPC -*- -project (DAnCE_NodeApplicationManager) : install, dance_lib, naming, \ - dance_nodeapplicationmanager_skel,dynamicinterface, \ - dance_nodeapplication, dance_stub, avoids_ace_for_tao { - sharedname = DAnCE_NodeApplicationManager - dynamicflags += NODEAPPLICATIONMANAGER_BUILD_DLL - - Source_Files { - NodeApplicationManager_Impl.cpp - } - - specific { - install_dir = dance/NodeApplicationManager - } -} diff --git a/DAnCE/dance/NodeApplicationManager/NodeApplicationManager_Export.h b/DAnCE/dance/NodeApplicationManager/NodeApplicationManager_Export.h deleted file mode 100644 index 7e77929daca..00000000000 --- a/DAnCE/dance/NodeApplicationManager/NodeApplicationManager_Export.h +++ /dev/null @@ -1,57 +0,0 @@ - -// -*- C++ -*- -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl NodeApplicationManager -// ------------------------------ -#ifndef NODEAPPLICATIONMANAGER_EXPORT_H -#define NODEAPPLICATIONMANAGER_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (NODEAPPLICATIONMANAGER_HAS_DLL) -# define NODEAPPLICATIONMANAGER_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && NODEAPPLICATIONMANAGER_HAS_DLL */ - -#if !defined (NODEAPPLICATIONMANAGER_HAS_DLL) -# define NODEAPPLICATIONMANAGER_HAS_DLL 1 -#endif /* ! NODEAPPLICATIONMANAGER_HAS_DLL */ - -#if defined (NODEAPPLICATIONMANAGER_HAS_DLL) && (NODEAPPLICATIONMANAGER_HAS_DLL == 1) -# if defined (NODEAPPLICATIONMANAGER_BUILD_DLL) -# define NodeApplicationManager_Export ACE_Proper_Export_Flag -# define NODEAPPLICATIONMANAGER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define NODEAPPLICATIONMANAGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* NODEAPPLICATIONMANAGER_BUILD_DLL */ -# define NodeApplicationManager_Export ACE_Proper_Import_Flag -# define NODEAPPLICATIONMANAGER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define NODEAPPLICATIONMANAGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* NODEAPPLICATIONMANAGER_BUILD_DLL */ -#else /* NODEAPPLICATIONMANAGER_HAS_DLL == 1 */ -# define NodeApplicationManager_Export -# define NODEAPPLICATIONMANAGER_SINGLETON_DECLARATION(T) -# define NODEAPPLICATIONMANAGER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* NODEAPPLICATIONMANAGER_HAS_DLL == 1 */ - -// Set NODEAPPLICATIONMANAGER_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (NODEAPPLICATIONMANAGER_NTRACE) -# if (ACE_NTRACE == 1) -# define NODEAPPLICATIONMANAGER_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define NODEAPPLICATIONMANAGER_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !NODEAPPLICATIONMANAGER_NTRACE */ - -#if (NODEAPPLICATIONMANAGER_NTRACE == 1) -# define NODEAPPLICATIONMANAGER_TRACE(X) -#else /* (NODEAPPLICATIONMANAGER_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define NODEAPPLICATIONMANAGER_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (NODEAPPLICATIONMANAGER_NTRACE == 1) */ - -#endif /* NODEAPPLICATIONMANAGER_EXPORT_H */ - -// End of auto generated file. diff --git a/DAnCE/dance/NodeApplicationManager/NodeApplicationManager_Impl.cpp b/DAnCE/dance/NodeApplicationManager/NodeApplicationManager_Impl.cpp deleted file mode 100644 index e162b1abf8b..00000000000 --- a/DAnCE/dance/NodeApplicationManager/NodeApplicationManager_Impl.cpp +++ /dev/null @@ -1,398 +0,0 @@ - -#include "ace/iosfwd.h" -#include "dance/Logger/Log_Macros.h" - -#include "NodeApplicationManager_Impl.h" -#include "dance/NodeApplication/NodeApplication_Impl.h" -#include "dance/DAnCE_PropertiesC.h" -#include "dance/DAnCE_Utility.h" -#include "ace/Unbounded_Set.h" -#include "tao/ORB.h" -#include "tao/Object.h" - -using namespace DAnCE; -using namespace DAnCE::Utility; - -NodeApplicationManager_Impl::NodeApplicationManager_Impl (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - DAnCE::ArtifactInstallation_ptr installer, - const ACE_CString& node_name, - const PROPERTY_MAP &properties) - : orb_ (CORBA::ORB::_duplicate (orb)), - poa_ (PortableServer::POA::_duplicate (poa)), - installer_ (DAnCE::ArtifactInstallation::_duplicate (installer)), - application_ (0), - node_name_ (node_name), - properties_ () -{ - DANCE_TRACE ("NodeApplicationManager_Impl::NodeApplicationManager_Impl"); - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, (LM_DEBUG, DLINFO - ACE_TEXT(" NodeApplicationManager_Impl::NodeApplicationManager_Impl - ") - ACE_TEXT("Initializing for node '%C' starting...\n"), - node_name.c_str())); - - PROPERTY_MAP::const_iterator i = properties.begin (); - while (!i.done ()) - { - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT("NodeApplicationManager_Impl::NodeApplicationManager_Impl - ") - ACE_TEXT("Binding value for property %C\n"), i->key ().c_str ())); - this->properties_.bind (i->key (), i->item ()); - i.advance (); - } - - const ACE_TCHAR *ior = 0; - - if (get_property_value (DAnCE::INSTANCE_NC, this->properties_, ior) || - get_property_value (DAnCE::DOMAIN_NC, this->properties_, ior)) - { - try - { - CORBA::Object_var obj = this->orb_->string_to_object (ior); - this->instance_nc_ = CosNaming::NamingContext::_narrow (obj); - } - catch (const CORBA::Exception &e) - { - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("NodeApplicationManager_Impl::NodeApplicationManager_Impl - ") - ACE_TEXT("Unable to resolve the instance naming context:%C\n"), - e._info ().c_str ())); - } - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT("NodeApplicationManager_Impl::NodeApplicationManager_Impl - ") - ACE_TEXT("Successfully resolved the instance naming context.\n"))); - } - else DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT("NodeApplicationManager_Impl::NodeApplicationManager_Impl - ") - ACE_TEXT("No instance NC was provided\n"))); -} - -NodeApplicationManager_Impl::~NodeApplicationManager_Impl() -{ - DANCE_TRACE ("NodeApplicationManager_Impl::~NodeApplicationManager_Impl"); - - try - { - // initialize installer - this->installer_->initialize (); - - // install artifacts for each sub plan and update path and libpath - // properties for the locality manager instance of each sub plan - // also pass the installer reference in a property - for (LocalitySplitter::TSubPlanIterator itplan = this->split_plan_.plans ().begin (); - itplan != this->split_plan_.plans ().end (); - ++itplan) - { - // remove all artifacts for this sub plan - this->installer_->remove_all ((*itplan).int_id_.UUID. in ()); - } - - // cleanup installer resources - this->installer_->clear (); - - if (this->application_ != 0) - { - CORBA::Object_var app = - this->poa_->servant_to_reference (this->application_); - PortableServer::ObjectId_var id = this->poa_->reference_to_id (app); - this->poa_->deactivate_object (id); - - delete this->application_; - this->application_ = 0; - } - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("NodeApplicationManager_Impl::~NodeApplicationManager_Impl - ") - ACE_TEXT("Caught exception in NodeApplicationManager destructor\n"))); - } -} - -void -NodeApplicationManager_Impl::preparePlan (const Deployment::DeploymentPlan& plan) -{ - DANCE_TRACE ("NodeApplicationManager_Impl::preparePlan"); - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_TRACE, DLINFO - ACE_TEXT("NodeApplicationManager_impl::preparePlan - ") - ACE_TEXT("Performing locality split on plan %C.\n"), - plan.UUID.in ())); - - this->split_plan_.split_plan (plan); - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("NodeApplicationManager_impl::preparePlan - ") - ACE_TEXT("Plan %C successfully split into %u localities.\n"), - plan.UUID.in (), - this->split_plan_.plans ().current_size ())); - - // initialize installer - this->installer_->initialize (); - - // install artifacts for each sub plan and update path and libpath - // properties for the locality manager instance of each sub plan - // also pass the installer reference in a property - for (LocalitySplitter::TSubPlanIterator itplan = this->split_plan_.plans ().begin (); - itplan != this->split_plan_.plans ().end (); - ++itplan) - { - ACE_Unbounded_Set<ACE_CString> artifact_paths; - - ::Deployment::DeploymentPlan &sub_plan = (*itplan).int_id_; - LocalitySplitter::TSubPlanKey &sub_plan_key = (*itplan).ext_id_; - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_TRACE, DLINFO - ACE_TEXT("NodeApplicationManager_impl::preparePlan - ") - ACE_TEXT("Installing %u artifacts for locality %C.\n"), - sub_plan.artifact.length (), - sub_plan.UUID.in ())); - - // install artifacts - for (CORBA::ULong i=0; - i < sub_plan.artifact.length (); - ++i) - { - this->installer_->install(sub_plan.UUID.in (), - sub_plan.artifact[i]); - - CORBA::String_var location = - this->installer_->get_artifact_location (sub_plan.UUID.in (), - sub_plan.artifact[i].name.in ()); - - // modify artifact descriptor location field to reflect the installed - // artifact's location - CORBA::ULong loc_last = sub_plan.artifact[i].location.length (); - sub_plan.artifact[i].location.length (loc_last + 1); - for (CORBA::ULong iloc = loc_last; - iloc > 0; - --iloc) - { - // shift all locations 1 position to the back to make room for the installed - // location - sub_plan.artifact[i].location[iloc] = sub_plan.artifact[i].location[iloc - 1]; - } - // store installed location as first in list - sub_plan.artifact[i].location[0] = location._retn (); - - // collect all unique paths - ACE_CString path (sub_plan.artifact[i].location[0].in (), - 0, false); // avoid copying - ACE_CString::size_type pos = path.rfind (ACE_DIRECTORY_SEPARATOR_CHAR_A); - if (pos != ACE_CString::npos) - { - artifact_paths.insert (path.substr (0, pos>0 ? pos : 1)); - } - } - - // get locality manager deployment descriptors - ::Deployment::InstanceDeploymentDescription& lm_idd = - sub_plan.instance[sub_plan_key.locality_manager_instance ()]; - ::Deployment::MonolithicDeploymentDescription& lm_mdd = - sub_plan.implementation[lm_idd.implementationRef]; - - // update path and libpath properties of sub plan locality manager - if (artifact_paths.size () > 0) - { - ACE_CString search_path; - for (ACE_Unbounded_Set<ACE_CString>::iterator it = artifact_paths.begin (); - it != artifact_paths.end (); - ++it) - { - if (!search_path.empty ()) - search_path += ACE_TEXT_ALWAYS_CHAR (ACE_LD_SEARCH_PATH_SEPARATOR_STR); - search_path += *it; - } - - // update PATH - ACE_CString new_path; - const char* prop_val = 0; - if (DAnCE::Utility::get_property_value (DAnCE::DANCE_LM_PATH, - lm_mdd.execParameter, - prop_val) && prop_val != 0) - { - new_path += prop_val; - new_path += ACE_TEXT_ALWAYS_CHAR (ACE_LD_SEARCH_PATH_SEPARATOR_STR); - new_path += search_path; - } - else - { - new_path.set (search_path.c_str (), false); // avoid copying - } - DAnCE::Utility::update_property_value (DAnCE::DANCE_LM_PATH, - lm_mdd.execParameter, - new_path.c_str ()); - - // On windows these two search paths are the same -#if !defined (ACE_WIN32) - // update LIBPATH - new_path.clear (); - prop_val = 0; - if (DAnCE::Utility::get_property_value (DAnCE::DANCE_LM_LIBPATH, - lm_mdd.execParameter, - prop_val) && prop_val != 0) - { - new_path += prop_val; - new_path += ACE_TEXT_ALWAYS_CHAR (ACE_LD_SEARCH_PATH_SEPARATOR_STR); - new_path += search_path; - } - else - { - new_path.set (search_path.c_str (), false); // avoid copying - } - DAnCE::Utility::update_property_value (DAnCE::DANCE_LM_LIBPATH, - lm_mdd.execParameter, - new_path.c_str ()); -#endif - } - - const char *config_file; - - if (DAnCE::Utility::get_property_value (DAnCE::DANCE_LM_CONFIGFILE, - this->properties_, - config_file)) - { - DAnCE::Utility::update_property_value<const char *> (DAnCE::DANCE_LM_CONFIGFILE, - lm_idd.configProperty, - config_file); - } - - - DAnCE::Utility::update_property_value<CosNaming::NamingContext_ptr> ( - DAnCE::LOCALITY_NAMINGCONTEXT, - lm_idd.configProperty, - this->instance_nc_. in ()); - - // pass installer reference as an execParameter property - DAnCE::Utility::update_property_value<DAnCE::ArtifactInstallation_ptr> ( - DAnCE::DANCE_LM_INSTALLER, - lm_mdd.execParameter, - this->installer_.in ()); - } - - // cleanup installer resources - // (does *not* cleanup install registry; just signals end of install actions) - this->installer_->clear (); - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("NodeApplicationManager_impl::preparePlan - ") - ACE_TEXT("Finished preparing plan %C.\n"), - plan.UUID.in ())); -} - -Deployment::Application_ptr -NodeApplicationManager_Impl::startLaunch (const Deployment::Properties &prop, - Deployment::Connections_out providedReference) -{ - DANCE_TRACE ("NodeApplicationManager_Impl::startLaunch"); - - // Creating NodeApplication object - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_TRACE, DLINFO ACE_TEXT("NodeApplicationManager_impl::startLaunch - ") - ACE_TEXT("Initializing NodeApplication\n"))); - ACE_NEW_THROW_EX (this->application_, - NodeApplication_Impl (this->orb_.in(), - this->poa_.in(), - this->installer_.in (), - this->node_name_, - this->properties_), - CORBA::NO_MEMORY ()); - - DANCE_DEBUG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("NodeApplicationManager_impl::startLaunch - ") - ACE_TEXT("Instructing NodeApplication to prepare locality managers.\n"))); - - this->application_->prepare_instances (this->split_plan_.plans ()); - - DANCE_DEBUG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("NodeApplicationManager_impl::startLaunch - ") - ACE_TEXT("Instructing NodeApplication to start launch localities.\n"))); - - this->application_->start_launch_instances (prop, providedReference); - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT("NodeApplicationManager_impl::startLaunch - ") - ACE_TEXT("Activating NodeApplication servant\n"))); - - PortableServer::ObjectId_var as_id = - this->poa_->activate_object (this->application_); - - CORBA::Object_var as_obj = this->poa_->id_to_reference (as_id.in ()); - Deployment::Application_var app = Deployment::Application::_narrow (as_obj.in ()); - - if (CORBA::is_nil (app)) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO, - "NodeApplicationManager_Impl::startLaunch - ", - "NodeApplication servant failed to activate\n")); - throw ::Deployment::StartError ("NodeApplication", - "Activation failure"); - } - return app._retn (); -} - -void -NodeApplicationManager_Impl::destroyApplication (Deployment::Application_ptr application) -{ - DANCE_TRACE ("NodeApplicationManager_Impl::destroyApplication"); - - try - { - if (!application->_is_equivalent (this->poa_->servant_to_reference (this->application_))) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("NodeApplicationManager_Impl::destroyApplication - ") - ACE_TEXT("application is equivalent to current application\n"))); - throw ::Deployment::StopError("NodeApplicationManager", - "Wrong application passed to destroyApplication"); - } - - this->application_->remove_instances (); - - PortableServer::ObjectId_var id = this->poa_->reference_to_id (application); - this->poa_->deactivate_object (id); - - delete this->application_; - this->application_ = 0; - } - catch (const CORBA::SystemException &) - { - throw; - } - catch (const Deployment::StopError &) - { - throw; - } - catch (const CORBA::UserException &e) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("NodeApplicationManager_Impl::destroyApplication failed ") - ACE_TEXT ("with UserException %C(%C) \"%C\"\n"), - e._name(), e._rep_id(), e._info().c_str())); - throw Deployment::StopError(e._name(), e._info().c_str()); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO - ACE_TEXT("NodeApplicationManager_Impl::destroyApplication failed ") - ACE_TEXT("with unknown exception.\n"))); - throw Deployment::StopError("NodeApplicatoinManager", "Unknown C++ exception in destroyApplication"); - } -} - diff --git a/DAnCE/dance/NodeApplicationManager/NodeApplicationManager_Impl.h b/DAnCE/dance/NodeApplicationManager/NodeApplicationManager_Impl.h deleted file mode 100644 index 5e703d75f58..00000000000 --- a/DAnCE/dance/NodeApplicationManager/NodeApplicationManager_Impl.h +++ /dev/null @@ -1,67 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file NodeApplicationManager_Impl.h - * - * @brief Implementation of POA_Deployment::NodeApplicationManager - * - * @author Erwin Gottlieb <eg@prismtech.com> - */ -//============================================================================= - -#ifndef NODEAPPLICATIONMANAGER_IMPL_H_ -#define NODEAPPLICATIONMANAGER_IMPL_H_ - -#include "NodeApplicationManager_Export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/orbsvcs/CosNamingC.h" - -#include "dance/Deployment/Deployment_DeploymentPlanC.h" -#include "dance/Deployment/Deployment_NodeApplicationManagerS.h" -#include "dance/NodeApplication/NodeApplication_Impl.h" -#include "dance/DAnCE_ArtifactInstallationC.h" - -namespace DAnCE - { - - class NodeApplicationManager_Export NodeApplicationManager_Impl : - public virtual POA_Deployment::NodeApplicationManager - { - public: - - NodeApplicationManager_Impl (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - DAnCE::ArtifactInstallation_ptr installer, - const ACE_CString& name, - const PROPERTY_MAP &properties); - - virtual ~NodeApplicationManager_Impl(); - - virtual Deployment::Application_ptr - startLaunch (const Deployment::Properties & configProperty, - Deployment::Connections_out providedReference); - - virtual void destroyApplication (Deployment::Application_ptr); - - void preparePlan (const Deployment::DeploymentPlan& plan); - - private: - LocalitySplitter split_plan_; - CORBA::ORB_var orb_; - PortableServer::POA_var poa_; - DAnCE::ArtifactInstallation_var installer_; - NodeApplication_Impl* application_; - ACE_CString node_name_; - PROPERTY_MAP properties_; - CosNaming::NamingContext_var instance_nc_; - }; - - typedef PortableServer::Servant_var<NodeApplicationManager_Impl> Safe_NodeApplicationManager_Impl; - -} -#endif /*NODEAPPLICATIONMANAGER_IMPL_H_*/ diff --git a/DAnCE/dance/NodeManager/.gitignore b/DAnCE/dance/NodeManager/.gitignore deleted file mode 100644 index b17c6369d02..00000000000 --- a/DAnCE/dance/NodeManager/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/dance_node_manager diff --git a/DAnCE/dance/NodeManager/NodeManager.mpc b/DAnCE/dance/NodeManager/NodeManager.mpc deleted file mode 100644 index 6e5c9f83c04..00000000000 --- a/DAnCE/dance/NodeManager/NodeManager.mpc +++ /dev/null @@ -1,13 +0,0 @@ -// -*- MPC -*- -project(Node_Manager_Exec) : install, utils, dance_exe, naming, avoids_ace_for_tao, \ - dance_nodeapplicationmanager, dance_nodemanager_skel, dance_skel, \ - dance_artifact_installation, dance_installation_repository_manager, \ - dance_installation_handlers, dance_logger { - exename = dance_node_manager - - Source_Files { - NodeManager_Impl.cpp - Node_Manager_Module.cpp - Node_Manager.cpp - } -} diff --git a/DAnCE/dance/NodeManager/NodeManager_Impl.cpp b/DAnCE/dance/NodeManager/NodeManager_Impl.cpp deleted file mode 100644 index d32976c8c31..00000000000 --- a/DAnCE/dance/NodeManager/NodeManager_Impl.cpp +++ /dev/null @@ -1,247 +0,0 @@ -#include "NodeManager_Impl.h" -#include "ace/iosfwd.h" -#include "dance/Logger/Log_Macros.h" -#include "ace/OS_Memory.h" - -#include "dance/DAnCE_PropertiesC.h" -#include "dance/LocalityManager/Scheduler/Plugin_Manager.h" -#include "dance/LocalityManager/Handler/Plugin_Conf.h" - -#ifdef GEN_OSTREAM_OPS -#include <iostream> -#include <sstream> -#endif /* GEN_OSTREAM_OPS */ - -namespace DAnCE -{ - NodeManager_Impl::NodeManager_Impl(CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - DAnCE::ArtifactInstallation_ptr installer, - const char* name, - std::string config_file, - const PROPERTY_MAP &properties) - : orb_ (CORBA::ORB::_duplicate (orb)), - poa_ (PortableServer::POA::_duplicate (poa)), - installer_ (DAnCE::ArtifactInstallation::_duplicate (installer)), - name_ (name), - properties_ (properties.current_size ()) - { - DANCE_TRACE ( "NodeManager_Impl::NodeManager_Impl"); - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_INFO, DLINFO - ACE_TEXT("NodeManager_impl::NodeManager_impl has been created\n"))); - - PROPERTY_MAP::const_iterator i = properties.begin (); - while (!i.done ()) - { - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_TRACE, DLINFO - ACE_TEXT("NodeManager_Impl::NodeManager_Impl - ") - ACE_TEXT("Binding property %C provided by caller.\n"), i->key ().c_str ())); - this->properties_.bind (i->key (), i->item ()); - i.advance (); - } - - ::Deployment::Properties prop; - ::DAnCE::Utility::build_property_sequence (prop, properties); - PLUGIN_MANAGER::instance ()->set_configuration (prop); - PLUGIN_MANAGER::instance ()->set_orb (this->orb_); - - Plugin_Configurator conf; - - if (config_file.c_str ()) - { - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT ("NodeManager_Impl::NodeManager_Impl - ") - ACE_TEXT ("Loading plugin file <%C>\n"), - config_file.c_str ())); - conf.load_from_text_file (ACE_TEXT_CHAR_TO_TCHAR (config_file.c_str ())); - } - else - DANCE_ERROR (DANCE_LOG_WARNING, - (LM_WARNING, DLINFO - ACE_TEXT ("NodeManager_Impl::NodeManager_Impl - ") - ACE_TEXT ("Warning: No plugin configuration file found.\n"))); - } - - NodeManager_Impl::~NodeManager_Impl() - { - DANCE_TRACE ("NodeManager_Impl::~NodeManager_Impl()"); - for (TManagers::iterator iter = this->managers_.begin(); - iter != this->managers_.end(); - ++iter) - { - try - { - PortableServer::ObjectId_var id = this->poa_->servant_to_id ( (*iter).int_id_); - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("NodeManager_impl::~NodeManager_impl - Deactivating NodeApplicationManager %C\n"), - (*iter).ext_id_.c_str ())); - this->poa_->deactivate_object (id.in()); - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("NodeManager_impl::~NodeManager_impl - deleting NodeApplicationManager\n"))); - delete (*iter).int_id_; - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT("NodeManager_impl::~NodeManager_impl - NodeApplicationManager deleted\n"))); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, - (LM_WARNING, DLINFO - ACE_TEXT("NodeManager_impl::~NodeManager_impl - Caught exception while removing ") - ACE_TEXT("NodeApplicationManager %C\n"), (*iter).ext_id_.c_str ())); - } - } - - PLUGIN_MANAGER::close (); - } - - void - NodeManager_Impl::joinDomain (const ::Deployment::Domain & /*theDomain*/, - ::Deployment::TargetManager_ptr /*manager*/, - ::Deployment::Logger_ptr /*log*/, - ::CORBA::Long /*updateInterval*/) - { - DANCE_TRACE ("NodeManager_Impl::joinDomain"); - DANCE_DEBUG (DANCE_LOG_NONFATAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("NodeManager_Impl::joinDomain - ") - ACE_TEXT("joinDomain not implemented\n"))); - throw CORBA::NO_IMPLEMENT (); - } - - void - NodeManager_Impl::leaveDomain () - { - DANCE_TRACE ("NodeManager_Impl::leaveDomain"); - DANCE_DEBUG (DANCE_LOG_NONFATAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("NodeManager_Impl::leaveDomain - ") - ACE_TEXT("leave not implemented\n"))); - throw CORBA::NO_IMPLEMENT (); - } - - ::Deployment::NodeApplicationManager_ptr - NodeManager_Impl::preparePlan (const ::Deployment::DeploymentPlan & plan, - ::Deployment::ResourceCommitmentManager_ptr /*resourceCommitment*/) - { - DANCE_TRACE ( "NodeManager_Impl::preparePlan"); - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT("NodeManager_impl::preparePlan - ") - ACE_TEXT("started for node %C and plan %C\n"), - this->name_.c_str(), plan.UUID.in())); - -#ifdef GEN_OSTREAM_OPS - if (DAnCE_debug_level >= DANCE_LOG_DETAILED_TRACE) - { - std::ostringstream plan_stream; - plan_stream << plan << std::endl; - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO "NodeManager_impl::preparePlan - %C", - plan_stream.str ().c_str ())); - } -#endif /* GEN_OSTREAM_OPS */ - - // resourceCommitment will be used on next development stage - if (0 == this->managers_.find (plan.UUID.in())) - { - // What should we do here if we already have application for this plan? - // Probably it is mistake because we should previously call destroyApplication - // before performe relaunching of application - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO ACE_TEXT("NodeManager_impl::preparePlan - ") - ACE_TEXT("ApplicationManager for UUID %C already exists\n"), - plan.UUID.in ())); - throw ::Deployment::PlanError(plan.UUID.in (), - "Plan with same UUID already exists"); - } - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("NodeManager_impl::preparePlan - creating NodeApplicationManager...\n"))); - NodeApplicationManager_Impl* manager = 0; - ACE_NEW_THROW_EX (manager, - NodeApplicationManager_Impl (this->orb_.in(), - this->poa_.in(), - this->installer_. in (), - this->name_, - this->properties_), - CORBA::NO_MEMORY()); - Safe_NodeApplicationManager_Impl safe_manager (manager); - - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_TRACE, DLINFO - ACE_TEXT("NodeManager_impl::preparePlan - ") - ACE_TEXT ("invoking preparePlan on NodeApplicationManager...\n"))); - manager->preparePlan (plan); - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("NodeManager_impl::preparePlan - activating NodeApplicationManager...\n"))); - PortableServer::ObjectId_var id = this->poa_->activate_object (manager); - CORBA::Object_var nam = this->poa_->id_to_reference (id.in()); - - // There is an idea to check if plan.UUID really exists - this->managers_.bind (plan.UUID.in(), safe_manager._retn ()); - - // narrow should return a nil reference if it fails. - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_INFO, DLINFO - ACE_TEXT("NodeManager_impl::preparePlan - ") - ACE_TEXT ("NodeApplicationManager for plan %C completed\n"), - plan.UUID.in ())); - return Deployment::NodeApplicationManager::_narrow (nam.in ()); - } - - void - NodeManager_Impl::destroyManager (::Deployment::NodeApplicationManager_ptr appManager) - { - DANCE_TRACE ("NodeManager_Impl::destroyManager"); - - for (TManagers::iterator iter = this->managers_.begin(); - iter != this->managers_.end(); - ++iter) - { - if (appManager->_is_equivalent (this->poa_->servant_to_reference ( (*iter).int_id_))) - { - PortableServer::ObjectId_var id = this->poa_->reference_to_id (appManager); - this->poa_->deactivate_object (id.in()); - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("NodeManager_impl::destroyManager - deleting NodeApplicationManager\n"))); - delete (*iter).int_id_; - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("NodeManager_impl::destroyManager - NodeApplicationManager deleted\n"))); - this->managers_.unbind ( (*iter).ext_id_); - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("NodeManager_impl::destroyManager - finished\n"))); - return; - } - } - - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("NodeManager_impl::destroyManager - ") - ACE_TEXT("correponding NodeApplicationManager cannot be found\n"))); - throw ::Deployment::InvalidReference(); - } - - ::Deployment::Resources * - NodeManager_Impl::getDynamicResources () - { - DANCE_TRACE ( "NodeManager_Impl::getDynamicResources ()"); - DANCE_DEBUG (DANCE_LOG_NONFATAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("NodeManager_Impl::getDynamicResources - ") - ACE_TEXT("getDynamicResources not implemented\n"))); - throw CORBA::NO_IMPLEMENT (); - } -} //DAnCE - diff --git a/DAnCE/dance/NodeManager/NodeManager_Impl.h b/DAnCE/dance/NodeManager/NodeManager_Impl.h deleted file mode 100644 index 97dbbe5a290..00000000000 --- a/DAnCE/dance/NodeManager/NodeManager_Impl.h +++ /dev/null @@ -1,69 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file NodeManager_Impl.h - * - * @brief Implementation of POA_Deployment::NodeManager - * - * @author Erwin Gottlieb <eg@prismtech.com> - * @author William R. Otte <wotte@dre.vanderbilt.edu> - */ -//============================================================================= - -#ifndef NODEMANAGER_IMPL_H_ -#define NODEMANAGER_IMPL_H_ - -#include "tao/Object.h" -#include "tao/ORB.h" -#include "dance/DAnCE_Utility.h" -#include "dance/Deployment/Deployment_NodeManagerS.h" -#include "dance/NodeApplicationManager/NodeApplicationManager_Impl.h" -#include "dance/DAnCE_ArtifactInstallationC.h" -#include "ace/Map_Manager.h" - -namespace DAnCE -{ - class NodeManager_Impl : - public virtual POA_Deployment::NodeManager - { - public: - /// The fixed listener port is caused by the usage of CCM Object locator - NodeManager_Impl (CORBA::ORB_ptr orb, - PortableServer::POA_ptr poa, - DAnCE::ArtifactInstallation_ptr installer, - const char* name, - std::string config_file, - const PROPERTY_MAP &options); - - virtual ~NodeManager_Impl(); - - virtual void joinDomain (const ::Deployment::Domain & theDomain, - ::Deployment::TargetManager_ptr manager, - ::Deployment::Logger_ptr log, - ::CORBA::Long updateInterval); - - virtual void leaveDomain (void); - - virtual ::Deployment::NodeApplicationManager_ptr preparePlan ( - const ::Deployment::DeploymentPlan & plan, - ::Deployment::ResourceCommitmentManager_ptr resourceCommitment); - - virtual void destroyManager (::Deployment::NodeApplicationManager_ptr appManager); - - virtual ::Deployment::Resources * getDynamicResources (void); - - private: - CORBA::ORB_var orb_; - PortableServer::POA_var poa_; - DAnCE::ArtifactInstallation_var installer_; - ACE_CString name_; - /// @todo, see if we can use a _ptr - typedef ACE_Map_Manager<ACE_CString, NodeApplicationManager_Impl*, ACE_Null_Mutex > TManagers; - TManagers managers_; - PROPERTY_MAP properties_; - DAnCE::Deployment_Scheduler scheduler_; - }; -} - -#endif /*NODEMANAGER_IMPL_H_*/ diff --git a/DAnCE/dance/NodeManager/Node_Manager.cpp b/DAnCE/dance/NodeManager/Node_Manager.cpp deleted file mode 100644 index eab3937851c..00000000000 --- a/DAnCE/dance/NodeManager/Node_Manager.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "ace/Dynamic_Service.h" -#include "tao/ORB.h" -#include "tao/Object.h" -#include "dance/Logger/Log_Macros.h" -#include "dance/Logger/Logger_Service.h" -#include "Node_Manager_Module.h" - -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - DANCE_DISABLE_TRACE (); - - int retval = 0; - - try - { - CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); - - - DAnCE::Logger_Service - * dlf = ACE_Dynamic_Service<DAnCE::Logger_Service>::instance ("DAnCE_Logger"); - - if (dlf) - { - dlf->init (argc, argv); - } - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("NodeManager - initializing module instance\n"))); - - DAnCE_NodeManager_Module nm; - CORBA::Object_var obj = nm.init (orb.in (), argc, argv); - - if (!CORBA::is_nil (obj.in ())) - { - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("NodeManager - running ORB\n"))); - orb->run (); - } - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("NodeManager - destroying ORB\n"))); - - orb->destroy (); - } - catch (const CORBA::Exception& ex) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_EMERGENCY, "NodeManager - Error, CORBA Exception: %C\n", - ex._info ().c_str ())); - retval = -1; - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, "NodeManager - Error: Unknown exception.\n")); - retval = -1; - } - - return retval; -} - diff --git a/DAnCE/dance/NodeManager/Node_Manager_Module.cpp b/DAnCE/dance/NodeManager/Node_Manager_Module.cpp deleted file mode 100644 index 6b0d280c519..00000000000 --- a/DAnCE/dance/NodeManager/Node_Manager_Module.cpp +++ /dev/null @@ -1,742 +0,0 @@ -// -*- C++ -*- -#include "ace/Get_Opt.h" -#include "ace/OS_NS_stdio.h" -#include "ace/Env_Value_T.h" -#include "tao/StringSeqC.h" -#include "tao/IORTable/IORTable.h" -#include "tao/Utils/PolicyList_Destroyer.h" -#include "orbsvcs/CosNamingC.h" -#include "dance/Logger/Log_Macros.h" -#include "dance/DAnCE_PropertiesC.h" -#include "Node_Manager_Module.h" -#include "NodeManager_Impl.h" -#include "Artifact_Installation/Artifact_Installation_Impl.h" -#include "Artifact_Installation/Artifact_Installation_Handler_Svc.h" -#include "Artifact_Installation/Installation_Repository_Manager_Impl.h" -#include "Artifact_Installation/File_Installation_Handler.h" -#include "Artifact_Installation/Http_Installation_Handler.h" - -namespace DAnCE -{ - namespace Node_Manager - { - bool - write_IOR (const ACE_TCHAR * ior_file_name, const char* ior) - { - FILE* ior_output_file_ = ACE_OS::fopen (ior_file_name, ACE_TEXT("w")); - - if (ior_output_file_) - { - ACE_OS::fprintf (ior_output_file_, "%s", ior); - ACE_OS::fclose (ior_output_file_); - return true; - } - return false; - } - } -} - -DAnCE_NodeManager_Module::SOptions::SOptions(void) - : process_ns_ (false), - process_ns_file_ (0), - create_plan_ns_ (false), - create_plan_ns_ior_ (0), - rebind_plan_ns_ (false), - rebind_plan_ns_ior_ (0), - cs_path_ (ACE_TEXT("dance_locality_manager")), - timeout_ (5), - server_args_ (0), - domain_nc_ (0), - instance_nc_ (0), - locality_config_("") -{ - ACE_Env_Value<const ACE_TCHAR *> dance_env (ACE_TEXT ("DANCE_ROOT"), - ACE_TEXT ("")); - node_config_ = ACE_TEXT_ALWAYS_CHAR (dance_env); - node_config_ += "/bin/nodemanager.localityconfig"; -} - -DAnCE_NodeManager_Module::DAnCE_NodeManager_Module (void) -{ - DANCE_TRACE("DAnCE_NodeManager_Module::DAnCE_NodeManager_Module"); -} - -DAnCE_NodeManager_Module::~DAnCE_NodeManager_Module (void) -{ - DANCE_TRACE ("DAnCE_NodeManager_Module::~DAnCE_NodeManager_Module"); - - for (Servant_Map::iterator it = this->nm_map_.begin (); - it != this->nm_map_.end (); - ++it) - { - delete (*it).int_id_; - } -} - -const char * -DAnCE_NodeManager_Module::usage (void) -{ - DANCE_TRACE ("DAnCE_NodeManager_Module::usage"); - return "Node Manager Options:\n" - "\t-e|--exec-mgr\t\t [execution manager ior file name]\n" - "\t-n|--node-mgr\t\t <node name> [=node manager ior file name]\n" - "\t-c|--create-plan-ns [NC] create plan objects (components and ports) representation in name context with ior NC\n" - "\t-r|--rebind-plan-ns [NC] bind plan representation name context to NC\n" - "\t-i|--port-indirection\t enable plan objects indirection via servant locator\n" - "\t-s|--server-executable\t default component server executable\n" - "\t--server-args\t\t additional arguments to supply to the component server\n" - "\t-t|--timeout\t\t default timeout in seconds to wait for component server spawn\n" - "\t-d|--domain-nc [NC]\t Default naming context for domain objects.\n" - "\t--instance-nc [NC]\t Default naming context for instance registration directives. No argument indicates Domain NC.\n" - "\t--locality-config\t\t Provide a locality configuration file that is passed to all spawned locality managers.\n" - "\t--node-config\t\t Provide a locality configuration file used to initialize the NodeManager.\n" - "\t-h|help\t\t\t print this help message\n"; -} - -bool -DAnCE_NodeManager_Module::parse_args (int argc, ACE_TCHAR * argv[]) -{ - ACE_Get_Opt get_opts (argc, - argv, - ACE_TEXT("e:n:p::c::r::is:t:h"), - 0, - 0, - ACE_Get_Opt::RETURN_IN_ORDER); - - get_opts.long_option (ACE_TEXT("exec-mgr"), 'e', ACE_Get_Opt::ARG_REQUIRED); - get_opts.long_option (ACE_TEXT("node-mgr"), 'n', ACE_Get_Opt::ARG_REQUIRED); - get_opts.long_option (ACE_TEXT("process-ns"), 'p', ACE_Get_Opt::ARG_OPTIONAL); - get_opts.long_option (ACE_TEXT("create-plan-ns"), 'c', ACE_Get_Opt::ARG_OPTIONAL); - get_opts.long_option (ACE_TEXT("rebind-plan-ns"), 'r', ACE_Get_Opt::ARG_OPTIONAL); - get_opts.long_option (ACE_TEXT("port-indirection"), 'i', ACE_Get_Opt::NO_ARG); - get_opts.long_option (ACE_TEXT("server-executable"), 's', ACE_Get_Opt::ARG_REQUIRED); - get_opts.long_option (ACE_TEXT("server-args"), ACE_Get_Opt::ARG_REQUIRED); - get_opts.long_option (ACE_TEXT("timeout"), 't', ACE_Get_Opt::ARG_REQUIRED); - get_opts.long_option (ACE_TEXT("domain-nc"), 'd', ACE_Get_Opt::ARG_REQUIRED); - get_opts.long_option (ACE_TEXT("locality-config"), ACE_Get_Opt::ARG_REQUIRED); - get_opts.long_option (ACE_TEXT("help"), 'h', ACE_Get_Opt::NO_ARG); - get_opts.long_option (ACE_TEXT("instance-nc"), ACE_Get_Opt::ARG_REQUIRED); - get_opts.long_option (ACE_TEXT("node-config"), ACE_Get_Opt::ARG_REQUIRED); - - int c; - while ( (c = get_opts ()) != -1) - { - switch (c) - { - case 'n': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT("Node_Manager_Module::parse_args - ") - ACE_TEXT("Provided Node Manager name: %s\n"), get_opts.opt_arg ())); - this->options_.node_managers_.push_back (get_opts.opt_arg ()); - break; - - case 'p': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT("Node_Manager_Module::parse_args - ") - ACE_TEXT("Instructed to create process ns with file %s\n"), get_opts.opt_arg ())); - this->options_.process_ns_ = true; - this->options_.process_ns_file_ = get_opts.opt_arg (); - break; - - case 'c': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT("Node_Manager_Module::parse_args - ") - ACE_TEXT("Instructed to create plan NS in context: %s\n"), get_opts.opt_arg ())); - this->options_.create_plan_ns_ = true; - this->options_.create_plan_ns_ior_ = get_opts.opt_arg (); - break; - - case 'r': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT("Node_Manager_Module::parse_args - ") - ACE_TEXT("Instructed to rebind plan NS in context: %s\n"), get_opts.opt_arg ())); - this->options_.rebind_plan_ns_ = true; - this->options_.rebind_plan_ns_ior_ = get_opts.opt_arg (); - break; - - case 'i': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT("Node_Manager_Module::parse_args - ") - ACE_TEXT("Instructed to create port indirection service\n"))); - this->options_.port_indirection_ = true; - break; - - case 's': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT("Node_Manager_Module::parse_args - ") - ACE_TEXT("Using provided component server executable:%s\n"), - get_opts.opt_arg ())); - this->options_.cs_path_ = get_opts.opt_arg (); - break; - - case 't': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT("Node_Manager_Module::parse_args - ") - ACE_TEXT("Using provided component server spawn timeout:%s\n"), - get_opts.opt_arg ())); - this->options_.timeout_ = ACE_OS::atoi (get_opts.opt_arg ()); - break; - - case 'd': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT("Node_Manager_Module::parse_args - ") - ACE_TEXT("Binding to provided Domain Naming Context: '%s'\n"), - get_opts.opt_arg ())); - this->options_.domain_nc_ = get_opts.opt_arg (); - break; - - case 'h': - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, - this->usage (), argv [0], c)); - return false; - break; - - case 0: - if (ACE_OS::strcmp (get_opts.long_option (), - ACE_TEXT("server-args")) == 0) - { - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT("Node_Manager_Module::parse_args - ") - ACE_TEXT("Using provided component server arguments: '%s'\n"), - get_opts.opt_arg ())); - this->options_.server_args_ = get_opts.opt_arg (); - } - else if (ACE_OS::strcmp (get_opts.long_option (), - ACE_TEXT("locality-config")) == 0) - { - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT("Node_Manager_Module::parse_args - ") - ACE_TEXT("Using locality configuration file <%s>\n"), - get_opts.opt_arg ())); - this->options_.locality_config_ = ACE_TEXT_ALWAYS_CHAR (get_opts.opt_arg ()); - } - else if (ACE_OS::strcmp (get_opts.long_option (), - ACE_TEXT("node-config")) == 0) - { - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT("Node_Manager_Module::parse_args - ") - ACE_TEXT("Using locality configuration file for node: <%s>\n"), - get_opts.opt_arg ())); - this->options_.node_config_ = ACE_TEXT_ALWAYS_CHAR (get_opts.opt_arg ()); - } - else if (ACE_OS::strcmp (get_opts.long_option (), - ACE_TEXT("instance-nc")) == 0) - { - if (get_opts.opt_arg () == 0) - { - if (this->options_.domain_nc_ == 0) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, DLINFO ACE_TEXT("Node_Manager_Module::parse_args - ") - ACE_TEXT("ERROR: instance-nc provided no argument, ") - ACE_TEXT("but domain-nc did not appear before.\n"))); - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, this->usage (), argv[0], c)); - return false; - } - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT("Node_Manager_Module::parse_args - ") - ACE_TEXT("Instance NC defaulting to Domain NC\n"))); - this->options_.instance_nc_ = this->options_.domain_nc_; - } - else - { - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT("Node_Manager_Module::parse_args - ") - ACE_TEXT("Using provided instance NC: %s\n"), - get_opts.opt_arg ())); - this->options_.instance_nc_ = get_opts.opt_arg (); - } - } - else - { - DANCE_ERROR (DANCE_LOG_WARNING, - (LM_ERROR, DLINFO ACE_TEXT("Node_Manager_Module::parse_args - ") - ACE_TEXT("Ignoring unknown long option %s\n"), - get_opts.long_option ())); - } - - break; - - default: - DANCE_DEBUG (DANCE_LOG_WARNING, - (LM_TRACE, DLINFO - ACE_TEXT("Node_Manager_Module::parse_args - ignoring unknown option %c\n"), - c)); - } - } - return true; -} - -CORBA::Object_ptr -DAnCE_NodeManager_Module::init (CORBA::ORB_ptr orb, - int argc, - ACE_TCHAR *argv[]) -{ - try - { - if (CORBA::is_nil(orb)) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, DLINFO - ACE_TEXT("DAnCE_NodeManager_Module::init - ") - ACE_TEXT("Attempted to create Node Manager with a nil orb.\n"))); - return CORBA::Object::_nil(); - } - - if (CORBA::is_nil(this->orb_.in())) - { - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO ACE_TEXT("DAnCE_NodeManager_Module::init - ") - ACE_TEXT("NM's orb is nil.\n"))); - this->orb_ = CORBA::ORB::_duplicate (orb); - } - else if (ACE_OS::strcmp(orb->id(), this->orb_->id()) != 0) - { - DANCE_DEBUG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE_NodeManager_Module::init - ") - ACE_TEXT("Resetting NM's orb.\n"))); - this->orb_ = CORBA::ORB::_duplicate (orb); - this->domain_nc_ = CosNaming::NamingContext::_nil(); - } - - if (!this->parse_args (argc, argv)) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, DLINFO - ACE_TEXT("DAnCE_NodeManager_Module::init - ") - ACE_TEXT("Unable to parse the commandline arguments.\n"))); - return CORBA::Object::_nil (); - } - - this->register_value_factories (); - this->create_poas (); - - if (this->options_.domain_nc_) - { - try - { - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO ACE_TEXT("DAnCE_NodeManager_Module::init - ") - ACE_TEXT("Resolving DomainNC.\n"))); - CORBA::Object_var domain_obj = this->orb_->string_to_object (this->options_.domain_nc_); - if (!CORBA::is_nil (domain_obj.in ())) - { - this->domain_nc_ = CosNaming::NamingContext::_narrow (domain_obj.in()); - if (CORBA::is_nil (this->domain_nc_.in ())) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, DLINFO - ACE_TEXT("DAnCE_NodeManager_Module::init - ") - ACE_TEXT("Narrow to NamingContext return nil for DomainNC.\n"))); - return CORBA::Object::_nil (); - } - } - } - catch (const CORBA::Exception&) - { - DANCE_ERROR (DANCE_LOG_WARNING, (LM_WARNING, DLINFO - ACE_TEXT("DAnCE_NodeManager_Module::init - ") - ACE_TEXT("DomainNC context not found!\n"))); - } - } - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("DAnCE_NodeManager_Module::init - ") - ACE_TEXT("Resolving plan NS naming context.\n"))); - - CosNaming::NamingContext_var rebind_nc; - if (this->options_.rebind_plan_ns_) - { - if (!this->options_.create_plan_ns_) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, DLINFO - ACE_TEXT ("DAnCE_NodeManager_Module::init - ") - ACE_TEXT ("Rebind_plan_ns option is enabled but Create_plan_ns is not.\n"))); - return CORBA::Object::_nil(); - } - CORBA::Object_var tmp_obj; - if (0 != this->options_.rebind_plan_ns_ior_) - { - tmp_obj = orb->string_to_object (this->options_.rebind_plan_ns_ior_); - rebind_nc = CosNaming::NamingContext::_narrow (tmp_obj); - } - else - { - if (CORBA::is_nil (this->domain_nc_.in ())) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, DLINFO - ACE_TEXT ("DAnCE_NodeManager_Module::init - ") - ACE_TEXT ("The rebind plan is enabled but neither NC ") - ACE_TEXT ("nor DomainNC are not supplied. No rebinding will be done.\n") - ACE_TEXT ("Use the \"-rebind-plan-ns NC ior\" ") - ACE_TEXT ("or \"-ORBInitRef DomainNC\" option.\n"))); - return CORBA::Object::_nil (); - } - rebind_nc = CosNaming::NamingContext::_duplicate (this->domain_nc_.in ()); - } - } - - // Initialize IOR table - CORBA::Object_var table_object = orb->resolve_initial_references ("IORTable"); - - IORTable::Table_var adapter = IORTable::Table::_narrow (table_object.in ()); - - if (CORBA::is_nil (adapter.in ())) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, DLINFO - ACE_TEXT ("DAnCE_NodeManager_Module::init - ") - ACE_TEXT ("Unable to RIR the IORTable.\n"))); - return CORBA::Object::_nil (); - } - - // Creating in process nameservice - CosNaming::NamingContext_var plan_nc; - if (this->options_.create_plan_ns_) - { - DANCE_DEBUG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("DAnCE_NodeManager_Module::init - ") - ACE_TEXT ("Resolving plan-specific naming context.\n"))); - CORBA::Object_var naming_obj; - if (0 != this->options_.create_plan_ns_ior_) - { - naming_obj = orb->string_to_object (this->options_.create_plan_ns_ior_); - plan_nc = CosNaming::NamingContext::_narrow (naming_obj.in()); - if (CORBA::is_nil (plan_nc.in())) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, DLINFO - ACE_TEXT ("DAnCE_NodeManager_Module::init - ") - ACE_TEXT ("Failed trying to narrow naming context ") - ACE_TEXT ("for dance creating plan NC.\n") - ACE_TEXT ("Use the \"--create-plan-ns NC ior\" ") - ACE_TEXT ("or \"--process-ns\" option.\n"))); - return CORBA::Object::_nil (); - } - } - else if (this->options_.process_ns_) - { - naming_obj = orb->resolve_initial_references ("NameService"); - if (0 != this->options_.process_ns_file_) - { - CORBA::String_var ior = orb->object_to_string (naming_obj.in ()); - DAnCE::Node_Manager::write_IOR (this->options_.process_ns_file_, ior.in ()); - } - plan_nc = CosNaming::NamingContext::_narrow (naming_obj.in ()); - if (CORBA::is_nil (plan_nc.in ())) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, DLINFO - ACE_TEXT ("DAnCE_NodeManager_Module::init - ") - ACE_TEXT ("Fails trying to narrow naming context ") - ACE_TEXT ("for dance creating plan NC.\n") - ACE_TEXT ("Use the \"--create-plan-ns NC ior\" ") - ACE_TEXT ("or \"--process-ns\" option.\n"))); - return CORBA::Object::_nil (); - } - } - else if (CORBA::is_nil (this->domain_nc_.in ())) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, DLINFO - ACE_TEXT ("DAnCE_NodeManager_Module::init - ") - ACE_TEXT ("The create plan is enabled but neither NC ior ") - ACE_TEXT ("nor --process-ns or DomainNC option are not supplied.\n") - ACE_TEXT ("Use the \"--create-plan-ns NC ior\", \"--process-ns\" ") - ACE_TEXT ("or \"-ORBInitRef DomainNC\" option.\n"))); - return CORBA::Object::_nil (); - } - else - { - plan_nc = CosNaming::NamingContext::_duplicate (this->domain_nc_.in ()); - } - } - - // Parsing Node name and node manager ior file name - ACE_TString node_name = this->options_.node_managers_[0].c_str (); - ACE_TString node_file; - size_t npos = node_name.find ('='); - if (ACE_CString::npos != npos) - { - node_file = node_name.substring (npos + 1, node_name.length() - npos + 1); - node_name = node_name.substring (0, npos); - } - - // load service modules for artifact installation service - load_artifact_installation_modules (argc, argv); - - // Creating in process artifact installation service - DAnCE::ArtifactInstallation_Impl* installer = 0; - ACE_NEW_RETURN (installer, - DAnCE::ArtifactInstallation_Impl (), - CORBA::Object::_nil ()); - PortableServer::Servant_var<DAnCE::ArtifactInstallation_Impl> safe_installer (installer); - - ACE_CString installer_oid_str = ACE_TEXT_ALWAYS_CHAR ((node_name + ACE_TEXT (".ArtifactInstaller")).c_str ()); - - // Registering servant in poa - PortableServer::ObjectId_var installer_oid = - PortableServer::string_to_ObjectId (installer_oid_str.c_str()); - this->nm_poa_->activate_object_with_id (installer_oid, safe_installer._retn ()); - - CORBA::Object_var installer_object = this->nm_poa_->id_to_reference (installer_oid.in ()); - this->installer_ = DAnCE::ArtifactInstallation::_narrow (installer_object.in ()); - - // Getting node manager ior - CORBA::String_var installer_ior = orb->object_to_string (installer_object.in ()); - - // Binding ior to IOR Table - adapter->bind (installer_oid_str.c_str (), installer_ior.in ()); - - // Make sure that we have only one Node Manager - if (this->options_.node_managers_.size () != 1) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, DLINFO - ACE_TEXT ("DAnCE_NodeManager_Module::init - ") - ACE_TEXT ("For now only one node manager creation is supported.\n"))); - return CORBA::Object::_nil (); - } - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT ("DAnCE_NodeManager_Module::init - ") - ACE_TEXT ("DAnCE_NodeManager::run_main - creating NodeManager for node %C\n"), - this->options_.node_managers_[0].c_str())); - - //Creating node manager servant - DAnCE::NodeManager_Impl * nm = 0; - if (this->nm_map_.find (node_name, nm) == -1) - { - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("DAnCE_NodeManager_Module::init - ") - ACE_TEXT ("Allocating new NodeManager servant instance for NodeManager\n"))); - int size = 64; - DAnCE::Utility::PROPERTY_MAP properties (size); - this->create_nm_properties (properties); - - ACE_NEW_RETURN (nm, - DAnCE::NodeManager_Impl (orb, - this->root_poa_.in (), - this->installer_.in (), - ACE_TEXT_ALWAYS_CHAR (node_name.c_str()), - this->options_.node_config_, - properties), - CORBA::Object::_nil ()); - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("DAnCE_NodeManager_Module::init - ") - ACE_TEXT ("New NodeManager servant instance for NodeManager allocated.\n"))); - this->nm_map_.bind (node_name, nm); - } - - ACE_CString node_manager_oid = ACE_TEXT_ALWAYS_CHAR ((node_name + ACE_TEXT (".NodeManager")).c_str ()); - - // Registering servant in poa - PortableServer::ObjectId_var oid = - PortableServer::string_to_ObjectId (node_manager_oid.c_str()); - this->nm_poa_->activate_object_with_id (oid, nm); - - // Getting node manager ior - CORBA::Object_var nm_obj = this->nm_poa_->id_to_reference (oid.in ()); - CORBA::String_var ior = orb->object_to_string (nm_obj.in ()); - - // Binding ior to IOR Table - adapter->bind (node_manager_oid.c_str (), ior.in ()); - - // Binding node manager to DomainNC - if (!CORBA::is_nil (this->domain_nc_.in ())) - { - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_TRACE, DLINFO - ACE_TEXT ("DAnCE_NodeManager_Module::init - ") - ACE_TEXT ("Registering NM in NC as \"%C.NodeManager\".\n"), node_name.c_str ())); - CosNaming::Name name (1); - name.length (1); - name[0].id = CORBA::string_dup (ACE_TEXT_ALWAYS_CHAR (node_name.c_str ())); - name[0].kind = CORBA::string_dup ("NodeManager"); - this->domain_nc_->rebind (name, nm_obj.in ()); - } - - // Writing ior to file - if (0 != node_file.length ()) - { - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("DAnCE_NodeManager_Module::init - ") - ACE_TEXT ("Writing node IOR %C to file %C.\n"), node_file.c_str (), ior.in ())); - if (!DAnCE::Node_Manager::write_IOR (node_file.c_str (), ior.in ())) - DANCE_ERROR (DANCE_LOG_NONFATAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("DAnCE_NodeManager_Module::init - ") - ACE_TEXT ("Error: Unable to write IOR to file %C\n"), - node_file.c_str ())); - } - - // Activate POA manager - PortableServer::POAManager_var mgr = this->root_poa_->the_POAManager (); - mgr->activate (); - - // Finishing Deployment part - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_NOTICE, DLINFO - ACE_TEXT ("DAnCE_NodeManager_Module::init - ") - ACE_TEXT ("DAnCE_NodeManager is running...\n"))); - - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("DAnCE_NodeManager_Module::init - ") - ACE_TEXT ("NodeManager IOR: %C\n"), ior.in ())); - - return nm_obj._retn (); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("DAnCE_NodeManager::main\t\n"); - return CORBA::Object::_nil (); - } -} - -void -DAnCE_NodeManager_Module::register_value_factories (void) -{ - DANCE_TRACE("DAnCE_NodeManager_Module::register_value_factories"); -} - -void -DAnCE_NodeManager_Module::create_poas (void) -{ - DANCE_TRACE("DAnCE_NodeManager_Module::create_poas"); - // Get reference to Root POA. - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("DAnCE_NodeManager_Module::create_poas - ") - ACE_TEXT ("Resolving root POA\n"))); - CORBA::Object_var obj = this->orb_->resolve_initial_references ("RootPOA"); - - this->root_poa_ = PortableServer::POA::_narrow (obj.in ()); - - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("DAnCE_NodeManager_Module::create_poas - ") - ACE_TEXT ("Obtaining the POAManager\n"))); - PortableServer::POAManager_var mgr = this->root_poa_->the_POAManager (); - - TAO::Utils::PolicyList_Destroyer policies (2); - policies.length (2); - - try - { - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("DAnCE_NodeManager_Module::create_poas - ") - ACE_TEXT ("DAnCE_NodeManager_Module::create_poas - ") - ACE_TEXT ("Creating the \"Managers\" POA.\n"))); - - policies[0] = this->root_poa_->create_id_assignment_policy (PortableServer::USER_ID); - policies[1] = this->root_poa_->create_lifespan_policy (PortableServer::PERSISTENT); - this->nm_poa_ = this->root_poa_->create_POA ("Managers", - mgr.in(), - policies); - } - catch (const PortableServer::POA::AdapterAlreadyExists &) - { - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_INFO, DLINFO - ACE_TEXT ("DAnCE_NodeManager_Module::create_poas - ") - ACE_TEXT ("Using existing \"Managers\" POA\n"))); - this->nm_poa_ = this->root_poa_->find_POA ("Managers", 0); - } -} - -void -DAnCE_NodeManager_Module::create_nm_properties (DAnCE::Utility::PROPERTY_MAP &props) -{ - { - CORBA::Any val; - val <<= this->options_.timeout_; - props.bind (DAnCE::LOCALITY_TIMEOUT, val); - } - { - CORBA::Any val; - val <<= this->root_poa_.in (); - props.bind (DAnCE::ENTITY_POA, val); - } - { - CORBA::Any val; - val <<= CORBA::Any::from_string (CORBA::string_dup (ACE_TEXT_ALWAYS_CHAR (this->options_.cs_path_)),0); - props.bind (DAnCE::LOCALITY_EXECUTABLE, val); - } - { - CORBA::Any val; - val <<= CORBA::Any::from_string (CORBA::string_dup (ACE_TEXT_ALWAYS_CHAR (this->options_.server_args_)),0); - props.bind (DAnCE::LOCALITY_ARGUMENTS, val); - } - if (this->options_.locality_config_ != "") - { - CORBA::Any val; - val <<= CORBA::Any::from_string (CORBA::string_dup (this->options_.locality_config_.c_str ()), 0); - props.bind (DAnCE::DANCE_LM_CONFIGFILE, val); - } - if (this->options_.instance_nc_) - { - CORBA::Any val; - val <<= CORBA::Any::from_string (CORBA::string_dup (ACE_TEXT_ALWAYS_CHAR (this->options_.instance_nc_)), 0); - props.bind (DAnCE::INSTANCE_NC, val); - } - if (this->options_.domain_nc_) - { - CORBA::Any val; - val <<= CORBA::Any::from_string (CORBA::string_dup (ACE_TEXT_ALWAYS_CHAR (this->options_.domain_nc_)), 0); - props.bind (DAnCE::DOMAIN_NC, val); - } -} - -void -DAnCE_NodeManager_Module::load_artifact_installation_modules (int argc, ACE_TCHAR *argv []) -{ - DAnCE::InstallationRepositoryManagerSvc - * dirms = ACE_Dynamic_Service<DAnCE::InstallationRepositoryManagerSvc>::instance ("InstallationRepositoryManager"); - - if (dirms) - { - dirms->init (argc, argv); - } - - DAnCE::ArtifactInstallationHandlerSvc - * dfihs = ACE_Dynamic_Service<DAnCE::ArtifactInstallationHandlerSvc>::instance ("FileInstallationHandler"); - - if (dfihs) - { - dfihs->init (argc, argv); - } - - DAnCE::ArtifactInstallationHandlerSvc - * dhihs = ACE_Dynamic_Service<DAnCE::ArtifactInstallationHandlerSvc>::instance ("HttpInstallationHandler"); - - if (dhihs) - { - dhihs->init (argc, argv); - } -} diff --git a/DAnCE/dance/NodeManager/Node_Manager_Module.h b/DAnCE/dance/NodeManager/Node_Manager_Module.h deleted file mode 100644 index faff12d404c..00000000000 --- a/DAnCE/dance/NodeManager/Node_Manager_Module.h +++ /dev/null @@ -1,113 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Node_Manager_Module.h - * - * @brief To start NodeManager by starter - * - * @author Vinzenz Tornow <vt@prismtech.com> - * @author William R. Otte <wotte@dre.vanderbilt.edu> - */ -//============================================================================= - -#ifndef NODE_MANAGER_MODULE_H -#define NODE_MANAGER_MODULE_H - -#include /**/ "ace/pre.h" - -#include "ace/Service_Config.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Vector_T.h" -#include "ace/Map_Manager.h" -#include "ace/Null_Mutex.h" -#include "tao/ORB.h" -#include "tao/PortableServer/PortableServer.h" -#include "orbsvcs/CosNamingC.h" -#include "dance/DAnCE_Utility.h" -#include "dance/DAnCE_ArtifactInstallationC.h" - -#include <string> - -namespace DAnCE -{ - class NodeManager_Impl; -} - -/** - * @class Node_Manager_Module - * - * @brief The shared object that is instantiated when the node manager - * module/library is dynamically loaded. - * - * This class runs the node manager instance - */ -class DAnCE_NodeManager_Module -{ - public: - /// Constructor. - DAnCE_NodeManager_Module (void); - - /// Destructor. - ~DAnCE_NodeManager_Module (void); - - /// Overload the base class method to create a new instance - /// of a DAnCE_NodeManager_Module object. - CORBA::Object_ptr init (CORBA::ORB_ptr orb, - int argc, - ACE_TCHAR *argv []); - - private: - const char * usage (void); - - bool parse_args (int argc, ACE_TCHAR *argv []); - - struct SOptions - { - bool process_ns_; - const ACE_TCHAR* process_ns_file_; - bool create_plan_ns_; - const ACE_TCHAR* create_plan_ns_ior_; - bool rebind_plan_ns_; - const ACE_TCHAR* rebind_plan_ns_ior_; - bool port_indirection_; - ACE_Vector<ACE_TString> node_managers_; - const ACE_TCHAR * cs_path_; - unsigned int timeout_; - const ACE_TCHAR * server_args_; - const ACE_TCHAR * domain_nc_; - const ACE_TCHAR * instance_nc_; - unsigned int threads_; - std::string locality_config_; - std::string node_config_; - SOptions(); - }; - - void register_value_factories (void); - void create_poas (void); - void create_nm_properties (DAnCE::Utility::PROPERTY_MAP &props); - void load_artifact_installation_modules (int argc, ACE_TCHAR *argv []); - - /// Here we store the servants. - typedef ACE_Map_Manager < ACE_TString, - DAnCE::NodeManager_Impl *, - ACE_Null_Mutex > Servant_Map; - Servant_Map nm_map_; - CORBA::ORB_var orb_; - CosNaming::NamingContext_var domain_nc_; - - SOptions options_; - - PortableServer::POA_var root_poa_; - PortableServer::POA_var nm_poa_; - - DAnCE::ArtifactInstallation_var installer_; -}; - -#include /**/ "ace/post.h" - -#endif /* NODE_MANAGER_MODULE_H */ diff --git a/DAnCE/dance/NodeManager/README b/DAnCE/dance/NodeManager/README deleted file mode 100644 index 84dd9b803fa..00000000000 --- a/DAnCE/dance/NodeManager/README +++ /dev/null @@ -1,15 +0,0 @@ -/** - - - -@page NodeManager README File - -CIAO's NodeManager implementation. NodeManager is the bootstraping -mechanism to create new NodeApplication on the localhost. We -currently depend on starting the NodeApplicationManager process on -some port of all the hosts that have NodeApplication install to -function properly. The port to run this daemon can be set by using the -TAO ORB options command of -ORBEndpoint <port>. This replaces the -earlier CIAO_Daemon implementation of CIAO as defined in the CCM -specification. -*/ diff --git a/DAnCE/dance/Plan_Launcher/.gitignore b/DAnCE/dance/Plan_Launcher/.gitignore deleted file mode 100644 index 818f39fce32..00000000000 --- a/DAnCE/dance/Plan_Launcher/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/dance_plan_launcher diff --git a/DAnCE/dance/Plan_Launcher/Daemon/.gitignore b/DAnCE/dance/Plan_Launcher/Daemon/.gitignore deleted file mode 100644 index 0953c65a111..00000000000 --- a/DAnCE/dance/Plan_Launcher/Daemon/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -/dance_pl_daemon -/DAnCE_PL_stub_export.h -/PL_DaemonC.cpp -/PL_DaemonC.h -/PL_DaemonC.inl -/PL_DaemonS.cpp -/PL_DaemonS.h diff --git a/DAnCE/dance/Plan_Launcher/Daemon/PL_Daemon.cpp b/DAnCE/dance/Plan_Launcher/Daemon/PL_Daemon.cpp deleted file mode 100644 index 02d516018dd..00000000000 --- a/DAnCE/dance/Plan_Launcher/Daemon/PL_Daemon.cpp +++ /dev/null @@ -1,107 +0,0 @@ -#include "tao/ORB.h" -#include "tao/Object.h" -#include "tao/Utils/ORB_Destroyer.h" -#include "tao/Utils/PolicyList_Destroyer.h" -#include "dance/Logger/Log_Macros.h" -#include "dance/Logger/Logger_Service.h" -#include "dance/DAnCE_Utility.h" - -#include "PL_Daemon_Impl.h" - -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - DANCE_DISABLE_TRACE (); - - int retval = 0; - - try - { - DAnCE::Logger_Service * dlf = - ACE_Dynamic_Service<DAnCE::Logger_Service>::instance ("DAnCE_Logger"); - - if (dlf) - { - dlf->init (argc, argv); - } - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO - ACE_TEXT("PL_Daemon - initializing ORB\n"))); - - CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO - ACE_TEXT("PL_Daemon - initializing module instance\n"))); - - - TAO::Utils::ORB_Destroyer safe_orb (orb); - - CORBA::Object_var poa_obj - = orb->resolve_initial_references ("RootPOA"); - - PortableServer::POA_var poa - = PortableServer::POA::_narrow (poa_obj.in ()); - - PortableServer::POAManager_var mgr = poa->the_POAManager (); - PortableServer::POA_var persistent_poa; - TAO::Utils::PolicyList_Destroyer policies (2); - policies.length (2); - try - { - DANCE_TRACE_LOG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO ACE_TEXT("PL_Daemon - ") - ACE_TEXT("before creating the \"Managers\" POA.\n"))); - - policies[0] = poa->create_id_assignment_policy (PortableServer::USER_ID); - policies[1] = poa->create_lifespan_policy (PortableServer::PERSISTENT); - persistent_poa = poa->create_POA ("Managers", - mgr.in(), - policies); - } - catch (const PortableServer::POA::AdapterAlreadyExists &) - { - persistent_poa = poa->find_POA ("Managers", 0); - } - - DAnCE::Plan_Launcher_Daemon_i *pl_daemon (0); - - ACE_NEW_RETURN (pl_daemon, - DAnCE::Plan_Launcher_Daemon_i (orb.in ()), - 0); - - PortableServer::ServantBase_var safe_servant (pl_daemon); - - PortableServer::ObjectId_var oid = - PortableServer::string_to_ObjectId ("Plan_Launcher_Daemon"); - persistent_poa->activate_object_with_id (oid, pl_daemon); - - CORBA::Object_var pl_obj = persistent_poa->id_to_reference (oid.in ()); - CORBA::String_var pl_ior = orb->object_to_string (pl_obj.in ()); - - DAnCE::Utility::write_IOR (ACE_TEXT ("PL_Daemon.ior"), - pl_ior.in ()); - - orb->run (); - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO - ACE_TEXT("PL_Daemon - destroying ORB\n"))); - - orb->destroy (); - } - catch (const CORBA::Exception& ex) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_EMERGENCY, DLINFO - "PL_Daemon - Error - CORBA Exception :%C\n", - ex._info ().c_str ())); - retval = -1; - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, "PL_Daemon - Error: Unknown exception.\n")); - retval = -1; - } - - return retval; -} - diff --git a/DAnCE/dance/Plan_Launcher/Daemon/PL_Daemon.idl b/DAnCE/dance/Plan_Launcher/Daemon/PL_Daemon.idl deleted file mode 100644 index 0817cdbd77a..00000000000 --- a/DAnCE/dance/Plan_Launcher/Daemon/PL_Daemon.idl +++ /dev/null @@ -1,27 +0,0 @@ -/** - * @file PL_Daemon.idl - * @author William R. Otte <wotte@dre.vanderbilt.edu> - * - * Daemonized version of the Plan Launcher. - */ - -#ifndef PL_DAEMON_IDL -#define PL_DAEMON_IDL - -#include "dance/Deployment/Deployment_DeploymentPlan.idl" - -module DAnCE -{ - interface Plan_Launcher_Daemon - { - /// Load a deployment plan from a file - ::Deployment::DeploymentPlan parse_xml_plan (in string plan_location); - - /// Load a deployment plan from a file - ::Deployment::DeploymentPlan parse_cdr_plan (in string plan_location); - - oneway void shutdown (); - }; -}; - -#endif diff --git a/DAnCE/dance/Plan_Launcher/Daemon/PL_Daemon.mpc b/DAnCE/dance/Plan_Launcher/Daemon/PL_Daemon.mpc deleted file mode 100644 index b82da19607c..00000000000 --- a/DAnCE/dance/Plan_Launcher/Daemon/PL_Daemon.mpc +++ /dev/null @@ -1,60 +0,0 @@ -project (DAnCE_PL_Daemon_idl) : install, dancelib_with_idl, dance_output, gen_ostream, \ - valuetype, dance_deployment_stub { - custom_only = 1 - idlflags += -Wb,stub_export_macro=DANCE_PL_STUB_Export \ - -Wb,stub_export_include=DAnCE_PL_stub_export.h \ - -Gxhst - - IDL_Files { - PL_Daemon.idl - } - - specific { - install_dir = dance/Plan_Launcher/Daemon - } -} - -project (DAnCE_PL_Daemon_stub) : install, dance_deployment_stub, dance_output, dance_lib { - - after += DAnCE_PL_Daemon_idl - dynamicflags += DANCE_PL_STUB_BUILD_DLL - - IDL_Files { - } - - Source_Files { - PL_DaemonC.cpp - } - - Header_Files { - PL_DaemonC.h - } - - specific { - install_dir = dance/Plan_Launcher/Daemon - } -} - -project (DAnCE_PL_Daemon) : dance_exe, install, dance_plan_launcher, utils, dance_stub { - exename = dance_pl_daemon - after += DAnCE_PL_Daemon_stub - libs += DAnCE_PL_Daemon_stub - dynamicflags += DANCE_PL_SKEL_BUILD_DLL - - IDL_Files { - } - - Source_Files { - PL_DaemonS.cpp - PL_Daemon_Impl.cpp - PL_Daemon.cpp - } - - Header_Files { - PL_Daemon_Impl.h - } - - specific { - install_dir = dance/Plan_Launcher/Daemon - } -} diff --git a/DAnCE/dance/Plan_Launcher/Daemon/PL_Daemon_Impl.cpp b/DAnCE/dance/Plan_Launcher/Daemon/PL_Daemon_Impl.cpp deleted file mode 100644 index 96b57022196..00000000000 --- a/DAnCE/dance/Plan_Launcher/Daemon/PL_Daemon_Impl.cpp +++ /dev/null @@ -1,57 +0,0 @@ -// -*- C++ -*- -// TAO_IDL - Generated from -// be/be_codegen.cpp:1756 - -#include "PL_Daemon_Impl.h" -#include "Convert_Plan/Convert_Plan_Impl.h" - -namespace DAnCE -{ - - // Implementation skeleton constructor - Plan_Launcher_Daemon_i::Plan_Launcher_Daemon_i (CORBA::ORB_ptr orb) - : orb_ (CORBA::ORB::_duplicate (orb)) - { - } - - // Implementation skeleton destructor - Plan_Launcher_Daemon_i::~Plan_Launcher_Daemon_i (void) - { - } - - ::Deployment::DeploymentPlan * - Plan_Launcher_Daemon_i::parse_xml_plan (const char * plan_location) - { - if (!plan_location) - throw CORBA::BAD_PARAM (); - - Deployment::DeploymentPlan * plan = - DAnCE::Convert_Plan::read_xml_plan (ACE_TEXT_CHAR_TO_TCHAR (plan_location)); - - if (plan) - return plan; - - throw CORBA::UNKNOWN (); - } - - - ::Deployment::DeploymentPlan * - Plan_Launcher_Daemon_i::parse_cdr_plan (const char * plan_location) - { - if (!plan_location) - throw CORBA::BAD_PARAM (); - - Deployment::DeploymentPlan * plan = - DAnCE::Convert_Plan::read_xml_plan (ACE_TEXT_CHAR_TO_TCHAR (plan_location)); - - if (plan) - return plan; - - throw CORBA::UNKNOWN (); - } - - void Plan_Launcher_Daemon_i::shutdown (void) - { - this->orb_->shutdown (); - } -} diff --git a/DAnCE/dance/Plan_Launcher/Daemon/PL_Daemon_Impl.h b/DAnCE/dance/Plan_Launcher/Daemon/PL_Daemon_Impl.h deleted file mode 100644 index 7a40dedac7b..00000000000 --- a/DAnCE/dance/Plan_Launcher/Daemon/PL_Daemon_Impl.h +++ /dev/null @@ -1,44 +0,0 @@ -// -*- C++ -*- -// TAO_IDL - Generated from -// be/be_codegen.cpp:1698 - -#ifndef PL_DAEMONI_SPRPP7_H_ -#define PL_DAEMONI_SPRPP7_H_ - -#include "PL_DaemonS.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -namespace DAnCE -{ - -class Plan_Launcher_Daemon_i - : public virtual POA_DAnCE::Plan_Launcher_Daemon -{ -public: - // Constructor - Plan_Launcher_Daemon_i (CORBA::ORB_ptr orb); - - // Destructor - virtual ~Plan_Launcher_Daemon_i (void); - - virtual - ::Deployment::DeploymentPlan * parse_xml_plan ( - const char * plan_location); - - virtual - ::Deployment::DeploymentPlan * parse_cdr_plan ( - const char * plan_location); - - virtual - void shutdown (void); - - private: - CORBA::ORB_var orb_; -}; - -} - -#endif /* PL_DAEMONI_H_ */ diff --git a/DAnCE/dance/Plan_Launcher/Deployment_Failure.h b/DAnCE/dance/Plan_Launcher/Deployment_Failure.h deleted file mode 100644 index d7fe4804c75..00000000000 --- a/DAnCE/dance/Plan_Launcher/Deployment_Failure.h +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @file Deployment_Failure.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - * - * Defines exceptions used internally to the Plan Launcher - */ - -#ifndef DANCE_DEPLOYMENT_FAILURE -#define DANCE_DEPLOYMENT_FAILURE - -#include "ace/SString.h" - -namespace DAnCE -{ - struct Deployment_Failure - { - Deployment_Failure (const ACE_CString &ex) : ex_ (ex) {} - - ACE_CString ex_; - }; -} - -#endif diff --git a/DAnCE/dance/Plan_Launcher/EM_Launcher.cpp b/DAnCE/dance/Plan_Launcher/EM_Launcher.cpp deleted file mode 100644 index 64861fc518a..00000000000 --- a/DAnCE/dance/Plan_Launcher/EM_Launcher.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "EM_Launcher.h" - -namespace DAnCE -{ - EM_Launcher::EM_Launcher (CORBA::ORB_ptr orb, - __Base::Manager_ptr manager) - : __Base (orb, manager) - { - } - - EM_Launcher::~EM_Launcher (void) - { - } - - bool - EM_Launcher::lookup_by_uuid (const char *uuid, - CORBA::Object_out am, - CORBA::Object_out app) - { - DANCE_TRACE ("EM_Launcher::lookup_by_uuid"); - - try - { - ::Deployment::DomainApplicationManagers_var managers = this->manager_->getManagers (); - - for (CORBA::ULong i = 0; i < managers->length (); ++i) - { - ::Deployment::DeploymentPlan_var plan (managers[i]->getPlan ()); - ACE_CString plan_uuid (plan->UUID.in ()); - if (plan_uuid == uuid) - { - am = CORBA::Object::_duplicate (managers[i]); - - ::Deployment::Applications_var apps = managers[i]->getApplications (); - - if (apps->length () != 0) - { - app = CORBA::Object::_duplicate ((*apps)[0]); - return true; - } - else return false; - } - } - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("EM_Launcher::lookup_by_uuid - ") - ACE_TEXT ("Caught CORBA Exception: %C\n"), - ex._info ().c_str ())); - throw Deployment_Failure (ex._info ()); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("EM_Launcher::lookup_by_uuid - ") - ACE_TEXT ("Unknown C++ exception\n"))); - throw Deployment_Failure ("Unknown C++ exception in lookup_by_uuid\n"); - } - - return false; - } -} diff --git a/DAnCE/dance/Plan_Launcher/EM_Launcher.h b/DAnCE/dance/Plan_Launcher/EM_Launcher.h deleted file mode 100644 index a55cfa893c7..00000000000 --- a/DAnCE/dance/Plan_Launcher/EM_Launcher.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @file EM_Launcher.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - * - * Plan Launcher bridge for the Execution Manager. - */ - -#ifndef DANCE_PLAN_LAUNCHER_EM -#define DANCE_PLAN_LAUNCHER_EM - -#include "Plan_Launcher_Base_Impl_T.h" - -#include "dance/Deployment/Deployment_DomainApplicationC.h" -#include "dance/Deployment/Deployment_DomainApplicationManagerC.h" -#include "dance/Deployment/Deployment_ExecutionManagerC.h" -#include "dance/Plan_Launcher/Plan_Launcher_Export.h" - -namespace DAnCE -{ - class DAnCE_Plan_Launcher_Export EM_Launcher : - public virtual Plan_Launcher_Base_Impl< ::Deployment::ExecutionManager, - ::Deployment::DomainApplicationManager, - ::Deployment::DomainApplication > - { - typedef Plan_Launcher_Base_Impl< ::Deployment::ExecutionManager, - ::Deployment::DomainApplicationManager, - ::Deployment::DomainApplication > __Base; - - public: - EM_Launcher (CORBA::ORB_ptr orb, - __Base::Manager_ptr managerw); - - ~EM_Launcher (void); - - - bool lookup_by_uuid (const char *uuid, - CORBA::Object_out am, - CORBA::Object_out app); - }; -} - -#endif diff --git a/DAnCE/dance/Plan_Launcher/LM_Launcher.cpp b/DAnCE/dance/Plan_Launcher/LM_Launcher.cpp deleted file mode 100644 index 454c269eae3..00000000000 --- a/DAnCE/dance/Plan_Launcher/LM_Launcher.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include "LM_Launcher.h" - -namespace DAnCE -{ - LM_Launcher::LM_Launcher (CORBA::ORB_ptr orb, - __Base::Manager_ptr manager) - : __Base (orb, manager) - { - } - - LM_Launcher::~LM_Launcher (void) - { - } - - /* - bool - LM_Launcher::lookup_by_uuid (const char *uuid, - CORBA::Object_out am, - CORBA::Object_out app) - { - DANCE_TRACE ("LM_Launcher::lookup_by_uuid"); - - try - { - ::Deployment::ApplicationManagers_var managers = this->manager_->getManagers (); - - for (CORBA::ULong i = 0; i < managers->length (); ++i) - { - ::Deployment::DeploymentPlan_var plan (managers[i]->getPlan ()); - ACE_CString plan_uuid (plan->UUID.in ()); - if (plan_uuid == uuid) - { - am = CORBA::Object::_duplicate (managers[i]); - - ::Deployment::Applications_var apps = managers[i]->getApplications (); - - if (apps->length () != 0) - { - app = CORBA::Object::_duplicate ((*apps)[0]); - return true; - } - else return false; - } - } - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("LM_Launcher::lookup_by_uuid - ") - ACE_TEXT ("Caught CORBA Exception: %C\n"), - ex._info ().c_str ())); - throw Deployment_Failure (ex._info ()); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("LM_Launcher::lookup_by_uuid - ") - ACE_TEXT ("Unknown C++ exception\n"))); - throw Deployment_Failure ("Unknown C++ exception in lookup_by_uuid\n"); - } - - return false; - } - */ -} diff --git a/DAnCE/dance/Plan_Launcher/LM_Launcher.h b/DAnCE/dance/Plan_Launcher/LM_Launcher.h deleted file mode 100644 index fbc9b1a2907..00000000000 --- a/DAnCE/dance/Plan_Launcher/LM_Launcher.h +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @file LM_Launcher.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - * - * Plan Launcher bridge for the Locality Manager. - */ - -#ifndef DANCE_PLAN_LAUNCHER_LM -#define DANCE_PLAN_LAUNCHER_LM - -#include "Plan_Launcher_Base_Impl_T.h" - -#include "dance/DAnCE_LocalityManagerC.h" -#include "dance/Plan_Launcher/Plan_Launcher_Export.h" - -namespace DAnCE -{ - class DAnCE_Plan_Launcher_Export LM_Launcher : - public virtual Plan_Launcher_Base_Impl< ::DAnCE::LocalityManager, - ::DAnCE::LocalityManager, - ::DAnCE::LocalityManager > - { - typedef Plan_Launcher_Base_Impl< ::DAnCE::LocalityManager, - ::DAnCE::LocalityManager, - ::DAnCE::LocalityManager > __Base; - - public: - LM_Launcher (CORBA::ORB_ptr orb, - __Base::Manager_ptr managerw); - - ~LM_Launcher (void); - - - bool lookup_by_uuid (const char *uuid, - CORBA::Object_out am, - CORBA::Object_out app); - }; -} - -#endif diff --git a/DAnCE/dance/Plan_Launcher/NM_Launcher.cpp b/DAnCE/dance/Plan_Launcher/NM_Launcher.cpp deleted file mode 100644 index 80311d44698..00000000000 --- a/DAnCE/dance/Plan_Launcher/NM_Launcher.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "NM_Launcher.h" - -namespace DAnCE -{ - NM_Launcher::NM_Launcher (CORBA::ORB_ptr orb, - __Base::Manager_ptr manager) - : __Base (orb, manager) - { - } - - NM_Launcher::~NM_Launcher (void) - { - } -} diff --git a/DAnCE/dance/Plan_Launcher/NM_Launcher.h b/DAnCE/dance/Plan_Launcher/NM_Launcher.h deleted file mode 100644 index a447e326208..00000000000 --- a/DAnCE/dance/Plan_Launcher/NM_Launcher.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @file NM_Launcher.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - * - * Plan Launcher bridge for the Node Manager. - */ - -#ifndef DANCE_PLAN_LAUNCHER_NM -#define DANCE_PLAN_LAUNCHER_NM - -#include "Plan_Launcher_Base_Impl_T.h" - -#include "dance/Deployment/Deployment_NodeApplicationC.h" -#include "dance/Deployment/Deployment_NodeApplicationManagerC.h" -#include "dance/Deployment/Deployment_NodeManagerC.h" -#include "dance/Plan_Launcher/Plan_Launcher_Export.h" - -namespace DAnCE -{ - class DAnCE_Plan_Launcher_Export NM_Launcher : - public virtual Plan_Launcher_Base_Impl< ::Deployment::NodeManager, - ::Deployment::NodeApplicationManager, - ::Deployment::NodeApplication > - { - typedef Plan_Launcher_Base_Impl< ::Deployment::NodeManager, - ::Deployment::NodeApplicationManager, - ::Deployment::NodeApplication > __Base; - - public: - NM_Launcher (CORBA::ORB_ptr orb, - __Base::Manager_ptr managerw); - - ~NM_Launcher (void); - - - }; -} - -#endif diff --git a/DAnCE/dance/Plan_Launcher/Plan_Launcher.cpp b/DAnCE/dance/Plan_Launcher/Plan_Launcher.cpp deleted file mode 100644 index a7fd94b8cda..00000000000 --- a/DAnCE/dance/Plan_Launcher/Plan_Launcher.cpp +++ /dev/null @@ -1,1042 +0,0 @@ -#include "ace/OS_NS_sys_time.h" -#include "ace/OS_NS_unistd.h" -#include "ace/OS_NS_stdlib.h" -#include "ace/Dynamic_Service.h" -#include "ace/Env_Value_T.h" -#include "ace/Get_Opt.h" -#include "tao/ORB.h" -#include "tao/Object.h" -#include "dance/Logger/Log_Macros.h" -#include "dance/Logger/Logger_Service.h" -#include "tools/Convert_Plan/Convert_Plan_Impl.h" -#include "tools/Config_Handlers/XML_File_Intf.h" -#include "tools/Domain_Validator/CORBA/CORBA_Domain_Validator_impl.h" - -#include "EM_Launcher.h" -#include "NM_Launcher.h" -#include "LM_Launcher.h" - -//#include "Plan_Launcher_Impl.h" - -namespace -{ - struct Options - { - enum MODE - { - LAUNCH, - STARTLAUNCH, - FINISHLAUNCH, - START, - TEARDOWN, - INVALID - }; - - Options (void) - : em_ior_ ("corbaname:rir:/NameService#ExecutionManager"), - nm_ior_ (0), - lm_ior_ (0), - xml_plan_ (0), - cdr_plan_ (0), - domain_file_ (0), - uuid_ (0), - am_ior_ (0), - app_ior_ (0), - output_ (false), - output_prefix_ (0), - mode_ (LAUNCH), - force_ (false), - quiet_ (false), - em_timeout_ (1), - domain_timeout_ (0) - {} - - const ACE_TCHAR *em_ior_; - const ACE_TCHAR *nm_ior_; - const ACE_TCHAR *lm_ior_; - const ACE_TCHAR *xml_plan_; - const ACE_TCHAR *cdr_plan_; - const ACE_TCHAR *domain_file_; - const ACE_TCHAR *uuid_; - const ACE_TCHAR *am_ior_; - const ACE_TCHAR *app_ior_; - bool output_; - const ACE_TCHAR *output_prefix_; - MODE mode_; - bool force_; - bool quiet_; - int em_timeout_; - int domain_timeout_; - }; -} - - -void -usage(const ACE_TCHAR*) -{ - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Plan Launcher Options :\n") - ACE_TEXT ("\t-k|--em-ior <EM IOR>\t\t") - ACE_TEXT ("ExecutionManager IOR for EM based deployment.\n") - ACE_TEXT ("\t-n|--nm-ior <NodeManager IOR>\t") - ACE_TEXT ("NodeManager IOR for NM based deployment.\n") - ACE_TEXT ("\t--lm-ior <LocalityManager IOR>\t") - ACE_TEXT ("LocalityManager IOR for LM based deployment.\n") - ACE_TEXT ("\t--manager-timeout <seconds>\t\n") - ACE_TEXT ("Number of seconds to wait for a valid Execution Manager reference.\n") - ACE_TEXT ("\t--domain-timeout <seconds>\t") - ACE_TEXT ("Number of seconds to wait for a domain validation.\n") - ACE_TEXT ("\t--domain-file <cdd>\t") - ACE_TEXT ("The domain file that the plan launcher should use for domain validation\n") - /* - ACE_TEXT ("\nName Service Options\n") - ACE_TEXT ("\t--domain-nc [NC]\t\t) - ACE_TEXT (Domain Naming Context (default will rir NameService)\n") - ACE_TEXT ("\t--instance-nc [NC]\t\t") - ACE_TEXT("Instance Naming Context (default will rir NameService)\n") - */ - ACE_TEXT ("\nPlan Identification Options:\n") - ACE_TEXT ("\t-c|--cdr-plan <CDR Deployment Plan>\n") - ACE_TEXT ("\t-x|--xml-plan <XML Deployment Plan>\n") - - ACE_TEXT ("\t-u|--plan-uuid <PLAN UUID>\t") - ACE_TEXT ("Only supported for EM-based deployments\n") - - ACE_TEXT ("\t-a|--app-ior <APP IOR>\t\t") - ACE_TEXT ("IOR for Application entity (Domain or Node)\n") - - ACE_TEXT ("\t-m|--am-ior <AM IOR>\t\t") - ACE_TEXT ("IOR For ApplicationManager entity (Domain or Node)\n") - - ACE_TEXT ("\nPlan Control Options:\n") - ACE_TEXT ("The default action is to fully launch a plan. ") - ACE_TEXT ("The following options may be used\n") - ACE_TEXT ("to arrive at a different state\n") - ACE_TEXT ("\t-l|--launch-plan\t\t") - ACE_TEXT ("Launch the plan (Requires CDR/XML plan)\n") - - ACE_TEXT ("\t-s|--stop-plan\t\t\tStop the plan ") - ACE_TEXT ("(Requires Plan, UUID, or APP/AM references\n") - - ACE_TEXT ("\t-f|--force\t\t\tDo not stop teardown on errors") - - ACE_TEXT ("\nOther Options\n") - ACE_TEXT ("\t-o|--output[prefix]\t\tOutput IOR files ") - ACE_TEXT ("that result from plan control action, ") - ACE_TEXT ("if any. Optional prefix to filename defaults ") - ACE_TEXT ("to plan UUID if plan is provided. ") - ACE_TEXT ("Default is on for NM-based deployments.\n") - - ACE_TEXT ("\t-q|--quiet\t\t\tSuppress error messages.\n") - ACE_TEXT ("\t-h|--help\t\t\tShow this usage information\n") - )); -} - -bool -parse_args(int argc, ACE_TCHAR *argv[], Options &options) -{ - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("PL options : \""))); - - for (int i = 0; i < argc; ++i) - { - DANCE_TRACE_LOG (DANCE_LOG_TRACE, (LM_TRACE, "\t%s\n", argv[i])); - } - - ACE_Get_Opt get_opt(argc, argv, - ACE_TEXT ("k:n:c:x:u:m:a:lsfqo::h")); - get_opt.long_option(ACE_TEXT("em-ior"), 'k', ACE_Get_Opt::ARG_REQUIRED); - get_opt.long_option(ACE_TEXT("nm-ior"), 'n', ACE_Get_Opt::ARG_REQUIRED); - get_opt.long_option(ACE_TEXT("lm-ior"), ACE_Get_Opt::ARG_REQUIRED); - get_opt.long_option(ACE_TEXT("xml-plan"), 'x', ACE_Get_Opt::ARG_REQUIRED); - get_opt.long_option(ACE_TEXT("cdr-plan"), 'c', ACE_Get_Opt::ARG_REQUIRED); - get_opt.long_option(ACE_TEXT("plan-uuid"), 'u', ACE_Get_Opt::ARG_REQUIRED); - get_opt.long_option(ACE_TEXT("am-ior"), 'm', ACE_Get_Opt::ARG_REQUIRED); - get_opt.long_option(ACE_TEXT("app-ior"), 'a', ACE_Get_Opt::ARG_REQUIRED); - get_opt.long_option(ACE_TEXT("launch-plan"), 'l', ACE_Get_Opt::NO_ARG); - get_opt.long_option(ACE_TEXT("stop-plan"), 's', ACE_Get_Opt::NO_ARG); - get_opt.long_option(ACE_TEXT("force"), 'f', ACE_Get_Opt::NO_ARG); - get_opt.long_option(ACE_TEXT("quiet"), 'q', ACE_Get_Opt::NO_ARG); - get_opt.long_option(ACE_TEXT("output"), 'o', ACE_Get_Opt::ARG_OPTIONAL); - get_opt.long_option(ACE_TEXT("help"), 'h', ACE_Get_Opt::NO_ARG); - get_opt.long_option(ACE_TEXT("manager-timeout"), ACE_Get_Opt::ARG_REQUIRED); - get_opt.long_option(ACE_TEXT("domain-timeout"), ACE_Get_Opt::ARG_REQUIRED); - get_opt.long_option(ACE_TEXT("domain-file"), ACE_Get_Opt::ARG_REQUIRED); - - int c; - ACE_CString s; - while ( (c = get_opt ()) != EOF) - { - switch (c) - { - case 'k': - if (get_opt.opt_arg () == 0) - { - options.em_ior_ = ACE_TEXT ("corbaname:rir:/NameService#ExecutionManager"); - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, (LM_DEBUG, DLINFO - ACE_TEXT ("Plan_Launcher::parse_args - ") - ACE_TEXT ("Defaulting to NameService lookup") - ACE_TEXT ("of ExecutionManager\n"))); - } - else - { - options.em_ior_ = get_opt.opt_arg (); - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, (LM_DEBUG, DLINFO - ACE_TEXT ("Plan_Launcher::parse_args - ") - ACE_TEXT ("Using ExecutionManager IOR: %s\n"), - options.em_ior_)); - } - break; - - case 'n': - options.em_ior_ = 0; - options.nm_ior_ = get_opt.opt_arg (); - options.output_ = true; - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, (LM_DEBUG, DLINFO - ACE_TEXT ("Plan_Launcher::parse_args - ") - ACE_TEXT ("Using NodeManager IOR: %s\n"), - options.nm_ior_)); - break; - - case 'x': - options.xml_plan_ = get_opt.opt_arg (); - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, (LM_DEBUG, DLINFO - ACE_TEXT ("Plan_Launcher::parse_args - ") - ACE_TEXT ("Using XML plan: %s\n"), - options.xml_plan_)); - break; - - case 'c': - options.cdr_plan_ = get_opt.opt_arg (); - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, (LM_DEBUG, DLINFO - ACE_TEXT ("Plan_Launcher::parse_args - ") - ACE_TEXT ("Using CDR plan: %s\n"), - options.cdr_plan_)); - break; - - case 'u': - options.uuid_ = get_opt.opt_arg (); - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, (LM_DEBUG, DLINFO - ACE_TEXT ("Plan_Launcher::parse_args - ") - ACE_TEXT ("Using UUID: %s\n"), - options.uuid_)); - break; - - case 'm': - options.am_ior_ = get_opt.opt_arg (); - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, (LM_DEBUG, DLINFO - ACE_TEXT ("Plan_Launcher::parse_args - ") - ACE_TEXT ("Using ApplicationManager IOR %s\n"), - options.am_ior_)); - break; - - case 'a': - options.app_ior_ = get_opt.opt_arg (); - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, (LM_DEBUG, DLINFO - ACE_TEXT ("Plan_Launcher::parse_args - ") - ACE_TEXT ("Application IOR: %s\n"), - options.app_ior_)); - break; - - case 'l': - options.mode_ = Options::LAUNCH; - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, (LM_DEBUG, DLINFO - ACE_TEXT ("Plan_Launcher::parse_args - ") - ACE_TEXT ("Launching nominated plan\n"))); - break; - - case 's': - options.mode_ = Options::TEARDOWN; - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, (LM_DEBUG, DLINFO - ACE_TEXT ("Plan_Launcher::parse_args - ") - ACE_TEXT ("Tearing down nominated plan\n"))); - break; - - case 'f': - options.force_ = true; - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, (LM_DEBUG, DLINFO - ACE_TEXT ("Plan_Launcher::parse_args - ") - ACE_TEXT ("Not stopping teardown on errors\n"))); - break; - - case 'o': - options.output_ = true; - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, (LM_DEBUG, DLINFO - ACE_TEXT ("Plan_Launcher::parse_args - ") - ACE_TEXT ("IOR files will be output to ") - ACE_TEXT ("the current working directory\n"))); - - if (get_opt.opt_arg () != 0) - { - options.output_prefix_ = get_opt.opt_arg (); - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, (LM_DEBUG, DLINFO - ACE_TEXT ("Plan_Launcher::parse_args - ") - ACE_TEXT ("Storing user-provided output ") - ACE_TEXT ("postfix <%s>\n"), - options.output_prefix_)); - } - - break; - - case 'q': - options.quiet_ = true; - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, (LM_DEBUG, DLINFO - ACE_TEXT ("Plan_Launcher::parse_args - ") - ACE_TEXT ("Plan_Launcher will hide all ouput") - ACE_TEXT ("messages.\n"))); - break; - case 'h': - usage (argv[0]); - return false; - - case 0: - if (ACE_OS::strcmp (get_opt.long_option (), - ACE_TEXT ("lm-ior")) == 0) - { - options.em_ior_ = 0; - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("Plan_Launcher::parse_args - ") - ACE_TEXT ("Got LM IOR file: %C"), - get_opt.opt_arg ())); - options.lm_ior_ = get_opt.opt_arg (); - break; - } - if (ACE_OS::strcmp (get_opt.long_option (), - ACE_TEXT ("domain-file")) == 0) - { - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("Plan_Launcher::parse_args - ") - ACE_TEXT ("Got domain file: %C\n"), - get_opt.opt_arg ())); - options.domain_file_ = get_opt.opt_arg (); - break; - } - if ((ACE_OS::strcmp (get_opt.long_option (), - ACE_TEXT ("manager-timeout")) == 0)) - { - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("Plan_Launcher::parse_args - ") - ACE_TEXT ("Got Manager Timeout value: %C\n"), - get_opt.opt_arg ())); - options.em_timeout_ = ACE_OS::atoi (get_opt.opt_arg ()); - break; - } - if ((ACE_OS::strcmp (get_opt.long_option (), - ACE_TEXT ("domain-timeout")) == 0)) - { - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("Plan_Launcher::parse_args - ") - ACE_TEXT ("Got Manager Timeout value: %C\n"), - get_opt.opt_arg ())); - options.domain_timeout_ = ACE_OS::atoi (get_opt.opt_arg ()); - break; - } - - default: - usage (argv[0]); - return false; - } - } - - /// Sanity checking on the options. - - // In all cases, we need to have a EM/NM IOR specified, but only one. - if ((!options.em_ior_ && !options.nm_ior_ && !options.lm_ior_) || - (options.em_ior_ && options.nm_ior_ && options.lm_ior_)) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, DLINFO ACE_TEXT ("Plan_launcher::parse_args - ") - ACE_TEXT ("Error: Must specify either EM IOR, NM IOR, LM IOR\n"))); - return false; - } - - // Launching plans requires a plan (duh), and only one plan - if ((options.mode_ == Options::LAUNCH) && - ((!options.xml_plan_ && !options.cdr_plan_) || - (options.xml_plan_ && options.cdr_plan_))) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::parse_args - ") - ACE_TEXT ("Error: Launching plans requires ") - ACE_TEXT ("exactly one type of plan (CDR/XML) be ") - ACE_TEXT ("specified.\n"))); - return false; - } - - // tearing down plans requires a bit more complex set of options: - if ((options.mode_ == Options::TEARDOWN) - // Either way (EM/NM), we ca use a combination of a AM and a APP. - && !( - (options.am_ior_ && options.app_ior_) || - // If we are tearing down from EM, we have more options, namely: - // A plan of some kind - (options.em_ior_ && - ( - ((!options.xml_plan_ && !options.cdr_plan_) || - (options.xml_plan_ && options.cdr_plan_)) || - // A UUID - (!options.uuid_) - ) - ) - ) - ) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::parse_args - ") - ACE_TEXT ("Invalid set of plan identification ") - ACE_TEXT ("as required for teardown\n"))); - return false; - } - - - return true; -} - -bool -write_IOR (const ACE_TCHAR * ior_file_name, const char* ior) -{ - FILE* ior_output_file_ = ACE_OS::fopen (ior_file_name, ACE_TEXT("w")); - - if (ior_output_file_) - { - ACE_OS::fprintf (ior_output_file_, "%s", ior); - ACE_OS::fclose (ior_output_file_); - return true; - } - return false; -} - -int -launch_plan (const Options &opts, - DAnCE::Plan_Launcher_Base *pl_base, - const ::Deployment::DeploymentPlan *plan, - CORBA::ORB_ptr orb) -{ - DANCE_TRACE ("launch_plan"); - - try - { - CORBA::Object_var app_mgr, app; - - CORBA::String_var - uuid_safe (pl_base->launch_plan (*plan, app_mgr.out () , app.out ())); - ACE_CString uuid = uuid_safe.in (); - - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_NOTICE, DLINFO - ACE_TEXT ("Plan_Launcher::launch_plan - ") - ACE_TEXT ("Successfully deployed plan ") - ACE_TEXT ("with UUID: <%C>\n"), - uuid.c_str ())); - - if (!opts.output_) - return 0; - - ACE_TString am_output, app_output; - - if (opts.output_prefix_) - am_output = app_output = opts.output_prefix_; - else - am_output = app_output = ACE_TEXT_CHAR_TO_TCHAR (uuid.c_str ()); - - am_output += ACE_TEXT ("_AM.ior"); - app_output += ACE_TEXT ("_APP.ior"); - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT ("Plan_Launcher::launch_plan - ") - ACE_TEXT ("Writing Application Manager IOR to <%s>\n"), - am_output.c_str ())); - CORBA::String_var tmp = orb->object_to_string (app_mgr.in ()); - write_IOR (am_output.c_str (), - tmp.in ()); - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT ("Plan_Launcher::launch_plan - ") - ACE_TEXT ("Writing Application IOR to <%s>\n"), - am_output.c_str ())); - - tmp = orb->object_to_string (app.in ()); - write_IOR (app_output.c_str (), - tmp.in ()); - - } - catch (const DAnCE::Deployment_Failure &ex) - { - if (!opts.quiet_) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::launch_plan - ") - ACE_TEXT ("Deployment failed, exception: %C\n"), - ex.ex_.c_str ())); - } - - return 1; - } - catch (const Deployment::PlanError &ex) - { - if (!opts.quiet_) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::launch_plan - ") - ACE_TEXT ("Caught PlanError exception: %C, %C\n"), - ex.name.in (), - ex.reason.in () - )); - } - return 1; - } - catch (const Deployment::StartError &ex) - { - if (!opts.quiet_) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::launch_plan - ") - ACE_TEXT ("Caught PlanError exception: %C, %C\n"), - ex.name.in (), - ex.reason.in () - )); - } - return 1; - } - catch (const Deployment::StopError &ex) - { - if (!opts.quiet_) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::launch_plan - ") - ACE_TEXT ("Caught PlanError exception: %C, %C\n"), - ex.name.in (), - ex.reason.in () - )); - } - return 1; - } - catch (const CORBA::Exception &ex) - { - if (!opts.quiet_) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::launch_plan - ") - ACE_TEXT ("Deployment failed, caught CORBA exception %C\n"), - ex._info ().c_str ())); - } - return 1; - } - catch (...) - { - if (!opts.quiet_) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher::launch_plan - ") - ACE_TEXT ("Deployment failed, ") - ACE_TEXT ("caught unknown C++ exception\n"))); - } - return 1; - } - - return 0; -} - -int -teardown_plan (const Options &opts, - DAnCE::Plan_Launcher_Base *pl_base, - const ::Deployment::DeploymentPlan *plan, - CORBA::ORB_ptr orb) -{ - DANCE_TRACE ("teardown_plan"); - - int rc = 0; - try - { - CORBA::Object_var am; - CORBA::Object_var app; - if (opts.am_ior_ && opts.app_ior_) - { - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT ("Plan_Launcher::teardown_plan - ") - ACE_TEXT ("Tearing down plan with explicitly ") - ACE_TEXT ("nominated App and AM IORs.\n"))); - am = orb->string_to_object (opts.am_ior_); - app = orb->string_to_object (opts.app_ior_); - } - else - { - // Need to perform lookup by uuid, - // either explicitly provided or in plan. - ACE_CString uuid; - if (plan) - uuid = plan->UUID.in (); - else - uuid = ACE_TEXT_ALWAYS_CHAR (opts.uuid_); - - DAnCE::EM_Launcher *em_launcher = - dynamic_cast <DAnCE::EM_Launcher *> (pl_base); - - if (!em_launcher) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Plan_Launcher::teardown_plan - ") - ACE_TEXT ("Error: Attempting UUID lookup on non") - ACE_TEXT ("-EM managed plan not supported\n"))); - return 1; - } - - if (em_launcher->lookup_by_uuid (uuid.c_str (), - am.out (), - app.out ())) - { - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT ("Plan_Launcher::teardown_plan - ") - ACE_TEXT ("Tearing down plan with UUID %C\n"), - uuid.c_str ())); - } - else - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Plan_Launcher::teardown_plan - ") - ACE_TEXT ("Error: Lookup by UUID failed\n"))); - return 1; - } - } - - try - { - pl_base->teardown_application (am, app); - } - catch (const DAnCE::Deployment_Failure &ex) - { - if (!opts.quiet_) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO - ACE_TEXT ("Plan_Launcher::teardown_plan - ") - ACE_TEXT ("Application Teardown failed, exception: %C\n"), - ex.ex_.c_str ())); - } - rc = 1; - } - catch (const CORBA::Exception &ex) - { - if (!opts.quiet_) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO - ACE_TEXT ("Plan_Launcher::teardown_plan - ") - ACE_TEXT ("Application Teardown failed, ") - ACE_TEXT ("caught CORBA exception %C\n"), - ex._info ().c_str ())); - } - rc = 1; - } - catch (...) - { - if (!opts.quiet_) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO - ACE_TEXT ("Plan_Launcher::teardown_plan - ") - ACE_TEXT ("Application Teardown failed, ") - ACE_TEXT ("caught unknown C++ exception\n"))); - } - rc = 1; - } - - if (rc == 0 || opts.force_) - pl_base->destroy_app_manager (am); - } - catch (const DAnCE::Deployment_Failure &ex) - { - if (!opts.quiet_) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO - ACE_TEXT ("Plan_Launcher::teardown_plan - ") - ACE_TEXT ("Teardown failed, exception: %C\n"), - ex.ex_.c_str ())); - } - return 1; - } - catch (const CORBA::Exception &ex) - { - if (!opts.quiet_) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO - ACE_TEXT ("Plan_Launcher::teardown_plan - ") - ACE_TEXT ("Teardown failed, caught CORBA exception %C\n"), - ex._info ().c_str ())); - } - return 1; - } - catch (...) - { - if (!opts.quiet_) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO - ACE_TEXT ("Plan_Launcher::teardown_plan - ") - ACE_TEXT ("Teardown failed, ") - ACE_TEXT ("caught unknown C++ exception\n"))); - } - return 1; - } - - return rc; -} - -template <typename Manager> -typename Manager::_ptr_type -resolve_manager (ACE_Time_Value timeout, const ACE_TCHAR * ior, CORBA::ORB_ptr orb) -{ - ACE_Time_Value retry (0, 1000000 / 4); - - CORBA::Object_var obj; - typename Manager::_var_type tmp_em; - - ACE_CString last_error; - - do - { - try - { - obj = orb->string_to_object (ior); - - if (CORBA::is_nil (obj)) - { - ACE_OS::sleep (retry); - } - else - break; - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_WARNING, - (LM_ERROR, DLINFO, ACE_TEXT ("Plan_Launcher - ") - ACE_TEXT ("Caught CORBA Exception while resolving Manager object reference: %C\n"), - ex._info ().c_str ())); - last_error = ex._info (); - } - } while (ACE_OS::gettimeofday () < timeout); - - tmp_em = Manager::_narrow (obj); - - if (CORBA::is_nil (tmp_em.in ())) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher - ") - ACE_TEXT ("Unable to resolve ") - ACE_TEXT ("Manager reference <%s>, %C\n"), - ior, - last_error.c_str ())); - return 0; - } - - bool non_existant (false); - - do { - try - { - non_existant = tmp_em->_non_existent (); - - if (!non_existant) - break; - ACE_OS::sleep (retry); - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_WARNING, - (LM_ERROR, DLINFO, ACE_TEXT ("Plan_Launcher - ") - ACE_TEXT ("Caught CORBA Exception while resolving Manager object reference: %C\n"), - ex._info ().c_str ())); - last_error = ex._info (); - } - } while (ACE_OS::gettimeofday () < timeout); - - if (non_existant) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_EMERGENCY, DLINFO, ACE_TEXT ("Plan_Launcher - ") - ACE_TEXT ("Unable to validate connection to Manager: %C\n"), - last_error.c_str ())); - return 0; - } - - return tmp_em._retn (); -} - -struct ORB_Destroyer -{ - ORB_Destroyer (CORBA::ORB_var &orb) : - orb_ (orb) - { - } - - ~ORB_Destroyer (void) - { - orb_->destroy (); - } - CORBA::ORB_var &orb_; -}; - -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - DANCE_DISABLE_TRACE (); - - int retval = 0; - - Options options; - - try - { - CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); - ORB_Destroyer safe_orb (orb); - - DAnCE::Logger_Service * dlf = - ACE_Dynamic_Service<DAnCE::Logger_Service>::instance ("DAnCE_Logger"); - - if (dlf) - { - dlf->init (argc, argv); - } - - if (!parse_args (argc, argv, options)) - { - return 1; - } - - - auto_ptr<DAnCE::Plan_Launcher_Base> pl_base (0); - - - Deployment::DeploymentPlan_var dp; - - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_DEBUG, DLINFO ACE_TEXT ("Plan_Launcher - ") - ACE_TEXT ("Parsing deployment plan\n"))); - if (options.cdr_plan_) - { - dp = DAnCE::Convert_Plan::read_cdr_plan (options.cdr_plan_); - if (!dp.ptr ()) - { - if (!options.quiet_) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO - ACE_TEXT ("PlanLauncher - ") - ACE_TEXT ("Error: Unable to read ") - ACE_TEXT ("in CDR plan\n"))); - } - return 1; - } - } - else if (options.xml_plan_) - { - dp = DAnCE::Convert_Plan::read_xml_plan (options.xml_plan_); - - if (!dp.ptr ()) - { - if (!options.quiet_) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO - ACE_TEXT ("PlanLauncher - Error: ") - ACE_TEXT ("Unable to read in XML plan\n"))); - } - return 1; - } - } - - if (options.domain_file_) - { - ::DAnCE::Config_Handlers::XML_File_Intf file (options.domain_file_); - file.add_search_path (ACE_TEXT ("DANCE_ROOT"), ACE_TEXT ("/docs/schema/")); - ::Deployment::Domain *plan = file.release_domain (); - - if (!plan) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("PlanLauncher - Error - ") - ACE_TEXT("Error: Processing file <%C>\n"), options.domain_file_)); - return false; - } - - DAnCE_Domain_Validator_i validator (orb); - validator.load_domain (*plan); - - ::DAnCE::Time_Value tv; - tv.seconds (options.domain_timeout_); - CORBA::StringSeq_var late_nodes; - - if (!validator.block_for_domain (tv, late_nodes.out ())) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, DLINFO - ACE_TEXT ("PlanLauncher - Error: ") - ACE_TEXT ("Not all nodes in domain ready\n"))); - - for (CORBA::ULong i = 0; i < late_nodes->length (); ++i) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, DLINFO - ACE_TEXT ("PlanLauncher - Error: ") - ACE_TEXT ("Node <%C> is not started\n"), - late_nodes[i].in ())); - } - return 1; - } - } - - ACE_Time_Value timeout (ACE_OS::gettimeofday () + ACE_Time_Value (options.em_timeout_)); - - if (options.em_ior_) - { - // Resolve ExecutionManager IOR for EM base deployment. - DAnCE::EM_Launcher *em_pl (0); - - - Deployment::ExecutionManager_var tmp_em = - resolve_manager<Deployment::ExecutionManager> (timeout, - options.em_ior_, - orb); - - if (CORBA::is_nil (tmp_em)) - { - DANCE_ERROR(DANCE_LOG_EMERGENCY, - (LM_ERROR, DLINFO - ACE_TEXT ("Plan_Launcher - ") - ACE_TEXT ("Unable to resolve EM object reference\n"))); - return 0; - } - - ACE_NEW_THROW_EX (em_pl, - DAnCE::EM_Launcher (orb.in (), - tmp_em.in ()), - CORBA::NO_MEMORY ()); - - pl_base.reset (em_pl); - } - else if (options.nm_ior_) - { - // Resolve NM IOR for NM based deployment. - DAnCE::NM_Launcher *nm_pl (0); - - CORBA::Object_var obj = orb->string_to_object (options.nm_ior_); - Deployment::NodeManager_var tmp_em = - Deployment::NodeManager::_narrow (obj); - - if (CORBA::is_nil (tmp_em.in ())) - { - if (!options.quiet_) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher - ") - ACE_TEXT ("Unable to resolve ") - ACE_TEXT ("NodeManager reference <%s>\n"), - options.nm_ior_)); - } - return 1; - } - - ACE_NEW_THROW_EX (nm_pl, - DAnCE::NM_Launcher (orb.in (), - tmp_em.in ()), - CORBA::NO_MEMORY ()); - - pl_base.reset (nm_pl); - } - else if (options.lm_ior_) - { - // Resolve NM IOR for NM based deployment. - DAnCE::LM_Launcher *lm_pl (0); - - CORBA::Object_var obj = orb->string_to_object (options.lm_ior_); - DAnCE::LocalityManager_var tmp_em = - DAnCE::LocalityManager::_narrow (obj); - - if (CORBA::is_nil (tmp_em.in ())) - { - if (!options.quiet_) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher - ") - ACE_TEXT ("Unable to resolve ") - ACE_TEXT ("LocalityManager reference <%s>\n"), - options.lm_ior_)); - } - return 1; - } - - ACE_NEW_THROW_EX (lm_pl, - DAnCE::LM_Launcher (orb.in (), - tmp_em.in ()), - CORBA::NO_MEMORY ()); - - pl_base.reset (lm_pl); - } - - - - switch (options.mode_) - { - case Options::LAUNCH: - retval = launch_plan (options, pl_base.get (), dp, orb.in ()); - - break; - - case Options::TEARDOWN: - retval = teardown_plan (options, pl_base.get (), dp, orb.in ()); - break; - - default: - if (!options.quiet_) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher -") - ACE_TEXT ("Mode not yet supported\n"))); - } - break; - - }; - } - catch (const Deployment::PlanError &ex) - { - if (!options.quiet_) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ("PlanLauncher - ") - ACE_TEXT ("Error in plan: <%C>, <%C>\n"), - ex.name.in (), - ex.reason.in ())); - } - retval = -1; - } - catch (const DAnCE::Deployment_Failure& e) - { - if (!options.quiet_) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ("PlanLauncher - ") - ACE_TEXT ("Error: %C.\n"), e.ex_.c_str())); - } - retval = 1; - } - catch (const CORBA::Exception& ex) - { - if (!options.quiet_) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_ERROR, DLINFO ACE_TEXT ( "PlanLauncher - ") - ACE_TEXT ("Error: %C\n"), ex._info ().c_str ())); - } - retval = 1; - } - catch (...) - { - if (!options.quiet_) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, ACE_TEXT ("PlanLauncher - ") - ACE_TEXT ("Error: Unknown exception.\n"))); - } - retval = 1; - } - - return retval; -} diff --git a/DAnCE/dance/Plan_Launcher/Plan_Launcher.mpc b/DAnCE/dance/Plan_Launcher/Plan_Launcher.mpc deleted file mode 100644 index 7fdc53a1ba2..00000000000 --- a/DAnCE/dance/Plan_Launcher/Plan_Launcher.mpc +++ /dev/null @@ -1,28 +0,0 @@ -// -*- MPC -*- -project(DAnCE_Plan_Launcher_Impl) : install_lib, dance_lib, dance_logger, dance_convert_plan, \ - dance_executionmanager_stub, \ - dance_domainapplication_stub, \ - dance_domainapplicationmanager_stub, \ - dance_nodeapplication_stub, \ - dance_nodeapplicationmanager_stub, \ - dance_nodemanager_stub, dance_stub { - - dynamicflags += DANCE_PLAN_LAUNCHER_BUILD_DLL - - Source_Files { - EM_Launcher.cpp - NM_Launcher.cpp - LM_Launcher.cpp - } - - Template_Files { - Plan_Launcher_Base_Impl_T.cpp - } -} - -project(Plan_Launcher_Exec) : dance_domain_validator, install, dance_exe, dance_plan_launcher { - exename = dance_plan_launcher - Source_Files { - Plan_Launcher.cpp - } -} diff --git a/DAnCE/dance/Plan_Launcher/Plan_Launcher_Base.h b/DAnCE/dance/Plan_Launcher/Plan_Launcher_Base.h deleted file mode 100644 index 09264934fde..00000000000 --- a/DAnCE/dance/Plan_Launcher/Plan_Launcher_Base.h +++ /dev/null @@ -1,56 +0,0 @@ -/** - * @file Plan_Launcher_Base.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - * - * ABC for the EM/NM bridges. - */ - -#ifndef DANCE_PLAN_LAUNCHER_BASE -#define DANCE_PLAN_LAUNCHER_BASE - -#include "dance/Deployment/Deployment_DeploymentPlanC.h" -#include "dance/Deployment/Deployment_ConnectionC.h" -#include "dance/Plan_Launcher/Plan_Launcher_Export.h" - -namespace DAnCE -{ - class DAnCE_Plan_Launcher_Export Plan_Launcher_Base - { - public: - virtual ~Plan_Launcher_Base (void) {}; - - /// Fully launches a nominated plan, returning valid object references to - /// the ApplicationManager and Application objects if successful. - virtual const char * launch_plan (const ::Deployment::DeploymentPlan &plan, - CORBA::Object_out am, - CORBA::Object_out app) = 0; - - /// Invokes prepareplan for the provided plan, returning a reference to - /// the ApplicationManager. - virtual CORBA::Object_ptr prepare_plan (const ::Deployment::DeploymentPlan &plan) = 0; - - /// Invokes startLaunch on the provided ApplicationManager reference. - virtual CORBA::Object_ptr start_launch (CORBA::Object_ptr app_mgr, - const ::Deployment::Properties &properties, - ::Deployment::Connections_out connections) = 0; - - /// Invokes finishLaunch on the provided Application reference. - virtual void finish_launch (CORBA::Object_ptr application, - const ::Deployment::Connections &provided_connections, - bool start) = 0; - - /// Invokes start on the provided application reference. - virtual void start (CORBA::Object_ptr application) = 0; - - /// Tears down a plan given an applicationmanafger and Application - /// reference pair. - virtual void teardown_application (CORBA::Object_ptr app_mgr, - CORBA::Object_ptr app) = 0; - - /// Instructs the Manager to destroy the ApplicationManager. - virtual void destroy_app_manager (CORBA::Object_ptr app_mgr) = 0; - - }; -} - -#endif diff --git a/DAnCE/dance/Plan_Launcher/Plan_Launcher_Base_Impl_T.cpp b/DAnCE/dance/Plan_Launcher/Plan_Launcher_Base_Impl_T.cpp deleted file mode 100644 index 6f137bd8679..00000000000 --- a/DAnCE/dance/Plan_Launcher/Plan_Launcher_Base_Impl_T.cpp +++ /dev/null @@ -1,637 +0,0 @@ -#ifndef PLAN_LAUNCHER_BASE_IMPL_CPP -#define PLAN_LAUNCHER_BASE_IMPL_CPP - -#include "Plan_Launcher_Base_Impl_T.h" - -#include "ace/Env_Value_T.h" -#include "ace/OS_NS_stdio.h" -#include "ace/Get_Opt.h" - -#include "dance/Deployment/Deployment_PlanErrorC.h" -#include "dance/Deployment/Deployment_ApplicationC.h" -#include "dance/Deployment/Deployment_ApplicationManagerC.h" -#include "dance/Logger/Log_Macros.h" - -#include "Deployment_Failure.h" - -#ifdef GEN_OSTREAM_OPS -#include <iostream> -#include <sstream> -#endif /* GEN_OSTREAM_OPS */ - -namespace DAnCE -{ - template <typename Manager, typename AppManager, typename Application> - Plan_Launcher_Base_Impl <Manager, AppManager, Application> :: - Plan_Launcher_Base_Impl(CORBA::ORB_ptr orb, - Manager_ptr manager) - : orb_ (CORBA::ORB::_duplicate (orb)), - manager_ (Manager::_duplicate (manager)) - { - DANCE_TRACE ("Plan_Launcher_Base_Impl::Plan_Launcher_Base_Impl"); - if (CORBA::is_nil (this->orb_.in ())) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher_Base_Impl::Plan_Launcher_Base_Impl - ") - ACE_TEXT ("Plan Launcher requires a valid ORB\n"))); - throw Deployment_Failure ("Plan launcher requires a valid ORB\n"); - } - - if (CORBA::is_nil (this->manager_.in ())) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher_Base_Impl::Plan_Launcher_Base_Impl - ") - ACE_TEXT ("Plan Launcher requires a valid Manager reference.\n"))); - throw Deployment_Failure ("Plan launcher requires a valid Manager reference\n"); - } - } - - template <typename Manager, typename AppManager, typename Application> - Plan_Launcher_Base_Impl < Manager, AppManager, Application> ::~Plan_Launcher_Base_Impl() - { - } - - template <typename Manager, typename AppManager, typename Application> - CORBA::Object_ptr - Plan_Launcher_Base_Impl< Manager, AppManager, Application> - ::prepare_plan (const ::Deployment::DeploymentPlan &plan) - { - DANCE_TRACE ("Plan_Launcher_Base_Impl::prepare_plan"); - -#ifdef GEN_OSTREAM_OPS - if (DAnCE_debug_level >= DANCE_LOG_DETAILED_TRACE) - { - std::ostringstream plan_stream; - plan_stream << plan << std::endl; - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, - (LM_TRACE, DLINFO "Convert_Plan - Input plan: %C\n", - plan_stream.str ().c_str ())); - } -#endif /* GEN_OSTREAM_OPS */ - - typename AppManager::_var_type app_manager; - - try - { - ::Deployment::ApplicationManager_var l_manager = - this->manager_->preparePlan (plan, 0); - app_manager = app_manager = AppManager::_narrow (l_manager.in ()); - } - catch (::Deployment::PlanError &ex) - { - ACE_CString error ("Caught PlanError exception while invoking preparePlan: "); - error += ex.name.in (); - error += ", "; - error += ex.reason.in (); - - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::prepare_plan - %C\n"), - error.c_str ())); - throw Deployment_Failure (error); - } - catch (::Deployment::StartError &ex) - { - ACE_CString error ("Caught StartError exception while invoking preparePlan: "); - error += ex.name.in (); - error += ", " ; - error += ex.reason.in (); - - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::prepare_plan - %C\n"), - error.c_str ())); - throw Deployment_Failure (error); - } - catch (::CORBA::Exception &ex) - { - ACE_CString error; - error += "Caught CORBA exception while invoking preparePlan: "; - error += ex._info (); - - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::prepare_plan - %C\n"), - error.c_str ())); - throw Deployment_Failure (error); - } - catch(...) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::prepare_plan - ") - ACE_TEXT("An exception was thrown during EM->preparePlan.\n"))); - throw Deployment_Failure ("An unexpected C++ exception was caught while invoking preparePlan"); - } - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT ("Plan_Launcher_Base_Impl::launch_plan - ") - ACE_TEXT ("after to call preparePlan\n"))); - - if (CORBA::is_nil (app_manager.in ())) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::prepare_plan - ") - ACE_TEXT("preparePlan call failed: ") - ACE_TEXT("nil ApplicationManager reference\n"))); - return 0; - } - else - { - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_DEBUG, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::prepare_plan - ") - ACE_TEXT("ApplicationMAnager was received from preparePlan.\n"))); - } - - return app_manager._retn (); -} - -template <typename Manager, typename AppManager, typename Application> -CORBA::Object_ptr -Plan_Launcher_Base_Impl< Manager, AppManager, Application> -::start_launch (CORBA::Object_ptr app_mgr, - const ::Deployment::Properties &properties, - ::Deployment::Connections_out connections) -{ - DANCE_TRACE ("Plan_Launcher_Base_Impl::start_launch"); - - AppManager_var app_manager (AppManager::_narrow (app_mgr)); - - if (CORBA::is_nil (app_manager.in ())) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO ACE_TEXT ("Plan_Launcher_Base_Impl::start_launch - ") - ACE_TEXT ("Nil ApplicationManager reference\n"))); - return 0; - } - - Deployment::Application_var da; - try - { - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::start_launch - ") - ACE_TEXT("before startLaunch...\n"))); - da = app_manager->startLaunch (properties, connections); - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::start_launch - ") - ACE_TEXT("startLaunch completed...\n"))); - } - catch (::Deployment::StartError &ex) - { - ACE_CString error; - error += "Caught StartError exception while invoking startLaunch: " ; - error += ex.name.in (); - error += ", "; - error += ex.reason.in (); - - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::start_launch - %C\n"), - error.c_str ())); - throw Deployment_Failure (error); - } - catch (::Deployment::InvalidProperty &ex) - { - ACE_CString error; - error += "Caught InvalidProperty exception while invoking startLaunch: "; - error += ex.name.in (); - error += ", "; - error += ex.reason.in (); - - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::start_launch - %C\n"), - error.c_str ())); - throw Deployment_Failure (error); - } - catch (::Deployment::InvalidNodeExecParameter &ex) - { - ACE_CString error; - error += "Caught InvalidNodeExecParameter exception while invoking startLaunch: "; - error += ex.name.in (); - error += ", "; - error += ex.reason.in (); - - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::start_launch - %C\n"), - error.c_str ())); - throw Deployment_Failure (error); - } - catch (::Deployment::InvalidComponentExecParameter &ex) - { - ACE_CString error; - error += "Caught InvalidComponentExecParameter exception while invoking startLaunch: "; - error += ex.name.in (); - error += ", "; - error += ex.reason.in (); - - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::start_launch - %C\n"), - error.c_str ())); - throw Deployment_Failure (error); - } - catch (::Deployment::ResourceNotAvailable &ex) - { - ACE_CString error; - error += "Caught ResourceNotAvailable while invoking startLaunch: "; - error += ex.name.in (); - error += ", Type: <"; - error += ex.resourceType.in (); - error += "> Property Name: <"; - error += ex.propertyName.in (); - error += "> Element: <"; - error += ex.elementName.in (); - error += "> Resource Name: <"; - error += ex.resourceName.in (); - error += ">"; - - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::start_launch - %C\n"), - error.c_str ())); - throw Deployment_Failure (error); - } - catch (::CORBA::Exception &ex) - { - ACE_CString error; - error += "Caught CORBA exception while invoking startLaunch: "; - error += ex._info ().c_str (); - - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::start_launch - %C\n"), - error.c_str ())); - throw Deployment_Failure (error); - } - catch(...) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::start_launch - ") - ACE_TEXT("An exception was thrown during DAM->startLaunch.\n"))); - throw Deployment_Failure ("Unexpected C++ exception in startLaunch\n"); - } - - if (CORBA::is_nil (da.in())) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::start_launch - ") - ACE_TEXT("CIAO_PlanLauncher:startLaunch call failed: ") - ACE_TEXT("nil DomainApplication reference\n"))); - return 0; - } - else - { - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_DEBUG, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::start_launch - ") - ACE_TEXT("DomainApplication was received from startLaunch\n"))); - } - - return da._retn (); -} - -template <typename Manager, typename AppManager, typename Application> -void -Plan_Launcher_Base_Impl< Manager, AppManager, Application> -::finish_launch (CORBA::Object_ptr app, - const ::Deployment::Connections &provided_connections, - bool start) -{ - DANCE_TRACE ("Plan_Launcher_Base_Impl::finish_launch"); - - Application_var application (Application::_narrow (app)); - - if (CORBA::is_nil (application.in ())) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::launch_plan - ") - ACE_TEXT("Nil Application reference.\n"))); - throw Deployment_Failure ("Nil Application reference"); - } - - // Call finish Launch to complete the connections - try - { - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::launch_plan - ") - ACE_TEXT("before finishLaunch\n"))); - application->finishLaunch (provided_connections, - start); - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_DEBUG, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::launch_plan - ") - ACE_TEXT("finishLaunch completed.\n"))); - } - catch (::Deployment::InvalidConnection &ex) - { - ACE_CString error; - error += "Caught InvalidConnection exception while invoking finishLaunch: "; - error += ex.name.in (); - error += ", "; - error += ex.reason.in (); - - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::finish_launch - %C\n"), - error.c_str ())); - throw Deployment_Failure (error); - } - catch (::Deployment::StartError &ex) - { - ACE_CString error; - error += "Caught StartError exception while invoking finishLaunch: "; - error += ex.name.in (); - error += ", "; - error += ex.reason.in (); - - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::finish_launch - %C\n"), - error.c_str ())); - throw Deployment_Failure (error); - } - catch (::CORBA::Exception &ex) - { - ACE_CString error; - error += "Caught CORB exception while invoking finishLaunch: "; - error += ex._info (); - - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::finish_launch - %C\n"), - error.c_str ())); - throw Deployment_Failure (error); - } - catch(...) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::finish_launch - ") - ACE_TEXT("An exception was thrown during DA->finishLaunch.\n"))); - throw Deployment_Failure ("Unexpected C++ exception in finishLaunch"); - } -} - -template <typename Manager, typename AppManager, typename Application> -void -Plan_Launcher_Base_Impl< Manager, AppManager, Application> -::start (CORBA::Object_ptr app) -{ - DANCE_TRACE ("Plan_Launcher_Base_Impl::start"); - - Application_var application (Application::_narrow (app)); - - if (CORBA::is_nil (application.in ())) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::start - ") - ACE_TEXT("Nil Application reference.\n"))); - throw Deployment_Failure ("Nil Application reference"); - } - - try - { - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::start - ") - ACE_TEXT("before invoking start on application...\n"))); - application->start (); - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_DEBUG, - DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::start - ") - ACE_TEXT("after invoking start on application...\n"))); - } - catch (const ::Deployment::StartError &ex) - { - ACE_CString error; - error += "Caught StartError exception while invoking start: "; - error += ex.name.in (); - error += ", "; - error += ex.reason.in (); - - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::start - %C\n"), - error.c_str ())); - throw Deployment_Failure (error); - } - catch (const ::CORBA::Exception &ex) - { - ACE_CString error; - error += "Caught CORBA exception while invoking start: "; - error += ex._info ().c_str (); - - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::start - %C\n"), - error.c_str ())); - throw Deployment_Failure (error); - } - catch(...) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::start - ") - ACE_TEXT("An exception was thrown during DA->start.\n"))); - throw Deployment_Failure ("Unexpected C++ exception in start\n"); - } -} - -template <typename Manager, typename AppManager, typename Application> -const char * -Plan_Launcher_Base_Impl< Manager, AppManager, Application> -::launch_plan (const ::Deployment::DeploymentPlan &plan, - CORBA::Object_out am_out, - CORBA::Object_out app_out) -{ - DANCE_TRACE ("Plan_Launcher_Base_Impl::launch_plan"); - - try - { - CORBA::Object_var app_mgr = this->prepare_plan (plan); - - ::Deployment::Connections_var conns; - - CORBA::Object_var app = this->start_launch (app_mgr.in (), - 0, - conns.out ()); - - this->finish_launch (app.in (), - conns, - false); - - this->start (app.in ()); - - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT ("Plan_Launcher_Base_Impl::launch_plan - ") - ACE_TEXT ("Application Deployed successfully\n"))); - - am_out = app_mgr._retn (); - app_out = app._retn (); - } - catch (const CORBA::Exception& ex) - { - char buf[1024]; - ACE_OS::sprintf (buf, "Plan_Launcher_Base_Impl::launch_plan - CORBA EXCEPTION: <%s>\n", - ex._info().fast_rep()); - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO ACE_TEXT("%C"), buf)); - throw Deployment_Failure (buf); - } - catch (const Deployment_Failure &) - { - throw; - } - catch (...) - { - char buf[1024]; - ACE_OS::sprintf (buf, "Plan_Launcher_Base_Impl::launch_plan - EXCEPTION: non-CORBA exception\n"); - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO ACE_TEXT("%C"), buf)); - throw Deployment_Failure (buf); - } - - return plan.UUID.in(); -} - -template <typename Manager, typename AppManager, typename Application> -void -Plan_Launcher_Base_Impl< Manager, AppManager, Application> -::teardown_application (CORBA::Object_ptr am_obj, - CORBA::Object_ptr app_obj) -{ - DANCE_TRACE ("Plan_Launcher_Base_Impl::teardown_application"); - - AppManager_var am (AppManager::_narrow (am_obj)); - - if (CORBA::is_nil (am.in ())) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::teardown_application - ") - ACE_TEXT("Nil ApplicationManager reference.\n"))); - throw Deployment_Failure ("Nil ApplicationManager reference in teardown_application"); - } - - Application_var app (Application::_narrow (app_obj)); - - if (CORBA::is_nil (app.in ())) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::teardown_appliocation - ") - ACE_TEXT("Nil Application reference.\n"))); - throw Deployment_Failure ("Nil Application reference in teardown_application"); - } - - try - { - am->destroyApplication (app.in ()); - } - catch (const ::Deployment::StopError &ex) - { - ACE_CString error; - error += "Caught StopError exception while invoking destroyApplication: "; - error += ex.name.in (); - error += ", "; - error += ex.reason.in (); - - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::teardown_application - %C\n"), - error.c_str ())); - throw Deployment_Failure (error); - } - catch (const CORBA::Exception &ex) - { - ACE_CString error; - error += "Caught CORBA exception while invoking destroyApplication: "; - error += ex._info ().c_str (); - - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::teardown_application - %C\n"), - error.c_str ())); - throw Deployment_Failure (error); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::teardown_appliocation - ") - ACE_TEXT ("Caught unknown C++ exception\n"))); - throw Deployment_Failure ("Unknown C++ exception\n"); - } -} - -template <typename Manager, typename AppManager, typename Application> -void -Plan_Launcher_Base_Impl< Manager, AppManager, Application>::destroy_app_manager(CORBA::Object_ptr am_obj) -{ - DANCE_TRACE ("Plan_Launcher_Base_Impl::destroy_app_manager"); - - AppManager_var am (AppManager::_narrow (am_obj)); - - if (CORBA::is_nil (am.in ())) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::destroy_app_manager - ") - ACE_TEXT("Nil ApplicationManager reference.\n"))); - throw Deployment_Failure ("Nil ApplicationManager reference in destroy_app_manager"); - } - - try - { - DANCE_ERROR (DANCE_LOG_MINOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::destroy_app_manager - ") - ACE_TEXT ("Destroying ApplicationManager\n"))); - this->manager_->destroyManager (am.in ()); - DANCE_ERROR (DANCE_LOG_MINOR_EVENT, - (LM_DEBUG, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::destroy_app_manager - ") - ACE_TEXT ("ApplicationManager destroyed.\n"))); - } - catch (const ::Deployment::StopError &ex) - { - ACE_CString error; - error += "Caught StopError exception while invoking destroyManager: "; - error += ex.name.in (); - error += ", "; - error += ex.reason.in (); - - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::destory_app_manager - %C\n"), - error.c_str ())); - throw Deployment_Failure (error); - } - catch (const CORBA::Exception &ex) - { - ACE_CString error; - error += "Caught CORBA exception while invoking destroyManager: "; - error += ex._info ().c_str (); - - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT("Plan_Launcher_Base_Impl::destroy_app_manager - %C\n"), - error.c_str ())); - throw Deployment_Failure (error); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO ACE_TEXT("Plan_Launcher_Base_Impl::destroy_app_manager - ") - ACE_TEXT ("Caught unknown C++ exception\n"))); - throw Deployment_Failure ("Unknown C++ exception\n"); - } -} - -} -#endif diff --git a/DAnCE/dance/Plan_Launcher/Plan_Launcher_Base_Impl_T.h b/DAnCE/dance/Plan_Launcher/Plan_Launcher_Base_Impl_T.h deleted file mode 100644 index 86b46555c6d..00000000000 --- a/DAnCE/dance/Plan_Launcher/Plan_Launcher_Base_Impl_T.h +++ /dev/null @@ -1,88 +0,0 @@ -/** - * - * @file Plan_Launcher_Base_Impl_T.h - * @author William R. Otte <wotte@dre.vanderbilt.edu> - * - * Contains the generic implementation of plan launcher logic for both EM and NM deployments. - */ - -#ifndef PLAN_LAUNCHER_BASE_IMPL_H -#define PLAN_LAUNCHER_BASE_IMPL_H - -#include "dance/Deployment/Deployment_ConnectionC.h" -#include "dance/Deployment/Deployment_DeploymentPlanC.h" - -#include "Plan_Launcher_Base.h" - -namespace DAnCE -{ - /** - * @class Plan_Launcher_Base_Impl - * @brief This class launches and manages deployment plans. - */ - template<typename Manager, typename AppManager, typename Application> - class Plan_Launcher_Base_Impl : public virtual Plan_Launcher_Base - { - protected: - typedef Plan_Launcher_Base_Impl< Manager, AppManager, Application > __Type; - - typedef typename Manager::_ptr_type Manager_ptr; - typedef typename Manager::_var_type Manager_var; - - typedef typename AppManager::_ptr_type AppManager_ptr; - typedef typename AppManager::_var_type AppManager_var; - - typedef typename Application::_ptr_type Application_ptr; - typedef typename Application::_var_type Application_var; - - public: - Plan_Launcher_Base_Impl (CORBA::ORB_ptr orb, - Manager_ptr manager); - - virtual ~Plan_Launcher_Base_Impl (); - - /** - * @brief Launch a plan, given an IDL deployment plan - * @param plan A valid IDL deployment plan - * @returns a string containing the UUID of the plan. Null indicates failure. - */ - virtual const char * launch_plan (const ::Deployment::DeploymentPlan &plan, - CORBA::Object_out am, - CORBA::Object_out app); - - virtual CORBA::Object_ptr prepare_plan (const ::Deployment::DeploymentPlan &plan); - - virtual CORBA::Object_ptr start_launch (CORBA::Object_ptr app_mgr, - const ::Deployment::Properties &properties, - ::Deployment::Connections_out connections); - - virtual void finish_launch (CORBA::Object_ptr app, - const ::Deployment::Connections &provided_connections, - bool start); - - virtual void start (CORBA::Object_ptr application); - - /// Tears down a plan given the UUID - virtual void teardown_application (CORBA::Object_ptr app_mgr, - CORBA::Object_ptr app); - - virtual void destroy_app_manager (CORBA::Object_ptr); - - protected: - /// Cached ORB pointer - CORBA::ORB_var orb_; - - /// Object reference of the Manager - Manager_var manager_; - }; // class Plan_Launcher_Impl - -} -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "dance/Plan_Launcher/Plan_Launcher_Base_Impl_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("dance/Plan_Launcher_Base_Impl_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - -#endif /* PLAN_LAUNCHER_BASE_IMPL_H */ diff --git a/DAnCE/dance/Plan_Launcher/Plan_Launcher_Export.h b/DAnCE/dance/Plan_Launcher/Plan_Launcher_Export.h deleted file mode 100644 index 4bab4dc7136..00000000000 --- a/DAnCE/dance/Plan_Launcher/Plan_Launcher_Export.h +++ /dev/null @@ -1,57 +0,0 @@ - -// -*- C++ -*- -// Definition for Win32 Export directives. -// This file is generated automatically by generate_export_file.pl DAnCE_Plan_Launcher -// ------------------------------ -#ifndef DANCE_PLAN_LAUNCHER_EXPORT_H -#define DANCE_PLAN_LAUNCHER_EXPORT_H - -#include "ace/config-all.h" - -#if defined (ACE_AS_STATIC_LIBS) && !defined (DANCE_PLAN_LAUNCHER_HAS_DLL) -# define DANCE_PLAN_LAUNCHER_HAS_DLL 0 -#endif /* ACE_AS_STATIC_LIBS && DANCE_PLAN_LAUNCHER_HAS_DLL */ - -#if !defined (DANCE_PLAN_LAUNCHER_HAS_DLL) -# define DANCE_PLAN_LAUNCHER_HAS_DLL 1 -#endif /* ! DANCE_PLAN_LAUNCHER_HAS_DLL */ - -#if defined (DANCE_PLAN_LAUNCHER_HAS_DLL) && (DANCE_PLAN_LAUNCHER_HAS_DLL == 1) -# if defined (DANCE_PLAN_LAUNCHER_BUILD_DLL) -# define DAnCE_Plan_Launcher_Export ACE_Proper_Export_Flag -# define DANCE_PLAN_LAUNCHER_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) -# define DANCE_PLAN_LAUNCHER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# else /* DANCE_PLAN_LAUNCHER_BUILD_DLL */ -# define DAnCE_Plan_Launcher_Export ACE_Proper_Import_Flag -# define DANCE_PLAN_LAUNCHER_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) -# define DANCE_PLAN_LAUNCHER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -# endif /* DANCE_PLAN_LAUNCHER_BUILD_DLL */ -#else /* DANCE_PLAN_LAUNCHER_HAS_DLL == 1 */ -# define DAnCE_Plan_Launcher_Export -# define DANCE_PLAN_LAUNCHER_SINGLETON_DECLARATION(T) -# define DANCE_PLAN_LAUNCHER_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) -#endif /* DANCE_PLAN_LAUNCHER_HAS_DLL == 1 */ - -// Set DANCE_PLAN_LAUNCHER_NTRACE = 0 to turn on library specific tracing even if -// tracing is turned off for ACE. -#if !defined (DANCE_PLAN_LAUNCHER_NTRACE) -# if (ACE_NTRACE == 1) -# define DANCE_PLAN_LAUNCHER_NTRACE 1 -# else /* (ACE_NTRACE == 1) */ -# define DANCE_PLAN_LAUNCHER_NTRACE 0 -# endif /* (ACE_NTRACE == 1) */ -#endif /* !DANCE_PLAN_LAUNCHER_NTRACE */ - -#if (DANCE_PLAN_LAUNCHER_NTRACE == 1) -# define DANCE_PLAN_LAUNCHER_TRACE(X) -#else /* (DANCE_PLAN_LAUNCHER_NTRACE == 1) */ -# if !defined (ACE_HAS_TRACE) -# define ACE_HAS_TRACE -# endif /* ACE_HAS_TRACE */ -# define DANCE_PLAN_LAUNCHER_TRACE(X) ACE_TRACE_IMPL(X) -# include "ace/Trace.h" -#endif /* (DANCE_PLAN_LAUNCHER_NTRACE == 1) */ - -#endif /* DANCE_PLAN_LAUNCHER_EXPORT_H */ - -// End of auto generated file. diff --git a/DAnCE/dance/RepositoryManager/.gitignore b/DAnCE/dance/RepositoryManager/.gitignore deleted file mode 100644 index b9859194d93..00000000000 --- a/DAnCE/dance/RepositoryManager/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -/dance_repository_manager -/dance_rm_admin -/RepositoryManagerDaemonC.cpp -/RepositoryManagerDaemonC.h -/RepositoryManagerDaemonC.inl -/RepositoryManagerDaemonS.cpp -/RepositoryManagerDaemonS.h diff --git a/DAnCE/dance/RepositoryManager/PC_Updater.cpp b/DAnCE/dance/RepositoryManager/PC_Updater.cpp deleted file mode 100644 index ad4919b24a8..00000000000 --- a/DAnCE/dance/RepositoryManager/PC_Updater.cpp +++ /dev/null @@ -1,245 +0,0 @@ -#include "dance/Logger/Log_Macros.h" -#include "dance/Deployment/Deployment_DataC.h" -#include "PC_Updater.h" -#include "PC_Updater_T.h" -#include "ace/Containers_T.h" //for ACE_Double_Linked_List - -namespace -{ - const size_t TEMP_LEN = 1024; -} - -using namespace PC_Updater_T; - - - //PATH of glory/gory to update the locations of the IADs - // - //PackageConfiguration something; - //ComponentPackageDescriptions basePackage; - //PackagedComponentImplementations implementation; - //ComponentImplementationDescription referencedImplementation; - // - //MONOLITHIC Component: - //MonolithicImplementationDescriptions monolithicImpl; - //NamedImplementationArtifacts primaryArtifact; - //ImplementationArtifactDescription referencedArtifact; - //::CORBA::StringSeq location; - // - //ASSEMBLY-BASED Component - //ComponentAssemblyDescriptions assemblyImpl; - //SubcomponentInstantiationDescriptions instance; - //ComponentPackageDescriptions package; - //... - - -/* - * PC_Updater Constructors - */ -PC_Updater::PC_Updater (const char* server_path, const char* package) -: server_path_ (server_path), - file_list_ (), - package_ (package), - success_ (true) -{ -} - - -PC_Updater::PC_Updater (ACE_CString& server_path, ACE_CString& package) -: server_path_ (server_path), - file_list_ (), - package_ (package), - success_ (true) -{ -} - -/* - * PC_Updater - Destructor - */ -PC_Updater::~PC_Updater () -{ - this->clear_list (); -} - - -void PC_Updater::clear_list () -{ - while (!this->file_list_.is_empty ()) - { - ZIP_File_Info* inf = this->file_list_.delete_head (); - - //deallocate the head of the filename list - delete inf; - } -} - - -/* - * PC_Updater - Object update methods - */ - - -/// PackageConfiguration -bool PC_Updater::update (::Deployment::PackageConfiguration &pc) -{ - //get the list of files in the package and figure out the names of all necessary files - if (!ZIP_Wrapper::file_list_info (const_cast <char*> (this->package_.c_str ()), this->file_list_)) - return false; - - update_sequence (pc.basePackage, this); - - return this->success_; -} - - -/// ComponentInterfaceDescription -void PC_Updater::update (::Deployment::ComponentInterfaceDescription &) -{ -} - -/// Requirement -void PC_Updater::update (::Deployment::Requirement &) -{ -} - - -/// ComponentExternalPortEndpoint -void PC_Updater::update (::Deployment::ComponentExternalPortEndpoint &) -{ -} - -/// ImplementationDependency -void PC_Updater::update (Deployment::ImplementationDependency &) -{ -} - -// ComponentPackageReference - -void PC_Updater::update (::Deployment::ComponentPackageReference &) -{ -} - -// SubcomponentInstantiationDescription - -void PC_Updater::update (::Deployment::SubcomponentInstantiationDescription &sid) -{ - update_sequence (sid.basePackage, this); -} - -// SubcomponentPortEndpoint - -void PC_Updater::update (::Deployment::SubcomponentPortEndpoint& ) -{ -} - -// AssemblyConnectionDescription - -void PC_Updater::update (::Deployment::AssemblyConnectionDescription &) -{ -} - - -// AssemblyPropertyMapping - -void -PC_Updater::update (::Deployment::AssemblyPropertyMapping &) -{ -} - -// ComponentAssemblyDescription - -void PC_Updater::update (::Deployment::ComponentAssemblyDescription& cad) -{ - update_sequence (cad.instance, this); -} - -// ImplementationArtifactDescription - -void PC_Updater::update (::Deployment::ImplementationArtifactDescription &iad) -{ - const char* location = CORBA::string_dup (iad.location[0]); - - //create an iterator - ACE_Double_Linked_List_Iterator<ZIP_File_Info> iter (this->file_list_); - - //find the correct path and return - while (!iter.done ()) - { - const char* full_path = iter.next ()->name_.c_str (); - //weird. Need to call next to get current ?!?! - - //is it an implementation artifact? - const char* name = ACE_OS::strstr (full_path, "implementations/"); - if (name) - { - //now check if the name matches - name = ACE_OS::strstr (full_path, iad.location[0]); - - if (name) - { - ACE_CString loc (this->server_path_); - loc += "/implementations/"; - loc += location; - - iad.location[0] = CORBA::string_dup (loc.c_str ()); - - //cout << "Location after update: " << iad.location[0] << endl << endl; - return; - } - } - iter++; - } - - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, - "[PC_Updater::update] Unable to update: %s!\n", - location)); - - this->success_ = false; -} - -// NamedImplementationArtifact - -void PC_Updater::update (::Deployment::NamedImplementationArtifact &nia) -{ - update (nia.referencedArtifact); -} - -// ImplementationRequirement -void PC_Updater::update (::Deployment::ImplementationRequirement &) -{ -} - -// MonolithicImplementationDescription -void PC_Updater::update (::Deployment::MonolithicImplementationDescription &mid) -{ - update_sequence (mid.primaryArtifact, this); -} - -// Capability -void PC_Updater::update (::Deployment::Capability &) -{ -} - -// ComponentImplementationDescription -void PC_Updater::update (::Deployment::ComponentImplementationDescription &cid) -{ - update_sequence (cid.assemblyImpl, this); - update_sequence (cid.monolithicImpl, this); -} - -// PackagedComponentImplementation -void PC_Updater::update (::Deployment::PackagedComponentImplementation &pci) -{ - PC_Updater::update (pci.referencedImplementation); -} - -// ComponentPackageDescription -void PC_Updater::update (::Deployment::ComponentPackageDescription &comppkgdesc) -{ - update_sequence (comppkgdesc.implementation, this); -} - - -// Property -void PC_Updater::update (Deployment::Property& ) -{ -} diff --git a/DAnCE/dance/RepositoryManager/PC_Updater.h b/DAnCE/dance/RepositoryManager/PC_Updater.h deleted file mode 100644 index ed65c8fdb19..00000000000 --- a/DAnCE/dance/RepositoryManager/PC_Updater.h +++ /dev/null @@ -1,110 +0,0 @@ - -/* -*- C++ -*- */ - -//======================================================================== -/** - * file PC_Updater.h - * - * This class is used to update the location field of the implementation - * artifacts in the PackageConfiguration, so that they point to the - * physical libraries on the collocated HTTP server - * - * author Stoyan Paunov <spaunov@isis.vanderbilt.edu> - */ -//======================================================================== - -#ifndef PC_UPDATER_H -#define PC_UPDATER_H -#include /**/ "ace/pre.h" - -#include "dance/Deployment/DeploymentC.h" -#include "dance/Deployment/Deployment_Packaging_DataC.h" -#include "ace/SString.h" //for the ACE_CString - -#include "ZIP_Wrapper.h" //Wrapper around zzip -#include "ace/Containers_T.h" //for ACE_Double_Linked_List -#include "ace/Malloc_Allocator.h" //for ACE_New_Allocator needed by the doubly link list - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -/** - * @class PC_Updater - * - * This class defines a set of overloaded methods used to update - * the contents of a PackageConfiguration. More specifically the class - * goes through the PackageConfiguration and updates the locations of the - * artifacts, wrt to their location on the HTTP server. - */ -class PC_Updater -{ -public: - - /// Constructors - PC_Updater (const char* server_path, const char* package); - PC_Updater (ACE_CString& server_path, ACE_CString& package); - - ~PC_Updater (); - - /// A whole slew of overloaded routines for different IDL - /// data types part of the PackageConfiguration. - - bool update (::Deployment::PackageConfiguration &pc); - - void update (::Deployment::Property &property); - - void update (::Deployment::AssemblyConnectionDescription &acd); - - void update (::Deployment::AssemblyPropertyMapping &apm); - - void update (::Deployment::ComponentPackageDescription &comppkgdesc); - - void update (::Deployment::MonolithicImplementationDescription &mid); - - void update (::Deployment::PackagedComponentImplementation &pci); - - void update (::Deployment::SubcomponentPortEndpoint &spe); - - void update (::Deployment::Requirement &requirement); - - void update (::Deployment::ComponentExternalPortEndpoint &cepe); - - void update (::Deployment::ComponentPackageReference &cpr); - - void update (::Deployment::ComponentImplementationDescription &cid); - - void update (::Deployment::SubcomponentInstantiationDescription &sid); - - void update (::Deployment::NamedImplementationArtifact &named_implementation); - - void update (::Deployment::ComponentInterfaceDescription &cid); - - void update (::Deployment::Capability &capability); - - void update (::Deployment::ImplementationArtifactDescription &iad); - - void update (::Deployment::ImplementationRequirement &ir); - - void update (::Deployment::ImplementationDependency &id); - - void update (::Deployment::ComponentAssemblyDescription& cad); - -protected: - - void clear_list (); - -private: - - ACE_CString server_path_; - - /// Create a doubly link list - ACE_Double_Linked_List<ZIP_File_Info> file_list_; - - ACE_CString package_; - bool success_; -}; - -#include /**/ "ace/post.h" - -#endif /* PC_UPDATER_H */ diff --git a/DAnCE/dance/RepositoryManager/PC_Updater_T.cpp b/DAnCE/dance/RepositoryManager/PC_Updater_T.cpp deleted file mode 100644 index 8f995de61f4..00000000000 --- a/DAnCE/dance/RepositoryManager/PC_Updater_T.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef PC_UPDATER_T_C -#define PC_UPDATER_T_C -#include "PC_Updater.h" -#include "PC_Updater_T.h" - -namespace PC_Updater_T -{ - /// Dumps a sequence - template <typename SEQUENCE> - void update_sequence (SEQUENCE &seq, PC_Updater* updater) - { - CORBA::ULong const size = seq.length (); - - for (CORBA::ULong i = 0; i < size; ++i) - updater->update (seq[i]); - } -} - -#endif /* PC_Updater_C */ diff --git a/DAnCE/dance/RepositoryManager/PC_Updater_T.h b/DAnCE/dance/RepositoryManager/PC_Updater_T.h deleted file mode 100644 index a4b0e94cbd3..00000000000 --- a/DAnCE/dance/RepositoryManager/PC_Updater_T.h +++ /dev/null @@ -1,38 +0,0 @@ - -/* -*- C++ -*- */ - -//================================================================== -/** - * file PC_Updater_T.h - * - * author Stoyan Paunov <spaunov@isis.vanderbilt.edu> - */ -//===================================================================== - -#ifndef CIAO_CONFIG_HANDLERS_PC_UPDATER_T_H -#define CIAO_CONFIG_HANDLERS_PC_UPDATER_T_H -#include /**/ "ace/pre.h" - -#include "ace/config-lite.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -namespace PC_Updater_T -{ - template <typename SEQUENCE> - static void update_sequence (SEQUENCE &seq); -} - -#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) -#include "PC_Updater_T.cpp" -#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ - -#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) -#pragma implementation ("PC_Updater_T.cpp") -#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ - - -#include /**/ "ace/post.h" -#endif /*CIAO_CONFIG_HANDLERS_PC_Updater_T_H*/ diff --git a/DAnCE/dance/RepositoryManager/README b/DAnCE/dance/RepositoryManager/README deleted file mode 100644 index 0d92cb4fd88..00000000000 --- a/DAnCE/dance/RepositoryManager/README +++ /dev/null @@ -1,48 +0,0 @@ - - -This is the README file for the Repository Manager (RM). - -Building RM: -In order to be able to compile the RM you need to have ZLIB lib because the RM -uses it to read the contents of CCM packages. In order to compile the RM -successfully you will need to do the following: -1.Download the binary version of ZLIB or build it yourself -3.Create an "include" and a "lib" subdirectory. Then copy the libraries files into - the "lib" subdirectory and copy zlib.h into the "include" subdirectory. -4.Set $ZLIB_ROOT to point to the directories where you placed the libraries and - the include files. -5.Turn on zzip and zlib in default.features for MPC. -6.MPC will handle the rest. - -If you want to get the component package through http server: -1.Be sure to set JAWS_DOCUMENT_ROOT to the installation path of the RepoMan, i.e., $CIAO_ROOT/DAnCE/RepositoryManager. -2.Start JAWS: $ACE_ROOT/apps/JAWS/server/main - -Start RM: -1.Using ior file: - RepositoryManagerDaemon -o -2.Using Naming Service: - RepositoryManagerDaemon -v [NameofRM] - -Using RMadmin: -1.Install component package: (use BasicSP for example) - Be sure you have BasicSP.cpk in the $CIAO_ROOT/DAnCE/RepositoryManager/packages - > RMadmin -o -n BasicSP -i -l packages/BasicSP.cpk - or - > RMadmin -o -n BasicSP -i -l http://127.0.0.1:5432/packages/BasicSP.cpk (If the JAWS is started) - This will create the BasicSP directory, BasicSP.cpk file and BasicSP.epc file in the - $CIAO_ROOT/DAnCE/RepositoryManager/RepositoryManager/ -2.Delete component package: (use BasicSP for example) - > RMadmin -o -n BasicSP -d -3.Find component package by its name: (use BasicSP for example) - > RMadmin -o -n BasicSP -f -4.Stop RM: - > RMadmin -o -s - This will create the RM_record file in the $CIAO_ROOT/DAnCE/RepositoryManager/RepositoryManager/ which record the - names and UUIDs of the installed component packages. - - - - - - diff --git a/DAnCE/dance/RepositoryManager/RM_Helper.cpp b/DAnCE/dance/RepositoryManager/RM_Helper.cpp deleted file mode 100644 index 2f7eee33cff..00000000000 --- a/DAnCE/dance/RepositoryManager/RM_Helper.cpp +++ /dev/null @@ -1,262 +0,0 @@ -#include "RM_Helper.h" -#include "ace/Auto_Ptr.h" //for Auto_Ptr -#include "ace/OS_NS_fcntl.h" //for open -#include "ace/OS_NS_unistd.h" //for close -#include "ace/OS_NS_sys_stat.h" //for filesize and mkdir -#include "ace/OS_NS_string.h" -#include "dance/Logger/Log_Macros.h" - -void -RM_Helper::pc_to_cdr (const Deployment::PackageConfiguration& pc, TAO_OutputCDR& cdr) -{ - cdr << pc; -} - - -void -RM_Helper::cdr_to_pc (Deployment::PackageConfiguration& pc, TAO_InputCDR& cdr) -{ - cdr >> pc; -} - -bool -RM_Helper::externalize (const Deployment::PackageConfiguration& pc, const char* path) -{ - size_t bufsiz = 0; - TAO_OutputCDR out (bufsiz); - - RM_Helper::pc_to_cdr (pc, out); - - const ACE_Message_Block* mb = out.begin (); - - return write_pc_to_disk (path, *(const_cast<ACE_Message_Block*> (mb))); -} - - -bool -RM_Helper::reincarnate (Deployment::PackageConfiguration& pc, const char* path) -{ - size_t length = 0; - ACE_Auto_Ptr<ACE_Message_Block> mb (read_pc_from_disk (path, length)); - - if (!mb.get ()) - return false; - - TAO_InputCDR in (mb.get ()); - - RM_Helper::cdr_to_pc (pc, in); - - return true; -} - - -/// This function attempts to copy the file from a specified location -/// to another specified location on the hard disk. -bool -RM_Helper::copy_from_disk_to_disk (const char* from_path, const char* to_path) -{ - if (ACE_OS::strcmp (from_path, to_path) == 0) - return true; - - // Open the files - ACE_HANDLE from_handle = ACE_OS::open (from_path, O_RDONLY); - if (from_handle == ACE_INVALID_HANDLE) - DANCE_ERROR_RETURN (1, (LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("[RM::copy_from_disk_to_disk] file open error")), - 0); - - ACE_stat file_info; - ACE_OS::fstat (from_handle, &file_info); - ACE_UINT64 file_length = file_info.st_size; - - ACE_HANDLE to_handle = ACE_OS::open (to_path, O_CREAT | O_TRUNC | O_WRONLY); - if (to_handle == ACE_INVALID_HANDLE) - DANCE_ERROR_RETURN (1, (LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("[RM::copy_from_disk_to_disk] file creation error")), - 0); - - - // Read the contents of the file into the buffer and write the data to another file - ACE_Message_Block *mb = 0; - size_t length; - size_t number = 0; - bool last = false; - - while (true) - { - if ((file_length - BUFSIZ*number) > BUFSIZ) - length = BUFSIZ; - else - { - length = static_cast<size_t> (file_length - BUFSIZ*number); - last = true; - } - - mb = new ACE_Message_Block (length); - - if (ACE_OS::read_n (from_handle, mb->wr_ptr (), length) == -1) - DANCE_ERROR_RETURN (1, (LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("[RM::copy_from_disk_to_disk] file read error")), - 0); - - ++number; - - mb->length (length); - - for (ACE_Message_Block *curr = mb; curr != 0; curr = curr->cont ()) - if (ACE_OS::write_n (to_handle, curr->rd_ptr (), curr->length ()) == -1) - { - mb->release (); - DANCE_ERROR_RETURN (1, (LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("[RM::copy_from_disk_to_disk] file write error")), - 0); - } - - mb->release (); - - if (last) - break; - } - - // Close the files - ACE_OS::close (from_handle); - ACE_OS::close (to_handle); - - return true; -} - - -/// This function attempts to write a sequence of bytes from an -/// ACE_Message_Block to a specified location. A 0 is returned -/// in the case of an error and a 1 upon success -bool RM_Helper::write_to_disk ( - const char* full_path, - ACE_Message_Block& mb, - bool replace - ) -{ - ACE_stat stat; - - if (ACE_OS::stat(full_path, &stat) != -1 && !replace) - return false; - - // Open a file handle to the local filesystem - ACE_HANDLE handle = ACE_OS::open (full_path, O_CREAT | O_TRUNC | O_WRONLY); - if (handle == ACE_INVALID_HANDLE) - DANCE_ERROR_RETURN (1, (LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("[RM::write_to_disk] file creation error")), - false); - - // Write the data to the file - for (ACE_Message_Block * curr = &mb; curr != 0; curr = curr->cont ()) - if (ACE_OS::write_n (handle, curr->rd_ptr(), curr->length()) == -1) - DANCE_ERROR_RETURN (1, (LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("write error")), - false); - - // Close the file handle - ACE_OS::close (handle); - - return true; -} - - -/// This function attempts to write a sequence of bytes from an -/// ACE_Message_Block to a specified location. A 0 is returned -/// in the case of an error and a 1 upon success -/// -/// @note This function write the contents in a way that preserves the -/// structure of the ACE_Message_Block. It is relevant for -/// PackageConfigurations ONLY -bool RM_Helper::write_pc_to_disk ( - const char* full_path, - ACE_Message_Block& mb, - bool replace - ) -{ - ACE_stat stat; - - if (ACE_OS::stat(full_path, &stat) != -1 && !replace) - return false; - - // Open a file handle to the local filesystem - ACE_HANDLE const handle = ACE_OS::open (full_path, O_CREAT | O_TRUNC | O_WRONLY); - if (handle == ACE_INVALID_HANDLE) - DANCE_ERROR_RETURN (1, (LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("[RM::write_to_disk] file creation error")), - false); - - // write the data to the file - for (ACE_Message_Block * curr = &mb; curr != 0; curr = curr->cont ()) - if (ACE_OS::write_n (handle, curr->rd_ptr(), curr->length()) == -1) - DANCE_ERROR_RETURN (1, (LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("write error")), - 0); - - // Close the file handle - ACE_OS::close (handle); - - return true; -} - - -/// Function to read the contents of a file from disk into an ACE_Message_Block -/// returns a pointer to an ACE_Message_Block and updates the lenght on success -/// 0 on failure -ACE_Message_Block* -RM_Helper::read_pc_from_disk ( - const char* full_path, - size_t &length - ) -{ - length = 0; - - // Open the file - ACE_HANDLE const handle = ACE_OS::open (full_path, O_RDONLY); - if (handle == ACE_INVALID_HANDLE) - DANCE_ERROR_RETURN (1, (LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("[RM::read_mb_from_disk] file open error")), - 0); - - ACE_stat file_info; - ACE_OS::fstat (handle, &file_info); - - // Get and check the length of the file - length = static_cast<size_t> (file_info.st_size); - - ACE_INT64 check = length; - if (check != file_info.st_size) - { - length = 0; - DANCE_ERROR_RETURN (1, (LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("[RM::read_mb_from_disk] file length error")), - 0); - } - - // Read the contents of the file into the buffer - ACE_Message_Block* mb = 0; - ACE_NEW_RETURN (mb, ACE_Message_Block (length + 1), 0); - - if (ACE_OS::read_n (handle, mb->wr_ptr (), length) == -1) - DANCE_ERROR_RETURN (1, (LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("[RM::read_mb_from_disk] file read error")), - 0); - - mb->length (length); - - // Close the file handle - ACE_OS::close (handle); - - return mb; -} diff --git a/DAnCE/dance/RepositoryManager/RM_Helper.h b/DAnCE/dance/RepositoryManager/RM_Helper.h deleted file mode 100644 index b22c40736ea..00000000000 --- a/DAnCE/dance/RepositoryManager/RM_Helper.h +++ /dev/null @@ -1,75 +0,0 @@ - -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file RM_Helper.h - * - * This class aggregates a number of helper functions used by the - * CIAO RepositoryManager - * - * @author Stoyan Paunov - */ -//============================================================================= - -#ifndef RM_HELPER_H_ -#define RM_HELPER_H_ - -#include "dance/Deployment/Deployment_Packaging_DataC.h" -#include "tao/CDR.h" -#include "ace/Message_Block.h" - - -class RM_Helper -{ -public: - - static void pc_to_cdr (const Deployment::PackageConfiguration& pc, TAO_OutputCDR& cdr); - - static void cdr_to_pc (Deployment::PackageConfiguration& pc, TAO_InputCDR& cdr); - - static bool externalize (const Deployment::PackageConfiguration& pc, const char* path); - - static bool reincarnate (Deployment::PackageConfiguration& pc, const char* path); - - /** - * Function that copies the file from a specified location to another - * specified location on the hard disk. - * @retval true on success - * @retval false on error - */ - static bool copy_from_disk_to_disk (const char* from_path, const char* to_path); - - /** - * Function that writes out a file to a specified location on the hard disk - * @retval true on success - * @retval false on already exists and replace == false - * @retval false on error - */ - static bool write_to_disk (const char* full_path, - ACE_Message_Block& mb, - bool replace = true); - - /** - * Function that writes out a file to a specified location on the hard disk - * @retval true on success - * @retval false on already exists and replace == false - * @retval 0 on error - * @note This function is relevant for PackageConfigurations ONLY - */ - static bool write_pc_to_disk (const char* full_path, - ACE_Message_Block& mb, - bool replace = true); - - /** - * Function to read the contents of a file from disk into an - * ACE_Message_Block returns a pointer to an ACE_Message_Block and updates - * the lenght on success - * @retval 0 on failure - */ - static ACE_Message_Block* read_pc_from_disk (const char* full_path, - size_t &length); - -}; - -#endif diff --git a/DAnCE/dance/RepositoryManager/RepositoryManager.cpp b/DAnCE/dance/RepositoryManager/RepositoryManager.cpp deleted file mode 100644 index 5cf5478f563..00000000000 --- a/DAnCE/dance/RepositoryManager/RepositoryManager.cpp +++ /dev/null @@ -1,272 +0,0 @@ - -/* -*- C++ -*- */ - -//====================================================================== -/** - * @file RepositoryManager.cpp - * - * Description: - * Main driver program for the CIAO RepositoryManager - * Please run as follows: - * RepositoryManagerDaemon [int:nthreads] - * - * @author Stoyan Paunov - */ -//====================================================================== - -#include "RepositoryManager_Impl.h" -#include "ace/OS_NS_stdio.h" -#include "ace/iosfwd.h" -#include "ace/Auto_Ptr.h" -#include "ace/Task.h" -#include "ace/Get_Opt.h" -#include "ace/SString.h" - -#include "orbsvcs/CosNamingC.h" - -namespace CIAO -{ - namespace RepositoryManager - { - /// Name of the file holding the IOR of the RM - const char * RMior = "RepositoryManagerDaemon.ior"; - - // Name of RepoMan - const char * repoman_name_ = "RepositoryManager"; - - //Name service of the RM - const char * RMname_service = "RepositoryManager"; - - /// Default number of worker threads to run in the multi-threaded RM - static unsigned int nthreads = 3; - static ACE_CString HTTPserver = "127.0.0.1:5432"; - - static bool register_with_ns_ = false; - static bool write_to_ior_ = true; - } -} - -// Forward declaration -bool parse_args (int argc, ACE_TCHAR *argv[]); - -/** - * @class Worker - * - * Class that implements the service routine of the worker threads - * of the repository manager - */ -class Worker : public ACE_Task_Base -{ -public: - /// ctor - Worker (CORBA::ORB_ptr orb); - - /// The thread entry point. - virtual int svc (void); - -private: - /// The orb - CORBA::ORB_var orb_; -}; - -bool -write_ior_file (CORBA::ORB_ptr orb, - CIAO::RepositoryManagerDaemon_ptr obj) -{ - CORBA::String_var ior = orb->object_to_string (obj); - - FILE* RMior_file = ACE_OS::fopen (DAnCE::RepositoryManager::RMior, "w"); - - if (RMior_file) - { - ACE_OS::fprintf (RMior_file, - "%s", - ior.in ()); - ACE_OS::fclose (RMior_file); - } - else - { - return false; - } - - return true; -} - -bool -register_with_ns (CORBA::ORB_ptr orb, - CIAO::RepositoryManagerDaemon_ptr obj) -{ - if (ACE_OS::strlen (DAnCE::RepositoryManager::repoman_name_) > 0) - { - DAnCE::RepositoryManager::RMname_service = - DAnCE::RepositoryManager::repoman_name_; - } - - // Naming Service related operations - CORBA::Object_var naming_context_object = - orb->resolve_initial_references ("NameService"); - - CosNaming::NamingContext_var naming_context = - CosNaming::NamingContext::_narrow (naming_context_object.in ()); - - // Initialize the Naming Sequence - CosNaming::Name name (1); - name.length (1); - - // String dup required for MSVC6 - name[0].id = CORBA::string_dup (DAnCE::RepositoryManager::RMname_service); - - // Register the servant with the Naming Service - naming_context->rebind (name, obj); - - return true; -} - -///Main function - -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - try - { - // Init the ORB - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - if (!parse_args (argc, argv)) - return -1; - - // Get the root POA object - CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA"); - - // Downcast to POA type - PortableServer::POA_var root_poa = PortableServer::POA::_narrow (obj.in ()); - - // Activate the POA manager - PortableServer::POAManager_var mgr = root_poa->the_POAManager (); - mgr->activate (); - - // Create a servant - CIAO_RepositoryManagerDaemon_i* repo = 0; - ACE_NEW_RETURN (repo, - CIAO_RepositoryManagerDaemon_i ( - orb.in (), - DAnCE::RepositoryManager::HTTPserver.c_str (), - DAnCE::RepositoryManager::repoman_name_), - 1); - - // Transfer ownership to the POA - PortableServer::ServantBase_var owner_transfer(repo); - PortableServer::ObjectId_var id = - root_poa->activate_object (ci_srv); - CORBA::Object_var repo_object = root_poa->id_to_reference (id.in ()); - CIAO::RepositoryManagerDaemon_var RepositoryManagerDaemon = - CIAO::RepositoryManagerDaemon::_narrow (repo_object.in ()); - - bool retval = false; - - if (DAnCE::RepositoryManager::write_to_ior_) - { - retval = write_ior_file (orb.in (), RepositoryManagerDaemon.in ()); - } - if (retval && DAnCE::RepositoryManager::register_with_ns_) - { - retval = register_with_ns (orb.in (), RepositoryManagerDaemon.in ()); - } - - if (!retval) - { - return -1; - } - - Worker worker (orb.in ()); - if (worker.activate (THR_NEW_LWP | THR_JOINABLE, - DAnCE::RepositoryManager::nthreads) != 0) - DANCE_ERROR_RETURN (1, (LM_ERROR, - "Cannot activate worker threads\n"), - 1); - - worker.thr_mgr ()->wait (); - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, (LM_DEBUG, "event loop finished\n")); - - orb->destroy (); - } - catch (const CORBA::Exception &ex) { - cerr << "CORBA Exception: " << ex << endl; - - return 1; - } - - return 0; -} - - -// **************************************************************** - -///Code to parse the arguments - - bool - parse_args (int argc, ACE_TCHAR *argv[]) - { - ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("ov:s:n:")); - int c; - while ((c = get_opts ()) != -1) - switch (c) - { - case 'o': - DAnCE::RepositoryManager::write_to_ior_ = true; - DAnCE::RepositoryManager::register_with_ns_ = false; - break; - case 'v': - DAnCE::RepositoryManager::write_to_ior_ = false; - DAnCE::RepositoryManager::register_with_ns_ = true; - DAnCE::RepositoryManager::repoman_name_ = get_opts.opt_arg (); - break; - case 's': - DAnCE::RepositoryManager::HTTPserver = get_opts.opt_arg (); - break; - case 'n': - DAnCE::RepositoryManager::nthreads = ACE_OS::atoi (get_opts.opt_arg ()); - break; - case '?': // display help for use of the server. - DANCE_ERROR (DANCE_LOG_EMERGENCY, (LM_INFO, - ACE_TEXT("usage: %s\n") - ACE_TEXT("-o <using ior file>\n") - ACE_TEXT("-v <name of naming service>\n") - ACE_TEXT("-s <IP:PORT for HTTP server>\n") - ACE_TEXT("-n <number of threads>\n"), - argv [0])); - return false; - break; - default: - ; - } - - return true; - } - - - -// **************************************************************** - -///Constuctor for the worker class -Worker::Worker (CORBA::ORB_ptr orb) - : orb_ (CORBA::ORB::_duplicate (orb)) -{ -} - -///implementation of the service routine inherited from ACE::Task_Base - -int Worker::svc (void) -{ - try - { - this->orb_->run (); - } - catch (const CORBA::Exception&) - { - } - return 0; -} - - diff --git a/DAnCE/dance/RepositoryManager/RepositoryManager.mpc b/DAnCE/dance/RepositoryManager/RepositoryManager.mpc deleted file mode 100644 index e5e2cf72c5e..00000000000 --- a/DAnCE/dance/RepositoryManager/RepositoryManager.mpc +++ /dev/null @@ -1,49 +0,0 @@ -// -*- MPC -*- -project (DAnCE_RepositoryManagerDaemon_IDL) : install, danceidldefaults { - custom_only = 1 - IDL_Files { - RepositoryManagerDaemon.idl - } - specific { - install_dir = dance/RepositoryManager - } -} - -project (DAnCE_RepositoryManager_Exec) : install, dance_logger, dance_config_handlers, dance_repositorymanagerbase, dance_repositorymanager_skel, naming, iortable, utils, zlib, minizip, dance_exe { - exename = dance_repository_manager - after += DAnCE_RepositoryManagerDaemon_IDL - requires += zlib - Source_Files { - RepositoryManagerDaemonC.cpp - RepositoryManagerDaemonS.cpp - ZIP_Wrapper.cpp - RepositoryManager_Impl.cpp - RM_Helper.cpp - URL_Parser.cpp - PC_Updater.cpp - Repository_Manager_Module.cpp - Repository_Manager.cpp - } - Template_Files { - PC_Updater_T.cpp - } - IDL_Files { - } - specific { - install_dir = dance/RepositoryManager - } -} - -project (DAnCE_RepositoryManager_Admin_Exec) : install, dance_repositorymanager_stub, dance_config_handlers, naming, dance_exe, dance_logger { - exename = dance_rm_admin - after += DAnCE_RepositoryManagerDaemon_IDL - - IDL_Files { - } - - Source_Files { - repository_manager_admin.cpp - RepositoryManagerDaemonC.cpp - repository_manager_admin_exec.cpp - } -} diff --git a/DAnCE/dance/RepositoryManager/RepositoryManagerDaemon.idl b/DAnCE/dance/RepositoryManager/RepositoryManagerDaemon.idl deleted file mode 100644 index 0e820330a21..00000000000 --- a/DAnCE/dance/RepositoryManager/RepositoryManagerDaemon.idl +++ /dev/null @@ -1,11 +0,0 @@ -#include "dance/Deployment/Deployment_RepositoryManager.idl" - -module CIAO -{ - interface RepositoryManagerDaemon : Deployment::RepositoryManager - { - // Shutdown the daemon process. - oneway void shutdown (); - }; -}; - diff --git a/DAnCE/dance/RepositoryManager/RepositoryManager_Impl.cpp b/DAnCE/dance/RepositoryManager/RepositoryManager_Impl.cpp deleted file mode 100644 index 7116f099e44..00000000000 --- a/DAnCE/dance/RepositoryManager/RepositoryManager_Impl.cpp +++ /dev/null @@ -1,1269 +0,0 @@ -//==================================================================== -/** - * @file RepositoryManager_Impl.cpp - * - * Description: Actial implementation of the RepoMan - * - * @author Stoyan Paunov - * Shanshan Jiang <shanshan.jiang@vanderbilt.edu> - */ -//==================================================================== - -#include "RepositoryManager_Impl.h" - -#include "ace/OS_NS_fcntl.h" //for open -#include "ace/OS_NS_unistd.h" //for close -#include "ace/OS_NS_sys_stat.h" //for filesize and fstat and mkdir -#include "ace/OS_NS_string.h" //for ACE_CString -#include "ace/OS_Memory.h" //for ACE_NEW* macros - - -//to remove a file or dir from the local filesystem need remove () from stdio.h -// ---> need to include ace/OS_NS_stdio.h which would include the correct file for any OS! -#include "ace/OS_NS_stdio.h" - -#include "ZIP_Wrapper.h" //Wrapper around zzip -#include "ace/Containers_T.h" //for ACE_Double_Linked_List -#include "ace/Malloc_Allocator.h" //for ACE_New_Allocator - -//for the PackageConfiguration parsing -#include "dance/Deployment/Deployment_DataC.h" -#include "dance/Deployment/Deployment_Packaging_DataC.h" -#include "dance/Logger/Log_Macros.h" - -#include "Package_Handlers/PCD_Handler.h" -#include "ace/XML_Utils/XML_Typedefs.h" - -#include "RM_Helper.h" //to be able to externalize/internalize a PackageConfiguration -#include "ace/Message_Block.h" //for ACE_Message_Block - -#include "ace/Thread.h" //for obtaining the ID of the current thread -#include "ace/OS_NS_stdlib.h" //for itoa () -#include "ace/Dirent.h" - -#include "URL_Parser.h" //for parsing the URL -#include "tao/HTTP_Client.h" //the HTTP client class to downloading packages - -#include "PC_Updater.h" //A visitor class to walk through the elements of the PC - -#include "ace/Configuration_Import_Export.h" - -namespace -{ - static const char* PC_EXTENSION = ".epc"; - - static const ACE_TCHAR *RM_RECORD_FILE = ACE_TEXT("RM_record"); - static const ACE_TCHAR *RM_RECORD_NAME_SECTION = ACE_TEXT("Names"); - static const ACE_TCHAR *RM_RECORD_UUID_SECTION = ACE_TEXT("UUIDs"); -} - -namespace DAnCE -{ - - //----------------------------------------------------------------- - //Constructor - // - //----------------------------------------------------------------- - - RepositoryManagerDaemon_i::RepositoryManagerDaemon_i - (CORBA::ORB_ptr the_orb, const ACE_TCHAR* server, const ACE_TCHAR* install_dir) - : the_orb_ (CORBA::ORB::_duplicate (the_orb)), - install_root_ (""), - HTTP_server_ ("http://"), - install_path (install_dir) - { - //form the path - this->HTTP_server_ += server; - this->HTTP_server_ += "/"; - this->HTTP_server_ += install_path; - this->HTTP_server_ += "/"; - - //create directory in which the packages will be stored - ACE_OS::mkdir(install_path.c_str ()); - //if dir already exists a -1 is returned - //we ignore this, just need to make sure the directory exists - - ACE_OS::getcwd (this->cwd_, TEMP_LEN); - - this->install_root_ = this->cwd_; - this->install_root_ += "/"; - this->install_root_ += install_path; - - // Install the configuration files to get the names, UUIDs, & types info. - ACE_Configuration_Heap cfg; - cfg.open (); - ACE_Configuration_Section_Key root = cfg.root_section (); - - ACE_Registry_ImpExp config_importer (cfg); - ACE_OS::chdir (install_path.c_str ()); - config_importer.import_config (RM_RECORD_FILE); - ACE_OS::chdir (this->cwd_); - - ACE_CString name; - ACE_Configuration::VALUETYPE type; - ACE_CString path; - - ACE_Configuration_Section_Key NameSection; - cfg.open_section (root, RM_RECORD_NAME_SECTION, 1, NameSection); - u_int index = 0; - while (!cfg.enumerate_values (NameSection, index, name, type)) - { - cfg.get_string_value (NameSection, name.c_str (), path); - this->names_.bind (name, path); - - ++index; - } - - ACE_Configuration_Section_Key UUIDSection; - cfg.open_section (root, RM_RECORD_UUID_SECTION, 1, UUIDSection); - index = 0; - while (!cfg.enumerate_values (UUIDSection, index, name, type)) - { - cfg.get_string_value (UUIDSection, name.c_str (), path); - this->uuids_.bind (name, path); - - ++index; - } - - // Add types - index = 0; - for (PCMap_Iterator iter = this->names_.begin (); - iter != this->names_.end (); - ++iter, ++index) - { - PCEntry& element = *iter; - - ::Deployment::PackageConfiguration_var pc = this->findPackageByName (element.ext_id_.c_str ()); - - if(!this->add_type (pc, element.ext_id_.c_str ())) - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, "Failed to add the type\n")); - } - - XML::XML_Typedef:: - XML_HELPER.get_resolver ().get_resolver ().add_path (ACE_TEXT ("DANCE_ROOT"), - ACE_TEXT ("/docs/schema/")); - XML::XML_Typedef:: - XML_HELPER.get_resolver ().get_resolver ().add_path (ACE_TEXT ("CIAO_ROOT"), - ACE_TEXT ("/docs/schema/")); - - } - - //----------------------------------------------------------------- - //Destructor - // - //----------------------------------------------------------------- - - RepositoryManagerDaemon_i::~RepositoryManagerDaemon_i (void) - { - this->names_.unbind_all (); - this->uuids_.unbind_all (); - this->types_.unbind_all (); - } - - //----------------------------------------------------------------- - //shutdown - // - //----------------------------------------------------------------- - - void RepositoryManagerDaemon_i::shutdown () - - { - // Release resource. - this->names_.unbind_all (); - this->uuids_.unbind_all (); - this->types_.unbind_all (); - - this->the_orb_->shutdown (0); - } - - - //----------------------------------------------------------------- - //installPackage - // - //----------------------------------------------------------------- - - void RepositoryManagerDaemon_i::installPackage (const char * installationName, - const char * location, - ::CORBA::Boolean replace) - { - - PCEntry *entry = 0; - if (this->names_.find (ACE_CString (installationName), entry) == 0) - { - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_INFO, DLINFO "RepositoryManagerDaemon_i::installPackage - " - "Found package %s already installed.\n")); - if (!replace) - throw Deployment::NameExists (); - else - deletePackage (installationName); - } - - //Now lets form the path for the local file - //NOTE: I need the absolute path because I will change to a subdirectory - //when I am parsing the descriptors - - ACE_CString path (this->install_root_); - path += "/"; - path += installationName; - - ACE_CString package_path (path); - package_path += ".cpk"; //package extension - - ACE_CString pc_path (path); - pc_path += PC_EXTENSION; //external PackageConfiguration extension - - - ACE_CString descriptor_dir (path); - descriptor_dir += "/descriptors/"; //location of the descriptor directory - - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO "RepositoryManagerDaemon_i::installPackage - " - "Package Path: %s\n", - package_path.c_str ())); - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO "RepositoryManagerDaemon_i::installPackage - " - "Descriptor path: %s\n", - descriptor_dir.c_str ())); - - //check if URL or local file - //download or load into memory - - if (ACE_OS::strstr (location, "http://")) - { - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_INFO, DLINFO "RepositoryManagerDaemon_i::installPackage - " - "Downloading package over HTTP: %s\n", - location)); - - ACE_Message_Block* mb = 0; - ACE_NEW_THROW_EX (mb, ACE_Message_Block (), CORBA::NO_MEMORY ()); - - try - { - //get the remote file - if (!HTTP_Get (location, *mb)) - { - throw CORBA::INTERNAL (); - } - - // Write file to designated location on disk - if (!RM_Helper::write_to_disk (package_path.c_str (), *mb)) - { - throw CORBA::INTERNAL (); - } - - mb->release (); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO "RepositoryManagerDaemon_i::installPackage - " - "Caught unexpected exception while fetching path %s\n", - location)); - - mb->release (); - throw; - } - } - else - { - if (!RM_Helper::copy_from_disk_to_disk (location, package_path.c_str ())) - throw CORBA::INTERNAL (); - } - - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_TRACE, DLINFO "RepositoryManagerDaemon_i::installPackage - " - "Uncompressing file %s to directory %s\n", - package_path.c_str (), - this->install_root_.c_str ())); - - ZIP_Wrapper::uncompress (const_cast<char*> (package_path.c_str ()), - const_cast<char*> (this->install_root_.c_str ()), - false //not verbose - ); - - //Start the parsing - - ACE_CString pc_name; - - this->find_PC_name (const_cast<char*> (package_path.c_str ()), pc_name); - - //if the PackageConfiguration name cannot be found, then there is nothing to install - if (pc_name == "") - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO "RepositoryManagerDaemon_i::installPackage - " - "Unable to find PC name %s in path %s\n", - pc_name.c_str (), - package_path.c_str ())); - - //clean the extracted files - remove_extracted_package (path.c_str ()); - //remove the package - remove (package_path.c_str ()); - - throw Deployment::PackageError (); - } - - //TODO: move exception throwing out of this func. User boolean error handling!!! - //TODO: check for errors! - Deployment::PackageConfiguration_var pc; - pc = this->retrieve_PC_from_descriptors (const_cast<char*> (pc_name.c_str ()), - descriptor_dir.c_str ()); - - - if (this->uuids_.find (ACE_CString (pc->UUID), entry) == 0) - { - //clean the extracted files - remove_extracted_package (path.c_str ()); - //remove the package - remove (package_path.c_str ()); - - throw Deployment::NameExists (); - } - - //forming the server path info - ACE_CString server_path (this->HTTP_server_); - server_path += installationName; - - //NOTE: ComponentPackageReferences are currently NOT supported - if (!(pc->basePackage.length () > 0)) - { - //clean the extracted files - remove_extracted_package (path.c_str ()); - //remove the package - remove (package_path.c_str ()); - - throw CORBA::NO_IMPLEMENT (); - } - - PC_Updater updater (server_path, package_path); - - if (!updater.update (pc)) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO "[RM] problem updating the PackageConfiguration!\n")); - - //clean the extracted files - remove_extracted_package (path.c_str ()); - //remove the package - remove (package_path.c_str ()); - throw Deployment::PackageError (); - } - - - //now lets externalize the PackageConfiguration, so that we can access it later on - //without having to do the whole parsing again. - //NOTE: Order here is important. Do not populate maps before the externalization! - RM_Helper::externalize (pc, pc_path.c_str ()); - - //insert the package into the database - if (this->names_.bind (ACE_CString (installationName), path) == -1) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, - "[RM] could not bind %s.\n", - installationName)); - - //clean the extracted files - remove_extracted_package (path.c_str ()); - //remove the package - remove (package_path.c_str ()); - //remove the PackageConfiguration externalization - remove (pc_path.c_str ()); - - //throw exception - throw CORBA::INTERNAL (); - } - - //ALSO NEED THE UUID here - if (this->uuids_.bind (ACE_CString (pc->UUID), path) == -1) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, - "[RM] could not bind %s.\n", - ACE_CString (pc->UUID).c_str ())); - - //unbind the name - this->names_.unbind (installationName); - - //clean the extracted files - remove_extracted_package (path.c_str ()); - //remove the package - remove (package_path.c_str ()); - //remove the PackageConfiguration externalization - remove (pc_path.c_str ()); - - //throw exception - throw CORBA::INTERNAL (); - } - - //now add the type interface - if(!this->add_type (pc, installationName)) - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, "Failed to add the type\n")); - - this->dump (); - - this->save (); - - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, (LM_INFO, - "Installed PackageConfiguration \n\tname: %s \n\tuuid: %s\n", - installationName, ACE_CString (pc->UUID).c_str ())); - } - - - //----------------------------------------------------------------- - //createPackage - // - //----------------------------------------------------------------- - - void RepositoryManagerDaemon_i::createPackage (const char * installationName, - const ::Deployment::PackageConfiguration & package, - const char * baseLocation, - ::CORBA::Boolean replace) - { - ::Deployment::PackageConfiguration pc = package; - - // Find if there is a PackageConfiguration with the same name. - PCEntry *entry = 0; - if (this->names_.find (ACE_CString (installationName), entry) == 0) - { - if (!replace) - throw Deployment::NameExists (); - else - deletePackage (installationName); - } - - // Find if there is a PackageConfiguration with the same uuid. - if (this->uuids_.find (ACE_CString (pc.UUID), entry) == 0) - throw Deployment::NameExists (); - - // Find if the PackageConfiguration has a basePackage. - // NOTE: ComponentPackageReferences are currently NOT supported. - if (!(pc.basePackage.length () > 0)) - throw CORBA::NO_IMPLEMENT (); - - // Form the path for the local file - ACE_CString path (this->install_root_); - path += "/"; - path += installationName; - - ACE_CString package_path (path); - package_path += ".cpk"; //package extension - - ACE_CString pc_path (path); - pc_path += PC_EXTENSION; //external PackageConfiguration extension - - // Check if URL or local file, download or load into memory - if (ACE_OS::strstr (baseLocation, "http://")) - { - //TODO: how can I incorporate a Auto_Ptr is explicit release is needed - ACE_Message_Block* mb = 0; - ACE_NEW_THROW_EX (mb, ACE_Message_Block (), CORBA::NO_MEMORY ()); - - //get the remote file - if (!HTTP_Get (baseLocation, *mb)) - { - mb->release (); - throw CORBA::INTERNAL (); - } - - // Write file to designated location on disk - if (!RM_Helper::write_to_disk (package_path.c_str (), *mb)) - { - mb->release (); - throw CORBA::INTERNAL (); - } - - mb->release (); - } - else - { - if (!RM_Helper::copy_from_disk_to_disk (baseLocation, package_path.c_str ())) - throw CORBA::INTERNAL (); - } - - - ZIP_Wrapper::uncompress (const_cast<char*> (package_path.c_str ()), - const_cast<char*> (this->install_root_.c_str ()), - false //not verbose - ); - - // Form the server path info - ACE_CString server_path (this->HTTP_server_); - server_path += installationName; - - // Update the newly installed package configration informantion. - PC_Updater updater (server_path, package_path); - - if (!updater.update (pc)) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, "[RM] problem updating the PackageConfiguration!\n")); - //clean the extracted files - remove_extracted_package (path.c_str ()); - //remove the package - remove (package_path.c_str ()); - throw Deployment::PackageError (); - } - - // Externalize the PackageConfiguration, so that we can access it later on - // without having to do the whole parsing again. - // NOTE: Order here is important. Do not populate maps before the externalization! - RM_Helper::externalize (pc, pc_path.c_str ()); - - // Insert the name of the package. - if (this->names_.bind (ACE_CString (installationName), path) == -1) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, - "[RM] could not bind %s.\n", - installationName)); - - //clean the extracted files - remove_extracted_package (path.c_str ()); - //remove the package - remove (package_path.c_str ()); - //remove the PackageConfiguration externalization - remove (pc_path.c_str ()); - - //throw exception - throw CORBA::INTERNAL (); - } - - // Insert the UUID of the package. - if (this->uuids_.bind (ACE_CString (pc.UUID), path) == -1) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, - "[RM] could not bind %s.\n", - ACE_CString (pc.UUID).c_str ())); - - //unbind the name - this->names_.unbind (installationName); - - //clean the extracted files - remove_extracted_package (path.c_str ()); - //remove the package - remove (package_path.c_str ()); - //remove the PackageConfiguration externalization - remove (pc_path.c_str ()); - - //throw exception - throw CORBA::INTERNAL (); - } - - //now add the type interface - //TODO: CHECK if successful - if(!this->add_type (pc, installationName)) - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, "Failed to add the type\n")); - - this->dump (); - - this->save (); - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_INFO, - "Created PackageConfiguration \n directory: %s \n name: %s \n uuid: %s\n", - path.c_str (), installationName, ACE_CString (pc.UUID).c_str ())); - } - - - //----------------------------------------------------------------- - //findPackageByName - // - //----------------------------------------------------------------- - - ::Deployment::PackageConfiguration* - RepositoryManagerDaemon_i::findPackageByName (const char * name) - - { - // Find out if the PackageConfiguration was installed in the repository, - // return it if found or throw and exception otherwise - - PCEntry *entry = 0; - - if (this->names_.find (ACE_CString (name), entry) != 0) - throw Deployment::NoSuchName (); - //PackageConfiguration was not found - - ACE_CString pc_path (entry->int_id_.c_str ()); - pc_path += PC_EXTENSION; - - Deployment::PackageConfiguration_var pc; - ACE_NEW_THROW_EX (pc, - Deployment::PackageConfiguration (), - CORBA::NO_MEMORY ()); - - - if(!RM_Helper::reincarnate (pc, pc_path.c_str ())) - throw CORBA::INTERNAL (); - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_INFO, "Successfully looked up \'%s\'.\n", name)); - - return pc._retn (); - } - - - //----------------------------------------------------------------- - //findPackageByUUID - // - //----------------------------------------------------------------- - - ::Deployment::PackageConfiguration* - RepositoryManagerDaemon_i::findPackageByUUID (const char * UUID) - - { - // Find out if the PackageConfiguration was installed in the repository, - // return it if found or throw and exception otherwise - - PCEntry *entry = 0; - - if (this->uuids_.find (ACE_CString (UUID), entry) != 0) - throw Deployment::NoSuchName (); - //PackageConfiguration was not found - - ACE_CString pc_path (entry->int_id_.c_str ()); - pc_path += PC_EXTENSION; - - Deployment::PackageConfiguration_var pc; - ACE_NEW_THROW_EX (pc, - Deployment::PackageConfiguration (), - CORBA::NO_MEMORY ()); - - - if(!RM_Helper::reincarnate (pc, pc_path.c_str ())) - throw CORBA::INTERNAL (); - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_INFO, "Successfully looked up %s.\n", UUID)); - - return pc._retn (); - } - - //----------------------------------------------------------------- - //findPackageByType - // - //----------------------------------------------------------------- - - ::CORBA::StringSeq * RepositoryManagerDaemon_i::findNamesByType (const char * type) - { - CIEntry *entry = 0; - - //find the type in the interface map - if (this->types_.find (ACE_CString (type), entry) != 0) - { - //return an empty sequence - CORBA::StringSeq_var seq; - ACE_NEW_THROW_EX (seq, CORBA::StringSeq (0), CORBA::NO_MEMORY ()); - - return seq._retn (); - } - else - { - CISet ci_set = (*entry).int_id_set_; - - CORBA::ULong len = ci_set.size (); - - //allocate a sequence of the right length - CORBA::StringSeq_var seq; - ACE_NEW_THROW_EX (seq, - CORBA::StringSeq (len), - CORBA::NO_MEMORY ()); - seq->length (len); - - //store the elements in the string sequence - CISet_Iterator ci_set_iter (ci_set); - CORBA::ULong index = 0; - for (ci_set_iter = ci_set.begin (); - ci_set_iter != ci_set.end () && index < len; - ++ci_set_iter, ++index) - { - seq[index] = CORBA::string_dup ((*ci_set_iter).c_str ()); - } - - return seq._retn (); - } - } - - - //----------------------------------------------------------------- - //getAllNames - // - //----------------------------------------------------------------- - - ::CORBA::StringSeq* - RepositoryManagerDaemon_i::getAllNames () - - { - //Map.current_size () gives you the current number with the duplicates - //Map.total_size () gives you the allocated space + the empty slots - //Apparently the only way to figure out the number of keys is to - //count them with an iterator. - - CORBA::ULong num_entries = 0; - - for (PCMap_Iterator i = this->names_.begin (); - i != this->names_.end (); - ++i) - ++num_entries; - - CORBA::StringSeq_var seq; - ACE_NEW_THROW_EX (seq, CORBA::StringSeq (num_entries), CORBA::NO_MEMORY ()); - - - seq->length (num_entries); - - CORBA::ULong index = 0; - for (PCMap_Iterator iter = this->names_.begin (); - iter != this->names_.end () && index < num_entries; - ++iter, ++index) - { - PCEntry& element = *iter; - seq[index] = CORBA::string_dup (element.ext_id_.c_str ()); - } - - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_INFO, "The number of packages %d\n", seq->length ())); - - return seq._retn (); //release the underlying CORBA::StringSeq - } - - - //----------------------------------------------------------------- - //getAllTypes - // - //----------------------------------------------------------------- - - ::CORBA::StringSeq * RepositoryManagerDaemon_i::getAllTypes () - { - //Map.current_size () gives you the current number with the duplicates - //Map.total_size () gives you the allocated space + the empty slots - //Apparently the only way to figure out the number of keys is to - //count them with an iterator. - - CORBA::ULong num_entries = 0; - - for (CIMap_Iterator i = this->types_.begin (); - i != this->types_.end (); - ++i) - ++num_entries; - - CORBA::StringSeq_var seq; - ACE_NEW_THROW_EX (seq, - CORBA::StringSeq (num_entries), - CORBA::NO_MEMORY ()); - - - seq->length (num_entries); - - CORBA::ULong index = 0; - for (CIMap_Iterator iter = this->types_.begin (); - iter != this->types_.end () && index < num_entries; - ++iter, ++index) - - { - CIEntry& element = *iter; - seq[index] = CORBA::string_dup (element.ext_id_.c_str ()); - } - - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, "The number of types: %d\n", num_entries)); - - return seq._retn (); //release the underlying CORBA::StringSeq - } - - - //----------------------------------------------------------------- - //DeletePackage - // - //----------------------------------------------------------------- - - void RepositoryManagerDaemon_i::deletePackage (const char * installationName) - { - bool internal_err = false; - - PCEntry *entry = 0; - - if (this->names_.find (ACE_CString (installationName), entry) != 0) - throw Deployment::NoSuchName (); - - //cache the package path - ACE_CString path (entry->int_id_.c_str ()); - - //remove the name association - if (this->names_.unbind (installationName) == -1) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, - "Unable to unbind %s.\n", - installationName)); - internal_err = true; - } - - //the package location - ACE_CString package_path (path); - package_path += ".cpk"; //package extension - - //the PackageConfiguration externalization location - ACE_CString pc_path (path); - pc_path += PC_EXTENSION; //external PackageConfiguration extension - - Deployment::PackageConfiguration_var pc; - ACE_NEW_THROW_EX (pc, - Deployment::PackageConfiguration (), - CORBA::NO_MEMORY ()); - - - if(!RM_Helper::reincarnate (pc, pc_path.c_str ())) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, "Could not reincarnate PC\n")); - internal_err = true; - } - - if (this->uuids_.unbind (ACE_CString (pc->UUID)) == -1) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, "Could not remove UUID\n")); - internal_err = true; - } - - //remove the type from the interface map - if (!this->remove_type (pc, installationName)) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, "Could not remove type\n")); - internal_err = true; - } - - //actually delete the package here! - - //clean the extracted files - remove_extracted_package (path.c_str ()); - //remove the package - remove (package_path.c_str ()); - //remove the PackageConfiguration externalization - remove (pc_path.c_str ()); - - this->dump (); - - this->save (); - - if (internal_err) - throw CORBA::INTERNAL (); - else - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_INFO, "Successfully deleted \'%s\'\n", installationName)); - - } - - - //==========================================HELPER METHODS================================================== - - Deployment::PackageConfiguration* - RepositoryManagerDaemon_i::retrieve_PC_from_package (char* package) - { - char temp[128]; - // ACE_thread_t thread_id = ACE_Thread::self (); - char* PID = ACE_OS::itoa (ACE_OS::getpid (), temp, 10); - - ACE_OS::mkdir(PID); - //if dir already exists a -1 is returned - //we ignore this, just need to make sure the directory exists - - //change the working dir - ACE_OS::chdir (PID); - - ACE_CString pcd_name; - //extract the necessary descriptors - if (extract_descriptor_files (package, - pcd_name) < 0) - { - ACE_OS::chdir (this->cwd_); - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, - "(%P|%t) RepositoryManager: error extracting necessary files\n")); - throw CORBA::INTERNAL (); - } - - Deployment::PackageConfiguration_var pc; - //parse the PCD to make sure that there are no package errors - try - { - //CIAO::Config_Handlers::STD_PC_Intf intf (pcd_name.c_str ()); - //pc = intf.get_PC (); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, - "(%P|%t) RepositoryManager: Error parsing the PCD\n")); - - //change back the the old working dir - ACE_OS::chdir (this->cwd_); - throw Deployment::PackageError (); - } - //able to parse the PC. So lets install the package in the repo - - //we no longer need the descriptors, so lets erase them! - remove_descriptor_files (package); - - //change back the the old working dir - ACE_OS::chdir (this->cwd_); - - //now lets erase the directory! - ACE_OS::rmdir (PID); - //the ACE_OS::rmdir does not work. Possibly because we need to delete - //the contents first. I will look into it more closely when I am back. - - return pc._retn (); - } - - - //function to retvieve a file via HTTP - //stores the file in the passed preallocated ACE_Message_Block - //returns 1 on success - // 0 on error - - int RepositoryManagerDaemon_i::HTTP_Get (const char* URL, ACE_Message_Block &mb) - { - URL_Parser *parser = TheURL_Parser::instance (); - if (!parser->parseURL (const_cast<char*> (URL))) - return 0; - - // Create a client - TAO_HTTP_Client client; - - // Open the client - if (client.open (parser->filename_, - parser->hostname_, - parser->port_) == -1) - { - client.close (); - return 0; - } - - // Read from it - if (client.read (&mb) <= 0) - { - client.close (); - return 0; - } - - return 1; - } - - - - //function to parse and return the PackageConfiguration from the already - //extracted descriptor files - Deployment::PackageConfiguration* - RepositoryManagerDaemon_i::retrieve_PC_from_descriptors (const char* pc_name, - const char* descriptor_dir) - { - //change the working dir - ACE_OS::chdir (descriptor_dir); - - Deployment::PackageConfiguration_var pc = new Deployment::PackageConfiguration (); - //parse the PCD to make sure that there are no package errors - try - { - DAnCE::Config_Handlers::Packaging::PCD_Handler::package_config (pc_name, *pc); - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, - "(%P|%t) [RM::retrieve_PC_from_descriptors] Error parsing the PCD\n")); - - //change back the the old working dir - ACE_OS::chdir (this->cwd_); - throw Deployment::PackageError (); - } - //able to parse the PC. So lets install the package in the repo - - //change back the the old working dir - ACE_OS::chdir (this->cwd_); - - return pc._retn (); - } - - - //find out what the name of the PackageConfiguration file is - void RepositoryManagerDaemon_i::find_PC_name (char* package, ACE_CString& pcd_name) - { - pcd_name = ""; //empty the contents of the ACE_CString - - //create a doubly link list - ACE_New_Allocator allocator; - ACE_Double_Linked_List<ZIP_File_Info> list (&allocator); - - //get the list of files in the package and figure out the names of all necessary files - if (!(ZIP_Wrapper::file_list_info (package, list))) - return; - - size_t skip_len = ACE_OS::strlen ("descriptors") + 1; - - while (!list.is_empty ()) - { - ZIP_File_Info* inf = list.delete_head (); - - if (ACE_OS::strstr (inf->name_.c_str (), "descriptors")) - if (ACE_OS::strstr (inf->name_.c_str (), ".pcd")) - pcd_name = inf->name_.c_str () + skip_len; - - //deallocate the head of the filename list - delete inf; - } - } - - - //We are using Xercesc in the Config_Handlers and unfortunately its API only - //takes a file in the local file system as an argument, thus need to - //write out the contents of the deployent plan to a file - //in the current directory. I use the thread id to guarrantee - //lack of race conditions if multithreading is enabled - - int RepositoryManagerDaemon_i::extract_descriptor_files (char* package, ACE_CString& pcd_name) - { - //create a doubly link list - ACE_New_Allocator allocator; - ACE_Double_Linked_List<ZIP_File_Info> list (&allocator); - - //get the list of files in the package and figure out the names of all necessary files - if (!(ZIP_Wrapper::file_list_info (package, list))) - return 0; - - size_t skip_len = ACE_OS::strlen ("descriptors") + 1; - - while (!list.is_empty ()) - { - ZIP_File_Info* inf = list.delete_head (); - ACE_Message_Block* file = 0; - if (ACE_OS::strstr (inf->name_.c_str (), "descriptors")) - { - if (ACE_OS::strstr (inf->name_.c_str (), ".pcd")) - pcd_name = inf->name_.c_str () + skip_len; - - //extract the descriptor from the package - ACE_NEW_RETURN (file, ACE_Message_Block (0,0), 0); - if (!ZIP_Wrapper::get_file(const_cast<char*> (package), - const_cast<char*> (inf->name_.c_str ()), - *file)) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, - "[RM::extract_descriptor_files] Unable to retrieve file!\n")); - //release the message block chain - file->release (); - return 0; - } - - - //write the file to disk - if(!RM_Helper::write_to_disk (inf->name_.c_str () + skip_len, *file)) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, - "[RM::extract_descriptor_files] Unable to write out descriptor to disk!\n")); - //release the message block chain - file->release (); - return 0; - } - - //release the message block chain - file->release (); - } - - //deallocate the head of the filename list - delete inf; - } - - return 1; - } - - int RepositoryManagerDaemon_i::remove_descriptor_files (char* package) - { - int return_code = 1; - - //create a doubly link list - ACE_New_Allocator allocator; - ACE_Double_Linked_List<ZIP_File_Info> list (&allocator); - - //get the list of files in the package and figure out the names of all necessary files - if (!(ZIP_Wrapper::file_list_info (package, list))) - return 0; - - size_t skip_len = ACE_OS::strlen ("descriptors") + 1; - - while (!list.is_empty ()) - { - ZIP_File_Info* inf = list.delete_head (); - if (ACE_OS::strstr (inf->name_.c_str (), "descriptors")) - { - //delete disk - if(remove (inf->name_.c_str () + skip_len)) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, - "[RM::remove_descriptor_files] Unable to remove file from disk!\n")); - return_code = 0; - } - } - //deallocate the head of the filename list - delete inf; - } - - return return_code; - } - - int RepositoryManagerDaemon_i::remove_extracted_package (const char* path) - { - ACE_TCHAR full_path[MAXPATHLEN]; - ACE_OS::getcwd (full_path, sizeof(full_path)); - - ACE_OS::chdir (path); - - ACE_Dirent dir (path); - - for (ACE_DIRENT *directory; (directory = dir.read ()) != 0;) - { - if (ACE::isdotdir (directory->d_name) == true) - continue; - - ACE_stat stat_buf; - ACE_OS::lstat (directory->d_name, &stat_buf); - - ACE_CString temp = path; - temp += "/"; - temp += directory->d_name; - switch (stat_buf.st_mode & S_IFMT) - { - case S_IFREG: // Either a regular file or an executable. - remove (temp.c_str ()); - break; - - case S_IFDIR: - remove_extracted_package (temp.c_str ()); - break; - - default: - break; - } - } - - ACE_OS::chdir (full_path); - - ACE_OS::rmdir (path); - - return 0; - } - - //function to extract the type of the component from - //the PackageConfiguration and update the interface map - //returns 1 on success - // 0 on error - - int RepositoryManagerDaemon_i::add_type (Deployment::PackageConfiguration& pc, - const char* name) - { - if (pc.basePackage.length () > 0) - { - ::CORBA::StringSeq supportedTypes = pc.basePackage[0] - .implementation[0] - .referencedImplementation - .implements - .supportedType; - - if (supportedTypes.length () != 0) - { - CORBA::ULong len = supportedTypes.length (); - for (CORBA::ULong i = 0; i < len; ++i) - { - this->types_.bind (ACE_CString (supportedTypes[i]), name); - } - } - } - else //ComponentPackageReference - { - //not implemented yet - return 0; - } - - return 1; - } - - //function to remove the interface type of the component - //being removed from the interface map - //returns 1 on success - // 0 on error - - int RepositoryManagerDaemon_i::remove_type (Deployment::PackageConfiguration& pc, - const char* name) - { - if (pc.basePackage.length () > 0) - { - ::CORBA::StringSeq supportedTypes = pc.basePackage[0] - .implementation[0] - .referencedImplementation - .implements - .supportedType; - - if (supportedTypes.length () != 0) - { - CORBA::ULong len = supportedTypes.length (); - for (CORBA::ULong i = 0; i < len; ++i) - { - if (this->types_.unbind (ACE_CString (supportedTypes[i]), ACE_CString (name)) != 0) - DANCE_ERROR (DANCE_LOG_ERROR, (LM_DEBUG, "Could not find type %s with package name %s!\n", - ACE_CString (supportedTypes[i]).c_str (), - name)); - } - } - } - else //ComponentPackageReference - { - //not implemented yet - return 0; - } - - return 1; - } - - //function to dump the state of the RepositoryManager - void RepositoryManagerDaemon_i::dump (void) - { -#if defined (ACE_HAS_DUMP) - - DANCE_DEBUG(DANCE_LOG_MAJOR_DEBUG_INFO, (LM_DEBUG, "NAMES:\n")); - this->names_.dump (); - DANCE_DEBUG(DANCE_LOG_MAJOR_DEBUG_INFO, (LM_DEBUG, "UUIDs:\n")); - this->uuids_.dump (); - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, (LM_DEBUG, "Component Interface Types:\n")); - this->types_.dump (); -#endif /* ACE_HAS_DUMP */ - } - - //function to save the package info of the RepositoryManager - void RepositoryManagerDaemon_i::save (void) - { - // Save the names, UUIDs, & types info to the configuration files. - ACE_Configuration_Heap cfg; - cfg.open (); - ACE_Configuration_Section_Key root = cfg.root_section (); - - ACE_Configuration_Section_Key NameSection; - cfg.open_section (root, RM_RECORD_NAME_SECTION, 1, NameSection); - for (PCMap_Iterator iter = this->names_.begin (); - iter != this->names_.end (); - ++iter) - { - PCEntry& element = *iter; - cfg.set_string_value (NameSection, element.ext_id_.c_str (), element.int_id_.c_str ()); - } - - ACE_Configuration_Section_Key UUIDSection; - cfg.open_section (root, RM_RECORD_UUID_SECTION, 1, UUIDSection); - for (PCMap_Iterator iter = this->uuids_.begin (); - iter != this->uuids_.end (); - ++iter) - { - PCEntry& element = *iter; - cfg.set_string_value (UUIDSection, element.ext_id_.c_str (), element.int_id_.c_str ()); - } - - ACE_Registry_ImpExp exporter (cfg); - ACE_OS::chdir (install_path.c_str ()); - exporter.export_config (RM_RECORD_FILE); - ACE_OS::chdir (this->cwd_); - } -} diff --git a/DAnCE/dance/RepositoryManager/RepositoryManager_Impl.h b/DAnCE/dance/RepositoryManager/RepositoryManager_Impl.h deleted file mode 100644 index 2e1d8e68905..00000000000 --- a/DAnCE/dance/RepositoryManager/RepositoryManager_Impl.h +++ /dev/null @@ -1,231 +0,0 @@ - -/* -*- C++ -*- */ - -//====================================================================== -/** - * @file RepositoryManager_Impl.h - * - * Description: - * This file is the main implementation file for the RepositoryManager - * in CIAO. We have used a number of techniques in order to increase - * scalability of the RepoMan while still maintaining complience with - * the D&C spec - * - * @author Stoyan Paunov - * @author Shanshan Jiang <shanshan.jiang@vanderbilt.edu> - * @author William R. Otte <wotte@dre.vanderbilt.edu> - */ -//====================================================================== - -#ifndef REPOSITORYMANAGERI_H_ -#define REPOSITORYMANAGERI_H_ - -//-----------------------------NOTE--------------------------------- -//I need to disable all the code which has to do with interface -//type information because we currently do not support assembly -//interfaces which causes undesired behavior with respect to the -//hash tables because the specificType field in assembly interfaces -//is empty, so two unrelated intefaces appear to be related. - -#include "RepositoryManagerDaemonS.h" - -#include "ace/Hash_Map_Manager_T.h" //for the ACE_Hash_Map_Manager -#include "ace/Hash_Multi_Map_Manager_T.h" //for the ACE_Hash_MultiMap_Manager -#include "ace/Null_Mutex.h" //for ACE_Null_Mutex -#include "ace/RW_Mutex.h" //for ACE_RW_Mutex -#include "ace/OS_NS_string.h" //for ACE_CString -#include "ace/SString.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -namespace -{ - static const size_t TEMP_LEN = 1024; -} - -namespace DAnCE -{ - class RepositoryManagerDaemon_i : - public virtual POA_CIAO::RepositoryManagerDaemon - { - public: - /// Constructor - RepositoryManagerDaemon_i (CORBA::ORB_ptr the_orb, - const ACE_TCHAR* server = ACE_TEXT("localhost:5432"), - const ACE_TCHAR* install_dir = ACE_TEXT("RepositoryManager")); - - /// Destructor - virtual ~RepositoryManagerDaemon_i (void); - - virtual void shutdown (); - - virtual - void installPackage (const ACE_TCHAR * installationName, - const ACE_TCHAR * location, - ::CORBA::Boolean replace); - - virtual - void createPackage (const ACE_TCHAR * installationName, - const ::Deployment::PackageConfiguration & package, - const ACE_TCHAR * baseLocation, - ::CORBA::Boolean replace); - - virtual - ::Deployment::PackageConfiguration * findPackageByName (const ACE_TCHAR * name); - - virtual - ::Deployment::PackageConfiguration * findPackageByUUID (const ACE_TCHAR * UUID); - - virtual - ::CORBA::StringSeq * findNamesByType (const ACE_TCHAR * type); - - virtual - ::CORBA::StringSeq * getAllNames (); - - virtual - ::CORBA::StringSeq * getAllTypes (); - - virtual - void deletePackage (const ACE_TCHAR * installationName); - - protected: - - /// Function to parse and return the PackageConfiguration from a specified - /// package - Deployment::PackageConfiguration* retrieve_PC_from_package (ACE_TCHAR* package); - - /// Find out what the name of the PackageConfiguration file is - void find_PC_name (ACE_TCHAR* package, ACE_CString& pcd_name); - - /// Function to parse and return the PackageConfiguration from the already - /// extracted descriptor files - Deployment::PackageConfiguration* retrieve_PC_from_descriptors (const ACE_TCHAR* pc_name, - const ACE_TCHAR* descriptor_dir); - - - /// Function to retrieve a file via HTTP - /// stores the file in the passed preallocated ACE_Message_Block - /// @retval 1 success - /// @retval 0 error - int HTTP_Get (const ACE_TCHAR* URL, ACE_Message_Block &mb); - - /// Function to extract all necessary files for parsing the - /// PackageConfiguration descriptor and populating the idl struct. - /// @retval 1 success - /// @retval 0 error - /// - /// @note ACE_CString& pcd_name is an out parameter - int extract_descriptor_files (ACE_TCHAR* package, - ACE_CString& pcd_name); - - - /// Function to remove the files extracted for parsing the PackageConfiguration - /// descriptor and populating the idl struct. It reads the names of the files - /// from the package. They correspond to the names on disk. - /// @retval 1 on success - /// @retval 0 on error - int remove_descriptor_files (ACE_TCHAR* package); - - - /// Function to remove the files extracted from the package upon istallation - /// It reads the names of the files from the package. They correspond to the - /// names on disk. It deletes each file, then it deletes the directories that - /// contain them. - /// @note extraction location is path/*archive_name*/ - /// @retval 1 on success - /// @retval 0 on error - int remove_extracted_package (const ACE_TCHAR* package_path); - - /// Function to extract the type of the component from - /// the PackageConfiguration and update the interface map - /// @retval 1 on success - /// @retval 0 on error - int add_type (::Deployment::PackageConfiguration& pc, - const ACE_TCHAR* name); - - /// Function to remove the interface type of the component - /// being removed from the interface map - /// @retval 1 on success - /// @retval 0 on error - int remove_type (::Deployment::PackageConfiguration& pc, - const ACE_TCHAR* name); - - /// Function to dump the state of the RepositoryManager - void dump (void); - - /// Function to save the package info of the RepositoryManager - void save (void); - - private: - /// Cached information about the installed PackageConfigurations - /// A separate map for the installation names and their UUID's - /// Key: PackageConfiguration name or its UUID (CString type) - /// Value: The location of the local copy of the package - - ///Based on the synchronization needed we can parametrize this with either - ///ACE_Null_Mutex or ACE_RW_Mutex - - typedef ACE_Hash_Map_Manager_Ex<ACE_CString, - ACE_CString, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_RW_Mutex> PCMap; - - typedef PCMap::ITERATOR PCMap_Iterator; - typedef PCMap::ENTRY PCEntry; - - - /// Cached information about the installed Component Interfaces - /// A map which associates Component supportedType with the - /// names of packages which implement this component type - /// Key: Component supportedType - /// Value: Unbounded set of the names of installed packages which - /// implement this component type - - ///Based on the synchronization needed we can parametrize this with either - ///ACE_Null_Mutex or ACE_RW_Mutex - - typedef ACE_Hash_Multi_Map_Manager<ACE_CString, - ACE_CString, - ACE_Hash<ACE_CString>, - ACE_Equal_To<ACE_CString>, - ACE_RW_Mutex> CIMap; - - typedef CIMap::ITERATOR CIMap_Iterator; - typedef CIMap::ENTRY CIEntry; - typedef CIEntry::VALUE_SET CISet; - typedef CIEntry::VALUE_SET_ITERATOR CISet_Iterator; - - /// A hash map that associates the names of - /// PackageConfigurations with their location - PCMap names_; - - /// a hash map that associates the UUIDs of - /// PackageConfigurations with their location - PCMap uuids_; - - /// a hash map which associates Component Interface - /// UUIDs with their implementations - CIMap types_; - - /// The ORB - CORBA::ORB_var the_orb_; - - /// Will hold the current working directory - ACE_TCHAR cwd_ [TEMP_LEN]; - - /// Full path for the install directory - ACE_CString install_root_; - - /// Location of the server - ACE_CString HTTP_server_; - - /// Directory where the packages will be stored locally - ACE_CString install_path; -}; - -} - -#endif /* REPOSITORYMANAGER_H_ */ diff --git a/DAnCE/dance/RepositoryManager/Repository_Manager.cpp b/DAnCE/dance/RepositoryManager/Repository_Manager.cpp deleted file mode 100644 index 974b980b19c..00000000000 --- a/DAnCE/dance/RepositoryManager/Repository_Manager.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include "ace/Dynamic_Service.h" -#include "tao/ORB.h" -#include "tao/Object.h" -#include "dance/Logger/Log_Macros.h" -#include "dance/Logger/Logger_Service.h" -#include "Repository_Manager_Module.h" - -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - DANCE_DISABLE_TRACE (); - - int retval = 0; - - try - { - DAnCE::Logger_Service - * dlf = ACE_Dynamic_Service<DAnCE::Logger_Service>::instance ("DAnCE_Logger"); - - if (dlf) - { - dlf->init (argc, argv); - } - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("RepositoryManager - initializing ORB\n"))); - - CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO - ACE_TEXT("RepositoryManager - initializing module instance\n"))); - - DAnCE_RepositoryManager_Module rm; - CORBA::Object_var obj = rm.init (orb.in (), argc, argv); - - if (!CORBA::is_nil (obj.in ())) - { - DANCE_TRACE_LOG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO - ACE_TEXT("RepositoryManager - running ORB\n"))); - orb->run (); - } - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT("RepositoryManager - destroying ORB\n"))); - - orb->destroy (); - } - catch (const CORBA::Exception& ex) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, DLINFO - ACE_TEXT ("Caught CORBA Exception: %C\n"), - ex._info ().c_str ())); - retval = -1; - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_ERROR, "RepositoryManager - Error: Unknown exception.\n")); - retval = -1; - } - - return retval; -} - diff --git a/DAnCE/dance/RepositoryManager/Repository_Manager_Module.cpp b/DAnCE/dance/RepositoryManager/Repository_Manager_Module.cpp deleted file mode 100644 index f30a9948aec..00000000000 --- a/DAnCE/dance/RepositoryManager/Repository_Manager_Module.cpp +++ /dev/null @@ -1,544 +0,0 @@ -// -*- C++ -*- -#include "Repository_Manager_Module.h" -#include "ace/Get_Opt.h" -#include "ace/OS_NS_stdio.h" -#include "ace/Task.h" -#include "ace/Atomic_Op.h" -#include "tao/IORTable/IORTable.h" -#include "tao/Utils/PolicyList_Destroyer.h" -#include "orbsvcs/CosNamingC.h" -#include "dance/Logger/Log_Macros.h" -#include "dance/DAnCE_PropertiesC.h" - -#ifdef DANCE_RM_USES_JAWS -#include "JAWS/server/HTTP_Server.h" -#endif - -#include "RepositoryManager_Impl.h" - -namespace DAnCE -{ - namespace Repository_Manager - { - bool - write_IOR (const ACE_TCHAR * ior_file_name, const char* ior) - { - FILE* ior_output_file_ = - ACE_OS::fopen (ior_file_name, ACE_TEXT("w")); - - if (ior_output_file_) - { - ACE_OS::fprintf (ior_output_file_, - "%s", - ior); - ACE_OS::fclose (ior_output_file_); - return true; - } - return false; - } - - class Worker : public virtual ACE_Task_Base - { - public: - Worker (CORBA::ORB_ptr orb) : - orb_(CORBA::ORB::_duplicate (orb)) - { - } - - virtual int svc (void) - { - DANCE_TRACE ("DAnCE::Repository_Manager::Worker::svc"); - - size_t thread_id = ++this->thread_counter_; - - try - { - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_INFO, DLINFO ACE_TEXT("DAnCE::Repository_Manager::Worker::svc - ") - ACE_TEXT("Spawning thread %u for the ORB.\n"), thread_id)); - this->orb_->run (); - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_INFO, DLINFO ACE_TEXT("DAnCE::Repository_Manager::Worker::svc - ") - ACE_TEXT("ORB event loop for thread %u completed successfully.\n"), thread_id)); - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT("DAnCE::Repository_Manager::Worker::svc - ") - ACE_TEXT("Caught CORBA exception from ORB event loop for thread %u: %C\n"), - thread_id, ex._info ().c_str ())); - return -1; - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT("DAnCE::Repository_Manager::Worker::svc - ") - ACE_TEXT("Caught unknown C++ exception from ORB event loop for thread %u\n"), - thread_id)); - return -1; - } - - return 0; - } - - private: - ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> thread_counter_; - CORBA::ORB_var orb_; - }; - } -} - -DAnCE_RepositoryManager_Module::DAnCE_RepositoryManager_Module (void) -{ - DANCE_TRACE("DAnCE_RepositoryManager_Module::DAnCE_RepositoryManager_Module"); -} - -DAnCE_RepositoryManager_Module::~DAnCE_RepositoryManager_Module (void) -{ - DANCE_TRACE ("DAnCE_RepositoryManager_Module::~DAnCE_RepositoryManager_Module"); -} - -const char * -DAnCE_RepositoryManager_Module::usage (void) -{ - DANCE_TRACE ("DAnCE_RepositoryManager_Module::usage"); - return "Repository Manager Options:\n" - "\t-n|--name [name]\t Name to register in the naming service\n" - "\t-t|--threads [num]\t Number of threads to run.\n" - "\t-f|--file [name]\t Filename to output IOR.\n" - "\t-p|--package-dir [directory]\t Directory to store packages.\n" - "\t-s|--server-address [address]\t Address of the HTTP server associated with this RM.\n" - "\t-d|--domain-nc [NC]\t Default naming context for domain objects.\n" - "\t-h|help\t\t\t print this help message\n" -#ifdef DANCE_RM_USES_JAWS - "\t--spawn-http\t\t Spawn a JAWS http server, controlled by following options:\n" - "\t--http-port [port]\t Spawn JAWS HTTP server with provided port, default is 5432\n" - "\t--http-threads [number]\t Spawn provided number of threads in HTTP server, default is 1\n" - "\t--http-threading [strategy]\t Use provided threading strategy. POOL (Default), PER_REQUEST, THROTTLE.\n" - "\t--http-io [stratety]\t Use provided I/O strategy. SYNCH (default), ASYNCH.\n" - "\t--http-caching [strategy]\t Use provided caching strategy. NO_CACHE (default), CACHE\n" -#endif - ; - -} - -bool -DAnCE_RepositoryManager_Module::parse_args (int argc, ACE_TCHAR * argv[]) -{ - DANCE_TRACE ("DAnCE_RepositoryManager_Module::parse_args"); - - ACE_Get_Opt get_opts (argc - 1, - argv + 1, - ACE_TEXT(":hd:t:f:p:n:"), - 0, - 0, - ACE_Get_Opt::RETURN_IN_ORDER, - 1); - - get_opts.long_option (ACE_TEXT("help"), 'h', ACE_Get_Opt::NO_ARG); - get_opts.long_option (ACE_TEXT("domain-nc"), 'd', ACE_Get_Opt::ARG_REQUIRED); - get_opts.long_option (ACE_TEXT("file"), 'f', ACE_Get_Opt::ARG_REQUIRED); - get_opts.long_option (ACE_TEXT("threads"), 't', ACE_Get_Opt::ARG_REQUIRED); - get_opts.long_option (ACE_TEXT("package-dir"), 'p', ACE_Get_Opt::ARG_REQUIRED); - get_opts.long_option (ACE_TEXT("name"), 'n', ACE_Get_Opt::ARG_REQUIRED); - get_opts.long_option (ACE_TEXT("server-address"), 's', ACE_Get_Opt::ARG_REQUIRED); -#ifdef DANCE_RM_USES_JAWS - get_opts.long_option (ACE_TEXT("spawn-http"), ACE_Get_Opt::NO_ARG); - get_opts.long_option (ACE_TEXT("http-port"), ACE_Get_Opt::ARG_REQUIRED); - get_opts.long_option (ACE_TEXT("http-threads"), ACE_Get_Opt::ARG_REQUIRED); - get_opts.long_option (ACE_TEXT("http-threading"), ACE_Get_Opt::ARG_REQUIRED); - get_opts.long_option (ACE_TEXT("http-io"), ACE_Get_Opt::ARG_REQUIRED); - get_opts.long_option (ACE_TEXT("http-caching"), ACE_Get_Opt::ARG_REQUIRED); -#endif /* DANCE_RM_USES_JAWS */ - - //get_opts.long_option ("help", '?'); - - int c; - while ( (c = get_opts ()) != -1) - { - switch (c) - { - case 'd': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT("Repository_Manager_Module::parse_args - ") - ACE_TEXT("Binding to provided Domain Naming Context: '%s'\n"), - get_opts.opt_arg ())); - this->options_.domain_nc_ = get_opts.opt_arg (); - break; - - case 'f': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT("Repository_Manager_Module::parse_args - ") - ACE_TEXT("Output filename for IOR is %s\n"), - get_opts.opt_arg ())); - this->options_.ior_file_ = get_opts.opt_arg (); - break; - - case 't': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT("Repository_Manager_Module::parse_args - ") - ACE_TEXT("Number of threads is %s\n"), get_opts.opt_arg ())); - this->options_.threads_ = (ACE_OS::atoi (get_opts.opt_arg ())); - break; - - case 'p': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT("Repository_Manager_Module::parse_args - ") - ACE_TEXT("Package directory is %s\n"), - get_opts.opt_arg ())); - this->options_.package_dir_ = get_opts.opt_arg (); - break; - - case 'n': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT("Repository_Manager_Module::parse_args - ") - ACE_TEXT("Name is %s\n"), - get_opts.opt_arg ())); - this->options_.name_ = get_opts.opt_arg (); - break; - - case 's': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT("Repository_Manager_Module::parse_args - ") - ACE_TEXT("Server address is %s\n"), - get_opts.opt_arg ())); - this->options_.server_address_ = get_opts.opt_arg (); - break; - - case 0: - if (ACE_OS::strcmp (get_opts.long_option (), ACE_TEXT("spawn-http")) == 0) - { - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT("Repository_Manager_Module::parse_args - ") - ACE_TEXT("Found option to spawn in-process HTTP server\n"))); - this->options_.spawn_http_ = true; - } - else if (ACE_OS::strcmp (get_opts.long_option (), ACE_TEXT("http-port")) == 0) - { - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT("Repository_Manager_Module::parse_args - ") - ACE_TEXT("Using %s as the spawned HTTP server port\n"), - get_opts.opt_arg ())); - this->options_.spawn_http_ = true; - this->options_.http_port_ = get_opts.opt_arg (); - } - else if (ACE_OS::strcmp (get_opts.long_option (), ACE_TEXT("http-threads")) == 0) - { - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT("Repository_Manager_Module::parse_args - ") - ACE_TEXT("Using %s as the spawned HTTP number of threads\n"), - get_opts.opt_arg ())); - this->options_.spawn_http_ = true; - this->options_.http_threads_ = get_opts.opt_arg (); - } - else if (ACE_OS::strcmp (get_opts.long_option (), ACE_TEXT("http-threading")) == 0) - { - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT("Repository_Manager_Module::parse_args - ") - ACE_TEXT("Using %s as the spawned HTTP server threading model\n"), - get_opts.opt_arg ())); - this->options_.spawn_http_ = true; - this->options_.http_threading_ = get_opts.opt_arg (); - } - else if (ACE_OS::strcmp (get_opts.long_option (), ACE_TEXT("http-io")) == 0) - { - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT("Repository_Manager_Module::parse_args - ") - ACE_TEXT("Using %s as the spawned HTTP server IO strategy\n"), - get_opts.opt_arg ())); - this->options_.spawn_http_ = true; - this->options_.http_io_ = get_opts.opt_arg (); - } - else if (ACE_OS::strcmp (get_opts.long_option (), ACE_TEXT("http-caching")) == 0) - { - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT("Repository_Manager_Module::parse_args - ") - ACE_TEXT("Using %s as the spawned HTTP server caching strategy\n"), - get_opts.opt_arg ())); - this->options_.spawn_http_ = true; - this->options_.http_caching_ = get_opts.opt_arg (); - } - else - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO ACE_TEXT("Repository_Manager_Module::parse_args - ") - ACE_TEXT("ERROR: unknown long option %s\n"), - get_opts.long_option ())); - } - - break; - - case 'h': - case '?': // Display help for use of the server. - default: - ACE_ERROR_RETURN ((LM_ERROR, - this->usage (), - argv [0], c), - false); - break; - } - - } - - if (this->options_.server_address_ == 0) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT("Repository_Manager_Module::parse_args - ") - ACE_TEXT("Must provide server address using --server-address option.\n"))); - return false; - } - - return true; -} - -CORBA::Object_ptr -DAnCE_RepositoryManager_Module::init (CORBA::ORB_ptr orb, - int argc, - ACE_TCHAR *argv[]) -{ - DANCE_TRACE ("DAnCE_RepositoryManager_Module::init"); - - try - { - if (CORBA::is_nil(orb)) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO ACE_TEXT("DAnCE_RepositoryManager_Module::init - ") - ACE_TEXT("Attempted to create Repository Manager with a nil orb.\n"))); - return CORBA::Object::_nil(); - } - else - { - this->orb_ = CORBA::ORB::_duplicate (orb); - } - - if (ACE_OS::strcmp(orb->id(), this->orb_->id()) != 0) - { - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO ACE_TEXT("DAnCE_RepositoryManager_Module::init - ") - ACE_TEXT("Resetting NM's orb.\n"))); - this->orb_ = CORBA::ORB::_duplicate (orb); - this->domain_nc_ = CosNaming::NamingContext::_nil(); - } - - if (!this->parse_args (argc, argv)) - { - return CORBA::Object::_nil (); - } - - if (this->options_.spawn_http_) - this->spawn_http (); - - this->create_poas (); - - if (this->options_.domain_nc_) - { - try - { - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO ACE_TEXT("DAnCE_RepositoryManager_Module::init - ") - ACE_TEXT("Resolving DomainNC.\n"))); - CORBA::Object_var domain_obj = this->orb_->string_to_object (this->options_.domain_nc_); - if (!CORBA::is_nil (domain_obj.in ())) - { - this->domain_nc_ = CosNaming::NamingContext::_narrow (domain_obj.in()); - if (CORBA::is_nil (this->domain_nc_.in ())) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR,DLINFO ACE_TEXT("DAnCE_RepositoryManager_Module::init - ") - ACE_TEXT("Narrow to NamingContext return nil for DomainNC.\n"))); - return CORBA::Object::_nil (); - } - } - } - catch (const CORBA::Exception&) - { - DANCE_DEBUG (DANCE_LOG_ERROR, - (LM_WARNING, DLINFO ACE_TEXT("DAnCE_RepositoryManager_Module::init - ") - ACE_TEXT("DomainNC context not found!\n"))); - } - } - - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO ACE_TEXT("DAnCE_RepositoryManager_Module::init - ") - ACE_TEXT("Initializing the IOR Table\n"))); - // Initialize IOR table - CORBA::Object_var table_object = orb->resolve_initial_references ("IORTable"); - - IORTable::Table_var adapter = IORTable::Table::_narrow (table_object.in ()); - - if (CORBA::is_nil (adapter.in ())) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_ERROR, DLINFO ACE_TEXT("DAnCE_RepositoryManager_Module::init - ") - ACE_TEXT("Unable to RIR the IORTable.\n"))); - return CORBA::Object::_nil (); - } - - - //Creating repository manager servant - DAnCE::RepositoryManagerDaemon_i * rm = new DAnCE::RepositoryManagerDaemon_i (orb, - this->options_.server_address_, - this->options_.package_dir_); - PortableServer::ServantBase_var safe_svt (rm); - - ACE_CString repository_manager_oid; - - if (this->options_.name_ == 0) - repository_manager_oid = "RepositoryManager"; - else - { - repository_manager_oid = this->options_.name_; - repository_manager_oid += ".RepositoryManager"; - } - - // Registering servant in poa - PortableServer::ObjectId_var oid = - PortableServer::string_to_ObjectId (repository_manager_oid.c_str()); - this->rm_poa_->activate_object_with_id (oid, rm); - - // Getting repository manager ior - CORBA::Object_var nm_obj = this->rm_poa_->id_to_reference (oid.in ()); - CORBA::String_var ior = orb->object_to_string (nm_obj.in ()); - - // Binding ior to IOR Table - adapter->bind (repository_manager_oid.c_str (), ior.in ()); - - // Binding repository manager to DomainNC - if (!CORBA::is_nil (this->domain_nc_.in ())) - { - ACE_CString ns_name; - if (this->options_.name_ == 0) - ns_name = "RepositoryManager"; - else ns_name = this->options_.name_; - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_TRACE, DLINFO ACE_TEXT("DAnCE_RepositoryManager_Module::init - ") - ACE_TEXT("Registering NM in NC as \"%C\".\n"), ns_name.c_str ())); - CosNaming::Name name (1); - name.length (1); - name[0].id = CORBA::string_dup (ns_name.c_str ()); - name[0].kind = CORBA::string_dup ("RepositoryManager"); - this->domain_nc_->rebind (name, nm_obj.in ()); - } - - // Writing ior to file - if (0 != this->options_.ior_file_) - { - DANCE_TRACE_LOG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO ACE_TEXT("DAnCE_RepositoryManager_Module::init - ") - ACE_TEXT("Writing RM IOR %C to file %C.\n"), this->options_.ior_file_, ior.in ())); - if (!DAnCE::Repository_Manager::write_IOR (this->options_.ior_file_, ior.in ())) - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT("DAnCE_RepositoryManager_Module::init - ") - ACE_TEXT("Error: Unable to write IOR to file %C\n"), - this->options_.ior_file_)); - } - - // Activate POA manager - PortableServer::POAManager_var mgr = this->root_poa_->the_POAManager (); - mgr->activate (); - - // Finishing Deployment part - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_NOTICE, DLINFO ACE_TEXT("DAnCE_RepositoryManager_Module::init - ") - ACE_TEXT("DAnCE_RepositoryManager is running...\n"))); - - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO ACE_TEXT("DAnCE_RepositoryManager_Module::init - ") - ACE_TEXT("RepositoryManager IOR: %C\n"), ior.in ())); - - return nm_obj._retn (); - } - catch (const CORBA::Exception& ex) - { - ex._tao_print_exception ("DAnCE_RepositoryManager::main\t\n"); - return CORBA::Object::_nil (); - } -} - -void -DAnCE_RepositoryManager_Module::create_poas (void) -{ - DANCE_TRACE("DAnCE_RepositoryManager_Module::create_poas"); - // Get reference to Root POA. - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO ACE_TEXT("DAnCE_RepositoryManager_Module::create_poas - ") - ACE_TEXT("Resolving root POA\n"))); - CORBA::Object_var obj = this->orb_->resolve_initial_references ("RootPOA"); - - this->root_poa_ = PortableServer::POA::_narrow (obj.in ()); - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO ACE_TEXT("DAnCE_RepositoryManager_Module::create_poas - ") - ACE_TEXT("Obtaining the POAManager\n"))); - PortableServer::POAManager_var mgr = this->root_poa_->the_POAManager (); - - TAO::Utils::PolicyList_Destroyer policies (2); - policies.length (2); - - try - { - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO ACE_TEXT("DAnCE_RepositoryManager_Module::create_poas - ") - ACE_TEXT("DAnCE_RepositoryManager_Module::create_poas - ") - ACE_TEXT("Creating the \"Repository\" POA.\n"))); - - policies[0] = this->root_poa_->create_id_assignment_policy (PortableServer::USER_ID); - policies[1] = this->root_poa_->create_lifespan_policy (PortableServer::PERSISTENT); - this->rm_poa_ = this->root_poa_->create_POA ("Repository", - mgr.in(), - policies); - } - catch (const PortableServer::POA::AdapterAlreadyExists &) - { - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_INFO, DLINFO ACE_TEXT("DAnCE_RepositoryManager_Module::create_poas - ") - ACE_TEXT("Using existing \"Repository\" POA\n"))); - this->rm_poa_ = this->root_poa_->find_POA ("Repository", 0); - } -} - -void -DAnCE_RepositoryManager_Module::spawn_http (void) -{ - DANCE_TRACE ("DAnCE_RepositoryManager_Module::spawn_http"); - - ACE_CString directive = -#if (ACE_USES_CLASSIC_SVC_CONF == 0) - ACE_TEXT ("<dynamic id=\"HTTP_Server\" type=\"Service_Object\">") - ACE_TEXT (" <initializer init=\"_make_HTTP_Server\" path=\"JAWS\" params=\""); -#else - ACE_TEXT ("dynamic HTTP_Server Service_Object *") - ACE_TEXT (" JAWS:_make_HTTP_Server() \""); -#endif - - directive += ACE_TEXT ("-p "); - directive += this->options_.http_port_; - directive += ACE_TEXT (" -n "); - directive += this->options_.http_threads_; - directive += ACE_TEXT (" -i "); - directive += this->options_.http_io_; - directive += ACE_TEXT (" -t "); - directive += this->options_.http_threading_; - directive += ACE_TEXT (" -c "); - directive += this->options_.http_caching_; - directive += ACE_TEXT (" -b 50 -f THR_NEW_LWP"); - directive += ACE_TEXT ("\""); - -#if (ACE_USES_CLASSIC_SVC_CONF == 0) - directive += ACE_TEXT ("/>"); - directive += ACE_TEXT ("</dynamic>"); -#endif - - ACE_Service_Config::current ()->process_directive (directive.c_str ()); -} - diff --git a/DAnCE/dance/RepositoryManager/Repository_Manager_Module.h b/DAnCE/dance/RepositoryManager/Repository_Manager_Module.h deleted file mode 100644 index eec0a1f7375..00000000000 --- a/DAnCE/dance/RepositoryManager/Repository_Manager_Module.h +++ /dev/null @@ -1,105 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Repository_Manager_Module.h - * - * @brief To start RepositoryManager by starter - * - * @author Vinzenz Tornow <vt@prismtech.com> - * @author William R. Otte <wotte@dre.vanderbilt.edu> - */ -//============================================================================= - -#ifndef NODE_MANAGER_MODULE_H -#define NODE_MANAGER_MODULE_H - -#include /**/ "ace/pre.h" - -#include "ace/Service_Config.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Vector_T.h" -#include "ace/Map_Manager.h" -#include "ace/Null_Mutex.h" -#include "tao/ORB.h" -#include "tao/PortableServer/PortableServer.h" -#include "orbsvcs/CosNamingC.h" -#include "dance/DAnCE_Utility.h" - -/** - * @class Repository_Manager_Module - * - * This class runs the node manager instance - */ -class DAnCE_RepositoryManager_Module -{ - public: - /// Constructor. - DAnCE_RepositoryManager_Module (void); - - /// Destructor. - ~DAnCE_RepositoryManager_Module (void); - - /// Overload the base class method to create a new instance - /// of a DAnCE_RepositoryManager_Module object. - CORBA::Object_ptr init (CORBA::ORB_ptr orb, - int argc, - ACE_TCHAR *argv []); - - private: - struct SOptions - { - const ACE_TCHAR * domain_nc_; - const ACE_TCHAR * ior_file_; - size_t threads_; - const ACE_TCHAR * package_dir_; - const ACE_TCHAR * name_; - const ACE_TCHAR * server_address_; - - bool spawn_http_; - const ACE_TCHAR *http_port_; - const ACE_TCHAR *http_threads_; - const ACE_TCHAR *http_threading_; - const ACE_TCHAR *http_io_; - const ACE_TCHAR *http_caching_; - - SOptions() : - domain_nc_ (0), - ior_file_ (0), - threads_ (1), - package_dir_ (ACE_TEXT("RepositoryManager_Packages")), - server_address_ (0), - spawn_http_ (false), - http_port_ (ACE_TEXT("5432")), - http_threads_ (ACE_TEXT("1")), - http_threading_ (ACE_TEXT("POOL")), - http_io_ (ACE_TEXT("SYNCH")), - http_caching_ (ACE_TEXT("NO_CACHE")) - { - } - }; - - const char * usage (void); - - bool parse_args (int argc, ACE_TCHAR *argv []); - - void create_poas (void); - - void spawn_http (void); - - CORBA::ORB_var orb_; - CosNaming::NamingContext_var domain_nc_; - - SOptions options_; - - PortableServer::POA_var root_poa_; - PortableServer::POA_var rm_poa_; -}; - -#include /**/ "ace/post.h" - -#endif /* NODE_MANAGER_MODULE_H */ diff --git a/DAnCE/dance/RepositoryManager/URL_Parser.cpp b/DAnCE/dance/RepositoryManager/URL_Parser.cpp deleted file mode 100644 index 45231335298..00000000000 --- a/DAnCE/dance/RepositoryManager/URL_Parser.cpp +++ /dev/null @@ -1,100 +0,0 @@ -#include "ace/Get_Opt.h" -#include "ace/ARGV.h" -#include "URL_Parser.h" -#include "ace/ACE.h" - -#include "dance/Logger/Log_Macros.h" - -bool -URL_Parser::parse_args (int argc, ACE_TCHAR *argv[]) -{ - ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("rwu:h:p:f:d")); - - bool success = true; - int c; - - while ((c = get_opt ()) != -1) - switch (c) - { - case 'd': - this->debug_ = true; - break; - case 'u': - success = parseURL (get_opt.opt_arg ()); - break; - // Usage fallthrough. - default: - success = false; - } - - if (this->hostname_ == 0 || this->filename_ == 0) - { - success = false; - } - - return success; -} - -URL_Parser::URL_Parser (void) - : hostname_ (ACE::strnew (ACE_TEXT("127.0.0.1"))), - port_ (ACE_DEFAULT_HTTP_SERVER_PORT), - filename_ (0), - debug_ (false) -{ -} - -bool URL_Parser::parseURL (ACE_TCHAR* url) -{ - ACE_TCHAR* ptr = 0; - bool success = true; - ptr = ACE_OS::strstr (url, ACE_TEXT("http://")); - if (ptr) - url += ACE_OS::strlen (ACE_TEXT("http://")); - - if (url[0] == '/') - { - this->filename_ = ACE_OS::strdup (url); - } - else - { - ptr = ACE_OS::strstr (url, ":"); - if (ptr) - this->port_ = ACE_OS::atoi (ptr + 1); - else - ptr = ACE_OS::strstr (url, "/"); - - if(!ptr) - success = false; - else - { - size_t host_len = ptr - url; - ACE::strdelete (this->hostname_); - ACE_NEW_RETURN (this->hostname_, char [host_len + 1], false); - ACE_OS::strncpy (this->hostname_, url, host_len); - this->hostname_ [host_len] = '\0'; - ptr = ACE_OS::strstr (ptr, "/"); - if (ptr) - { - this->filename_ = ACE_OS::strdup(ptr); - } - else - { - success = false; - } - } - } - return success; -} - - -void URL_Parser::Error (void) -{ - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_DEBUG, "./http_client -u http://hostname:port/filename [-d]\n")); -} - -URL_Parser::~URL_Parser() -{ - delete [] this->hostname_; - ACE_OS::free (this->filename_); -} diff --git a/DAnCE/dance/RepositoryManager/URL_Parser.h b/DAnCE/dance/RepositoryManager/URL_Parser.h deleted file mode 100644 index 9ec963baa12..00000000000 --- a/DAnCE/dance/RepositoryManager/URL_Parser.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- C++ -*- */ - -//============================================================================= -/** - * @file URL_Parser.h - * - * Parses a URL into its logical chunks - * - * @author Stoyan Paunov - */ -//============================================================================= - - -#ifndef URL_PARSER_H -#define URL_PARSER_H - -#include "ace/Singleton.h" //for ACE_Singleton -#include "ace/Null_Mutex.h" //for ACE_Null_Mutex - -// Forward declaration -class URL_Parser; - -typedef ACE_Singleton <URL_Parser, ACE_Null_Mutex> TheURL_Parser; - -class URL_Parser -{ -public: - - friend class ACE_Singleton <URL_Parser, ACE_Null_Mutex>; - - /// Parses commandline arguments - bool parse_args (int argc, ACE_TCHAR *argv[]); - - /// Return false on failure - bool parseURL (ACE_TCHAR* url); - - void Error (void); - - /// Hostname to connect to - ACE_TCHAR *hostname_; - - /// Port number to use - u_short port_; - - /// Filename to upload/download - ACE_TCHAR *filename_; - - /// Turns on verbosity - bool debug_; - - /// destructor - ~URL_Parser (void); - -protected: - /// protected constructor, singleton - URL_Parser (void); -}; - - - -#endif /* URL_PARSER_H */ diff --git a/DAnCE/dance/RepositoryManager/ZIP_Wrapper.cpp b/DAnCE/dance/RepositoryManager/ZIP_Wrapper.cpp deleted file mode 100644 index 0e6af8b73fb..00000000000 --- a/DAnCE/dance/RepositoryManager/ZIP_Wrapper.cpp +++ /dev/null @@ -1,386 +0,0 @@ - -//=============================================================================== -/** - * @file ZIP_Wrapper.cpp - * - * Purpose: implementing the ZIP_Wrapper class - * - * @author Stoyan Paunov, Vipul Singh - */ -//=============================================================================== - -#include "ace/Containers_T.h" //for ACE_Double_Linked_List -#include "ace/Message_Block.h" //for ACE_Message_Block -#include "ace/OS_NS_fcntl.h" //for open -#include "ace/OS_NS_unistd.h" //for close -#include "ace/OS_NS_string.h" //for strncpy -#include "ace/SString.h" //for ACE_CString -#include "ace/OS_NS_sys_stat.h" //for stat -#include "ace/OS_NS_sys_stat.h" //for filesize and mkdir -#include "ace/OS_Memory.h" //for ACE_NEW* macros -#include "dance/Logger/Log_Macros.h" - -#include <string> -#include "minizip/unzip.h" -#define MAXFILENAME (256) -#define CASESENSITIVITY (0) -#define WRITEBUFFERSIZE (8192) - -#include "ZIP_Wrapper.h" - -//ZIP_File_Info constructor -ZIP_File_Info::ZIP_File_Info (char* name, size_t size) - : name_ (name), - size_ (size), - next_ (0), - prev_ (0) -{ -} - -//ZIP_File_Info default constructor -ZIP_File_Info::ZIP_File_Info () - : name_ (""), - size_ (0), - next_ (0), - prev_ (0) -{ -} - - -/// Gets a list of the files in the archive. -int ZIP_Wrapper::file_list_info (char* zip_name, - ACE_Double_Linked_List<ZIP_File_Info> &list) -{ - unzFile uf=0; - char filename_try[MAXFILENAME+16] = ""; - if (zip_name!=0) - { - ACE_OS::strncpy(filename_try, zip_name, MAXFILENAME-1); - /* strncpy doesnt append the trailing NULL, if the string is too long. */ - filename_try[ MAXFILENAME ] = '\0'; - /* open the zip file */ - uf = unzOpen(zip_name); - /* if zipfile could not be opened, try appending .zip to name */ - if (uf==0) - { - ACE_OS::strcat(filename_try, ".zip"); - uf = unzOpen(filename_try); - } - } - /* If zipfile could not be opened still, return */ - if (uf==0) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_DEBUG, ACE_TEXT("There is some problem in opening") - ACE_TEXT(" %s or %s.zip using unzOpen\n"), zip_name, zip_name)); - return 1; - } - unz_global_info gi; - /* get information about all the files in zip file*/ - int err = unzGetGlobalInfo(uf, &gi); - if (err!=UNZ_OK) - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_DEBUG, ACE_TEXT("unzGetGlobalInfo failed while trying") - ACE_TEXT(" to get global information about zipfile\n"), err)); - /* gi.number_entry corresponds to the number of directory entries - in the zip file */ - for (uLong i=0;i<gi.number_entry;i++) - { - char filename_inzip[256]; - unz_file_info file_info; - /* get information about the current file in zip file */ - err = unzGetCurrentFileInfo(uf, &file_info, filename_inzip, - sizeof(filename_inzip), 0, 0, 0, 0); - if (err!=UNZ_OK) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_DEBUG, ACE_TEXT("unzGetCurrentFileInfo failed") - ACE_TEXT(" while trying to get information") - ACE_TEXT(" about current file\n"), err)); - break; - } - ZIP_File_Info* next = 0; - ACE_NEW_RETURN (next, ZIP_File_Info (filename_inzip, - sizeof(filename_inzip)), -1); - /* add information about current file to the list */ - list.insert_tail (next); - if ((i+1)<gi.number_entry) - { - err = unzGoToNextFile(uf); - if (err!=UNZ_OK) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_DEBUG, - ACE_TEXT(" unzGoToNextFile failed") - ACE_TEXT(" while trying to go to next file\n"), - err)); - break; - } - } - } - unzCloseCurrentFile(uf); - return gi.number_entry; -} - - -//get file and store it into ACE message block. -bool ZIP_Wrapper::get_file (char* archive_path, char* filename, - ACE_Message_Block &file) -{ - bool return_code = true; - unzFile uf=0; - uf = unzOpen(archive_path); - /* locate the desired file in the zip file and set it as current file*/ - int j=unzLocateFile(uf, filename, 0); - if (j==UNZ_END_OF_LIST_OF_FILE) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_DEBUG, ACE_TEXT("File not found in zip archive"))); - return false; - } - else if (j==UNZ_OK) - { - int k=unzOpenCurrentFile(uf); - if (k!=UNZ_OK) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_DEBUG, ACE_TEXT("Error in opening the current") - ACE_TEXT(" file using unzOpenCurrentFile"))); - return false; - } - else - { - int num_read = 0; - ACE_Message_Block* head = &file; - - //read the file into the ACE_Message_Block - do - { - if (head->space () == 0) - { - ACE_Message_Block* next = 0; - ACE_NEW_RETURN (next, ACE_Message_Block (BUFSIZ), false); - head->cont (); - head = head->cont (); - } - num_read = unzReadCurrentFile(archive_path, head->wr_ptr(), - head->space()); - if (num_read > 0) - head->wr_ptr (num_read); - } while (num_read > 0); - if (num_read < 0) - return_code = false; - unzCloseCurrentFile(uf); - unzClose(uf); - return return_code; - } - } - return return_code; -} - - -/// uncompress the zip file -/// The zip file will be uncompressed into a directory -/// with the name of zip archive. -/// the path is assumed to be an existing directory - -bool ZIP_Wrapper::uncompress (char* zip_archive, char* path, bool verbose) -{ - //open the zip archive - unzFile uf=0; - uf = unzOpen(zip_archive); - if (uf==0) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_DEBUG,ACE_TEXT("unzOpen failed to open the") - ACE_TEXT(" zipfile\n"))); - return false; - } - //get the name of the archive - ACE_CString arch_dir (path); - arch_dir += "/"; - //get only the name of the archive; remove path info - char* n = ACE_OS::strstr (zip_archive, "/"); - char* zip_name = 0; - while (n != 0) - { - zip_name = ++n; - n = ACE_OS::strstr (n, "/"); - } - arch_dir += zip_name; - //NOTE: Assumes .zip or cpk extension - arch_dir = arch_dir.substring (0, arch_dir.length () - 4); - //create directory with the name of zip archive - ACE_OS::mkdir(arch_dir.c_str()); - //if dir exists -1 is returned and ignored - unz_global_info gi; - int err = unzGetGlobalInfo(uf, &gi); - if (err!=UNZ_OK) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_DEBUG, ACE_TEXT("unzGetGlobalInfo failed to get global") - ACE_TEXT(" information about zipfile\n"), err)); - return false; - } - err =unzGoToFirstFile(uf); - if (err!=UNZ_OK) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_DEBUG,ACE_TEXT("error %d with zipfile in" - ACE_TEXT(" unzGoToFirstFile\n")), err)); - return false; - } - /* read each entry of zip file, create directory structure if it is - a non existing directory whereas if it is a file, write the file - at the proper path in the directory structure */ - for (uLong i=0;i<gi.number_entry;i++) - { - char filename_inzip[256]; - unz_file_info file_info; - err = unzGetCurrentFileInfo(uf, &file_info, filename_inzip, - sizeof(filename_inzip), 0, 0, 0, 0); - if (err!=UNZ_OK) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_DEBUG, ACE_TEXT("unzGetCurrentFileInfo failed") - ACE_TEXT(" while trying to get information") - ACE_TEXT(" about currentfile\n"), err)); - break; - } - int direc = checkdir(filename_inzip); - /* If it is a directory, we create directory structure */ - if (direc==1) - { - makethedir(filename_inzip, arch_dir); - } - /* If it is a file, we read its data and write the uncompressed - data to the file with proper path.*/ - else if (direc==0) - { - handlethefile(filename_inzip, uf, file_info, verbose, arch_dir); - } - if ((i+1)<gi.number_entry) - { - err = unzGoToNextFile(uf); - if (err!=UNZ_OK) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR,ACE_TEXT("unzGoToNextFile failed") - ACE_TEXT(" while trying to go to") - ACE_TEXT(" nextfile\n"), err)); - break; - } - } - } - unzClose(uf); - return true; -} - - - -///try to find if it is a directory OR file -int ZIP_Wrapper::checkdir (char* filename_inzip) -{ - int direc = 0; - char* dircheck = ACE_OS::strstr (filename_inzip, "/"); - /* We assume that a directory will have its entry terminating in a / - We also assume that the directory entries in the zip file use - forward slash for both unix and windows */ - while (dircheck != 0) - { - int i = ACE_OS::strcmp(dircheck, "/"); - if (i == 0) - { - direc = 1; - break; - } - ++dircheck; - dircheck = ACE_OS::strstr (dircheck, "/"); - } - return direc; -} - -/// Create directory structure if entry in zipfile is a directory -int ZIP_Wrapper::makethedir (char* filename_inzip, ACE_CString arch_dir) -{ - // let's try to create the directory structure for the package - char dir_name [2048]; - char* next = ACE_OS::strstr (filename_inzip, "/"); - while (next != 0) - { - ACE_CString location (arch_dir); - ACE_OS::strncpy (dir_name, filename_inzip, next - filename_inzip - + 1); - - dir_name[next - filename_inzip + 1] = '\0'; - location += "/"; - location += dir_name; - ACE_stat stat; - if (ACE_OS::stat (location.c_str (), &stat) == -1) - ACE_OS::mkdir (location.c_str ()); - next++; - next = ACE_OS::strstr (next, "/"); - } - return 0; -} - -/// If entry in zipfile is a file, then read the file and write the -/// uncompressed data at the proper filepath. -int ZIP_Wrapper::handlethefile (char* filename_inzip, unzFile uf, - unz_file_info file_info, bool verbose, - ACE_CString arch_dir) -{ - int k = unzOpenCurrentFile(uf); - if (k!=UNZ_OK) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR,ACE_TEXT("unzOpenCurrentFile failed in" - " opening the current file"))); - return false; - } - else - { - size_t const file_size = file_info.uncompressed_size; - char* temp = 0; - ACE_NEW_RETURN (temp, char [file_size], false); - ACE_Auto_Basic_Array_Ptr<char> buffer (temp); - //read in the data - unzReadCurrentFile(uf, &(*buffer), file_size); - //close the zip handle - unzCloseCurrentFile(uf); - //create file name + path to open - std::string file_path (arch_dir.c_str ()); - //NOTE: need the c-style char to stop at '\0' - file_path += "/"; - file_path += filename_inzip; - //print out the file to be uncompressed - if (verbose) - { - ACE_OS::write(ACE_STDOUT, file_path.c_str (), - file_path.length () ); - ACE_OS::write(ACE_STDOUT, "\n", 1); - } - // Open a file handle to the local filesystem - ACE_HANDLE handle = ACE_OS::open (file_path.c_str (), - O_CREAT | O_TRUNC | O_WRONLY); - if (handle == ACE_INVALID_HANDLE) - { - unzClose(uf); - DANCE_ERROR_RETURN (DANCE_LOG_ERROR, (LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("[uncompress] file creation error")), - 0); - } - //write the uncompressed data to the file - if (ACE_OS::write (handle, &(*buffer), file_size) == -1) - { - unzClose(uf); - DANCE_ERROR_RETURN (DANCE_LOG_ERROR, - (LM_ERROR, - ACE_TEXT ("%p\n"), - ACE_TEXT ("[uncompress] file write error")), - 0); - } - // Close the file handle - ACE_OS::close (handle); - } - return 0; -} diff --git a/DAnCE/dance/RepositoryManager/ZIP_Wrapper.h b/DAnCE/dance/RepositoryManager/ZIP_Wrapper.h deleted file mode 100644 index 1c6e5c5fad2..00000000000 --- a/DAnCE/dance/RepositoryManager/ZIP_Wrapper.h +++ /dev/null @@ -1,113 +0,0 @@ - -/* -*- C++ -*- */ - -//======================================================================= -/** - * @file ZIP_Wrapper.h - * - * Purpose: to provide a wrapper around minizip for easy handling of - * ZIP archives. This wrapper can be used as an auxiliary - * class that allows a program to become ZIP-aware - * - * @author Stoyan Paunov, Vipul Singh - */ -//======================================================================= - -#ifndef _ZIP_WRAPPER_H_ -#define _ZIP_WRAPPER_H_ - -#include "ace/Containers_T.h" //for ACE_Double_Linked_List -#include "ace/Message_Block.h" //for ACE_Message_Block -#include "ace/SString.h" //for ACE_CString - - -#include "ace/OS_NS_fcntl.h" //for open -#include "ace/OS_NS_sys_stat.h" //for filesize and mkdir - -#include "minizip/unzip.h" - - -/** - * @class ZIP_File_Info - * - * This class is used as a carrier of information - * about entities residing inside a ZIP archive - */ -class ZIP_File_Info -{ -public: - ACE_CString name_; - size_t size_; - ZIP_File_Info* next_; - ZIP_File_Info* prev_; - - ZIP_File_Info (char* name, size_t size); - ZIP_File_Info (); -}; - -/** - * @class ZIP_Wrappers - * - * This class is the actual workhorse that provides all of - * the necessary functionality - */ -class ZIP_Wrapper -{ -public: - - /// Get file and store it into an ACE_Message_Block. The function - /// averts subdirectory traversal problems. - /// NOTE: Be sure to release the message block even if the function returns - /// false becuase the return value might be due to unsuccessful allocation - - ///archive_path is the zip archive with the path - ///filename is the name of the file to be looked for in the zip archive. - ///the file is stored in ACE message block. - static bool get_file (char* archive_path, char* filename, - ACE_Message_Block &file); - - /// uncompress the zip file - /// The zip file will be uncompressed into a directory with the - ///name of zip archive. - /// The path is assumed to be an existing directory - - ///zip_archive is the arcive to be uncompressed with full path. - ///path is used for creating a directory with the name of zip archive. - static bool uncompress (char* zip_archive, char* path = 0, - bool verbose = true); - - /// Get a list of the files in the archive - - ///zip_name is the name of zipfile with fullpath. - ///list stores information about each entry in zip file. - static int file_list_info (char* zip_name, - ACE_Double_Linked_List<ZIP_File_Info> &list); - - ///Check if an entry of a zip file is a file or directory - ///We assume a directoryname terminates with a forward slash - ///Returns 1 for directory while 0 for file. - - ///filename_inzip is an entry in a zipfile - static int checkdir (char* filename_inzip); - - ///Create directory structure if entry in zipfile is a directory - - ///filename_inzip is an entry in a zipfile - ///arch_dir stores the name of the directory to be created - static int makethedir (char* filename_inzip, ACE_CString arch_dir); - - ///If entry in zipfile is a file, then read the file and write - /// the uncompressed data at the proper filepath. - - ///filename_inzip is an entry in a zipfile - ///uf refers to the zip archive - ///file_info is used to get information about current file - ///verbose decides if the details are to be printed or not - ///arch_dir is the name of file with full path where it is to be - ///uncompressed - static int handlethefile (char* filename_inzip, unzFile uf, - unz_file_info file_info, - bool verbose, ACE_CString arch_dir); -}; - -#endif diff --git a/DAnCE/dance/RepositoryManager/repository_manager_admin.cpp b/DAnCE/dance/RepositoryManager/repository_manager_admin.cpp deleted file mode 100644 index 754880c7240..00000000000 --- a/DAnCE/dance/RepositoryManager/repository_manager_admin.cpp +++ /dev/null @@ -1,247 +0,0 @@ -#include "repository_manager_admin.h" -#include "dance/Logger/Log_Macros.h" -#include "RepositoryManagerDaemonC.h" - -namespace DAnCE -{ - namespace RepositoryManager - { - Admin::Admin (Deployment::RepositoryManager_ptr rm) - : rm_ (Deployment::RepositoryManager::_duplicate (rm)) - { - DANCE_TRACE ("Admin::Admin"); - } - - - /// Install a package at a provided filesystem path. - bool - Admin::install_package (const ACE_TCHAR *uri, - const ACE_TCHAR *name, - bool replace) - { - DANCE_TRACE ("Admin::install_package"); - - try - { - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_TRACE, DLINFO ACE_TEXT ("Admin::install_package - ") - ACE_TEXT ("Installing package with URI: %s, name: %s\n"), - uri, name)); - this->rm_->installPackage (ACE_TEXT_ALWAYS_CHAR (name), - ACE_TEXT_ALWAYS_CHAR (uri), - replace); - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO ACE_TEXT ("Admin::install_package - ") - ACE_TEXT ("Package installed successfully\n"))); - } - catch (Deployment::NameExists &) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("Admin::install_package - ") - ACE_TEXT ("Package with name %s already installed.\n"), - name)); - return false; - } - catch (Deployment::PackageError &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("Admin::install_package - ") - ACE_TEXT ("Internal error while installing package with name %s: %C - %C\n"), - name, ex.source.in (), ex.reason.in ())); - return false; - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("Admin::install_package - ") - ACE_TEXT ("Unexpected CORBA Exception while installing package with name: %s. Reason: %C\n"), - name, - ex._info ().c_str ())); - return false; - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("Admin::install_package - ") - ACE_TEXT ("Unexpected C++ exception while installing package with name: %s\n"), - name)); - return false; - } - - return true; - } - - /// Create new package. - bool - Admin::create_package (const ACE_TCHAR * /* pc_path */, - const ACE_TCHAR * /** name*/, - const ACE_TCHAR * /*baselocation*/, - bool /*replace*/) - { - DANCE_TRACE ("Admin::create_package"); - - return false; - } - - /// Uninstall a package with a provided UUID. - /// Fails if the NoSuchName exception was raised. - bool - Admin::uninstall_package (const ACE_TCHAR *uuid) - { - DANCE_TRACE ("Admin::uninstall_package"); - - try - { - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_TRACE, DLINFO ACE_TEXT ("Admin::uninstall_package - ") - ACE_TEXT ("Attempting to uninstall package %s\n"), - uuid)); - this->rm_->deletePackage (ACE_TEXT_ALWAYS_CHAR (uuid)); - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_INFO, DLINFO ACE_TEXT ("Admin::uninstall_package - ") - ACE_TEXT ("Successfully uninstalled package %s\n"), - uuid)); - } - catch (Deployment::NoSuchName &) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("Admin::uninstall_package - ") - ACE_TEXT ("No package with the given UUID found: %s\n"), - uuid)); - return false; - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("Admin::uninstall_package - ") - ACE_TEXT ("Unexpected CORBA Exception while uninstalling package with uuid: %s. Reason: %C\n"), - uuid, - ex._info ().c_str ())); - return false; - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("Admin::uninstall_package - ") - ACE_TEXT ("Unexpected C++ exception while installing package with uuid: %C\n"), - uuid)); - return false; - } - - return true; - } - - /// List all installed packages - ::CORBA::StringSeq * - Admin::list_packages (void) - { - DANCE_TRACE ("Admin::list_packages"); - - try - { - CORBA::StringSeq_var packages = this->rm_->getAllNames (); - return packages._retn (); - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("Admin::list_packages - ") - ACE_TEXT ("Unexpected CORBA Exception while listing packages: %C\n"), - ex._info ().c_str ())); - return 0; - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("Admin::list_package - ") - ACE_TEXT ("Unexpected C++ exception while listing packages\n"))); - return 0; - } - - return 0; - } - - /// List all installed package types - ::CORBA::StringSeq * - Admin::list_types (void) - { - DANCE_TRACE ("Admin::list_types"); - - try - { - CORBA::StringSeq_var packages = this->rm_->getAllTypes (); - return packages._retn (); - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("Admin::list_types - ") - ACE_TEXT ("Unexpected CORBA Exception while listing package types: %C\n"), - ex._info ().c_str ())); - return 0; - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("Admin::list_types - ") - ACE_TEXT ("Unexpected C++ exception while listing package types\n"))); - return 0; - } - - return 0; - } - - /// Find package names by type - ::CORBA::StringSeq * - Admin::find_by_type (const ACE_TCHAR *type) - { - DANCE_TRACE ("Admin::find_by_type"); - - if (type == 0) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("Admin::find_by_type - ") - ACE_TEXT ("Nill type passed to find_by_type\n"))); - return 0; - } - - try - { - ::CORBA::StringSeq_var types = this->rm_->findNamesByType (ACE_TEXT_ALWAYS_CHAR (type)); - types._retn (); - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("Admin::find_by_type - ") - ACE_TEXT ("Unexpected CORBA Exception while listing packages of type %C: %C\n"), - type, - ex._info ().c_str ())); - return 0; - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("Admin::find_by_type - ") - ACE_TEXT ("Unexpected C++ exception while listing packages by type %C\n"), - type)); - return 0; - } - - return 0; - } - - /// Attempt to shutdown the server. - bool - Admin::shutdown (void) - { - DANCE_TRACE ("Admin::shutdown"); - - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_TRACE, DLINFO ACE_TEXT ("Admin::shutdown - ") - ACE_TEXT ("Attempting to shut down Repository Manager\n"))); - CIAO::RepositoryManagerDaemon_var rmd = - CIAO::RepositoryManagerDaemon::_narrow (this->rm_.in ()); - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_INFO, DLINFO ACE_TEXT ("Admin::shutdown - ") - ACE_TEXT ("Repository Manager shut down.\n"))); - if (CORBA::is_nil (rmd.in ())) - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO ACE_TEXT ("Admin::shutdown - ") - ACE_TEXT ("Unable to narrow provided RM reference to a CIAO::RepositoryManagerDaemon\n"))); - return false; - } - - rmd->shutdown (); - - return true; - } - } -} diff --git a/DAnCE/dance/RepositoryManager/repository_manager_admin.h b/DAnCE/dance/RepositoryManager/repository_manager_admin.h deleted file mode 100644 index 05dbf7c7fca..00000000000 --- a/DAnCE/dance/RepositoryManager/repository_manager_admin.h +++ /dev/null @@ -1,63 +0,0 @@ - -/** - * @file repository_manager_admin.h - * @author William R. Otte <wotte@dre.vanderbilt.edu>? - * - * Class which implements most repository admin functions. - */ - -#ifndef REPOSITORY_MANAGER_ADMIN_H_ -#define REPOSITORY_MANAGER_ADMIN_H_ - -#include /**/ "ace/pre.h" -#include "dance/Deployment/Deployment_RepositoryManagerC.h" - -namespace DAnCE -{ - namespace RepositoryManager - { - /** - * @class Admin - * @brief Implements administrative functions for the Repository Manager. - */ - class Admin - { - public: - Admin (Deployment::RepositoryManager_ptr rm); - - /// Install a package at a provided filesystem path. - bool install_package (const ACE_TCHAR *uri, - const ACE_TCHAR *name, - bool replace); - - /// Create new package. - bool create_package (const ACE_TCHAR *pc_path, - const ACE_TCHAR *name, - const ACE_TCHAR *baselocation, - bool replace); - - /// Uninstall a package with a provided UUID. - /// Fails if the NoSuchName exception was raised. - bool uninstall_package (const ACE_TCHAR *uuid); - - /// List all installed packages - ::CORBA::StringSeq * list_packages (void); - - /// List all installed package types - ::CORBA::StringSeq * list_types (void); - - /// Find package names by type - ::CORBA::StringSeq * find_by_type (const ACE_TCHAR *type); - - /// Attempt to shutdown the server. - bool shutdown (void); - - private: - Deployment::RepositoryManager_var rm_; - }; - } -} - -#include /**/ "ace/post.h" - -#endif /* REPOSITORY_MANAGER_ADMIN_H_ */ diff --git a/DAnCE/dance/RepositoryManager/repository_manager_admin_exec.cpp b/DAnCE/dance/RepositoryManager/repository_manager_admin_exec.cpp deleted file mode 100644 index 4b4c4f8a0c8..00000000000 --- a/DAnCE/dance/RepositoryManager/repository_manager_admin_exec.cpp +++ /dev/null @@ -1,472 +0,0 @@ -/** - * @file repository_manager_admin_exec.cpp - * @author William R. Otte <wotte@dre.vanderbilt.edu> - * - * Simple administration program for the Repository Manager. - */ - -#include "ace/Auto_Ptr.h" -#include "ace/Get_Opt.h" -#include "ace/Unbounded_Set.h" -#include "ace/String_Base.h" -#include "dance/Logger/Log_Macros.h" -#include "dance/Logger/Logger_Service.h" -#include "dance/Deployment/Deployment_RepositoryManagerC.h" - -#include "repository_manager_admin.h" - -struct Options -{ - Options (void) - : rm_ior_ (ACE_TEXT("")), - domain_nc_ (ACE_TEXT("")), - list_ (false), - shutdown_ (false) - { - } - - struct Installation - { - Installation (void) - { - } - - bool init (const ACE_TCHAR *inst) - { - ACE_TString tmp (inst); - - size_t begin = 0; - size_t pos = tmp.find (',', begin); - - if (pos != ACE_TString::npos) - path_ = tmp.substring (begin, pos - begin); - else - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Options::Installation::init - ") - ACE_TEXT ("Installation directive missing name and replace parameters, ") - ACE_TEXT ("must have form path,name,replace\n"))); - return false; - } - - - begin = pos + 1; - pos = tmp.find (',', begin); - - if (pos != ACE_TString::npos) - name_ = tmp.substring (begin, pos - begin); - else - { - DANCE_ERROR (DANCE_LOG_ERROR, - (LM_ERROR, DLINFO - ACE_TEXT ("Options::Installation::init - ") - ACE_TEXT ("Installation directive mssing replace parameter, ") - ACE_TEXT ("must have form path,name,replace\n"))); - return false; - } - - begin = pos + 1; - - if (tmp[begin] == '0') replace_ = false; - else if (tmp[begin] == '1') replace_ = true; - else - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("Options::Installation::init - ") - ACE_TEXT ("Replace directive muse be 1 or 0.\n"))); - return false; - } - - return true; - } - - bool operator== (const Installation &rhs) const - { - return (replace_ == rhs.replace_) && - (path_ == rhs.path_) && - (name_ == rhs.name_); - } - - ACE_TString path_; - ACE_TString name_; - bool replace_; - }; - - struct Creation - { - Creation (void) - { - } - - bool init (const ACE_TCHAR *inst) - { - ACE_TString tmp (inst); - - size_t begin = 0; - size_t pos = tmp.find (',', begin); - - if (pos != ACE_TString::npos) - path_ = tmp.substring (begin, pos - begin); - else - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("Options::Creation::init - ") - ACE_TEXT ("Creation directive missing name, base location, and replace parameters, ") - ACE_TEXT ("must have form path,name,base,replace\n"))); - return false; - } - - - begin = pos + 1; - pos = tmp.find (',', begin); - - if (pos != ACE_TString::npos) - name_ = tmp.substring (begin, pos - begin); - else - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("Options::Creation::init - ") - ACE_TEXT ("Creation directive mssing base location and replace parameter, ") - ACE_TEXT ("must have form path,name,base,replace\n"))); - return false; - } - - begin = pos + 1; - pos = tmp.find (',', begin); - - if (pos != ACE_TString::npos) - base_location_ = tmp.substring (begin, pos - begin); - else - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("Options::Creation::init - ") - ACE_TEXT ("Creation directive mssing replace parameter, ") - ACE_TEXT ("must have form path,name,base,replace\n"))); - return false; - } - - begin = pos + 1; - - if (tmp[begin] == '0') replace_ = false; - else if (tmp[begin] == '1') replace_ = true; - else - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("Options::Creation::init - ") - ACE_TEXT ("Replace directive muse be 1 or 0.\n"))); - return false; - } - - return true; - } - - bool operator== (const Creation &rhs) const - { - return (replace_ == rhs.replace_) && - (path_ == rhs.path_) && - (name_ == rhs.name_); - } - - ACE_TString path_, name_, base_location_; - bool replace_; - }; - - const ACE_TCHAR *rm_ior_; - const ACE_TCHAR *domain_nc_; - ACE_Unbounded_Set< Installation > install_; - ACE_Unbounded_Set< Creation > create_; - ACE_Unbounded_Set< ACE_TString > uninstall_; - bool list_; - bool shutdown_; - - void usage (void) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_DEBUG, ACE_TEXT ("usage:\n") - ACE_TEXT ("\t-h,--help\t\t\tThis message.\n") - ACE_TEXT ("\t-r,--rm-ior <ior>\t\tIOR where the RM instance may be found\n") - ACE_TEXT ("\t-i,--install <path>,<name>,<1|0>\tInstall package found at <path> into the RM, with <name>,\n") - ACE_TEXT ("\t\t\t<1> replacing or <0> not replacing an existing package. *\n") - ACE_TEXT ("\t-c,--create <path>,<name>,<base location>,<1|0>\tInstall package found at <path> into the RM, with <name>,\n") - ACE_TEXT ("\t\t\t<base location>, <1> replacing or <0> not replacing an existing package. *\n") - ACE_TEXT ("\t-u,--uninstall <uuid>\t\tUninstall package identified by UUID. *\n") - ACE_TEXT ("\t-l,--list\t\t\tList all packages installed in the RM\n") - ACE_TEXT ("\t-s,--shutdown\t\t\tShutdown the RM.\n") - ACE_TEXT ("\t-d,--domain-nc <ior>\t\tProvide a reference to the domain naming context\n") - - ACE_TEXT ("\n\n\tArguments with a * may be specified multiple times.\n"))); - } - - - int parse_args (int argc, ACE_TCHAR *argv[]) - { - ACE_Get_Opt get_opt (argc, argv, - ACE_TEXT ("hr:i:c:u:lsd:"), - 0, 0, - ACE_Get_Opt::RETURN_IN_ORDER, - 1); - - get_opt.long_option (ACE_TEXT("help"), 'h', ACE_Get_Opt::NO_ARG); - get_opt.long_option (ACE_TEXT("rm-ior"), 'r', ACE_Get_Opt::ARG_REQUIRED); - get_opt.long_option (ACE_TEXT("install"), 'i', ACE_Get_Opt::ARG_REQUIRED); - get_opt.long_option (ACE_TEXT("create"), 'c', ACE_Get_Opt::ARG_REQUIRED); - get_opt.long_option (ACE_TEXT("uninstall"), 'u', ACE_Get_Opt::ARG_REQUIRED); - get_opt.long_option (ACE_TEXT("list"), 'l', ACE_Get_Opt::NO_ARG); - get_opt.long_option (ACE_TEXT("shutdown"), 's', ACE_Get_Opt::NO_ARG); - get_opt.long_option (ACE_TEXT("domain-nc"), 'd', ACE_Get_Opt::ARG_REQUIRED); - - int c; - Installation inst; - Creation create; - - while ((c = get_opt ()) != -1) - { - switch (c) - { - case 'h': - this->usage (); - return 1; - break; - - case 'r': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("Options::parse_args - ") - ACE_TEXT ("Using provided RM IOR: %C\n"), - get_opt.opt_arg ())); - rm_ior_ = get_opt.opt_arg (); - break; - - case 'i': - if (!inst.init (get_opt.opt_arg ())) - { - this->usage (); - return -1; - } - - if (inst.replace_) - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("Replacing installed package from path %C with name %C.\n"), inst.path_.c_str (), - inst.name_.c_str ())); - else - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("Installing package from path %C with name %C.\n"), inst.path_.c_str (), - inst.name_.c_str ())); - - this->install_.insert (inst); - break; - - case 'c': - if (!create.init (get_opt.opt_arg ())) - { - this->usage (); - return -1; - } - - if (create.replace_) - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("Replacing installed package from path %C with name %C and base location %C.\n"), - create.path_.c_str (), - create.name_.c_str (), - create.base_location_.c_str ())); - else - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("Installing new package from path %C with name %C and base location %C.\n"), - create.path_.c_str (), - create.name_.c_str (), - create.base_location_.c_str ())); - - this->create_.insert (create); - break; - - case 'u': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("Removing package with UUID %C\n"), get_opt.opt_arg ())); - this->uninstall_.insert (get_opt.opt_arg ()); - break; - - case 'l': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("Listing all packages.\n"))); - this->list_ = true; - break; - - case 's': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("Shutting down the RM instance.\n"))); - this->shutdown_ = true; - break; - - case 'd': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("Using provided Domain NC: %C\n"), - get_opt.opt_arg ())); - domain_nc_ = get_opt.opt_arg (); - break; - - case 0: - if (ACE_OS::strcmp (get_opt.long_option (), ACE_TEXT ("domain-nc")) == 0) - { - } - else - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("Options::parse_args - ") - ACE_TEXT ("Unknown long option: %C\n"), - get_opt.long_option ())); - this->usage (); - return -1; - } - } - } - return 0; - } -}; - -int ACE_TMAIN (int argc, ACE_TCHAR **argv) -{ - DANCE_DISABLE_TRACE (); - - auto_ptr<DAnCE::Logger_Service> logger; - - int retval (0); - - try - { - DAnCE::Logger_Service - * dlf = ACE_Dynamic_Service<DAnCE::Logger_Service>::instance ("DAnCE_Logger"); - - if (dlf) - { - dlf->init (argc, argv); - } - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, - (LM_TRACE, DLINFO - ACE_TEXT ("Module_main.h - initializing ORB\n"))); - - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - - Options options; - int const error = options.parse_args (argc, argv); - if (error == -1) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("repository_manager_admin_exec::main - ") - ACE_TEXT ("Failed to parse command line arguments.\n"))); - } - else if (error == 1) - { //help was issued -> quit - return 0; - } - - if (options.rm_ior_ == 0) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("repository_manager_admin_exec::main - ") - ACE_TEXT ("No RepositoryManager IOR provided\n"))); - return -1; - } - - // Resolve the RepositoryManager reference - CORBA::Object_var obj = orb->string_to_object (options.rm_ior_); - - Deployment::RepositoryManager_var rm = - Deployment::RepositoryManager::_narrow (obj); - - if (CORBA::is_nil (obj)) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("repository_manager_admin_exec::main - ") - ACE_TEXT ("Provided IOR was invalid or could not be narrowed: %s\n"), - options.rm_ior_)); - return -1; - } - - DAnCE::RepositoryManager::Admin admin (rm.in ()); - - ACE_Unbounded_Set_Iterator<Options::Installation> inst_it = - options.install_.begin (); - Options::Installation *inst (0); - - while (inst_it.next (inst) == 1) - { - if (!admin.install_package (inst->path_.c_str (), - inst->name_.c_str (), - inst->replace_)) - retval = -1; - inst_it.advance (); - } - - ACE_Unbounded_Set_Iterator<Options::Creation> creat_it (options.create_); - Options::Creation *creat (0); - - while (creat_it.next (creat) == 1) - { - if (!admin.create_package (creat->path_.c_str (), - creat->name_.c_str (), - creat->base_location_.c_str (), - creat->replace_)) - retval = -1; - creat_it.advance (); - } - - ACE_Unbounded_Set_Iterator<ACE_TString> uninst_it (options.uninstall_); - ACE_TString *uninst = 0; - - while (uninst_it.next (uninst) == 1) - { - if (!admin.uninstall_package (uninst->c_str ())) - retval = -1; - uninst_it.advance (); - } - - if (options.list_) - { - ::CORBA::StringSeq * packages = admin.list_packages (); - if (packages == 0) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("repository_manager_admin_exec::main - ") - ACE_TEXT ("No packages returned from list_packages\n"))); - retval = -1; - } - - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_EMERGENCY, ACE_TEXT ("Listing %u packages installed on server:\n"))); - - for (CORBA::ULong i = 0; i < packages->length (); ++i) - { - DANCE_TRACE_LOG (DANCE_LOG_DETAILED_TRACE, (LM_TRACE, "\t%s\n", - (*packages)[i].in ())); - } - - delete packages; - } - - if (options.shutdown_) - { - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_EMERGENCY, ACE_TEXT ("Shutting down the Repository Manager\n"))); - if (!admin.shutdown ()) - retval = -1; - } - - orb->destroy (); - } - catch (const CORBA::Exception &ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("repository_manager_admin_exec::main - ") - ACE_TEXT ("Caught unexpected CORBA Exception: %s\n"), - ex._info ().c_str ())); - return -1; - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("repository_manager_admin_exec::main - ") - ACE_TEXT ("Caught unexpected C++ exception.\n"))); - return -1; - } - - return retval; -} - diff --git a/DAnCE/dance/TargetManager/.gitignore b/DAnCE/dance/TargetManager/.gitignore deleted file mode 100644 index 5dbf23bfc28..00000000000 --- a/DAnCE/dance/TargetManager/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/dance_target_manager diff --git a/DAnCE/dance/TargetManager/DomainDataManager.cpp b/DAnCE/dance/TargetManager/DomainDataManager.cpp deleted file mode 100644 index 7f525d8f5bb..00000000000 --- a/DAnCE/dance/TargetManager/DomainDataManager.cpp +++ /dev/null @@ -1,648 +0,0 @@ -#include "DomainDataManager.h" -#include "dance/Deployment/Deployment_NodeManagerC.h" - -#include "tools/Config_Handlers/XML_File_Intf.h" -#include "dance/Logger/Log_Macros.h" - -#ifdef GEN_OSTREAM_OPS -#include <iostream> -#include <sstream> -#endif /* GEN_OSTREAM_OPS */ - -void -DAnCE::DomainDataManager::init (CORBA::ORB_ptr orb, - ::Deployment::TargetManager_ptr target, - const ACE_TCHAR *domain_name) -{ - DANCE_TRACE ("DAnCE::DomainDataManager::init"); - - this->orb_ = CORBA::ORB::_duplicate (orb); - this->target_mgr_ = ::Deployment::TargetManager::_duplicate(target); - - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, - (LM_DEBUG, DLINFO ACE_TEXT ("DAnCE::DomainDataManager::init - ") - ACE_TEXT ("Parsing initial domain from file %s\n"), - domain_name)); - - DAnCE::Config_Handlers::XML_File_Intf intf (domain_name); - ::Deployment::Domain* dmn = intf.release_domain (); - - DANCE_DEBUG (DANCE_LOG_EVENT_TRACE, - (LM_TRACE, DLINFO ACE_TEXT ("DAnCE::DomainDataManager::init - ") - ACE_TEXT ("Initial domain successfully parsed\n"))); -#ifdef GEN_OSTREAM_OPS - if (DAnCE_debug_level >= DANCE_LOG_TRACE) - { - std::ostringstream _stream; - _stream << *dmn << std::endl; - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO "DAnCE::DomainDataManager::init - " - "Contents of Domain: %C\n", - _stream.str ().c_str ())); - } -#endif - - current_domain_ = *dmn; - initial_domain_ = current_domain_; - - // initialize the provisioning domain - provisioned_data_ = initial_domain_; - - update_node_status (); - - call_all_node_managers (); -} - -int DAnCE::DomainDataManager::update_domain (const ::CORBA::StringSeq &, - const ::Deployment::Domain & domainSubset, - ::Deployment::DomainUpdateKind update_kind) -{ - DANCE_TRACE ("DAnCE::DomainDataManager::update_domain"); - - // 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; -} - -::Deployment::Domain* DAnCE::DomainDataManager::get_current_domain () -{ - DANCE_TRACE ("DAnCE::DomainDataManager::get_current_domain"); - - return new ::Deployment::Domain (provisioned_data_); -} - -::Deployment::Domain* DAnCE::DomainDataManager::get_initial_domain () -{ - DANCE_TRACE ("DAnCE::DomainDataManager::get_initial_domain"); - - return new ::Deployment::Domain (initial_domain_); -} - -int DAnCE::DomainDataManager::readin_domain_data () -{ - DANCE_TRACE ("DAnCE::DomainDataManager::readin_domain_data"); - - // here read in Domain data ... - // - return 0; -} - -int DAnCE::DomainDataManager::call_all_node_managers () -{ - DANCE_TRACE ("DAnCE::DomainDataManager::call_all_node_managers"); - -/* if ( this->deployment_config_.init ("NodeDetails.dat") == -1 ) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, - "TargetM (%P|%t) DomainDataManager.cpp -" - "DAnCE::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 (const CORBA::Exception&) - { - DANCE_ERROR (DANCE_LOG_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 (const CORBA::Exception& ex) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR , "TM::Error in calling Join Domain==\n")); - ex._tao_print_exception ( - "Exception caught in ""DomainDataManager::joinDomain"); - } - } - } -*/ - return 0; - -} - - -::Deployment::ResourceCommitmentManager_ptr DAnCE::DomainDataManager -::commitResources (const ::Deployment::ResourceAllocations &) -{ - DANCE_TRACE ("DAnCE::DomainDataManager::commitResources"); - -/* - // 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; - */ - return 0; -} - - -void DAnCE::DomainDataManager:: -releaseResources (const ::Deployment::ResourceCommitmentManager_ptr) -{ - DANCE_TRACE ("DAnCE::DomainDataManager::releaseResources"); - - // 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 DAnCE::DomainDataManager::match_requirement_resource ( - ::Deployment::InstanceResourceDeploymentDescriptions deployed, - ::Deployment::Resources & available) -{ - DANCE_TRACE ("DAnCE::DomainDataManager::match_requirement_resource"); - - // 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)) - { - // 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 DAnCE::DomainDataManager::match_properties ( - ::Deployment::Properties deployed, - ::Deployment::SatisfierProperties & available) -{ - DANCE_TRACE ("DAnCE::DomainDataManager::match_properties"); - - 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 DAnCE::DomainDataManager::commit_release_resource ( - ::Deployment::Property & deployed, - ::Deployment::SatisfierProperty & available) -{ - DANCE_TRACE ("DAnCE::DomainDataManager::commit_release_resource"); - - if (current_action_ == commit) - { - - CORBA::Long required_d; - - if ((deployed.value >>= required_d) == false) - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, "Failed to extract required amount\n")); - - CORBA::Long available_d; - - if ((available.value >>= available_d) == false) - DANCE_ERROR (DANCE_LOG_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; - } -} - -int DAnCE::DomainDataManager::add_to_domain ( - const ::Deployment::Domain& domain) -{ - DANCE_TRACE ("DAnCE::DomainDataManager::add_to_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 DAnCE::DomainDataManager::find_in_initial_domain (const char* node_name, - ::Deployment::Node& node) -{ - DANCE_TRACE ("DAnCE::DomainDataManager::find_in_initial_domain"); - - 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 DAnCE::DomainDataManager::find_in_provisioned_domain (const char* node_name, - ::Deployment::Node& node) -{ - DANCE_TRACE ("DAnCE::DomainDataManager::find_in_provisioned_domain"); - - 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 DAnCE::DomainDataManager::delete_from_domain ( - const ::Deployment::Domain& domain) -{ - DANCE_TRACE ("DAnCE::DomainDataManager::delete_from_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 DAnCE::DomainDataManager::intimate_planner ( - const ::Deployment::Domain& domain) -{ - DANCE_TRACE ("DAnCE::DomainDataManager::intimate_planner"); - - // 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 DAnCE::DomainDataManager::update_node_status () -{ - DANCE_TRACE ("DAnCE::DomainDataManager::update_node_status"); - - // update the node status here ... - return 0; -} - -void DAnCE::DomainDataManager::commitResourceAllocation ( - const ::Deployment::ResourceAllocations & resources) -{ - DANCE_TRACE ("DAnCE::DomainDataManager::commitResourceAllocation"); - - // commit the resources - // parse into the plan and commit resources ... - - // set the action value - current_action_ = commit; - - this->commit_release_RA (resources); -} - -void DAnCE::DomainDataManager::releaseResourceAllocation ( - const ::Deployment::ResourceAllocations & resources) -{ - DANCE_TRACE ("DAnCE::DomainDataManager::releaseResourceAllocation"); - - // set the action value - current_action_ = release; - - this->commit_release_RA (resources); -} - - -int DAnCE::DomainDataManager::commit_release_RA (const ::Deployment::ResourceAllocations& resources) -{ - DANCE_TRACE ("DAnCE::DomainDataManager::commit_release_RA"); - - // 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 - DANCE_ERROR (DANCE_LOG_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& -DAnCE::DomainDataManager::find_resource ( - const ::Deployment::ResourceAllocation& resource) -{ - DANCE_TRACE ("DAnCE::DomainDataManager::find_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/DAnCE/dance/TargetManager/DomainDataManager.h b/DAnCE/dance/TargetManager/DomainDataManager.h deleted file mode 100644 index 5c18d0afb0e..00000000000 --- a/DAnCE/dance/TargetManager/DomainDataManager.h +++ /dev/null @@ -1,242 +0,0 @@ -//=============================================================== -/** - * @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 "dance/Deployment/Deployment_TargetDataC.h" -#include "dance/Deployment/Deployment_TargetManagerC.h" - -namespace DAnCE -{ - /** - * @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 (void); - - /** - * @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 (void); - - /** - * @brief returns the sequence of node managers - * object reference - */ - ::Deployment::ResourceCommitmentManager_ptr - commitResources (const ::Deployment::ResourceAllocations & resources); - - /** - * @brief The function releases the resources held by a plan - */ - void releaseResources (const ::Deployment::ResourceCommitmentManager_ptr manager); - - /** - * @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); - - /** - * @brief Initializing DomainDataManager - * - * This function inits the DomainDataManager - * - */ - void init (CORBA::ORB_ptr orb, - ::Deployment::TargetManager_ptr target, - const ACE_TCHAR *domain_name); - - private: - /// The different action that can take place - enum Action {commit , release}; - - /** - * @brief It will read the initial Domain data from - * XML files. - */ - int readin_domain_data (void); - - /** - * @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); - - - /** - * @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 (void); - - /** - * @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 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_; - }; - - typedef ACE_Singleton <DomainDataManager, ACE_SYNCH_RECURSIVE_MUTEX> - DomainDataManager_Singleton; -#define DOMAIN_DATA_MANAGER DomainDataManager_Singleton::instance () -} // CIAO - -#endif /* DOMAIN_DATA_MGRH */ diff --git a/DAnCE/dance/TargetManager/ResourceCommitmentManager.cpp b/DAnCE/dance/TargetManager/ResourceCommitmentManager.cpp deleted file mode 100644 index ddc28817a25..00000000000 --- a/DAnCE/dance/TargetManager/ResourceCommitmentManager.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// -#include "ResourceCommitmentManager.h" -#include "DomainDataManager.h" -#include "dance/Logger/Log_Macros.h" - -DAnCE::ResourceCommitmentManager_i::ResourceCommitmentManager_i (void) -{ - DANCE_TRACE ("DAnCE::ResourceCommitmentManager_i"); -} - -DAnCE::ResourceCommitmentManager_i::~ResourceCommitmentManager_i (void) -{ - DANCE_TRACE ("DAnCE::ResourceCommitmentManager_i::~ResourceCommitmentManager_i"); -} - -void -DAnCE::ResourceCommitmentManager_i::commitResources ( - const ::Deployment::ResourceAllocations& resources) -{ - DANCE_TRACE ("DAnCE::ResourceCommitmentManager_i::commitResources"); - - DOMAIN_DATA_MANAGER->commitResourceAllocation (resources); - - // Commit succesful .. add to commited resource, we get an exception - // if the method above fails - this->add_to_committed_resource (resources); -} - -void -DAnCE::ResourceCommitmentManager_i::releaseResources ( - const ::Deployment::ResourceAllocations & resources) -{ - DANCE_TRACE ("DAnCE::ResourceCommitmentManager_i::releaseResources"); - - // If the resources set is null, use the already allocated resources .. - if (resources.length () == 0) - { - DOMAIN_DATA_MANAGER->releaseResourceAllocation (this->resources_); - } - else - { - DOMAIN_DATA_MANAGER->releaseResourceAllocation (resources); - } -} - -void -DAnCE::ResourceCommitmentManager_i::add_to_committed_resource ( - ::Deployment::ResourceAllocations res) -{ - DANCE_TRACE ("DAnCE::ResourceCommitmentManager_i::add_to_committed_resource"); - - CORBA::ULong const 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]; - } -} diff --git a/DAnCE/dance/TargetManager/ResourceCommitmentManager.h b/DAnCE/dance/TargetManager/ResourceCommitmentManager.h deleted file mode 100644 index ebb91c40a86..00000000000 --- a/DAnCE/dance/TargetManager/ResourceCommitmentManager.h +++ /dev/null @@ -1,58 +0,0 @@ -// -/** - * @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 DAnCE -{ - - class ResourceCommitmentManager_i - : public virtual POA_Deployment::ResourceCommitmentManager - { - public: - /// Constructor - ResourceCommitmentManager_i (void); - - /// Destructor - virtual ~ResourceCommitmentManager_i (void); - - /** - * @brief Commits the resources - * - * 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: - /** - * @brief This function adds the res to already commited resources. - * This is to be called from within commitResources - */ - void add_to_committed_resource (::Deployment::ResourceAllocations res); - - /// The commited resource - ::Deployment::ResourceAllocations resources_; - }; -} - -#endif /* DEPLOYMENT_RESOURCECOMMITMENTMANAGERI_H_ */ diff --git a/DAnCE/dance/TargetManager/TargetManager.mpc b/DAnCE/dance/TargetManager/TargetManager.mpc deleted file mode 100644 index 9577c83eb73..00000000000 --- a/DAnCE/dance/TargetManager/TargetManager.mpc +++ /dev/null @@ -1,15 +0,0 @@ -project (DAnCE_TargetManager_Exec) : install, iortable, utils, naming, dance_logger, \ - dance_nodemanager_stub, dance_nodemanager_skel, dance_exe, \ - dance_config_handlers, dance_targetmanager_skel { - exename = dance_target_manager - IDL_Files { - } - - Source_Files { - DomainDataManager.cpp - ResourceCommitmentManager.cpp - TargetManager_Impl.cpp - Target_Manager_Module.cpp - Target_Manager.cpp - } -} diff --git a/DAnCE/dance/TargetManager/TargetManager_Impl.cpp b/DAnCE/dance/TargetManager/TargetManager_Impl.cpp deleted file mode 100644 index 9457086f7c3..00000000000 --- a/DAnCE/dance/TargetManager/TargetManager_Impl.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// -*- C++ -*- -#include "TargetManager_Impl.h" -#include "DomainDataManager.h" - -namespace DAnCE -{ -TargetManagerDaemon_i::TargetManagerDaemon_i (CORBA::ORB_ptr orb) - : orb_ (::CORBA::ORB::_duplicate (orb)) -{ -} - -TargetManagerDaemon_i::~TargetManagerDaemon_i (void) -{ -} - -void TargetManagerDaemon_i::init (const ACE_TCHAR *file) -{ - DAnCE::DOMAIN_DATA_MANAGER->init (this->orb_.in (), - this->_this (), - file); -} - -::Deployment::Domain * TargetManagerDaemon_i::getAllResources (void) -{ - return DAnCE::DOMAIN_DATA_MANAGER->get_initial_domain (); -} - -::Deployment::Domain * -TargetManagerDaemon_i::getAvailableResources (void) -{ - return DAnCE::DOMAIN_DATA_MANAGER->get_current_domain (); -} - -::Deployment::ResourceCommitmentManager_ptr -TargetManagerDaemon_i::createResourceCommitment ( - const ::Deployment::ResourceAllocations & resources) -{ - return DAnCE::DOMAIN_DATA_MANAGER->commitResources (resources); -} - -void TargetManagerDaemon_i::destroyResourceCommitment ( - ::Deployment::ResourceCommitmentManager_ptr manager) -{ - return DAnCE::DOMAIN_DATA_MANAGER->releaseResources (manager); -} - -void TargetManagerDaemon_i::updateDomain ( - const ::CORBA::StringSeq & elements, - const ::Deployment::Domain & domainSubset, - ::Deployment::DomainUpdateKind updateKind) -{ - DAnCE::DOMAIN_DATA_MANAGER->update_domain (elements, domainSubset, updateKind); -} - - -} diff --git a/DAnCE/dance/TargetManager/TargetManager_Impl.h b/DAnCE/dance/TargetManager/TargetManager_Impl.h deleted file mode 100644 index ad2be0fb1a4..00000000000 --- a/DAnCE/dance/TargetManager/TargetManager_Impl.h +++ /dev/null @@ -1,49 +0,0 @@ -// -*- C++ -*- - -#ifndef TARGETMANAGERDAEMONI_H_ -#define TARGETMANAGERDAEMONI_H_ - -#include "dance/Deployment/Deployment_TargetManagerS.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -#pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -namespace DAnCE -{ -class TargetManagerDaemon_i - : public virtual POA_Deployment::TargetManager -{ -public: - /// Constructor - TargetManagerDaemon_i (CORBA::ORB_ptr orb); - - /// Destructor - virtual ~TargetManagerDaemon_i (void); - - void init (const ACE_TCHAR *file); - - virtual ::Deployment::Domain * getAllResources (void); - - virtual ::Deployment::Domain * getAvailableResources (void); - - virtual - ::Deployment::ResourceCommitmentManager_ptr createResourceCommitment ( - const ::Deployment::ResourceAllocations & resources); - - virtual void destroyResourceCommitment ( - ::Deployment::ResourceCommitmentManager_ptr manager); - - virtual void updateDomain ( - const ::CORBA::StringSeq & elements, - const ::Deployment::Domain & domainSubset, - ::Deployment::DomainUpdateKind updateKind); - - private: - CORBA::ORB_var orb_; -}; -} - - -#endif /* TARGETMANAGERDAEMONI_H_ */ - diff --git a/DAnCE/dance/TargetManager/Target_Manager.cpp b/DAnCE/dance/TargetManager/Target_Manager.cpp deleted file mode 100644 index 0366ee8b334..00000000000 --- a/DAnCE/dance/TargetManager/Target_Manager.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include "ace/Dynamic_Service.h" -#include "tao/ORB.h" -#include "tao/Object.h" -#include "dance/Logger/Log_Macros.h" -#include "dance/Logger/Logger_Service.h" -#include "Target_Manager_Module.h" - -int -ACE_TMAIN (int argc, ACE_TCHAR *argv[]) -{ - DANCE_DISABLE_TRACE (); - - int retval = 0; - - try - { - DAnCE::Logger_Service - * dlf = ACE_Dynamic_Service<DAnCE::Logger_Service>::instance ("DAnCE_Logger"); - - if (dlf) - { - dlf->init (argc, argv); - } - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO - ACE_TEXT("TargetManager - initializing ORB\n"))); - - CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO - ACE_TEXT("TargetManager - initializing module instance\n"))); - - DAnCE_TargetManager_Module tm; - CORBA::Object_var obj = tm.init (orb.in (), argc, argv); - - if (!CORBA::is_nil (obj.in ())) - { - DANCE_TRACE_LOG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO - ACE_TEXT("TargetManager - running ORB\n"))); - orb->run (); - } - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO - ACE_TEXT("TargetManager - destroying ORB\n"))); - - orb->destroy (); - } - catch (const CORBA::Exception& ex) - { - DANCE_ERROR (DANCE_LOG_EMERGENCY, - (LM_EMERGENCY, - ACE_TEXT ("Caught CORBA exception: %C\n"), - ex._info ().c_str ())); - retval = -1; - } - catch (...) - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, "TargetManager - Error: Unknown exception.\n")); - retval = -1; - } - - return retval; -} - diff --git a/DAnCE/dance/TargetManager/Target_Manager_Module.cpp b/DAnCE/dance/TargetManager/Target_Manager_Module.cpp deleted file mode 100644 index f3412a162f7..00000000000 --- a/DAnCE/dance/TargetManager/Target_Manager_Module.cpp +++ /dev/null @@ -1,345 +0,0 @@ -// -*- C++ -*- -#include "Target_Manager_Module.h" -#include "ace/Get_Opt.h" -#include "ace/OS_NS_stdio.h" -#include "ace/Task.h" -#include "tao/IORTable/IORTable.h" -#include "tao/Utils/PolicyList_Destroyer.h" -#include "orbsvcs/CosNamingC.h" -#include "dance/Logger/Log_Macros.h" -#include "dance/DAnCE_PropertiesC.h" - -#include "TargetManager_Impl.h" - -namespace DAnCE -{ - namespace Target_Manager - { - bool - write_IOR (const ACE_TCHAR * ior_file_name, const char* ior) - { - FILE* ior_output_file_ = - ACE_OS::fopen (ior_file_name, ACE_TEXT("w")); - - if (ior_output_file_) - { - ACE_OS::fprintf (ior_output_file_, - "%s", - ior); - ACE_OS::fclose (ior_output_file_); - return true; - } - return false; - } - } -} - -DAnCE_TargetManager_Module::DAnCE_TargetManager_Module (void) -{ - //DANCE_TRACE("DAnCE_TargetManager_Module::DAnCE_TargetManager_Module"); -} - -DAnCE_TargetManager_Module::~DAnCE_TargetManager_Module (void) -{ - DANCE_TRACE ("DAnCE_TargetManager_Module::~DAnCE_TargetManager_Module"); - - for (Servant_Map::iterator it = this->rm_map_.begin (); - it != this->rm_map_.end (); - ++it) - { - delete (*it).int_id_; - } -} - -const char * -DAnCE_TargetManager_Module::usage (void) -{ - DANCE_TRACE ("DAnCE_TargetManager_Module::usage"); - return "Repository Manager Options:\n" - //"\t-n|--name [name]\t Name to register in the naming service\n" - "\t-f|--file [name]\t Filename to output IOR.\n" - "\t-i|--init [name]\t Filename read initial domain descriptor.\n" - "\t-d|--domain-nc [NC]\t Default naming context for domain objects.\n" - "\t-h|help\t\t\t print this help message\n" - ; - -} - -bool -DAnCE_TargetManager_Module::parse_args (int argc, ACE_TCHAR * argv[]) -{ - DANCE_TRACE ("DAnCE_TargetManager_Module::parse_args"); - - ACE_Get_Opt get_opts (argc - 1, - argv + 1, - ACE_TEXT(":hd:f:i:"), - 0, - 0, - ACE_Get_Opt::RETURN_IN_ORDER, - 1); - - get_opts.long_option (ACE_TEXT("help"), 'h', ACE_Get_Opt::NO_ARG); - get_opts.long_option (ACE_TEXT("domain-nc"), 'd', ACE_Get_Opt::ARG_REQUIRED); - get_opts.long_option (ACE_TEXT("file"), 'f', ACE_Get_Opt::ARG_REQUIRED); - get_opts.long_option (ACE_TEXT("init"), 'i', ACE_Get_Opt::ARG_REQUIRED); - - int c; - while ( (c = get_opts ()) != -1) - { - switch (c) - { - case 'd': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("Target_Manager_Module::parse_args - ") - ACE_TEXT ("Binding to provided Domain Naming Context: '%s'\n"), - get_opts.opt_arg ())); - this->options_.domain_nc_ = get_opts.opt_arg (); - break; - - case 'f': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("Target_Manager_Module::parse_args - ") - ACE_TEXT ("Output filename for IOR is %s\n"), - get_opts.opt_arg ())); - this->options_.ior_file_ = get_opts.opt_arg (); - break; - - case 'i': - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, - (LM_DEBUG, DLINFO - ACE_TEXT ("Target_Manager_Module::parse_args - ") - ACE_TEXT ("Initial domain file %s\n"), - get_opts.opt_arg ())); - this->options_.domain_descr_ = get_opts.opt_arg (); - break; - - case 'h': - case '?': // Display help for use of the server. - ACE_ERROR_RETURN ((LM_ERROR, - this->usage (), - argv [0], c), - false); - break; - - case 0: - { - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("Target_Manager_Module::parse_args - ") - ACE_TEXT ("ERROR: unknown long option %s\n"), - get_opts.long_option ())); - } - - break; - - default: - DANCE_ERROR (DANCE_LOG_WARNING, (LM_TRACE, DLINFO ACE_TEXT ("Target_Manager_Module::parse_args - ignoring unknown option %c:%C\n"), - c, get_opts.opt_arg ())); - } - - } - - return true; -} - -CORBA::Object_ptr -DAnCE_TargetManager_Module::init (CORBA::ORB_ptr orb, - int argc, - ACE_TCHAR *argv[]) -{ - DANCE_TRACE ("DAnCE_TargetManager_Module::init"); - - try - { - if (CORBA::is_nil(orb)) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("DAnCE_TargetManager_Module::init - ") - ACE_TEXT ("Attempted to create Target Manager with a nil orb.\n"))); - return CORBA::Object::_nil(); - } - else - { - this->orb_ = CORBA::ORB::_duplicate (orb); - } - - if (ACE_OS::strcmp(orb->id(), this->orb_->id()) != 0) - { - DANCE_TRACE_LOG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO ACE_TEXT ("DAnCE_TargetManager_Module::init - ") - ACE_TEXT ("Resetting TM's orb.\n"))); - this->orb_ = CORBA::ORB::_duplicate (orb); - this->domain_nc_ = CosNaming::NamingContext::_nil(); - } - - if (!this->parse_args (argc, argv)) - { - return CORBA::Object::_nil (); - } - - this->create_poas (); - - if (this->options_.domain_nc_) - { - try - { - DANCE_TRACE_LOG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO ACE_TEXT ("DAnCE_TargetManager_Module::init - ") - ACE_TEXT ("Resolving DomainNC.\n"))); - CORBA::Object_var domain_obj = this->orb_->string_to_object (this->options_.domain_nc_); - if (!CORBA::is_nil (domain_obj.in ())) - { - this->domain_nc_ = CosNaming::NamingContext::_narrow (domain_obj.in()); - if (CORBA::is_nil (this->domain_nc_.in ())) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR,DLINFO ACE_TEXT ("DAnCE_TargetManager_Module::init - ") - ACE_TEXT ("Narrow to NamingContext return nil for DomainNC.\n"))); - return CORBA::Object::_nil (); - } - } - } - catch (const CORBA::Exception&) - { - DANCE_DEBUG (DANCE_LOG_ERROR, - (LM_WARNING, DLINFO ACE_TEXT ("DAnCE_TargetManager_Module::init - ") - ACE_TEXT ("DomainNC context not found!\n"))); - } - } - - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO ACE_TEXT ("DAnCE_TargetManager_Module::init - ") - ACE_TEXT ("Initializing the IOR Table\n"))); - // Initialize IOR table - CORBA::Object_var table_object = orb->resolve_initial_references ("IORTable"); - - IORTable::Table_var adapter = IORTable::Table::_narrow (table_object.in ()); - - if (CORBA::is_nil (adapter.in ())) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("DAnCE_TargetManager_Module::init - ") - ACE_TEXT ("Unable to RIR the IORTable.\n"))); - return CORBA::Object::_nil (); - } - - - //Creating repository manager servant - DAnCE::TargetManagerDaemon_i * rm = new DAnCE::TargetManagerDaemon_i (orb); - - PortableServer::ServantBase_var safe_svt (rm); - - ACE_CString repository_manager_oid; - - if (this->options_.name_ == 0) - { - repository_manager_oid = "TargetManager"; - } - else - { - repository_manager_oid = ACE_TEXT_ALWAYS_CHAR (this->options_.name_); - repository_manager_oid += ".TargetManager"; - } - - // Registering servant in poa - PortableServer::ObjectId_var oid = - PortableServer::string_to_ObjectId (repository_manager_oid.c_str()); - this->rm_poa_->activate_object_with_id (oid, rm); - - // Getting repository manager ior - CORBA::Object_var nm_obj = this->rm_poa_->id_to_reference (oid.in ()); - CORBA::String_var ior = orb->object_to_string (nm_obj.in ()); - - // Binding ior to IOR Table - adapter->bind (repository_manager_oid.c_str (), ior.in ()); - - // Binding repository manager to DomainNC - if (!CORBA::is_nil (this->domain_nc_.in ())) - { - ACE_CString ns_name; - if (this->options_.name_ == 0) - { - ns_name = "TargetManager"; - } - else - { - ns_name = ACE_TEXT_ALWAYS_CHAR (this->options_.name_); - } - - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, - (LM_TRACE, DLINFO ACE_TEXT ("DAnCE_TargetManager_Module::init - ") - ACE_TEXT ("Registering NM in NC as \"%C\".\n"), ns_name.c_str ())); - CosNaming::Name name (1); - name.length (1); - name[0].id = CORBA::string_dup (ns_name.c_str ()); - name[0].kind = CORBA::string_dup ("TargetManager"); - this->domain_nc_->rebind (name, nm_obj.in ()); - } - - // Writing ior to file - if (0 != this->options_.ior_file_) - { - DANCE_DEBUG (DANCE_LOG_MINOR_EVENT, (LM_TRACE, DLINFO ACE_TEXT ("DAnCE_TargetManager_Module::init - ") - ACE_TEXT ("Writing RM IOR %C to file %C.\n"), this->options_.ior_file_, ior.in ())); - if (!DAnCE::Target_Manager::write_IOR (this->options_.ior_file_, ior.in ())) - DANCE_ERROR (DANCE_LOG_ERROR, (LM_ERROR, DLINFO ACE_TEXT ("DAnCE_TargetManager_Module::init - ") - ACE_TEXT ("Error: Unable to write IOR to file %C\n"), - this->options_.ior_file_)); - } - - // Activate POA manager - PortableServer::POAManager_var mgr = this->root_poa_->the_POAManager (); - mgr->activate (); - - // Finishing Deployment part - DANCE_DEBUG (DANCE_LOG_MAJOR_EVENT, (LM_NOTICE, DLINFO ACE_TEXT ("DAnCE_TargetManager_Module::init - ") - ACE_TEXT ("DAnCE_TargetManager is running...\n"))); - - DANCE_DEBUG (DANCE_LOG_MAJOR_DEBUG_INFO, (LM_DEBUG, DLINFO ACE_TEXT ("DAnCE_TargetManager_Module::init - ") - ACE_TEXT ("TargetManager IOR: %s\n"), ior.in ())); - - return nm_obj._retn (); - } - catch (const CORBA::Exception& ex) - { - DANCE_ERROR (DANCE_LOG_TERMINAL_ERROR, - (LM_EMERGENCY, - ACE_TEXT ("Caught CORBA Exception: %C\n"), - ex._info ().c_str ())); - return CORBA::Object::_nil (); - } -} - -void -DAnCE_TargetManager_Module::create_poas (void) -{ - DANCE_TRACE("DAnCE_TargetManager_Module::create_poas"); - // Get reference to Root POA. - DANCE_TRACE_LOG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO ACE_TEXT ("DAnCE_TargetManager_Module::create_poas - ") - ACE_TEXT ("Resolving root POA\n"))); - CORBA::Object_var obj = this->orb_->resolve_initial_references ("RootPOA"); - - this->root_poa_ = PortableServer::POA::_narrow (obj.in ()); - - DANCE_TRACE_LOG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO ACE_TEXT ("DAnCE_TargetManager_Module::create_poas - ") - ACE_TEXT ("Obtaining the POAManager\n"))); - PortableServer::POAManager_var mgr = this->root_poa_->the_POAManager (); - - TAO::Utils::PolicyList_Destroyer policies (2); - policies.length (2); - - try - { - DANCE_TRACE_LOG (DANCE_LOG_TRACE, (LM_TRACE, DLINFO ACE_TEXT ("DAnCE_TargetManager_Module::create_poas - ") - ACE_TEXT ("DAnCE_TargetManager_Module::create_poas - ") - ACE_TEXT ("Creating the \"Repository\" POA.\n"))); - - policies[0] = this->root_poa_->create_id_assignment_policy (PortableServer::USER_ID); - policies[1] = this->root_poa_->create_lifespan_policy (PortableServer::PERSISTENT); - this->rm_poa_ = this->root_poa_->create_POA ("Repository", - mgr.in(), - policies); - } - catch (const PortableServer::POA::AdapterAlreadyExists &) - { - DANCE_TRACE_LOG (DANCE_LOG_TRACE, (LM_INFO, DLINFO ACE_TEXT ("DAnCE_TargetManager_Module::create_poas - ") - ACE_TEXT ("Using existing \"Repository\" POA\n"))); - this->rm_poa_ = this->root_poa_->find_POA ("Repository", 0); - } -} - diff --git a/DAnCE/dance/TargetManager/Target_Manager_Module.h b/DAnCE/dance/TargetManager/Target_Manager_Module.h deleted file mode 100644 index e635da39598..00000000000 --- a/DAnCE/dance/TargetManager/Target_Manager_Module.h +++ /dev/null @@ -1,90 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Target_Manager_Module.h - * - * @brief To start TargetManager by starter - * - * @author William R. Otte <wotte@dre.vanderbilt.edu> - */ -//============================================================================= - -#ifndef NODE_MANAGER_MODULE_H -#define NODE_MANAGER_MODULE_H - -#include /**/ "ace/pre.h" - -#include "ace/Service_Config.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "ace/Map_Manager.h" -#include "ace/Null_Mutex.h" -#include "tao/ORB.h" -#include "tao/PortableServer/POAC.h" -#include "orbsvcs/CosNamingC.h" -#include "TargetManager_Impl.h" - -/** - * @class Target_Manager_Module - * - * This class runs the node manager instance - */ -class DAnCE_TargetManager_Module -{ - public: - /// Constructor. - DAnCE_TargetManager_Module (void); - - /// Destructor. - ~DAnCE_TargetManager_Module (void); - - CORBA::Object_ptr init (CORBA::ORB_ptr orb, - int argc, - ACE_TCHAR *argv []); - - private: - const char * usage (void); - - bool parse_args (int argc, ACE_TCHAR *argv []); - - struct SOptions - { - const ACE_TCHAR * domain_nc_; - const ACE_TCHAR * ior_file_; - const ACE_TCHAR * domain_descr_; - const ACE_TCHAR * name_; - - SOptions() : - domain_nc_ (0), - ior_file_ (0), - domain_descr_ (0), - name_ (0) - { - } - }; - - void create_poas (void); - - /// Here we store the servants. - typedef ACE_Map_Manager < ACE_CString, - DAnCE::TargetManagerDaemon_i *, - ACE_Null_Mutex > Servant_Map; - - Servant_Map rm_map_; - - CORBA::ORB_var orb_; - CosNaming::NamingContext_var domain_nc_; - - SOptions options_; - - PortableServer::POA_var root_poa_; - PortableServer::POA_var rm_poa_; -}; - -#include /**/ "ace/post.h" - -#endif /* NODE_MANAGER_MODULE_H */ diff --git a/DAnCE/dance/Version.h b/DAnCE/dance/Version.h deleted file mode 100644 index bdf9e70e60e..00000000000 --- a/DAnCE/dance/Version.h +++ /dev/null @@ -1,8 +0,0 @@ - -// -*- C++ -*- -// This is file was automatically generated by \$ACE_ROOT/bin/make_release.py - -#define DAnCE_MAJOR_VERSION 1 -#define DAnCE_MINOR_VERSION 3 -#define DAnCE_BETA_VERSION 3 -#define DAnCE_VERSION "1.3.3" |