File indexing completed on 2023-03-17 10:44:52
0001 #include "CaloOnlineTools/HcalOnlineDb/interface/ConfigurationDatabaseImpl.hh"
0002
0003 #ifndef HAVE_XDAQ
0004 #include "CaloOnlineTools/HcalOnlineDb/interface/xdaq_compat.h" // Includes typedef for log4cplus::Logger
0005 #endif
0006
0007 #include <iostream> // std::cout
0008
0009 namespace hcal {
0010
0011 ConfigurationDatabaseImpl::ConfigurationDatabaseImpl() : m_logger(&std::cout) {}
0012
0013 void ConfigurationDatabaseImpl::parseAccessor(const std::string& accessor,
0014 std::string& method,
0015 std::string& host,
0016 std::string& port,
0017 std::string& user,
0018 std::string& db,
0019 std::map<std::string, std::string>& params) {
0020 std::string::size_type start, end;
0021
0022 method.clear();
0023 host.clear();
0024 port.clear();
0025 user.clear();
0026 db.clear();
0027 params.clear();
0028
0029 if (accessor.empty())
0030 return;
0031
0032
0033 start = 0;
0034 end = accessor.find("://");
0035 if (end == std::string::npos)
0036 return;
0037
0038 method = accessor.substr(start, end - start);
0039 start = end + 3;
0040
0041 end = accessor.find('@', start);
0042 if (end != std::string::npos) {
0043 user = accessor.substr(start, end - start);
0044 start = end + 1;
0045 }
0046
0047 end = accessor.find(':', start);
0048 if (end != std::string::npos) {
0049 host = accessor.substr(start, end - start);
0050 start = end + 1;
0051 }
0052
0053 end = accessor.find('/', start);
0054 if (end == std::string::npos)
0055 return;
0056 if (host.empty())
0057 host = accessor.substr(start, end - start);
0058 else
0059 port = accessor.substr(start, end - start);
0060 start = end + 1;
0061
0062 end = accessor.find('?', start);
0063 if (end == std::string::npos) {
0064 db = accessor.substr(start);
0065 return;
0066 } else
0067 db = accessor.substr(start, end - start);
0068 start = end;
0069
0070
0071 std::string pname, pvalue;
0072 while (start != std::string::npos) {
0073 start += 1;
0074 end = accessor.find('=', start);
0075 if (end == std::string::npos)
0076 break;
0077 pname = accessor.substr(start, end - start);
0078 start = end + 1;
0079 end = accessor.find_first_of(",&", start);
0080 if (end == std::string::npos) {
0081 pvalue = accessor.substr(start);
0082 } else {
0083 pvalue = accessor.substr(start, end - start);
0084 }
0085 params[pname] = pvalue;
0086 start = end;
0087 }
0088 }
0089
0090 std::vector<std::string> ConfigurationDatabaseImpl::getValidTags() noexcept(false) {
0091 XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
0092 }
0093 ConfigurationDatabase::ApplicationConfig ConfigurationDatabaseImpl::getApplicationConfig(
0094 const std::string& tag, const std::string& classname, int instance) noexcept(false) {
0095 XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
0096 }
0097
0098 std::string ConfigurationDatabaseImpl::getConfigurationDocument(const std::string& tag) noexcept(false) {
0099 XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
0100 }
0101
0102 unsigned int ConfigurationDatabaseImpl::getFirmwareChecksum(const std::string& board,
0103 unsigned int version) noexcept(false) {
0104 XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
0105 }
0106
0107 void ConfigurationDatabaseImpl::getFirmwareMCS(const std::string& board,
0108 unsigned int version,
0109 std::vector<std::string>& mcsLines) noexcept(false) {
0110 XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
0111 }
0112 void ConfigurationDatabaseImpl::getLUTs(
0113 const std::string& tag,
0114 int crate,
0115 int slot,
0116 std::map<ConfigurationDatabase::LUTId, ConfigurationDatabase::LUT>& LUTs) noexcept(false) {
0117 XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
0118 }
0119 void ConfigurationDatabaseImpl::getLUTChecksums(
0120 const std::string& tag,
0121 std::map<ConfigurationDatabase::LUTId, ConfigurationDatabase::MD5Fingerprint>& checksums) noexcept(false) {
0122 XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
0123 }
0124 void ConfigurationDatabaseImpl::getPatterns(
0125 const std::string& tag,
0126 int crate,
0127 int slot,
0128 std::map<ConfigurationDatabase::PatternId, ConfigurationDatabase::HTRPattern>& patterns) noexcept(false) {
0129 XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
0130 }
0131 void ConfigurationDatabaseImpl::getZSThresholds(
0132 const std::string& tag,
0133 int crate,
0134 int slot,
0135 std::map<ConfigurationDatabase::ZSChannelId, int>& thresholds) noexcept(false) {
0136 XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
0137 }
0138 void ConfigurationDatabaseImpl::getHLXMasks(
0139 const std::string& tag,
0140 int crate,
0141 int slot,
0142 std::map<ConfigurationDatabase::FPGAId, ConfigurationDatabase::HLXMasks>& masks) noexcept(false) {
0143 XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
0144 }
0145 void ConfigurationDatabaseImpl::getRBXdata(
0146 const std::string& tag,
0147 const std::string& rbx,
0148 ConfigurationDatabase::RBXdatumType dtype,
0149 std::map<ConfigurationDatabase::RBXdatumId, ConfigurationDatabase::RBXdatum>& RBXdata) noexcept(false) {
0150 XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
0151 }
0152 void ConfigurationDatabaseImpl::getRBXpatterns(
0153 const std::string& tag,
0154 const std::string& rbx,
0155 std::map<ConfigurationDatabase::RBXdatumId, ConfigurationDatabase::RBXpattern>& patterns) noexcept(false) {
0156 XCEPT_RAISE(hcal::exception::ConfigurationDatabaseException, "Not implemented");
0157 }
0158
0159
0160 oracle::occi::Connection* ConfigurationDatabaseImpl::getConnection(void) { return nullptr; }
0161
0162 oracle::occi::Environment* ConfigurationDatabaseImpl::getEnvironment(void) { return nullptr; }
0163
0164 }