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  boost::shared_ptr<coral::ISessionProxy> share();
27  void close();
28  private:
29  boost::shared_ptr<coral::ISessionProxy> m_proxy;
30  };
31 
34 
35  public:
36 
38 
39  virtual ~ConnectionPool();
40 
41  coral::IConnectionService& connectionService();
42  coral::IConnectionServiceConfiguration& configuration();
43 
44  SharedSession connect( const std::string& connectionString, coral::AccessMode accessMode );
45  SharedSession connect( const std::string& connectionString, const std::string& asRole, coral::AccessMode accessMode );
46 
47  private:
48 
49  static std::string lookupString( const std::string& connectionString, coral::AccessMode accessMode );
50  static std::string lookupString( const std::string& connectionString, const std::string& role, coral::AccessMode accessMode );
51 
52  private:
53 
54  coral::ConnectionService m_connectionService;
55 
56  std::map<std::string,boost::weak_ptr<coral::ISessionProxy> > m_sessions;
57  };
58 
59 
60 }
61 
62 #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 > share()
boost::shared_ptr< coral::ISessionProxy > m_proxy
coral::ConnectionService m_connectionService
string connectionString
Definition: autoCondHLT.py:4
SharedSession connect(const std::string &connectionString, coral::AccessMode accessMode)