139 std::string m_url = catUrl;
142 Service<SiteLocalConfig> localconfservice;
143 if (!localconfservice.isAvailable())
144 throw cms::Exception(
"TrivialFileCatalog",
"edm::SiteLocalConfigService is not available");
146 m_url = (fallback ? localconfservice->fallbackDataCatalog() : localconfservice->dataCatalog());
151 if (m_url.find(
"file:") == std::string::npos) {
152 throw cms::Exception(
"TrivialFileCatalog",
"TrivialFileCatalog::connect: Malformed url for file catalog configuration");
155 m_url = m_url.erase(0, m_url.find(
":") + 1);
157 std::vector<std::string> tokens;
161 if (tokens.size() == 2) {
162 std::string
const options = tokens[1];
163 std::vector<std::string> optionTokens;
166 std::string
const equalSign(
"=");
167 std::string
const comma(
",");
169 for (
size_t oi = 0, oe = optionTokens.size(); oi != oe; ++oi) {
170 std::string
const option = optionTokens[oi];
171 std::vector<std::string> argTokens;
174 if (argTokens.size() != 2) {
175 throw cms::Exception(
"TrivialFileCatalog",
"TrivialFileCatalog::connect: Malformed url for file catalog configuration");
178 if (argTokens[0] ==
"protocol") {
180 }
else if (argTokens[0] ==
"destination") {
187 throw cms::Exception(
"TrivialFileCatalog",
"TrivialFileCatalog::connect: protocol was not supplied in the contact string");
196 if (!configFile.good() || !configFile.is_open()) {
197 throw cms::Exception(
"TrivialFileCatalog",
"TrivialFileCatalog::connect: Unable to open trivial file catalog " +
m_filename);
202 XercesDOMParser*
parser =
new XercesDOMParser;
203 parser->setValidationScheme(XercesDOMParser::Val_Auto);
204 parser->setDoNamespaces(
false);
206 DOMDocument*
doc = parser->getDocument();
223 DOMNodeList*
rules = doc->getElementsByTagName(
_toDOMS(
"lfn-to-pfn"));
224 unsigned int const ruleTagsNum = rules->getLength();
228 for (
unsigned int i = 0;
i < ruleTagsNum; ++
i) {
229 DOMNode* ruleNode = rules->item(
i);
235 DOMNodeList* rules = doc->getElementsByTagName(
_toDOMS(
"pfn-to-lfn"));
236 unsigned int ruleTagsNum = rules->getLength();
238 for (
unsigned int i = 0;
i < ruleTagsNum; ++
i) {
239 DOMNode* ruleNode = rules->item(
i);
std::string m_destination
ProtocolRules m_inverseRules
ProtocolRules m_directRules
void parseRule(xercesc::DOMNode *ruleNode, ProtocolRules &rules)
std::vector< std::string > m_protocols
XMLCh * _toDOMS(std::string temp)