summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/ImplRepo_Service/Server_Info.h
blob: 5132dfa14472a8c9e3709c8f106ea0aca6e31250 (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
134
135
136
137
//=============================================================================
/**
 *  @file    Server_Info.h
 *
 *  This class implements the Server_Info for the Implementation Repository.
 *
 *  @author Darrell Brunsch <brunsch@cs.wustl.edu>
 *  @author Priyanka Gontla <gontla_p@ociweb.com>
 */
#ifndef SERVER_INFO_H
#define SERVER_INFO_H

#include "ace/Bound_Ptr.h"

#include "ImplRepoC.h"

#include "ace/SString.h"

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

struct Server_Info;
typedef ACE_Strong_Bound_Ptr<Server_Info, ACE_Null_Mutex> Server_Info_Ptr;

/**
* @brief Information about IMR registered servers.
*/
struct Server_Info
{
  Server_Info ();
  Server_Info (const Server_Info & other);

  Server_Info (const ACE_CString& fqname,
               const ACE_CString& aname,
               const ACE_CString& cmdline,
               const ImplementationRepository::EnvironmentList& env,
               const ACE_CString& working_dir,
               ImplementationRepository::ActivationMode amode,
               int start_limit,
               const ACE_CString& partial_ior = ACE_CString(""),
               const ACE_CString& server_ior = ACE_CString(""),
               ImplementationRepository::ServerObject_ptr svrobj = ImplementationRepository::ServerObject::_nil());

  Server_Info (const ACE_CString& serverId,
               const ACE_CString& pname,
               bool jacorb,
               Server_Info_Ptr alt);

  Server_Info & operator= (const Server_Info& other);

  void clear ();

  /// Convert to the corba type
  void setImRInfo (ImplementationRepository::ServerInformation* info) const;
  ImplementationRepository::ServerInformation* createImRServerInfo() const;

  void reset_runtime ();

  bool is_server (const char *name) const;
  bool has_peer (const char *name) const;
  bool is_mode (ImplementationRepository::ActivationMode m) const;
  ImplementationRepository::ActivationMode mode () const;

  bool is_running () const;
  bool start_allowed ();
  void started (bool success);

  // transform the supplied limit to always be at least 1
  void start_limit (int lim);

  void update_options (const ImplementationRepository::StartupOptions &options);
  void set_contact (const char *pior,
                    const char *sior,
                    ImplementationRepository::ServerObject_ptr svrobj);

  Server_Info *active_info ();
  const Server_Info *active_info () const;

  const char * ping_id () const;

  static bool parse_id (const char * id,
                        ACE_CString& server_id,
                        ACE_CString& poa_name);

  static void gen_id (const Server_Info *si, ACE_CString& id);

  static void gen_key (const ACE_CString& server_id,
                       const ACE_CString& poa_name,
                       ACE_CString& key);

  static void fqname_to_key (const char * fqname, ACE_CString& key);

  /// The name of the server instance.
  ACE_CString server_id;
  /// the name of the poa
  ACE_CString poa_name;
  /// true if the server is JacORB
  bool is_jacorb;

  /// The fully qualified name of this info, combines the serverID and POA name
  ACE_CString key_name_;

  /// The name of the activator in which this server runs
  ACE_CString activator;
  /// The command line startup command (program and arguments).
  ACE_CString cmdline;
  /// Environment Variables.
  ImplementationRepository::EnvironmentList env_vars;
  /// The working directory.
  ACE_CString dir;
  /// The type of activation this supports.
  ImplementationRepository::ActivationMode activation_mode_;
  /// Limit of retries to start the server
  int start_limit_;
  /// Current number of start attempts
  int start_count_;
  /// Current endpoint used by the server.
  ACE_CString partial_ior;
  /// IOR of the server object in the server.
  ACE_CString ior;
  /// The timestamp of the last time we verified the server is alive
  ACE_Time_Value last_ping;
  /// The cached server object
  ImplementationRepository::ServerObject_var server;
  /// A comma separated list of additional POAs bound to this server
  CORBA::StringSeq peers;
  /// Alternate server info for sharing startup info between linked POAs
  Server_Info_Ptr alt_info_;

  /// Last known process ID reported by the activator
  int pid;
  /// The locator should expect a notification on server death from activator
  bool death_notify;
};

#endif /* SERVER_INFO_H */