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