Skip to content

Commit

Permalink
[XrdXml] retrieve the logical file name from the metalink xml and add…
Browse files Browse the repository at this point in the history
… to FileInfo object
  • Loading branch information
simonmichal committed Sep 16, 2015
1 parent 1ca224f commit 1fc6c01
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/XrdOuc/XrdOucFileInfo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ XrdOucFileInfo::~XrdOucFileInfo()
// Destroy the url list
//
while((udP = uP)) {uP = uP->next; delete udP;}

// Free the memory allocated for fLfn
//
if( fLfn ) free(fLfn);
}

/******************************************************************************/
Expand Down Expand Up @@ -150,7 +154,17 @@ void XrdOucFileInfo::AddUrl(const char *url, const char *cntry,
else fUrl = urlP;
if (fUrl != fUrlNext) fUrlNext = fUrl;
}


/******************************************************************************/
/* A d d F i l e N a m e */
/******************************************************************************/

void XrdOucFileInfo::AddFileName(const char * filename)
{
if(filename)
fLfn = strdup(filename);
}

/******************************************************************************/
/* G e t D i g e s t */
/******************************************************************************/
Expand Down
6 changes: 6 additions & 0 deletions src/XrdOuc/XrdOucFileInfo.hh
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ void AddDigest(const char *hname, const char *hval);

void AddUrl(const char *url, const char *cntry=0,
int prty=0, bool fifo=true);
//-----------------------------------------------------------------------------
//! Add a filename to the file descriptions.
//!
//! @param filename Poiner to file name.
//-----------------------------------------------------------------------------
void AddFileName(const char * filename);

//-----------------------------------------------------------------------------
//! Obtain the next digest that can be used to validate the file.
Expand Down
17 changes: 17 additions & 0 deletions src/XrdXml/XrdXmlMetaLink.cc
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,14 @@ bool XrdXmlMetaLink::GetFile(const char *scope)

bool XrdXmlMetaLink::GetFileInfo(const char *scope)
{
static const char *fileScope = "file";
const char *fsubElem[] = {scope, "url", "hash", "size",
"verification", "resources", 0};
int ePos;

if(strncmp(scope, fileScope, 4) == 0)
GetName();

// Process the elements in he file section. Both formats have the same tags,
// though not the same attributes. We will take care of the differences later.
//
Expand Down Expand Up @@ -425,6 +429,19 @@ bool XrdXmlMetaLink::GetUrl()
return true;
}

/******************************************************************************/
/* Private: G e t N a m e */
/******************************************************************************/

void XrdXmlMetaLink::GetName()
{
static const char *mAtr[] = {"name", 0};
char *mVal[] = {0};
reader->GetAttributes(mAtr, mVal);
currFile->AddFileName(mVal[0]);
free(mVal[0]);
}

/******************************************************************************/
/* Private: P u t F i l e */
/******************************************************************************/
Expand Down
1 change: 1 addition & 0 deletions src/XrdXml/XrdXmlMetaLink.hh
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ bool GetHash();
void GetRdrError(const char *why);
bool GetSize();
bool GetUrl();
void GetName();
bool PutFile(const char *buff, int blen);
bool UrlOK(char *url);

Expand Down

0 comments on commit 1fc6c01

Please sign in to comment.