3 //=============================================================================
5 * @file Locator_Options.h
7 * @brief Definition of the Options class for the Implementation Repository.
9 * @author Darrell Brunsch <brunsch@cs.wustl.edu>
11 //=============================================================================
13 #ifndef LOCATOR_OPTIONS_H
14 #define LOCATOR_OPTIONS_H
16 #include "locator_export.h"
18 #include "ace/SString.h"
19 #include "ace/Time_Value.h"
21 #if !defined (ACE_LACKS_PRAGMA_ONCE)
23 #endif /* ACE_LACKS_PRAGMA_ONCE */
30 * @brief Maintains the global options.
32 * This is where the settings for TAO's Implementation Repository are stored.
34 class Locator_Export Options
37 enum SERVICE_COMMAND
{
45 /// Parse the command-line arguments and initialize the options.
46 int init (int argc
, ACE_TCHAR
*argv
[]);
47 /// This version should only be used when run as an nt service.
48 int init_from_registry();
51 bool service () const;
53 /// Debug level for the Implementation Repository.
54 unsigned int debug () const;
56 /// Returns the file where the IOR should be stored.
57 const ACE_TString
& ior_filename () const;
59 /// Will we listen for multicast location requests?
60 bool multicast () const;
62 /// The nt service command to run (install/remove)
63 SERVICE_COMMAND
service_command() const;
65 int save_registry_options();
67 const char* cmdline() const;
69 /// File that contains the activator related information
70 /// that the persistent locator has to save.
71 const ACE_TString
& persist_file_name() const;
73 /// Do we allow modifications to the servers?
74 bool readonly () const;
76 /// Which type of repository is to be used?
84 RepoMode
repository_mode () const;
86 /// Do we wish to clear out the repository
87 bool repository_erase () const;
89 /// Returns the timeout value for program starting.
90 ACE_Time_Value
startup_timeout () const;
92 /// Servers may be started externally to the ImR but register with it
93 /// so that clients may still be forwarded to it. Traditionally, such
94 /// servers are not pinged by the ImR in the spirit that since its own
95 /// means were used to activate the service, the ImR should let the client
96 /// deal with the server no matter the consequences. However, the ImR is
97 /// in a position to give more information to the client or lists of
98 /// active servers, so enabling the ping_external_ option will override
99 /// the assumption of liveness and actively ping, based on the existing
100 /// rules, all registered servers.
101 bool ping_external () const;
103 /// If the server hasn't been verified for a while, then we'll
104 /// ping it. Note : No timers are currently used. We simply ping()
105 /// during indirect invocations, if this interval has elapsed.
106 ACE_Time_Value
ping_interval () const;
108 /// When pinging, this is the timeout
109 ACE_Time_Value
ping_timeout () const;
111 LiveCheck
*pinger () const;
112 void pinger (LiveCheck
*);
114 bool unregister_if_address_reused () const;
116 bool lockout () const;
118 bool throw_shutdown_exceptions () const;
120 /// Indicate what type of ImR Locator this is.
121 enum ImrType
{ BACKUP_IMR
, PRIMARY_IMR
, STANDALONE_IMR
};
122 ImrType
imr_type() const;
124 const ACE_CString
&ft_endpoint () const;
126 ACE_Time_Value
ft_update_delay () const;
129 /// Parses and pulls out arguments for the ImR
130 int parse_args (int &argc
, ACE_TCHAR
*argv
[]);
132 /// Print the usage information.
133 void print_usage () const;
135 /// Run a service command.
136 int run_service_command (const ACE_TString
& cmdline
);
138 int load_registry_options();
140 /// xml, heap, or registry
143 /// Do we clear out the repository on load
149 /// File where the IOR of the server object is stored.
150 ACE_TString ior_output_file_
;
152 /// Will we listen for multicast location requests?
155 /// Are we running as a service?
158 /// Should the ImR ping servers not started using the ImR?
161 /// The amount of time between successive "are you started yet?" pings.
162 ACE_Time_Value ping_interval_
;
164 /// The amount of time to wait for a "are you started yet?" ping reply.
165 ACE_Time_Value ping_timeout_
;
167 /// The amount of time to wait for a server to response after starting it.
168 ACE_Time_Value startup_timeout_
;
170 /// Can the server_repository be modified?
173 /// SC_NONE, SC_INSTALL, SC_REMOVE, ...
174 SERVICE_COMMAND service_command_
;
176 /// Our extra command line arguments
177 ACE_CString cmdline_
;
179 /// The persistent XML file name.
180 ACE_TString persist_file_name_
;
182 /// Should check the server address and remove previous server if
183 /// the address is reused.
184 bool unregister_if_address_reused_
;
186 /// If enabled, use a global start count and lock access to the
187 /// server without user intervention. Otherwise start count is reset
188 /// for every start request
191 /// The type of ImR Locator this is.
194 /// Have the "shutdown_server" command forward any exceptions (such
195 /// as transient) back to the caller. Default behavior is to not do
196 /// that since doing so may break existing installations. There is
197 /// no command line option for this yet, but I want to preserve the
198 /// framework for future use.
199 bool throw_shutdown_exceptions_
;
203 ACE_CString ft_endpoint_
;
205 ACE_Time_Value ft_update_delay_
;