summaryrefslogtreecommitdiff
path: root/TAO/CIAO/DAnCE/Plan_Launcher/Plan_Launcher_Impl.h
blob: 371d7eb2f19ca6b56c2f602c4df2feeb03f9d7b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/**
 * $Id$
 * @file Plan_Launcher_Impl.h
 * @author Will Otte <wotte@dre.vanderbilt.edu>
 *
 * Contains the Plan_Launcher_i class, which can be used by
 * applications to launch component assemblies.
 */
#ifndef PLAN_LAUNCHER_IMPL_H
#define PLAN_LAUNCHER_IMPL_H

#include "Plan_Launcher_Impl_Export.h"
#include "ciao/DeploymentS.h"
#include "ciao/CIAO_common.h"
#include "ExecutionManager/DAM_Map.h"
#include "Interfaces/ExecutionManagerC.h"

namespace CIAO
{
  namespace Plan_Launcher
  {

    /**
     * @class Plan_Launcher_i
     * @brief This class launches and manages deployment plans.
     */
    class Plan_Launcher_Impl_Export Plan_Launcher_i
    {
    public:
      class Deployment_Failure {};

      Plan_Launcher_i ();


      bool init (const char *em_ior,
                 CORBA::ORB_ptr orb
                 ACE_ENV_ARG_DECL_WITH_DEFAULTS);

      /**
       * @fn launch_plan
       * @brief Launch a plan, given a deployment plan URI
       * @param plan_uri A uri that points ot a valid deployment plan
       * @returns a string containing the UUID of the plan. Null indicates failure.
       */
      const char * launch_plan (const char *plan_uri
                                ACE_ENV_ARG_DECL_WITH_DEFAULTS)
        ACE_THROW_SPEC ((Deployment_Failure));

      const char * re_launch_plan (const char *plan_uri
                                   ACE_ENV_ARG_DECL_WITH_DEFAULTS)
        ACE_THROW_SPEC ((Deployment_Failure));

      /**
       * @fn launch_plan
       * @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.
       */
      const char * launch_plan (const ::Deployment::DeploymentPlan &plan
                                ACE_ENV_ARG_DECL_WITH_DEFAULTS)
        ACE_THROW_SPEC ((Deployment_Failure));

      const char * re_launch_plan (const ::Deployment::DeploymentPlan &plan
                                   ACE_ENV_ARG_DECL_WITH_DEFAULTS)
        ACE_THROW_SPEC ((Deployment_Failure));

      /// Returns the DAM associated with a given plan URI
      ::Deployment::DomainApplicationManager_ptr get_dam (const char *uuid
                                           ACE_ENV_ARG_DECL_WITH_DEFAULTS);

      /// Tears down a plan given the UUID
      bool teardown_plan (const char *uuid ACE_ENV_ARG_DECL);

      bool teardown_plan (::Deployment::DomainApplicationManager_ptr dam
                          ACE_ENV_ARG_DECL_WITH_DEFAULTS);

      void destroy_dam (::Deployment::DomainApplicationManager_ptr dam
                        ACE_ENV_ARG_DECL_WITH_DEFAULTS);

      void destroy_dam_by_plan (const char * plan_uuid
                                ACE_ENV_ARG_DECL_WITH_DEFAULTS);

    private:
      ::CIAO::ExecutionManagerDaemon_var em_;

      /// Local map for DAMs, to save expensive UUID lookups.
      Execution_Manager::DAM_Map map_;
    };

  }
}


#endif /* PLAN_LAUNCHER_IMPL_H */