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();