CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SessionImpl.h
Go to the documentation of this file.
1 #ifndef CondCore_CondDB_SessionImpl_h
2 #define CondCore_CondDB_SessionImpl_h
3 
5 #include "IOVSchema.h"
6 #include "GTSchema.h"
7 //
9 //
10 #include "RelationalAccess/ConnectionService.h"
11 #include "RelationalAccess/ISessionProxy.h"
12 //
13 #include <memory>
14 // temporarely
15 #include <boost/shared_ptr.hpp>
16 
17 namespace coral {
18  class ISessionProxy;
19  class ISchema;
20 }
21 
22 namespace cond {
23 
24  namespace persistency {
25 
26  class ITransaction {
27  public:
28  virtual ~ITransaction(){}
29  virtual void commit() = 0;
30  virtual void rollback() = 0;
31  virtual bool isActive() = 0;
32  bool iovDbExists = false;
33  bool iovDbOpen = false;
34  bool gtDbExists = false;
35  bool gtDbOpen = false;
36  bool isOra = false;
37  size_t clients = 0;
38  };
39 
40  BackendType checkBackendType( boost::shared_ptr<coral::ISessionProxy>& session,
42 
43  class SessionImpl {
44  public:
46  public:
47  SessionImpl();
48  SessionImpl( boost::shared_ptr<coral::ISessionProxy>& session,
50  BackendType backType );
51 
52  ~SessionImpl();
53 
54  void close();
55  bool isActive() const;
56  void startTransaction( bool readOnly=true );
57  void commitTransaction();
58  void rollbackTransaction();
59  bool isTransactionActive( bool deep=true ) const;
60 
61  void openIovDb( FailureOnOpeningPolicy policy = THROW );
62  void openGTDb( FailureOnOpeningPolicy policy = THROW );
63  void openDb();
66  // only for the bridging...
67  bool isOra();
68 
69  public:
70  // allows for session shared among more services. To be changed to unique_ptr when we stop needing this feature.
71  boost::shared_ptr<coral::ISessionProxy> coralSession;
72  // not really useful outside the ORA bridging...
75  std::unique_ptr<ITransaction> transaction;
76  std::unique_ptr<IIOVSchema> iovSchemaHandle;
77  std::unique_ptr<IGTSchema> gtSchemaHandle;
78  };
79 
80  }
81 
82 }
83 
84 #endif
85 
BackendType checkBackendType(boost::shared_ptr< coral::ISessionProxy > &coralSession, const std::string &connectionString)
Definition: SessionImpl.cc:63
void openGTDb(FailureOnOpeningPolicy policy=THROW)
Definition: SessionImpl.cc:179
void openIovDb(FailureOnOpeningPolicy policy=THROW)
Definition: SessionImpl.cc:163
std::unique_ptr< IIOVSchema > iovSchemaHandle
Definition: SessionImpl.h:76
boost::shared_ptr< coral::ISessionProxy > coralSession
Definition: SessionImpl.h:71
std::unique_ptr< IGTSchema > gtSchemaHandle
Definition: SessionImpl.h:77
BackendType
Definition: Types.h:23
void startTransaction(bool readOnly=true)
Definition: SessionImpl.cc:112
string connectionString
Definition: autoCondHLT.py:4
bool isTransactionActive(bool deep=true) const
Definition: SessionImpl.cc:157
std::unique_ptr< ITransaction > transaction
Definition: SessionImpl.h:75