116 Service<SiteLocalConfig> localconfservice;
117 if (!localconfservice.isAvailable())
118 throw cms::Exception(
"TrivialFileCatalog",
"edm::SiteLocalConfigService is not available");
120 m_url = (
fallback ? localconfservice->fallbackDataCatalog() : localconfservice->dataCatalog());
125 if (m_url.find(
"file:") == std::string::npos) {
127 "TrivialFileCatalog::connect: Malformed url for file catalog configuration");
130 m_url = m_url.erase(0, m_url.find(
":") + 1);
132 std::vector<std::string> tokens;
136 if (tokens.size() == 2) {
138 std::vector<std::string> optionTokens;
144 for (
size_t oi = 0, oe = optionTokens.size(); oi != oe; ++oi) {
146 std::vector<std::string> argTokens;
149 if (argTokens.size() != 2) {
151 "TrivialFileCatalog::connect: Malformed url for file catalog configuration");
154 if (argTokens[0] ==
"protocol") {
156 }
else if (argTokens[0] ==
"destination") {
164 "TrivialFileCatalog::connect: protocol was not supplied in the contact string");
167 std::ifstream configFile;
173 if (!configFile.good() || !configFile.is_open()) {
175 "TrivialFileCatalog::connect: Unable to open trivial file catalog " +
m_filename);
180 auto parser = std::make_unique<XercesDOMParser>();
182 parser->setValidationScheme(XercesDOMParser::Val_Auto);
183 parser->setDoNamespaces(
false);
185 DOMDocument*
doc =
parser->getDocument();
202 DOMNodeList*
rules = doc->getElementsByTagName(
uStr(
"lfn-to-pfn").ptr());
203 XMLSize_t
const ruleTagsNum = rules->getLength();
207 for (XMLSize_t
i = 0;
i < ruleTagsNum; ++
i) {
208 DOMNode* ruleNode = rules->item(
i);
214 DOMNodeList* rules = doc->getElementsByTagName(
uStr(
"pfn-to-lfn").ptr());
215 XMLSize_t ruleTagsNum = rules->getLength();
217 for (XMLSize_t
i = 0;
i < ruleTagsNum; ++
i) {
218 DOMNode* ruleNode = rules->item(
i);
222 }
catch (xercesc::DOMException
const&
e) {
224 <<
"Xerces XML parser threw this exception: " <<
cStr(e.getMessage()).ptr() << std::endl;
std::string m_destination
ProtocolRules m_inverseRules
ZStr< char > cStr(XMLCh const *str)
ZStr< XMLCh > uStr(char const *str)
ProtocolRules m_directRules
void parseRule(xercesc::DOMNode *ruleNode, ProtocolRules &rules)
std::vector< std::string > m_protocols