Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v36r16 (ea80daf8)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
XMLFileCatalog.cpp
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #include "xercesc/dom/DOM.hpp"
12 #include "xercesc/framework/LocalFileFormatTarget.hpp"
13 #include "xercesc/framework/MemBufInputSource.hpp"
14 #include "xercesc/parsers/XercesDOMParser.hpp"
15 #include "xercesc/sax/EntityResolver.hpp"
16 #include "xercesc/sax/InputSource.hpp"
17 #include "xercesc/sax/SAXParseException.hpp"
18 #include "xercesc/util/PlatformUtils.hpp"
19 #include "xercesc/util/XMLString.hpp"
20 #include "xercesc/util/XMLURL.hpp"
21 #include "xercesc/util/XMLUni.hpp"
22 #include "xercesc/util/XercesDefs.hpp"
23 
24 #include "GaudiKernel/MsgStream.h"
25 #include "GaudiKernel/Service.h"
26 #include <Gaudi/PluginService.h>
27 
28 #include "XMLFileCatalog.h"
29 #include "createGuidAsString.h"
30 
31 #include <fstream>
32 #include <iostream>
33 #include <stdexcept>
34 #include <sys/stat.h>
35 #include <sys/types.h>
36 
37 using namespace xercesc;
38 using namespace Gaudi;
39 using namespace std;
40 
41 #if _XERCES_VERSION <= 30000
42 // API change between XercesC 2 and 3
43 # define setIdAttribute( a, b ) setIdAttribute( a )
44 #endif
45 
47 
48 namespace {
49 
50  typedef const string& CSTR;
51  inline string _toString( const XMLCh* toTranscode ) {
52  char* buff = XMLString::transcode( toTranscode );
53  string tmp( buff == 0 ? "" : buff );
54  XMLString::release( &buff );
55  return tmp;
56  }
57  struct __Init {
58  __Init() {
59  try {
60  XMLPlatformUtils::Initialize();
61  } catch ( const XMLException& e ) {
62  cout << "Xerces-c error in initialization:" << _toString( e.getMessage() ) << endl;
63  }
64  }
65  ~__Init() { XMLPlatformUtils::Terminate(); }
66  };
67  __Init __In__;
68 
69  struct XMLStr {
70  XMLCh* m_xml;
71  XMLStr( CSTR c ) { m_xml = XMLString::transcode( c.c_str() ); }
72  ~XMLStr() {
73  if ( m_xml ) XMLString::release( &m_xml );
74  }
75  operator const XMLCh*() const { return m_xml; }
76  };
77  struct XMLTag : public XMLStr {
78  string m_str;
79  XMLTag( CSTR s ) : XMLStr( s ), m_str( s ) {}
80  ~XMLTag() {}
81  operator CSTR() const { return m_str; }
82  };
83  // bool operator==(const XMLTag& b, CSTR c) { return c==b.m_str; }
84  bool operator==( CSTR c, const XMLTag& b ) { return c == b.m_str; }
85  struct XMLCollection {
86  DOMElement* m_node;
87  XMLCollection( DOMNode* n, bool use_children = true ) : m_node( (DOMElement*)n ) {
88  if ( use_children ) {
89  if ( m_node ) m_node = (DOMElement*)m_node->getFirstChild();
90  if ( m_node && m_node->getNodeType() != DOMNode::ELEMENT_NODE ) ++( *this );
91  }
92  }
93  operator bool() const { return m_node; }
94  operator DOMNode*() const { return m_node; }
95  operator DOMElement*() const { return m_node; }
96  DOMElement* operator->() const { return m_node; }
97  string attr( const XMLTag& tag ) const { return _toString( m_node->getAttribute( tag ) ); }
98  string attr( CSTR tag ) const { return attr( XMLTag( tag ) ); }
99  string tag() const { return _toString( m_node->getTagName() ); }
100  void operator++() {
101  while ( m_node ) {
102  m_node = (DOMElement*)m_node->getNextSibling();
103  if ( m_node && m_node->getNodeType() == DOMNode::ELEMENT_NODE ) { return; }
104  }
105  }
106  };
107  struct ErrHandler : public ErrorHandler {
109  IMessageSvc* m_msg;
111  ErrHandler( IMessageSvc* m ) : m_msg( m ) {}
113  void resetErrors() override {}
115  void warning( const SAXParseException& /* e */ ) override {}
117  void error( const SAXParseException& e ) override;
119  void fatalError( const SAXParseException& e ) override;
120  };
121  struct DTDRedirect : public EntityResolver {
122  InputSource* resolveEntity( const XMLCh* const /* pubId */, const XMLCh* const /* sysId */ ) override {
123  static const char* dtdID = "redirectinmem.dtd";
124  static const char* dtd = "\
125  <!ELEMENT POOLFILECATALOG (META*,File*)>\
126  <!ELEMENT META EMPTY>\
127  <!ELEMENT File (physical,logical,metadata*)>\
128  <!ATTLIST META name CDATA #REQUIRED>\
129  <!ATTLIST META type CDATA #REQUIRED>\
130  <!ELEMENT physical (pfn)+>\
131  <!ELEMENT logical (lfn)*>\
132  <!ELEMENT metadata EMPTY>\
133  <!ELEMENT lfn EMPTY>\
134  <!ELEMENT pfn EMPTY>\
135  <!ATTLIST File ID ID #REQUIRED>\
136  <!ATTLIST pfn name ID #REQUIRED>\
137  <!ATTLIST pfn filetype CDATA #IMPLIED>\
138  <!ATTLIST pfn se CDATA #IMPLIED>\
139  <!ATTLIST lfn name ID #REQUIRED>\
140  <!ATTLIST metadata att_name CDATA #REQUIRED>\
141  <!ATTLIST metadata att_value CDATA #REQUIRED>\
142  ";
143  static const size_t len = strlen( dtd );
144  return new MemBufInputSource( (const XMLByte*)dtd, len, dtdID, false );
145  }
146  };
147 
148  void ErrHandler::error( const SAXParseException& e ) {
149  string m( _toString( e.getMessage() ) );
150  if ( m.find( "The values for attribute 'name' must be names or name tokens" ) != string::npos ||
151  m.find( "The values for attribute 'ID' must be names or name tokens" ) != string::npos ||
152  m.find( "for attribute 'name' must be Name or Nmtoken" ) != string::npos ||
153  m.find( "for attribute 'ID' must be Name or Nmtoken" ) != string::npos ||
154  m.find( "for attribute 'name' is invalid Name or NMTOKEN value" ) != string::npos ||
155  m.find( "for attribute 'ID' is invalid Name or NMTOKEN value" ) != string::npos )
156  return;
157  string sys( _toString( e.getSystemId() ) );
158  MsgStream log( m_msg, "XMLCatalog" );
159  log << MSG::ERROR << "Error at file \"" << sys << "\", line " << e.getLineNumber() << ", column "
160  << e.getColumnNumber() << endmsg << "Message: " << m << endmsg;
161  }
162  void ErrHandler::fatalError( const SAXParseException& e ) {
163  MsgStream log( m_msg, "XMLCatalog" );
164  string m( _toString( e.getMessage() ) );
165  string sys( _toString( e.getSystemId() ) );
166  log << MSG::ERROR << "Fatal Error at file \"" << sys << "\", line " << e.getLineNumber() << ", column "
167  << e.getColumnNumber() << endmsg << "Message: " << m << endmsg;
168  throw runtime_error( "Standard pool exception : Fatal Error on the DOM Parser" );
169  }
170 
171  const XMLTag EmptyCatalog( "<!-- Edited By POOL -->\n"
172  "<!DOCTYPE POOLFILECATALOG SYSTEM \"InMemory\">\n"
173  "<POOLFILECATALOG>\n"
174  "</POOLFILECATALOG>\n" );
175  const XMLTag PFNCOLL( "physical" );
176  const XMLTag LFNCOLL( "logical" );
177  const XMLTag PFNNODE( "pfn" );
178  const XMLTag LFNNODE( "lfn" );
179  const XMLTag Attr_type( "type" );
180  const XMLTag Attr_ID( "ID" );
181  const XMLTag Attr_name( "name" );
182  const XMLTag Attr_ftype( "filetype" );
183  const XMLTag MetaNode( "metadata" );
184  const XMLTag Attr_metaName( "att_name" );
185  const XMLTag Attr_metaValue( "att_value" );
186 } // namespace
187 
188 // ----------------------------------------------------------------------------
189 XMLFileCatalog::XMLFileCatalog( CSTR uri, IMessageSvc* m ) : m_file( uri ), m_msgSvc( m ) {}
190 // ----------------------------------------------------------------------------
193 // ----------------------------------------------------------------------------
194 DOMDocument* XMLFileCatalog::getDoc( bool throw_if_no_exists ) const {
195  if ( !m_doc && throw_if_no_exists ) printError( "The XML catalog was not started.", true );
196  return m_doc;
197 }
198 // ----------------------------------------------------------------------------
199 void XMLFileCatalog::printError( CSTR msg, bool rethrow ) const {
200  MsgStream log( m_msgSvc, "XMLCatalog" );
201  log << MSG::FATAL << msg << endmsg;
202  if ( rethrow ) throw runtime_error( "XMLFileCatalog> " + msg );
203 }
204 // ----------------------------------------------------------------------------
206  string xmlFile = getfile( false );
207  try {
208  m_parser = std::make_unique<XercesDOMParser>();
209  m_parser->setValidationScheme( XercesDOMParser::Val_Auto );
210  m_parser->setDoNamespaces( false );
211  DTDRedirect dtdinmem;
212  m_parser->setEntityResolver( &dtdinmem );
213  if ( !m_errHdlr ) m_errHdlr = std::make_unique<ErrHandler>( m_msgSvc );
214  m_parser->setErrorHandler( m_errHdlr.get() );
215  if ( !xmlFile.empty() ) {
216  m_parser->parse( xmlFile.c_str() );
217  } else {
218  const std::string& s = EmptyCatalog;
219  MemBufInputSource src( (const XMLByte*)s.c_str(), s.length(), "MemCatalog" );
220  m_parser->parse( src );
221  }
222  m_doc = m_parser->getDocument();
223  } catch ( const XMLException& e ) {
224  printError( "XML parse error[" + xmlFile + "]: " + _toString( e.getMessage() ) );
225  } catch ( const DOMException& e ) {
226  printError( "XML parse error[" + xmlFile + "]: " + _toString( e.getMessage() ) );
227  } catch ( ... ) { printError( "UNKNOWN XML parse error in file " + xmlFile ); }
228 }
229 // ----------------------------------------------------------------------------
230 string XMLFileCatalog::lookupFID( const std::string& fid ) const {
231  std::string result;
232  DOMNode* e = element( fid, false );
233  e = e ? e->getParentNode() : 0; // Mode up to <logical>
234  e = e ? e->getParentNode() : 0; // Mode up to <File>
235  if ( e ) {
236  if ( e->getAttributes() ) { // Need to check this. The node may be no DOMElement
237  char* nam = XMLString::transcode( ( (DOMElement*)e )->getAttribute( Attr_ID ) );
238  if ( nam ) result = nam;
239  XMLString::release( &nam );
240  }
241  }
242  return result;
243 }
244 // ----------------------------------------------------------------------------
245 void XMLFileCatalog::getFID( Strings& fids ) const {
246  fids.clear();
247  DOMNode* fde = getDoc( true )->getElementsByTagName( XMLStr( "*" ) )->item( 0 );
248  for ( XMLCollection c( child( fde, "File" ), false ); c; ++c ) fids.push_back( c.attr( Attr_ID ) );
249 }
250 // ----------------------------------------------------------------------------
251 void XMLFileCatalog::getPFN( CSTR fid, Files& files ) const {
252  files.clear();
253  for ( XMLCollection c( child( child( element( fid, false ), PFNCOLL ), PFNNODE ), false ); c; ++c )
254  files.emplace_back( c.attr( Attr_name ), c.attr( Attr_ftype ) );
255 }
256 // ----------------------------------------------------------------------------
257 void XMLFileCatalog::getLFN( CSTR fid, Files& files ) const {
258  files.clear();
259  for ( XMLCollection c( child( child( element( fid, false ), LFNCOLL ), LFNNODE ), false ); c; ++c )
260  files.emplace_back( c.attr( Attr_name ), fid );
261 }
262 // ----------------------------------------------------------------------------
263 void XMLFileCatalog::getMetaData( CSTR fid, Attributes& attr ) const {
264  attr.clear();
265  for ( XMLCollection c( child( element( fid ), MetaNode ), false ); c; ++c )
266  attr.emplace_back( c.attr( Attr_metaName ), c.attr( Attr_metaValue ) );
267  if ( attr.size() > 0 ) attr.emplace_back( "guid", fid );
268 }
269 // ----------------------------------------------------------------------------
270 DOMNode* XMLFileCatalog::child( DOMNode* par, CSTR tag, CSTR attr, CSTR val ) const {
271  for ( XMLCollection c( par ); c; ++c ) {
272  if ( c.tag() == tag ) {
273  if ( !attr.empty() && c.attr( attr ) != val ) continue;
274  return c;
275  }
276  }
277  return 0;
278 }
279 // ----------------------------------------------------------------------------
280 void XMLFileCatalog::setMetaData( CSTR fid, CSTR attr, CSTR val ) const {
281  if ( !readOnly() ) {
282  DOMNode* node = element( fid );
283  DOMElement* mnod = (DOMElement*)child( node, MetaNode, Attr_metaName, attr );
284  if ( !mnod ) {
285  mnod = getDoc( true )->createElement( MetaNode );
286  node->appendChild( mnod );
287  mnod->setAttribute( Attr_metaName, XMLStr( attr ) );
288  }
289  mnod->setAttribute( Attr_metaValue, XMLStr( val ) );
290  m_update = true;
291  return;
292  }
293  printError( "Cannot update readonly catalog!" );
294 }
295 // ----------------------------------------------------------------------------
296 string XMLFileCatalog::getMetaDataItem( CSTR fid, CSTR attr ) const {
297  XMLCollection c( child( getDoc( true )->getElementById( XMLStr( fid ) ), MetaNode, Attr_metaName, attr ) );
298  return c ? c.attr( attr ) : string( "" );
299 }
300 // ----------------------------------------------------------------------------
301 void XMLFileCatalog::dropMetaData( CSTR fid, CSTR attr ) const {
302  vector<DOMNode*> gbc;
303  DOMNode* fn = getDoc( true )->getElementById( XMLStr( fid ) );
304  for ( XMLCollection c{ child( fn, MetaNode ) }; c; ++c )
305  if ( attr[0] == '*' || !c.attr( attr ).empty() ) gbc.push_back( c );
306  for ( const auto& i : gbc ) fn->removeChild( i );
307 }
308 // ----------------------------------------------------------------------------
309 DOMNode* XMLFileCatalog::element( CSTR element_name, bool print_err ) const {
310  DOMNode* node = getDoc( true )->getElementById( XMLStr( element_name ) );
311  if ( !node && print_err ) printError( "Cannot find element:" + element_name );
312  return node;
313 }
314 // ----------------------------------------------------------------------------
315 void XMLFileCatalog::deleteFID( CSTR fid ) const {
316  DOMNode *pn = nullptr, *fn = element( fid );
317  if ( fn ) pn = fn->getParentNode();
318  if ( pn ) pn->removeChild( fn );
319 }
320 // ----------------------------------------------------------------------------
322  if ( !fid.empty() ) {
324  if ( res.first == 0 || res.second == 0 ) { printError( "Failed to register FID:" + fid ); }
325  return;
326  }
327  throw runtime_error( "XMLFileCatalog> Cannot register LFN for invalid FID:" + fid );
328 }
329 // ----------------------------------------------------------------------------
330 void XMLFileCatalog::renamePFN( CSTR pfn, CSTR new_pfn ) const {
331  DOMNode* node = getDoc( true )->getElementById( XMLStr( pfn ) );
332  if ( node && node->getNodeType() == DOMNode::ELEMENT_NODE ) {
333  ( (DOMElement*)node )->setAttribute( Attr_name, XMLStr( new_pfn ) );
334  m_update = true;
335  }
336 }
337 // ----------------------------------------------------------------------------
338 void XMLFileCatalog::deletePFN( CSTR pfn ) const {
339  DOMNode* node = getDoc( true )->getElementById( XMLStr( pfn ) );
340  if ( node ) {
341  DOMNode* pcoll_node = node->getParentNode();
342  pcoll_node->removeChild( node );
343  m_update = true;
344  for ( XMLCollection pcoll( pcoll_node, true ); pcoll; ++pcoll ) {
345  return; // there are other PFN entries left, so we are done
346  }
347  // delete empty file entry
348  DOMNode* file_node = pcoll_node->getParentNode();
349  file_node->getParentNode()->removeChild( file_node );
350  }
351 }
352 // ----------------------------------------------------------------------------
354  if ( readOnly() ) {
355  printError( "Cannot update readonly catalog!" );
356  return { nullptr, nullptr };
357  }
358 
360  DOMElement * file = (DOMElement*)element( fid, false ), *phyelem = 0, *logelem = 0;
361  DOMDocument* doc = getDoc( true );
362  if ( !file ) {
363  DOMNode* fde = doc->getElementsByTagName( XMLStr( "*" ) )->item( 0 );
364  file = m_doc->createElement( XMLStr( "File" ) );
365  file->setAttribute( Attr_ID, XMLStr( fid ) );
366  file->setIdAttribute( Attr_ID, true );
367  fde->appendChild( file );
368  m_update = true;
369  }
370  for ( XMLCollection c1( file ); c1; ++c1 ) {
371  char* nam = XMLString::transcode( c1->getNodeName() );
372  if ( nam == PFNCOLL ) phyelem = c1;
373  if ( nam == LFNCOLL ) logelem = c1;
374  XMLString::release( &nam );
375  }
376  if ( !phyelem ) {
377  phyelem = doc->createElement( PFNCOLL );
378  file->appendChild( phyelem );
379  m_update = true;
380  }
381  if ( !logelem ) {
382  logelem = doc->createElement( LFNCOLL );
383  file->appendChild( logelem );
384  m_update = true;
385  }
386  return { logelem, phyelem };
387 }
388 // ----------------------------------------------------------------------------
389 void XMLFileCatalog::registerPFN( CSTR fid, CSTR pfn, CSTR ftype ) const {
390  if ( !fid.empty() ) {
392  DOMElement * phyelem = res.second, *fnelem = 0;
393  for ( XMLCollection c( phyelem ); c; ++c ) {
394  char* nam = XMLString::transcode( c->getNodeName() );
395  if ( nam == PFNNODE ) {
396  XMLString::release( &nam );
397  nam = XMLString::transcode( c->getAttribute( Attr_name ) );
398  if ( nam == pfn ) {
399  XMLString::release( &nam );
400  fnelem = c;
401  break;
402  }
403  }
404  XMLString::release( &nam );
405  }
406  if ( !fnelem ) {
407  fnelem = getDoc( true )->createElement( PFNNODE );
408  phyelem->appendChild( fnelem );
409  fnelem->setAttribute( Attr_ftype, XMLStr( ftype ) );
410  fnelem->setAttribute( Attr_name, XMLStr( pfn ) );
411  fnelem->setIdAttribute( Attr_name, true );
412  m_update = true;
413  }
414  return;
415  }
416  throw runtime_error( "XMLFileCatalog> Cannot register PFN for invalid FID:" + fid );
417 }
418 // ----------------------------------------------------------------------------
419 void XMLFileCatalog::registerLFN( CSTR fid, CSTR lfn ) const {
420  if ( !fid.empty() ) {
422  DOMElement * logelem = res.first, *fnelem = 0;
423  for ( XMLCollection c( logelem ); c; ++c ) {
424  char* nam = XMLString::transcode( c->getNodeName() );
425  if ( nam == LFNNODE ) {
426  XMLString::release( &nam );
427  nam = XMLString::transcode( c->getAttribute( Attr_name ) );
428  if ( nam == lfn ) {
429  XMLString::release( &nam );
430  fnelem = c;
431  break;
432  }
433  }
434  }
435  if ( !fnelem ) {
436  fnelem = getDoc( true )->createElement( LFNNODE );
437  logelem->appendChild( fnelem );
438  fnelem->setAttribute( Attr_name, XMLStr( lfn ) );
439  fnelem->setIdAttribute( Attr_name, true );
440  m_update = true;
441  }
442  return;
443  }
444  throw runtime_error( "XMLFileCatalog> Cannot register LFN for invalid FID:" + fid );
445 }
446 // ----------------------------------------------------------------------------
448  try {
449  if ( dirty() && !readOnly() ) {
450  string xmlfile = getfile( true );
451  XMLStr ii( "LS" );
452  DOMImplementation* imp = DOMImplementationRegistry::getDOMImplementation( ii );
453  auto tar = std::make_unique<LocalFileFormatTarget>( xmlfile.c_str() );
454 #if _XERCES_VERSION <= 30000
455  DOMWriter* wr = imp->createDOMWriter();
456  wr->setFeature( XMLUni::fgDOMWRTFormatPrettyPrint, true );
457  wr->writeNode( tar.get(), *m_doc );
458  wr->release();
459 #else
460  DOMLSOutput* output = imp->createLSOutput();
461  output->setByteStream( tar.get() );
462  DOMLSSerializer* wr = imp->createLSSerializer();
463  wr->getDomConfig()->setParameter( XMLStr( "format-pretty-print" ), true );
464  wr->write( m_doc, output );
465  output->release();
466  wr->release();
467 #endif
468  }
469  } catch ( exception& e ) { printError( string( "Cannot open output file:" ) + e.what() ); } catch ( ... ) {
470  printError( "Unknown IO rrror." );
471  }
472 }
473 // ----------------------------------------------------------------------------
474 string XMLFileCatalog::getfile( bool create ) {
475  string protocol, path;
476  XMLURL xerurl;
477  try {
478  xerurl = (const XMLCh*)XMLStr( m_file );
479  protocol = _toString( xerurl.getProtocolName() );
480  path = _toString( xerurl.getPath() );
481  } catch ( const XMLException& e ) { printError( _toString( e.getMessage() ) ); }
482  if ( protocol.empty() ) {
483  printError( "Missing protocol." );
484  } else if ( protocol == "http" || protocol == "ftp" ) {
485  m_rdOnly = true;
486  } else if ( protocol == "file" ) {
487  m_rdOnly = false;
488  struct stat buff;
489  int exist = ::stat( path.c_str(), &buff ) != -1;
490  if ( create && !exist ) {
491  MsgStream log( m_msgSvc, "XMLCatalog" );
492  log << MSG::INFO << "File '" << path << "' does not exist. New file created." << endmsg;
493  ofstream out{ path };
494  if ( !m_rdOnly && out.is_open() ) {
495  out << (CSTR)EmptyCatalog << endl;
496  } else {
497  printError( "Problem creating file " + path );
498  }
499  out.close();
500  } else if ( exist ) {
501  return path;
502  } else if ( !create ) {
503  return "";
504  }
505  } else {
506  printError( protocol + ": protocol not supported." );
507  }
508  return path;
509 }
Gaudi::XMLFileCatalog::deletePFN
void deletePFN(CSTR pfn) const override
remove a PFN
Definition: XMLFileCatalog.cpp:338
std::strlen
T strlen(T... args)
std::string
STL class.
IMessageSvc
Definition: IMessageSvc.h:47
std::exception
STL class.
Gaudi.Configuration.log
log
Definition: Configuration.py:30
AtlasMCRecoFullPrecedenceDump.path
path
Definition: AtlasMCRecoFullPrecedenceDump.py:49
Gaudi::XMLFileCatalog::m_parser
std::unique_ptr< xercesc::XercesDOMParser > m_parser
Definition: XMLFileCatalog.h:112
MSG::INFO
@ INFO
Definition: IMessageSvc.h:25
std::pair
Gaudi::XMLFileCatalog::child
xercesc::DOMNode * child(xercesc::DOMNode *par, CSTR tag, CSTR attr="", CSTR val="") const
Definition: XMLFileCatalog.cpp:270
gaudirun.s
string s
Definition: gaudirun.py:348
std::vector
STL class.
std::string::length
T length(T... args)
GaudiMP.FdsRegistry.msg
msg
Definition: FdsRegistry.py:19
std::unique_ptr::get
T get(T... args)
Gaudi::XMLFileCatalog::setMetaData
void setMetaData(CSTR fid, CSTR name, CSTR value) const override
Insert/update metadata item.
Definition: XMLFileCatalog.cpp:280
Gaudi::XMLFileCatalog::deleteFID
void deleteFID(CSTR FileID) const override
Delete FileID Node from the catalog.
Definition: XMLFileCatalog.cpp:315
conf.release
string release
Definition: conf.py:27
Gaudi::XMLFileCatalog::getLFN
void getLFN(CSTR fid, Files &files) const override
Dump all logical file names of the catalog associate to the FileID.
Definition: XMLFileCatalog.cpp:257
gaudirun.c
c
Definition: gaudirun.py:527
gaudirun.output
output
Definition: gaudirun.py:523
Gaudi::XMLFileCatalog::getPFN
void getPFN(CSTR fid, Files &files) const override
Dump all physical file names of the catalog and their attributes associate to the FileID.
Definition: XMLFileCatalog.cpp:251
Gaudi::XMLFileCatalog::commit
void commit() override
Save DOM catalog to file.
Definition: XMLFileCatalog.cpp:447
Gaudi::IFileCatalog::Factory
Gaudi::PluginService::Factory< IInterface *(const std::string &, IMessageSvc *)> Factory
Definition: IFileCatalog.h:42
std::vector::push_back
T push_back(T... args)
Gaudi::XMLFileCatalog::m_msgSvc
IMessageSvc * m_msgSvc
Definition: XMLFileCatalog.h:115
compareOutputFiles.par
par
Definition: compareOutputFiles.py:486
Gaudi::XMLFileCatalog::getfile
std::string getfile(bool create)
Definition: XMLFileCatalog.cpp:474
PluginService.h
Gaudi::XMLFileCatalog::registerLFN
void registerLFN(CSTR fid, CSTR lfn) const override
Create a FileID and Node of the logical file name with all the attributes.
Definition: XMLFileCatalog.cpp:419
Gaudi::Units::m
constexpr double m
Definition: SystemOfUnits.h:108
Gaudi::XMLFileCatalog::dropMetaData
void dropMetaData(CSTR fid) const override
Drop all metadata of one FID.
Definition: XMLFileCatalog.h:97
std::cout
std::ofstream
STL class.
Gaudi::XMLFileCatalog::dirty
bool dirty() const override
Check if the catalog should be updated.
Definition: XMLFileCatalog.h:61
Gaudi::XMLFileCatalog::m_doc
xercesc::DOMDocument * m_doc
Definition: XMLFileCatalog.h:111
std::string::c_str
T c_str(T... args)
Gaudi::XMLFileCatalog::i_registerFID
std::pair< xercesc::DOMElement *, xercesc::DOMElement * > i_registerFID(CSTR fid) const
Definition: XMLFileCatalog.cpp:353
Gaudi::XMLFileCatalog::m_rdOnly
bool m_rdOnly
Definition: XMLFileCatalog.h:109
Gaudi::XMLFileCatalog::element
xercesc::DOMNode * element(CSTR fid, bool print_err=true) const
Definition: XMLFileCatalog.cpp:309
std::runtime_error
STL class.
Gaudi::XMLFileCatalog::readOnly
bool readOnly() const override
Check if the catalog is read-only.
Definition: XMLFileCatalog.h:59
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:203
MsgStream
Definition: MsgStream.h:34
Gaudi
Header file for std:chrono::duration-based Counters.
Definition: __init__.py:1
MSG::FATAL
@ FATAL
Definition: IMessageSvc.h:25
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:235
Gaudi::XMLFileCatalog::printError
void printError(CSTR msg, bool throw_exc=true) const
Definition: XMLFileCatalog.cpp:199
BoostArrayProperties.Strings
Strings
Definition: BoostArrayProperties.py:35
Service.h
DECLARE_FACTORY
#define DECLARE_FACTORY(type, factory)
Definition: PluginServiceV1.h:41
createGuidAsString.h
std::endl
T endl(T... args)
Gaudi::XMLFileCatalog::CSTR
const std::string & CSTR
Definition: XMLFileCatalog.h:39
std
STL namespace.
AlgSequencer.c1
c1
Definition: AlgSequencer.py:33
MSG::ERROR
@ ERROR
Definition: IMessageSvc.h:25
Gaudi::XMLFileCatalog::registerPFN
void registerPFN(CSTR fid, CSTR pfn, CSTR ftype) const override
Create a FileID and Node of the physical file name with all the attributes.
Definition: XMLFileCatalog.cpp:389
Gaudi::XMLFileCatalog
Definition: XMLFileCatalog.h:37
Gaudi::XMLFileCatalog::init
void init() override
Parse the DOM tree of the XML catalog.
Definition: XMLFileCatalog.cpp:205
Gaudi::createGuidAsString
std::string createGuidAsString()
Helper function creating file identifier using the UUID mechanism.
Gaudi::XMLFileCatalog::renamePFN
void renamePFN(CSTR pfn, CSTR new_pfn) const override
rename a PFN
Definition: XMLFileCatalog.cpp:330
std::string::empty
T empty(T... args)
Gaudi::XMLFileCatalog::getMetaData
void getMetaData(CSTR fid, Attributes &attr) const override
Dump all MetaData of the catalog for a given file ID.
Definition: XMLFileCatalog.cpp:263
Gaudi::XMLFileCatalog::getDoc
xercesc::DOMDocument * getDoc(bool throw_if_no_exists=true) const
Definition: XMLFileCatalog.cpp:194
Gaudi::XMLFileCatalog::getMetaDataItem
std::string getMetaDataItem(CSTR fid, CSTR name) const override
Access metadata item.
Definition: XMLFileCatalog.cpp:296
Gaudi::XMLFileCatalog::m_update
bool m_update
Definition: XMLFileCatalog.h:110
Gaudi::XMLFileCatalog::registerFID
void registerFID(CSTR fid) const override
Create a FileID and Node.
Definition: XMLFileCatalog.cpp:321
Gaudi::XMLFileCatalog::m_file
std::string m_file
Definition: XMLFileCatalog.h:114
Gaudi::XMLFileCatalog::m_errHdlr
std::unique_ptr< xercesc::ErrorHandler > m_errHdlr
Definition: XMLFileCatalog.h:113
Gaudi::XMLFileCatalog::getFID
void getFID(Strings &fids) const override
Dump all file Identifiers.
Definition: XMLFileCatalog.cpp:245
Gaudi::Details::operator==
bool operator==(const PropertyId &lhs, const PropertyId &rhs)
Definition: PropertyId.h:110
CSTR
const std::string CSTR
Definition: MultiStoreSvc.cpp:51
std::exception::what
T what(T... args)
MsgStream.h
Gaudi::XMLFileCatalog::lookupFID
std::string lookupFID(CSTR lfn) const
Definition: XMLFileCatalog.cpp:230
PrepareBase.out
out
Definition: PrepareBase.py:20
XMLFileCatalog.h
Gaudi::XMLFileCatalog::createFID
std::string createFID() const override
Catalog interface
Definition: XMLFileCatalog.cpp:192