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_authPath = std::string("")
 
int m_authSys = 0
 
std::map< std::string, int > m_dbTypes
 
std::string m_frontierSecurity = std::string("")
 
bool m_loggingEnabled = false
 
coral::MsgLevel m_messageLevel = coral::Error
 
std::unique_ptr< CoralMsgReporterm_msgReporter
 
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 24 of file ConnectionPool.cc.

24  {
26  configure();
27  }

References configure(), and m_pluginManager.

◆ ~ConnectionPool()

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

Definition at line 29 of file ConnectionPool.cc.

29 { delete m_pluginManager; }

References m_pluginManager.

Member Function Documentation

◆ configure() [1/2]

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

Definition at line 125 of file ConnectionPool.cc.

125  {
126  coral::ConnectionService connServ;
127  configure(connServ.configuration());
128  }

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 71 of file ConnectionPool.cc.

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

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_authPath, m_authSys, m_messageLevel, m_msgReporter, m_pluginManager, 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 130 of file ConnectionPool.cc.

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

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 162 of file ConnectionPool.cc.

163  {
164  return createSession(connectionString, transactionId);
165  }

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 150 of file ConnectionPool.cc.

152  {
153  std::shared_ptr<coral::ISessionProxy> coralSession =
154  createCoralSession(connectionString, transactionId, writeCapable);
155  return Session(std::make_shared<SessionImpl>(coralSession, connectionString));
156  }

References l1RCTOmdsFedVectorProducer_cfi::connectionString, and createCoralSession().

◆ isLoggingEnabled()

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

Definition at line 69 of file ConnectionPool.cc.

69 { 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 35 of file ConnectionPool.cc.

References m_frontierSecurity, and signature.

Referenced by setParameters().

◆ setLogDestination()

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

Definition at line 174 of file ConnectionPool.cc.

174  {
175  m_msgReporter = std::make_unique<CoralMsgReporter>(logger);
176  }

References m_msgReporter.

◆ setLogging()

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

Definition at line 37 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 39 of file ConnectionPool.cc.

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

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_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_dbTypes

std::map<std::string, int> cond::persistency::ConnectionPool::m_dbTypes
private

Definition at line 74 of file ConnectionPool.h.

◆ m_frontierSecurity

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

Definition at line 71 of file ConnectionPool.h.

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

◆ m_loggingEnabled

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

Definition at line 68 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 66 of file ConnectionPool.h.

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

◆ m_msgReporter

std::unique_ptr<CoralMsgReporter> cond::persistency::ConnectionPool::m_msgReporter
private

Definition at line 67 of file ConnectionPool.h.

Referenced by configure(), and setLogDestination().

◆ m_pluginManager

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

Definition at line 73 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:73
cond::auth::COND_READER_ROLE
static constexpr const char *const COND_READER_ROLE
Definition: Auth.h:17
cond::persistency::ConnectionPool::setFrontierSecurity
void setFrontierSecurity(const std::string &signature)
Definition: ConnectionPool.cc:35
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:167
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:158
cond::auth::COND_WRITER_ROLE
static constexpr const char *const COND_WRITER_ROLE
Definition: Auth.h:16
cond::auth::COND_AUTH_SYS
static constexpr const char *const COND_AUTH_SYS
Definition: Auth.h:11
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:66
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:33
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond::persistency::ConnectionPool::m_frontierSecurity
std::string m_frontierSecurity
Definition: ConnectionPool.h:71
beam_dqm_sourceclient-live_cfg.messageLevel
messageLevel
Definition: beam_dqm_sourceclient-live_cfg.py:358
cond::persistency::IOV::tname
static constexpr char const * tname
Definition: IOVSchema.h:104
cond::persistency::ConnectionPool::setMessageVerbosity
void setMessageVerbosity(coral::MsgLevel level)
Definition: ConnectionPool.cc:172
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::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:31
cond::persistency::ConnectionPool::configure
void configure()
Definition: ConnectionPool.cc:125
instance
static PFTauRenderPlugin instance
Definition: PFTauRenderPlugin.cc:70
cond::auth::COND_AUTH_PATH
static constexpr const char *const COND_AUTH_PATH
Definition: Auth.h:10
cond::persistency::ConnectionPool::m_authPath
std::string m_authPath
Definition: ConnectionPool.h:64
cond::persistency::ConnectionPool::m_loggingEnabled
bool m_loggingEnabled
Definition: ConnectionPool.h:68
cond::auth::COND_AUTH_PATH_PROPERTY
static constexpr const char *const COND_AUTH_PATH_PROPERTY
Definition: Auth.h:27
cond::persistency::ConnectionPool::setLogging
void setLogging(bool flag)
Definition: ConnectionPool.cc:37
cond::persistency::ConnectionPool::m_msgReporter
std::unique_ptr< CoralMsgReporter > m_msgReporter
Definition: ConnectionPool.h:67
cond::persistency::PAYLOAD::tname
static constexpr char const * tname
Definition: IOVSchema.h:67
l1RCTOmdsFedVectorProducer_cfi.connectionString
connectionString
Definition: l1RCTOmdsFedVectorProducer_cfi.py:4
cond::persistency::ConnectionPool::m_authSys
int m_authSys
Definition: ConnectionPool.h:65
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116