CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ConnectionPool.h
Go to the documentation of this file.
1 #ifndef INCLUDE_ORA_CONNECTIONPOOL_H
2 #define INCLUDE_ORA_CONNECTIONPOOL_H
3 
4 //
5 #include <map>
6 // externals
7 #include <boost/shared_ptr.hpp>
8 #include <boost/weak_ptr.hpp>
9 #include "RelationalAccess/ConnectionService.h"
10 
11 namespace coral {
12  class ISessionProxy;
13 }
14 
15 namespace ora {
16 
17  class SharedSession {
18  public:
19  SharedSession();
20  SharedSession(boost::shared_ptr<coral::ISessionProxy>& coralSession);
21  SharedSession( const SharedSession& rhs );
23  SharedSession& operator=( const SharedSession& rhs );
24  bool isValid();
25  coral::ISessionProxy& get();
26  void close();
27  private:
28  boost::shared_ptr<coral::ISessionProxy> m_proxy;
29  };
30 
33 
34  public:
35 
37 
38  virtual ~ConnectionPool();
39 
40  coral::IConnectionService& connectionService();
41  coral::IConnectionServiceConfiguration& configuration();
42 
43  SharedSession connect( const std::string& connectionString, coral::AccessMode accessMode );
44  SharedSession connect( const std::string& connectionString, const std::string& asRole, coral::AccessMode accessMode );
45 
46  private:
47 
48  static std::string lookupString( const std::string& connectionString, coral::AccessMode accessMode );
49  static std::string lookupString( const std::string& connectionString, const std::string& role, coral::AccessMode accessMode );
50 
51  private:
52 
53  coral::ConnectionService m_connectionService;
54 
55  std::map<std::string,boost::weak_ptr<coral::ISessionProxy> > m_sessions;
56  };
57 
58 
59 }
60 
61 #endif
To be moved in DBCommon, has to serve also the pure coral use case.
static std::string lookupString(const std::string &connectionString, coral::AccessMode accessMode)
coral::IConnectionServiceConfiguration & configuration()
std::map< std::string, boost::weak_ptr< coral::ISessionProxy > > m_sessions
coral::IConnectionService & connectionService()
SharedSession & operator=(const SharedSession &rhs)
boost::shared_ptr< coral::ISessionProxy > m_proxy
coral::ConnectionService m_connectionService
SharedSession connect(const std::string &connectionString, coral::AccessMode accessMode)