| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

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

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 implements1<IFileCatalog> {
26 protected:
27 typedef const std::string& CSTR;
28
29 public:
31 XMLFileCatalog(CSTR url, IMessageSvc* m);
33 virtual ~XMLFileCatalog();
34
36
37 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 xercesc::XercesDOMParser *m_parser;
96 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 */