File indexing completed on 2024-04-06 12:01:24
0001 #ifndef ConditionDatabase_ConnectionPool_h
0002 #define ConditionDatabase_ConnectionPool_h
0003
0004 #include "CondCore/CondDB/interface/Session.h"
0005
0006 #include <string>
0007 #include <memory>
0008
0009 #include "CoralBase/MessageStream.h"
0010
0011 namespace edm {
0012 class ParameterSet;
0013 }
0014
0015 namespace coral {
0016 class IConnectionServiceConfiguration;
0017 class ISessionProxy;
0018 class IMsgReporter;
0019 }
0020
0021 namespace cond {
0022 class CoralServiceManager;
0023 }
0024
0025 namespace cond {
0026
0027 namespace persistency {
0028
0029 class CoralMsgReporter;
0030 class Logger;
0031
0032 enum DbAuthenticationSystem { UndefinedAuthentication = 0, CondDbKey, CoralXMLFile };
0033
0034
0035 class ConnectionPool {
0036 public:
0037 ConnectionPool();
0038 ~ConnectionPool();
0039
0040 void setMessageVerbosity(coral::MsgLevel level);
0041 void setLogDestination(Logger& logger);
0042 void setAuthenticationPath(const std::string& p);
0043 void setAuthenticationSystem(int authSysCode);
0044 void setFrontierSecurity(const std::string& signature);
0045 void setLogging(bool flag);
0046 void setConnectionTimeout(int seconds);
0047 bool isLoggingEnabled() const;
0048 void setParameters(const edm::ParameterSet& connectionPset);
0049 void configure();
0050 Session createSession(const std::string& connectionString, bool writeCapable = false);
0051 Session createReadOnlySession(const std::string& connectionString, const std::string& transactionId);
0052 std::shared_ptr<coral::ISessionProxy> createCoralSession(const std::string& connectionString,
0053 bool writeCapable = false);
0054
0055 private:
0056 std::shared_ptr<coral::ISessionProxy> createCoralSession(const std::string& connectionString,
0057 const std::string& transactionId,
0058 bool writeCapable = false);
0059 Session createSession(const std::string& connectionString,
0060 const std::string& transactionId,
0061 bool writeCapable = false);
0062 void configure(coral::IConnectionServiceConfiguration& coralConfig);
0063
0064 private:
0065 std::string m_authPath = std::string("");
0066 int m_authSys = 0;
0067 std::string m_authenticationService = std::string("");
0068 coral::MsgLevel m_messageLevel = coral::Error;
0069 int m_connectionTimeout = 0;
0070 CoralMsgReporter* m_msgReporter = nullptr;
0071 bool m_loggingEnabled = false;
0072
0073
0074 std::string m_frontierSecurity = std::string("");
0075
0076 cond::CoralServiceManager* m_pluginManager = nullptr;
0077 };
0078 }
0079 }
0080
0081 #endif