CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
cond::persistency::ConnectionPool Class Reference

#include <ConnectionPool.h>

Public Member Functions

void configure ()
 
 ConnectionPool ()
 
std::shared_ptr< coral::ISessionProxy > createCoralSession (const std::string &connectionString, bool writeCapable=false)
 
Session createReadOnlySession (const std::string &connectionString, const std::string &transactionId)
 
Session createSession (const std::string &connectionString, bool writeCapable=false)
 
bool isLoggingEnabled () const
 
void setAuthenticationPath (const std::string &p)
 
void setAuthenticationSystem (int authSysCode)
 
void setFrontierSecurity (const std::string &signature)
 
void setLogDestination (Logger &logger)
 
void setLogging (bool flag)
 
void setMessageVerbosity (coral::MsgLevel level)
 
void setParameters (const edm::ParameterSet &connectionPset)
 
 ~ConnectionPool ()
 

Private Member Functions

void configure (coral::IConnectionServiceConfiguration &coralConfig)
 
std::shared_ptr< coral::ISessionProxy > createCoralSession (const std::string &connectionString, const std::string &transactionId, bool writeCapable=false)
 
Session createSession (const std::string &connectionString, const std::string &transactionId, bool writeCapable=false)
 

Private Attributes

std::string m_authenticationService = std::string("")
 
std::string m_authPath = std::string("")
 
int m_authSys = 0
 
std::string m_frontierSecurity = std::string("")
 
bool m_loggingEnabled = false
 
coral::MsgLevel m_messageLevel = coral::Error
 
CoralMsgReporterm_msgReporter = nullptr
 
cond::CoralServiceManagerm_pluginManager = nullptr
 

Detailed Description

Definition at line 35 of file ConnectionPool.h.

Constructor & Destructor Documentation

◆ ConnectionPool()

cond::persistency::ConnectionPool::ConnectionPool ( )

Definition at line 26 of file ConnectionPool.cc.

26  {
28  m_msgReporter = new CoralMsgReporter;
29  coral::MessageStream::installMsgReporter(m_msgReporter);
30  configure();
31  }

References configure(), m_msgReporter, and m_pluginManager.

◆ ~ConnectionPool()

cond::persistency::ConnectionPool::~ConnectionPool ( )

Definition at line 33 of file ConnectionPool.cc.

33 { delete m_pluginManager; }

References m_pluginManager.

Member Function Documentation

◆ configure() [1/2]

void cond::persistency::ConnectionPool::configure ( )

Definition at line 127 of file ConnectionPool.cc.

127  {
128  coral::ConnectionService connServ;
129  configure(connServ.configuration());
130  }

Referenced by BeamSpotRcdPrinter::BeamSpotRcdPrinter(), CondDBESSource::CondDBESSource(), l1t::DataManager::connect(), ConnectionPool(), popcon::L1RPCHwConfigSourceHandler::ConnectOnlineDB(), popcon::RPCEMapSourceHandler::ConnectOnlineDB(), FillInfoPopConSourceHandler::getNewObjects(), LHCInfoPopConSourceHandler::getNewObjects(), DTLVStatusHandler::getNewObjects(), DTHVStatusHandler::getNewObjects(), DTKeyedConfigHandler::getNewObjects(), DTUserKeyedConfigHandler::getNewObjects(), SiStripCoralIface::initialize(), popcon::PopCon::initialize(), L1ConfigOnlineProdBase< L1HtMissScaleRcd, L1CaloEtScale >::L1ConfigOnlineProdBase(), L1ConfigOnlineProdBaseExt< L1TCaloParamsO2ORcd, l1t::CaloParams >::L1ConfigOnlineProdBaseExt(), popcon::PopConBTransitionSourceHandler< T >::PopConBTransitionSourceHandler(), popcon::PopConESTransitionSourceHandler< T >::PopConESTransitionSourceHandler(), L1RCTOmdsFedVectorProducer::produce(), RunInfoRead::readData(), RPCDCCLinkMapHandler::RPCDCCLinkMapHandler(), RPCLBLinkMapHandler::RPCLBLinkMapHandler(), SiStripDetVOffHandler::SiStripDetVOffHandler(), SiStripDetVOffPrinter::SiStripDetVOffPrinter(), SiStripDetVOffTkMapPlotter::SiStripDetVOffTkMapPlotter(), SiStripDetVOffTrendPlotter::SiStripDetVOffTrendPlotter(), SiStripPayloadHandler< SiStripPayload >::SiStripPayloadHandler(), and SiStripPayloadMapTableCreator::SiStripPayloadMapTableCreator().

