3 //=============================================================================
7 * This class implements the Implementation Repository helper application.
9 * @author Darrell Brunsch <brunsch@cs.wustl.edu>
11 //=============================================================================
15 #include "tao/ImR_Client/ImplRepoC.h"
16 #include "tao/corba.h"
17 #include "ace/SString.h"
18 #include "ace/Auto_Ptr.h"
20 // Forward Declaration
26 * @brief TAO's command line helper application
28 * This class talks to the IMR and registers/lists/etc.
34 // = Constructor and destructor.
38 /// Execute client code.
41 /// Initialize the client communication endpoint with server.
42 int init (int argc
, ACE_TCHAR
**argv
);
45 /// Print out information about all operations.
46 void print_usage (void);
48 /// Parses the arguments passed on the command line.
49 int parse_args (void);
51 /// # of arguments on the command line.
54 /// Arguments from command line.
60 /// Reference to our Locator interface of
61 /// implementation repository.
62 ImplementationRepository::Administration_var imr_
;
64 /// What we need to do.
65 ACE_Auto_Ptr
<TAO_IMR_Op
> op_
;
72 * @brief IMR Operation Base Class
74 * Provides a base class with virtual methods for each operation strategy.
90 static TAO_IMR_Op
*make_op (const ACE_TCHAR
*op_name
);
93 virtual ~TAO_IMR_Op (void);
96 virtual int parse (int argc
, ACE_TCHAR
**argv
) = 0;
99 virtual int run (void) = 0;
101 /// Sets the implrepo locator pointer
102 void set_imr (ImplementationRepository::Administration_ptr imr
);
105 TAO_IMR_Op (void) : imr_ (0), quiet_ (false) {}
109 /// Prints out the information contained in a ServerInformation structure.
110 void display_server_information (const ImplementationRepository::ServerInformation
&info
);
112 /// Reference to our implementation repository.
113 ImplementationRepository::Administration_ptr imr_
;
119 * @class TAO_IMR_Op_Activate
121 * @brief Activation Operation
123 * Activation is used to start servers via the Implementation Repository
125 class TAO_IMR_Op_Activate
: public TAO_IMR_Op
128 virtual int parse (int argc
, ACE_TCHAR
**argv
);
129 virtual int run (void);
132 /// Prints a message about the usage
133 void print_usage (void);
136 ACE_CString server_name_
;
140 * @class TAO_IMR_Op_Autostart
142 * @brief Autostart Operation
144 * Autostart is used to activate all servers with the AUTO_START activation
147 class TAO_IMR_Op_Autostart
: public TAO_IMR_Op
150 virtual int parse (int argc
, ACE_TCHAR
**argv
);
151 virtual int run (void);
154 /// Prints a message about the usage
155 void print_usage (void);
160 * @class TAO_IMR_Op_IOR
162 * @brief IOR Operation
164 * IOR is used to create a simple IOR for a server that uses the
165 * IMR and the Interoperable Naming Service.
167 class TAO_IMR_Op_IOR
: public TAO_IMR_Op
170 virtual int parse (int argc
, ACE_TCHAR
**argv
);
171 virtual int run (void);
174 /// Prints a message about the usage
175 void print_usage (void);
178 ACE_CString server_name_
;
180 /// Filename to output to.
181 ACE_TString filename_
;
186 * @class TAO_IMR_Op_Kill
188 * @brief Kill Operation
190 * Kill is used to unregister a server in the IMR.
192 class TAO_IMR_Op_Kill
: public TAO_IMR_Op
195 virtual int parse (int argc
, ACE_TCHAR
**argv
);
196 virtual int run (void);
199 /// Prints a message about the usage
200 void print_usage (void);
202 ACE_CString server_name_
;
208 * @class TAO_IMR_Op_Link
210 * @brief Link Operation
212 * Link is used to unregister a server in the IMR.
214 class TAO_IMR_Op_Link
: public TAO_IMR_Op
217 virtual int parse (int argc
, ACE_TCHAR
**argv
);
218 virtual int run (void);
221 /// Prints a message about the usage
222 void print_usage (void);
224 ACE_CString server_name_
;
226 CORBA::StringSeq peers_
;
232 * @class TAO_IMR_Op_List
234 * @brief List Operation
236 * List is used to either list all the servers registered in the IMR or just
237 * look at one of them.
239 class TAO_IMR_Op_List
: public TAO_IMR_Op
242 TAO_IMR_Op_List (void);
244 virtual int parse (int argc
, ACE_TCHAR
**argv
);
245 virtual int run (void);
248 /// Prints a message about the usage
249 void print_usage (void);
252 ACE_CString server_name_
;
254 /// If true, more server information is displayed.
255 int verbose_server_information_
;
257 /// If true, only show servers that are currently active.
258 int list_only_active_servers_
;
260 /// retrieve no more than this number of entries at a time
261 CORBA::ULong how_many_
;
263 /// If true, use minimum formatting.
266 /// Prints out the information contained in a ServerInformation structure.
267 /// Specialized to only print server information
268 void display_server_information (const ImplementationRepository::ServerInformation
&info
);
273 * @class TAO_IMR_Op_Remove
275 * @brief Remove Operation
277 * Remove is used to unregister a server in the IMR.
279 class TAO_IMR_Op_Remove
: public TAO_IMR_Op
282 virtual int parse (int argc
, ACE_TCHAR
**argv
);
283 virtual int run (void);
286 /// Prints a message about the usage
287 void print_usage (void);
289 ACE_CString server_name_
;
296 * @class TAO_IMR_Op_Shutdown
298 * @brief Shutdown Operation
300 * Shutdown is used to shutdown a server through the IMR.
302 class TAO_IMR_Op_Shutdown
: public TAO_IMR_Op
305 virtual int parse (int argc
, ACE_TCHAR
**argv
);
306 virtual int run (void);
309 /// Prints a message about the usage
310 void print_usage (void);
312 ACE_CString server_name_
;
316 * Shutdown the ImR and optionally any registered activators.
318 class TAO_IMR_Op_ShutdownRepo
: public TAO_IMR_Op
321 TAO_IMR_Op_ShutdownRepo();
322 virtual int parse (int argc
, ACE_TCHAR
**argv
);
323 virtual int run (void);
326 void print_usage (void);
332 * @class TAO_IMR_Op_Register
334 * @brief Register Operation
336 * Register is used to update/add information for a server
339 class TAO_IMR_Op_Register
: public TAO_IMR_Op
342 TAO_IMR_Op_Register(bool is_add
);
344 virtual int parse (int argc
, ACE_TCHAR
**argv
);
345 virtual int run (void);
349 /// Enables pre-registration checks
352 /// Sets one environment variable.
353 void addenv (ACE_TCHAR
*opt
);
355 /// Prints a message about the usage.
356 void print_usage (void);
359 ACE_CString server_name_
;
361 bool set_command_line_
;
362 ACE_CString command_line_
;
364 bool set_environment_vars_
;
365 ImplementationRepository::EnvironmentList environment_vars_
;
367 bool set_working_dir_
;
368 ACE_CString working_dir_
;
370 bool set_activation_
;
371 ImplementationRepository::ActivationMode activation_
;
373 bool set_retry_count_
;
377 ACE_CString activator_
;
380 #endif /* TAO_IMR_I_H */