AMPS C/C++ Client Class Reference
AMPS C/C++ Client Version 5.3.4.4
AMPS::ServerChooser Class Reference

Abstract base class for choosing amongst multiple URIs for both the initial connection and reconnection. More...

#include <ServerChooser.hpp>

Public Member Functions

std::string getCurrentURI ()
 Returns the current URI. More...
 
AuthenticatorgetCurrentAuthenticator ()
 Returns the Authenticator instance associated with the current URI. More...
 
void reportFailure (const AMPSException &exception_, const ConnectionInfo &info_)
 Called by HAClient when an error occurs connecting to the current URI, and/or when an error occurs logging on. More...
 
std::string getError ()
 Provides additional detail to be included in an exception thrown when the AMPS instance(s) are not available. More...
 
void reportSuccess (const ConnectionInfo &info_)
 Called by the HAClient when successfully connected and logged on to the current instance. More...
 
ServerChooseradd (const std::string &uri_)
 Add a server to a server chooser if its policy permits. More...
 
void remove (const std::string &uri_)
 Remove a server from a server chooser if its policy permits. More...
 

Detailed Description

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.

Member Function Documentation

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
Authenticator& AMPS::ServerChooser::getCurrentAuthenticator ( )
inline

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: