22 #include <boost/algorithm/string.hpp>
23 #include <boost/foreach.hpp>
38 boost::scoped_ptr<LeaseMgr>&
39 LeaseMgrFactory::getLeaseMgrPtr() {
40 static boost::scoped_ptr<LeaseMgr> leaseMgrPtr;
45 LeaseMgrFactory::create(
const std::string& dbaccess) {
46 const std::string type =
"type";
53 if (parameters.find(type) == parameters.end()) {
56 "contain the 'type' keyword");
61 if (parameters[type] ==
string(
"mysql")) {
69 "support for database type: mysql");
73 if (parameters[type] ==
string(
"postgresql")) {
81 "support for database type: postgresql");
84 if (parameters[type] ==
string(
"cql")) {
87 getLeaseMgrPtr().reset(
new CqlLeaseMgr(parameters));
92 "support for database type: cql");
95 if (parameters[type] ==
string(
"memfile")) {
104 "not specify a supported database backend: " << parameters[type]);
108 LeaseMgrFactory::destroy() {
111 if (getLeaseMgrPtr()) {
113 .arg(getLeaseMgrPtr()->getType());
115 getLeaseMgrPtr().reset();
119 LeaseMgrFactory::haveInstance() {
120 return (getLeaseMgrPtr().
get());
124 LeaseMgrFactory::instance() {
125 LeaseMgr* lmptr = getLeaseMgrPtr().get();
const isc::log::MessageID DHCPSRV_MYSQL_DB
const isc::log::MessageID DHCPSRV_PGSQL_DB
Concrete implementation of a lease database backend using flat file.
#define LOG_INFO(LOGGER, MESSAGE)
Macro to conveniently test info output and log it.
A generic exception that is thrown if a parameter given to a method or function is considered invalid...
PostgreSQL Lease Manager.
const isc::log::MessageID DHCPSRV_CQL_DB
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
static ParameterMap parse(const std::string &dbaccess)
Parse database access string.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
const isc::log::MessageID DHCPSRV_MEMFILE_DB
const isc::log::MessageID DHCPSRV_CLOSE_DB
Defines the logger used by the top-level component of kea-dhcp-ddns.
No lease manager exception.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
const int DHCPSRV_DBG_TRACE
DHCP server library logging levels.
const isc::log::MessageID DHCPSRV_UNKNOWN_DB
isc::log::Logger dhcpsrv_logger("dhcpsrv")
DHCP server library Logger.
std::map< std::string, std::string > ParameterMap
Database configuration parameter map.
static std::string redactedAccessString(const ParameterMap ¶meters)
Redact database access string.
const isc::log::MessageID DHCPSRV_NOTYPE_DB