◆ configure() [2/2]

void cond::persistency::ConnectionPool::configure ( coral::IConnectionServiceConfiguration &  coralConfig)
private

Definition at line 75 of file ConnectionPool.cc.

75  {
76  coralConfig.disablePoolAutomaticCleanUp();
77  coralConfig.disableConnectionSharing();
78  // message streaming
79  coral::MessageStream::setMsgVerbosity(m_messageLevel);
81 
82  // authentication
83  m_authenticationService = std::string("CORAL/Services/EnvironmentAuthenticationService");
85  // authentication
86  if (authPath.empty()) {
87  // first try to check the env...
88  const char* authEnv = std::getenv(cond::auth::COND_AUTH_PATH);
89  if (authEnv) {
90  authPath += authEnv;
91  }
92  }
93  int authSys = m_authSys;
94  // first attempt, look at the env...
95  const char* authSysEnv = std::getenv(cond::auth::COND_AUTH_SYS);
96  if (authSysEnv) {
97  authSys = ::atoi(authSysEnv);
98  }
99  if (authSys != CondDbKey && authSys != CoralXMLFile) {
100  // take the default
101  authSys = CondDbKey;
102  }
103  std::string servName("");
104  if (authSys == CondDbKey) {
105  if (authPath.empty()) {
106  const char* authEnv = std::getenv("HOME");
107  if (authEnv) {
108  authPath += authEnv;
109  }
110  }
111  servName = "COND/Services/RelationalAuthenticationService";
112  } else if (authSys == CoralXMLFile) {
113  if (authPath.empty()) {
114  authPath = ".";
115  }
116  servName = "COND/Services/XMLAuthenticationService";
117  }
118  if (!authPath.empty()) {
119  m_authenticationService = servName;
120  coral::Context::instance().PropertyManager().property(cond::auth::COND_AUTH_PATH_PROPERTY)->set(authPath);
122  }
123 
124  coralConfig.setAuthenticationService(m_authenticationService);
125  }

