25 : backend_type_(backend_type),
32 host_(host), port_(port) {
40 isc_throw(BadValue,
"database access information must be a map");
56 host_ = h->stringValue();
62 (p->intValue() < 0) ||
63 (p->intValue() > std::numeric_limits<uint16_t>::max())) {
65 "to " << std::numeric_limits<uint16_t>::max());
67 port_ =
static_cast<uint16_t
>(p->intValue());
98 s <<
"host=" << host_ <<
",";
101 s <<
"port=" << port_ <<
",";
106 std::string text = s.str();
107 if ((!text.empty() && (text.back() ==
','))) {
121 if (!host_.empty()) {
132 if (type ==
"mysql") {
135 }
else if (type ==
"postgresql") {
149 return (
"postgresql");
154 return (std::string());
158BackendSelector::validate()
const {
159 if ((port_ != 0) && (host_.empty())) {
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
static ElementPtr create(const Position &pos=ZERO_POSITION())
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
static std::string backendTypeToString(const Type &type)
Converts backend type to string.
std::string toText() const
Returns selections as text.
static Type stringToBackendType(const std::string &type)
Converts string to backend type.
Type
Supported database types.
bool amUnspecified() const
Checks if selector is "unspecified".
virtual data::ElementPtr toElement() const
Unparse a backend selector object.
BackendSelector()
Default constructor.
static const BackendSelector & UNSPEC()
Returns instance of the "unspecified" backend selector.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Element > ElementPtr
Defines the logger used by the top-level component of kea-lfc.