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< DbConnection > | connection |
std::auto_ptr< ora::Database > | database |
bool | isOpen |
std::auto_ptr < cond::TechnologyProxy > | technologyProxy |
std::auto_ptr< DbTransaction > | transaction |
Definition at line 35 of file DbSession.cc.
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] |
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, 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, 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; } }
std::string const cond::SessionImpl::blobStreamingService |
Definition at line 113 of file DbSession.cc.
Referenced by open(), and openReadOnly().
std::auto_ptr<DbConnection> cond::SessionImpl::connection |
Definition at line 111 of file DbSession.cc.
Referenced by open(), and openReadOnly().
std::auto_ptr<ora::Database> cond::SessionImpl::database |
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().
std::auto_ptr<cond::TechnologyProxy> cond::SessionImpl::technologyProxy |
Definition at line 112 of file DbSession.cc.
Referenced by open(), and openReadOnly().
std::auto_ptr<DbTransaction> cond::SessionImpl::transaction |
Definition at line 115 of file DbSession.cc.
Referenced by close(), open(), and openReadOnly().