CMS 3D CMS Logo

Public Member Functions | Public Attributes

cond::SessionImpl Class Reference

List of all members.

Public Member Functions

void close ()
void open (const std::string &connectionString, const std::string &role, bool readOnly)
void openReadOnly (const std::string &connectionString, const std::string &transactionId)
 SessionImpl (const DbConnection &connection)
 SessionImpl ()
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.

                   :
        connection(),
        blobStreamingService( "COND/Services/BlobStreamingService" ),
        database(),
        transaction(),
        isOpen(false){
      }
cond::SessionImpl::SessionImpl ( const DbConnection connection) [inline, explicit]

Definition at line 45 of file DbSession.cc.

                                                            :
        connection(new DbConnection(connection)),
        blobStreamingService( "COND/Services/BlobStreamingService" ),
        database(),
        transaction(),
        isOpen(false){
      }
virtual cond::SessionImpl::~SessionImpl ( ) [inline, virtual]

Definition at line 54 of file DbSession.cc.

References close().

                            {
        close();
      }

Member Function Documentation

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

Definition at line 105 of file DbSession.cc.

References database, isOpen, and transaction.

Referenced by open(), openReadOnly(), and ~SessionImpl().

                  {
        transaction.reset();
        database.reset();
        isOpen = false;
      }
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, Exception, reco::get(), isOpen, AlCaHLTBitMon_QueryRunRegistry::string, technologyProxy, and transaction.

                              {
        close();
        if( connection.get() ){
          if(!connection->isOpen()){
            throw cond::Exception("DbSession::open: cannot open session. Underlying connection is closed.");
          }
          boost::shared_ptr<ora::ConnectionPool> connPool = connection->connectionPool();
          database.reset( new ora::Database( connPool ) );
 
          ora::IBlobStreamingService* blobStreamer = cond::BlobStreamerPluginFactory::get()->create(  blobStreamingService );
          if(!blobStreamer) throw cond::Exception("DbSession::open: cannot find required plugin. No instance of ora::IBlobStreamingService has been loaded..");
          database->configuration().setBlobStreamingService( blobStreamer );
          //database->configuration().properties().setFlag( ora::Configuration::automaticDatabaseCreation() );
          database->configuration().properties().setFlag( ora::Configuration::automaticContainerCreation() );
          // open the db connection
          technologyProxy = buildTechnologyProxy(connectionString, *connection);
          std::string connStr = (*technologyProxy).getRealConnectString( connectionString );
          database->connect( connStr, role, readOnly );
          transaction.reset( new cond::DbTransaction( database->transaction() ) );
          isOpen = true;
        }
      }
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, Exception, reco::get(), isOpen, AlCaHLTBitMon_QueryRunRegistry::string, technologyProxy, and transaction.

                                                       {
        close();
        if( connection.get() ){
          if(!connection->isOpen()){
            throw cond::Exception("DbSession::open: cannot open session. Underlying connection is closed.");
          }
          boost::shared_ptr<ora::ConnectionPool> connPool = connection->connectionPool();
          database.reset( new ora::Database( connPool ) );
 
          ora::IBlobStreamingService* blobStreamer = cond::BlobStreamerPluginFactory::get()->create(  blobStreamingService );
          if(!blobStreamer) throw cond::Exception("DbSession::open: cannot find required plugin. No instance of ora::IBlobStreamingService has been loaded..");
          database->configuration().setBlobStreamingService( blobStreamer );
          // open the db connection
          technologyProxy = buildTechnologyProxy(connectionString, *connection);
          std::string connStr = (*technologyProxy).getRealConnectString(connectionString, transactionId);
          database->connect( connStr, Auth::COND_READER_ROLE, true );
          transaction.reset( new cond::DbTransaction( database->transaction() ) );
          isOpen = true;
        }
      }

Member Data Documentation

Definition at line 113 of file DbSession.cc.

Referenced by open(), and openReadOnly().

Definition at line 111 of file DbSession.cc.

Referenced by open(), and openReadOnly().

Definition at line 114 of file DbSession.cc.

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

Definition at line 116 of file DbSession.cc.

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

Definition at line 112 of file DbSession.cc.

Referenced by open(), and openReadOnly().

Definition at line 115 of file DbSession.cc.

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