CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DbConnection.cc
Go to the documentation of this file.
1 //local includes
5 // ora includes
7 
8 namespace cond {
10  public:
13  m_connectionPool( new ora::ConnectionPool ),
15  }
16 
17  virtual ~ConnectionImpl(){
18  close();
19  }
20 
21  void close(){
22  m_connectionPool.reset();
23  }
24 
26  boost::shared_ptr<ora::ConnectionPool> m_connectionPool;
28  };
29 }
30 
32  m_implementation(new ConnectionImpl()){
33  configure();
34 }
35 
37  m_implementation( conn.m_implementation ){
38 }
39 
41 }
42 
44 {
45  if(this!=&conn) m_implementation = conn.m_implementation;
46  return *this;
47 }
48 
50 {
51  m_implementation->m_configuration.configure( m_implementation->m_connectionPool->configuration() );
52  m_implementation->m_initialized = true;
53 }
54 
56  m_implementation->m_configuration = DbConnectionConfiguration::defaultConfigurations()[ defaultItem ];
57  configure();
58 }
59 
60 void
62  m_implementation->m_configuration.setParameters( connectionPset );
63  configure();
64 }
65 
67  if(!isOpen())
68  throw cond::Exception("DbConnection::createSession: cannot create session. Connection has been closed.");
69  return cond::DbSession( *this );
70 }
71 
72 
74 {
75  m_implementation->close();
76 }
77 
79 {
80  return m_implementation->m_connectionPool.get();
81 }
82 
84 {
85  return m_implementation->m_configuration;
86 }
87 
89 {
90  return m_implementation->m_configuration;
91 }
92 
93 boost::shared_ptr<ora::ConnectionPool> cond::DbConnection::connectionPool() const {
94  return m_implementation->m_connectionPool;
95 }
96 
97 coral::IConnectionService& cond::DbConnection::connectionService() const {
98  if(!isOpen())
99  throw cond::Exception("DbConnection::connectionService: cannot get connection service. Connection has not been open.");
100  return m_implementation->m_connectionPool->connectionService();
101 }
102 
103 const coral::IMonitoringReporter& cond::DbConnection::monitoringReporter() const {
104  if(!isOpen())
105  throw cond::Exception("DbConnection::monitoringReporter: cannot get connection service. Connection has not been open.");
106  return m_implementation->m_connectionPool->connectionService().monitoringReporter();
107 }
108 
109 coral::IWebCacheControl& cond::DbConnection::webCacheControl() const{
110  if(!isOpen())
111  throw cond::Exception("DbConnection::webCacheControl: cannot get connection service. Connection has not been open.");
112  return m_implementation->m_connectionPool->connectionService().webCacheControl();
113 }
114 
virtual ~DbConnection()
Definition: DbConnection.cc:40
DbConnectionConfiguration m_configuration
Definition: DbConnection.cc:27
const coral::IMonitoringReporter & monitoringReporter() const
bool isOpen() const
Definition: DbConnection.cc:78
DbConnectionConfiguration & configuration()
Definition: DbConnection.cc:83
coral::IWebCacheControl & webCacheControl() const
coral::IConnectionService & connectionService() const
Definition: DbConnection.cc:97
boost::shared_ptr< ora::ConnectionPool > m_connectionPool
Definition: DbConnection.cc:26
DbConnection & operator=(const DbConnection &conn)
Definition: DbConnection.cc:43
boost::shared_ptr< ora::ConnectionPool > connectionPool() const
Definition: DbConnection.cc:93
DbSession createSession() const
Definition: DbConnection.cc:66
boost::shared_ptr< ConnectionImpl > m_implementation
Definition: DbConnection.h:69
volatile std::atomic< bool > shutdown_flag false
tuple conn
Definition: results_mgr.py:53
static const std::vector< DbConnectionConfiguration > & defaultConfigurations()