| # Gaudi Framework, version v20r3
Generated: 24 Nov 2008

# Gaudi::XMLFileCatalog Class Reference

`#include <XMLFileCatalog.h>`

Inheritance diagram for Gaudi::XMLFileCatalog:

[legend]
Collaboration diagram for Gaudi::XMLFileCatalog:

[legend]

List of all members.

## Detailed Description

This class constitutes the core of the XML based FileCatalog API for POOL.

It uses the DOM model and the external XercesC library for parsing.

Definition at line 25 of file XMLFileCatalog.h.

## Public Member Functions
| XMLFileCatalog (CSTR url, IMessageSvc *m)
| Create a catalog file, initialization of XercesC.
virtual | ~XMLFileCatalog ()
| Destructor,.
virtual unsigned long | addRef ()
| IInterface implementation.
virtual unsigned long | release ()
| release catalog
virtual StatusCode | queryInterface (const InterfaceID &id, void **ppv)
| Query interface.
virtual std::string | createFID () const
| Catalog interface.
virtual CSTR | connectInfo () const
| Access to connect string.
virtual void | init ()
| Parse the DOM tree of the XML catalog.
virtual void | commit ()
| Save DOM catalog to file.
virtual void | rollback ()
| Save DOM catalog to file.
virtual bool | readOnly () const
| Check if the catalog is read-only.
virtual bool | dirty () const
| Check if the catalog should be updated.
virtual bool | existsPFN (CSTR pfn) const
| Return the status of a physical file name.
virtual std::string | lookupPFN (CSTR fid) const
| Lookup file identifier by physical file name.
virtual bool | existsLFN (CSTR lfn) const
| Return the status of a logical file name.
virtual std::string | lookupLFN (CSTR lfn) const
| Lookup file identifier by logical file name.
virtual bool | existsFID (CSTR fid) const
| Return the status of a FileID.
virtual void | getPFN (CSTR fid, Files &files) const
| Dump all physical file names of the catalog and their attributes associate to the FileID.
virtual void | getLFN (CSTR fid, Files &files) const
| Dump all logical file names of the catalog associate to the FileID.
virtual void | getFID (Strings &fids) const
| Dump all file Identifiers.
virtual void | deleteFID (CSTR FileID) const
| Delete FileID Node from the catalog.
virtual void | registerPFN (CSTR fid, CSTR pfn, CSTR ftype) const
| Create a FileID and Node of the physical file name with all the attributes.
virtual void | registerLFN (CSTR fid, CSTR lfn) const
| Create a FileID and Node of the logical file name with all the attributes.
virtual void | registerFID (CSTR fid) const
| Create a FileID and Node.
virtual void | getMetaData (CSTR fid, Attributes &attr) const
| Dump all MetaData of the catalog for a given file ID.
virtual std::string | getMetaDataItem (CSTR fid, CSTR name) const
| Access metadata item.
virtual void | setMetaData (CSTR fid, CSTR name, CSTR value) const
| Insert/update metadata item.
virtual void | dropMetaData (CSTR fid) const
| Drop all metadata of one FID.
virtual void | dropMetaData (CSTR fid, CSTR attr) const
| Drop specified metadata item.
## Protected Types
typedef const std::string & | CSTR
## Private Member Functions
xercesc::DOMDocument * | getDoc (bool throw_if_no_exists=true) const
std::string | getfile (bool create)
void | printError (CSTR msg, bool throw_exc=true) const
std::string | lookupFID (CSTR lfn) const
xercesc::DOMNode * | element (CSTR fid, bool print_err=true) const
xercesc::DOMNode * | child (xercesc::DOMNode *par, CSTR tag, CSTR attr="", CSTR val="") const
std::pair< xercesc::DOMElement *, xercesc::DOMElement * > | i_registerFID (CSTR fid) const
## Private Attributes
bool | m_rdOnly
bool | m_update
xercesc::DOMDocument * | m_doc
xercesc::XercesDOMParser * | m_parser
xercesc::ErrorHandler * | m_errHdlr
std::string | m_file
unsigned long | m_refCount
IMessageSvc * | m_msgSvc

## Member Typedef Documentation

