The Gaudi Framework  master (181af51f)
Loading...
Searching...
No Matches
XMLFileCatalog.cpp
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2024 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 <Gaudi/PluginService.h>
26#include <GaudiKernel/Service.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
37using namespace xercesc;
38using namespace Gaudi;
39using 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
48namespace {
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// ----------------------------------------------------------------------------
190// ----------------------------------------------------------------------------
192std::string XMLFileCatalog::createFID() const { return createGuidAsString(); }
193// ----------------------------------------------------------------------------
194DOMDocument* 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// ----------------------------------------------------------------------------
199void 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// ----------------------------------------------------------------------------
230string 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// ----------------------------------------------------------------------------
245void 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// ----------------------------------------------------------------------------
251void 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// ----------------------------------------------------------------------------
257void 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// ----------------------------------------------------------------------------
263void 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// ----------------------------------------------------------------------------
270DOMNode* 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// ----------------------------------------------------------------------------
280void 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// ----------------------------------------------------------------------------
296string 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// ----------------------------------------------------------------------------
301void 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// ----------------------------------------------------------------------------
309DOMNode* 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// ----------------------------------------------------------------------------
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() ) {
323 std::pair<DOMElement*, DOMElement*> res = i_registerFID( fid );
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// ----------------------------------------------------------------------------
330void 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// ----------------------------------------------------------------------------
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// ----------------------------------------------------------------------------
353std::pair<DOMElement*, DOMElement*> XMLFileCatalog::i_registerFID( CSTR fid ) const {
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// ----------------------------------------------------------------------------
389void XMLFileCatalog::registerPFN( CSTR fid, CSTR pfn, CSTR ftype ) const {
390 if ( !fid.empty() ) {
391 std::pair<DOMElement*, DOMElement*> res = i_registerFID( fid );
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// ----------------------------------------------------------------------------
419void XMLFileCatalog::registerLFN( CSTR fid, CSTR lfn ) const {
420 if ( !fid.empty() ) {
421 std::pair<DOMElement*, DOMElement*> res = i_registerFID( fid );
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// ----------------------------------------------------------------------------
474string 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}
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198
const std::string CSTR
#define DECLARE_FACTORY(type, factory)
Gaudi::PluginService::Factory< IInterface *(const std::string &, IMessageSvc *)> Factory
This class constitutes the core of the XML based FileCatalog API for POOL.
std::string getfile(bool create)
void getLFN(CSTR fid, Files &files) const override
Dump all logical file names of the catalog associate to the FileID.
const std::string & CSTR
std::pair< xercesc::DOMElement *, xercesc::DOMElement * > i_registerFID(CSTR fid) const
std::unique_ptr< xercesc::ErrorHandler > m_errHdlr
void registerPFN(CSTR fid, CSTR pfn, CSTR ftype) const override
Create a FileID and Node of the physical file name with all the attributes.
void getPFN(CSTR fid, Files &files) const override
Dump all physical file names of the catalog and their attributes associate to the FileID.
void getMetaData(CSTR fid, Attributes &attr) const override
Dump all MetaData of the catalog for a given file ID.
void getFID(Strings &fids) const override
Dump all file Identifiers.
void init() override
Parse the DOM tree of the XML catalog.
xercesc::DOMNode * child(xercesc::DOMNode *par, CSTR tag, CSTR attr="", CSTR val="") const
std::unique_ptr< xercesc::XercesDOMParser > m_parser
xercesc::DOMDocument * getDoc(bool throw_if_no_exists=true) const
void registerFID(CSTR fid) const override
Create a FileID and Node.
void deletePFN(CSTR pfn) const override
remove a PFN
std::string createFID() const override
Catalog interface.
XMLFileCatalog(CSTR url, IMessageSvc *m)
Create a catalog file, initialization of XercesC.
void setMetaData(CSTR fid, CSTR name, CSTR value) const override
Insert/update metadata item.
void printError(CSTR msg, bool throw_exc=true) const
void commit() override
Save DOM catalog to file.
void registerLFN(CSTR fid, CSTR lfn) const override
Create a FileID and Node of the logical file name with all the attributes.
xercesc::DOMDocument * m_doc
void dropMetaData(CSTR fid) const override
Drop all metadata of one FID.
bool dirty() const override
Check if the catalog should be updated.
bool readOnly() const override
Check if the catalog is read-only.
std::string getMetaDataItem(CSTR fid, CSTR name) const override
Access metadata item.
void deleteFID(CSTR FileID) const override
Delete FileID Node from the catalog.
std::string lookupFID(CSTR lfn) const
void renamePFN(CSTR pfn, CSTR new_pfn) const override
rename a PFN
xercesc::DOMNode * element(CSTR fid, bool print_err=true) const
The IMessage is the interface implemented by the message service.
Definition IMessageSvc.h:34
Definition of the MsgStream class used to transmit messages.
Definition MsgStream.h:29
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition __init__.py:1
std::string createGuidAsString()
Helper function creating file identifier using the UUID mechanism.
bool operator==(const T &v, const Property< TP, V, H > &p)
delegate (value == property) to property operator==
Definition Property.h:420
@ FATAL
Definition IMessageSvc.h:22
@ ERROR
Definition IMessageSvc.h:22
@ INFO
Definition IMessageSvc.h:22
STL namespace.