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 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
 
cond::CoralServiceManagerm_pluginManager = 0
 

Detailed Description

Definition at line 31 of file ConnectionPool.h.

Constructor & Destructor Documentation

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

Definition at line 30 of file ConnectionPool.cc.

References m_pluginManager.

30 { delete m_pluginManager; }
cond::CoralServiceManager * m_pluginManager

Member Function Documentation

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

Definition at line 121 of file ConnectionPool.cc.

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< TRcd, TData >::L1ConfigOnlineProdBase(), L1ConfigOnlineProdBaseExt< TRcd, TData >::L1ConfigOnlineProdBaseExt(), 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().

121  {
122  coral::ConnectionService connServ;
123  configure(connServ.configuration());
124  }
void cond::persistency::ConnectionPool::configure ( coral::IConnectionServiceConfiguration &  coralConfig)
private

Definition at line 72 of file ConnectionPool.cc.

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_pluginManager, and AlCaHLTBitMon_QueryRunRegistry::string.

72  {
73  coralConfig.disablePoolAutomaticCleanUp();
74  coralConfig.disableConnectionSharing();
75  // message streaming
76  coral::MessageStream::setMsgVerbosity(m_messageLevel);
77  std::string authServiceName("CORAL/Services/EnvironmentAuthenticationService");
79  // authentication
80  if (authPath.empty()) {
81  // first try to check the env...
82  const char* authEnv = std::getenv(cond::auth::COND_AUTH_PATH);
83  if (authEnv) {
84  authPath += authEnv;
85  }
86  }
87  int authSys = m_authSys;
88  // first attempt, look at the env...
89  const char* authSysEnv = std::getenv(cond::auth::COND_AUTH_SYS);
90  if (authSysEnv) {
91  authSys = ::atoi(authSysEnv);
92  }
93  if (authSys != CondDbKey && authSys != CoralXMLFile) {
94  // take the default
95  authSys = CondDbKey;
96  }
97  std::string servName("");
98  if (authSys == CondDbKey) {
99  if (authPath.empty()) {
100  const char* authEnv = std::getenv("HOME");
101  if (authEnv) {
102  authPath += authEnv;
103  }
104  }
105  servName = "COND/Services/RelationalAuthenticationService";
106  } else if (authSys == CoralXMLFile) {
107  if (authPath.empty()) {
108  authPath = ".";
109  }
110  servName = "COND/Services/XMLAuthenticationService";
111  }
112  if (!authPath.empty()) {
113  authServiceName = servName;
114  coral::Context::instance().PropertyManager().property(cond::auth::COND_AUTH_PATH_PROPERTY)->set(authPath);
115  coral::Context::instance().loadComponent(authServiceName, m_pluginManager);
116  }
117 
118  coralConfig.setAuthenticationService(authServiceName);
119  }
static PFTauRenderPlugin instance
static constexpr const char *const COND_AUTH_PATH
Definition: Auth.h:10
static constexpr const char *const COND_AUTH_PATH_PROPERTY
Definition: Auth.h:27
static constexpr const char *const COND_AUTH_SYS
Definition: Auth.h:11
cond::CoralServiceManager * m_pluginManager
std::shared_ptr< coral::ISessionProxy > cond::persistency::ConnectionPool::createCoralSession ( const std::string &  connectionString,
bool  writeCapable = false 
)
std::shared_ptr< coral::ISessionProxy > cond::persistency::ConnectionPool::createCoralSession ( const std::string &  connectionString,
const std::string &  transactionId,
bool  writeCapable = false 
)
private

Definition at line 126 of file ConnectionPool.cc.

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

128  {
129  coral::ConnectionService connServ;
130  //all sessions opened with this connection service will share the same frontier security option.
131  std::pair<std::string, std::string> fullConnectionPars =
133  if (!fullConnectionPars.second.empty()) {
134  //all sessions opened with this connection service will share the same TTL settings for TAG, IOV, and PAYLOAD tables.
135  connServ.webCacheControl().setTableTimeToLive(fullConnectionPars.second, TAG::tname, 1);
136  connServ.webCacheControl().setTableTimeToLive(fullConnectionPars.second, IOV::tname, 1);
137  connServ.webCacheControl().setTableTimeToLive(fullConnectionPars.second, PAYLOAD::tname, 3);
138  }
139 
140  return std::shared_ptr<coral::ISessionProxy>(
141  connServ.connect(fullConnectionPars.first,
143  writeCapable ? coral::Update : coral::ReadOnly));
144  }
static char const * tname
Definition: IOVSchema.h:66
static char const * tname
Definition: IOVSchema.h:13
static constexpr const char *const COND_READER_ROLE
Definition: Auth.h:17
std::pair< std::string, std::string > getConnectionParams(const std::string &connectionString, const std::string &transactionId, const std::string &signature)
static constexpr const char *const COND_WRITER_ROLE
Definition: Auth.h:16
static char const * tname
Definition: IOVSchema.h:103
Session cond::persistency::ConnectionPool::createReadOnlySession ( const std::string &  connectionString,
const std::string &  transactionId 
)

Definition at line 158 of file ConnectionPool.cc.

References createSession().

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

159  {
160  return createSession(connectionString, transactionId);
161  }
Session createSession(const std::string &connectionString, bool writeCapable=false)
Session cond::persistency::ConnectionPool::createSession ( const std::string &  connectionString,
bool  writeCapable = false 
)
Session cond::persistency::ConnectionPool::createSession ( const std::string &  connectionString,
const std::string &  transactionId,
bool  writeCapable = false 
)
private

Definition at line 146 of file ConnectionPool.cc.

References createCoralSession().

148  {
149  std::shared_ptr<coral::ISessionProxy> coralSession =
150  createCoralSession(connectionString, transactionId, writeCapable);
151  return Session(std::make_shared<SessionImpl>(coralSession, connectionString));
152  }
std::shared_ptr< coral::ISessionProxy > createCoralSession(const std::string &connectionString, bool writeCapable=false)
bool cond::persistency::ConnectionPool::isLoggingEnabled ( ) const

Definition at line 70 of file ConnectionPool.cc.

References m_loggingEnabled.

void cond::persistency::ConnectionPool::setAuthenticationPath ( const std::string &  p)
void cond::persistency::ConnectionPool::setAuthenticationSystem ( int  authSysCode)
void cond::persistency::ConnectionPool::setFrontierSecurity ( const std::string &  signature)

Definition at line 36 of file ConnectionPool.cc.

References m_frontierSecurity, and signature.

Referenced by setParameters().

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
void cond::persistency::ConnectionPool::setLogging ( bool  flag)
void cond::persistency::ConnectionPool::setMessageVerbosity ( coral::MsgLevel  level)
void cond::persistency::ConnectionPool::setParameters ( const edm::ParameterSet connectionPset)

Definition at line 40 of file ConnectionPool.cc.

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

Referenced by BeamSpotRcdPrinter::BeamSpotRcdPrinter(), CondDBESSource::CondDBESSource(), cond::service::PoolDBOutputService::PoolDBOutputService(), 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().

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

Member Data Documentation

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

Definition at line 59 of file ConnectionPool.h.

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

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

Definition at line 60 of file ConnectionPool.h.

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

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

Definition at line 68 of file ConnectionPool.h.

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

Definition at line 65 of file ConnectionPool.h.

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

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

Definition at line 62 of file ConnectionPool.h.

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

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

Definition at line 61 of file ConnectionPool.h.

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

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

Definition at line 67 of file ConnectionPool.h.

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