CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
cond::SessionImpl Class Reference

Public Member Functions

void close ()
 
void open (const std::string &connectionString, const std::string &role, bool readOnly)
 
void open (boost::shared_ptr< coral::ISessionProxy > &coralSession, const std::string &connectionString, const std::string &schemaName)
 
void openReadOnly (const std::string &connectionString, const std::string &transactionId)
 
 SessionImpl ()
 
 SessionImpl (const DbConnection &connection)
 
virtual ~SessionImpl ()
 

Public Attributes

std::string const blobStreamingService
 
std::auto_ptr< DbConnectionconnection
 
std::auto_ptr< ora::Databasedatabase
 
bool isOpen
 
std::auto_ptr
< cond::TechnologyProxy
technologyProxy
 
std::auto_ptr< DbTransactiontransaction
 

Detailed Description

Definition at line 35 of file DbSession.cc.

Constructor & Destructor Documentation

cond::SessionImpl::SessionImpl ( )
inline

Definition at line 37 of file DbSession.cc.

37  :
38  connection(),
39  blobStreamingService( "COND/Services/BlobStreamingService" ),
40  database(),
41  transaction(),
42  isOpen(false){
43  }
std::auto_ptr< DbConnection > connection
Definition: DbSession.cc:126
std::auto_ptr< DbTransaction > transaction
Definition: DbSession.cc:130
std::auto_ptr< ora::Database > database
Definition: DbSession.cc:129
std::string const blobStreamingService
Definition: DbSession.cc:128
cond::SessionImpl::SessionImpl ( const DbConnection connection)
inlineexplicit

Definition at line 45 of file DbSession.cc.

45  :
46  connection(new DbConnection(connection)),
47  blobStreamingService( "COND/Services/BlobStreamingService" ),
48  database(),
49  transaction(),
50  isOpen(false){
51  }
std::auto_ptr< DbConnection > connection
Definition: DbSession.cc:126
std::auto_ptr< DbTransaction > transaction
Definition: DbSession.cc:130
std::auto_ptr< ora::Database > database
Definition: DbSession.cc:129
std::string const blobStreamingService
Definition: DbSession.cc:128
virtual cond::SessionImpl::~SessionImpl ( )
inlinevirtual

Definition at line 54 of file DbSession.cc.

References close().

54  {
55  close();
56  }

Member Function Documentation

void cond::SessionImpl::close ( void  )
inline
void cond::SessionImpl::open ( const std::string &  connectionString,
const std::string &  role,
bool  readOnly 
)
inline

Definition at line 58 of file DbSession.cc.

References ora::Configuration::automaticContainerCreation(), blobStreamingService, cond::buildTechnologyProxy(), close(), connection, database, edm::hlt::Exception, reco::get(), isOpen, AlCaHLTBitMon_QueryRunRegistry::string, technologyProxy, and transaction.

Referenced by Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController::importConfig().

60  {
61  close();
62  if( connection.get() ){
63  if(!connection->isOpen()){
64  throw cond::Exception("DbSession::open: cannot open session. Underlying connection is closed.");
65  }
66  boost::shared_ptr<ora::ConnectionPool> connPool = connection->connectionPool();
67  database.reset( new ora::Database( connPool ) );
68 
70  if(!blobStreamer) throw cond::Exception("DbSession::open: cannot find required plugin. No instance of ora::IBlobStreamingService has been loaded..");
71  database->configuration().setBlobStreamingService( blobStreamer );
72  //database->configuration().properties().setFlag( ora::Configuration::automaticDatabaseCreation() );
73  database->configuration().properties().setFlag( ora::Configuration::automaticContainerCreation() );
74  // open the db connection
75  technologyProxy = buildTechnologyProxy(connectionString, *connection);
76  std::string connStr = (*technologyProxy).getRealConnectString( connectionString );
77  database->connect( connStr, role, readOnly );
78  transaction.reset( new cond::DbTransaction( database->transaction() ) );
79  isOpen = true;
80  }
81  }
std::auto_ptr< cond::TechnologyProxy > buildTechnologyProxy(const std::string &userconnect, const DbConnection &connection)
Definition: DbSession.cc:17
std::auto_ptr< DbConnection > connection
Definition: DbSession.cc:126
static std::string automaticContainerCreation()
std::auto_ptr< DbTransaction > transaction
Definition: DbSession.cc:130
std::auto_ptr< ora::Database > database
Definition: DbSession.cc:129
std::auto_ptr< cond::TechnologyProxy > technologyProxy
Definition: DbSession.cc:127
Interface for a Streaming Service.
std::string const blobStreamingService
Definition: DbSession.cc:128
T get(const Candidate &c)
Definition: component.h:55
void cond::SessionImpl::open ( boost::shared_ptr< coral::ISessionProxy > &  coralSession,
const std::string &  connectionString,
const std::string &  schemaName 
)
inline

