Commit ca871b0a authored by Nikola Hardi's avatar Nikola Hardi
Browse files

Expand the result of find command to include turl based on lfn

parent fc96abc5
Pipeline #984917 passed with stage
in 5 minutes and 37 seconds
......@@ -76,7 +76,7 @@ public:
TJAlienResult *RunJsonCommand(TString *command, TList *options);
// Parse the result from Json structure
TJAlienResult *GetCommandResult(json_object *json_response);
TJAlienResult *GetCommandResult(json_object *json_response, bool expand_find = false);
// Format command to Json structure
json_object *CreateJsonCommand(TString *command, TList *options);
......
......@@ -230,7 +230,7 @@ TGridResult *TJAlien::Command(const char *command, bool interactive, UInt_t stre
TString *s = new TString(sCommand->GetString());
result = (TJAlienResult*) connection.RunJsonCommand(s, options);
TJAlienResultRewriter().Rewrite((std::string)sCommand->GetString(), result);
TJAlienResultRewriter().Rewrite(sCommand->GetString().Data(), result);
if (interactive)
{
......
......@@ -410,13 +410,7 @@ Bool_t TJAlienCollection::ExportXML(TFile * exportfile, Bool_t selected, Bool_t
tagval =
(TObjString *) ((TMap *) nextgroup->GetValue(attributes->GetName()))->GetValue(tagname);
if (TString(tagname->GetName()) != "evlist") {
// NOTE: (nhardi) dirty hack - see find command json output and compare TGridResult with alien
if(TString(tagname->GetName()) != "lfn") {
snprintf(outline,4096, "%s=\"%s\" ", tagname->GetName(), tagval->GetName());
} else {
snprintf(outline, 4096, "lfn=\"%s\" turl=\"alien://%s\" ", tagval->GetName(), tagval->GetName());
}
snprintf(outline,4096, "%s=\"%s\" ", tagname->GetName(), tagval->GetName());
} else {
// the eventlist has to be converted from TEventList to a string list with komma separation
TEntryList *xmlentrylist = (TEntryList *) tagval;
......
......@@ -484,13 +484,13 @@ TJAlienResult *TJAlienConnectionManager::RunJsonCommand(TString *command, TList
json_object * jobj_res = json_tokener_parse(readBuffer.c_str());
// get response
TJAlienResult *GridResult = this->GetCommandResult( jobj_res );
TJAlienResult *GridResult = this->GetCommandResult(jobj_res, *command == "find");
return GridResult;
}
//______________________________________________________________________________
TJAlienResult* TJAlienConnectionManager::GetCommandResult(json_object *json_response)
TJAlienResult* TJAlienConnectionManager::GetCommandResult(json_object *json_response, bool expand_find)
{
// JSON parser of the JBox result
// - parsing the meta information
......@@ -527,7 +527,12 @@ TJAlienResult* TJAlienConnectionManager::GetCommandResult(json_object *json_resp
TMap *t = new TMap();
json_object_object_foreach(jvalue, key, val)
{
t->Add(new TObjString(key), new TObjString(json_object_get_string(val)));
TString sValue = json_object_get_string(val);
TString sKey = key;
t->Add(new TObjString(key), new TObjString(sValue));
if(expand_find && sKey == "lfn") {
t->Add(new TObjString("turl"), new TObjString("alien://" + sValue));
}
}
gridResult->Add(t);
}
......
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