Abstract base class for choosing amongst multiple URIs for both the initial connection and reconnection.
More...
#include <ServerChooser.hpp>
Abstract base class for choosing amongst multiple URIs for both the initial connection and reconnection.
Used by HAClient to pick an initial server and also to pick a server if there is a failure.
ServerChooser& AMPS::ServerChooser::add |
( |
const std::string & |
uri_ | ) |
|
|
inline |
Add a server to a server chooser if its policy permits.
- Parameters
-
uri_ | The URI of the server to add |
Returns the Authenticator instance associated with the current URI.
- Returns
- An Authenticator or NULL if none is required for logon.
std::string AMPS::ServerChooser::getCurrentURI |
( |
| ) |
|
|
inline |
Returns the current URI.
- Returns
- The current URI or empty string if no server is available.
std::string AMPS::ServerChooser::getError |
( |
| ) |
|
|
inline |
Provides additional detail to be included in an exception thrown when the AMPS instance(s) are not available.
Called by the HAClient when creating an exception.
- Returns
- A string with information about the connection that failed and the reason for the failure. When no further information is available, returns an empty string.
void AMPS::ServerChooser::remove |
( |
const std::string & |
uri_ | ) |
|
|
inline |
Remove a server from a server chooser if its policy permits.
- Parameters
-
uri_ | The URI of the server to remove |
void AMPS::ServerChooser::reportFailure |
( |
const AMPSException & |
exception_, |
|
|
const ConnectionInfo & |
info_ |
|
) |
| |
|
inline |
Called by HAClient when an error occurs connecting to the current URI, and/or when an error occurs logging on.
Implementors will likely advance the current URI to the next one in a list, or choose to stay with the current one, based on the exception type.
- Parameters
-
exception_ | The exception associated with the failure. |
info_ | a map of information about the connection at time of failure |
void AMPS::ServerChooser::reportSuccess |
( |
const ConnectionInfo & |
info_ | ) |
|
|
inline |
Called by the HAClient when successfully connected and logged on to the current instance.
- Parameters
-
info_ | information about the successful connection |
The documentation for this class was generated from the following file: