#include <SiteLocalConfigService.h>
Public Member Functions | |
std::string const | dataCatalog (void) const |
unsigned int | debugLevel () const |
std::string const | fallbackDataCatalog (void) const |
std::string const | lookupCalibConnect (std::string const &input) const |
std::string const | rfioType (void) const |
SiteLocalConfigService (ParameterSet const &pset) | |
std::string const * | sourceCacheHint () const |
double const * | sourceCacheMinFree () const |
std::string const * | sourceCacheTempDir () const |
std::vector< std::string > const * | sourceNativeProtocols () const |
std::string const * | sourceReadHint () const |
unsigned int const * | sourceTimeout () const |
unsigned int const * | sourceTTreeCacheSize () const |
Static Public Member Functions | |
static void | fillDescriptions (ConfigurationDescriptions &descriptions) |
Private Member Functions | |
std::string const | frontierConnect (std::string const &servlet) const |
void | parse (std::string const &url) |
Private Attributes | |
std::string | m_cacheHint |
std::string const * | m_cacheHintPtr |
double | m_cacheMinFree |
double const * | m_cacheMinFreePtr |
std::string | m_cacheTempDir |
std::string const * | m_cacheTempDirPtr |
bool | m_connected |
std::string | m_dataCatalog |
unsigned int | m_debugLevel |
std::string | m_fallbackDataCatalog |
std::string | m_frontierConnect |
std::vector< std::string > | m_nativeProtocols |
std::vector< std::string > const * | m_nativeProtocolsPtr |
std::string | m_readHint |
std::string const * | m_readHintPtr |
std::string | m_rfioType |
unsigned int | m_timeout |
unsigned int const * | m_timeoutPtr |
unsigned int | m_ttreeCacheSize |
unsigned int const * | m_ttreeCacheSizePtr |
std::string | m_url |
Definition at line 23 of file SiteLocalConfigService.h.
edm::service::SiteLocalConfigService::SiteLocalConfigService | ( | ParameterSet const & | pset | ) | [explicit] |
Definition at line 97 of file SiteLocalConfigService.cc.
References edm::ParameterSet::exists(), edm::ParameterSet::getUntrackedParameter(), m_cacheHint, m_cacheHintPtr, m_cacheMinFree, m_cacheMinFreePtr, m_cacheTempDir, m_cacheTempDirPtr, m_debugLevel, m_nativeProtocols, m_nativeProtocolsPtr, m_readHint, m_readHintPtr, m_timeout, m_timeoutPtr, m_ttreeCacheSize, m_ttreeCacheSizePtr, m_url, parse(), and tmp.
: m_url("/SITECONF/local/JobConfig/site-local-config.xml"), m_dataCatalog(), m_fallbackDataCatalog(), m_frontierConnect(), m_rfioType("castor"), m_connected(false), m_cacheTempDir(), m_cacheTempDirPtr(0), m_cacheMinFree(), m_cacheMinFreePtr(0), m_cacheHint(), m_cacheHintPtr(0), m_readHint(), m_readHintPtr(0), m_ttreeCacheSize(0U), m_ttreeCacheSizePtr(0), m_timeout(0U), m_timeoutPtr(0), m_debugLevel(0U), m_nativeProtocols(), m_nativeProtocolsPtr(0) { char* tmp = getenv("CMS_PATH"); if (tmp) { m_url = tmp + m_url; } this->parse(m_url); //apply overrides overrideFromPSet("overrideSourceCacheTempDir", pset, m_cacheTempDir, m_cacheTempDirPtr); overrideFromPSet("overrideSourceCacheMinFree", pset, m_cacheMinFree, m_cacheMinFreePtr); overrideFromPSet("overrideSourceCacheHintDir", pset, m_cacheHint, m_cacheHintPtr); overrideFromPSet("overrideSourceReadHint", pset, m_readHint, m_readHintPtr); overrideFromPSet("overrideSourceNativeProtocols", pset, m_nativeProtocols, m_nativeProtocolsPtr); overrideFromPSet("overrideSourceTTreeCacheSize", pset, m_ttreeCacheSize, m_ttreeCacheSizePtr); overrideFromPSet("overrideSourceTimeout", pset, m_timeout, m_timeoutPtr); if(pset.exists("debugLevel")) { m_debugLevel = pset.getUntrackedParameter<unsigned int>("debugLevel"); } }
std::string const edm::service::SiteLocalConfigService::dataCatalog | ( | void | ) | const [virtual] |
Implements edm::SiteLocalConfig.
Definition at line 144 of file SiteLocalConfigService.cc.
References Exception, m_connected, m_dataCatalog, and m_url.
{ if (!m_connected) { //throw cms::Exception("Incomplete configuration") // << "Valid site-local-config not found at " << m_url; // Return PoolFileCatalog.xml for now return "file:PoolFileCatalog.xml"; } if (m_dataCatalog == "") { throw cms::Exception("Incomplete configuration") << "Did not find catalog in event-data section in " << m_url; } return m_dataCatalog; }
unsigned int edm::service::SiteLocalConfigService::debugLevel | ( | ) | const [virtual] |
Implements edm::SiteLocalConfig.
Definition at line 279 of file SiteLocalConfigService.cc.
References m_debugLevel.
{ return m_debugLevel; }
std::string const edm::service::SiteLocalConfigService::fallbackDataCatalog | ( | void | ) | const [virtual] |
Implements edm::SiteLocalConfig.
Definition at line 161 of file SiteLocalConfigService.cc.
References m_connected, and m_fallbackDataCatalog.
{ if (!m_connected) { //throw cms::Exception("Incomplete configuration") // << "Valid site-local-config not found at " << m_url; // Return PoolFileCatalog.xml for now return "file:PoolFileCatalog.xml"; } // Note: Unlike the dataCatalog, the fallbackDataCatalog may be empty! return m_fallbackDataCatalog; }
void edm::service::SiteLocalConfigService::fillDescriptions | ( | ConfigurationDescriptions & | descriptions | ) | [static] |
Definition at line 458 of file SiteLocalConfigService.cc.
References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::addOptionalUntracked(), and edm::ParameterSetDescription::setComment().
{ ParameterSetDescription desc; desc.setComment("Service to translate logical file names to physical file names."); desc.addOptionalUntracked<std::string>("overrideSourceCacheTempDir"); desc.addOptionalUntracked<double>("overrideSourceCacheMinFree"); desc.addOptionalUntracked<std::string>("overrideSourceCacheHintDir"); desc.addOptionalUntracked<std::string>("overrideSourceReadHint"); desc.addOptionalUntracked<std::vector<std::string> >("overrideSourceNativeProtocols"); desc.addOptionalUntracked<unsigned int>("overrideSourceTTreeCacheSize"); desc.addOptionalUntracked<unsigned int>("overrideSourceTimeout"); desc.addOptionalUntracked<unsigned int>("debugLevel"); descriptions.add("SiteLocalConfigService", desc); }
std::string const edm::service::SiteLocalConfigService::frontierConnect | ( | std::string const & | servlet | ) | const [private] |
Definition at line 174 of file SiteLocalConfigService.cc.
References Exception, m_connected, m_frontierConnect, and m_url.
Referenced by lookupCalibConnect(), and parse().
{ if (!m_connected) { throw cms::Exception("Incomplete configuration") << "Valid site-local-config not found at " << m_url; } if (m_frontierConnect == "") { throw cms::Exception("Incomplete configuration") << "Did not find frontier-connect in calib-data section in " << m_url; } if (servlet == "") { return m_frontierConnect; } // Replace the last component of every "serverurl=" piece (up to the // next close-paren) with the servlet std::string::size_type nextparen = 0; std::string::size_type serverurl, lastslash; std::string complexstr = ""; while ((serverurl = m_frontierConnect.find("(serverurl=", nextparen)) != std::string::npos) { complexstr.append(m_frontierConnect, nextparen, serverurl - nextparen); nextparen = m_frontierConnect.find(')', serverurl); lastslash = m_frontierConnect.rfind('/', nextparen); complexstr.append(m_frontierConnect, serverurl, lastslash - serverurl + 1); complexstr.append(servlet); } complexstr.append(m_frontierConnect, nextparen, m_frontierConnect.length()-nextparen); return complexstr; }
std::string const edm::service::SiteLocalConfigService::lookupCalibConnect | ( | std::string const & | input | ) | const [virtual] |
Implements edm::SiteLocalConfig.
Definition at line 207 of file SiteLocalConfigService.cc.
References frontierConnect(), and collect_tpl::input.
{ static std::string const proto = "frontier://"; if (input.substr(0,proto.length()) == proto) { // Replace the part after the frontier:// and before either an open- // parentheses (which indicates user-supplied options) or the last // slash (which indicates start of the schema) with the complex // parenthesized string returned from frontierConnect() (which // contains all the information needed to connect to frontier), // if that part is a simple servlet name (non-empty and not // containing special characters) // Example connect strings where servlet is replaced: // frontier://cms_conditions_data/CMS_COND_ECAL // frontier://FrontierInt/CMS_COND_ECAL // frontier://FrontierInt(retrieve-ziplevel=0)/CMS_COND_ECAL // Example connect strings left untouched: // frontier://cmsfrontier.cern.ch:8000/FrontierInt/CMS_COND_ECAL // frontier://(serverurl=cmsfrontier.cern.ch:8000/FrontierInt)/CMS_COND_ECAL std::string::size_type startservlet = proto.length(); // if user supplied extra parenthesized options, stop servlet there std::string::size_type endservlet = input.find("(", startservlet); if (endservlet == std::string::npos) { endservlet = input.rfind('/', input.length()); } std::string servlet = input.substr(startservlet, endservlet - startservlet); if ((servlet != "") && (servlet.find_first_of(":/)[]") == std::string::npos)) { if (servlet == "cms_conditions_data") { // use the default servlet from site-local-config.xml servlet = ""; } return proto + frontierConnect(servlet) + input.substr(endservlet); } } return input; }
void edm::service::SiteLocalConfigService::parse | ( | std::string const & | url | ) | [private] |
Definition at line 289 of file SiteLocalConfigService.cc.
References _toDOMS(), _toString(), validate_alignment_devdb10_cfg::catalog, asciidump::doc, alignCSCRings::e, frontierConnect(), i, m_cacheHint, m_cacheHintPtr, m_cacheMinFree, m_cacheMinFreePtr, m_cacheTempDir, m_cacheTempDirPtr, m_connected, m_dataCatalog, m_fallbackDataCatalog, m_frontierConnect, m_nativeProtocols, m_nativeProtocolsPtr, m_readHint, m_readHintPtr, m_rfioType, m_timeout, m_timeoutPtr, m_ttreeCacheSize, m_ttreeCacheSizePtr, and geometryXMLtoCSV::parser.
Referenced by SiteLocalConfigService().
{ XMLPlatformUtils::Initialize(); std::auto_ptr<XercesDOMParser> parser(new XercesDOMParser); try { parser->setValidationScheme(XercesDOMParser::Val_Auto); parser->setDoNamespaces(false); parser->parse(url.c_str()); DOMDocument* doc = parser->getDocument(); if (!doc) { return; } // The Site Config has the following format // <site-local-config> // <site name="FNAL"> // <event-data> // <catalog url="trivialcatalog_file:/x/y/z.xml"/> // <rfiotype value="castor"/> // </event-data> // <calib-data> // <catalog url="trivialcatalog_file:/x/y/z.xml"/> // <frontier-connect> // ... frontier-interpreted server/proxy xml ... // </frontier-connect> // </calib-data> // <source-config> // <cache-temp-dir name="/a/b/c"/> // <cache-hint value="..."/> // <read-hint value="..."/> // <ttree-cache-size value="0"/> // <native-protocols> // <protocol prefix="dcache"/> // <protocol prefix="file"/> // </native-protocols> // </source-config> // </site> // </site-local-config> // FIXME: should probably use the parser for validating the XML. DOMNodeList *sites = doc->getElementsByTagName(_toDOMS("site")); unsigned int numSites = sites->getLength(); for (unsigned int i = 0; i < numSites; ++i) { DOMElement *site = static_cast<DOMElement *>(sites->item(i)); // Parsing of the event data section { DOMNodeList *eventDataList = site->getElementsByTagName(_toDOMS("event-data")); if (eventDataList->getLength() > 0) { DOMElement *eventData = static_cast<DOMElement *>(eventDataList->item(0)); DOMNodeList *catalogs = eventData->getElementsByTagName(_toDOMS("catalog")); if (catalogs->getLength() > 0) { DOMElement * catalog = static_cast<DOMElement *>(catalogs->item(0)); m_dataCatalog = _toString(catalog->getAttribute(_toDOMS("url"))); } if (catalogs->getLength() > 1) { DOMElement * catalog = static_cast<DOMElement *>(catalogs->item(1)); m_fallbackDataCatalog = _toString(catalog->getAttribute(_toDOMS("url"))); } DOMNodeList* rfiotypes = eventData->getElementsByTagName(_toDOMS("rfiotype")); if (rfiotypes->getLength() > 0) { DOMElement* rfiotype = static_cast<DOMElement *>(rfiotypes->item(0)); m_rfioType = _toString(rfiotype->getAttribute(_toDOMS("value"))); } } } // Parsing of the calib-data section { DOMNodeList *calibDataList = site->getElementsByTagName(_toDOMS("calib-data")); if (calibDataList->getLength() > 0) { DOMElement *calibData = static_cast<DOMElement *>(calibDataList->item(0)); DOMNodeList *frontierConnectList = calibData->getElementsByTagName(_toDOMS("frontier-connect")); if (frontierConnectList->getLength() > 0) { DOMElement *frontierConnect = static_cast<DOMElement *>(frontierConnectList->item(0)); m_frontierConnect = _toParenString(*frontierConnect); } } } // Parsing of the source config section { DOMNodeList *sourceConfigList = site->getElementsByTagName(_toDOMS("source-config")); if (sourceConfigList->getLength() > 0) { DOMElement *sourceConfig = static_cast<DOMElement *>(sourceConfigList->item(0)); DOMNodeList *cacheTempDirList = sourceConfig->getElementsByTagName(_toDOMS("cache-temp-dir")); if (cacheTempDirList->getLength() > 0) { DOMElement *cacheTempDir = static_cast<DOMElement *>(cacheTempDirList->item(0)); m_cacheTempDir = _toString(cacheTempDir->getAttribute(_toDOMS("name"))); m_cacheTempDirPtr = &m_cacheTempDir; } DOMNodeList *cacheMinFreeList = sourceConfig->getElementsByTagName(_toDOMS("cache-min-free")); if (cacheMinFreeList->getLength() > 0) { DOMElement *cacheMinFree = static_cast<DOMElement *>(cacheMinFreeList->item(0)); m_cacheMinFree = _toDouble(cacheMinFree->getAttribute(_toDOMS("value"))); m_cacheMinFreePtr = &m_cacheMinFree; } DOMNodeList *cacheHintList = sourceConfig->getElementsByTagName(_toDOMS("cache-hint")); if (cacheHintList->getLength() > 0) { DOMElement *cacheHint = static_cast<DOMElement *>(cacheHintList->item(0)); m_cacheHint = _toString(cacheHint->getAttribute(_toDOMS("value"))); m_cacheHintPtr = &m_cacheHint; } DOMNodeList *readHintList = sourceConfig->getElementsByTagName(_toDOMS("read-hint")); if (readHintList->getLength() > 0) { DOMElement *readHint = static_cast<DOMElement *>(readHintList->item(0)); m_readHint = _toString(readHint->getAttribute(_toDOMS("value"))); m_readHintPtr = &m_readHint; } DOMNodeList *ttreeCacheSizeList = sourceConfig->getElementsByTagName(_toDOMS("ttree-cache-size")); if (ttreeCacheSizeList->getLength() > 0) { DOMElement *ttreeCacheSize = static_cast<DOMElement *>(ttreeCacheSizeList->item(0)); m_ttreeCacheSize = _toUInt(ttreeCacheSize->getAttribute(_toDOMS("value"))); m_ttreeCacheSizePtr = &m_ttreeCacheSize; } DOMNodeList *timeoutList = sourceConfig->getElementsByTagName(_toDOMS("timeout-in-seconds")); if (timeoutList->getLength() > 0) { DOMElement *timeout = static_cast<DOMElement *>(timeoutList->item(0)); m_timeout = _toUInt(timeout->getAttribute(_toDOMS("value"))); m_timeoutPtr = &m_timeout; } DOMNodeList *nativeProtocolsList = sourceConfig->getElementsByTagName(_toDOMS("native-protocols")); if (nativeProtocolsList->getLength() > 0) { DOMElement *nativeProtocol = static_cast<DOMElement *>(nativeProtocolsList->item(0)); DOMNodeList *childList = nativeProtocol->getChildNodes(); XMLCh* prefixXMLCh = _toDOMS("prefix"); unsigned int numNodes = childList->getLength(); for (unsigned int i = 0; i < numNodes; ++i) { DOMNode *childNode = childList->item(i); if (childNode->getNodeType() != DOMNode::ELEMENT_NODE) { continue; } DOMElement *child = static_cast<DOMElement *>(childNode); m_nativeProtocols.push_back(_toString(child->getAttribute(prefixXMLCh))); } m_nativeProtocolsPtr = &m_nativeProtocols; } } } } m_connected = true; } catch (xercesc::DOMException const& e) { } }
std::string const edm::service::SiteLocalConfigService::rfioType | ( | void | ) | const [virtual] |
Implements edm::SiteLocalConfig.
Definition at line 244 of file SiteLocalConfigService.cc.
References m_rfioType.
{ return m_rfioType; }
std::string const * edm::service::SiteLocalConfigService::sourceCacheHint | ( | ) | const [virtual] |
Implements edm::SiteLocalConfig.
Definition at line 259 of file SiteLocalConfigService.cc.
References m_cacheHintPtr.
{ return m_cacheHintPtr; }
double const * edm::service::SiteLocalConfigService::sourceCacheMinFree | ( | ) | const [virtual] |
Implements edm::SiteLocalConfig.
Definition at line 254 of file SiteLocalConfigService.cc.
References m_cacheMinFreePtr.
{ return m_cacheMinFreePtr; }
std::string const * edm::service::SiteLocalConfigService::sourceCacheTempDir | ( | ) | const [virtual] |
Implements edm::SiteLocalConfig.
Definition at line 249 of file SiteLocalConfigService.cc.
References m_cacheTempDirPtr.
{ return m_cacheTempDirPtr; }
std::vector< std::string > const * edm::service::SiteLocalConfigService::sourceNativeProtocols | ( | ) | const [virtual] |
Implements edm::SiteLocalConfig.
Definition at line 284 of file SiteLocalConfigService.cc.
References m_nativeProtocolsPtr.
{ return m_nativeProtocolsPtr; }
std::string const * edm::service::SiteLocalConfigService::sourceReadHint | ( | ) | const [virtual] |
Implements edm::SiteLocalConfig.
Definition at line 264 of file SiteLocalConfigService.cc.
References m_readHintPtr.
{ return m_readHintPtr; }
unsigned int const * edm::service::SiteLocalConfigService::sourceTimeout | ( | ) | const [virtual] |
Implements edm::SiteLocalConfig.
Definition at line 274 of file SiteLocalConfigService.cc.
References m_timeoutPtr.
{ return m_timeoutPtr; }
unsigned int const * edm::service::SiteLocalConfigService::sourceTTreeCacheSize | ( | ) | const [virtual] |
Implements edm::SiteLocalConfig.
Definition at line 269 of file SiteLocalConfigService.cc.
References m_ttreeCacheSizePtr.
{ return m_ttreeCacheSizePtr; }
std::string edm::service::SiteLocalConfigService::m_cacheHint [private] |
Definition at line 59 of file SiteLocalConfigService.h.
Referenced by parse(), and SiteLocalConfigService().
std::string const* edm::service::SiteLocalConfigService::m_cacheHintPtr [private] |
Definition at line 60 of file SiteLocalConfigService.h.
Referenced by parse(), SiteLocalConfigService(), and sourceCacheHint().
double edm::service::SiteLocalConfigService::m_cacheMinFree [private] |
Definition at line 57 of file SiteLocalConfigService.h.
Referenced by parse(), and SiteLocalConfigService().
double const* edm::service::SiteLocalConfigService::m_cacheMinFreePtr [private] |
Definition at line 58 of file SiteLocalConfigService.h.
Referenced by parse(), SiteLocalConfigService(), and sourceCacheMinFree().
std::string edm::service::SiteLocalConfigService::m_cacheTempDir [private] |
Definition at line 55 of file SiteLocalConfigService.h.
Referenced by parse(), and SiteLocalConfigService().
std::string const* edm::service::SiteLocalConfigService::m_cacheTempDirPtr [private] |
Definition at line 56 of file SiteLocalConfigService.h.
Referenced by parse(), SiteLocalConfigService(), and sourceCacheTempDir().
bool edm::service::SiteLocalConfigService::m_connected [private] |
Definition at line 54 of file SiteLocalConfigService.h.
Referenced by dataCatalog(), fallbackDataCatalog(), frontierConnect(), and parse().
std::string edm::service::SiteLocalConfigService::m_dataCatalog [private] |
Definition at line 50 of file SiteLocalConfigService.h.
Referenced by dataCatalog(), and parse().
unsigned int edm::service::SiteLocalConfigService::m_debugLevel [private] |
Definition at line 67 of file SiteLocalConfigService.h.
Referenced by debugLevel(), and SiteLocalConfigService().
std::string edm::service::SiteLocalConfigService::m_fallbackDataCatalog [private] |
Definition at line 51 of file SiteLocalConfigService.h.
Referenced by fallbackDataCatalog(), and parse().
std::string edm::service::SiteLocalConfigService::m_frontierConnect [private] |
Definition at line 52 of file SiteLocalConfigService.h.
Referenced by frontierConnect(), and parse().
std::vector<std::string> edm::service::SiteLocalConfigService::m_nativeProtocols [private] |
Definition at line 68 of file SiteLocalConfigService.h.
Referenced by parse(), and SiteLocalConfigService().
std::vector<std::string> const* edm::service::SiteLocalConfigService::m_nativeProtocolsPtr [private] |
Definition at line 69 of file SiteLocalConfigService.h.
Referenced by parse(), SiteLocalConfigService(), and sourceNativeProtocols().
std::string edm::service::SiteLocalConfigService::m_readHint [private] |
Definition at line 61 of file SiteLocalConfigService.h.
Referenced by parse(), and SiteLocalConfigService().
std::string const* edm::service::SiteLocalConfigService::m_readHintPtr [private] |
Definition at line 62 of file SiteLocalConfigService.h.
Referenced by parse(), SiteLocalConfigService(), and sourceReadHint().
std::string edm::service::SiteLocalConfigService::m_rfioType [private] |
Definition at line 53 of file SiteLocalConfigService.h.
Referenced by parse(), and rfioType().
unsigned int edm::service::SiteLocalConfigService::m_timeout [private] |
Definition at line 65 of file SiteLocalConfigService.h.
Referenced by parse(), and SiteLocalConfigService().
unsigned int const* edm::service::SiteLocalConfigService::m_timeoutPtr [private] |
Definition at line 66 of file SiteLocalConfigService.h.
Referenced by parse(), SiteLocalConfigService(), and sourceTimeout().
unsigned int edm::service::SiteLocalConfigService::m_ttreeCacheSize [private] |
Definition at line 63 of file SiteLocalConfigService.h.
Referenced by parse(), and SiteLocalConfigService().
unsigned int const* edm::service::SiteLocalConfigService::m_ttreeCacheSizePtr [private] |
Definition at line 64 of file SiteLocalConfigService.h.
Referenced by parse(), SiteLocalConfigService(), and sourceTTreeCacheSize().
std::string edm::service::SiteLocalConfigService::m_url [private] |
Definition at line 49 of file SiteLocalConfigService.h.
Referenced by dataCatalog(), frontierConnect(), and SiteLocalConfigService().