Definition at line 105 of file DbSession.cc.

References ora::Configuration::automaticContainerCreation(), blobStreamingService, close(), database, edm::hlt::Exception, edm::false, reco::get(), isOpen, and transaction.

Referenced by Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController::importConfig().

107  {
108  close();
109  database.reset( new ora::Database );
110 
112  if(!blobStreamer) throw cond::Exception("DbSession::open: cannot find required plugin. No instance of ora::IBlobStreamingService has been loaded..");
113  database->configuration().setBlobStreamingService( blobStreamer );
114  database->configuration().properties().setFlag( ora::Configuration::automaticContainerCreation() );
115  database->connect( coralSession, connectionString, schemaName );
116  transaction.reset( new cond::DbTransaction( database->transaction(), false ) );
117  isOpen = true;
118  }
static std::string automaticContainerCreation()
std::auto_ptr< DbTransaction > transaction
Definition: DbSession.cc:130
std::auto_ptr< ora::Database > database
Definition: DbSession.cc:129
Interface for a Streaming Service.
volatile std::atomic< bool > shutdown_flag false
std::string const blobStreamingService
Definition: DbSession.cc:128
T get(const Candidate &c)
Definition: component.h:55
void cond::SessionImpl::openReadOnly ( const std::string &  connectionString,
const std::string &  transactionId 
)
inline

Definition at line 83 of file DbSession.cc.

References blobStreamingService, cond::buildTechnologyProxy(), close(), cond::Auth::COND_READER_ROLE, connection, database, edm::hlt::Exception, reco::get(), isOpen, AlCaHLTBitMon_QueryRunRegistry::string, technologyProxy, and transaction.

84  {
85  close();
86  if( connection.get() ){
87  if(!connection->isOpen()){
88  throw cond::Exception("DbSession::open: cannot open session. Underlying connection is closed.");
89  }
90  boost::shared_ptr<ora::ConnectionPool> connPool = connection->connectionPool();
91  database.reset( new ora::Database( connPool ) );
92 
94  if(!blobStreamer) throw cond::Exception("DbSession::open: cannot find required plugin. No instance of ora::IBlobStreamingService has been loaded..");
95  database->configuration().setBlobStreamingService( blobStreamer );
96  // open the db connection
97  technologyProxy = buildTechnologyProxy(connectionString, *connection);
98  std::string connStr = (*technologyProxy).getRealConnectString(connectionString, transactionId);
99  database->connect( connStr, Auth::COND_READER_ROLE, true );
100  transaction.reset( new cond::DbTransaction( database->transaction() ) );
101  isOpen = true;
102  }
103  }
std::auto_ptr< cond::TechnologyProxy > buildTechnologyProxy(const std::string &userconnect, const DbConnection &connection)
Definition: DbSession.cc:17
std::auto_ptr< DbConnection > connection
Definition: DbSession.cc:126
std::auto_ptr< DbTransaction > transaction
Definition: DbSession.cc:130
std::auto_ptr< ora::Database > database
Definition: DbSession.cc:129
std::auto_ptr< cond::TechnologyProxy > technologyProxy
Definition: DbSession.cc:127
static const std::string COND_READER_ROLE
Definition: Auth.h:19
Interface for a Streaming Service.
std::string const blobStreamingService
Definition: DbSession.cc:128
T get(const Candidate &c)
Definition: component.h:55

Member Data Documentation

std::string const cond::SessionImpl::blobStreamingService

Definition at line 128 of file DbSession.cc.

Referenced by open(), and openReadOnly().

std::auto_ptr<DbConnection> cond::SessionImpl::connection

Definition at line 126 of file DbSession.cc.

Referenced by open(), and openReadOnly().

std::auto_ptr<ora::Database> cond::SessionImpl::database

Definition at line 129 of file DbSession.cc.

Referenced by close(), open(), and openReadOnly().

bool cond::SessionImpl::isOpen

Definition at line 131 of file DbSession.cc.

Referenced by close(), open(), and openReadOnly().

std::auto_ptr<cond::TechnologyProxy> cond::SessionImpl::technologyProxy

Definition at line 127 of file DbSession.cc.

Referenced by open(), and openReadOnly().

std::auto_ptr<DbTransaction> cond::SessionImpl::transaction

Definition at line 130 of file DbSession.cc.

Referenced by close(), open(), and openReadOnly().