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)
 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 34 of file DbSession.cc.


Constructor & Destructor Documentation

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

Definition at line 36 of file DbSession.cc.

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

Definition at line 44 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 53 of file DbSession.cc.

References close().

                            {
        close();
      }

Member Function Documentation

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

Definition at line 82 of file DbSession.cc.

References database, isOpen, and transaction.

Referenced by open(), 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 57 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();
          database->connect( connStr, role, readOnly );
          transaction.reset( new cond::DbTransaction( database->transaction() ) );
          isOpen = true;
        }
      }

Member Data Documentation

Definition at line 90 of file DbSession.cc.

Referenced by open().

Definition at line 88 of file DbSession.cc.

Referenced by open().

Definition at line 91 of file DbSession.cc.

Referenced by close(), and open().

Definition at line 93 of file DbSession.cc.

Referenced by close(), and open().

Definition at line 89 of file DbSession.cc.

Referenced by open().

Definition at line 92 of file DbSession.cc.

Referenced by close(), and open().