CMS 3D CMS Logo

DTDBSession Class Reference

Description:. More...

#include <CondTools/DT/interface/DTDBSession.h>

List of all members.

Public Member Functions

void connect (bool readOnly)
 start transaction
void disconnect ()
 end transaction
 DTDBSession (const std::string &dbFile, const std::string &dbCatalog, const std::string &auth_path, bool siteLocalConfig=false)
 Constructor.
cond::PoolTransactionpoolDB () const
 Operations.
virtual ~DTDBSession ()
 Destructor.

Private Attributes

cond::Connectionm_connection
cond::PoolTransactionm_pooldb
cond::DBSessionm_session


Detailed Description

Description:.

Date
2007/12/07 15:12:17
Revision
1.2
Author:
Paolo Ronchese INFN Padova

Definition at line 54 of file DTDBSession.h.


Constructor & Destructor Documentation

DTDBSession::DTDBSession ( const std::string &  dbFile,
const std::string &  dbCatalog,
const std::string &  auth_path,
bool  siteLocalConfig = false 
)

Constructor.

Definition at line 48 of file DTDBSession.cc.

References cond::DBSession::configuration(), connect(), cond::Env, cond::Error, Exception, edm::Service< T >::isAvailable(), m_connection, m_session, cond::DBSession::open(), cond::SessionConfiguration::setAuthenticationMethod(), cond::SessionConfiguration::setAuthenticationPath(), cond::SessionConfiguration::setMessageLevel(), and cond::XML.

00051                                                 :
00052   m_session( 0 ),
00053   m_pooldb( 0 ) {
00054 
00055    std::string connect( dbFile );
00056    std::string catconnect( dbCatalog );
00057 //   int connectionTimeOut = 600;
00058 //   int connectionRetrialPeriod = 30;
00059 //   int connectionRetrialTimeOut = 180;
00060    m_session = new cond::DBSession();
00061    if ( auth_path.empty() ) {
00062      m_session->configuration().setAuthenticationMethod( cond::Env );
00063    }
00064    else {
00065      m_session->configuration().setAuthenticationMethod( cond::XML );
00066      m_session->configuration().setAuthenticationPath( auth_path );
00067    }
00068    m_session->configuration().setMessageLevel( cond::Error );
00069 /*
00070    m_session->configuration().connectionConfiguration()->enableConnectionSharing();
00071    m_session->configuration().connectionConfiguration()->setConnectionTimeOut(
00072                                            connectionTimeOut );
00073    m_session->configuration().connectionConfiguration()->
00074               enableReadOnlySessionOnUpdateConnections();
00075    m_session->configuration().connectionConfiguration()->
00076               setConnectionRetrialPeriod( connectionRetrialPeriod );
00077    m_session->configuration().connectionConfiguration()->
00078               setConnectionRetrialTimeOut( connectionRetrialTimeOut );
00079 */
00080    m_session->open();
00081    if ( siteLocalConfig ) {
00082     edm::Service<edm::SiteLocalConfig> localconfservice;
00083     if( !localconfservice.isAvailable() ){
00084       throw cms::Exception("edm::SiteLocalConfigService is not available");
00085     }
00086    }
00087    m_connection = new cond::Connection( connect, -1 );
00088 //   m_pooldb = new cond::PoolStorageManager( connect, catconnect, m_session );
00089 
00090 }

DTDBSession::~DTDBSession (  )  [virtual]

Destructor.

Definition at line 95 of file DTDBSession.cc.

References m_connection, and m_session.

00095                           {
00096   delete m_connection;
00097   delete m_session;
00098 }


Member Function Documentation

void DTDBSession::connect ( bool  readOnly  ) 

start transaction

Definition at line 111 of file DTDBSession.cc.

References cond::Connection::connect(), m_connection, m_pooldb, m_session, cond::Connection::poolTransaction(), and cond::PoolTransaction::start().

Referenced by DTConfigDBDump::beginJob(), DTConfigDBInit::beginJob(), DTConfigDBCopy::beginJob(), DTCCBConfigHandler::chkConfigList(), and DTDBSession().

00111                                          {
00112   m_connection->connect( m_session );
00113   m_pooldb = &( m_connection->poolTransaction() );
00114   m_pooldb->start( readOnly );
00115 //  m_pooldb->connect();
00116 //  m_pooldb->startTransaction( readOnly );
00117   return;
00118 }

void DTDBSession::disconnect ( void   ) 

end transaction

Definition at line 122 of file DTDBSession.cc.

References cond::PoolTransaction::commit(), cond::Connection::disconnect(), m_connection, and m_pooldb.

Referenced by DTConfigDBDump::beginJob(), DTConfigDBInit::beginJob(), DTConfigDBCopy::beginJob(), and DTCCBConfigHandler::chkConfigList().

00122                              {
00123   m_pooldb->commit();
00124   m_connection->disconnect();
00125 //  m_pooldb->commit();
00126 //  m_pooldb->disconnect();     
00127   return;
00128 }

cond::PoolTransaction * DTDBSession::poolDB (  )  const

Operations.

get storage manager

get storage manager

Definition at line 104 of file DTDBSession.cc.

References m_pooldb.

Referenced by DTConfigDBInit::beginJob(), DTCCBConfigHandler::chkConfigList(), DTConfigHandler::clone(), DTConfigHandler::get(), and DTConfigHandler::getContainer().

00104                                                {
00105 //cond::PoolStorageManager* DTDBSession::poolDB() const {
00106   return m_pooldb;
00107 }


Member Data Documentation

cond::Connection* DTDBSession::m_connection [private]

Definition at line 83 of file DTDBSession.h.

Referenced by connect(), disconnect(), DTDBSession(), and ~DTDBSession().

cond::PoolTransaction* DTDBSession::m_pooldb [private]

Definition at line 84 of file DTDBSession.h.

Referenced by connect(), disconnect(), and poolDB().

cond::DBSession* DTDBSession::m_session [private]

Definition at line 82 of file DTDBSession.h.

Referenced by connect(), DTDBSession(), and ~DTDBSession().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:18:49 2009 for CMSSW by  doxygen 1.5.4