| # Gaudi Framework, version v23r0 |

Home |  | Generated: Mon Jan 30 2012

# XMLFileCatalog.h

Go to the documentation of this file.

    00001 #ifndef GAUDIUTILS_XMLFILECATALOG_H
    00002 #define GAUDIUTILS_XMLFILECATALOG_H
    00003
    00004 #include "GaudiUtils/IFileCatalog.h"
    00005 #include "xercesc/dom/DOMElement.hpp"
    00006 #include "xercesc/dom/DOMDocument.hpp"
    00007 #include "xercesc/sax/ErrorHandler.hpp"
    00008 #include "xercesc/parsers/XercesDOMParser.hpp"
    00009
    00010 // Forward declarations
    00011 class IMessageSvc;
    00012
    00013 /*
    00014  *   Gaudi namespace declaration
    00015  */
    00016 namespace Gaudi {
    00017
    00025   class XMLFileCatalog : public implements1<IFileCatalog> {
    00026   protected:
    00027     typedef const std::string& CSTR;
    00028
    00029   public:
    00031     XMLFileCatalog(CSTR url, IMessageSvc* m);
    00033     virtual ~XMLFileCatalog();
    00034
    00036
    00037     virtual std::string createFID() const;
    00039     virtual CSTR connectInfo() const               { return m_file;                 }
    00041     virtual void init();
    00043     virtual void commit();
    00045     virtual void rollback()                       { if ( dirty() )  init();        }
    00047     virtual bool readOnly() const                 { return m_rdOnly;                }
    00049     virtual bool dirty() const                    { return m_update;                }
    00051     virtual bool existsPFN(CSTR pfn)  const       { return element(pfn,false) != 0; }
    00053     virtual std::string lookupPFN(CSTR fid) const { return lookupFID(fid);          }
    00055     virtual bool existsLFN(CSTR lfn)  const       { return element(lfn,false) != 0; }
    00057     virtual std::string lookupLFN(CSTR lfn) const { return lookupFID(lfn);          }
    00059     virtual bool existsFID(CSTR fid)  const       { return element(fid,false) != 0; }
    00061     virtual void getPFN(CSTR fid, Files& files) const;
    00063     virtual void getLFN(CSTR fid, Files& files) const;
    00065     virtual void getFID(Strings& fids)  const;
    00067     virtual void deleteFID(CSTR FileID)  const;
    00069     virtual void registerPFN(CSTR fid, CSTR pfn, CSTR ftype) const;
    00071     virtual void registerLFN(CSTR fid, CSTR lfn) const;
    00073     virtual void registerFID(CSTR fid) const;
    00075     virtual void getMetaData(CSTR fid, Attributes& attr) const;
    00077     virtual std::string getMetaDataItem(CSTR fid, CSTR name) const;
    00079     virtual void setMetaData(CSTR fid, CSTR name, CSTR value) const;
    00081     virtual void dropMetaData(CSTR fid) const  {   dropMetaData(fid,"*");   }
    00083     virtual void dropMetaData(CSTR fid, CSTR attr) const;
    00084   private:
    00085     xercesc::DOMDocument* getDoc(bool throw_if_no_exists=true)  const;
    00086     std::string getfile(bool create);
    00087     void printError(CSTR msg, bool throw_exc=true) const;
    00088     std::string lookupFID(CSTR lfn)  const;
    00089     xercesc::DOMNode* element(CSTR fid, bool print_err=true)  const;
    00090     xercesc::DOMNode* child(xercesc::DOMNode* par, CSTR tag, CSTR attr="", CSTR val="") const;
    00091     std::pair<xercesc::DOMElement*, xercesc::DOMElement*> i_registerFID(CSTR fid) const;
    00092     bool                      m_rdOnly;
    00093     mutable bool              m_update;
    00094     xercesc::DOMDocument     *m_doc;
    00095     xercesc::XercesDOMParser *m_parser;
    00096     xercesc::ErrorHandler    *m_errHdlr;
    00097     std::string               m_file;
    00098     IMessageSvc*              m_msgSvc;
    00099   };
    00101   std::string createGuidAsString();
    00102 }         /* End namespace Gaudi                 */
    00103 #endif    /* GAUDIUTILS_XMLFILECATALOG_H   */

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines