Go to the documentation of this file.00001 #ifndef COND_DBCommon_DbConnectionConfiguration_h
00002 #define COND_DBCommon_DbConnectionConfiguration_h
00003
00004
00005
00006
00010
00011
00012 #include <string>
00013
00014 #include "CoralBase/MessageStream.h"
00015 #include "RelationalAccess/IMonitoring.h"
00016
00017 namespace coral {
00018 class IConnectionServiceConfiguration;
00019 }
00020
00021 namespace edm{
00022 class ParameterSet;
00023 }
00024
00025 namespace cond{
00026 class CoralServiceManager;
00027
00028 enum DbConfigurationDefaults { CoralDefaults, CmsDefaults, ProdDefaults, ToolDefaults, WebDefaults};
00029
00030 enum DbAuthenticationSystem { UndefinedAuthentication=0,CondDbKey, CoralXMLFile };
00031
00032 class DbConnectionConfiguration{
00033 public:
00034 static std::vector<DbConnectionConfiguration>& defaultConfigurations();
00035 public:
00036 DbConnectionConfiguration();
00037 DbConnectionConfiguration( bool connectionSharing,
00038 int connectionTimeOut,
00039 bool readOnlySessionOnUpdateConnections,
00040 int connectionRetrialPeriod,
00041 int connectionRetrialTimeOut,
00042 bool poolAutomaticCleanUp,
00043 const std::string& authenticationPath,
00044 const std::string& transactionId,
00045 coral::MsgLevel msgLev,
00046 coral::monitor::Level monitorLev,
00047 bool SQLMonitoring );
00048
00049 DbConnectionConfiguration( const DbConnectionConfiguration& rhs);
00050 ~DbConnectionConfiguration();
00051 DbConnectionConfiguration& operator=( const DbConnectionConfiguration& rhs);
00052
00053 void setParameters( const edm::ParameterSet& connectionPset );
00054
00055 void setConnectionSharing( bool flag );
00056 void setConnectionTimeOut( int timeOut );
00057 void setReadOnlySessionOnUpdateConnections( bool flag );
00058 void setConnectionRetrialPeriod( int period );
00059 void setConnectionRetrialTimeOut( int timeout );
00060 void setPoolAutomaticCleanUp( bool flag );
00061
00062 void setAuthenticationPath( const std::string& p );
00063 void setAuthenticationSystem( int authSysCode );
00064
00065 void setTransactionId( std::string const & tid);
00066
00067 void setMessageLevel( coral::MsgLevel l );
00068
00069 void setMonitoringLevel( coral::monitor::Level l );
00070
00071 void setSQLMonitoring( bool flag );
00072
00073 void configure( coral::IConnectionServiceConfiguration& coralConfig) const;
00074
00075 bool isConnectionSharingEnabled() const;
00076 int connectionTimeOut() const;
00077 bool isReadOnlySessionOnUpdateConnectionEnabled() const;
00078 int connectionRetrialPeriod() const;
00079 int connectionRetrialTimeOut() const;
00080 bool isPoolAutomaticCleanUpEnabled() const;
00081 const std::string& authenticationPath() const;
00082 const std::string& transactionId() const;
00083 coral::MsgLevel messageLevel() const;
00084 bool isSQLMonitoringEnabled() const;
00085 private:
00086 std::pair<bool,bool> m_connectionSharing;
00087 std::pair<bool,int> m_connectionTimeOut;
00088 std::pair<bool,bool> m_readOnlySessionOnUpdateConnections;
00089 std::pair<bool,int> m_connectionRetrialPeriod;
00090 std::pair<bool,int> m_connectionRetrialTimeOut;
00091 std::pair<bool,bool> m_poolAutomaticCleanUp;
00092 std::string m_authPath;
00093 int m_authSys;
00094 std::string m_transactionId;
00095 coral::MsgLevel m_messageLevel;
00096 coral::monitor::Level m_monitoringLevel;
00097
00098
00099 bool m_SQLMonitoring;
00100 CoralServiceManager* m_pluginManager;
00101 };
00102 }
00103 #endif