CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
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 setLogging (bool flag)
 
void setMessageVerbosity (coral::MsgLevel level)
 
void setParameters (const edm::ParameterSet &connectionPset)
 
 ~ConnectionPool ()
 

Private Member Functions

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

Private Attributes

std::string m_authPath
 
int m_authSys = 0
 
bool m_loggingEnabled = false
 
coral::MsgLevel m_messageLevel = coral::Info
 
cond::CoralServiceManagerm_pluginManager = 0
 
std::vector< std::string > m_refreshtablelist
 

Detailed Description

Definition at line 29 of file ConnectionPool.h.

Constructor & Destructor Documentation

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

Definition at line 23 of file ConnectionPool.cc.

References configure(), and m_refreshtablelist.

23  :
24  m_authPath(),
25  m_authSys(0),
26  m_messageLevel( coral::Error ),
27  m_loggingEnabled( false ),
30  m_refreshtablelist.reserve(6);
31  //table names for IOVSequence in the old POOL mapping
32  m_refreshtablelist.push_back("IOV");
33  m_refreshtablelist.push_back("IOV_DATA");
34  //table names for IOVSequence in ORA
35  m_refreshtablelist.push_back("ORA_C_COND_IOVSEQUENCE");
36  m_refreshtablelist.push_back("ORA_C_COND_IOVSEQU_A0");
37  m_refreshtablelist.push_back("ORA_C_COND_IOVSEQU_A1");
38  //table names for IOVSequence in CONDDB
39  m_refreshtablelist.push_back("TAG");
40  configure();
41  }
cond::CoralServiceManager * m_pluginManager
std::vector< std::string > m_refreshtablelist
cond::persistency::ConnectionPool::~ConnectionPool ( )

Definition at line 43 of file ConnectionPool.cc.

References m_pluginManager.

43  {
44  delete m_pluginManager;
45  }
cond::CoralServiceManager * m_pluginManager

Member Function Documentation

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

Definition at line 137 of file ConnectionPool.cc.

Referenced by CondDBESSource::CondDBESSource(), ConnectionPool(), DTKeyedConfigHandler::getNewObjects(), and DTUserKeyedConfigHandler::getNewObjects().

137  {
138  coral::ConnectionService connServ;
139  configure( connServ.configuration() );
140  }
void cond::persistency::ConnectionPool::configure ( coral::IConnectionServiceConfiguration &  coralConfig)
private

Definition at line 88 of file ConnectionPool.cc.

References builder_last_value_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.

88  {
89 
90  coralConfig.disablePoolAutomaticCleanUp();
91  coralConfig.disableConnectionSharing();
92  // message streaming
93  coral::MessageStream::setMsgVerbosity( m_messageLevel );
94  std::string authServiceName("CORAL/Services/EnvironmentAuthenticationService");
96  // authentication
97  if( authPath.empty() ){
98  // first try to check the env...
99  const char* authEnv = ::getenv( cond::Auth::COND_AUTH_PATH );
100  if(authEnv){
101  authPath += authEnv;
102  }
103  }
104  int authSys = m_authSys;
105  // first attempt, look at the env...
106  const char* authSysEnv = ::getenv( cond::Auth::COND_AUTH_SYS );
107  if( authSysEnv ){
108  authSys = ::atoi( authSysEnv );
109  }
110  if( authSys !=CondDbKey && authSys != CoralXMLFile ){
111  // take the default
112  authSys = CondDbKey;
113  }
114  std::string servName("");
115  if( authSys == CondDbKey ){
116  if( authPath.empty() ){
117  const char* authEnv = ::getenv("HOME");
118  if(authEnv){
119  authPath += authEnv;
120  }
121  }
122  servName = "COND/Services/RelationalAuthenticationService";
123  } else if( authSys == CoralXMLFile ){
124  if( authPath.empty() ){
125  authPath = ".";
126  }
127  servName = "COND/Services/XMLAuthenticationService";
128  }
129  if( !authPath.empty() ){
130  authServiceName = servName;
131  coral::Context::instance().PropertyManager().property(cond::Auth::COND_AUTH_PATH_PROPERTY)->set(authPath);
132  coral::Context::instance().loadComponent( authServiceName, m_pluginManager );
133  }
134  coralConfig.setAuthenticationService( authServiceName );
135  }
static PFTauRenderPlugin instance
static const std::string COND_AUTH_PATH_PROPERTY
Definition: Auth.h:27
static const char * COND_AUTH_SYS
Definition: Auth.h:13
static const char * COND_AUTH_PATH
Definition: Auth.h:12
cond::CoralServiceManager * m_pluginManager
Session cond::persistency::ConnectionPool::createReadOnlySession ( const std::string &  connectionString,
const std::string &  transactionId 
)