References lumi_dqm_sourceclient-live_cfg::authPath, cond::auth::COND_AUTH_PATH, cond::auth::COND_AUTH_PATH_PROPERTY, cond::auth::COND_AUTH_SYS, cond::persistency::CondDbKey, cond::persistency::CoralXMLFile, instance, m_authenticationService, m_authPath, m_authSys, m_messageLevel, m_msgReporter, m_pluginManager, cond::persistency::CoralMsgReporter::setOutputLevel(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ createCoralSession() [1/2]

std::shared_ptr< coral::ISessionProxy > cond::persistency::ConnectionPool::createCoralSession ( const std::string &  connectionString,
bool  writeCapable = false 
)

◆ createCoralSession() [2/2]

std::shared_ptr< coral::ISessionProxy > cond::persistency::ConnectionPool::createCoralSession ( const std::string &  connectionString,
const std::string &  transactionId,
bool  writeCapable = false 
)
private

Definition at line 132 of file ConnectionPool.cc.

134  {
135  coral::ConnectionService connServ;
136  //all sessions opened with this connection service will share the same frontier security option.
137  std::pair<std::string, std::string> fullConnectionPars =
139  if (!fullConnectionPars.second.empty()) {
140  //all sessions opened with this connection service will share the same TTL settings for TAG, IOV, and PAYLOAD tables.
141  connServ.webCacheControl().setTableTimeToLive(fullConnectionPars.second, TAG::tname, 1);
142  connServ.webCacheControl().setTableTimeToLive(fullConnectionPars.second, IOV::tname, 1);
143  connServ.webCacheControl().setTableTimeToLive(fullConnectionPars.second, PAYLOAD::tname, 3);
144  }
145 
146  return std::shared_ptr<coral::ISessionProxy>(
147  connServ.connect(fullConnectionPars.first,
149  writeCapable ? coral::Update : coral::ReadOnly));
150  }

References cond::auth::COND_READER_ROLE, cond::auth::COND_WRITER_ROLE, l1RCTOmdsFedVectorProducer_cfi::connectionString, cond::persistency::getConnectionParams(), m_frontierSecurity, cond::persistency::TAG::tname, cond::persistency::PAYLOAD::tname, and cond::persistency::IOV::tname.

◆ createReadOnlySession()

Session cond::persistency::ConnectionPool::createReadOnlySession ( const std::string &  connectionString,
const std::string &  transactionId 
)

Definition at line 176 of file ConnectionPool.cc.

177  {
178  return createSession(connectionString, transactionId);
179  }

References l1RCTOmdsFedVectorProducer_cfi::connectionString, and createSession().

Referenced by CondDBESSource::CondDBESSource(), and CondDBESSource::setIntervalFor().

◆ createSession() [1/2]

Session cond::persistency::ConnectionPool::createSession ( const std::string &  connectionString,
bool  writeCapable = false 
)

◆ createSession() [2/2]

Session cond::persistency::ConnectionPool::createSession ( const std::string &  connectionString,
const std::string &  transactionId,
bool  writeCapable = false 
)
private

Definition at line 152 of file ConnectionPool.cc.

154  {
155  std::shared_ptr<coral::ISessionProxy> coralSession =
156  createCoralSession(connectionString, transactionId, writeCapable);
157 
158  std::string principalName("");
159  if (!m_authenticationService.empty()) {
160  // need to hard-code somewhere the target name...
161  if (m_authenticationService == "COND/Services/RelationalAuthenticationService") {
162  coral::IHandle<coral::IAuthenticationService> authSvc =
163  coral::Context::instance().query<coral::IAuthenticationService>(m_authenticationService);
164  IDbAuthentication* dbAuth = dynamic_cast<IDbAuthentication*>(authSvc.get());
165  principalName = dbAuth->principalName();
166  }
167  }
168 
169  return Session(std::make_shared<SessionImpl>(coralSession, connectionString, principalName));
170  }

References l1RCTOmdsFedVectorProducer_cfi::connectionString, createCoralSession(), instance, m_authenticationService, cond::persistency::IDbAuthentication::principalName(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ isLoggingEnabled()

bool cond::persistency::ConnectionPool::isLoggingEnabled ( ) const

Definition at line 73 of file ConnectionPool.cc.

73 { return m_loggingEnabled; }

References m_loggingEnabled.

◆ setAuthenticationPath()

void cond::persistency::ConnectionPool::setAuthenticationPath ( const std::string &  p)

◆ setAuthenticationSystem()

void cond::persistency::ConnectionPool::setAuthenticationSystem ( int  authSysCode)

◆ setFrontierSecurity()

void cond::persistency::ConnectionPool::setFrontierSecurity ( const std::string &  signature)

Definition at line 39 of file ConnectionPool.cc.

References m_frontierSecurity, and signature.

Referenced by setParameters().

◆ setLogDestination()

void cond::persistency::ConnectionPool::setLogDestination ( Logger logger)

◆ setLogging()

void cond::persistency::ConnectionPool::setLogging ( bool  flag)

Definition at line 41 of file ConnectionPool.cc.

References RemoveAddSevLevel::flag, and m_loggingEnabled.

Referenced by setParameters().

◆ setMessageVerbosity()

void cond::persistency::ConnectionPool::setMessageVerbosity ( coral::MsgLevel  level)

◆ setParameters()

void cond::persistency::ConnectionPool::setParameters ( const edm::ParameterSet connectionPset)

Definition at line 43 of file ConnectionPool.cc.

43  {
44  //set the connection parameters from a ParameterSet
45  //if a parameter is not defined, keep the values already set in the data members
46  //(i.e. default if no other setters called, or the ones currently available)
47  setAuthenticationPath(connectionPset.getUntrackedParameter<std::string>("authenticationPath", m_authPath));
48  setAuthenticationSystem(connectionPset.getUntrackedParameter<int>("authenticationSystem", m_authSys));
50  int messageLevel =
51  connectionPset.getUntrackedParameter<int>("messageLevel", 0); //0 corresponds to Error level, current default
52  coral::MsgLevel level = m_messageLevel;
53  switch (messageLevel) {
54  case 0:
56  break;
57  case 1:
58  level = coral::Warning;
59  break;
60  case 2:
61  level = coral::Info;
62  break;
63  case 3:
65  break;
66  default:
68  }
70  setLogging(connectionPset.getUntrackedParameter<bool>("logging", m_loggingEnabled));
71  }

References Debug, edm::ParameterSet::getUntrackedParameter(), personalPlayback::level, m_authPath, m_authSys, m_frontierSecurity, m_loggingEnabled, m_messageLevel, beam_dqm_sourceclient-live_cfg::messageLevel, setAuthenticationPath(), setAuthenticationSystem(), setFrontierSecurity(), setLogging(), setMessageVerbosity(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by BeamSpotRcdPrinter::BeamSpotRcdPrinter(), CondDBESSource::CondDBESSource(), popcon::PopConBTransitionSourceHandler< T >::PopConBTransitionSourceHandler(), popcon::PopConESTransitionSourceHandler< T >::PopConESTransitionSourceHandler(), RunInfoRead::readData(), RPCDCCLinkMapHandler::RPCDCCLinkMapHandler(), RPCLBLinkMapHandler::RPCLBLinkMapHandler(), SiStripDetVOffHandler::SiStripDetVOffHandler(), SiStripDetVOffPrinter::SiStripDetVOffPrinter(), SiStripDetVOffTkMapPlotter::SiStripDetVOffTkMapPlotter(), SiStripDetVOffTrendPlotter::SiStripDetVOffTrendPlotter(), SiStripPayloadHandler< SiStripPayload >::SiStripPayloadHandler(), and SiStripPayloadMapTableCreator::SiStripPayloadMapTableCreator().

Member Data Documentation

◆ m_authenticationService

std::string cond::persistency::ConnectionPool::m_authenticationService = std::string("")
private

Definition at line 66 of file ConnectionPool.h.

Referenced by configure(), and createSession().

◆ m_authPath

std::string cond::persistency::ConnectionPool::m_authPath = std::string("")
private

Definition at line 64 of file ConnectionPool.h.

Referenced by configure(), setAuthenticationPath(), and setParameters().

◆ m_authSys

int cond::persistency::ConnectionPool::m_authSys = 0
private

Definition at line 65 of file ConnectionPool.h.

Referenced by configure(), setAuthenticationSystem(), and setParameters().

◆ m_frontierSecurity

std::string cond::persistency::ConnectionPool::m_frontierSecurity = std::string("")
private

Definition at line 72 of file ConnectionPool.h.

Referenced by createCoralSession(), setFrontierSecurity(), and setParameters().

◆ m_loggingEnabled

bool cond::persistency::ConnectionPool::m_loggingEnabled = false
private

Definition at line 69 of file ConnectionPool.h.

Referenced by isLoggingEnabled(), setLogging(), and setParameters().

◆ m_messageLevel

coral::MsgLevel cond::persistency::ConnectionPool::m_messageLevel = coral::Error
private

Definition at line 67 of file ConnectionPool.h.

Referenced by configure(), setMessageVerbosity(), and setParameters().

◆ m_msgReporter

CoralMsgReporter* cond::persistency::ConnectionPool::m_msgReporter = nullptr
private

Definition at line 68 of file ConnectionPool.h.

Referenced by configure(), ConnectionPool(), and setLogDestination().

◆ m_pluginManager

cond::CoralServiceManager* cond::persistency::ConnectionPool::m_pluginManager = nullptr
private

Definition at line 74 of file ConnectionPool.h.

Referenced by configure(), ConnectionPool(), and ~ConnectionPool().

personalPlayback.level
level
Definition: personalPlayback.py:22
lumi_dqm_sourceclient-live_cfg.authPath
authPath
Definition: lumi_dqm_sourceclient-live_cfg.py:33
cond::persistency::ConnectionPool::m_pluginManager
cond::CoralServiceManager * m_pluginManager
Definition: ConnectionPool.h:74
cond::auth::COND_READER_ROLE
static constexpr const char *const COND_READER_ROLE
Definition: Auth.h:18
cond::persistency::ConnectionPool::setFrontierSecurity
void setFrontierSecurity(const std::string &signature)
Definition: ConnectionPool.cc:39
logger
Definition: logger.py:1
cond::persistency::ConnectionPool::createCoralSession
std::shared_ptr< coral::ISessionProxy > createCoralSession(const std::string &connectionString, bool writeCapable=false)
Definition: ConnectionPool.cc:181
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
cond::persistency::ConnectionPool::createSession
Session createSession(const std::string &connectionString, bool writeCapable=false)
Definition: ConnectionPool.cc:172
cond::auth::COND_WRITER_ROLE
static constexpr const char *const COND_WRITER_ROLE
Definition: Auth.h:17
cond::auth::COND_AUTH_SYS
static constexpr const char *const COND_AUTH_SYS
Definition: Auth.h:12
cond::CoralServiceManager
Definition: CoralServiceManager.h:25
Debug
const bool Debug
Definition: CosmicMuonParameters.h:12
Session
cond::persistency::TAG::tname
static constexpr char const * tname
Definition: IOVSchema.h:13
cond::persistency::CoralXMLFile
Definition: ConnectionPool.h:32
cond::persistency::ConnectionPool::m_messageLevel
coral::MsgLevel m_messageLevel
Definition: ConnectionPool.h:67
cond::persistency::getConnectionParams
std::pair< std::string, std::string > getConnectionParams(const std::string &connectionString, const std::string &transactionId, const std::string &signature)
Definition: DbConnectionString.cc:39
cond::persistency::ConnectionPool::setAuthenticationSystem
void setAuthenticationSystem(int authSysCode)
Definition: ConnectionPool.cc:37
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond::persistency::ConnectionPool::m_frontierSecurity
std::string m_frontierSecurity
Definition: ConnectionPool.h:72
beam_dqm_sourceclient-live_cfg.messageLevel
messageLevel
Definition: beam_dqm_sourceclient-live_cfg.py:369
cond::persistency::IOV::tname
static constexpr char const * tname
Definition: IOVSchema.h:110
cond::persistency::ConnectionPool::setMessageVerbosity
void setMessageVerbosity(coral::MsgLevel level)
Definition: ConnectionPool.cc:186
signature
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined signature
Definition: Activities.doc:4
cond::persistency::ConnectionPool::m_msgReporter
CoralMsgReporter * m_msgReporter
Definition: ConnectionPool.h:68
cond::persistency::CondDbKey
Definition: ConnectionPool.h:32
leef::Error
edm::ErrorSummaryEntry Error
Definition: LogErrorEventFilter.cc:29
cond::persistency::ConnectionPool::setAuthenticationPath
void setAuthenticationPath(const std::string &p)
Definition: ConnectionPool.cc:35
cond::persistency::CoralMsgReporter::subscribe
void subscribe(Logger &logger)
Definition: CoralMsgReporter.cc:143
cond::persistency::ConnectionPool::configure
void configure()
Definition: ConnectionPool.cc:127
instance
static PFTauRenderPlugin instance
Definition: PFTauRenderPlugin.cc:70
cond::auth::COND_AUTH_PATH
static constexpr const char *const COND_AUTH_PATH
Definition: Auth.h:11
cond::persistency::ConnectionPool::m_authPath
std::string m_authPath
Definition: ConnectionPool.h:64
cond::persistency::ConnectionPool::m_loggingEnabled
bool m_loggingEnabled
Definition: ConnectionPool.h:69
cond::auth::COND_AUTH_PATH_PROPERTY
static constexpr const char *const COND_AUTH_PATH_PROPERTY
Definition: Auth.h:43
cond::persistency::ConnectionPool::setLogging
void setLogging(bool flag)
Definition: ConnectionPool.cc:41
cond::persistency::CoralMsgReporter::setOutputLevel
void setOutputLevel(coral::MsgLevel lvl) override
Modify output level.
Definition: CoralMsgReporter.cc:88
cond::persistency::PAYLOAD::tname
static constexpr char const * tname
Definition: IOVSchema.h:73
l1RCTOmdsFedVectorProducer_cfi.connectionString
connectionString
Definition: l1RCTOmdsFedVectorProducer_cfi.py:4
cond::persistency::ConnectionPool::m_authSys
int m_authSys
Definition: ConnectionPool.h:65
cond::persistency::ConnectionPool::m_authenticationService
std::string m_authenticationService
Definition: ConnectionPool.h:66
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116