Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:00:05

0001 #ifndef hcal_ConfigurationDatabaseImpl_hh_included
0002 #define hcal_ConfigurationDatabaseImpl_hh_included 1
0003 
0004 #include <string>
0005 #include <vector>
0006 #include <map>
0007 #include "CaloOnlineTools/HcalOnlineDb/interface/ConfigurationDatabaseException.hh"
0008 #include "CaloOnlineTools/HcalOnlineDb/interface/PluginManager.hh"
0009 #include "CaloOnlineTools/HcalOnlineDb/interface/ConfigurationDatabase.hh"
0010 
0011 #ifdef HAVE_XDAQ
0012 #include "log4cplus/logger.h"
0013 #else
0014 #include "CaloOnlineTools/HcalOnlineDb/interface/xdaq_compat.h"  // Includes typedef for log4cplus::Logger
0015 #endif
0016 
0017 //OCCI include
0018 #include "OnlineDB/Oracle/interface/Oracle.h"
0019 
0020 namespace hcal {
0021 
0022   /** \brief Implementation of an accessor to the configuration database.
0023 
0024    Accessors look like: 
0025      method://[user@]host[:port]/[database]?KEY=VALUE,...
0026      \ingroup hcalBase
0027   */
0028   class ConfigurationDatabaseImpl : public hcal::Pluggable {
0029   public:
0030     ConfigurationDatabaseImpl();
0031     /** \brief Set logger */
0032     void setLogger(log4cplus::Logger logger) { m_logger = logger; }
0033     /** \brief Static method to parse an accessor into various fields */
0034     static void parseAccessor(const std::string& accessor,
0035                               std::string& method,
0036                               std::string& host,
0037                               std::string& port,
0038                               std::string& user,
0039                               std::string& db,
0040                               std::map<std::string, std::string>& params);
0041     /** \brief Used by the Application to determine which implementation to use for a given accessor */
0042     virtual bool canHandleMethod(const std::string& method) const = 0;
0043     /** \brief Connect to the database using the given accessor */
0044     virtual void connect(const std::string& accessor) noexcept(false) = 0;
0045     /** \brief Disconnect from the database */
0046     virtual void disconnect() = 0;
0047 
0048     /* Various requests (default for all is to throw an exception indicating that no implementation is available. */
0049     virtual std::vector<std::string> getValidTags() noexcept(false);
0050     virtual ConfigurationDatabase::ApplicationConfig getApplicationConfig(const std::string& tag,
0051                                                                           const std::string& classname,
0052                                                                           int instance) noexcept(false);
0053     virtual std::string getConfigurationDocument(const std::string& tag) noexcept(false);
0054     /** \brief Retrieve the checksum for a given firmware version */
0055     virtual unsigned int getFirmwareChecksum(const std::string& board, unsigned int version) noexcept(false);
0056     /** \brief Retrieve the MCS file lines for a given firmware version */
0057     virtual void getFirmwareMCS(const std::string& board,
0058                                 unsigned int version,
0059                                 std::vector<std::string>& mcsLines) noexcept(false);
0060     virtual void getLUTs(const std::string& tag,
0061                          int crate,
0062                          int slot,
0063                          std::map<ConfigurationDatabase::LUTId, ConfigurationDatabase::LUT>& LUTs) noexcept(false);
0064     virtual void getLUTChecksums(
0065         const std::string& tag,
0066         std::map<ConfigurationDatabase::LUTId, ConfigurationDatabase::MD5Fingerprint>& checksums) noexcept(false);
0067     virtual void getPatterns(
0068         const std::string& tag,
0069         int crate,
0070         int slot,
0071         std::map<ConfigurationDatabase::PatternId, ConfigurationDatabase::HTRPattern>& patterns) noexcept(false);
0072     virtual void getZSThresholds(const std::string& tag,
0073                                  int crate,
0074                                  int slot,
0075                                  std::map<ConfigurationDatabase::ZSChannelId, int>& thresholds) noexcept(false);
0076     virtual void getHLXMasks(
0077         const std::string& tag,
0078         int crate,
0079         int slot,
0080         std::map<ConfigurationDatabase::FPGAId, ConfigurationDatabase::HLXMasks>& masks) noexcept(false);
0081     virtual void getRBXdata(
0082         const std::string& tag,
0083         const std::string& rbx,
0084         ConfigurationDatabase::RBXdatumType dtype,
0085         std::map<ConfigurationDatabase::RBXdatumId, ConfigurationDatabase::RBXdatum>& RBXdata) noexcept(false);
0086     virtual void getRBXpatterns(
0087         const std::string& tag,
0088         const std::string& rbx,
0089         std::map<ConfigurationDatabase::RBXdatumId, ConfigurationDatabase::RBXpattern>& patterns) noexcept(false);
0090 
0091     // added by Gena Kukartsev
0092     virtual oracle::occi::Connection* getConnection(void);
0093     virtual oracle::occi::Environment* getEnvironment(void);
0094 
0095   protected:
0096     log4cplus::Logger m_logger;
0097   };
0098 
0099 }  // namespace hcal
0100 
0101 #endif  // hcal_ConfigurationDatabaseImpl_hh_included