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
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
|
/* -*- C++ -*- */
//=============================================================================
/**
* @file tao_imr_i.h
*
* $Id$
*
* 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/ImR_Client/ImplRepoC.h"
#include "tao/corba.h"
#include "ace/SString.h"
#include "ace/Auto_Ptr.h"
// Forward Declaration
class TAO_IMR_Op;
/**
* @class TAO_IMR_i
*
* @brief TAO's command line helper application
*
* This class talks to the IMR and registers/lists/etc.
*/
class TAO_IMR_i
{
public:
// = Constructor and destructor.
TAO_IMR_i (void);
~TAO_IMR_i (void);
/// Execute client code.
int run (void);
/// Initialize the client communication endpoint with server.
int init (int argc, ACE_TCHAR **argv);
private:
/// Print out information about all operations.
void print_usage (void);
/// Parses the arguments passed on the command line.
int parse_args (void);
/// # of arguments on the command line.
int argc_;
/// Arguments from command line.
ACE_TCHAR **argv_;
/// Remember our orb.
CORBA::ORB_var orb_;
/// Reference to our Locator interface of
/// implementation repository.
ImplementationRepository::Administration_var imr_;
/// What we need to do.
ACE_Auto_Ptr<TAO_IMR_Op> op_;
};
/**
* @class TAO_IMR_Op
*
* @brief IMR Operation Base Class
*
* Provides a base class with virtual methods for each operation strategy.
*/
class TAO_IMR_Op
{
public:
enum RETURN_CODES {
NORMAL = 0,
UNKNOWN,
NO_PERMISSION,
ALREADY_REGISTERED,
CANNOT_ACTIVATE,
NOT_FOUND,
CANNOT_COMPLETE
};
/// Factory.
static TAO_IMR_Op *make_op (const ACE_TCHAR *op_name);
/// Destructor.
virtual ~TAO_IMR_Op (void);
/// Parse arguments.
virtual int parse (int argc, ACE_TCHAR **argv) = 0;
/// Do the work.
virtual int run (void) = 0;
/// Sets the implrepo locator pointer
void set_imr (ImplementationRepository::Administration_ptr imr);
protected:
/// Reference to our implementation repository.
ImplementationRepository::Administration_ptr imr_;
// = Helper methods
/// Prints out the information contained in a ServerInformation structure.
void display_server_information (const ImplementationRepository::ServerInformation &info);
};
/**
* @class TAO_IMR_Op_Activate
*
* @brief Activation Operation
*
* Activation is used to start servers via the Implementation Repository
*/
class TAO_IMR_Op_Activate : public TAO_IMR_Op
{
public:
virtual int parse (int argc, ACE_TCHAR **argv);
virtual int run (void);
protected:
/// Prints a message about the usage
void print_usage (void);
/// POA server name.
ACE_CString server_name_;
};
/**
* @class TAO_IMR_Op_Autostart
*
* @brief Autostart Operation
*
* Autostart is used to activate all servers with the AUTO_START activation
* mode.
*/
class TAO_IMR_Op_Autostart : public TAO_IMR_Op
{
public:
virtual int parse (int argc, ACE_TCHAR **argv);
virtual int run (void);
protected:
/// Prints a message about the usage
void print_usage (void);
};
/**
* @class TAO_IMR_Op_IOR
*
* @brief IOR Operation
*
* IOR is used to create a simple IOR for a server that uses the
* IMR and the Interoperable Naming Service.
*/
class TAO_IMR_Op_IOR : public TAO_IMR_Op
{
public:
virtual int parse (int argc, ACE_TCHAR **argv);
virtual int run (void);
protected:
/// Prints a message about the usage
void print_usage (void);
/// POA server name.
ACE_CString server_name_;
/// Filename to output to.
ACE_TString filename_;
};
/**
* @class TAO_IMR_Op_Kill
*
* @brief Kill Operation
*
* Kill is used to unregister a server in the IMR.
*/
class TAO_IMR_Op_Kill : public TAO_IMR_Op
{
public:
virtual int parse (int argc, ACE_TCHAR **argv);
virtual int run (void);
protected:
/// Prints a message about the usage
void print_usage (void);
ACE_CString server_name_;
int signum_;
};
/**
* @class TAO_IMR_Op_Link
*
* @brief Link Operation
*
* Link is used to unregister a server in the IMR.
*/
class TAO_IMR_Op_Link : public TAO_IMR_Op
{
public:
virtual int parse (int argc, ACE_TCHAR **argv);
virtual int run (void);
protected:
/// Prints a message about the usage
void print_usage (void);
ACE_CString server_name_;
CORBA::StringSeq peers_;
};
/**
* @class TAO_IMR_Op_List
*
* @brief List Operation
*
* List is used to either list all the servers registered in the IMR or just
* look at one of them.
*/
class TAO_IMR_Op_List : public TAO_IMR_Op
{
public:
TAO_IMR_Op_List (void);
virtual int parse (int argc, ACE_TCHAR **argv);
virtual int run (void);
protected:
/// Prints a message about the usage
void print_usage (void);
/// POA server name.
ACE_CString server_name_;
/// If true, more server information is displayed.
int verbose_server_information_;
/// If true, only show servers that are currently active.
int list_only_active_servers_;
/// retrieve no more than this number of entries at a time
CORBA::ULong how_many_;
/// Prints out the information contained in a ServerInformation structure.
/// Specialized to only print server information
void display_server_information (const ImplementationRepository::ServerInformation &info);
};
/**
* @class TAO_IMR_Op_Remove
*
* @brief Remove Operation
*
* Remove is used to unregister a server in the IMR.
*/
class TAO_IMR_Op_Remove : public TAO_IMR_Op
{
public:
virtual int parse (int argc, ACE_TCHAR **argv);
virtual int run (void);
protected:
/// Prints a message about the usage
void print_usage (void);
ACE_CString server_name_;
};
/**
* @class TAO_IMR_Op_Shutdown
*
* @brief Shutdown Operation
*
* Shutdown is used to shutdown a server through the IMR.
*/
class TAO_IMR_Op_Shutdown : public TAO_IMR_Op
{
public:
virtual int parse (int argc, ACE_TCHAR **argv);
virtual int run (void);
protected:
/// Prints a message about the usage
void print_usage (void);
ACE_CString server_name_;
};
/**
* Shutdown the ImR and optionally any registered activators.
*/
class TAO_IMR_Op_ShutdownRepo : public TAO_IMR_Op
{
public:
TAO_IMR_Op_ShutdownRepo();
virtual int parse (int argc, ACE_TCHAR **argv);
virtual int run (void);
protected:
void print_usage (void);
bool activators_;
};
/**
* @class TAO_IMR_Op_Register
*
* @brief Register Operation
*
* Register is used to update/add information for a server
* with the IMR.
*/
class TAO_IMR_Op_Register : public TAO_IMR_Op
{
public:
TAO_IMR_Op_Register(bool is_add);
virtual int parse (int argc, ACE_TCHAR **argv);
virtual int run (void);
protected:
/// Enables pre-registration checks
bool is_add_;
/// Sets one environment variable.
void addenv (ACE_TCHAR *opt);
/// Prints a message about the usage.
void print_usage (void);
/// POA server name.
ACE_CString server_name_;
bool set_command_line_;
ACE_CString command_line_;
bool set_environment_vars_;
ImplementationRepository::EnvironmentList environment_vars_;
bool set_working_dir_;
ACE_CString working_dir_;
bool set_activation_;
ImplementationRepository::ActivationMode activation_;
bool set_retry_count_;
int retry_count_;
bool set_activator_;
ACE_CString activator_;
};
#endif /* TAO_IMR_I_H */
|