Commit a44cd251 authored by Costin Grigoras's avatar Costin Grigoras
Browse files

Use the archive member name as defined by the PFN row in the database

parent 7cdba6cb
......@@ -171,8 +171,11 @@ public class PFNforReadOrDel extends Request {
for (final PFN pfn : pfns)
if (pfn.ticket.envelope == null)
logger.log(Level.WARNING, "Can't set archive anchor on " + pfn.pfn + " since the envelope is null");
else
else {
pfn.ticket.envelope.setArchiveAnchor(archiveMemberFileName);
pfn.ticket.envelope.setArchiveAnchor(archiveAnchor);
}
}
}
else
......
......@@ -54,6 +54,8 @@ public class XrootDEnvelope implements Serializable {
*/
public final PFN pfn;
private String archiveAnchorFileName;
/**
* A LFN that is pointing to this envelope's GUID/PFN us as a guid://
* archive link
......@@ -268,6 +270,23 @@ public class XrootDEnvelope implements Serializable {
}
}
/**
* When the file member name is know, use this method directly
*
* @param anchor
*/
public void setArchiveAnchor(final String anchor) {
if (anchor != null)
archiveAnchorFileName = anchor;
}
/**
* @return the name of the archive member to access
*/
public String getArchiveAnchorFileName() {
return archiveAnchorFileName;
}
/**
* Set the LFN that is pointing to this envelope's GUID/PFN us as a guid://
* archive link
......@@ -277,6 +296,9 @@ public class XrootDEnvelope implements Serializable {
*/
public void setArchiveAnchor(final LFN anchor) {
archiveAnchorLFN = anchor;
if (archiveAnchorFileName == null && archiveAnchorLFN != null)
archiveAnchorFileName = archiveAnchorLFN.getFileName();
}
/**
......
......@@ -239,8 +239,9 @@ public class JAliEnCommandaccess extends JAliEnBaseCommand {
}
// If archive member access requested, add it's filename as anchor
if (pfn.ticket.envelope.getArchiveAnchor() != null) {
commander.printOut("url", pfn.ticket.envelope.getTransactionURL() + "#" + pfn.ticket.envelope.getArchiveAnchor().getFileName());
final String archiveAnchorName = pfn.ticket.envelope.getArchiveAnchorFileName();
if (archiveAnchorName != null) {
commander.printOut("url", pfn.ticket.envelope.getTransactionURL() + "#" + archiveAnchorName);
}
else {
commander.printOut("url", pfn.ticket.envelope.getTransactionURL());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment