summaryrefslogtreecommitdiff
path: root/CIAO/DAnCE/NodeApplication/NodeApplication_Impl.h
blob: 8f77c9b2cfd5c88364fe55f103ca9842677e399a (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
95
96
97
98
99
100
// -*- C++ -*-

//=============================================================================
/**
 *  @file    NodeApplication_Impl.h
 *
 *  $Id$
 *
 * @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 "ccm/CCM_KeylessCCMHomeC.h"
#include "ciao/ComponentServer/CIAO_ServerActivator_Impl.h"

#include "ccm/ComponentServer/CCM_ComponentServerC.h"
#include "Deployment/Deployment_NodeApplicationS.h"
#include "Deployment/Deployment_DeploymentPlanC.h"
#include "Deployment/DeploymentC.h"
#include "DAnCE/DAnCE_Utility.h"
#include "DAnCE/DAnCE_LocalityManagerC.h"
#include "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_;
  };
}
#endif /*NODEAPPLICATION_IMPL_H_*/