51#define MAX_FILE_IMAGES 16
83 const char *ftitle,
Int_t compress,
84 Bool_t parallelopen,
const char *lurl,
86 TXNetFile(purl, option, ftitle, compress, 0, parallelopen, lurl)
88 TUrl logicalurl(lurl);
105 const char *ftitle,
Int_t compress,
109 ::Error(
"TAlienFileAccess",
"No GRID connection available!");
156 storageelement = value;
159 if (atoi(value.
Data()))
160 publicaccess =
kTRUE;
191 if (fAOption ==
"NEW")
195 recreate = (fAOption ==
"RECREATE") ?
kTRUE :
kFALSE;
199 if (!create && !recreate && !
update && !read) {
204 if (create || recreate ||
update) {
209 fAOption =
"RECREATE";
217 ::Error(
"TAlienFile::Open",
"no active GRID connection found");
227 ::Error(
"TAlienFile::Open",
"you don't have an active <alien> grid!");
244 command =
TString(
"access -p read ");
246 command =
TString(
"access read ");
250 command =
TString(
"access write-once ");
254 command =
TString(
"access write-version ");
258 command =
TString(
"access write-version ");
266 command += storageelement;
275 repcommand = command;
278 if (storageelement !=
"") {
280 repcommand += storageelement;
283 repcommand +=
"unknown";
286 repcommand += imagenr;
295 list =
dynamic_cast < TList *
>(alienResult);
300 "cannot get the access envelope for %s and image %u in SE <%s>",
303 ::Error(
"TAlienFile::Open",
304 "cannot get the access envelope for %s and image %u",
323 while ((
object = iter->
Next()) != 0) {
327 urlStr =
dynamic_cast < TObjString *
>(urlObject);
328 if (urlStr) urlStrs = urlStr->
GetName();
331 authzStr =
dynamic_cast < TObjString *
>(authzObject);
334 seStr =
dynamic_cast < TObjString *
>(seObject);
335 if (seStr) seStrs = seStr->
GetName();
338 if (nreplicasObject) {
339 snreplicas = nreplicasObject->
GetName();
340 nreplicas = snreplicas.
Atoi();
344 if (guidObject) sguid = guidObject->
GetName();
347 if (pfnObject) pfnStr = pfnObject->
GetName();
356 if ((!urlStr) || (!authzStr)) {
359 "didn't get the authorization to write %s",
364 "didn't get the authorization to read %s from location %u",
369 ::Info(
"TAlienFile::Open",
370 "Command::Stdout !!!");
372 ::Info(
"TAlienFile::Open",
373 "Command::Stderr !!!");
375 ::Info(
"TAlienFile::Open",
376 "End of Output !!!");
386 "No more images to try - giving up");
417 ::Info(
"TAlienFile::Open",
"Accessing image %u of %s in SE <%s>",
420 ::Info(
"TAlienFile::Open",
"Accessing image %u of %s", imagenr, purl.
GetUrl());
434 lUrloption +=
"&mkpath=1";
444 lUrloption += anchor;
445 lUrloption +=
"&mkpath=1";
453 loption +=
"&mkpath=1";
461 fAUrl =
TUrl(newurl);
498 parallelopen, lUrl.
GetUrl(), authz);
508 alienfile->
SetSE(seStrs);
509 alienfile->
SetPfn(pfnStr);
513 alienfile->
SetUrl(urlStrs);
521 "Couldn't open any of the file images of %s", lUrl.
GetUrl());
540 Info(
"~TAlienFile",
"dtor called for %s",
GetName());
565 Error(
"Close",
"the reported size of the written file is <= 0");
573 TList *list =
dynamic_cast < TList *
>(alienResult);
579 Error(
"Close",
"cannot commit envelope for %s",
fLfn.
Data());
585 while ((
object = iter->
Next()) != 0) {
591 if (!(strcmp(commitStr->
GetName(),
"1"))) {
623 command =
"access -p read ";
629 ::Error(
"TAlienFile::SUrl",
"no grid connection");
635 ::Error(
"TAlienFile::SUrl",
"couldn't get access URL for alien file %s", lfn);
643 object = iter->
Next();
647 urlStr =
dynamic_cast < TObjString *
>(urlObject);
656 ::Error(
"TAlienFile::SUrl",
"couldn't get surl for alien file %s", lfn);
static void update(gsl_integration_workspace *workspace, double a1, double b1, double area1, double error1, double a2, double b2, double area2, double error2)
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
R__EXTERN TSystem * gSystem
R__EXTERN TVirtualMonitoringWriter * gMonitoringWriter
void SetElapsed(Double_t real)
static TString SUrl(const char *lfn)
Get surl from lfn by asking AliEn catalog.
void SetUrl(const char *url)
void SetPfn(const char *pfn)
virtual ~TAlienFile()
TAlienFile file dtor.
static TAlienFile * Open(const char *lfn, const Option_t *option="", const char *title="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Bool_t parallelopen=kFALSE)
Static method used to create a TAlienFile object.
void SetSE(const char *se)
void SetGUID(const char *guid)
virtual void Close(const Option_t *opt="")
Close the file.
void SetNreplicas(Int_t nrep)
void SetImage(Int_t image)
Bool_t fWritable
True if directory is writable.
virtual Long64_t GetSize() const
Returns the current file size.
TString fOption
File options.
const char * GetGrid() const
virtual TGridResult * Command(const char *, Bool_t=kFALSE, UInt_t=2)
Iterator abstract base class.
virtual TObject * Next()=0
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const
Return a list iterator.
TMap implements an associative array of (key,value) pairs using a THashTable for efficient retrieval ...
TObject * GetValue(const char *keyname) const
Returns a pointer to the value associated with keyname as name of the key.
virtual const char * GetName() const
Returns name of object.
Int_t GetEntries() const
Return the number of objects in array (i.e.
TObject * At(Int_t idx) const
Collectable string class.
const char * GetName() const
Returns name of object.
void SetString(const char *s)
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
R__ALWAYS_INLINE Bool_t IsZombie() const
Double_t RealTime()
Stop the stopwatch (if it is running) and return the realtime (in seconds) passed between the start a...
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
void Stop()
Stop the stopwatch.
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
Int_t Atoi() const
Return integer value of string.
const char * Data() const
void ToUpper()
Change string to upper case.
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
virtual const char * Getenv(const char *env)
Get environment variable.
virtual void Unsetenv(const char *name)
Unset environment variable.
virtual void Setenv(const char *name, const char *value)
Set environment variable.
virtual int Unlink(const char *name)
Unlink, i.e.
This class represents a WWW compatible URL.
const char * GetAnchor() const
const char * GetUrl(Bool_t withDeflt=kFALSE) const
Return full URL.
const char * GetFile() const
void SetOptions(const char *opt)
const char * GetOptions() const
void SetFile(const char *file)
virtual Bool_t SendFileOpenProgress(TFile *, TList *, const char *, Bool_t=kFALSE)
virtual void Close(const Option_t *opt="")
Close the file (see TNetFile::Close() or TFile::Close() for more details).
virtual Bool_t IsOpen() const
Return kTRUE if the file is open, kFALSE otherwise.