ConnectionPool

DbAuthenticationSystem

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
#ifndef ConditionDatabase_ConnectionPool_h
#define ConditionDatabase_ConnectionPool_h

#include "CondCore/CondDB/interface/Session.h"
//
#include <string>
#include <memory>
//
#include "CoralBase/MessageStream.h"

namespace edm {
  class ParameterSet;
}

namespace coral {
  class IConnectionServiceConfiguration;
  class ISessionProxy;
  class IMsgReporter;
}  // namespace coral

namespace cond {
  class CoralServiceManager;
}

namespace cond {

  namespace persistency {
    //
    class CoralMsgReporter;
    class Logger;

    enum DbAuthenticationSystem { UndefinedAuthentication = 0, CondDbKey, CoralXMLFile };

    // a wrapper for the coral connection service.
    class ConnectionPool {
    public:
      ConnectionPool();
      ~ConnectionPool();

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

    private:
      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);
      void configure(coral::IConnectionServiceConfiguration& coralConfig);

    private:
      std::string m_authPath = std::string("");
      int m_authSys = 0;
      std::string m_authenticationService = std::string("");
      coral::MsgLevel m_messageLevel = coral::Error;
      int m_connectionTimeout = 0;
      CoralMsgReporter* m_msgReporter = nullptr;
      bool m_loggingEnabled = false;
      //The frontier security option is turned on for all sessions
      //usig this wrapper of the CORAL connection setup for configuring the server access
      std::string m_frontierSecurity = std::string("");
      // this one has to be moved!
      cond::CoralServiceManager* m_pluginManager = nullptr;
    };
  }  // namespace persistency
}  // namespace cond

#endif