summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/ImplRepo_Service/tao_imr_i.h
blob: 551f725720977feaebb64a35c3c4fcbd1c9ae088 (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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
/* -*- C++ -*- */
// $Id$

// ============================================================================
//
// = LIBRARY
//    TAO/orbsvcs/ImplRepo_Service
//
// = FILENAME
//    tao_imr_i.h
//
// = DESCRIPTION
//    This class implements the Implementation Repository helper application.
//
// = AUTHOR
//    Darrell Brunsch <brunsch@cs.wustl.edu>
//
// ============================================================================

#ifndef TAO_IMR_I_H
#define TAO_IMR_I_H

#include "tao/corba.h"
#include "tao/ImplRepoC.h"

class TAO_IMR_Op;
// Forward Declaration

class TAO_IMR_i
{
  // = TITLE
  //     TAO's command line helper application
  //
  // = DESCRIPTION
  //     This class talks to the IMR and registers/lists/etc.
public:
  // = Constructor and destructor.
  TAO_IMR_i (void);
  ~TAO_IMR_i (void);

  int run (void);
  // Execute client code.

  int init (int argc, char **argv);
  // Initialize the client communication endpoint with server.

private:
  void print_usage (void);
  // Print out information about all operations.

  int parse_args (void);
  // Parses the arguments passed on the command line.

  int argc_;
  // # of arguments on the command line.

  ACE_TCHAR **argv_;
  // arguments from command line.

  CORBA::ORB_var orb_;
  // Remember our orb.

  ImplementationRepository::Administration_var implrepo_;
  // Reference to our implementation repository.

  TAO_IMR_Op *op_;
  // What we need to do.
};


class TAO_IMR_Op
{
  // = TITLE
  //     IMR Operation Base Class
  //
  // = DESCRIPTION
  //     Provides a base class with virtual methods for each operation strategy.
public:
  static TAO_IMR_Op *make_op (const ACE_TCHAR *op_name);
  // Factory.

  TAO_IMR_Op (void);
  // Constructor.

  virtual void set_imr (ImplementationRepository::Administration_ptr imr);
  // Sets the implrepo pointer

  virtual ~TAO_IMR_Op (void);
  // Virtual Destructor.

  virtual int parse (int argc, ACE_TCHAR **argv) = 0;
  // Parse arguments.

  virtual int run (void) = 0;
  // Do the work.

protected:
  ImplementationRepository::Administration_ptr implrepo_;
  // Reference to our implementation repository.

  // = Helper methods

  void display_server_information (const ImplementationRepository::ServerInformation &info);
  // Prints out the information contained in a ServerInformation structure.
};


class TAO_IMR_Op_Activate : public TAO_IMR_Op
{
  // = TITLE
  //     Activation Operation
  //
  // = DESCRIPTION
  //     Activation is used to start servers via the Implementation Repository
public:
  TAO_IMR_Op_Activate (void);
  ~TAO_IMR_Op_Activate (void);

  virtual int parse (int argc, ACE_TCHAR **argv);
  virtual int run (void);

protected:
  void print_usage (void);
  // Prints a message about the usage

  ACE_TString server_name_;
  // POA server name.
};


class TAO_IMR_Op_Add : public TAO_IMR_Op
{
  // = TITLE
  //     Add Operation
  //
  // = DESCRIPTION
  //     Add is used to register information about a server with the IMR.
public:
  TAO_IMR_Op_Add (void);
  ~TAO_IMR_Op_Add (void);

  virtual int parse (int argc, ACE_TCHAR **argv);
  virtual int run (void);

protected:
  void setenv (ACE_TCHAR *optarg);
  // Sets one of the environment variables

  void print_usage (void);
  // Prints a message about the usage.

  ACE_TString server_name_;
  // POA server name.

  ACE_TString command_line_;
  // Command line.

  ImplementationRepository::EnvironmentList environment_vars_;
  // Environment Variables.

  ACE_TString working_dir_;
  // Working directory.

  ImplementationRepository::ActivationMode activation_;
  // Activation mode (0 = NORMAL, 1 = MANUAL, 2 = PER_CLIENT, 3 = AUTO_START)
};


class TAO_IMR_Op_Autostart : public TAO_IMR_Op
{
  // = TITLE
  //     Autostart Operation
  //
  // = DESCRIPTION
  //     Autostart is used to activate all servers with the AUTO_START activation
  //     mode.
public:
  TAO_IMR_Op_Autostart (void);
  ~TAO_IMR_Op_Autostart (void);

  virtual int parse (int argc, ACE_TCHAR **argv);
  virtual int run (void);

protected:
  void print_usage (void);
  // Prints a message about the usage
};


class TAO_IMR_Op_IOR : public TAO_IMR_Op
{
  // = TITLE
  //     IOR Operation
  //
  // = DESCRIPTION
  //     IOR is used to create a simple IOR for a server that uses the
  //     IMR and the Interoperable Naming Service.
public:
  TAO_IMR_Op_IOR (void);
  ~TAO_IMR_Op_IOR (void);

  virtual int parse (int argc, ACE_TCHAR **argv);
  virtual int run (void);

protected:
  void print_usage (void);
  // Prints a message about the usage

  ACE_TString server_name_;
  // POA server name.

  ACE_TString filename_;
  // Filename to output to.
};


class TAO_IMR_Op_List : public TAO_IMR_Op
{
  // = TITLE
  //     List Operation
  //
  // = DESCRIPTION
  //     List is used to either list all the servers registered in the IMR or just
  //     look at one of them.
public:
  TAO_IMR_Op_List (void);
  ~TAO_IMR_Op_List (void);

  virtual int parse (int argc, ACE_TCHAR **argv);
  virtual int run (void);

protected:
  void print_usage (void);
  // Prints a message about the usage

  ACE_TString server_name_;
  // POA server name.

  int verbose_server_information_;
  // If true, more server information is displayed.

  void display_server_information (const ImplementationRepository::ServerInformation &info);
  // Prints out the information contained in a ServerInformation structure.
  // Specialized to only print server information
};


class TAO_IMR_Op_Remove : public TAO_IMR_Op
{
  // = TITLE
  //     Remove Operation
  //
  // = DESCRIPTION
  //     Remove is used to unregister a server in the IMR.
public:
  TAO_IMR_Op_Remove (void);
  ~TAO_IMR_Op_Remove (void);

  virtual int parse (int argc, ACE_TCHAR **argv);
  virtual int run (void);

protected:
  void print_usage (void);
  // Prints a message about the usage

  ACE_TString server_name_;
  // POA server name.
};


class TAO_IMR_Op_Shutdown : public TAO_IMR_Op
{
  // = TITLE
  //     Shutdown Operation
  //
  // = DESCRIPTION
  //     Shutdown is used to shutdown a server through the IMR.
public:
  TAO_IMR_Op_Shutdown (void);
  ~TAO_IMR_Op_Shutdown (void);

  virtual int parse (int argc, ACE_TCHAR **argv);
  virtual int run (void);

protected:
  void print_usage (void);
  // Prints a message about the usage

  ACE_TString server_name_;
  // POA server name.
};


class TAO_IMR_Op_Update : public TAO_IMR_Op
{
  // = TITLE
  //     Update Operation
  //
  // = DESCRIPTION
  //     Update is used to update the information for a server registered
  //     with the IMR.
public:
  TAO_IMR_Op_Update (void);
  ~TAO_IMR_Op_Update (void);

  virtual int parse (int argc, ACE_TCHAR **argv);
  virtual int run (void);

protected:
  void setenv (ACE_TCHAR *optarg);
  // Sets one environment variable.

  void print_usage (void);
  // Prints a message about the usage.

  ACE_TString server_name_;
  // POA server name.

  int set_command_line_;
  // True if the command_line_ needs to be updated.

  ACE_TString command_line_;
  // Startup command.

  int set_environment_vars_;
  // True if the environment_vars_ needs to be updated.

  int set_working_dir_;
  // True if the working_dir_ needs to be updated.

  ImplementationRepository::EnvironmentList environment_vars_;
  // Environment Variables.

  ACE_TString working_dir_;
  // Working directory.

  int set_activation_;
  // True if the activation mode needs to be updated.

  ImplementationRepository::ActivationMode activation_;
  // Activation mode (0 = NORMAL, 1 = MANUAL, 2 = PER_CLIENT, 3 = AUTO_START)
};

#endif /* TAO_IMR_I_H */