19 #include <boost/algorithm/string.hpp>
20 #include <boost/foreach.hpp>
35 boost::scoped_ptr<TrackingLeaseMgr>&
36 LeaseMgrFactory::getLeaseMgrPtr() {
37 static boost::scoped_ptr<TrackingLeaseMgr> lease_mgr_ptr;
38 return (lease_mgr_ptr);
42 LeaseMgrFactory::create(
const std::string& dbaccess) {
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]);
94 LeaseMgrFactory::destroy() {
97 if (getLeaseMgrPtr()) {
99 .arg(getLeaseMgrPtr()->getType());
101 getLeaseMgrPtr().reset();
105 LeaseMgrFactory::recreate(
const std::string& dbaccess,
bool preserve_callbacks) {
108 if (preserve_callbacks && haveInstance()) {
109 callbacks = instance().callbacks_;
119 instance().callbacks_ = callbacks;
124 LeaseMgrFactory::haveInstance() {
125 return (getLeaseMgrPtr().get());
129 LeaseMgrFactory::instance() {
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.
Concrete implementation of a lease database backend using flat file.
No lease manager exception.
PostgreSQL Lease Manager.
Introduces callbacks into the LeaseMgr.
boost::shared_ptr< CallbackContainer > CallbackContainerPtr
Pointer to the callback container.
#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.