Definition at line 157 of file ConnectionPool.cc.

References createSession().

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

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

Definition at line 153 of file ConnectionPool.cc.

Referenced by createReadOnlySession(), CondDBESSource::fillTagCollectionFromGT(), DTKeyedConfigHandler::getNewObjects(), and DTUserKeyedConfigHandler::getNewObjects().

153  {
154  return createSession( connectionString, "", writeCapable );
155  }
Session 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 142 of file ConnectionPool.cc.

References cond::persistency::getRealConnectionString(), and m_refreshtablelist.

142  {
143  coral::ConnectionService connServ;
144  std::pair<std::string,std::string> fullConnectionPars = getRealConnectionString( connectionString, transactionId );
145  if( !fullConnectionPars.second.empty() )
146  for( auto tableName : m_refreshtablelist ) connServ.webCacheControl().refreshTable( fullConnectionPars.second, tableName );
147 
148  boost::shared_ptr<coral::ISessionProxy> coralSession( connServ.connect( fullConnectionPars.first,
149  writeCapable?coral::Update:coral::ReadOnly ) );
150  return Session( coralSession, connectionString );
151  }
std::pair< std::string, std::string > getRealConnectionString(const std::string &initialConnection)
std::vector< std::string > m_refreshtablelist
bool cond::persistency::ConnectionPool::isLoggingEnabled ( ) const

Definition at line 84 of file ConnectionPool.cc.

References m_loggingEnabled.

84  {
85  return m_loggingEnabled;
86  }
void cond::persistency::ConnectionPool::setAuthenticationPath ( const std::string &  p)
void cond::persistency::ConnectionPool::setAuthenticationSystem ( int  authSysCode)

Definition at line 51 of file ConnectionPool.cc.

References m_authSys.

Referenced by setParameters().

51  {
52  m_authSys = authSysCode;
53  }
void cond::persistency::ConnectionPool::setLogging ( bool  flag)

Definition at line 55 of file ConnectionPool.cc.

References m_loggingEnabled.

Referenced by setParameters().

55  {
56  m_loggingEnabled = flag;
57  }
void cond::persistency::ConnectionPool::setMessageVerbosity ( coral::MsgLevel  level)

Definition at line 160 of file ConnectionPool.cc.

References testEve_cfg::level, and m_messageLevel.

Referenced by setParameters().

160  {
162  }
tuple level
Definition: testEve_cfg.py:34
void cond::persistency::ConnectionPool::setParameters ( const edm::ParameterSet connectionPset)

Definition at line 59 of file ConnectionPool.cc.

References Debug, edm::ParameterSet::getUntrackedParameter(), testEve_cfg::level, setAuthenticationPath(), setAuthenticationSystem(), setLogging(), setMessageVerbosity(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by CondDBESSource::CondDBESSource(), and cond::service::PoolDBOutputService::PoolDBOutputService().

59  {
60  setAuthenticationPath( connectionPset.getUntrackedParameter<std::string>("authenticationPath","") );
61  setAuthenticationSystem( connectionPset.getUntrackedParameter<int>("authenticationSystem",0) );
62  int messageLevel = connectionPset.getUntrackedParameter<int>("messageLevel",0);
63  coral::MsgLevel level = coral::Error;
64  switch (messageLevel) {
65  case 0 :
66  level = coral::Error;
67  break;
68  case 1:
69  level = coral::Warning;
70  break;
71  case 2:
72  level = coral::Info;
73  break;
74  case 3:
75  level = coral::Debug;
76  break;
77  default:
78  level = coral::Error;
79  }
80  setMessageVerbosity(level);
81  setLogging( connectionPset.getUntrackedParameter<bool>("logging",false) );
82  }
T getUntrackedParameter(std::string const &, T const &) const
void setAuthenticationSystem(int authSysCode)
void setMessageVerbosity(coral::MsgLevel level)
tuple level
Definition: testEve_cfg.py:34
void setAuthenticationPath(const std::string &p)
const bool Debug

Member Data Documentation

std::string cond::persistency::ConnectionPool::m_authPath
private

Definition at line 48 of file ConnectionPool.h.

Referenced by configure(), and setAuthenticationPath().

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

Definition at line 49 of file ConnectionPool.h.

Referenced by configure(), and setAuthenticationSystem().

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

Definition at line 51 of file ConnectionPool.h.

Referenced by isLoggingEnabled(), and setLogging().

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

Definition at line 50 of file ConnectionPool.h.

Referenced by configure(), and setMessageVerbosity().

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

Definition at line 53 of file ConnectionPool.h.

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

std::vector<std::string> cond::persistency::ConnectionPool::m_refreshtablelist
private

Definition at line 54 of file ConnectionPool.h.

Referenced by ConnectionPool(), and createSession().