17 BackendSelector::BackendSelector()
23 : backend_type_(backend_type),
30 host_(host), port_(port) {
37 if (access_map->getType() != Element::map) {
43 if (t->getType() != Element::string) {
51 if (h->getType() != Element::string) {
54 host_ = h->stringValue();
59 if ((p->getType() != Element::integer) ||
60 (p->intValue() < 0) ||
61 (p->intValue() > std::numeric_limits<uint16_t>::max())) {
63 "to " << std::numeric_limits<uint16_t>::max());
65 port_ = static_cast<uint16_t>(p->intValue());
96 s <<
"host=" << host_ <<
",";
99 s <<
"port=" << port_ <<
",";
104 std::string text = s.str();
105 if ((!text.empty() && (text.back() ==
','))) {
114 if (type ==
"mysql") {
117 }
else if (type ==
"pgsql") {
120 }
else if (type ==
"cql") {
141 return (std::string());
145 BackendSelector::validate()
const {
146 if ((port_ != 0) && (host_.empty())) {
static const BackendSelector & UNSPEC()
Returns instance of the "unspecified" backend selector.
std::string toText() const
Returns selections as text.
static Type stringToBackendType(const std::string &type)
Converts string to backend type.
static std::string backendTypeToString(const Type &type)
Converts backend type to string.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
boost::shared_ptr< const Element > ConstElementPtr
BackendSelector()
Default constructor.
Defines the logger used by the top-level component of kea-dhcp-ddns.
Type
Supported database types.
bool amUnspecified() const
Checks if selector is "unspecified".