diff --git a/net/net/CMakeLists.txt b/net/net/CMakeLists.txt index de4009401b18a..697a18ce59686 100644 --- a/net/net/CMakeLists.txt +++ b/net/net/CMakeLists.txt @@ -15,6 +15,13 @@ ROOT_STANDARD_LIBRARY_PACKAGE(Net TApplicationRemote.h TApplicationServer.h TFileStager.h + TGrid.h + TGridCollection.h + TGridJDL.h + TGridJob.h + TGridJobStatus.h + TGridJobStatusList.h + TGridResult.h TMessage.h TMonitor.h TParallelMergingFile.h @@ -34,6 +41,12 @@ ROOT_STANDARD_LIBRARY_PACKAGE(Net src/NetErrors.cxx src/TApplicationRemote.cxx src/TApplicationServer.cxx + src/TGrid.cxx + src/TGridJDL.cxx + src/TGridJob.cxx + src/TGridJobStatus.cxx + src/TGridJobStatusList.cxx + src/TGridResult.cxx src/TFileStager.cxx src/TMessage.cxx src/TMonitor.cxx diff --git a/net/net/inc/LinkDef.h b/net/net/inc/LinkDef.h index 1760c4b430cb5..436ada902af09 100644 --- a/net/net/inc/LinkDef.h +++ b/net/net/inc/LinkDef.h @@ -14,6 +14,9 @@ #pragma link C++ enum ESockOptions; #pragma link C++ enum ESendRecvOptions; +#pragma link C++ global gGrid; +#pragma link C++ global gGridJobStatusList; + #pragma link C++ class TServerSocket; #pragma link C++ class TSocket; #pragma link C++ class TPServerSocket; @@ -27,6 +30,13 @@ #pragma link C++ class TSQLTableInfo; #pragma link C++ class TSQLColumnInfo; #pragma link C++ class TSQLMonitoringWriter; +#pragma link C++ class TGrid; +#pragma link C++ class TGridResult+; +#pragma link C++ class TGridJDL+; +#pragma link C++ class TGridJob+; +#pragma link C++ class TGridJobStatus+; +#pragma link C++ class TGridJobStatusList+; +#pragma link C++ class TGridCollection+; #pragma link C++ class TFileStager; #pragma link C++ class TApplicationRemote; #pragma link C++ class TApplicationServer; diff --git a/net/net/inc/TGrid.h b/net/net/inc/TGrid.h new file mode 100644 index 0000000000000..dd26464393f6e --- /dev/null +++ b/net/net/inc/TGrid.h @@ -0,0 +1,132 @@ +// @(#)root/net:$Id$ +// Author: Fons Rademakers 3/1/2002 + +/************************************************************************* + * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers. * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ + +#ifndef ROOT_TGrid +#define ROOT_TGrid + +#include "TObject.h" + +#include "TString.h" + +#include "TGridJob.h" + +class TGridResult; +class TGridJDL; +class TGridJob; +class TGridCollection; +class TGridJobStatusList; + + +/////////////////////////////////////////////////////////////////////////// +/// +/// Abstract base class defining interface to common GRID services. +/// +/// \note This class is deprecated. It is kept for backward compatibility +/// but it should not be used in new code. +/// +/// To open a connection to a GRID use the static method Connect(). +/// The argument of Connect() is of the form: +/// ~~~ +/// ://[:], e.g. alien://alice.cern.ch +/// ~~~ +/// Depending on the specified an appropriate plugin library +/// will be loaded which will provide the real interface. +/// +/// Related classes are TGridResult. +/// +/////////////////////////////////////////////////////////////////////////// +class TGrid : public TObject { + +protected: + TString fGridUrl; // the GRID url used to create the grid connection + TString fGrid; // type of GRID (AliEn, ...) + TString fHost; // GRID portal to which we are connected + TString fUser; // user name + TString fPw; // user passwd + TString fOptions; // options specified + Int_t fPort; // port to which we are connected + +public: + TGrid() : fGridUrl(), fGrid(), fHost(), fUser(), fPw(), fOptions(), fPort(-1) {} + virtual ~TGrid() {} + + const char *GridUrl() const { return fGridUrl; } + const char *GetGrid() const { return fGrid; } + const char *GetHost() const { return fHost; } + const char *GetUser() const { return fUser; } + const char *GetPw() const { return fPw; } + const char *GetOptions() const { return fOptions; } + Int_t GetPort() const { return fPort; } + virtual Bool_t IsConnected() const { return fPort == -1 ? kFALSE : kTRUE; } + + virtual void Shell() { MayNotUse("Shell"); } + virtual void Stdout() { MayNotUse("Stdout"); } + virtual void Stderr() { MayNotUse("Stderr"); } + + virtual TGridResult *Command(const char * /*command*/, + Bool_t /*interactive*/ = kFALSE, + UInt_t /*stream*/ = 2) + { MayNotUse("Command"); return nullptr; } + + virtual TGridResult *Query(const char * /*path*/, const char * /*pattern*/, + const char * /*conditions*/ = "", const char * /*options*/ = "") + { MayNotUse("Query"); return nullptr; } + + virtual TGridResult *LocateSites() { MayNotUse("LocalSites"); return nullptr; } + + //--- Catalogue Interface + virtual TGridResult *Ls(const char* /*ldn*/ ="", Option_t* /*options*/ ="", Bool_t /*verbose*/ =kFALSE) + { MayNotUse("Ls"); return nullptr; } + virtual const char *Pwd(Bool_t /*verbose*/ =kFALSE) + { MayNotUse("Pwd"); return nullptr; } + virtual const char *GetHomeDirectory() + { MayNotUse("GetHomeDirectory"); return nullptr; } + virtual Bool_t Cd(const char* /*ldn*/ ="",Bool_t /*verbose*/ =kFALSE) + { MayNotUse("Cd"); return kFALSE; } + virtual Int_t Mkdir(const char* /*ldn*/ ="", Option_t* /*options*/ ="", Bool_t /*verbose*/ =kFALSE) + { MayNotUse("Mkdir"); return kFALSE; } + virtual Bool_t Rmdir(const char* /*ldn*/ ="", Option_t* /*options*/ ="", Bool_t /*verbose*/ =kFALSE) + { MayNotUse("Mkdir"); return kFALSE; } + virtual Bool_t Register(const char* /*lfn*/ , const char* /*turl*/ , Long_t /*size*/ =-1, const char* /*se*/ =nullptr, const char* /*guid*/ =nullptr, Bool_t /*verbose*/ =kFALSE) + { MayNotUse("Mkdir"); return kFALSE; } + virtual Bool_t Rm(const char* /*lfn*/ , Option_t* /*option*/ ="", Bool_t /*verbose*/ =kFALSE) + { MayNotUse("Mkdir"); return kFALSE; } + + //--- Job Submission Interface + virtual TGridJob *Submit(const char * /*jdl*/) + { MayNotUse("Submit"); return nullptr; } + virtual TGridJDL *GetJDLGenerator() + { MayNotUse("GetJDLGenerator"); return nullptr; } + virtual TGridCollection *OpenCollection(const char *, UInt_t /*maxentries*/ = 1000000) + { MayNotUse("OpenCollection"); return nullptr; } + virtual TGridCollection *OpenCollectionQuery(TGridResult * /*queryresult*/,Bool_t /*nogrouping*/ = kFALSE) + { MayNotUse("OpenCollection"); return nullptr; } + virtual TGridJobStatusList* Ps(const char* /*options*/, Bool_t /*verbose*/ = kTRUE) + { MayNotUse("Ps"); return nullptr; } + virtual Bool_t KillById(TString /*jobid*/) + { MayNotUse("KillById"); return kFALSE; } + virtual Bool_t ResubmitById(TString /*jobid*/) + { MayNotUse("ResubmitById"); return kFALSE; } + virtual Bool_t Kill(TGridJob *gridjob) + { return ((gridjob)?KillById(gridjob->GetJobID()):kFALSE); } + virtual Bool_t Resubmit(TGridJob* gridjob) + { return ((gridjob)?ResubmitById(gridjob->GetJobID()):kFALSE); } + + //--- Load desired plugin and setup conection to GRID + static TGrid *Connect(const char *grid, const char *uid = nullptr, + const char *pw = nullptr, const char *options = nullptr); + + ClassDefOverride(TGrid,0) // ABC defining interface to GRID services +}; + +R__EXTERN TGrid *gGrid; + +#endif diff --git a/net/net/inc/TGridCollection.h b/net/net/inc/TGridCollection.h new file mode 100644 index 0000000000000..18f2ed4b14078 --- /dev/null +++ b/net/net/inc/TGridCollection.h @@ -0,0 +1,118 @@ +// @(#)root/net:$Id$ +// Author: Andreas-Joachim Peters 2005-05-09 + +/************************************************************************* + * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ + +#ifndef ROOT_TGridCollection +#define ROOT_TGridCollection + +#include "TObject.h" + +class TMap; +class TFile; +class TEntryList; +class TList; +class TDSet; +class TGridResult; +class TFileCollection; + + +////////////////////////////////////////////////////////////////////////// +/// +/// \note This class is deprecated. It is kept for backward compatibility +/// but it should not be used in new code. +/// +/// Class which manages collection files on the Grid. +/// +////////////////////////////////////////////////////////////////////////// +class TGridCollection : public TObject { +public: + TGridCollection() { } + virtual ~TGridCollection() { } + + virtual void Reset() + { MayNotUse("Reset"); } + virtual TMap *Next() + { MayNotUse("Next"); return nullptr;} + virtual Bool_t Remove(TMap *) + { MayNotUse("Remove"); return 0;} + virtual const char *GetTURL(const char * /*name*/ = "") + { MayNotUse("GetTURL"); return nullptr;} + virtual const char *GetSURL(const char * /*name*/ = "") + { MayNotUse("GetSURL"); return nullptr;} + virtual const char *GetLFN(const char * /*name*/ = "") + { MayNotUse("GetLFN"); return nullptr;} + virtual Long64_t GetSize(const char * /*name*/ = "") + { MayNotUse("GetSize"); return -1;} + virtual Bool_t IsOnline(const char * /*name*/ = "") + { MayNotUse("IsOnline"); return 0;} + virtual Bool_t IsSelected(const char * /*name*/ = "") + { MayNotUse("IsSelected"); return 0;} + virtual void Status() + { MayNotUse("Status"); } + virtual void SetTag(const char * , const char * , TMap* ) + { MayNotUse("SetTag"); } + virtual Bool_t SelectFile(const char *, Int_t /*nstart*/ = -1 , Int_t /*nstop*/ = -1) + { MayNotUse("SelectFile"); return kFALSE;} + virtual Bool_t DeselectFile(const char *, Int_t /*nstart*/ = -1, Int_t /*nstop*/ = -1) + { MayNotUse("DeselectFile"); return kFALSE;} + virtual Bool_t InvertSelection() + { MayNotUse("InvertSelection"); return kFALSE;} + virtual Bool_t DownscaleSelection(UInt_t /* scaler */ = 2) + { MayNotUse("DownscaleSelection"); return kFALSE;} + virtual Bool_t ExportXML(const char *, Bool_t /*selected*/ = kTRUE, Bool_t /*online*/ = kTRUE, + const char * /*name*/ = "ROOT xml", const char * /*comment*/ = "Exported XML") + { MayNotUse("ExportXML"); return kFALSE;} + virtual const char* GetExportUrl() + { MayNotUse("GetExportUrl"); return nullptr;} + virtual Bool_t SetExportUrl(const char * /*exporturl*/ = nullptr) + { MayNotUse("SetExportUrl"); return kFALSE;} + virtual void Print(Option_t * = "") const override + { MayNotUse("Print"); } + virtual TFile *OpenFile(const char *) + { MayNotUse("OpenFile"); return nullptr;} + virtual TList *GetFileGroupList() const + { MayNotUse("GetFileGroupList"); return nullptr;} + virtual TEntryList *GetEntryList(const char *) + { MayNotUse("GetEntryList"); return nullptr;} + virtual UInt_t GetNofGroups() const + { MayNotUse("GetNofGroups"); return 0;} + virtual UInt_t GetNofGroupfiles() const + { MayNotUse("GetNofGroupfiles"); return 0;} + virtual Bool_t OverlapCollection(TGridCollection *) + { MayNotUse("OverlapCollection"); return 0;} + virtual void Add(TGridCollection *) + { MayNotUse("Add");} + virtual Bool_t Stage(Bool_t /*bulk*/ = kFALSE, Option_t * /*TFileStager option*/ = "") + { MayNotUse("Stage"); return kFALSE;} + virtual Bool_t Prepare(Bool_t /*bulk*/ = kFALSE) + { MayNotUse("Prepare"); return kFALSE;} + virtual Bool_t CheckIfOnline(Bool_t /*bulk*/ = kFALSE) + { MayNotUse("CheckIfOnline"); return kFALSE;} + virtual TDSet *GetDataset(const char *, const char * , const char *) + { MayNotUse("GetDataset"); return nullptr;} + virtual TGridResult *GetGridResult(const char * /*filename*/ = "", Bool_t /*onlyonline*/ = kTRUE , Bool_t /*publicaccess*/ = kFALSE ) + { MayNotUse("GetGridResult"); return nullptr;} + virtual Bool_t LookupSUrls(Bool_t /*verbose*/ = kTRUE) + { MayNotUse("LookupSUrls"); return kFALSE;} + virtual TList *GetTagFilterList() const + { MayNotUse("GetTagFilterList"); return nullptr;} + virtual void SetTagFilterList(TList *) + { MayNotUse("SetTagFilterList");} + virtual const char* GetCollectionName() const + { MayNotUse("GetCollectionName"); return nullptr;} + virtual const char* GetInfoComment() const + { MayNotUse("GetInfoComment"); return nullptr;} + virtual TFileCollection* GetFileCollection(const char* /*name*/ = "", const char* /*title*/ = "") const + { MayNotUse("GetFileCollection"); return nullptr;} + + ClassDefOverride(TGridCollection,1) // ABC managing collection of files on the Grid +}; + +#endif diff --git a/net/net/inc/TGridJDL.h b/net/net/inc/TGridJDL.h new file mode 100644 index 0000000000000..6880484bba0d8 --- /dev/null +++ b/net/net/inc/TGridJDL.h @@ -0,0 +1,76 @@ +// @(#)root/net:$Id$ +// Author: Jan Fiete Grosse-Oetringhaus 28/9/2004 +// Jancurova.lucia@cern.ch Slovakia 29/9/2008 + +/************************************************************************* + * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ + +#ifndef ROOT_TGridJDL +#define ROOT_TGridJDL + +////////////////////////////////////////////////////////////////////////// +/// +/// \note This class is deprecated. It is kept for backward compatibility +/// but it should not be used in new code. +/// +/// Related classes are TGLiteJDL +/// . +////////////////////////////////////////////////////////////////////////// + +#include "TObject.h" +#include "TString.h" +#include "TMap.h" + + +class TGridJDL : public TObject { +protected: + TMap fMap; // stores the key, value pairs of the JDL + TMap fDescriptionMap; // stores the key, value pairs of the JDL +public: + TGridJDL() : fMap(), fDescriptionMap() { } + virtual ~TGridJDL(); + + void SetValue(const char *key, const char *value); + const char *GetValue(const char *key); + void SetDescription(const char *key, const char *description); + const char *GetDescription(const char *key); + TString AddQuotes(const char *value); + void AddToSet(const char *key, const char *value); + void AddToSetDescription(const char *key, const char *description); + virtual TString Generate(); + void Clear(const Option_t* = "") override; + + virtual void SetExecutable(const char *value=nullptr, const char *description=nullptr) = 0; + virtual void SetArguments(const char *value=nullptr, const char *description=nullptr) = 0; + virtual void SetEMail(const char *value=nullptr, const char *description=nullptr) = 0; + virtual void SetOutputDirectory(const char *value=nullptr, const char *description=nullptr) = 0; + virtual void SetPrice(UInt_t price=1, const char *description=nullptr) = 0; + virtual void SetTTL(UInt_t ttl=72000, const char *description=nullptr) = 0; + virtual void SetJobTag(const char *jobtag=nullptr, const char *description=nullptr) = 0; + virtual void SetInputDataListFormat(const char *format="xml-single", const char *description=nullptr) = 0; + virtual void SetInputDataList(const char *list="collection.xml", const char *description=nullptr) = 0; + + virtual void SetSplitMode(const char *value, UInt_t maxnumberofinputfiles=0, + UInt_t maxinputfilesize=0, const char *d1=nullptr, + const char *d2=nullptr, const char *d3=nullptr) = 0; + virtual void SetSplitArguments(const char *splitarguments=nullptr, const char *description=nullptr) = 0; + virtual void SetValidationCommand(const char *value, const char *description=nullptr) = 0; + + virtual void AddToInputSandbox(const char *value=nullptr, const char *description=nullptr) = 0; + virtual void AddToOutputSandbox(const char *value=nullptr, const char *description=nullptr) = 0; + virtual void AddToInputData(const char *value=nullptr, const char *description=nullptr) = 0; + virtual void AddToInputDataCollection(const char *value=nullptr, const char *description=nullptr) = 0; + virtual void AddToRequirements(const char *value=nullptr, const char *description=nullptr) = 0; + virtual void AddToPackages(const char *name="AliRoot", const char *version="default", + const char *type="VO_ALICE", const char *description=nullptr) = 0; + virtual void AddToOutputArchive(const char *value=nullptr, const char *description=nullptr) = 0; + + ClassDefOverride(TGridJDL,1) // ABC defining interface JDL generator +}; + +#endif diff --git a/net/net/inc/TGridJob.h b/net/net/inc/TGridJob.h new file mode 100644 index 0000000000000..52c63444c740f --- /dev/null +++ b/net/net/inc/TGridJob.h @@ -0,0 +1,50 @@ +// @(#)root/net:$Id$ +// Author: Jan Fiete Grosse-Oetringhaus 06/10/2004 + +/************************************************************************* + * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ + +#ifndef ROOT_TGridJob +#define ROOT_TGridJob + +#include "TObject.h" +#include "TString.h" + + +class TGridJobStatus; + +////////////////////////////////////////////////////////////////////////// +/// +/// Abstract base class defining interface to a GRID job. +/// +/// \note This class is deprecated. It is kept for backward compatibility +/// but it should not be used in new code. +/// +/// Related classes are TGridJobStatus. +/// +////////////////////////////////////////////////////////////////////////// +class TGridJob : public TObject { + +protected: + TString fJobID; // the job's ID + +public: + TGridJob(TString jobID) : fJobID(jobID) { } + virtual ~TGridJob() { } + + virtual TString GetJobID() { return fJobID; } + + virtual TGridJobStatus *GetJobStatus() const = 0; + virtual Int_t GetOutputSandbox(const char *localpath, Option_t *opt = nullptr); + + virtual Bool_t Resubmit() = 0; + virtual Bool_t Cancel () = 0; + ClassDefOverride(TGridJob,1) // ABC defining interface to a GRID job +}; + +#endif diff --git a/net/net/inc/TGridJobStatus.h b/net/net/inc/TGridJobStatus.h new file mode 100644 index 0000000000000..f1a57c2acaeec --- /dev/null +++ b/net/net/inc/TGridJobStatus.h @@ -0,0 +1,53 @@ +// @(#)root/net:$Id$ +// Author: Jan Fiete Grosse-Oetringhaus 06/10/2004 + +/************************************************************************* + * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ + +#ifndef ROOT_TGridJobStatus +#define ROOT_TGridJobStatus + +#include "TNamed.h" + + +////////////////////////////////////////////////////////////////////////// +/// +/// \note This class is deprecated. It is kept for backward compatibility +/// but it should not be used in new code. +/// +/// Abstract base class containing the status of a Grid job. +/// +////////////////////////////////////////////////////////////////////////// +class TGridJobStatus : public TNamed { + +public: + // Subset of Grid job states for common GetStatus function + enum EGridJobStatus { +// clang++ ://[:]`, +/// e.g.: alien://alice.cern.ch +/// The uid is the username and pw the password that should be used for +/// the connection. Depending on the `` the shared library (plugin) +/// for the selected system will be loaded. When the connection could not +/// be opened 0 is returned. For AliEn the supported options are: +/// -domain=`` +/// -debug=`` +/// Example: "-domain=cern.ch -debug=5" + +TGrid *TGrid::Connect(const char *grid, const char *uid, const char *pw, + const char *options) +{ + TPluginHandler *h; + TGrid *g = 0; + + if (!grid) { + ::Error("TGrid::Connect", "no grid specified"); + return 0; + } + if (!uid) + uid = ""; + if (!pw) + pw = ""; + if (!options) + options = ""; + + if ((h = gROOT->GetPluginManager()->FindHandler("TGrid", grid))) { + if (h->LoadPlugin() == -1) { + ::Error("TGrid::Connect", "Loading Plugin failed"); + return 0; + } + g = (TGrid *) h->ExecPlugin(4, grid, uid, pw, options); + } else { + ::Error("TGrid::Connect", "Could not find plugin to handle TGrid"); + } + + return g; +} diff --git a/net/net/src/TGridJDL.cxx b/net/net/src/TGridJDL.cxx new file mode 100644 index 0000000000000..5ba80ec545a31 --- /dev/null +++ b/net/net/src/TGridJDL.cxx @@ -0,0 +1,234 @@ +// @(#)root/net:$Id$ +// Author: Jan Fiete Grosse-Oetringhaus 28/9/2004 +// Jancurova.lucia@cern.ch Slovakia 29/9/2008 + +/************************************************************************* + * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers. * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ + +#include "TGridJDL.h" +#include "TObjString.h" +#include "Riostream.h" + + + +//////////////////////////////////////////////////////////////////////////////// +/// Cleanup. + +TGridJDL::~TGridJDL() +{ + Clear(); +} + +//////////////////////////////////////////////////////////////////////////////// +/// Clears the JDL information. + +void TGridJDL::Clear(const Option_t*) +{ + fMap.DeleteAll(); +} + +//////////////////////////////////////////////////////////////////////////////// +/// Sets a value. If the entry already exists the old one is replaced. + +void TGridJDL::SetValue(const char *key, const char *value) +{ + TObject *object = fMap.FindObject(key); + TPair *pair = dynamic_cast(object); + if (pair) { + TObject *oldObject = pair->Key(); + if (oldObject) { + TObject *oldValue = pair->Value(); + + fMap.Remove(oldObject); + delete oldObject; + oldObject = 0; + + if (oldValue) { + delete oldValue; + oldValue = 0; + } + } + } + + fMap.Add(new TObjString(key), new TObjString(value)); +} + +//////////////////////////////////////////////////////////////////////////////// +/// Returns the value corresponding to the provided key. Return 0 in case +/// key is not found. + +const char *TGridJDL::GetValue(const char *key) +{ + if (!key) + return 0; + + TObject *object = fMap.FindObject(key); + if (!object) + return 0; + + TPair *pair = dynamic_cast(object); + if (!pair) + return 0; + + TObject *value = pair->Value(); + if (!value) + return 0; + + TObjString *string = dynamic_cast(value); + if (!string) + return 0; + + return string->GetName(); +} + +//////////////////////////////////////////////////////////////////////////////// +/// Sets a value. If the entry already exists the old one is replaced. + +void TGridJDL::SetDescription(const char *key, const char* description) +{ + TObject *object = fDescriptionMap.FindObject(key); + TPair *pair = dynamic_cast(object); + if (pair) { + TObject *oldObject = pair->Key(); + if (oldObject) { + TObject *oldValue = pair->Value(); + + fDescriptionMap.Remove(oldObject); + delete oldObject; + oldObject = 0; + + if (oldValue) { + delete oldValue; + oldValue = 0; + } + } + } + + fDescriptionMap.Add(new TObjString(key), new TObjString(description)); +} + +//////////////////////////////////////////////////////////////////////////////// +/// Returns the value corresponding to the provided key. Return 0 in case +/// key is not found. + +const char *TGridJDL::GetDescription(const char *key) +{ + if (!key) + return 0; + + TObject *object = fDescriptionMap.FindObject(key); + if (!object) + return 0; + + TPair *pair = dynamic_cast(object); + if (!pair) + return 0; + + TObject *value = pair->Value(); + if (!value) + return 0; + + TObjString *string = dynamic_cast(value); + if (!string) + return 0; + + return string->GetName(); +} + +//////////////////////////////////////////////////////////////////////////////// +/// Adds quotes to the provided string. +/// E.g. Value --> "Value" + +TString TGridJDL::AddQuotes(const char *value) +{ + TString temp = TString("\""); + temp += value; + temp += "\""; + + return temp; +} + +//////////////////////////////////////////////////////////////////////////////// +/// Adds a value to a key value which hosts a set of values. +/// E.g. InputSandbox: {"file1","file2"} + +void TGridJDL::AddToSet(const char *key, const char *value) +{ + const char *oldValue = GetValue(key); + TString newString; + if (oldValue) + newString = oldValue; + if (newString.IsNull()) { + newString = "{"; + } else { + newString.Remove(newString.Length()-1); + newString += ","; + } + + newString += AddQuotes(value); + newString += "}"; + + SetValue(key, newString); +} + +//////////////////////////////////////////////////////////////////////////////// +/// Adds a value to a key value which hosts a set of values. +/// E.g. InputSandbox: {"file1","file2"} + +void TGridJDL::AddToSetDescription(const char *key, const char *description) +{ + const char *oldValue = GetDescription(key); + TString newString; + if (oldValue) + newString = oldValue; + newString += description; + + SetDescription(key, newString); +} +//////////////////////////////////////////////////////////////////////////////// +/// Generates the JDL snippet. + +TString TGridJDL::Generate() +{ + TString output(""); + + TIter next(&fMap); + TIter nextDescription(&fDescriptionMap); + TObject *object = 0; + TObject *objectD = 0; + while ((object = next())) { + TObjString *key = dynamic_cast(object); + if (key) { + TObject *value = fMap.GetValue(object); + TObjString *valueobj = dynamic_cast(value); + + if (valueobj) { + nextDescription.Reset(); + while ((objectD = nextDescription())) { + TObjString *keyD = dynamic_cast(objectD); + if (keyD) { + TObject *valueD = fDescriptionMap.GetValue(objectD); + TObjString *valueobjD = dynamic_cast(valueD); + if (valueobjD && !strcmp(key->GetName(), keyD->GetName())){ + //Info("",Form("%s %s",key->GetString().Data(),keyD->GetString().Data())); + output += "# "; + output += valueobjD->GetName(); + output += "\n"; + } + } + } + output += key->GetName(); + output += " = "; + output += valueobj->GetName(); + output += ";\n\n"; + } + } + } + + return output; +} diff --git a/net/net/src/TGridJob.cxx b/net/net/src/TGridJob.cxx new file mode 100644 index 0000000000000..be5f71cfbd371 --- /dev/null +++ b/net/net/src/TGridJob.cxx @@ -0,0 +1,24 @@ +// @(#)root/net:$Id$ +// Author: Jan Fiete Grosse-Oetringhaus 06/10/2004 + +/************************************************************************* + * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ + +#include "TGridJob.h" + + + +//////////////////////////////////////////////////////////////////////////////// +/// Must be implemented by actual GRID job implementation. Returns -1 in +/// case of error, 0 otherwise. + +Int_t TGridJob::GetOutputSandbox(const char *, Option_t *) +{ + MayNotUse("GetOutputSandbox"); + return -1; +} diff --git a/net/net/src/TGridJobStatus.cxx b/net/net/src/TGridJobStatus.cxx new file mode 100644 index 0000000000000..4cc1b0e31ed18 --- /dev/null +++ b/net/net/src/TGridJobStatus.cxx @@ -0,0 +1,14 @@ +// @(#)root/net:$Id$ +// Author: Jan Fiete Grosse-Oetringhaus 06/10/2004 + +/************************************************************************* + * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ + +#include "TGridJobStatus.h" + + diff --git a/net/net/src/TGridJobStatusList.cxx b/net/net/src/TGridJobStatusList.cxx new file mode 100644 index 0000000000000..71e6e2d97a2aa --- /dev/null +++ b/net/net/src/TGridJobStatusList.cxx @@ -0,0 +1,16 @@ +// @(#)root/net:$Id$ +// Author: Andreas-Joachim Peters 10/12/2006 + +/************************************************************************* + * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ + +#include "TGridJobStatusList.h" + +TGridJobStatusList *gGridJobStatusList = 0; + + diff --git a/net/net/src/TGridResult.cxx b/net/net/src/TGridResult.cxx new file mode 100644 index 0000000000000..7600153b83a62 --- /dev/null +++ b/net/net/src/TGridResult.cxx @@ -0,0 +1,13 @@ +// @(#)root/net:$Id$ +// Author: Fons Rademakers 23/5/2002 + +/************************************************************************* + * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * + * All rights reserved. * + * * + * For the licensing terms see $ROOTSYS/LICENSE. * + * For the list of contributors see $ROOTSYS/README/CREDITS. * + *************************************************************************/ + +#include "TGridResult.h" +