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

A server chooser that rotates through multiple URIs, in order. More...

#include <DefaultServerChooser.hpp>

+ Inheritance diagram for AMPS::DefaultServerChooser:

Public Member Functions

 DefaultServerChooser ()
 Default constructor which initializes an empty DefaultServerChooser.
 
virtual std::string getCurrentURI ()
 Returns the current URI. More...
 
void add (const std::string &uri_)
 Adds the given URI to self's list of URIs. More...
 
template<class T >
void addAll (const T &uriContainer_)
 Adds the given URIs to self's list of URIs. More...
 
void remove (const std::string &)
 Removes the given URI from self's list of URIs if found. More...
 
virtual AuthenticatorgetCurrentAuthenticator ()
 Returns the Authenticator instance associated with the current URI. More...
 
virtual void reportFailure (const AMPSException &exception_, const ConnectionInfo &)
 Called by HAClient when an error occurs connecting to the current URI, and/or when an error occurs logging on. More...
 
virtual std::string getError ()
 Called by HAClient when no servers are available to provide a more detailed error message in the exception message. More...
 
virtual void reportSuccess (const ConnectionInfo &)
 Called by the HAClient when successfully connected and logged on to the current instance. More...
 
virtual void next ()
 Advance the server chooser to the next server in the list, starting over with the first server when the chooser reaches the end of the list. More...
 
 ~DefaultServerChooser ()
 Destroy self.
 

Detailed Description

A server chooser that rotates through multiple URIs, in order.

Used by HAClient to pick an initial server and also to pick a server if there is a failure.

Member Function Documentation

void AMPS::DefaultServerChooser::add ( const std::string &  uri_)
inlinevirtual

Adds the given URI to self's list of URIs.

Parameters
uri_The URI to add to self.

Implements AMPS::ServerChooserImpl.

template<class T >
void AMPS::DefaultServerChooser::addAll ( const T &  uriContainer_)
inline

Adds the given URIs to self's list of URIs.

Parameters
uriContainer_The URIs to add to self.
virtual Authenticator& AMPS::DefaultServerChooser::getCurrentAuthenticator ( )
inlinevirtual

Returns the Authenticator instance associated with the current URI.

Returns
The DefaultAuthenticator instance

Implements AMPS::ServerChooserImpl.

virtual std::string AMPS::DefaultServerChooser::getCurrentURI ( )
inlinevirtual

Returns the current URI.

Returns
The current URI or empty string if no server is available.

Implements AMPS::ServerChooserImpl.

virtual std::string AMPS::DefaultServerChooser::getError ( )
inlinevirtual

Called by HAClient when no servers are available to provide a more detailed error message in the exception message.

This implementation returns an empty string.

Returns
The detailed error message.

Reimplemented from AMPS::ServerChooserImpl.

virtual void AMPS::DefaultServerChooser::next ( )
inlinevirtual

Advance the server chooser to the next server in the list, starting over with the first server when the chooser reaches the end of the list.

void AMPS::DefaultServerChooser::remove ( const std::string &  )
inlinevirtual

Removes the given URI from self's list of URIs if found.

For DefaultServerChooser, this method has no effect.

Implements AMPS::ServerChooserImpl.

virtual void AMPS::DefaultServerChooser::reportFailure ( const AMPSException &  exception_,
const ConnectionInfo &   
)
inlinevirtual

Called by HAClient when an error occurs connecting to the current URI, and/or when an error occurs logging on.

Advance the current URI to the next one in a list

Parameters
exception_The exception associated with the failure.

Implements AMPS::ServerChooserImpl.

virtual void AMPS::DefaultServerChooser::reportSuccess ( const ConnectionInfo &  )
inlinevirtual

Called by the HAClient when successfully connected and logged on to the current instance.

This implementation does nothing.

Implements AMPS::ServerChooserImpl.


The documentation for this class was generated from the following file: