summaryrefslogtreecommitdiff
path: root/CIAO/DAnCE/DomainApplicationManager/DomainApplicationManager_AMI_Impl.h
blob: 50e3cc7c30b99f2b49097250420d676480fe4fca (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
//==================================================================
/**
 *  @file DomainApplicationManager_AMI_Impl.h
 *
 *  $Id$
 *
 *  This file contains implementation for the servant of
 *  Deployment::DomainApplicationManager_AMI_Impl.
 *
 *  @author Gan Deng <gan.deng@vanderbilt.edu>
 */
//=====================================================================

#ifndef CIAO_DOMAINAPPLICATIONMANAGER_AMI_IMPL_H
#define CIAO_DOMAINAPPLICATIONMANAGER_AMI_IMPL_H
#include /**/ "ace/pre.h"

#include "ace/config-all.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "DomainApplicationManager_AMH_Impl.h"
#include "Reply_Handler_i.h"
#include "DAnCE/Deployment/Deployment_NodeApplicationManagerC.h"
#include "DAnCE/Deployment/Deployment_ApplicationC.h"

namespace CIAO
{
  /**
   * @class DomainApplicationManager_AMI_Impl
   *
   * @brief A subclass of the DomainApplicationManager_Impl servant
   * which uses AMI mechanism to handle deployment.
   */
  class DomainApplicationManager_Export DomainApplicationManager_AMI_Impl
    : public DomainApplicationManager_AMH_Impl
  {
  public:
    /// Constructor
    DomainApplicationManager_AMI_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);

    virtual void
      startLaunch (Deployment::AMH_DomainApplicationManagerResponseHandler_ptr _tao_rh,
                   const ::Deployment::Properties & configProperty,
                   ::CORBA::Boolean start);

    /// This operation will be called after *all* the AMI callbacks
    /// are received
    void
    post_ami_startLaunch (void);

    void decrease_start_launch_reply_count (void);

    int start_launch_reply_count (void);

  private:
    typedef struct
    {
      Deployment_AMI_NodeApplicationManagerHandler_i * servant_;
      ::Deployment::AMI_NodeApplicationManagerHandler_var obj_ref_;
    } AMI_NAM_Handler;

    typedef ACE_Hash_Map_Manager_Ex<ACE_CString,
                                    AMI_NAM_Handler,
                                    ACE_Hash<ACE_CString>,
                                    ACE_Equal_To<ACE_CString>,
                                    ACE_Null_Mutex> AMI_NAM_Handler_Table;
    typedef AMI_NAM_Handler_Table::iterator AMI_NAM_Handler_Table_Iterator;

    /// A table to trace the AMI reply handler
    AMI_NAM_Handler_Table ami_nam_handler_table_;

    /// Disable copy assignment
    DomainApplicationManager_AMI_Impl (const DomainApplicationManager_AMI_Impl&);

    /// AMI reply count
    volatile int start_launch_reply_count_;

    /// Object reference of the AMH response handler
    Deployment::AMH_DomainApplicationManagerResponseHandler_var amh_response_handler_;

    /// Object ID of the AMH response handler
    //PortableServer::ObjectId_var rh_oid_;
    ACE_Vector<PortableServer::ObjectId_var> rh_oid_;
  };
}

#include /**/ "ace/post.h"
#endif /* CIAO_DOMAINAPPLICATIONMANAGER_AMI_IMPL_H */