typedef const std::string& Gaudi::XMLFileCatalog::CSTR`[protected]`

Definition at line 27 of file XMLFileCatalog.h.

## Constructor & Destructor Documentation

XMLFileCatalog::XMLFileCatalog | ( | CSTR | url,
|  | IMessageSvc * | m |
| ) |  |  |

Create a catalog file, initialization of XercesC.

Definition at line 205 of file XMLFileCatalog.cpp.

    00206 : m_rdOnly(false),m_update(false),m_doc(0),m_parser(0),m_errHdlr(0),
    00207   m_file(uri), m_refCount(0), m_msgSvc(m)
    00208 {
    00209 }

XMLFileCatalog::~XMLFileCatalog | ( |  | ) | `[virtual]`

Destructor,.

Definition at line 211 of file XMLFileCatalog.cpp.

    00211                                   {
    00212   if (m_parser) delete m_parser;
    00213   m_parser = 0;
    00214   if (m_errHdlr) delete m_errHdlr;
    00215   m_errHdlr = 0;
    00216   m_doc = 0;
    00217 }

## Member Function Documentation

unsigned long XMLFileCatalog::addRef | ( |  | ) | `[virtual]`

IInterface implementation.

Increase reference count on catalog

Implements IInterface.

Definition at line 219 of file XMLFileCatalog.cpp.

    00219                                       {
    00220   return ++m_refCount;
    00221 }

unsigned long XMLFileCatalog::release | ( |  | ) | `[virtual]`

release catalog

Implements IInterface.

Definition at line 223 of file XMLFileCatalog.cpp.

    00223                                        {
    00224   long cnt = --m_refCount;
    00225   if ( cnt <= 0 ) {
    00226     delete this;
    00227   }
    00228   return cnt;
    00229 }

StatusCode XMLFileCatalog::queryInterface | ( | const InterfaceID & | id,
|  | void ** | ppv |
| ) |  |  | `[virtual]`

Query interface.

Implements IInterface.

Definition at line 231 of file XMLFileCatalog.cpp.

    00231                                                                               {
    00232   if ( riid.versionMatch(IFileCatalog::interfaceID()) ) {
    00233     *ppv = (IFileCatalog*)this;
    00234   }
    00235   else if ( riid.versionMatch(IInterface::interfaceID()) ) {
    00236     *ppv = (IInterface*)this;
    00237   }
    00238   else  {
    00239     *ppv = 0;
    00240     return StatusCode::FAILURE;
    00241   }
    00242   addRef();
    00243   return StatusCode::SUCCESS;
    00244 }

std::string XMLFileCatalog::createFID | ( |  | ) | const`[virtual]`

Catalog interface.

Create file identifier using UUID mechanism.

Create file identifier using UUID mechanism

Implements Gaudi::IFileCatalog.

Definition at line 246 of file XMLFileCatalog.cpp.

    00246                                            {
    00247   return createGuidAsString();
    00248 }

virtual CSTR Gaudi::XMLFileCatalog::connectInfo | ( |  | ) | const`[inline, virtual]`

Access to connect string.

Implements Gaudi::IFileCatalog.

Definition at line 47 of file XMLFileCatalog.h.

    00047 { return m_file;                 }

void XMLFileCatalog::init | ( |  | ) | `[virtual]`

Parse the DOM tree of the XML catalog.

Implements Gaudi::IFileCatalog.

Definition at line 264 of file XMLFileCatalog.cpp.

    00264                             {
    00265   string xmlFile = getfile(false);
    00266   try{
    00267     if ( m_parser ) delete m_parser;
    00268     m_parser = new XercesDOMParser;
    00269     m_parser->setValidationScheme(XercesDOMParser::Val_Auto);
    00270     m_parser->setDoNamespaces(false);
    00271     DTDRedirect dtdinmem;
    00272     m_parser->setEntityResolver(&dtdinmem);
    00273     if ( ! m_errHdlr ) m_errHdlr = new ErrHandler(m_msgSvc);
    00274     m_parser->setErrorHandler(m_errHdlr);
    00275     if ( !xmlFile.empty() )  {
    00276       m_parser->parse(xmlFile.c_str());
    00277     }
    00278     else  {
    00279       const std::string& s = EmptyCatalog;
    00280       MemBufInputSource src((const XMLByte*)s.c_str(),s.length(),"MemCatalog");
    00281       m_parser->parse(src);
    00282     }
    00283     m_doc = m_parser->getDocument();
    00284   }
    00285   catch (const XMLException& e) {
    00286     printError("XML parse error["+xmlFile+"]: "+_toString(e.getMessage()));
    00287   }
    00288   catch (const DOMException& e) {
    00289     printError("XML parse error["+xmlFile+"]: "+_toString(e.getMessage()));
    00290   }
    00291   catch (...)  {
    00292     printError("UNKNOWN XML parse error in file "+xmlFile);
    00293   }
    00294 }

