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");
62 if (parameters[type] ==
string(
"mysql")) {
69 if (parameters[type] ==
string(
"postgresql")) {
76 if (parameters[type] ==
string(
"cql")) {
78 getLeaseMgrPtr().reset(
new CqlLeaseMgr(parameters));
82 if (parameters[type] ==
string(
"memfile")) {
91 "not specify a supported database backend:" << parameters[type]);
95 LeaseMgrFactory::destroy() {
98 if (getLeaseMgrPtr()) {
100 .arg(getLeaseMgrPtr()->getType());
102 getLeaseMgrPtr().reset();
106 LeaseMgrFactory::haveInstance() {
107 return (getLeaseMgrPtr().get());
111 LeaseMgrFactory::instance() {
112 LeaseMgr* lmptr = getLeaseMgrPtr().get();
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.
#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.
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.
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.