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"
20 // Forward Declaration
26 * @brief TAO's command line helper application
28 * This class talks to the IMR and registers/lists/etc.
33 // = Constructor and destructor.
37 /// Execute client code.
40 /// Initialize the client communication endpoint with server.
41 int init (int argc
, ACE_TCHAR
**argv
);
44 /// Print out information about all operations.
47 /// Parses the arguments passed on the command line.
50 /// # of arguments on the command line.
53 /// Arguments from command line.
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_
;
71 * @brief IMR Operation Base Class
73 * Provides a base class with virtual methods for each operation strategy.
89 static TAO_IMR_Op
*make_op (const ACE_TCHAR
*op_name
);
92 virtual ~TAO_IMR_Op ();
95 virtual int parse (int argc
, ACE_TCHAR
**argv
) = 0;
98 virtual int run () = 0;
100 /// Sets the implrepo locator pointer
101 void set_imr (ImplementationRepository::Administration_ptr imr
);
104 TAO_IMR_Op () : imr_ (0), quiet_ (false) {}
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_
;
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
127 virtual int parse (int argc
, ACE_TCHAR
**argv
);
131 /// Prints a message about the usage
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
146 class TAO_IMR_Op_Autostart
: public TAO_IMR_Op
149 virtual int parse (int argc
, ACE_TCHAR
**argv
);
153 /// Prints a message about the 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
169 virtual int parse (int argc
, ACE_TCHAR
**argv
);
173 /// Prints a message about the usage
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
194 virtual int parse (int argc
, ACE_TCHAR
**argv
);
198 /// Prints a message about the usage
201 ACE_CString server_name_
;
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
216 virtual int parse (int argc
, ACE_TCHAR
**argv
);
220 /// Prints a message about the 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
242 virtual int parse (int argc
, ACE_TCHAR
**argv
);
246 /// Prints a message about the usage
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.
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
280 virtual int parse (int argc
, ACE_TCHAR
**argv
);
284 /// Prints a message about the usage
287 ACE_CString server_name_
;
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
303 virtual int parse (int argc
, ACE_TCHAR
**argv
);
307 /// Prints a message about the 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
319 TAO_IMR_Op_ShutdownRepo();
320 virtual int parse (int argc
, ACE_TCHAR
**argv
);
330 * @class TAO_IMR_Op_Register
332 * @brief Register Operation
334 * Register is used to update/add information for a server
337 class TAO_IMR_Op_Register
: public TAO_IMR_Op
340 TAO_IMR_Op_Register(bool is_add
);
342 virtual int parse (int argc
, ACE_TCHAR
**argv
);
346 /// Enables pre-registration checks
349 /// Sets one environment variable.
350 void addenv (ACE_TCHAR
*opt
);
352 /// Prints a message about the usage.
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_
;
374 ACE_CString activator_
;
377 #endif /* TAO_IMR_I_H */