19#include <boost/algorithm/string.hpp>
20#include <boost/foreach.hpp>
35boost::scoped_ptr<LeaseMgr>&
36LeaseMgrFactory::getLeaseMgrPtr() {
37 static boost::scoped_ptr<LeaseMgr> leaseMgrPtr;
43 const std::string type =
"type";
50 if (parameters.find(type) == parameters.end()) {
53 "contain the 'type' keyword");
58 if (parameters[type] ==
string(
"mysql")) {
66 "support for database type: mysql");
70 if (parameters[type] ==
string(
"postgresql")) {
78 "support for database type: postgresql");
81 if (parameters[type] ==
string(
"memfile")) {
90 "not specify a supported database backend: " << parameters[type]);
97 if (getLeaseMgrPtr()) {
99 .arg(getLeaseMgrPtr()->getType());
101 getLeaseMgrPtr().reset();
106 return (getLeaseMgrPtr().get());
111 LeaseMgr* lmptr = getLeaseMgrPtr().get();
A generic exception that is thrown if a parameter given to a method or function is considered invalid...
static std::string redactedAccessString(const ParameterMap ¶meters)
Redact database access string.
static ParameterMap parse(const std::string &dbaccess)
Parse database access string.
std::map< std::string, std::string > ParameterMap
Database configuration parameter map.
static void create(const std::string &dbaccess)
Create an instance of a lease manager.
static void destroy()
Destroy lease manager.
static LeaseMgr & instance()
Return current lease manager.
static bool haveInstance()
Indicates if the lease manager has been instantiated.
Concrete implementation of a lease database backend using flat file.
No lease manager exception.
PostgreSQL Lease Manager.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
#define LOG_ERROR(LOGGER, MESSAGE)
Macro to conveniently test error output and log it.
#define LOG_INFO(LOGGER, MESSAGE)
Macro to conveniently test info output and log it.
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
isc::log::Logger dhcpsrv_logger("dhcpsrv")
DHCP server library Logger.
const isc::log::MessageID DHCPSRV_MEMFILE_DB
const isc::log::MessageID DHCPSRV_PGSQL_DB
const isc::log::MessageID DHCPSRV_CLOSE_DB
const isc::log::MessageID DHCPSRV_UNKNOWN_DB
const isc::log::MessageID DHCPSRV_NOTYPE_DB
const int DHCPSRV_DBG_TRACE
DHCP server library logging levels.
const isc::log::MessageID DHCPSRV_MYSQL_DB
Defines the logger used by the top-level component of kea-lfc.