void XMLFileCatalog::commit | ( |  | ) | `[virtual]`

Save DOM catalog to file.

Implements Gaudi::IFileCatalog.

Definition at line 494 of file XMLFileCatalog.cpp.

    00494                                {
    00495   try {
    00496     if ( dirty() && !readOnly() )  {
    00497       string xmlfile = getfile(true);
    00498       XMLStr ii("LS");
    00499       DOMImplementation *imp = DOMImplementationRegistry::getDOMImplementation(ii);
    00500       DOMWriter         *wr  = ((DOMImplementationLS*)imp)->createDOMWriter();
    00501       XMLFormatTarget   *tar = new LocalFileFormatTarget(xmlfile.c_str());
    00502       wr->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
    00503       wr->writeNode(tar, *m_doc);
    00504       wr->release();
    00505       delete  tar;
    00506     }
    00507   }
    00508   catch ( exception& e )  {
    00509     printError(string("Cannot open output file:")+e.what());
    00510   }
    00511   catch (...)  {
    00512     printError("Unknown IO rrror.");
    00513   }
    00514 }

virtual void Gaudi::XMLFileCatalog::rollback | ( |  | ) | `[inline, virtual]`

Save DOM catalog to file.

Implements Gaudi::IFileCatalog.

Definition at line 53 of file XMLFileCatalog.h.

    00053 { if ( dirty() )  init();        }

virtual bool Gaudi::XMLFileCatalog::readOnly | ( |  | ) | const`[inline, virtual]`

Check if the catalog is read-only.

Implements Gaudi::IFileCatalog.

Definition at line 55 of file XMLFileCatalog.h.

    00055 { return m_rdOnly;                }

virtual bool Gaudi::XMLFileCatalog::dirty | ( |  | ) | const`[inline, virtual]`

Check if the catalog should be updated.

Implements Gaudi::IFileCatalog.

Definition at line 57 of file XMLFileCatalog.h.

    00057 { return m_update;                }

virtual bool Gaudi::XMLFileCatalog::existsPFN | ( | CSTR | pfn | ) | const`[inline, virtual]`

Return the status of a physical file name.

Implements Gaudi::IFileCatalog.

Definition at line 59 of file XMLFileCatalog.h.

    00059 { return element(pfn,false) != 0; }

virtual std::string Gaudi::XMLFileCatalog::lookupPFN | ( | CSTR | fid | ) | const`[inline, virtual]`

Lookup file identifier by physical file name.

Implements Gaudi::IFileCatalog.

Definition at line 61 of file XMLFileCatalog.h.

    00061 { return lookupFID(fid);          }

virtual bool Gaudi::XMLFileCatalog::existsLFN | ( | CSTR | lfn | ) | const`[inline, virtual]`

Return the status of a logical file name.

Implements Gaudi::IFileCatalog.

Definition at line 63 of file XMLFileCatalog.h.

    00063 { return element(lfn,false) != 0; }

virtual std::string Gaudi::XMLFileCatalog::lookupLFN | ( | CSTR | lfn | ) | const`[inline, virtual]`

Lookup file identifier by logical file name.

Implements Gaudi::IFileCatalog.

Definition at line 65 of file XMLFileCatalog.h.

    00065 { return lookupFID(lfn);          }

virtual bool Gaudi::XMLFileCatalog::existsFID | ( | CSTR | fid | ) | const`[inline, virtual]`

Return the status of a FileID.

Implements Gaudi::IFileCatalog.

