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, bool readOnly)
 
 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 36 of file DbSession.cc.

Constructor & Destructor Documentation

cond::SessionImpl::SessionImpl ( )
inline

Definition at line 38 of file DbSession.cc.

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

Definition at line 46 of file DbSession.cc.

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

Definition at line 55 of file DbSession.cc.

References close().

55  {
56  close();
57  }

Member Function Documentation

void cond::SessionImpl::close ( void  )
inline

Definition at line 82 of file DbSession.cc.

References database, isOpen, and transaction.

Referenced by python.Vispa.Gui.BoxContentDialog.BoxContentDialog::keyPressEvent(), python.Vispa.Gui.FindDialog.FindDialog::keyPressEvent(), open(), and ~SessionImpl().

82  {
83  transaction.reset();
84  database.reset();
85  isOpen = false;
86  }
std::auto_ptr< DbTransaction > transaction
Definition: DbSession.cc:92
std::auto_ptr< ora::Database > database
Definition: DbSession.cc:91
void cond::SessionImpl::open ( const std::string &  connectionString,
bool  readOnly 
)
inline

Definition at line 59 of file DbSession.cc.

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

Referenced by python.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  // open the db connection
74  technologyProxy = buildTechnologyProxy(connectionString, *connection);
75  std::string connStr = (*technologyProxy).getRealConnectString();
76  database->connect( connStr, readOnly );
77  transaction.reset( new cond::DbTransaction( database->transaction() ) );
78  isOpen = true;
79  }
80  }
std::auto_ptr< cond::TechnologyProxy > buildTechnologyProxy(const std::string &userconnect, const DbConnection &connection)
Definition: DbSession.cc:16
std::auto_ptr< DbConnection > connection
Definition: DbSession.cc:88
static std::string automaticDatabaseCreation()
Definition: Configuration.cc:5
std::auto_ptr< DbTransaction > transaction
Definition: DbSession.cc:92
std::auto_ptr< ora::Database > database
Definition: DbSession.cc:91
std::auto_ptr< cond::TechnologyProxy > technologyProxy
Definition: DbSession.cc:89
Interface for a Streaming Service.
std::string const blobStreamingService
Definition: DbSession.cc:90
T get(const Candidate &c)
Definition: component.h:56

Member Data Documentation

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

Definition at line 90 of file DbSession.cc.

Referenced by open().

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

Definition at line 88 of file DbSession.cc.

Referenced by open().

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

Definition at line 91 of file DbSession.cc.

Referenced by close(), and open().

bool cond::SessionImpl::isOpen

Definition at line 93 of file DbSession.cc.

Referenced by close(), and open().

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

Definition at line 89 of file DbSession.cc.

Referenced by open().

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

Definition at line 92 of file DbSession.cc.

Referenced by close(), and open().