"SfR Fresh" - the SfR Freeware/Shareware Archive 
As a special service "SfR Fresh" has tried to format the requested source page into HTML format using source code syntax highlighting with prefixed line numbers.
Alternatively you can here view or download the uninterpreted source code file.
That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.
1 =========================================================================
2 How to use the TGrid/TAlien/TAlienFile class V1.1 - Andreas.Peters@cern.ch
3 =========================================================================
4
5
6 TGrid-Plugin: TAlien
7 ====================
8
9 To connect to Alien you have to connect to a running API service of your
10 virtual organization.
11
12 Creating <gGrid> instance:
13 a) // connecting to an API service
14
15 TGrid::Connect("alien://pcapiserv01.cern.ch:9000","aliprod);
16
17 // connecting to an API service which is defined already by the
18 environement variables:
19 export alien_API_HOST=...
20 export alien_API_PORT=...
21 export alien_API_USER=...
22 TGrid::Connect("alien://");
23
24 // connect to an API service with an authentication token established
25 previously with gShellq.
26
27 b) TGrid::Connect("alien://",0,0,"t");
28
29 In case a) the authentication is private to the process, while case b)
30 shares the authentication(session) with the shell, which has established
31 the session previously. Notice that a) is not thread-safe, while b) is!
32
33 If you have executed TGrid::Connect(), the gGrid global variable
34 should be set != 0.
35
36 Some examples:
37
38 - change the working directory
39
40 gGrid->Cd("/alice/"); // => returns 1 for success, 0 for error
41
42 - get the working directory
43
44 printf("GRID Working is %d",gGrid->Pwd());
45
46 - list a directory
47
48 TGridResult* result = gGrid->Ls("/alice");
49 Int_t i=0;
50 while (result->GetFileName(i))
51 printf("File %s\n",result->GetFileName(i++));
52 TGridResult* result = gGrid->Ls("/alice");
53 Int_t i=0;
54 while (result->GetFileName(i))
55 printf("File %s\n",result->GetFileName(i++));
56
57 - get all file permissions - using the GetKey function
58
59 TGridResult* result = gGrid->Ls("/alice","-la");
60 while (result->GetFileName(i))\
61 printf("The permissions are %s\n",result->GetKey(i++,"permissions")
62
63 // => the defined keys for GetKey can be seen using result->Print();
64
65
66 - query files under a certain namespace tree
67
68 TGridResult* result = gGrid->Query("/alice/,"*.root");
69
70
71 You can execute any existing command via the Command interface:
72
73 TGridResult* result = gGrid->Command("ls -la /",0,2);
74
75 // '0' switches of the output of stdout and stderr to the terminal
76 // '2' selects the result stream to be returned as TGridResult* :
77 '0' returns stdout,
78 '1' returns stderr,
79 '2' returns the result structure
80
81 -> This command is equivalent to:
82
83 gGrid->Ls("/","-la");
84
85 You can print the stdout of the last command via:
86 gGrid->Stdout();
87
88 You can print the stderr of the last command via:
89 gGrid->Stderr();
90
91 To see the result structure of a command, you can just use the 'Print' function for the
92 TGridResult:
93
94 result->Print();
95
96
97
98 TFile-Plugin: TAlienFile
99 ========================
100
101 Files stored in Alien can be opened with the catalogue LFN or a GUID.
102 To open a file by LFN use:
103
104 TFile* myfile = TFile::Open("alien:///alice/cern.ch/file.root");
105
106 or
107
108 TFile* myfile = TFile::Open("/alien/alice/cern.ch/file.root");
109
110
111 To open a file by GUID use:
112
113 TFile* myfile = TFile::Open("alien://<guid>");
114
115 To address a certain storage element add to the URL
116 "?se=ALICE::CERN::Castor";
117
118 f.e. TFile::Open("/alien/alice/cern.ch/file.root?se=ALICE::CERN::Castor");
119
120
121 To open a ZIP file in an archive, use:
122
123 TFile::Open("/alien7alice/cern.ch/archivefile.zip#file.root");
124
125 - this assumes, that archivefile.zip is an UNCOMPRESSED zip archive containing
126 'file.root'.
127 - remember, that archives need to have the suffix '.zip' to be understood as
128 such.
129
130