CMS 3D CMS Logo

FileLocator.h
Go to the documentation of this file.
1 #ifndef FWCore_Catalog_FileLocator_h
2 #define FWCore_Catalog_FileLocator_h
3 
5 #include <string>
6 #include <list>
7 #include <map>
8 #include <utility>
9 #include <regex>
10 #include "tinyxml2.h"
11 #include <boost/property_tree/ptree.hpp>
12 
13 namespace edm {
14 
15  class FileLocator {
16  public:
17  explicit FileLocator(
18  edm::CatalogAttributes const& catAttr,
19  unsigned iCatalog = 0,
20  //storageDescriptionPath is used to override path provided by SiteLocalConfig. This is used in FileLocator_t.cpp tests
21  std::string const& storageDescriptionPath = std::string());
22  explicit FileLocator(std::string const& catUrl, unsigned iCatalog = 0);
23 
24  ~FileLocator();
25 
26  std::string pfn(std::string const& ilfn, edm::CatalogType catType) const;
27 
28  private:
32  static int s_numberOfInstances;
33 
34  struct Rule {
35  std::regex pathMatch;
36  std::regex destinationMatch;
39  };
40 
41  typedef std::vector<Rule> Rules;
42  typedef std::map<std::string, Rules> ProtocolRules;
43 
44  void init_trivialCatalog(std::string const& catUrl, unsigned iCatalog);
45 
46  void parseRuleTrivialCatalog(tinyxml2::XMLElement* ruleNode, ProtocolRules& rules);
47  //using data-access
48  void init(edm::CatalogAttributes const& input_dataCatalog,
49  unsigned iCatalog,
50  std::string const& storageDescriptionPath);
51  void parseRule(boost::property_tree::ptree::value_type const& storageRule,
52  std::string const& protocol,
54 
55  std::string applyRules(ProtocolRules const& protocolRules,
56  std::string const& protocol,
57  std::string const& destination,
58  bool direct,
59  std::string name) const;
60 
61  std::string convert(std::string const& input, ProtocolRules const& rules, bool direct) const;
62 
69 
72  //TFC allows more than one protocols provided in a catalog, separated by a comma
73  //In new Rucio storage description, only one protocol is provided in a catalog
74  //This variable can be simplified in the future
75  std::vector<std::string> m_protocols;
77  };
78 } // namespace edm
79 
80 #endif // FWCore_Catalog_FileLocator_h
ProtocolRules m_directRules_trivialCatalog
Definition: FileLocator.h:64
std::map< std::string, Rules > ProtocolRules
Definition: FileLocator.h:42
FileLocator(edm::CatalogAttributes const &catAttr, unsigned iCatalog=0, std::string const &storageDescriptionPath=std::string())
Definition: FileLocator.cc:53
static int s_numberOfInstances
Definition: FileLocator.h:32
std::string m_destination
Definition: FileLocator.h:76
std::string pfn(std::string const &ilfn, edm::CatalogType catType) const
Definition: FileLocator.cc:62
static std::string const input
Definition: EdmProvDump.cc:50
ProtocolRules m_inverseRules
Definition: FileLocator.h:66
std::string m_filename
Definition: FileLocator.h:71
std::string m_fileType
Definition: FileLocator.h:70
void init_trivialCatalog(std::string const &catUrl, unsigned iCatalog)
Definition: FileLocator.cc:122
void init(edm::CatalogAttributes const &input_dataCatalog, unsigned iCatalog, std::string const &storageDescriptionPath)
Definition: FileLocator.cc:216
ProtocolRules m_directRules
Definition: FileLocator.h:68
std::vector< Rule > Rules
Definition: FileLocator.h:41
HLT enums.
std::vector< std::string > m_protocols
Definition: FileLocator.h:75
void parseRuleTrivialCatalog(tinyxml2::XMLElement *ruleNode, ProtocolRules &rules)
Definition: FileLocator.cc:82
void parseRule(boost::property_tree::ptree::value_type const &storageRule, std::string const &protocol, ProtocolRules &rules)
Definition: FileLocator.cc:105
std::string convert(std::string const &input, ProtocolRules const &rules, bool direct) const
Definition: FileLocator.cc:68
std::string applyRules(ProtocolRules const &protocolRules, std::string const &protocol, std::string const &destination, bool direct, std::string name) const
Definition: FileLocator.cc:314
std::regex destinationMatch
Definition: FileLocator.h:36