diff --git a/Database/APR/FileCatalog/FileCatalog/IFileCatalog.h b/Database/APR/FileCatalog/FileCatalog/IFileCatalog.h index 756b3f6bfd982a4ba5175377539659027aed142f..bc774adcde7037f6db38c13e76f2810f6c137f27 100644 --- a/Database/APR/FileCatalog/FileCatalog/IFileCatalog.h +++ b/Database/APR/FileCatalog/FileCatalog/IFileCatalog.h @@ -53,13 +53,13 @@ namespace pool { bool dirty() const { return _fc->dirty(); } /// Get all FIDs - void getFIDs( Strings& fids ) const { return _fc->getFID(fids); } + void getFIDs( Strings& fids ) const { _fc->getFID(fids); } /// Get all logical names for a given FID. Return pairs <LFN,FID> - void getLFNs( const std::string& fid, Files& files ) const { return _fc->getLFN(fid, files); } + void getLFNs( const std::string& fid, Files& files ) const { _fc->getLFN(fid, files); } /// Dump all PFNames of the catalog and their attributes associate to the FileID - void getPFNs( const std::string& fid, Files& files ) const { return _fc->getPFN(fid, files); } + void getPFNs( const std::string& fid, Files& files ) const { _fc->getPFN(fid, files); } /// Get the first PFN + filetype for the given FID void getFirstPFN( const std::string& fid, std::string& pfn, std::string& tech ) const; @@ -84,16 +84,16 @@ namespace pool { // bool existsFID( const std::string& fid ) const = 0; /// Delete FileID Node from the catalog - void deleteFID( const std::string& FileID ) { return _fc->deleteFID(FileID); } + void deleteFID( const std::string& FileID ) { _fc->deleteFID(FileID); } /// Delete PFN from the catalog (delete entire FID entry if it was the last PFN) - void deletePFN( const std::string& pfn ); + void deletePFN( const std::string& pfn ) { _fc->deletePFN(pfn); } /// Register PFN, assign new FID if not given void registerPFN( const std::string& pfn, const std::string& ftype, std::string& fid ); /// Rename PFN - void renamePFN( const std::string& pfn, const std::string& newpfn ); + void renamePFN( const std::string& pfn, const std::string& newpfn ) { _fc->renamePFN(pfn, newpfn); } /// adding replica to an existing PFN void addReplicaPFN( const std::string& pfn, const std::string& replica_pfn ); diff --git a/Database/APR/FileCatalog/src/IFileCatalog.cpp b/Database/APR/FileCatalog/src/IFileCatalog.cpp index 1a283ffd02691010f2147fad528ba665da587ea5..3830d0778662ecf9589d83d59c62a2cc985e51f9 100644 --- a/Database/APR/FileCatalog/src/IFileCatalog.cpp +++ b/Database/APR/FileCatalog/src/IFileCatalog.cpp @@ -68,52 +68,6 @@ lookupFileByPFN( const std::string& pfn, std::string& fid, std::string& tech ) c } -/// Delete PFN from the catalog (delete entire FID entry if it was the last PFN) -void pool::IFileCatalog:: -deletePFN( const std::string& pfn ) -{ - std::string fid = _fc->lookupPFN(pfn); - if( !fid.empty() ) { - Files pfns, lfns; - getPFNs( fid, pfns ); - getLFNs( fid, lfns ); - deleteFID( fid ); - for( const auto& p: pfns ) { - if( p.first != pfn ) registerPFN( p.first, p.second, fid ); - } - for( const auto& l: lfns ) { - registerLFN( fid, l.first ); - } - } -} - - -/// Rename PFN -void pool::IFileCatalog:: -renamePFN( const std::string& pfn, const std::string& newpfn ) -{ - std::string fid = _fc->lookupPFN(pfn); - if( !fid.empty() ) { - Files pfns, lfns; - getPFNs( fid, pfns ); - getLFNs( fid, lfns ); - deleteFID( fid ); - for( const auto& p: pfns ) { - if( p.first == pfn ) { - registerPFN( newpfn, p.second, fid ); - } else { - registerPFN( p.first, p.second, fid ); - } - } - for( const auto& l: lfns ) { - registerLFN( fid, l.first ); - } - } else { - ATH_MSG_DEBUG("RenamePFN: PFN=" << pfn << " not found!"); - } -} - - /// Register PFN, assign new FID if not given void pool::IFileCatalog:: registerPFN( const std::string& pfn, const std::string& ftype, std::string& fid ) diff --git a/Database/APR/FileCatalog/utilities/FCaddReplica.cpp b/Database/APR/FileCatalog/utilities/FCaddReplica.cpp index 483367a9741d2f5051f287c1c23162c30119a444..c6d4591f7037a78cf596260ffff232469488cbf2 100755 --- a/Database/APR/FileCatalog/utilities/FCaddReplica.cpp +++ b/Database/APR/FileCatalog/utilities/FCaddReplica.cpp @@ -9,6 +9,7 @@ #include "FileCatalog/CommandLine.h" #include "FileCatalog/IFileCatalog.h" +#include "FileCatalog/URIParser.h" #include "POOLCore/Exception.h" #include "POOLCore/SystemTools.h" #include <memory> @@ -36,7 +37,9 @@ int main(int argc, char** argv) if( commands.Exists("u") ){ myuri=commands.GetByName("u"); - } + } else { + myuri=SystemTools::GetEnvStr("POOL_CATALOG"); + } if( commands.Exists("p") ){ mypfn=commands.GetByName("p"); } @@ -67,7 +70,9 @@ int main(int argc, char** argv) } try{ std::auto_ptr<IFileCatalog> mycatalog(new IFileCatalog); - mycatalog->setWriteCatalog(myuri); + pool::URIParser p( myuri ); + p.parse(); + mycatalog->setWriteCatalog(p.contactstring()); if( !mypfn.empty() ){ mycatalog->connect(); mycatalog->start();