CMS 3D CMS Logo

cond::DBSession Class Reference

#include <CondCore/DBCommon/interface/DBSession.h>

List of all members.

Public Member Functions

coral::IAuthenticationService & authenticationService () const
pool::IBlobStreamingService & blobStreamingService ()
cond::SessionConfigurationconfiguration ()
coral::IConnectionService & connectionService ()
 DBSession ()
const coral::IMonitoringReporter & monitoringReporter () const
void open ()
coral::IRelationalService & relationalService ()
coral::IWebCacheControl & webCacheControl ()
 ~DBSession ()

Private Attributes

coral::IConnectionService * m_con
seal::Handle< seal::Context > m_context
seal::Handle
< seal::ComponentLoader > 
m_loader
SessionConfigurationm_sessionConfig


Detailed Description

Definition at line 30 of file DBSession.h.


Constructor & Destructor Documentation

DBSession::DBSession (  ) 

Definition at line 28 of file DBSession.cc.

References python::TagTree::context, Exception, DBSPlugin::get(), m_context, m_loader, and m_sessionConfig.

00028                         { 
00029   seal::PluginManager* pm = seal::PluginManager::get();
00030   if ( ! pm ) {
00031     throw cond::Exception( "Could not get the plugin manager instance" );
00032   }
00033   pm->initialise();
00034   m_context=pool::POOLContext::context();
00035   m_loader = new seal::ComponentLoader( m_context.get() );
00036   m_sessionConfig = new cond::SessionConfiguration;
00037 }

DBSession::~DBSession (  ) 

Definition at line 38 of file DBSession.cc.

References m_sessionConfig.

00038                          {
00039   delete m_sessionConfig;
00040 }


Member Function Documentation

coral::IAuthenticationService & DBSession::authenticationService (  )  const

Definition at line 148 of file DBSession.cc.

References Exception, and m_context.

00148                                           {
00149    std::vector< seal::IHandle<coral::IAuthenticationService> > v_svc;
00150    m_context->query( v_svc );
00151    if ( v_svc.empty() ) {
00152      throw cond::Exception( "Could not locate the authentication service" );
00153    }
00154    return *(v_svc.front().get());
00155 }

pool::IBlobStreamingService & DBSession::blobStreamingService (  ) 

Definition at line 165 of file DBSession.cc.

References Exception, and m_context.

00165                                    {
00166   std::vector< seal::IHandle<pool::IBlobStreamingService> > v_svc;
00167   m_context->query( v_svc );
00168   if ( v_svc.empty() ) {
00169     throw cond::Exception( "Could not locate the BlobStreamingService" );
00170   }
00171   return *(v_svc.front().get());
00172 }

cond::SessionConfiguration & DBSession::configuration (  ) 

Definition at line 174 of file DBSession.cc.

References m_sessionConfig.

Referenced by cond::ConfigSessionFromParameterSet::ConfigSessionFromParameterSet(), cond::Connection::connect(), popcon::L1RPCHwConfigSourceHandler::ConnectOnlineDB(), popcon::RPCEMapSourceHandler::ConnectOnlineDB(), CondBasicIter::create(), l1t::DataManager::DataManager(), DTDBSession::DTDBSession(), DTCCBConfigHandler::getNewObjects(), PixelPopConCalibSourceHandler::getNewObjects_coral(), PoolDBESSource::PoolDBESSource(), cond::service::PoolDBOutputService::PoolDBOutputService(), and l1t::DataManager::setDebug().

00174                             {
00175   return *m_sessionConfig;
00176 }

coral::IConnectionService & DBSession::connectionService (  ) 

Definition at line 135 of file DBSession.cc.

References m_con.

Referenced by cond::Connection::connect(), and open().

00135                                 {
00136   return *m_con;
00137 }

const coral::IMonitoringReporter & DBSession::monitoringReporter (  )  const

Definition at line 157 of file DBSession.cc.

References m_con.

Referenced by cond::SQLReport::reportForConnection().

00157                                        {
00158   return m_con->monitoringReporter();
00159 }

