CMS 3D CMS Logo

TrivialFileCatalog.h

Go to the documentation of this file.
00001 #ifndef POOL_TRIVIALFILECATALOG_H
00002 #define POOL_TRIVIALFILECATALOG_H
00003 #ifndef POOL_FCIMPL_H
00004 #include "FileCatalog/FCImpl.h"
00005 #endif
00006 #ifndef FCBUF_H
00007 #include "FileCatalog/FCBuf.h"
00008 #endif
00009 #include <list>
00010 #include <utility>
00011 #include <SealBase/Regexp.h>
00012 #include <xercesc/dom/DOM.hpp>
00013 
00014 namespace pool 
00015 {
00032 class TrivialFileCatalog : public FCImpl 
00033 {
00034 public:
00035     TrivialFileCatalog ();
00036     virtual ~TrivialFileCatalog ();
00037     //
00038     //Connection and transaction control operations.
00039     //   
00040 
00045     virtual void connect();
00046 
00049     virtual void disconnect() const;
00052     virtual void start() const;
00060     virtual void commit(FileCatalog::CommitMode cm=FileCatalog::REFRESH) const;
00061 
00065     virtual void rollback() const;  
00066 
00067     //
00068     //File registration operations
00069     //
00070   
00079     virtual void registerPFN(const std::string& pfn, 
00080                              const std::string& filetype,
00081                              FileCatalog::FileID& fid ) const;   
00082 
00089     virtual void registerLFN(const std::string& pfn, 
00090                              const std::string& lfn) const;
00091 
00092 
00098     virtual void addReplicaPFN(const std::string& pfn, 
00099                                const std::string& rpf) const;
00100 
00106     virtual void addPFNtoGuid(const FileCatalog::FileID& guid, 
00107                               const std::string& pf, 
00108                               const std::string& filetype) const;
00109 
00115     virtual void renamePFN(const std::string& pfn, 
00116                            const std::string& newpfn) const;
00117   
00125     virtual void lookupFileByPFN(const std::string& pfn, 
00126                                  FileCatalog::FileID& fid, 
00127                                  std::string& ftype) const;
00128   
00133     virtual void lookupFileByLFN(const std::string& lfn, 
00134                                  FileCatalog::FileID& fid) const;
00135 
00145     virtual void lookupBestPFN(const FileCatalog::FileID& fid, 
00146                                const FileCatalog::FileOpenMode& omode,
00147                                const FileCatalog::FileAccessPattern& amode,
00148                                std::string& pfn,
00149                                std::string& filetype) const; 
00151     virtual void insertPFN(PFNEntry& pentry) const;
00153     virtual void insertLFN(LFNEntry& lentry) const;
00155     virtual void deletePFN(const std::string& pfn) const;
00157     virtual void deleteLFN(const std::string& lfn) const;
00159     virtual void deleteEntry(const FileCatalog::FileID& guid) const;
00160 
00161     virtual bool isReadOnly() const;
00162  
00164     virtual bool retrievePFN(const std::string& query, 
00165                              FCBuf<PFNEntry>& buf, 
00166                              const size_t& start );
00168     virtual bool retrieveLFN(const std::string& query, 
00169                              FCBuf<LFNEntry>& buf, 
00170                              const size_t& start );
00172     virtual bool retrieveGuid(const std::string& query, 
00173                               FCBuf<FileCatalog::FileID>& buf, 
00174                               const size_t& start );
00175 
00176 
00177 private:
00181     mutable bool        m_connectionStatus;
00182     static int          s_numberOfInstances;    
00183 
00184     
00185     
00186     typedef struct {
00187         seal::Regexp pathMatch;
00188         seal::Regexp destinationMatch;  
00189         std::string result;
00190         std::string chain;
00191     } Rule;
00192 
00193     typedef std::list <Rule> Rules;
00194     typedef std::map <std::string, Rules> ProtocolRules;
00195 
00196     void parseRule (xercesc::DOMNode *ruleNode, 
00197                     ProtocolRules &rules);
00198     
00199     std::string applyRules (const ProtocolRules& protocolRules,
00200                             const std::string & protocol,
00201                             const std::string & destination,
00202                             bool direct,
00203                             std::string name) const;
00204     
00205 
00206             
00208     ProtocolRules               m_directRules;
00210     ProtocolRules               m_inverseRules;
00211     
00212     std::string                 m_fileType;
00213     std::string                 m_filename;
00214     seal::StringList            m_protocols;
00215     std::string                 m_destination;    
00216 };    
00217     
00218 
00219 }
00220 
00221 
00222 #endif

Generated on Tue Jun 9 17:39:09 2009 for CMSSW by  doxygen 1.5.4