Commit | Line | Data |
---|---|---|
805e021f CE |
1 | // |
2 | // AFSPropertyManager.h | |
3 | // AFSCommander | |
4 | // | |
5 | // Created by Claudio Bisegni on 21/05/07. | |
6 | // Copyright 2007 INFN - National Institute of Nuclear Physics. All rights reserved. | |
7 | // | |
8 | ||
9 | #import <Cocoa/Cocoa.h> | |
10 | #import "DBCellElement.h" | |
11 | #import "FileUtil.h" | |
12 | ||
13 | ||
14 | #define AFS_DAEMON_STARTUPSCRIPT "/Library/OpenAFS/Tools/root.client/usr/vice/etc/afs.rc" | |
15 | #define AFS_DAEMON_PATH "/Library/LaunchDaemons/org.openafs.filesystems.afs.plist" | |
16 | #define AFS_FS_MOUNT "AFS" | |
17 | #define AFS_LAUNCHCTL_GREP_STR "org.openafs.filesystems.afs" | |
18 | /*! | |
19 | @class AFSPropertyManager | |
20 | @abstract AFS Manage Class | |
21 | @discussion This class manage the openafs param for celldbserv, cache param, group creation, get and release token | |
22 | */ | |
23 | ||
24 | @interface AFSPropertyManager : NSObject { | |
25 | NSString *installationPath; | |
26 | NSString *cellName; | |
27 | NSMutableArray *cellList; | |
28 | NSArray *userDefaultCellArray; | |
29 | NSString *afsRootMountPoint; | |
30 | int statCacheEntry; | |
31 | int dCacheDim; | |
32 | int cacheDimension; | |
33 | int daemonNumber; | |
34 | int nVolEntry; | |
35 | bool dynRoot; | |
36 | bool afsDB; | |
37 | bool verbose; | |
38 | ||
39 | //------------------- | |
40 | FileUtil *futil; | |
41 | BOOL useAfsdConfVersion; | |
42 | } | |
43 | ||
44 | /*! | |
45 | @method | |
46 | @abstract (brief description) | |
47 | @discussion (comprehensive description) | |
48 | */ | |
49 | -(id) init; | |
50 | ||
51 | /*! | |
52 | @function initWithAfsPath | |
53 | @abstract (description) | |
54 | @discussion (description) | |
55 | @param path Path di installazione afs | |
56 | @result Istanza della classe di gestione delle propieta' afs | |
57 | */ | |
58 | - (id)initWithAfsPath:(NSString*)path; | |
59 | ||
60 | /*! | |
61 | @method | |
62 | @abstract (brief description) | |
63 | @discussion (comprehensive description) | |
64 | */ | |
65 | -(void) dealloc; | |
66 | /*! | |
67 | @method | |
68 | @abstract (brief description) | |
69 | @discussion (comprehensive description) | |
70 | */ | |
71 | -(NSMutableArray*) getCellList; | |
72 | ||
73 | ||
74 | /*! | |
75 | @method | |
76 | @abstract (brief description) | |
77 | @discussion (comprehensive description) | |
78 | */ | |
79 | -(NSArray*) getAllCellsName; | |
80 | /*! | |
81 | @method | |
82 | @abstract (brief description) | |
83 | @discussion (comprehensive description) | |
84 | */ | |
85 | -(NSArray*) getUserDefaultForTokenCells; | |
86 | /*! | |
87 | @method | |
88 | @abstract (brief description) | |
89 | @discussion (comprehensive description) | |
90 | */ | |
91 | -(NSArray*) getDefaultForTokenCellsName; | |
92 | /*! | |
93 | @method | |
94 | @abstract (brief description) | |
95 | @discussion (comprehensive description) | |
96 | */ | |
97 | -(NSString*) getDefaultCellName; | |
98 | ||
99 | /*! | |
100 | @method setDefaultCellByName | |
101 | @abstract set the cell named "name" to be se user default | |
102 | @discussion first clean the last one selected as default and then set the cell named "name" as default user cell | |
103 | */ | |
104 | -(void) setDefaultCellByName:(NSString*)name; | |
105 | ||
106 | /*! | |
107 | @method | |
108 | @abstract (brief description) | |
109 | @discussion (comprehensive description) | |
110 | */- (void) setCellName:(NSString*)cell; | |
111 | ||
112 | /*! | |
113 | @method setPath | |
114 | @abstract Imposta Path | |
115 | @discussion Imposta il path dove e' installato afs, in modo da leggere e scrivere le configurazioni | |
116 | */ | |
117 | -(void) setPath:(NSString*)path; | |
118 | ||
119 | /*! | |
120 | @method path | |
121 | @abstract Return the afs base | |
122 | @discussion Return the Afs base installation path | |
123 | */ | |
124 | -(NSString*) path; | |
125 | ||
126 | /*! | |
127 | @function statCacheEntry | |
128 | @abstract get the afs number of state cache entry | |
129 | @discussion | |
130 | @result Number of stat cache entry | |
131 | */ | |
132 | -(int) statCacheEntry; | |
133 | ||
134 | ||
135 | /*! | |
136 | @function setStatCacheEntry | |
137 | @abstract Set the afs number of state cache entry | |
138 | @discussion | |
139 | @result Number of stat cache entry | |
140 | */ | |
141 | -(void) setStatCacheEntry:(int)statEntry; | |
142 | ||
143 | /*! | |
144 | @function dCacheDim | |
145 | @abstract return the dCacheDim param value for cache manager | |
146 | @result dCacheDim value | |
147 | */ | |
148 | -(int) dCacheDim; | |
149 | ||
150 | /*! | |
151 | @function setDCacheDim | |
152 | @abstract set the setDCacheDim value for cache manager param | |
153 | @discussion <#(description)#> | |
154 | @param dcacheDim cache param value | |
155 | */ | |
156 | -(void) setDCacheDim:(int)dcacheDim; | |
157 | ||
158 | /*! | |
159 | @function cacheDimension | |
160 | @abstract return the max size of the cache | |
161 | @result Cache dimension | |
162 | */ | |
163 | -(int) cacheDimension; | |
164 | ||
165 | /*! | |
166 | @function setCacheDimension | |
167 | @abstract Set the max cache dimension | |
168 | @discussion | |
169 | @param cacheDim MAx Chace dimension | |
170 | */ | |
171 | -(void) setCacheDimension:(int)cacheDim; | |
172 | ||
173 | /*! | |
174 | @function daemonNumber | |
175 | @abstract Return the number of daemon for the cache manager | |
176 | @result Number of daemon | |
177 | */ | |
178 | -(int) daemonNumber; | |
179 | ||
180 | /*! | |
181 | @function setDaemonNumber | |
182 | @abstract Set the daemon numbero for the cache manager | |
183 | @param dNumber number of daemon | |
184 | */ | |
185 | -(void) setDaemonNumber:(int)dNumber; | |
186 | ||
187 | /*! | |
188 | @function afsRootMountPoint | |
189 | @abstract Return the path where afs root volume will be mounted | |
190 | @result AFS mount point | |
191 | */ | |
192 | -(NSString*) afsRootMountPoint; | |
193 | ||
194 | /*! | |
195 | @function setAfsRootMountPoint | |
196 | @abstract Set the AFS mount point | |
197 | @param mountPoint AFS mount point | |
198 | */ | |
199 | -(void) setAfsRootMountPoint:(NSString*)mountPoint; | |
200 | ||
201 | /*! | |
202 | @function nVolEntry | |
203 | @abstract Return the nVolEntry for cache manager | |
204 | @result value for nVolEntry cache parameter | |
205 | */ | |
206 | -(int) nVolEntry; | |
207 | ||
208 | /*! | |
209 | @function setNVolEntry | |
210 | @abstract Set the nVolEntry parameter for cache manager | |
211 | @param entry value for nVolEntry cache manager parameter | |
212 | */ | |
213 | -(void) setNVolEntry:(int)entry; | |
214 | ||
215 | /*! | |
216 | @function dynRoot | |
217 | @abstract Return the DynRoot parametr for cache manager | |
218 | @result dynRoot parameter value | |
219 | */ | |
220 | -(bool) dynRoot; | |
221 | ||
222 | /*! | |
223 | @function setDynRoot | |
224 | @abstract Set the DynRoot flag value for cache manager | |
225 | @param flag dynRoot state (enable/disable) | |
226 | */ | |
227 | -(void) setDynRoot:(bool)flag; | |
228 | /*! | |
229 | @function afsDB | |
230 | @abstract Get the afsdb flag value for cache manager | |
231 | @result Return the value of the flag | |
232 | */ | |
233 | -(bool) afsDB; | |
234 | ||
235 | /*! | |
236 | @function setAfsDB | |
237 | @abstract Set the flag value for afsdb cache manager | |
238 | @param flag AfsDB state (enable/disable) | |
239 | */ | |
240 | -(void) setAfsDB:(bool)flag; | |
241 | /*! | |
242 | @function verbose | |
243 | */ | |
244 | -(bool) verbose; | |
245 | ||
246 | /*! | |
247 | @function setVerbose | |
248 | */ | |
249 | -(void) setVerbose:(bool)flag; | |
250 | /*! | |
251 | @function readCacheInfo | |
252 | @abstract Read the cache info | |
253 | @discussion The cache info is read from the file pointed by filePath param | |
254 | @param filePath file location for the CacheInfo | |
255 | */ | |
256 | -(int) readCacheInfo:(NSString*)filePath; | |
257 | ||
258 | /*! | |
259 | @function writeCacheInfo | |
260 | @abstract Write the cache info down the file | |
261 | @param filePath where to write the CacheInfo | |
262 | @result return the execution error | |
263 | */ | |
264 | -(int) writeCacheInfo:(NSString*)filePath; | |
265 | ||
266 | /*! | |
267 | @function readAfsdOption | |
268 | @abstract Read the afs option | |
269 | @discussion Read the afs option checking firt the afs version so it can read the old afsd.option or afs.conf file. If any error accour an NSException wil be trown | |
270 | @param filePath file where the parameter are store for default afsd.option or afs.conf | |
271 | */ | |
272 | -(void) readAfsdOption:(NSString*)filePath; | |
273 | ||
274 | /*! | |
275 | @function readOldAfsdOption | |
276 | @abstract Read the afsd.option file | |
277 | @discussion Read the old afsd.option style afsd option file. If any error accour an NSException wil be trown22 | |
278 | @param filePath file path to afsd.option like file | |
279 | @result <#(description)#> | |
280 | */ | |
281 | -(int) readOldAfsdOption:(NSString*)filePath; | |
282 | /*! | |
283 | @function readAFSDParamLineContent | |
284 | @abstract Try to decode one line of afsd.option or afs.conf | |
285 | @param paramLine one line of file afsd.option(the only one that is present) os afs.conf | |
286 | */ | |
287 | -(int) readAFSDParamLineContent:(NSString*)paramLine; | |
288 | /*! | |
289 | @function readNewAfsdOption | |
290 | @abstract Read the new afs.conf file format | |
291 | @discussion Scann every line f the afs.conf file ad for each one call the readAFSDParamLineContent with it's content | |
292 | @param filePath path of the new file with afs.conf file format | |
293 | */ | |
294 | -(int) readNewAfsdOption:(NSString*)filePath; | |
295 | /*! | |
296 | @function writeAfsdOption | |
297 | @abstract <#(description)#> | |
298 | @discussion <#(description)#> | |
299 | @param <#(name) (description)#> | |
300 | @result <#(description)#> | |
301 | */ | |
302 | -(int) writeAfsdOption:(NSString*)filePath; | |
303 | /*! | |
304 | @function writeOldAfsdOption | |
305 | @abstract Write the cache manager parameter to file | |
306 | @discussion First chech the version of afs installed then choice to save old o new file version(afsd.option or afs.conf) | |
307 | @param filePath file path for file to write into | |
308 | @result <#(description)#> | |
309 | */ | |
310 | -(int) writeOldAfsdOption:(NSString*)filePath; | |
311 | /*! | |
312 | @function writeNewAfsdOption | |
313 | @abstract Write the cache parameter to a file with the new format | |
314 | @param filePath file path where write into | |
315 | */ | |
316 | -(int) writeNewAfsdOption:(NSString*)filePath; | |
317 | /*! | |
318 | @function getAfsVersion | |
319 | @abstract Return the string representing the afs version | |
320 | @result The Enteir string returned from the call of fs -version | |
321 | */ | |
322 | -(NSString*) getAfsVersion; | |
323 | /*! | |
324 | @function getAfsMajorVersionVersion | |
325 | @abstract Return the major version of afs Major.x.x | |
326 | @result | |
327 | */ | |
328 | -(int) getAfsMajorVersionVersion; | |
329 | /*! | |
330 | @function getAfsMinorVersionVersion | |
331 | @abstract Return the major version of afs x.Minor.x | |
332 | @result | |
333 | */ | |
334 | -(int) getAfsMinorVersionVersion; | |
335 | ||
336 | /*! | |
337 | @function getAfsPatchVersionVersion | |
338 | @abstract Return the major version of afs x.x.Patch | |
339 | @result | |
340 | */ | |
341 | -(int) getAfsPatchVersionVersion; | |
342 | ||
343 | /*! | |
344 | @method clearConfiguration | |
345 | @abstract Clear all structure or array that contain value for afs client setting(cells cache param etch) | |
346 | @discussion | |
347 | */ | |
348 | -(void) clearConfiguration; | |
349 | ||
350 | /*! | |
351 | @function exceptionOnInvalidPath | |
352 | @abstract Check the validity of afs path | |
353 | @discussion If the installationPath variable don't point to a valid path, will be fired an NSException | |
354 | */ | |
355 | -(void) exceptionOnInvalidPath; | |
356 | ||
357 | /*! | |
358 | @method loadConfiguration | |
359 | @abstract load the all afs configuration (ThisCell & CellServDB & cache parameter) | |
360 | */ | |
361 | -(void) loadConfiguration; | |
362 | ||
363 | /*! | |
364 | @method readCellInfo | |
365 | @abstract Read the Main Cell Name | |
366 | */ | |
367 | -(void) readCellInfo:(NSString*) configFile; | |
368 | /*! | |
369 | @method readCellDB | |
370 | @abstract Read the CellServDB File | |
371 | @discussion Read the file of all cellservbd ad make the NSArray containing a DBCellElement for aech cell found | |
372 | */ | |
373 | -(void) readCellDB:(NSString*) configFile; | |
374 | /*! | |
375 | @function readTheseCell | |
376 | @abstract Read the "These Cell" | |
377 | @discussion Read the "These Cell" file that contains all the cell from which the user want to get the token | |
378 | @param configFile TheseCell file path | |
379 | @result NSAray with the cells name | |
380 | */ | |
381 | -(NSArray*) readTheseCell:(NSString*) configFile; | |
382 | /*! | |
383 | @method shutdown | |
384 | @abstract Stop The AFS | |
385 | */ | |
386 | -(void) shutdown; | |
387 | -(void) startup; | |
388 | -(void) scanIpForCell:(DBCellElement*) cellElement allIP:(NSString*)allIP; | |
389 | -(void) backupConfigurationFiles; | |
390 | -(void) backupFile:(NSString*)localAfsFilePath; | |
391 | -(void) saveConfigurationFiles:(BOOL) makeBackup; | |
392 | -(void) saveCacheConfigurationFiles:(BOOL) makeBackup; | |
393 | -(void) installConfigurationFile:(NSString*)srcConfFile destPath:(NSString*) destPath; | |
394 | -(NSArray*) getTokenList; | |
395 | -(BOOL) checkAfsStatus; | |
396 | -(BOOL) checkAfsStatusForStartup; | |
397 | -(void) klog:(NSString*)uName uPwd:(NSString*)uPwd cell:(NSString*)theCell; | |
398 | -(void) aklog:(NSString*)theCell noKerberosCall:(BOOL)krb5CallEnable; | |
399 | -(void) getTokens:(BOOL)klogAklogFlag usr:(NSString*)usr pwd:(NSString*)pwd; | |
400 | -(void) unlog:(NSString*)cell; | |
401 | -(NSString*) makeChaceParamString; | |
402 | -(BOOL) useAfsdConfConfigFile; | |
403 | @end |