ATLAS Offline Software
Loading...
Searching...
No Matches
InsertFileToCatalogApplication Class Reference
Inheritance diagram for InsertFileToCatalogApplication:
Collaboration diagram for InsertFileToCatalogApplication:

Public Member Functions

 InsertFileToCatalogApplication (int argc, char *argv[])
bool parseArguments ()
void execute ()
void printSyntax ()
virtual int run ()
virtual void startSession ATLAS_NOT_THREAD_SAFE ()
virtual void readFileGUIDs ()
virtual std::string readFileGUID (const std::string &pfn)

Static Public Member Functions

static bool initGaudi ()
 initialize the Gaudi framework for standalone executables

Protected Attributes

std::string executableName
std::string technologyName
pool::IStorageSvc * storageSvc = nullptr
std::vector< std::string > args
std::vector< std::string > fileNames
std::vector< std::pair< std::string, std::string > > fidAndPfn

Private Attributes

std::string m_catalogFN

Detailed Description

Definition at line 15 of file pool_insertFileToCatalog.cxx.

Constructor & Destructor Documentation

◆ InsertFileToCatalogApplication()

InsertFileToCatalogApplication::InsertFileToCatalogApplication ( int argc,
char * argv[] )

Definition at line 29 of file pool_insertFileToCatalog.cxx.

30 : SimpleUtilityBase( argc, argv )
31{
32 initGaudi();
33}
static bool initGaudi()
initialize the Gaudi framework for standalone executables
SimpleUtilityBase(int argc=0, char *argv[]=0)
constructor taking commandline parmeters

Member Function Documentation

◆ ATLAS_NOT_THREAD_SAFE()

virtual void startSession pool::SimpleUtilityBase::ATLAS_NOT_THREAD_SAFE ( )
virtualinherited

◆ execute()

void InsertFileToCatalogApplication::execute ( )
virtual

Reimplemented from pool::SimpleUtilityBase.

Definition at line 66 of file pool_insertFileToCatalog.cxx.

67{
68 startSession();
70
71 // Open the file catalog and insert the pfn/fid/technology
72 SmartIF<Gaudi::IFileCatalogMgr> catalogMgr = Gaudi::svcLocator()->service<Gaudi::IFileCatalogMgr>( "Gaudi::MultiFileCatalog" );
73 SmartIF<Gaudi::IFileCatalog> catalog( catalogMgr );
74 FileCatalogUtils::addCatalog( *catalogMgr, m_catalogFN, true );
75 catalog->init();
76
77 for( const auto& fp : fidAndPfn ) {
78 std::string fid = fp.first; // can't be const
79 FileCatalogUtils::registerPFN(*catalog, fp.second, technologyName, fid);
80 }
81 catalog->commit();
82}
virtual void readFileGUIDs()
std::vector< std::pair< std::string, std::string > > fidAndPfn
void registerPFN(Gaudi::IFileCatalog &fc, const std::string &pfn, const std::string &ftype, std::string &fid)
Register PFN, assign new FID if not given. Throws if the PFN is already registered.
std::string addCatalog(Gaudi::IFileCatalogMgr &mgr, const std::string &connect, bool forWriting=false)
Add new catalog, identified by name, to the existing ones, optionally as the write catalog.

◆ initGaudi()

bool pool::SimpleUtilityBase::initGaudi ( )
staticinherited

initialize the Gaudi framework for standalone executables

◆ parseArguments()

bool InsertFileToCatalogApplication::parseArguments ( )
virtual

Reimplemented from pool::SimpleUtilityBase.

Definition at line 37 of file pool_insertFileToCatalog.cxx.

38{
39 unsigned int excludedArgument = 0;
40 for ( unsigned int iArg = 0; iArg < args.size(); ++iArg ) {
41 if ( iArg > 0 && iArg == excludedArgument )
42 continue;
43 const std::string& arg = args[iArg];
44 if ( arg == "-u" ) {
45 unsigned int nextArgumentIndex = iArg + 1;
46 if( nextArgumentIndex < args.size() ) {
47 excludedArgument = nextArgumentIndex;
48 m_catalogFN = args[nextArgumentIndex];
49 }
50 }
51 else if( arg == "-t" ) {
52 unsigned int nextArgumentIndex = iArg + 1;
53 if ( nextArgumentIndex < args.size() ) {
54 excludedArgument = nextArgumentIndex;
55 technologyName = args[nextArgumentIndex];
56 }
57 }
58 else {
59 fileNames.push_back( arg );
60 }
61 }
63}
std::vector< std::string > fileNames
std::vector< std::string > args
virtual bool parseArguments()

◆ printSyntax()

void InsertFileToCatalogApplication::printSyntax ( )
virtual

Reimplemented from pool::SimpleUtilityBase.

Definition at line 86 of file pool_insertFileToCatalog.cxx.

87{
88 std::cout << "Syntax : " << executableName << " [-u fileCatalog] [-t technologyType] files" << std::endl;
89}

◆ readFileGUID()

virtual std::string pool::SimpleUtilityBase::readFileGUID ( const std::string & pfn)
virtualinherited

◆ readFileGUIDs()

virtual void pool::SimpleUtilityBase::readFileGUIDs ( )
virtualinherited

◆ run()

virtual int pool::SimpleUtilityBase::run ( )
virtualinherited

Member Data Documentation

◆ args

std::vector< std::string > pool::SimpleUtilityBase::args
protectedinherited

Definition at line 47 of file SimpleUtilityBase.h.

◆ executableName

std::string pool::SimpleUtilityBase::executableName
protectedinherited

Definition at line 43 of file SimpleUtilityBase.h.

◆ fidAndPfn

std::vector< std::pair< std::string, std::string > > pool::SimpleUtilityBase::fidAndPfn
protectedinherited

Definition at line 49 of file SimpleUtilityBase.h.

◆ fileNames

std::vector< std::string > pool::SimpleUtilityBase::fileNames
protectedinherited

Definition at line 48 of file SimpleUtilityBase.h.

◆ m_catalogFN

std::string InsertFileToCatalogApplication::m_catalogFN
private

Definition at line 24 of file pool_insertFileToCatalog.cxx.

◆ storageSvc

pool::IStorageSvc* pool::SimpleUtilityBase::storageSvc = nullptr
protectedinherited

Definition at line 45 of file SimpleUtilityBase.h.

◆ technologyName

std::string pool::SimpleUtilityBase::technologyName
protectedinherited

Definition at line 44 of file SimpleUtilityBase.h.


The documentation for this class was generated from the following file: