summaryrefslogtreecommitdiff
path: root/CIAO/DAnCE/NodeManager/Node_Manager_Module.h
blob: 2b87bf1bcfcff3c432d274fd35ca56bd5b45df0a (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// -*- C++ -*-

//=============================================================================
/**
 * @file Node_Manager_Module.h
 *
 * $Id$
 *
 * @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 "DAnCE_NodeManager_Module_Export.h"

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

#include "ace/Service_Config.h"
#include "ace/Vector_T.h"
#include "ace/Map_Manager.h"
#include "ace/Null_Mutex.h"
#include "tao/ORB.h"
#include "tao/PortableServer/POAC.h"
#include "orbsvcs/CosNamingC.h"
#include "tao/Object_Loader.h"
#include "Deployment/DAnCE_Loader.h"
#include "DAnCE/Deployment/Deployment_common.h"

namespace DAnCE
{
  class NodeManager_Impl;
//  class RedirectionService;
}

/**
 * @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_Export DAnCE_NodeManager_Module
  : public DAnCE::DAnCE_Object_Loader
{
 public:
      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_;
        bool ignore_failure_;
        const ACE_TCHAR * cs_path_;
        unsigned int timeout_;
        CORBA::Boolean standalone_;
        const ACE_TCHAR * server_args_;
        const ACE_TCHAR * domain_nc_;
        const ACE_TCHAR * instance_nc_;

        SOptions()
            : 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),
              cs_path_ (0),
              timeout_ (5),
              standalone_ (false),
              server_args_ (0),
              domain_nc_ (0),
              instance_nc_ (0)
        {
        }
      };

  /// 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.
  virtual CORBA::Object_ptr create_object (CORBA::ORB_ptr orb,
                                           int argc,
                                           ACE_TCHAR *argv []);

  virtual const char * usage (void);

  virtual bool parse_args (int argc, ACE_TCHAR *argv []);

 private:
  void register_value_factories (void);
  void create_poas (void);
  void create_nm_properties (DAnCE::PROPERTY_MAP &props);

  /// 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_;

  /// Single redirection service for all NMs.
  //DAnCE::RedirectionService * redirection_;
  SOptions options_;

  PortableServer::POA_var root_poa_;
  PortableServer::POA_var nm_poa_;
};

ACE_FACTORY_DECLARE (DAnCE_NodeManager_Module, DAnCE_NodeManager_Module)

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

#endif  /* NODE_MANAGER_MODULE_H */