26 #ifndef _DEFAULTSERVERCHOOSER_H_ 27 #define _DEFAULTSERVERCHOOSER_H_ 63 return _uris[_current];
71 void add(
const std::string& uri_)
73 _uris.push_back(uri_);
82 for (
typename T::const_iterator i = uriContainer_.begin(); i != uriContainer_.end(); ++i)
91 void remove(
const std::string& )
112 const ConnectionInfo& )
114 if (strcmp(exception_.getClassName(),
"DisconnectedException") != 0)
127 return std::string();
142 if (_uris.size() == 0)
146 _current = (_current + 1) % _uris.size();
155 std::vector<std::string> _uris;
161 #endif //_DEFAULTSERVERCHOOSER_H_ Abstract base class for choosing amongst multiple URIs for both the initial connection and reconnecti...
Definition: ServerChooserImpl.hpp:39
virtual void reportSuccess(const ConnectionInfo &)
Called by the HAClient when successfully connected and logged on to the current instance.
Definition: DefaultServerChooser.hpp:133
static Authenticator & instance()
Static function to return a static instance used when no Authenticator is supplied to a Client...
Definition: ampsplusplus.hpp:1049
A server chooser that rotates through multiple URIs, in order.
Definition: DefaultServerChooser.hpp:47
DefaultServerChooser()
Default constructor which initializes an empty DefaultServerChooser.
Definition: DefaultServerChooser.hpp:52
Core type, function, and class declarations for the AMPS C++ client.
virtual void next()
Advance the server chooser to the next server in the list, starting over with the first server when t...
Definition: DefaultServerChooser.hpp:140
virtual std::string getError()
Called by HAClient when no servers are available to provide a more detailed error message in the exce...
Definition: DefaultServerChooser.hpp:125
~DefaultServerChooser()
Destroy self.
Definition: DefaultServerChooser.hpp:152
virtual std::string getCurrentURI()
Returns the current URI.
Definition: DefaultServerChooser.hpp:59
void addAll(const T &uriContainer_)
Adds the given URIs to self's list of URIs.
Definition: DefaultServerChooser.hpp:80
virtual Authenticator & getCurrentAuthenticator()
Returns the Authenticator instance associated with the current URI.
Definition: DefaultServerChooser.hpp:101
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 lo...
Definition: DefaultServerChooser.hpp:111
void add(const std::string &uri_)
Adds the given URI to self's list of URIs.
Definition: DefaultServerChooser.hpp:71
Provides AMPS::ServerChooser, the abstract base class that defines the interface that an AMPS::HAClie...
Definition: ampsplusplus.hpp:102
The interface for handling authentication with the AMPS server.
Definition: ampsplusplus.hpp:995