Definition at line 67 of file XMLFileCatalog.h.

    00067 { return element(fid,false) != 0; }

void XMLFileCatalog::getPFN | ( | CSTR | fid,
|  | Files & | files |
| ) |  |  | const`[virtual]`

Dump all physical file names of the catalog and their attributes associate to the FileID.

Definition at line 318 of file XMLFileCatalog.cpp.

    00318                                                          {
    00319   files.clear();
    00320   for(XMLCollection c(child(child(element(fid,false),PFNCOLL),PFNNODE), false); c; ++c)
    00321     files.push_back(make_pair(c.attr(Attr_name),c.attr(Attr_ftype)));
    00322 }

void XMLFileCatalog::getLFN | ( | CSTR | fid,
|  | Files & | files |
| ) |  |  | const`[virtual]`

Dump all logical file names of the catalog associate to the FileID.

Definition at line 324 of file XMLFileCatalog.cpp.

    00324                                                          {
    00325   files.clear();
    00326   for(XMLCollection c(child(child(element(fid,false),LFNCOLL),LFNNODE), false); c; ++c)
    00327     files.push_back(make_pair(c.attr(Attr_name),fid));
    00328 }

void XMLFileCatalog::getFID | ( | Strings & | fids | ) | const`[virtual]`

Dump all file Identifiers.

Definition at line 311 of file XMLFileCatalog.cpp.

    00311                                                {
    00312   fids.clear();
    00313   DOMNode* fde = getDoc(true)->getElementsByTagName(XMLStr("*"))->item(0);
    00314   for(XMLCollection c(child(fde,"File"), false); c; ++c)
    00315     fids.push_back(c.attr(Attr_ID));
    00316 }

void XMLFileCatalog::deleteFID | ( | CSTR | FileID | ) | const`[virtual]`

Delete FileID Node from the catalog.

Implements Gaudi::IFileCatalog.

Definition at line 384 of file XMLFileCatalog.cpp.

    00384                                              {
    00385   DOMNode *pn = 0, *fn = element(fid);
    00386   if ( fn ) pn = fn->getParentNode();
    00387   if ( pn ) pn->removeChild(fn);
    00388 }

void XMLFileCatalog::registerPFN | ( | CSTR | fid,
|  | CSTR | pfn,
|  | CSTR | ftype |
| ) |  |  | const`[virtual]`

Create a FileID and Node of the physical file name with all the attributes.

Implements Gaudi::IFileCatalog.

Definition at line 436 of file XMLFileCatalog.cpp.

    00436                                                                      {
    00437   if ( !fid.empty() )  {
    00438     std::pair<DOMElement*,DOMElement*> res = i_registerFID(fid);
    00439     DOMElement* phyelem = res.second, *fnelem = 0;
    00440     for(XMLCollection c(phyelem); c; ++c )  {
    00441       char* nam = XMLString::transcode(c->getNodeName());
    00442       if ( nam == PFNNODE )  {
    00443         XMLString::release(&nam);
    00444         nam = XMLString::transcode(c->getAttribute(Attr_name));
    00445         if ( nam == pfn )  {
    00446           XMLString::release(&nam);
    00447           fnelem = c;
    00448           break;
    00449         }
    00450       }
    00451       XMLString::release(&nam);
    00452     }
    00453     if ( !fnelem )  {
    00454       fnelem = getDoc(true)->createElement(PFNNODE);
    00455       phyelem->appendChild(fnelem);
    00456       fnelem->setAttribute(Attr_ftype,XMLStr(ftype));
    00457       fnelem->setAttribute(Attr_name,XMLStr(pfn));
    00458       fnelem->setIdAttribute(Attr_name);
    00459       m_update = true;
    00460     }
    00461     return;
    00462   }
    00463   throw runtime_error("XMLFileCatalog> Cannot register PFN for invalid FID:"+fid);
    00464 }

void XMLFileCatalog::registerLFN | ( | CSTR | fid,
|  | CSTR | lfn |
| ) |  |  | const`[virtual]`

Create a FileID and Node of the logical file name with all the attributes.

Implements Gaudi::IFileCatalog.

