TJAlienFile.h 2.5 KB
Newer Older
Nikola Hardi's avatar
Nikola Hardi committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*
 * TJAlienFile.h
 *
 *  Created on: Jul 18, 2014
 *      Author: Tatiana Tothova
 */

#ifndef ROOT_TJAlienFile
#define ROOT_TJAlienFile

#ifndef ROOT_TXNetFile
#include "TXNetFile.h"
#endif

class TUrl;

class TJAlienFile : public TXNetFile {

private:
   TString fLfn;       // logical file name
   TString fAuthz;     // authorization envelope
   TString fGUID;      // GUID
   TString fUrl;       // url for the opened copy
   TString fPfn;       // physical file name
   TString fSE;        // Storage element
26
   TString fPrefSE;    // List of preferred storage elements
27
   Int_t   fImage;     // Image number
Nikola Hardi's avatar
Nikola Hardi committed
28
29
30
31
32
33
34
35
36
37
38
39
   Int_t   fNreplicas; // Number of replicas
   Long64_t fOpenedAt; // Absolute value for time when opened
   Double_t fElapsed;  // Time elapsed to opem file
public:
   TJAlienFile() : TXNetFile(), fLfn(), fAuthz(), fGUID(), fUrl(), fPfn(), fSE(), fNreplicas(0), fOpenedAt(0), fElapsed(0) { }
   TJAlienFile(const char *purl, Option_t *option = "",
              const char *ftitle = "", Int_t compress = 1,
              Bool_t parallelopen = kFALSE, const char *lurl = 0,
              const char *authz = 0);
   virtual ~TJAlienFile();

   virtual void Close(const Option_t *opt = "");
40
   void Mirror();
Nikola Hardi's avatar
Nikola Hardi committed
41
42
43

   const char  *GetGUID() const  {return fGUID;}
   Double_t     GetElapsed() const {return fElapsed;}
44
   Int_t        GetImage() const {return fImage;}
Nikola Hardi's avatar
Nikola Hardi committed
45
46
47
48
49
50
51
52
53
54
   const char  *GetLfn() const   {return fLfn;}
   Int_t        GetNreplicas() const {return fNreplicas;}
   Long64_t     GetOpenTime() const {return fOpenedAt;}
   const char  *GetPfn() const   {return fPfn;}
   const char  *GetSE() const    {return fSE;}
   const char  *GetUrl() const   {return fUrl;}

protected:
   void         SetGUID(const char *guid) {fGUID = guid;}
   void         SetElapsed(Double_t real) {fElapsed = real;}
55
   void         SetImage(Int_t image)   {fImage = image;}
Nikola Hardi's avatar
Nikola Hardi committed
56
57
58
   void         SetNreplicas(Int_t nrep) {fNreplicas = nrep;}
   void         SetPfn(const char *pfn) {fPfn = pfn;}
   void         SetSE(const char *se)   {fSE = se;}
59
   void         SetPreferredSE(const char *prefse) {fPrefSE = prefse;}
Nikola Hardi's avatar
Nikola Hardi committed
60
61
62
63
64
65
66
67
68
69
70
71
72
   void         SetUrl(const char *url) {fUrl = url;}


public:
   static TJAlienFile *Open(const char *url, const Option_t *option = "",
                           const char *title = "", Int_t compress = 1,
                           Bool_t parallelopen = kFALSE);
   static TString     SUrl(const char *lfn);

   ClassDef(TJAlienFile, 4)  //A ROOT file that reads/writes via AliEn services and TXNetFile protocol
};

#endif /* TJALIENFILE_H_ */