CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/CondCore/DBCommon/interface/DbConnectionConfiguration.h

Go to the documentation of this file.
00001 #ifndef COND_DBCommon_DbConnectionConfiguration_h
00002 #define COND_DBCommon_DbConnectionConfiguration_h
00003 //
00004 // Package:    CondCore/DBCommon
00005 // Class:      DbConnectionConfiguration
00006 //
00010 //
00011 //
00012 #include <string>
00013 // coral includes
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   class DbConnectionConfiguration{
00031   public:
00032     static std::vector<DbConnectionConfiguration>& defaultConfigurations();
00033   public:
00034     DbConnectionConfiguration();
00035     DbConnectionConfiguration( bool connectionSharing,
00036                                int connectionTimeOut,
00037                                bool readOnlySessionOnUpdateConnections,
00038                                int connectionRetrialPeriod,
00039                                int connectionRetrialTimeOut,
00040                                bool poolAutomaticCleanUp,
00041                                const std::string& authenticationPath,
00042                                const std::string& transactionId,        
00043                                coral::MsgLevel msgLev,
00044                                coral::monitor::Level monitorLev,
00045                                bool SQLMonitoring );
00046 
00047     DbConnectionConfiguration( const DbConnectionConfiguration& rhs);
00048     ~DbConnectionConfiguration();
00049     DbConnectionConfiguration& operator=( const DbConnectionConfiguration& rhs);
00050     // configuration from edm parameter set
00051     void setParameters( const edm::ParameterSet& connectionPset );
00052     // configuration for individual connection parameters
00053     void setConnectionSharing( bool flag );
00054     void setConnectionTimeOut( int timeOut );
00055     void setReadOnlySessionOnUpdateConnections( bool flag );
00056     void setConnectionRetrialPeriod( int period );
00057     void setConnectionRetrialTimeOut( int timeout );
00058     void setPoolAutomaticCleanUp( bool flag );
00059     // authentication 
00060     void setAuthenticationPath( const std::string& p );
00061     // transaction Id for multijob (used by frontier)
00062     void setTransactionId( std::string const & tid);
00063     // message level
00064     void setMessageLevel( coral::MsgLevel l );
00065     // monitoring level
00066     void setMonitoringLevel( coral::monitor::Level l );    
00067     // SQL monitoring
00068     void setSQLMonitoring( bool flag );
00069     // force the coral configuration
00070     void configure( coral::IConnectionServiceConfiguration& coralConfig) const;
00071     // getters
00072     bool isConnectionSharingEnabled() const;
00073     int connectionTimeOut() const;
00074     bool isReadOnlySessionOnUpdateConnectionEnabled() const;
00075     int connectionRetrialPeriod() const;
00076     int connectionRetrialTimeOut() const;
00077     bool isPoolAutomaticCleanUpEnabled() const;
00078     const std::string& authenticationPath() const;
00079     const std::string& transactionId() const;
00080     coral::MsgLevel messageLevel() const;
00081     bool isSQLMonitoringEnabled() const;
00082     private:
00083     std::pair<bool,bool> m_connectionSharing;
00084     std::pair<bool,int> m_connectionTimeOut;
00085     std::pair<bool,bool> m_readOnlySessionOnUpdateConnections;
00086     std::pair<bool,int> m_connectionRetrialPeriod;
00087     std::pair<bool,int> m_connectionRetrialTimeOut;
00088     std::pair<bool,bool> m_poolAutomaticCleanUp;
00089     std::string m_authPath;
00090     std::string m_transactionId;
00091     coral::MsgLevel m_messageLevel;
00092     coral::monitor::Level m_monitoringLevel;  
00093     //int m_idleConnectionCleanupPeriod;
00094 
00095     bool m_SQLMonitoring;
00096     CoralServiceManager* m_pluginManager;    
00097   };
00098 }
00099 #endif