Definition at line 466 of file XMLFileCatalog.cpp.

    00466                                                          {
    00467   if ( !fid.empty() )  {
    00468     std::pair<DOMElement*, DOMElement*> res = i_registerFID(fid);
    00469     DOMElement* logelem = res.first, *fnelem = 0;
    00470     for(XMLCollection c(logelem); c; ++c )  {
    00471       char* nam = XMLString::transcode(c->getNodeName());
    00472       if ( nam == LFNNODE )  {
    00473         XMLString::release(&nam);
    00474         nam = XMLString::transcode(c->getAttribute(Attr_name));
    00475         if ( nam == lfn )  {
    00476           XMLString::release(&nam);
    00477           fnelem = c;
    00478           break;
    00479         }
    00480       }
    00481     }
    00482     if ( !fnelem )  {
    00483       fnelem = getDoc(true)->createElement(LFNNODE);
    00484       logelem->appendChild(fnelem);
    00485       fnelem->setAttribute(Attr_name,XMLStr(lfn));
    00486       fnelem->setIdAttribute(Attr_name);
    00487       m_update = true;
    00488     }
    00489     return;
    00490   }
    00491   throw runtime_error("XMLFileCatalog> Cannot register LFN for invalid FID:"+fid);
    00492 }

void XMLFileCatalog::registerFID | ( | CSTR | fid | ) | const`[virtual]`

Create a FileID and Node.

Implements Gaudi::IFileCatalog.

Definition at line 390 of file XMLFileCatalog.cpp.

    00390                                                {
    00391   if ( !fid.empty() ) {
    00392     std::pair<DOMElement*, DOMElement*> res = i_registerFID(fid);
    00393     if ( res.first == 0 || res.second == 0 )  {
    00394       printError("Failed to register FID:"+fid);
    00395     }
    00396     return;
    00397   }
    00398   throw runtime_error("XMLFileCatalog> Cannot register LFN for invalid FID:"+fid);
    00399 }

void XMLFileCatalog::getMetaData | ( | CSTR | fid,
|  | Attributes & | attr |
| ) |  |  | const`[virtual]`

Dump all MetaData of the catalog for a given file ID.

Definition at line 330 of file XMLFileCatalog.cpp.

    00330                                                                    {
    00331   attr.clear();
    00332   for(XMLCollection c(child(element(fid),MetaNode), false); c; ++c)
    00333     attr.push_back(make_pair(c.attr(Attr_metaName),c.attr(Attr_metaValue)));
    00334   if ( attr.size() > 0 )
    00335     attr.push_back(make_pair("guid",fid));
    00336 }

string XMLFileCatalog::getMetaDataItem | ( | CSTR | fid,
|  | CSTR | name |
| ) |  |  | const`[virtual]`

Access metadata item.

Implements Gaudi::IFileCatalog.

Definition at line 364 of file XMLFileCatalog.cpp.

    00364                                                                 {
    00365   XMLCollection c(child(getDoc(true)->getElementById(XMLStr(fid)),MetaNode,Attr_metaName,attr));
    00366   return c ? c.attr(attr) : string("");
    00367 }

void XMLFileCatalog::setMetaData | ( | CSTR | fid,
|  | CSTR | name,
|  | CSTR | value |
| ) |  |  | const`[virtual]`

Insert/update metadata item.

Implements Gaudi::IFileCatalog.

Definition at line 348 of file XMLFileCatalog.cpp.

    00348                                                                       {
    00349   if ( !readOnly() )  {
    00350     DOMNode*    node = element(fid);
    00351     DOMElement* mnod = (DOMElement*)child(node,MetaNode,Attr_metaName,attr);
    00352     if (!mnod){
    00353       mnod = getDoc(true)->createElement(MetaNode);
    00354       node->appendChild(mnod);
    00355       mnod->setAttribute(Attr_metaName,XMLStr(attr));
    00356     }
    00357     mnod->setAttribute(Attr_metaValue,XMLStr(val));
    00358     m_update = true;
    00359     return;
    00360   }
    00361   printError("Cannot update readonly catalog!");
    00362 }

virtual void Gaudi::XMLFileCatalog::dropMetaData | ( | CSTR | fid | ) | const`[inline, virtual]`

