00001
00002
00003
00004
00005
00006 #include <string>
00007 #include <stdexcept>
00008 #ifndef POOL_PFNCATALOG_H
00009 #include "PFNCatalog.h"
00010 #endif
00011 #include "FileCatalog/FCException.h"
00012
00013
00014 pool::PFNCatalog::PFNCatalog ()
00015 {
00016 }
00017
00018 pool::PFNCatalog::~PFNCatalog ()
00019 {
00020 }
00021
00022
00023 void
00024 pool::PFNCatalog::connect ()
00025 {
00026 std::string mem ("memory://");
00027 std::string::size_type idx = m_url.find (mem);
00028 if (idx == std::string::npos)
00029 {
00030 throw FCTransactionException
00031 ("PFNCatalog::connect",
00032 ": Malformed url for PFN catalog, expect pfncatalog_memory://");
00033 }
00034 m_url = m_url.erase (0, idx + mem.length());
00035 idx = m_url.find ("?");
00036 if (idx == std::string::npos)
00037 {
00038 throw FCTransactionException
00039 ("PFNCatalog::connect",
00040 ": Malformed url for PFN catalog, expect pfncatalog_memory://fileType?PFN");
00041 }
00042 m_filetype = m_url.substr(0, idx);
00043 m_url = m_url.erase (0, idx + 1);
00044 }
00045
00046 void
00047 pool::PFNCatalog::disconnect () const
00048 {
00049 }
00050
00051 void
00052 pool::PFNCatalog::start () const
00053 {
00054 }
00055
00056 void
00057 pool::PFNCatalog::commit (FileCatalog::CommitMode ) const
00058 {
00059 }
00060
00061 void
00062 pool::PFNCatalog::rollback () const
00063 {
00064 throw FCTransactionException
00065 ("PFNCatalog::rollback",
00066 "PFN catalogs cannot rollback");
00067 }
00068
00069 void
00070 pool::PFNCatalog::registerPFN (const std::string& ,
00071 const std::string& ,
00072 FileCatalog::FileID& ) const
00073 {
00074 throw FCTransactionException
00075 ("PFNCatalog::registerPFN",
00076 "It does not make sense to register PFN for PFNCatalogs");
00077 }
00078
00079 void
00080 pool::PFNCatalog::registerLFN (const std::string& ,
00081 const std::string& ) const
00082 {
00083 throw FCTransactionException
00084 ("PFNCatalog::registerLFN",
00085 "It does not make sense to register LFN for PFNCatalogs");
00086 }
00087
00088 void
00089 pool::PFNCatalog::addReplicaPFN (const std::string& ,
00090 const std::string& ) const
00091 {
00092 throw FCTransactionException
00093 ("PFNCatalog::addReplicalPFN",
00094 "It does not make sense to register PFN for PFNCatalogs");
00095 }
00096
00097 void
00098 pool::PFNCatalog::addPFNtoGuid (const FileCatalog::FileID& ,
00099 const std::string& ,
00100 const std::string& ) const
00101 {
00102 throw FCTransactionException
00103 ("PFNCatalog::addPFNtoGuid",
00104 "It does not make sense to register replicas for PFNCatalogs");
00105 }
00106
00107 void
00108 pool::PFNCatalog::renamePFN (const std::string& ,
00109 const std::string& ) const
00110 {
00111 throw FCTransactionException
00112 ("PFNCatalog::renamePFN",
00113 "It does not make sense to rename PFNs for PFNCatalogs");
00114 }
00115
00116 void
00117 pool::PFNCatalog::lookupFileByPFN (const std::string & ,
00118 FileCatalog::FileID & fid,
00119 std::string& filetype) const
00120 {
00121 fid = "00000000-0000-0000-0000-000000000000";
00122 filetype = m_filetype;
00123 }
00124
00125 void
00126 pool::PFNCatalog::lookupFileByLFN (const std::string& ,
00127 FileCatalog::FileID& ) const
00128 {
00129 throw FCTransactionException
00130 ("PFNCatalog::lookupFileByLFN",
00131 "looking up files by LFN is not supported for PFNCatalogs");
00132 }
00133
00134 void
00135 pool::PFNCatalog::lookupBestPFN (const FileCatalog::FileID& ,
00136 const FileCatalog::FileOpenMode& ,
00137 const FileCatalog::FileAccessPattern& ,
00138 std::string& pfn,
00139 std::string& filetype) const
00140 {
00141 pfn = m_url;
00142 filetype = m_filetype;
00143 }
00144
00145 void
00146 pool::PFNCatalog::insertPFN (PFNEntry& ) const
00147 {
00148 throw FCTransactionException
00149 ("PFNCatalog::insertPFN",
00150 "It does not make sense to insert PFNs for PFNCatalogs");
00151 }
00152
00153 void
00154 pool::PFNCatalog::insertLFN (LFNEntry& ) const
00155 {
00156 throw FCTransactionException
00157 ("PFNCatalog::insertLFN",
00158 "It does not make sense to insert LFNs for PFNCatalogs");
00159 }
00160
00161 void
00162 pool::PFNCatalog::deletePFN (const std::string& ) const
00163 {
00164 throw FCTransactionException
00165 ("PFNCatalog::deletePFN",
00166 "It does not make sense to delete PFNs for PFNCatalogs");
00167 }
00168
00169 void
00170 pool::PFNCatalog::deleteLFN (const std::string& ) const
00171 {
00172 throw FCTransactionException
00173 ("PFNCatalog::deleteLFN",
00174 "It does not make sense to delete LFNs for PFNCatalogs");
00175 }
00176
00177 void
00178 pool::PFNCatalog::deleteEntry (const FileCatalog::FileID& ) const
00179 {
00180 throw FCTransactionException
00181 ("PFNCatalog::deleteEntry",
00182 "It does not make sense to delete GUIDs for PFNCatalogs");
00183 }
00184
00185 bool
00186 pool::PFNCatalog::isReadOnly () const
00187 {
00188 return true;
00189 }
00190
00191 bool
00192 pool::PFNCatalog::retrievePFN (const std::string& ,
00193 FCBuf<PFNEntry>& ,
00194 const size_t& )
00195 {
00196 throw FCTransactionException
00197 ("PFNCatalog::retrievePFN",
00198 "retrieving PFN is not supported for PFNCatalogs");
00199
00200 return false;
00201 }
00202
00203 bool
00204 pool::PFNCatalog::retrieveLFN (const std::string& ,
00205 FCBuf<LFNEntry>& ,
00206 const size_t& )
00207 {
00208 throw FCTransactionException
00209 ("PFNCatalog::retrieveLFN",
00210 "retrieving LFN is not supported for PFNCatalogs");
00211
00212 return false;
00213 }
00214
00215 bool
00216 pool::PFNCatalog::retrieveGuid (const std::string& ,
00217 FCBuf<FileCatalog::FileID>& ,
00218 const size_t& )
00219 {
00220 throw FCTransactionException
00221 ("PFNCatalog::retrieveGuid",
00222 "retrieving Guid is not supported for PFNCatalogs");
00223
00224 return false;
00225 }