void DBSession::open (  ) 

Definition at line 41 of file DBSession.cc.

References cond::SessionConfiguration::authenticationMethod(), cond::SessionConfiguration::authName(), cond::SessionConfiguration::blobStreamerName(), cond::SessionConfiguration::connectionConfiguration(), cond::ConnectionConfiguration::connectionRetrialPeriod(), cond::ConnectionConfiguration::connectionRetrialTimeOut(), connectionService(), cond::ConnectionConfiguration::connectionTimeOut(), cond::Debug, Debug, cond::Error, Exception, cond::SessionConfiguration::hasBlobStreamService(), i, cond::Info, cond::ConnectionConfiguration::isConnectionSharingEnabled(), cond::ConnectionConfiguration::isPoolAutomaticCleanUpEnabled(), cond::SessionConfiguration::isSQLMonitoringOn(), m_con, m_context, m_loader, m_sessionConfig, cond::SessionConfiguration::messageLevel(), cond::ConnectionConfiguration::monitorLevel(), path(), cond::ConnectionConfiguration::setMonitorLevel(), cond::Warning, and cond::XML.

Referenced by popcon::L1RPCHwConfigSourceHandler::ConnectOnlineDB(), popcon::RPCEMapSourceHandler::ConnectOnlineDB(), CondBasicIter::create(), l1t::DataManager::DataManager(), DTDBSession::DTDBSession(), DTCCBConfigHandler::getNewObjects(), PixelPopConCalibSourceHandler::getNewObjects_coral(), PoolDBESSource::PoolDBESSource(), and cond::service::PoolDBOutputService::PoolDBOutputService().