Drop all metadata of one FID.

Implements Gaudi::IFileCatalog.

Definition at line 89 of file XMLFileCatalog.h.

    00089 {   dropMetaData(fid,"*");   }

void XMLFileCatalog::dropMetaData | ( | CSTR | fid,
|  | CSTR | attr |
| ) |  |  | const`[virtual]`

Drop specified metadata item.

Implements Gaudi::IFileCatalog.

Definition at line 369 of file XMLFileCatalog.cpp.

    00369                                                            {
    00370   vector<DOMNode*> gbc;
    00371   DOMNode* fn = getDoc(true)->getElementById(XMLStr(fid));
    00372   for(XMLCollection c(child(fn,MetaNode)); c; ++c)
    00373     if ( attr[0]=='*' || !c.attr(attr).empty() ) gbc.push_back(c);
    00374   for(vector<DOMNode*>::iterator i=gbc.begin(); i != gbc.end(); i++)
    00375     fn->removeChild(*i);
    00376 }

DOMDocument * XMLFileCatalog::getDoc | ( | bool | throw_if_no_exists = `true` | ) | const`[private]`

Definition at line 250 of file XMLFileCatalog.cpp.

    00250                                                                    {
    00251   if ( !m_doc && throw_if_no_exists )
    00252     printError("The XML catalog was not started.",true);
    00253   return m_doc;
    00254 }

string XMLFileCatalog::getfile | ( | bool | create | ) | `[private]`

Definition at line 516 of file XMLFileCatalog.cpp.

    00516                                             {
    00517   string protocol, path;
    00518   XMLURL xerurl;
    00519   try{
    00520     xerurl   = (const XMLCh*)XMLStr(m_file);
    00521     protocol = _toString(xerurl.getProtocolName());
    00522     path     = _toString(xerurl.getPath());
    00523   }
    00524   catch (const XMLException& e ) {
    00525     printError(_toString(e.getMessage()));
    00526   }
    00527   if ( protocol.empty() )    {
    00528     printError("Missing protocol.");
    00529   }
    00530   else if ( protocol == "http" || protocol == "ftp" )  {
    00531     m_rdOnly = true;
    00532   }
    00533   else if ( protocol == "file" ) {
    00534     m_rdOnly = false;
    00535     struct stat buff;
    00536     int exist = ::stat(path.c_str(),&buff) != -1;
    00537     if ( create && !exist )  {
    00538       MsgStream log(m_msgSvc,"XMLCatalog");
    00539       log << MSG::INFO << "File '" << path << "' does not exist. New file created." << endmsg;
    00540       ofstream out(path.c_str());
    00541       if( !m_rdOnly && out.is_open() ) {
    00542         out << (CSTR)EmptyCatalog << endl;
    00543       }
    00544       else     {
    00545         printError("Problem creating file "+path);
    00546       }
    00547       out.close();
    00548     }
    00549     else if ( exist )  {
    00550       return path;
    00551     }
    00552     else if ( !create )  {
    00553       return "";
    00554     }
    00555   }
    00556   else  {
    00557     printError(protocol + ": protocol not supported.");
    00558   }
    00559   return path;
    00560 }

void XMLFileCatalog::printError | ( | CSTR | msg,
|  | bool | throw_exc = `true` |
| ) |  |  | const`[private]`

Definition at line 256 of file XMLFileCatalog.cpp.

    00256                                                               {
    00257   MsgStream log(m_msgSvc,"XMLCatalog");
    00258   log << MSG::FATAL << msg << endmsg;
    00259   if ( rethrow )  {
    00260     throw runtime_error("XMLFileCatalog> "+msg);
    00261   }
    00262 }

string XMLFileCatalog::lookupFID | ( | CSTR | lfn | ) | const`[private]`

Definition at line 296 of file XMLFileCatalog.cpp.

    00296                                                              {
    00297   std::string result;
    00298   DOMNode* e = element(fid,false);
    00299   e = e ? e->getParentNode() : 0;    // Mode up to <logical>
    00300   e = e ? e->getParentNode() : 0;    // Mode up to <File>
    00301   if ( e ) {
    00302     if ( e->getAttributes() ) { // Need to check this. The node may be no DOMElement
    00303       char* nam = XMLString::transcode(((DOMElement*)e)->getAttribute(Attr_ID));
    00304       if ( nam ) result = nam;
    00305       XMLString::release(&nam);
    00306     }
    00307   }
    00308   return result;
    00309 }

