CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Attributes

RPCDBCom Class Reference

#include <RPCDBCom.h>

Inheritance diagram for RPCDBCom:
RPCFw

List of all members.

Public Member Functions

 RPCDBCom ()
virtual void run ()=0
void setVerbosityLevel (coral::MsgLevel level)
virtual ~RPCDBCom ()

Protected Member Functions

coral::ISession * connect (const std::string &connectionString, const std::string &userName, const std::string &password)

Private Attributes

coral::IConnection * m_connection

Detailed Description

Definition at line 12 of file RPCDBCom.h.


Constructor & Destructor Documentation

RPCDBCom::RPCDBCom ( )

Definition at line 8 of file RPCDBCom.cc.

                  :
  m_connection( 0 )
{
  coral::Context& context = coral::Context::instance();
  context.loadComponent( "CORAL/RelationalPlugins/oracle" );
  coral::IHandle<coral::IRelationalDomain> domain = context.query<coral::IRelationalDomain>(
"CORAL/RelationalPlugins/oracle" );
  if ( ! domain.isValid() )
    throw std::runtime_error( "Could not load the OracleAccess plugin" );
}
RPCDBCom::~RPCDBCom ( ) [virtual]

Definition at line 20 of file RPCDBCom.cc.

References m_connection.

{
  if ( m_connection ) delete m_connection;
}

Member Function Documentation

coral::ISession * RPCDBCom::connect ( const std::string &  connectionString,
const std::string &  userName,
const std::string &  password 
) [protected]

Definition at line 27 of file RPCDBCom.cc.

References m_connection, and python::CommonUtils::session.

Referenced by RPCFw::createFEB(), RPCFw::createGAS(), RPCFw::createIDMAP(), RPCFw::createIMON(), RPCFw::createMix(), RPCFw::createSTATUS(), RPCFw::createT(), RPCFw::createUXC(), and RPCFw::createVMON().

{
  coral::Context& ctx = coral::Context::instance();
  ctx.loadComponent("CORAL/RelationalPlugins/oracle");
  coral::IHandle<coral::IRelationalDomain> iHandle=ctx.query<coral::IRelationalDomain>("CORAL/RelationalPlugins/oracle");
  if ( ! iHandle.isValid() ) {
    throw std::runtime_error( "Could not load the OracleAccess plugin" );
  }
  std::pair<std::string, std::string> connectionAndSchema = iHandle->decodeUserConnectionString( connectionString );

  if ( ! m_connection )
    m_connection = iHandle->newConnection( connectionAndSchema.first );

  if ( ! m_connection->isConnected() )
    m_connection->connect();
  
  coral::ISession* session = m_connection->newSession( connectionAndSchema.second );
  
  if ( session ) {
    session->startUserSession( userName, password );
  }
  //memory leaking
  return session;
}
virtual void RPCDBCom::run ( ) [pure virtual]

Implemented in RPCFw.

void RPCDBCom::setVerbosityLevel ( coral::MsgLevel  level)

Definition at line 56 of file RPCDBCom.cc.

{
  coral::MessageStream::setMsgVerbosity(level);
}

Member Data Documentation

coral::IConnection* RPCDBCom::m_connection [private]

Definition at line 26 of file RPCDBCom.h.

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