diff options
Diffstat (limited to 'TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.h')
-rw-r--r-- | TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.h | 228 |
1 files changed, 220 insertions, 8 deletions
diff --git a/TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.h b/TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.h index df5432602a5..49e52ee7d37 100644 --- a/TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.h +++ b/TAO/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_Impl.h @@ -28,7 +28,8 @@ #include "ace/Vector_T.h" #include "ace/Functor.h" #include "ace/OS_NS_string.h" -#include "DeploymentS.h" +#include "ciao/DomainApplicationManagerS.h" +#include "ciao/Deployment_common.h" #include "tao/Valuetype/ValueBase.h" #include "tao/Valuetype/Valuetype_Adapter_Impl.h" @@ -36,9 +37,15 @@ #include "Deployment_Configuration.h" #include "DomainApplicationManager_Export.h" #include "ciao/CIAO_common.h" +#include "ciao/Deployment_EventsC.h" namespace CIAO { + namespace Execution_Manager + { + class Execution_Manager_Impl; + } + /** * @class DomainApplicationManager_Impl * @@ -51,6 +58,16 @@ namespace CIAO : public virtual POA_Deployment::DomainApplicationManager { public: + + // External_Connections means we search all the connections including + // the connectiosn for external/shared components of this plan which hold + // port objrefs of components within this plan + enum Connection_Search_Type + { + External_Connections, + Internal_Connections + }; + /// Define the type which contains a list of DnC artifacts. /// @@ Assumption: Each NodeApplicationManager create only one /// NodeApplication when the startLaunch() operation is invoked, @@ -62,12 +79,14 @@ namespace CIAO ::Deployment::DeploymentPlan_var child_plan_; ::Deployment::NodeApplicationManager_var node_application_manager_; ::Deployment::NodeApplication_var node_application_; + ::Deployment::DeploymentPlan_var old_child_plan_; } Chained_Artifacts; /// Constructor DomainApplicationManager_Impl (CORBA::ORB_ptr orb, PortableServer::POA_ptr poa, Deployment::TargetManager_ptr manager, + Execution_Manager::Execution_Manager_Impl * em, const Deployment::DeploymentPlan &plan, const char * deployment_file) ACE_THROW_SPEC ((CORBA::SystemException)); @@ -79,6 +98,8 @@ namespace CIAO *============================================================*/ /** * Initialize the DomainApplicationManager. + * @para em A pointer to the ExecutionManager servant C++ object. + * * (1) Set the total number of child plans. * (2) Set the list of NodeManager names, which is an array of strings. * The <node_manager_names> is a pointer to an array of ACE_CString @@ -115,6 +136,16 @@ namespace CIAO *============================================================*/ /** + * Fetch the NodeApplication object reference based on the NodeManager name. + */ + virtual Deployment::NodeApplication_ptr get_node_app ( + const char * node_name + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC (( + ::CORBA::SystemException, + ::Deployment::NoSuchName)); + + /** * Executes the application, but does not start it yet. Users can * optionally provide launch-time configuration properties to * override properties that are part of the plan. Raises the @@ -140,12 +171,34 @@ namespace CIAO * is started as well. Raises the StartError exception if * launching or starting the application fails. */ - virtual void finishLaunch (::CORBA::Boolean start + virtual void finishLaunch (CORBA::Boolean start, + CORBA::Boolean is_ReDAC ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException, ::Deployment::StartError)); /** + * The last step in launching an application in the + * domain-level. We establish connection bindings + * for external/shared components of this deployment plan + * components. + * Internally, this operation will invoke some operations + * on ExecutionManager to finish up this task. + */ + virtual void post_finishLaunch (void) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::StartError)); + + virtual void passivate_shared_components (void) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::StartError)); + + virtual void activate_shared_components (void) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::StartError)); + + + /** * Starts the application. Raises the StartError exception if * starting the application fails. */ @@ -180,6 +233,20 @@ namespace CIAO ACE_THROW_SPEC ((CORBA::SystemException, Deployment::StopError)); + // The input parameter is a *new_plan* which has the + // same UUID of the existing running plan. + virtual void + perform_redeployment ( + const Deployment::DeploymentPlan & plan + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::PlanError, + Deployment::InstallationFailure, + Deployment::UnknownImplId, + Deployment::ImplEntryPointNotFound, + Deployment::InvalidConnection, + ::Components::RemoveFailure)); + protected: /// Destructor virtual ~DomainApplicationManager_Impl (void); @@ -202,6 +269,47 @@ namespace CIAO */ int split_plan (void); + /** + * Construct <Component_Binding_Info> struct for the component instance. + * + * @para name component instance name + * @para child_uuid child plan uuid string + */ + CIAO::Component_Binding_Info * + populate_binding_info (const ACE_CString& name, + const ACE_CString& child_uuid); + + /** + * Construct <Component_Binding_Info> struct for the component instance. + * Fetch the plan_uuid info from the internally cached shared component + * list. + * + * @para name component instance name + */ + CIAO::Component_Binding_Info * + populate_binding_info (const ACE_CString& name); + + /** + * Contact each NodeManager to get shared compnents information + * and then update its internal cache. + */ + void synchronize_shared_components_with_node_managers (void); + + /** + * A helper function to add a list of shared components into + * the cached shared component list. + * + * @para shared A list of shared components to be added. + */ + void add_shared_components (const Deployment::ComponentPlans & shared); + + /** + * A private function to check whether a component is in the shared + * component list. + * + * @para name The name of a component instance. + */ + bool is_shared_component (const char * name); /** * Cache the incoming connections, which is a sequence of Connections, @@ -213,21 +321,97 @@ namespace CIAO * Given a child deployment plan, find the <Connections> sequence * of the "providedReference" for the component instances in the * child deployment plan as Receiver side. + * By default, we search in the new plan. + * + * If <is_getting_all_connections> is false, then we only + * search for "new connections" (valid for ReDaC case only). + * Otherwise, we will search for both new connections and those + * already existing connections. */ Deployment::Connections * - get_outgoing_connections (const Deployment::DeploymentPlan &plan - ACE_ENV_ARG_DECL); + get_outgoing_connections (const Deployment::DeploymentPlan &plan, + bool is_getting_all_connections = true, + bool is_search_new_plan = true, + Connection_Search_Type t = Internal_Connections + ACE_ENV_ARG_DECL_WITH_DEFAULTS); /// This is a helper function to find the connection for a component. bool get_outgoing_connections_i (const char * instname, - Deployment::Connections & retv - ACE_ENV_ARG_DECL) + Deployment::Connections & retv, + bool is_ReDAC, + bool is_search_new_plan + ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_THROW_SPEC ((Deployment::StartError)); + + bool + populate_connection_for_binding ( + const char * instname, + const Deployment::PlanConnectionDescription & binding, + const Deployment::DeploymentPlan & plan, + Deployment::Connections & retv) + ACE_THROW_SPEC ((Deployment::StartError)); + + bool + handle_es_connection ( + const char * instname, + const Deployment::PlanConnectionDescription & binding, + const Deployment::DeploymentPlan & plan, + Deployment::Connections & retv) + ACE_THROW_SPEC ((Deployment::StartError)); + + bool + handle_direct_connection ( + const char * instname, + const Deployment::PlanConnectionDescription & binding, + const Deployment::DeploymentPlan & plan, + Deployment::Connections & retv) ACE_THROW_SPEC ((Deployment::StartError)); /// Dump connections, a static method void dump_connections (const ::Deployment::Connections & connections); + /// Check whether a connection already exists in the cached old plan + bool already_exists (const Deployment::PlanConnectionDescription & conn); + + /// Remove those appeared in <right> from the <left> + Deployment::Connections * + subtract_connections (const Deployment::Connections & left, + const Deployment::Connections & right); + + void + purge_connections (Deployment::Connections_var & connections, + const char * inst); + + /** + * The first step in finish_launching an application in the + * domain-level. We install all the CIAO_Event_Service objects + * as specified in the DeploymentPlan. + * Internally, this operation will invoke an operation on each cached + * NodeApplication object. + */ + virtual void install_all_es (void) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::StartError)); + + /** + * Add all CIAO_Event_Service objects into the cached map. + */ + virtual void + add_es_to_map (Deployment::ESInstallationInfos * es_infos, + Deployment::CIAO_Event_Services * event_services) + ACE_THROW_SPEC ((CORBA::SystemException, + Deployment::StartError)); + + /** + * Get the actual event connection QoS properties based on the + * deployment requirement. The deployment requirement only specifies + * an identifier/reference to the EventServiceDeploymentDescriptions. + */ + virtual const Deployment::Properties & + get_connection_QoS_configuration ( + const Deployment::Requirement & requirement); + protected: /// location of the Domainapplication CORBA::String_var domainapp_path_; @@ -238,8 +422,14 @@ namespace CIAO /// Keep a pointer to the managing POA. PortableServer::POA_var poa_; - /// Cache a object reference to this servant. - /// Deployment::DomainApplicationManager_var objref_; + /// Pointer to the ExecutionManager_Impl "singleton" servant object + /// We could do this because ExecutionManager and DomainApplicationManager + /// are always collocated in the same process, so we don't have + /// to pass CORBA object reference back and forth. + Execution_Manager::Execution_Manager_Impl * execution_manager_; + + /// Cache a list of shared components + Deployment::ComponentPlans_var shared_; /// Cache the ior of the previous reference CORBA::String_var ior_; @@ -251,6 +441,9 @@ namespace CIAO /// The plan will be initialized when init is called. Deployment::DeploymentPlan plan_; + /// Cached old deployment plan, i.e., before redeployment + Deployment::DeploymentPlan old_plan_; + /// Cached child plans. //Deployment::DeploymentPlan * child_plan_; @@ -273,6 +466,18 @@ namespace CIAO Chained_Artifacts_Table artifact_map_; + /// Cached information of all the CIAO_Event_Service objects within + /// the deployment plan + /// Key: the string identifier of the CIAO_Event_Service + /// Value: the object reference of the CIAO_Event_Service + typedef ACE_Hash_Map_Manager_Ex<ACE_CString, + CIAO::CIAO_Event_Service_var, + ACE_Hash<ACE_CString>, + ACE_Equal_To<ACE_CString>, + ACE_Null_Mutex> Event_Service_Table; + + Event_Service_Table es_map_; + /// The deployment information data file. const char * deployment_file_; @@ -286,6 +491,13 @@ namespace CIAO /// calling the startLaunch() method on the NodeApplicationManager object. ::Deployment::Connections_var all_connections_; + /// This variable is used to control the execution path of some + /// member function implementations. The reason is because we want + /// to avoid unnecessary code duplicate. The default value is "false". + bool is_redeployment_; + + /// Cache the CIAO_Event_Service deployment description + CIAO::DAnCE::EventServiceDeploymentDescriptions_var esd_; }; } |