tao_imr_i.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    tao_imr_i.h
00006  *
00007  *  tao_imr_i.h,v 1.19 2005/05/23 17:58:34 michel_j Exp
00008  *
00009  *  This class implements the Implementation Repository helper application.
00010  *
00011  *
00012  *  @author Darrell Brunsch <brunsch@cs.wustl.edu>
00013  */
00014 //=============================================================================
00015 #ifndef TAO_IMR_I_H
00016 #define TAO_IMR_I_H
00017 
00018 #include "tao/ImR_Client/ImplRepoC.h"
00019 #include "tao/corba.h"
00020 #include "ace/SString.h"
00021 #include "ace/Auto_Ptr.h"
00022 
00023 // Forward Declaration
00024 class TAO_IMR_Op;
00025 
00026 /**
00027  * @class TAO_IMR_i
00028  *
00029  * @brief TAO's command line helper application
00030  *
00031  * This class talks to the IMR and registers/lists/etc.
00032  */
00033 class TAO_IMR_i
00034 {
00035 public:
00036 
00037   // = Constructor and destructor.
00038   TAO_IMR_i (void);
00039   ~TAO_IMR_i (void);
00040 
00041   /// Execute client code.
00042   int run (void);
00043 
00044   /// Initialize the client communication endpoint with server.
00045   int init (int argc, char **argv);
00046 
00047 private:
00048   /// Print out information about all operations.
00049   void print_usage (void);
00050 
00051   /// Parses the arguments passed on the command line.
00052   int parse_args (void);
00053 
00054   /// # of arguments on the command line.
00055   int argc_;
00056 
00057   /// Arguments from command line.
00058   ACE_TCHAR **argv_;
00059 
00060   /// Remember our orb.
00061   CORBA::ORB_var orb_;
00062 
00063   /// Reference to our Locator interface of
00064   /// implementation repository.
00065   ImplementationRepository::Administration_var imr_;
00066 
00067   /// What we need to do.
00068   ACE_Auto_Ptr<TAO_IMR_Op> op_;
00069 };
00070 
00071 
00072 /**
00073  * @class TAO_IMR_Op
00074  *
00075  * @brief IMR Operation Base Class
00076  *
00077  * Provides a base class with virtual methods for each operation strategy.
00078  */
00079 class TAO_IMR_Op
00080 {
00081 public:
00082   enum RETURN_CODES {
00083     NORMAL = 0,
00084     UNKNOWN,
00085     NO_PERMISSION,
00086     ALREADY_REGISTERED,
00087     CANNOT_ACTIVATE,
00088     NOT_FOUND
00089   };
00090 
00091   /// Factory.
00092   static TAO_IMR_Op *make_op (const ACE_TCHAR *op_name);
00093 
00094   /// Destructor.
00095   virtual ~TAO_IMR_Op (void);
00096 
00097   /// Parse arguments.
00098   virtual int parse (int argc, ACE_TCHAR **argv) = 0;
00099 
00100   /// Do the work.
00101   virtual int run (void) = 0;
00102 
00103   /// Sets the implrepo locator pointer
00104   void set_imr (ImplementationRepository::Administration_ptr imr);
00105 
00106 protected:
00107   /// Reference to our implementation repository.
00108   ImplementationRepository::Administration_ptr imr_;
00109 
00110   // = Helper methods
00111 
00112   /// Prints out the information contained in a ServerInformation structure.
00113   void display_server_information (const ImplementationRepository::ServerInformation &info);
00114 };
00115 
00116 
00117 /**
00118  * @class TAO_IMR_Op_Activate
00119  *
00120  * @brief Activation Operation
00121  *
00122  * Activation is used to start servers via the Implementation Repository
00123  */
00124 class TAO_IMR_Op_Activate : public TAO_IMR_Op
00125 {
00126 public:
00127   virtual int parse (int argc, ACE_TCHAR **argv);
00128   virtual int run (void);
00129 
00130 protected:
00131   /// Prints a message about the usage
00132   void print_usage (void);
00133 
00134   /// POA server name.
00135   ACE_CString server_name_;
00136 };
00137 
00138 /**
00139  * @class TAO_IMR_Op_Autostart
00140  *
00141  * @brief Autostart Operation
00142  *
00143  * Autostart is used to activate all servers with the AUTO_START activation
00144  * mode.
00145  */
00146 class TAO_IMR_Op_Autostart : public TAO_IMR_Op
00147 {
00148 public:
00149   virtual int parse (int argc, ACE_TCHAR **argv);
00150   virtual int run (void);
00151 
00152 protected:
00153   /// Prints a message about the usage
00154   void print_usage (void);
00155 };
00156 
00157 
00158 /**
00159  * @class TAO_IMR_Op_IOR
00160  *
00161  * @brief IOR Operation
00162  *
00163  * IOR is used to create a simple IOR for a server that uses the
00164  * IMR and the Interoperable Naming Service.
00165  */
00166 class TAO_IMR_Op_IOR : public TAO_IMR_Op
00167 {
00168 public:
00169   virtual int parse (int argc, ACE_TCHAR **argv);
00170   virtual int run (void);
00171 
00172 protected:
00173   /// Prints a message about the usage
00174   void print_usage (void);
00175 
00176   /// POA server name.
00177   ACE_CString server_name_;
00178 
00179   /// Filename to output to.
00180   ACE_CString filename_;
00181 };
00182 
00183 
00184 /**
00185  * @class TAO_IMR_Op_List
00186  *
00187  * @brief List Operation
00188  *
00189  * List is used to either list all the servers registered in the IMR or just
00190  * look at one of them.
00191  */
00192 class TAO_IMR_Op_List : public TAO_IMR_Op
00193 {
00194 public:
00195   TAO_IMR_Op_List (void);
00196 
00197   virtual int parse (int argc, ACE_TCHAR **argv);
00198   virtual int run (void);
00199 
00200 protected:
00201   /// Prints a message about the usage
00202   void print_usage (void);
00203 
00204   /// POA server name.
00205   ACE_CString server_name_;
00206 
00207   /// If true, more server information is displayed.
00208   int verbose_server_information_;
00209 
00210   /// Prints out the information contained in a ServerInformation structure.
00211   /// Specialized to only print server information
00212   void display_server_information (const ImplementationRepository::ServerInformation &info);
00213 };
00214 
00215 
00216 /**
00217  * @class TAO_IMR_Op_Remove
00218  *
00219  * @brief Remove Operation
00220  *
00221  * Remove is used to unregister a server in the IMR.
00222  */
00223 class TAO_IMR_Op_Remove : public TAO_IMR_Op
00224 {
00225 public:
00226   virtual int parse (int argc, ACE_TCHAR **argv);
00227   virtual int run (void);
00228 
00229 protected:
00230   /// Prints a message about the usage
00231   void print_usage (void);
00232 
00233   ACE_CString server_name_;
00234 };
00235 
00236 
00237 /**
00238  * @class TAO_IMR_Op_Shutdown
00239  *
00240  * @brief Shutdown Operation
00241  *
00242  * Shutdown is used to shutdown a server through the IMR.
00243  */
00244 class TAO_IMR_Op_Shutdown : public TAO_IMR_Op
00245 {
00246 public:
00247   virtual int parse (int argc, ACE_TCHAR **argv);
00248   virtual int run (void);
00249 
00250 protected:
00251   /// Prints a message about the usage
00252   void print_usage (void);
00253 
00254   ACE_CString server_name_;
00255 };
00256 
00257 /**
00258  * Shutdown the ImR and optionally any registered activators.
00259  */
00260 class TAO_IMR_Op_ShutdownRepo : public TAO_IMR_Op
00261 {
00262 public:
00263   TAO_IMR_Op_ShutdownRepo();
00264   virtual int parse (int argc, ACE_TCHAR **argv);
00265   virtual int run (void);
00266 
00267 protected:
00268   void print_usage (void);
00269 
00270   bool activators_;
00271 };
00272 
00273 /**
00274  * @class TAO_IMR_Op_Register
00275  *
00276  * @brief Register Operation
00277  *
00278  * Register is used to update/add information for a server
00279  * with the IMR.
00280  */
00281 class TAO_IMR_Op_Register : public TAO_IMR_Op
00282 {
00283 public:
00284   TAO_IMR_Op_Register(bool is_add);
00285 
00286   virtual int parse (int argc, ACE_TCHAR **argv);
00287   virtual int run (void);
00288 
00289 protected:
00290 
00291   /// Enables pre-registration checks
00292   bool is_add_;
00293 
00294   /// Sets one environment variable.
00295   void addenv (ACE_TCHAR *opt);
00296 
00297   /// Prints a message about the usage.
00298   void print_usage (void);
00299 
00300   /// POA server name.
00301   ACE_CString server_name_;
00302 
00303   bool set_command_line_;
00304   ACE_CString command_line_;
00305 
00306   bool set_environment_vars_;
00307   ImplementationRepository::EnvironmentList environment_vars_;
00308 
00309   bool set_working_dir_;
00310   ACE_CString working_dir_;
00311 
00312   bool set_activation_;
00313   ImplementationRepository::ActivationMode activation_;
00314 
00315   bool set_retry_count_;
00316   int retry_count_;
00317 
00318   bool set_activator_;
00319   ACE_CString activator_;
00320 };
00321 
00322 #endif /* TAO_IMR_I_H */

Generated on Thu Nov 9 13:36:20 2006 for TAO_Implementation_Repository by doxygen 1.3.6