00041                         {
00042   m_loader->load("SEAL/Services/MessageService");
00043   std::vector< seal::IHandle<seal::IMessageService> > v_msgSvc;
00044   m_context->query( v_msgSvc );
00045   if ( v_msgSvc.empty() ) {
00046     throw cond::Exception( "could not locate the seal message service" );
00047   }
00048   switch ( m_sessionConfig->messageLevel() ) {
00049   case cond::Error :
00050     v_msgSvc.front()->setOutputLevel( seal::Msg::Error );
00051     break;
00052   case cond::Warning :
00053     v_msgSvc.front()->setOutputLevel( seal::Msg::Warning );
00054     break;
00055   case cond::Debug :
00056     v_msgSvc.front()->setOutputLevel( seal::Msg::Debug );
00057     break;
00058   case cond::Info :
00059     v_msgSvc.front()->setOutputLevel( seal::Msg::Info );
00060     break;
00061   default:
00062     v_msgSvc.front()->setOutputLevel( seal::Msg::Error );
00063   } 
00064   //load authentication service
00065   std::vector< seal::IHandle<coral::IAuthenticationService> > v_authsvc;
00066   if( m_sessionConfig->authenticationMethod()== cond::XML ) {
00067     m_loader->load( "COND/Services/XMLAuthenticationService" );
00068     boost::filesystem::path authPath( m_sessionConfig->authName() );
00069     if(boost::filesystem::is_directory(m_sessionConfig->authName())){
00070       authPath /= boost::filesystem::path("authentication.xml");
00071     }
00072     std::string authName=authPath.string();
00073     size_t nchildren=m_loader->context()->children();
00074     for( size_t i=0; i<nchildren; ++i ){
00075       seal::Handle<seal::PropertyManager> pmgr=m_loader->context()->child(i)->component<seal::PropertyManager>();
00076       std::string scopeName=pmgr->scopeName();
00077       //std::cout << "Scope: \"" << scopeName << "\"" << std::endl;
00078       if( scopeName=="COND/Services/XMLAuthenticationService" ){
00079         pmgr->property("AuthenticationFile")->set(authName);
00080       }
00081     }
00082   }else{
00083     m_loader->load( "CORAL/Services/EnvironmentAuthenticationService" );
00084   }
00085   //if( m_sessionConfig->authenticationMethod()==cond::XML ){
00086   //  }
00087   m_context->query(v_authsvc);
00088   if ( v_authsvc.empty() ) {
00089     throw cond::Exception( "Could not locate authentication service" );
00090   }
00091   //load relational service
00092   //m_loader->load( "CORAL/Services/RelationalService" );
00093   //load connection service
00094   m_loader->load( "CORAL/Services/ConnectionService" );
00095   
00096   m_con=m_context->query<coral::IConnectionService>( "CORAL/Services/ConnectionService" ).get();
00097   if (! m_con ) {
00098     throw cond::Exception( "could not locate the coral connection service" );
00099   }
00100   coral::IConnectionServiceConfiguration& conserviceConfig = connectionService().configuration();
00101   cond::ConnectionConfiguration* conConfig=m_sessionConfig->connectionConfiguration();
00102   if(m_sessionConfig->isSQLMonitoringOn()){
00103     m_loader->load( "COND/Services/SQLMonitoringService");
00104     conConfig->setMonitorLevel(coral::monitor::Trace);
00105   }
00106   if( conConfig ){
00107     if( conConfig->isConnectionSharingEnabled() ){
00108       conserviceConfig.enableConnectionSharing();
00109     }
00110     if( conConfig->isPoolAutomaticCleanUpEnabled() ){
00111       conserviceConfig.enablePoolAutomaticCleanUp();
00112     }else{
00113       conserviceConfig.disablePoolAutomaticCleanUp();
00114     }
00115     conserviceConfig.setConnectionRetrialPeriod( conConfig->connectionRetrialPeriod() );
00116     conserviceConfig.setConnectionRetrialTimeOut( conConfig->connectionRetrialTimeOut() );
00117     conserviceConfig.setConnectionTimeOut( conConfig->connectionTimeOut() );
00118     conserviceConfig.setMonitoringLevel( conConfig->monitorLevel() ); 
00119     if( m_sessionConfig->hasBlobStreamService() ){
00120       std::string streamerName=m_sessionConfig->blobStreamerName();
00121       if(streamerName.empty()){
00122         m_loader->load( "COND/Services/DefaultBlobStreamingService" );
00123       }else{
00124         m_loader->load(streamerName);
00125       }
00126       std::vector< seal::IHandle<pool::IBlobStreamingService> > v_blobsvc;
00127       m_context->query( v_blobsvc );
00128       if ( v_blobsvc.empty() ) {
00129         throw cond::Exception( "could not locate the BlobStreamingService" );
00130       }
00131     }
00132   }
00133 }

coral::IRelationalService & DBSession::relationalService (  ) 

Definition at line 139 of file DBSession.cc.

References Exception, and m_context.

00139                                 {
00140   std::vector< seal::IHandle<coral::IRelationalService> > v_svc;
00141   m_context->query( v_svc );
00142   if ( v_svc.empty() ) {
00143     throw cond::Exception( "Could not locate the relational service" );
00144   }
00145   return *(v_svc.front().get());
00146 }

coral::IWebCacheControl & DBSession::webCacheControl (  ) 

Definition at line 161 of file DBSession.cc.

References m_con.

Referenced by cond::FrontierProxy::setupSession().

00161                               {
00162   return m_con->webCacheControl();
00163 }


Member Data Documentation

coral::IConnectionService* cond::DBSession::m_con [private]

Definition at line 46 of file DBSession.h.

Referenced by connectionService(), monitoringReporter(), open(), and webCacheControl().

seal::Handle<seal::Context> cond::DBSession::m_context [private]

Definition at line 44 of file DBSession.h.

Referenced by authenticationService(), blobStreamingService(), DBSession(), open(), and relationalService().

seal::Handle<seal::ComponentLoader> cond::DBSession::m_loader [private]

Definition at line 45 of file DBSession.h.

Referenced by DBSession(), and open().

SessionConfiguration* cond::DBSession::m_sessionConfig [private]

Definition at line 47 of file DBSession.h.

Referenced by configuration(), DBSession(), open(), and ~DBSession().


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