XrdXmlMetaLink Class Reference

#include <XrdXmlMetaLink.hh>

Collaboration diagram for XrdXmlMetaLink:
Collaboration graph
[legend]

List of all members.

Public Member Functions

XrdOucFileInfoConvert (const char *fbuff, int blen=0)
XrdOucFileInfo ** ConvertAll (const char *fbuff, int &count, int blen=0)
const char * GetStatus (int &ecode)
 XrdXmlMetaLink (const char *protos="root:xroot:", const char *rdprot="xroot:", const char *rdhost=0, const char *encode=0)
 ~XrdXmlMetaLink ()
 Destructor.

Static Public Member Functions

static void DeleteAll (XrdOucFileInfo **vecp, int vecn)

Private Member Functions

bool GetFile (const char *scope)
bool GetFileInfo (const char *scope)
bool GetGLfn ()
bool GetHash ()
void GetRdrError (const char *why)
bool GetSize ()
bool GetUrl ()
void GetName ()
bool PutFile (const char *buff, int blen)
bool UrlOK (char *url)

Private Attributes

XrdXmlReaderreader
XrdOucFileInfofileList
XrdOucFileInfolastFile
XrdOucFileInfocurrFile
char * prots
char * encType
const char * rdProt
const char * rdHost
int fileCnt
int eCode
bool doAll
bool noUrl
char tmpFn [64]
char eText [256]

Detailed Description

The XrdXmlMetaLink object provides a uniform interface to convert metalink XML specifications to one or more XrdOucFileInfo objects. This object does not do a rigorous syntactic check of the metalink specification. Specifications that technically violate RFC 5854 (v4 metalinks) or the metalink.org v3 metalinks may be accepted and yield valid information.


Constructor & Destructor Documentation

XrdXmlMetaLink::XrdXmlMetaLink ( const char *  protos = "root:xroot:",
const char *  rdprot = "xroot:",
const char *  rdhost = 0,
const char *  encode = 0 
) [inline]

Constructor

Parameters:
protos Pointer to the list of desired protocols. Each protocol ends with a colon. They are specified without embedded spaces. Only urls using one of the listed protocols is returned. A nil pointer returns all urls regardless of the protocol.
rdprot The protocol to be used when constructing the global file entry. If nil, the first protocol in protos is used. If nil, a global file is not constructed.
rdhost The "<host>[<port>]" to use when constructing the global file. A global file entry is constructed only if rdhost is specified and a protocol is available, and a global file element exists in the xml file.
encode Specifies the xml encoding. Currently, only UTF-8 is is supported and is signified by a nil pointer.

References eText, and tmpFn.

XrdXmlMetaLink::~XrdXmlMetaLink (  )  [inline]

Destructor.

References encType, and prots.


Member Function Documentation

XrdOucFileInfo* XrdXmlMetaLink::Convert ( const char *  fbuff,
int  blen = 0 
)

Convert an XML metalink specification to a file info object. Only the first file entry is converted (see ConvertAll()).

Parameters:
fbuff Pointer to the filepath that contains the metalink specification when blen is 0. Otherwise, fbuff points to a memory buffer of length blen containing the specification.
blen Length of the buffer. When <=0, the first argument is a file path. Otherwise, it is a memory buffer of length blen whose contents are written into a file in /tmp, converted, and then deleted.
Returns:
Pointer to the corresponding file info object upon success. Otherwise, a null pointer is returned indicating that the metalink specification was invalid or had no required protocols. Use the GetStatus() method to obtain the description of the problem.
XrdOucFileInfo** XrdXmlMetaLink::ConvertAll ( const char *  fbuff,
int &  count,
int  blen = 0 
)

Convert an XML metalink specification to a file info object. All file entries are converted.

Parameters:
fbuff Pointer to the filepath that contains the metalink specification when blen is 0. Otherwise, fbuff points to a memory buffer of length blen containing the specification.
count Place where the number of array elements is returned.
blen Length of the buffer. When <=0, the first argument is a file path. Otherwise, it is a memory buffer of length blen whose contents are written into a file in /tmp, converted, and then deleted.
Returns:
Pointer to the array of corresponding fil info objects upon success. Otherwise, Otherwise, a null pointer is returned indicating that the metalink specification was invalid or had no required protocols. Use the GetStatus() method to obtain the description of the problem. Be aware that you must first delete each file info object before deleting the array. You can do this via DeleteAll().
static void XrdXmlMetaLink::DeleteAll ( XrdOucFileInfo **  vecp,
int  vecn 
) [static]

Delete a vector of file info objects and the vector itself as well.

Parameters:
vecp Pointer to the array.
vecn Number of elements in the vector.
bool XrdXmlMetaLink::GetFile ( const char *  scope  )  [private]
bool XrdXmlMetaLink::GetFileInfo ( const char *  scope  )  [private]
bool XrdXmlMetaLink::GetGLfn (  )  [private]
bool XrdXmlMetaLink::GetHash (  )  [private]
void XrdXmlMetaLink::GetName (  )  [private]
void XrdXmlMetaLink::GetRdrError ( const char *  why  )  [private]
bool XrdXmlMetaLink::GetSize (  )  [private]
const char* XrdXmlMetaLink::GetStatus ( int &  ecode  )  [inline]

Obtain ending status of previous conversion.

Parameters:
ecode Place to return the error code, if any.
Returns:
Pointer to the error text describing the error. The string becomes invalid if Convert() is called or the object is deleted. If no error was encountered, a null string is returned with ecode == 0.

References eCode, and eText.

bool XrdXmlMetaLink::GetUrl (  )  [private]
bool XrdXmlMetaLink::PutFile ( const char *  buff,
int  blen 
) [private]
bool XrdXmlMetaLink::UrlOK ( char *  url  )  [private]

Member Data Documentation

bool XrdXmlMetaLink::doAll [private]
int XrdXmlMetaLink::eCode [private]

Referenced by GetStatus().

char* XrdXmlMetaLink::encType [private]

Referenced by ~XrdXmlMetaLink().

char XrdXmlMetaLink::eText[256] [private]

Referenced by GetStatus(), and XrdXmlMetaLink().

int XrdXmlMetaLink::fileCnt [private]
bool XrdXmlMetaLink::noUrl [private]
char* XrdXmlMetaLink::prots [private]

Referenced by ~XrdXmlMetaLink().

const char* XrdXmlMetaLink::rdHost [private]
const char* XrdXmlMetaLink::rdProt [private]
char XrdXmlMetaLink::tmpFn[64] [private]

Referenced by XrdXmlMetaLink().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 2 Aug 2019 for xrootd by  doxygen 1.6.1