Commit 4300534b authored by Volodymyr Yurchenko's avatar Volodymyr Yurchenko Committed by Nikola Hardi
Browse files

Read archive anchors from server reply

parent c8ee9765
......@@ -54,7 +54,7 @@ TJAlienFile *TJAlienFile::Open(const char *url, Option_t *option,
// - Iterate through them until operation is successful or fail after trying
// all envelopes
::Info("TJAlienFile::Open", "Trying to open file with URL = \"%s\"", url);
if (gDebug > 1) ::Info("TJAlienFile::Open", "Trying to open file with URL = \"%s\"", url);
// Check if JAliEn connection exists.
if (!gGrid) {
......@@ -81,7 +81,7 @@ TJAlienFile *TJAlienFile::Open(const char *url, Option_t *option,
// Read the filename from the url
TUrl inputUrl(url);
TString fJName(inputUrl.GetFile());
::Info("TJAlienFile::Open", "File name: \"%s\"", fJName.Data());
if (gDebug > 1) ::Info("TJAlienFile::Open", "File name: \"%s\"", fJName.Data());
// Read options
TString fJOption = option;
......@@ -90,7 +90,7 @@ TJAlienFile *TJAlienFile::Open(const char *url, Option_t *option,
// There can be options appended to the url
// E.g.: <url>?se=ALICE::CERN::EOS,!ALICE::SUBATECH::EOS,disk:2&publicaccess=1
TString inputUrlOptions = inputUrl.GetOptions();
::Info("TJAlienFile::Open", "File URL options: \"%s\"", inputUrlOptions.Data());
if (gDebug > 1) ::Info("TJAlienFile::Open", "File URL options: \"%s\"", inputUrlOptions.Data());
// Maybe there are SE options set in the environment
TString storageElement = gSystem->Getenv("alien_CLOSE_SE");
......@@ -102,13 +102,13 @@ TJAlienFile *TJAlienFile::Open(const char *url, Option_t *option,
TObjArray *objOptions = inputUrlOptions.Tokenize("&");
for (Int_t i = 0; i < objOptions->GetEntries(); i++) {
TString loption = ((TObjString *) objOptions->At(i))->GetName();
::Info("TJAlienFile::Open", "Option \"%s\"", loption.Data());
if (gDebug > 1) ::Info("TJAlienFile::Open", "Option \"%s\"", loption.Data());
TObjArray *objTags = loption.Tokenize("=");
if (objTags->GetEntries() == 2) {
TString key = ((TObjString *) objTags->At(0))->GetName();
TString value = ((TObjString *) objTags->At(1))->GetName();
::Info("TJAlienFile::Open", "Option \"%s\" = \"%s\"", key.Data(), value.Data());
if (gDebug > 1) ::Info("TJAlienFile::Open", "Option \"%s\" = \"%s\"", key.Data(), value.Data());
// Parse SE information
if (!key.CompareTo("se", TString::kIgnoreCase))
......@@ -123,7 +123,7 @@ TJAlienFile *TJAlienFile::Open(const char *url, Option_t *option,
TString key = TString(spec(0, spec.Index(":")));
TString value = TString(spec(spec.Index(":") + 1, spec.Length()));
tags->Add(new TObjString(key), new TObjString(value));
::Info("TJAlienFile::Open", "Tag \"%s\" = \"%s\"", key.Data(), value.Data());
if (gDebug > 1) ::Info("TJAlienFile::Open", "Tag \"%s\" = \"%s\"", key.Data(), value.Data());
}
}
}
......@@ -170,9 +170,9 @@ TJAlienFile *TJAlienFile::Open(const char *url, Option_t *option,
// ----------------------------------------------------------------------------------------
// Construct the command to be sent
//
TString command("access");
::Info("TJAlienFile::Open", "Running access command =\"%s\"", command.Data());
if (gDebug > 1) ::Info("TJAlienFile::Open", "Running access command =\"%s\"", command.Data());
if (fJOption == "UPDATE" || fJOption == "RECREATE") {
command += (" " + TString("write-version"));
......@@ -282,12 +282,15 @@ TJAlienFile *TJAlienFile::Open(const char *url, Option_t *option,
delete valueObject;
::Info("TJAlienFile::Open", "%s", urlStr.Data());
::Info("TJAlienFile::Open", "%s", seStr.Data());
::Info("TJAlienFile::Open", "%d", nreplicas);
::Info("TJAlienFile::Open", "%s", sguid.Data());
::Info("TJAlienFile::Open", "%s", pfnStr.Data());
::Info("TJAlienFile::Open", "%s", tagsStr.Data());
if (gDebug > 1)
{
::Info("TJAlienFile::Open", "%s", urlStr.Data());
::Info("TJAlienFile::Open", "%s", seStr.Data());
::Info("TJAlienFile::Open", "%d", nreplicas);
::Info("TJAlienFile::Open", "%s", sguid.Data());
::Info("TJAlienFile::Open", "%s", pfnStr.Data());
::Info("TJAlienFile::Open", "%s", tagsStr.Data());
}
// If envelope does not contain necessary information
if ((!urlStr) || (!authz)) {
......@@ -314,11 +317,26 @@ TJAlienFile *TJAlienFile::Open(const char *url, Option_t *option,
// Form physical and logical URLs
//
TUrl logicalUrl(url);
TUrl physicalUrl(urlStr + TString("?&authz=") + authz);
TString anchor = inputUrl.GetAnchor();
// Extract the anchor from input url
// alien:///alice/sim/2017/LHC17j8c/245353/001/aod_archive.zip#AliAOD.root
// ^ anchor ^
TString anchor = inputUrl.GetAnchor();
// If no anchor was specified there, try to get it from server reply
// root://grid03.hepl.hiroshima-u.ac.jp:1094//07/43168/80a25954-bfdb-11e7-9da3-bbe5aa2e0c61#AliAOD.root
// ^ anchor ^
if (anchor.Length() == 0)
{
TObjArray *tokens = urlStr.Tokenize("#");
if (tokens->GetEntries() == 2)
{
anchor = ((TObjString *) tokens->At(1))->GetName();
urlStr = ((TObjString *) tokens->At(0))->GetName();
}
}
TUrl logicalUrl(url);
TUrl physicalUrl(urlStr + TString("?&authz=") + authz);
if (anchor.Length())
{
......
Supports Markdown
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