Locator_Options.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file   Locator_Options.h
00006  *
00007  *  Locator_Options.h,v 1.8 2006/01/04 16:10:11 giovannd Exp
00008  *
00009  *  @brief  Definition of the Options class for the Implementation Repository.
00010  *
00011  *  @author Darrell Brunsch <brunsch@cs.wustl.edu>
00012  */
00013 //=============================================================================
00014 
00015 #ifndef LOCATOR_OPTIONS_H
00016 #define LOCATOR_OPTIONS_H
00017 
00018 #include "locator_export.h"
00019 
00020 #include "ace/SString.h"
00021 #include "ace/Time_Value.h"
00022 
00023 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00024 # pragma once
00025 #endif /* ACE_LACKS_PRAGMA_ONCE */
00026 
00027 /**
00028  * @class Options
00029  *
00030  * @brief Maintains the global options.
00031  *
00032  * This is where the settings for TAO's Implementation Repository are stored.
00033  */
00034 class Locator_Export Options
00035 {
00036 public:
00037 
00038   enum SERVICE_COMMAND {
00039     SC_NONE,
00040     SC_INSTALL,
00041     SC_REMOVE
00042   };
00043 
00044   enum RepoMode {
00045     REPO_NONE,
00046     REPO_XML_FILE,
00047     REPO_HEAP_FILE,
00048     REPO_REGISTRY
00049   };
00050 
00051   Options ();
00052 
00053   /// Parse the command-line arguments and initialize the options.
00054   int init (int argc, char *argv[]);
00055   /// This version should only be used when run as an nt service.
00056   int init_from_registry();
00057 
00058   /// Service Mode
00059   bool service (void) const;
00060 
00061   /// Debug level for the Implementation Repository.
00062   unsigned int debug (void) const;
00063 
00064   /// Returns the file where the IOR should be stored.
00065   const ACE_TString& ior_filename (void) const;
00066 
00067   /// Will we listen for multicast location requests?
00068   bool multicast (void) const;
00069 
00070   /// The nt service command to run (install/remove)
00071   SERVICE_COMMAND service_command(void) const;
00072 
00073   int save_registry_options();
00074 
00075   const char* cmdline(void) const;
00076 
00077   /// File that contains the activator related information
00078   /// that the persistent locator has to save.
00079   const ACE_TString& persist_file_name(void) const;
00080 
00081   /// Do we allow modifications to the servers?
00082   bool readonly (void) const;
00083 
00084   RepoMode repository_mode (void) const;
00085 
00086   /// Do we wish to clear out the repository
00087   bool repository_erase (void) const;
00088 
00089   /// Returns the timeout value for program starting.
00090   ACE_Time_Value startup_timeout (void) const;
00091 
00092   /// If the server hasn't been verified for a while, then we'll
00093   /// ping it. Note : No timers are currently used. We simply ping()
00094   /// during indirect invocations, if this interval has elapsed.
00095   ACE_Time_Value ping_interval (void) const;
00096 
00097 private:
00098   /// Parses and pulls out arguments for the ImR
00099   int parse_args (int &argc, char *argv[]);
00100 
00101   /// Print the usage information.
00102   void print_usage (void) const;
00103 
00104   /// Run a service command.
00105   int run_service_command (const ACE_TString& cmdline);
00106 
00107   int load_registry_options();
00108 private:
00109 
00110   // xml, heap, or registry
00111   RepoMode repo_mode_;
00112 
00113   // do we clear out the repository on load
00114   bool erase_repo_;
00115 
00116   /// Debug level.
00117   unsigned int debug_;
00118 
00119   /// File where the IOR of the server object is stored.
00120   ACE_TString ior_output_file_;
00121 
00122   /// Will we listen for multicast location requests?
00123   bool multicast_;
00124 
00125   /// Are we running as a service?
00126   bool service_;
00127 
00128   /// The amount of time between successive "are you started yet?" pings.
00129   ACE_Time_Value ping_interval_;
00130 
00131   /// The amount of time to wait for a server to response after starting it.
00132   ACE_Time_Value startup_timeout_;
00133 
00134   /// Can the server_repository be modified?
00135   bool readonly_;
00136 
00137   /// SC_NONE, SC_INSTALL, SC_REMOVE, ...
00138   SERVICE_COMMAND service_command_;
00139 
00140   /// Our extra command line arguments
00141   ACE_CString cmdline_;
00142 
00143   /// The persistent XML file name.
00144   ACE_TString persist_file_name_;
00145 };
00146 
00147 #endif

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