ROOT  6.06/09
Reference Guide
TAlienFile.h
Go to the documentation of this file.
1 // @(#)root/alien:$Id$
2 // Author: Andreas Peters 11/09/2003
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TAlienFile
13 #define ROOT_TAlienFile
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TAlienFile //
18 // //
19 // A TAlienFile is like a normal TFile except that it reads and writes //
20 // it's data via TXNetFile and gets authorization and the TXNetFile //
21 // URL from an alien service. //
22 // //
23 // Filenames are standard URL format with protocol "alien". //
24 // The following are valid TAlienFile URL's: //
25 // //
26 // alien:///alice/cern.ch/user/p/peters/test.root //
27 // /alien/alice/cern.ch/user/p/peters/test.root //
28 // //
29 // - notice that URLs like /alien/alice... are converted internally //
30 // to alien://alice... //
31 // //
32 //////////////////////////////////////////////////////////////////////////
33 
34 #ifndef ROOT_TXNetFile
35 #include "TXNetFile.h"
36 #endif
37 
38 
39 class TUrl;
40 
41 class TAlienFile : public TXNetFile {
42 
43 private:
44  TString fLfn; // logical file name
45  TString fAuthz; // authorization envelope
46  TString fGUID; // GUID
47  TString fUrl; // url for the opened copy
48  TString fPfn; // physical file name
49  TString fSE; // Storage element
50  Int_t fImage; // Image number
51  Int_t fNreplicas; // Number of replicas
52  Long64_t fOpenedAt; // Absolute value for time when opened
53  Double_t fElapsed; // Time elapsed to opem file
54 public:
55  TAlienFile() : TXNetFile(), fLfn(), fAuthz(), fGUID(), fUrl(), fPfn(), fSE(), fImage(0), fNreplicas(0), fOpenedAt(0), fElapsed(0) { }
56  TAlienFile(const char *purl, Option_t *option = "",
57  const char *ftitle = "", Int_t compress = 1,
58  Bool_t parallelopen = kFALSE, const char *lurl = 0,
59  const char *authz = 0);
60  virtual ~TAlienFile();
61 
62  virtual void Close(const Option_t *opt = "");
63 
64  const char *GetGUID() const {return fGUID;}
65  Double_t GetElapsed() const {return fElapsed;}
66  Int_t GetImage() const {return fImage;}
67  const char *GetLfn() const {return fLfn;}
68  Int_t GetNreplicas() const {return fNreplicas;}
69  Long64_t GetOpenTime() const {return fOpenedAt;}
70  const char *GetPfn() const {return fPfn;}
71  const char *GetSE() const {return fSE;}
72  const char *GetUrl() const {return fUrl;}
73 
74 protected:
75  void SetGUID(const char *guid) {fGUID = guid;}
76  void SetElapsed(Double_t real) {fElapsed = real;}
77  void SetImage(Int_t image) {fImage = image;}
78  void SetNreplicas(Int_t nrep) {fNreplicas = nrep;}
79  void SetPfn(const char *pfn) {fPfn = pfn;}
80  void SetSE(const char *se) {fSE = se;}
81  void SetUrl(const char *url) {fUrl = url;}
82 
83 public:
84  static TAlienFile *Open(const char *lfn, const Option_t *option = "",
85  const char *title = "", Int_t compress = 1,
86  Bool_t parallelopen = kFALSE);
87  static TString SUrl(const char *lfn);
88 
89  ClassDef(TAlienFile, 4) //A ROOT file that reads/writes via AliEn services and TXNetFile protocol
90 };
91 
92 #endif
const char * GetGUID() const
Definition: TAlienFile.h:64
virtual void Close(const Option_t *opt="")
Close the file.
Definition: TAlienFile.cxx:546
static TAlienFile * Open(const char *lfn, const Option_t *option="", const char *title="", Int_t compress=1, Bool_t parallelopen=kFALSE)
Static method used to create a TAlienFile object.
Definition: TAlienFile.cxx:104
long long Long64_t
Definition: RtypesCore.h:69
const char Option_t
Definition: RtypesCore.h:62
TString fGUID
Definition: TAlienFile.h:46
const char * GetUrl() const
Definition: TAlienFile.h:72
This class represents a WWW compatible URL.
Definition: TUrl.h:41
Double_t fElapsed
Definition: TAlienFile.h:53
void SetPfn(const char *pfn)
Definition: TAlienFile.h:79
void SetElapsed(Double_t real)
Definition: TAlienFile.h:76
Basic string class.
Definition: TString.h:137
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
TString fSE
Definition: TAlienFile.h:49
TString fPfn
Definition: TAlienFile.h:48
Int_t fImage
Definition: TAlienFile.h:50
#define ClassDef(name, id)
Definition: Rtypes.h:254
void SetSE(const char *se)
Definition: TAlienFile.h:80
Double_t GetElapsed() const
Definition: TAlienFile.h:65
Long64_t GetOpenTime() const
Definition: TAlienFile.h:69
Int_t GetNreplicas() const
Definition: TAlienFile.h:68
const char * GetSE() const
Definition: TAlienFile.h:71
TString fUrl
Definition: TAlienFile.h:47
void SetNreplicas(Int_t nrep)
Definition: TAlienFile.h:78
Long64_t fOpenedAt
Definition: TAlienFile.h:52
virtual ~TAlienFile()
TAlienFile file dtor.
Definition: TAlienFile.cxx:534
void SetGUID(const char *guid)
Definition: TAlienFile.h:75
double Double_t
Definition: RtypesCore.h:55
void SetImage(Int_t image)
Definition: TAlienFile.h:77
const char * GetPfn() const
Definition: TAlienFile.h:70
Int_t fNreplicas
Definition: TAlienFile.h:51
Int_t GetImage() const
Definition: TAlienFile.h:66
static TString SUrl(const char *lfn)
Get surl from lfn by asking AliEn catalog.
Definition: TAlienFile.cxx:612
TString fLfn
Definition: TAlienFile.h:44
TString fAuthz
Definition: TAlienFile.h:45
void SetUrl(const char *url)
Definition: TAlienFile.h:81
const char * GetLfn() const
Definition: TAlienFile.h:67
const char Int_t const char * image
Definition: TXSlave.cxx:46