Gaudi Framework, version v20r4

Generated: 8 Jan 2009

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 : virtual public 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 unsigned long addRef();
00039     virtual unsigned long release();
00041     virtual StatusCode queryInterface(const InterfaceID& id, void** ppv);
00042 
00044 
00045     virtual std::string createFID() const;
00047     virtual CSTR connectInfo() const               { return m_file;                 }
00049     virtual void init();
00051     virtual void commit();
00053     virtual void rollback()                       { if ( dirty() )  init();        }
00055     virtual bool readOnly() const                 { return m_rdOnly;                }
00057     virtual bool dirty() const                    { return m_update;                }
00059     virtual bool existsPFN(CSTR pfn)  const       { return element(pfn,false) != 0; }
00061     virtual std::string lookupPFN(CSTR fid) const { return lookupFID(fid);          }
00063     virtual bool existsLFN(CSTR lfn)  const       { return element(lfn,false) != 0; }
00065     virtual std::string lookupLFN(CSTR lfn) const { return lookupFID(lfn);          } 
00067     virtual bool existsFID(CSTR fid)  const       { return element(fid,false) != 0; }
00069     virtual void getPFN(CSTR fid, Files& files) const;
00071     virtual void getLFN(CSTR fid, Files& files) const;
00073     virtual void getFID(Strings& fids)  const;
00075     virtual void deleteFID(CSTR FileID)  const;
00077     virtual void registerPFN(CSTR fid, CSTR pfn, CSTR ftype) const;
00079     virtual void registerLFN(CSTR fid, CSTR lfn) const;
00081     virtual void registerFID(CSTR fid) const;
00083     virtual void getMetaData(CSTR fid, Attributes& attr) const;
00085     virtual std::string getMetaDataItem(CSTR fid, CSTR name) const; 
00087     virtual void setMetaData(CSTR fid, CSTR name, CSTR value) const;
00089     virtual void dropMetaData(CSTR fid) const  {   dropMetaData(fid,"*");   }
00091     virtual void dropMetaData(CSTR fid, CSTR attr) const;
00092   private:
00093     xercesc::DOMDocument* getDoc(bool throw_if_no_exists=true)  const;
00094     std::string getfile(bool create);
00095     void printError(CSTR msg, bool throw_exc=true) const;
00096     std::string lookupFID(CSTR lfn)  const;
00097     xercesc::DOMNode* element(CSTR fid, bool print_err=true)  const;
00098     xercesc::DOMNode* child(xercesc::DOMNode* par, CSTR tag, CSTR attr="", CSTR val="") const;
00099     std::pair<xercesc::DOMElement*, xercesc::DOMElement*> i_registerFID(CSTR fid) const;
00100     bool                      m_rdOnly;
00101     mutable bool              m_update;
00102     xercesc::DOMDocument     *m_doc;
00103     xercesc::XercesDOMParser *m_parser;
00104     xercesc::ErrorHandler    *m_errHdlr;
00105     std::string               m_file;
00106     unsigned long             m_refCount;
00107     IMessageSvc*              m_msgSvc;
00108   };
00110   std::string createGuidAsString();
00111 }         /* End namespace Gaudi                 */
00112 #endif    /* GAUDIUTILS_XMLFILECATALOG_H   */

Generated at Thu Jan 8 17:44:24 2009 for Gaudi Framework, version v20r4 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004