Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / orbsvcs / ImplRepo_Service / tao_imr_i.h
blob0e2d8725bbcfbbb0f294eadbc5dde8022a0dbf13
1 /* -*- C++ -*- */
3 //=============================================================================
4 /**
5 * @file tao_imr_i.h
7 * This class implements the Implementation Repository helper application.
9 * @author Darrell Brunsch <brunsch@cs.wustl.edu>
11 //=============================================================================
12 #ifndef TAO_IMR_I_H
13 #define TAO_IMR_I_H
15 #include "tao/ImR_Client/ImplRepoC.h"
16 #include "tao/corba.h"
17 #include "ace/SString.h"
18 #include <memory>
20 // Forward Declaration
21 class TAO_IMR_Op;
23 /**
24 * @class TAO_IMR_i
26 * @brief TAO's command line helper application
28 * This class talks to the IMR and registers/lists/etc.
30 class TAO_IMR_i
32 public:
33 // = Constructor and destructor.
34 TAO_IMR_i ();
35 ~TAO_IMR_i ();
37 /// Execute client code.
38 int run ();
40 /// Initialize the client communication endpoint with server.
41 int init (int argc, ACE_TCHAR **argv);
43 private:
44 /// Print out information about all operations.
45 void print_usage ();
47 /// Parses the arguments passed on the command line.
48 int parse_args ();
50 /// # of arguments on the command line.
51 int argc_;
53 /// Arguments from command line.
54 ACE_TCHAR **argv_;
56 /// Remember our orb.
57 CORBA::ORB_var orb_;
59 /// Reference to our Locator interface of
60 /// implementation repository.
61 ImplementationRepository::Administration_var imr_;
63 /// What we need to do.
64 std::unique_ptr<TAO_IMR_Op> op_;
68 /**
69 * @class TAO_IMR_Op
71 * @brief IMR Operation Base Class
73 * Provides a base class with virtual methods for each operation strategy.
75 class TAO_IMR_Op
77 public:
78 enum RETURN_CODES {
79 NORMAL = 0,
80 UNKNOWN,
81 NO_PERMISSION,
82 ALREADY_REGISTERED,
83 CANNOT_ACTIVATE,
84 NOT_FOUND,
85 CANNOT_COMPLETE
88 /// Factory.
89 static TAO_IMR_Op *make_op (const ACE_TCHAR *op_name);
91 /// Destructor.
92 virtual ~TAO_IMR_Op ();
94 /// Parse arguments.
95 virtual int parse (int argc, ACE_TCHAR **argv) = 0;
97 /// Do the work.
98 virtual int run () = 0;
100 /// Sets the implrepo locator pointer
101 void set_imr (ImplementationRepository::Administration_ptr imr);
103 protected:
104 TAO_IMR_Op () : imr_ (0), quiet_ (false) {}
106 // = Helper methods
108 /// Prints out the information contained in a ServerInformation structure.
109 void display_server_information (const ImplementationRepository::ServerInformation &info);
111 /// Reference to our implementation repository.
112 ImplementationRepository::Administration_ptr imr_;
113 bool quiet_;
118 * @class TAO_IMR_Op_Activate
120 * @brief Activation Operation
122 * Activation is used to start servers via the Implementation Repository
124 class TAO_IMR_Op_Activate : public TAO_IMR_Op
126 public:
127 virtual int parse (int argc, ACE_TCHAR **argv);
128 virtual int run ();
130 protected:
131 /// Prints a message about the usage
132 void print_usage ();
134 /// POA server name.
135 ACE_CString server_name_;
139 * @class TAO_IMR_Op_Autostart
141 * @brief Autostart Operation
143 * Autostart is used to activate all servers with the AUTO_START activation
144 * mode.
146 class TAO_IMR_Op_Autostart : public TAO_IMR_Op
148 public:
149 virtual int parse (int argc, ACE_TCHAR **argv);
150 virtual int run ();
152 protected:
153 /// Prints a message about the usage
154 void print_usage ();
159 * @class TAO_IMR_Op_IOR
161 * @brief IOR Operation
163 * IOR is used to create a simple IOR for a server that uses the
164 * IMR and the Interoperable Naming Service.
166 class TAO_IMR_Op_IOR : public TAO_IMR_Op
168 public:
169 virtual int parse (int argc, ACE_TCHAR **argv);
170 virtual int run ();
172 protected:
173 /// Prints a message about the usage
174 void print_usage ();
176 /// POA server name.
177 ACE_CString server_name_;
179 /// Filename to output to.
180 ACE_TString filename_;
185 * @class TAO_IMR_Op_Kill
187 * @brief Kill Operation
189 * Kill is used to unregister a server in the IMR.
191 class TAO_IMR_Op_Kill : public TAO_IMR_Op
193 public:
194 virtual int parse (int argc, ACE_TCHAR **argv);
195 virtual int run ();
197 protected:
198 /// Prints a message about the usage
199 void print_usage ();
201 ACE_CString server_name_;
202 int signum_;
207 * @class TAO_IMR_Op_Link
209 * @brief Link Operation
211 * Link is used to unregister a server in the IMR.
213 class TAO_IMR_Op_Link : public TAO_IMR_Op
215 public:
216 virtual int parse (int argc, ACE_TCHAR **argv);
217 virtual int run ();
219 protected:
220 /// Prints a message about the usage
221 void print_usage ();
223 ACE_CString server_name_;
225 CORBA::StringSeq peers_;
230 * @class TAO_IMR_Op_List
232 * @brief List Operation
234 * List is used to either list all the servers registered in the IMR or just
235 * look at one of them.
237 class TAO_IMR_Op_List : public TAO_IMR_Op
239 public:
240 TAO_IMR_Op_List ();
242 virtual int parse (int argc, ACE_TCHAR **argv);
243 virtual int run ();
245 protected:
246 /// Prints a message about the usage
247 void print_usage ();
249 /// POA server name.
250 ACE_CString server_name_;
252 /// If true, more server information is displayed.
253 int verbose_server_information_;
255 /// If true, only show servers that are currently active.
256 int list_only_active_servers_;
258 /// retrieve no more than this number of entries at a time
259 CORBA::ULong how_many_;
261 /// If true, use minimum formatting.
262 int terse_;
264 /// Prints out the information contained in a ServerInformation structure.
265 /// Specialized to only print server information
266 void display_server_information (const ImplementationRepository::ServerInformation &info);
271 * @class TAO_IMR_Op_Remove
273 * @brief Remove Operation
275 * Remove is used to unregister a server in the IMR.
277 class TAO_IMR_Op_Remove : public TAO_IMR_Op
279 public:
280 virtual int parse (int argc, ACE_TCHAR **argv);
281 virtual int run ();
283 protected:
284 /// Prints a message about the usage
285 void print_usage ();
287 ACE_CString server_name_;
288 bool force_;
289 int signum_;
294 * @class TAO_IMR_Op_Shutdown
296 * @brief Shutdown Operation
298 * Shutdown is used to shutdown a server through the IMR.
300 class TAO_IMR_Op_Shutdown : public TAO_IMR_Op
302 public:
303 virtual int parse (int argc, ACE_TCHAR **argv);
304 virtual int run ();
306 protected:
307 /// Prints a message about the usage
308 void print_usage ();
310 ACE_CString server_name_;
314 * Shutdown the ImR and optionally any registered activators.
316 class TAO_IMR_Op_ShutdownRepo : public TAO_IMR_Op
318 public:
319 TAO_IMR_Op_ShutdownRepo();
320 virtual int parse (int argc, ACE_TCHAR **argv);
321 virtual int run ();
323 protected:
324 void print_usage ();
326 bool activators_;
330 * @class TAO_IMR_Op_Register
332 * @brief Register Operation
334 * Register is used to update/add information for a server
335 * with the IMR.
337 class TAO_IMR_Op_Register : public TAO_IMR_Op
339 public:
340 TAO_IMR_Op_Register(bool is_add);
342 virtual int parse (int argc, ACE_TCHAR **argv);
343 virtual int run ();
345 protected:
346 /// Enables pre-registration checks
347 bool is_add_;
349 /// Sets one environment variable.
350 void addenv (ACE_TCHAR *opt);
352 /// Prints a message about the usage.
353 void print_usage ();
355 /// POA server name.
356 ACE_CString server_name_;
358 bool set_command_line_;
359 ACE_CString command_line_;
361 bool set_environment_vars_;
362 ImplementationRepository::EnvironmentList environment_vars_;
364 bool set_working_dir_;
365 ACE_CString working_dir_;
367 bool set_activation_;
368 ImplementationRepository::ActivationMode activation_;
370 bool set_retry_count_;
371 int retry_count_;
373 bool set_activator_;
374 ACE_CString activator_;
377 #endif /* TAO_IMR_I_H */