Fawkes API  Fawkes Development Version
mongodb.h
1 
2 /***************************************************************************
3  * mongodb.h - MongoDB aspect for Fawkes
4  *
5  * Created: Mon Dec 06 00:24:43 2010
6  * Copyright 2006-2017 Tim Niemueller [www.niemueller.de]
7  ****************************************************************************/
8 
9 /* This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version. A runtime exception applies to
13  * this software (see LICENSE.GPL_WRE file mentioned below for details).
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
21  */
22 
23 #ifndef _PLUGINS_MONGODB_ASPECT_MONGODB_H_
24 #define _PLUGINS_MONGODB_ASPECT_MONGODB_H_
25 
26 #include <aspect/aspect.h>
27 
28 #include <string>
29 
30 namespace mongo {
31 class DBClientBase;
32 }
33 
34 namespace fawkes {
35 class MongoDBConnCreator;
36 
37 class MongoDBAspectIniFin;
38 
39 class MongoDBAspect : public virtual Aspect
40 {
41  friend MongoDBAspectIniFin;
42 
43 public:
44  MongoDBAspect(const char *config_prefix);
45  MongoDBAspect();
46  virtual ~MongoDBAspect();
47 
48  const std::string &
50  {
51  return mongodb_config_name_;
52  }
53 
54 protected:
55  mongo::DBClientBase *mongodb_client;
57 
58 private:
59  void init_MongoDBAspect(mongo::DBClientBase *mongodb_client, MongoDBConnCreator *mongodb_connmgr);
60 
61 private:
62  std::string mongodb_config_name_;
63 };
64 
65 } // end namespace fawkes
66 
67 #endif
Fawkes aspect base class.
Definition: aspect.h:31
Fawkes library namespace.
mongo::DBClientBase * mongodb_client
MongoDB client to use to interact with the database.
Definition: mongodb.h:55
MongoDBConnCreator * mongodb_connmgr
Connection manager to retrieve more client connections from if necessary.
Definition: mongodb.h:56
MongoDBAspect()
Constructor.
Definition: mongodb.cpp:71
Thread aspect to access MongoDB.
Definition: mongodb.h:39
virtual ~MongoDBAspect()
Virtual empty destructor.
Definition: mongodb.cpp:77
MongoDBAspect initializer/finalizer.
Interface for a MongoDB connection creator.
const std::string & mongodb_config_name() const
Get MongoDB configuration name.
Definition: mongodb.h:49