DOMNode * XMLFileCatalog::element | ( | CSTR | fid,
|  | bool | print_err = `true` |
| ) |  |  | const`[private]`

Definition at line 378 of file XMLFileCatalog.cpp.

    00378                                                                        {
    00379   DOMNode* node = getDoc(true)->getElementById(XMLStr(element_name));
    00380   if ( !node && print_err ) printError("Cannot find element:"+element_name);
    00381   return node;
    00382 }

xercesc::DOMNode* Gaudi::XMLFileCatalog::child | ( | xercesc::DOMNode * | par,
|  | CSTR | tag,
|  | CSTR | attr = `""`,
|  | CSTR | val = `""` |
| ) |  |  | const`[private]`

std::pair< DOMElement *, DOMElement * > XMLFileCatalog::i_registerFID | ( | CSTR | fid | ) | const`[private]`

It creates a new node File with name = fid in the XML file catalog

Definition at line 401 of file XMLFileCatalog.cpp.

    00401                                                                              {
    00402   if ( !readOnly() )  {
    00404     DOMElement *file = (DOMElement*)element(fid,false), *phyelem = 0, *logelem = 0;
    00405     DOMDocument* doc = getDoc(true);
    00406     if ( !file )  {
    00407       DOMNode* fde = doc->getElementsByTagName(XMLStr("*"))->item(0);
    00408       file = m_doc->createElement(XMLStr("File"));
    00409       file->setAttribute(Attr_ID, XMLStr(fid));
    00410       file->setIdAttribute(Attr_ID);
    00411       fde->appendChild(file);
    00412       m_update = true;
    00413     }
    00414     for(XMLCollection c1(file); c1; ++c1 )  {
    00415       char* nam = XMLString::transcode(c1->getNodeName());
    00416       if ( nam == PFNCOLL ) phyelem = c1;
    00417       if ( nam == LFNCOLL ) logelem = c1;
    00418       XMLString::release(&nam);
    00419     }
    00420     if ( !phyelem )  {
    00421       phyelem = doc->createElement(PFNCOLL);
    00422       file->appendChild(phyelem);
    00423       m_update = true;
    00424     }
    00425     if ( !logelem )  {
    00426       logelem = doc->createElement(LFNCOLL);
    00427       file->appendChild(logelem);
    00428       m_update = true;
    00429     }
    00430     return std::make_pair(logelem,phyelem);
    00431   }
    00432   printError("Cannot update readonly catalog!");
    00433   return std::pair<DOMElement*, DOMElement*>(0,0);
    00434 }

## Member Data Documentation

bool Gaudi::XMLFileCatalog::m_rdOnly`[private]`

Definition at line 100 of file XMLFileCatalog.h.

bool Gaudi::XMLFileCatalog::m_update`[mutable, private]`

Definition at line 101 of file XMLFileCatalog.h.

xercesc::DOMDocument* Gaudi::XMLFileCatalog::m_doc`[private]`

Definition at line 102 of file XMLFileCatalog.h.

xercesc::XercesDOMParser* Gaudi::XMLFileCatalog::m_parser`[private]`

Definition at line 103 of file XMLFileCatalog.h.

xercesc::ErrorHandler* Gaudi::XMLFileCatalog::m_errHdlr`[private]`

Definition at line 104 of file XMLFileCatalog.h.

std::string Gaudi::XMLFileCatalog::m_file`[private]`

Definition at line 105 of file XMLFileCatalog.h.

unsigned long Gaudi::XMLFileCatalog::m_refCount`[private]`

Definition at line 106 of file XMLFileCatalog.h.

IMessageSvc* Gaudi::XMLFileCatalog::m_msgSvc`[private]`

Definition at line 107 of file XMLFileCatalog.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r3/GaudiUtils/src/component/XMLFileCatalog.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r3/GaudiUtils/src/component/XMLFileCatalog.cpp