| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

XMLFileCatalog.h
Go to the documentation of this file.
1 #ifndef GAUDIUTILS_XMLFILECATALOG_H
2 #define GAUDIUTILS_XMLFILECATALOG_H
3
4 #include "GaudiUtils/IFileCatalog.h"
5 #include "xercesc/dom/DOMElement.hpp"
6 #include "xercesc/dom/DOMDocument.hpp"
7 #include "xercesc/sax/ErrorHandler.hpp"
8 #include "xercesc/parsers/XercesDOMParser.hpp"
9
10 // Forward declarations
11 class IMessageSvc;
12
13 /*
14 * Gaudi namespace declaration
15 */
16 namespace Gaudi {
17
25 class XMLFileCatalog : public implements<IFileCatalog> {
26 protected:
27 typedef const std::string& CSTR;
28
29 public:
31 XMLFileCatalog(CSTR url, IMessageSvc* m);
33 virtual ~XMLFileCatalog() = default;
34
36 virtual std::string createFID() const;
39 virtual CSTR connectInfo() const { return m_file; }
41 virtual void init();
43 virtual void commit();
45 virtual void rollback() { if ( dirty() ) init(); }
47 virtual bool readOnly() const { return m_rdOnly; }
49 virtual bool dirty() const { return m_update; }
51 virtual bool existsPFN(CSTR pfn) const { return element(pfn,false) != 0; }
53 virtual std::string lookupPFN(CSTR fid) const { return lookupFID(fid); }
55 virtual bool existsLFN(CSTR lfn) const { return element(lfn,false) != 0; }
57 virtual std::string lookupLFN(CSTR lfn) const { return lookupFID(lfn); }
59 virtual bool existsFID(CSTR fid) const { return element(fid,false) != 0; }
61 virtual void getPFN(CSTR fid, Files& files) const;
63 virtual void getLFN(CSTR fid, Files& files) const;
65 virtual void getFID(Strings& fids) const;
67 virtual void deleteFID(CSTR FileID) const;
69 virtual void registerPFN(CSTR fid, CSTR pfn, CSTR ftype) const;
71 virtual void registerLFN(CSTR fid, CSTR lfn) const;
73 virtual void registerFID(CSTR fid) const;
75 virtual void getMetaData(CSTR fid, Attributes& attr) const;
77 virtual std::string getMetaDataItem(CSTR fid, CSTR name) const;
79 virtual void setMetaData(CSTR fid, CSTR name, CSTR value) const;
81 virtual void dropMetaData(CSTR fid) const { dropMetaData(fid,"*"); }
83 virtual void dropMetaData(CSTR fid, CSTR attr) const;
84 private:
85 xercesc::DOMDocument* getDoc(bool throw_if_no_exists=true) const;
86 std::string getfile(bool create);
87 void printError(CSTR msg, bool throw_exc=true) const;
88 std::string lookupFID(CSTR lfn) const;
89 xercesc::DOMNode* element(CSTR fid, bool print_err=true) const;
90 xercesc::DOMNode* child(xercesc::DOMNode* par, CSTR tag, CSTR attr="", CSTR val="") const;
91 std::pair<xercesc::DOMElement*, xercesc::DOMElement*> i_registerFID(CSTR fid) const;
92 bool m_rdOnly;
93 mutable bool m_update;
94 xercesc::DOMDocument *m_doc;
95 std::unique_ptr<xercesc::XercesDOMParser> m_parser;
96 std::unique_ptr<xercesc::ErrorHandler> m_errHdlr;
97 std::string m_file;
98 IMessageSvc* m_msgSvc;
99 };
101 std::string createGuidAsString();
102 } /* End namespace Gaudi */
103 #endif /* GAUDIUTILS_XMLFILECATALOG_H */
Gaudi::XMLFileCatalog::connectInfo
virtual CSTR connectInfo() const
Access to connect string.
Definition: XMLFileCatalog.h:39
Gaudi::XMLFileCatalog::rollback
virtual void rollback()
Save DOM catalog to file.
Definition: XMLFileCatalog.h:45
Gaudi::XMLFileCatalog::m_file
std::string m_file
Definition: XMLFileCatalog.h:97
implements
Base class used to implement the interfaces.
Definition: implements.h:9
Gaudi::XMLFileCatalog::lookupLFN
virtual std::string lookupLFN(CSTR lfn) const
Lookup file identifier by logical file name.
Definition: XMLFileCatalog.h:57
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
GaudiMP.FdsRegistry.msg
tuple msg
Definition: FdsRegistry.py:8
Gaudi::XMLFileCatalog::readOnly
virtual bool readOnly() const
Check if the catalog is read-only.
Definition: XMLFileCatalog.h:47
Gaudi::XMLFileCatalog::existsFID
virtual bool existsFID(CSTR fid) const
Return the status of a FileID.
Definition: XMLFileCatalog.h:59
Gaudi::XMLFileCatalog::existsLFN
virtual bool existsLFN(CSTR lfn) const
Return the status of a logical file name.
Definition: XMLFileCatalog.h:55
Gaudi::XMLFileCatalog::lookupFID
std::string lookupFID(CSTR lfn) const
Definition: XMLFileCatalog.cpp:261
Gaudi::XMLFileCatalog::getfile
std::string getfile(bool create)
Definition: XMLFileCatalog.cpp:491
Gaudi::XMLFileCatalog::getMetaDataItem
virtual std::string getMetaDataItem(CSTR fid, CSTR name) const
Access metadata item.
Definition: XMLFileCatalog.cpp:329
Gaudi::XMLFileCatalog::dropMetaData
virtual void dropMetaData(CSTR fid) const
Drop all metadata of one FID.
Definition: XMLFileCatalog.h:81
Gaudi::XMLFileCatalog::element
xercesc::DOMNode * element(CSTR fid, bool print_err=true) const
Definition: XMLFileCatalog.cpp:343
Gaudi::XMLFileCatalog::setMetaData
virtual void setMetaData(CSTR fid, CSTR name, CSTR value) const
Insert/update metadata item.
Definition: XMLFileCatalog.cpp:313
Gaudi::XMLFileCatalog::m_parser
std::unique_ptr< xercesc::XercesDOMParser > m_parser
Definition: XMLFileCatalog.h:95
Gaudi::XMLFileCatalog::~XMLFileCatalog
virtual ~XMLFileCatalog()=default
Destructor,.
Gaudi::XMLFileCatalog::registerPFN
virtual void registerPFN(CSTR fid, CSTR pfn, CSTR ftype) const
Create a FileID and Node of the physical file name with all the attributes.
Definition: XMLFileCatalog.cpp:402
std::string
STL class.
Gaudi::XMLFileCatalog::CSTR
const std::string & CSTR
Definition: XMLFileCatalog.h:27
Gaudi::XMLFileCatalog::init
virtual void init()
Parse the DOM tree of the XML catalog.
Definition: XMLFileCatalog.cpp:230
compareOutputFiles.par
string par
Definition: compareOutputFiles.py:386
Gaudi::XMLFileCatalog::dirty
virtual bool dirty() const
Check if the catalog should be updated.
Definition: XMLFileCatalog.h:49
Gaudi::XMLFileCatalog::child
xercesc::DOMNode * child(xercesc::DOMNode *par, CSTR tag, CSTR attr="", CSTR val="") const
Definition: XMLFileCatalog.cpp:303
Gaudi::Units::m
constexpr double m
Definition: SystemOfUnits.h:93
Gaudi::XMLFileCatalog::printError
void printError(CSTR msg, bool throw_exc=true) const
Definition: XMLFileCatalog.cpp:222
Gaudi::XMLFileCatalog::getFID
virtual void getFID(Strings &fids) const
Dump all file Identifiers.
Definition: XMLFileCatalog.cpp:276
Gaudi::XMLFileCatalog::m_errHdlr
std::unique_ptr< xercesc::ErrorHandler > m_errHdlr
Definition: XMLFileCatalog.h:96
IMessageSvc
The IMessage is the interface implemented by the message service.
Definition: IMessageSvc.h:57
Gaudi::XMLFileCatalog::m_doc
xercesc::DOMDocument * m_doc
Definition: XMLFileCatalog.h:94
Gaudi::XMLFileCatalog::getDoc
xercesc::DOMDocument * getDoc(bool throw_if_no_exists=true) const
Definition: XMLFileCatalog.cpp:216
dump_component_properties.value
list value
Definition: dump_component_properties.py:12
IFileCatalog.h
Gaudi::XMLFileCatalog::lookupPFN
virtual std::string lookupPFN(CSTR fid) const
Lookup file identifier by physical file name.
Definition: XMLFileCatalog.h:53
Gaudi::XMLFileCatalog::getLFN
virtual void getLFN(CSTR fid, Files &files) const
Dump all logical file names of the catalog associate to the FileID.
Definition: XMLFileCatalog.cpp:289
Gaudi::XMLFileCatalog::deleteFID
virtual void deleteFID(CSTR FileID) const
Delete FileID Node from the catalog.
Definition: XMLFileCatalog.cpp:349
Gaudi::XMLFileCatalog::XMLFileCatalog
XMLFileCatalog(CSTR url, IMessageSvc *m)
Create a catalog file, initialization of XercesC.
Definition: XMLFileCatalog.cpp:205
Gaudi::XMLFileCatalog::existsPFN
virtual bool existsPFN(CSTR pfn) const
Return the status of a physical file name.
Definition: XMLFileCatalog.h:51
Gaudi::XMLFileCatalog::m_rdOnly
bool m_rdOnly
Definition: XMLFileCatalog.h:92
std::pair
std::unique_ptr< xercesc::XercesDOMParser >
Gaudi::createGuidAsString
std::string createGuidAsString()
Create file identifier using UUID mechanism.
Definition: XMLFileCatalog.cpp:188
Gaudi::XMLFileCatalog::commit
virtual void commit()
Save DOM catalog to file.
Definition: XMLFileCatalog.cpp:460
Gaudi::XMLFileCatalog::getPFN
virtual void getPFN(CSTR fid, Files &files) const
Dump all physical file names of the catalog and their attributes associate to the FileID...
Definition: XMLFileCatalog.cpp:283
Gaudi::XMLFileCatalog::i_registerFID
std::pair< xercesc::DOMElement *, xercesc::DOMElement * > i_registerFID(CSTR fid) const
Definition: XMLFileCatalog.cpp:366
Gaudi::XMLFileCatalog::m_msgSvc
IMessageSvc * m_msgSvc
Definition: XMLFileCatalog.h:98
Gaudi::XMLFileCatalog::getMetaData
virtual void getMetaData(CSTR fid, Attributes &attr) const
Dump all MetaData of the catalog for a given file ID.
Definition: XMLFileCatalog.cpp:295
Gaudi::XMLFileCatalog::registerFID
virtual void registerFID(CSTR fid) const
Create a FileID and Node.
Definition: XMLFileCatalog.cpp:355
Gaudi::XMLFileCatalog
This class constitutes the core of the XML based FileCatalog API for POOL.
Definition: XMLFileCatalog.h:25
Gaudi::XMLFileCatalog::createFID
virtual std::string createFID() const
Catalog interface.
Definition: XMLFileCatalog.cpp:212
Gaudi::XMLFileCatalog::registerLFN
virtual void registerLFN(CSTR fid, CSTR lfn) const
Create a FileID and Node of the logical file name with all the attributes.
Definition: XMLFileCatalog.cpp:432
Gaudi::XMLFileCatalog::m_update
bool m_update
Definition: XMLFileCatalog.h:93
Gaudi
Helper functions to set/get the application return code.
Definition: __init__.py:1