2 // AFSPropertyManager.h
5 // Created by Claudio Bisegni on 21/05/07.
6 // Copyright 2007 INFN - National Institute of Nuclear Physics. All rights reserved.
9 #import <Cocoa/Cocoa.h>
10 #import "DBCellElement.h"
14 @class AFSPropertyManager
15 @abstract AFS Manage Class
16 @discussion This class manage the openafs param for celldbserv, cache param, group creation, get and release token
19 @interface AFSPropertyManager : NSObject {
20 NSString *installationPath;
22 NSMutableArray *cellList;
23 NSArray *userDefaultCellArray;
24 NSString *afsRootMountPoint;
36 BOOL useAfsdConfVersion;
41 @abstract (brief description)
42 @discussion (comprehensive description)
47 @function initWithAfsPath
48 @abstract (description)
49 @discussion (description)
50 @param path Path di installazione afs
51 @result Istanza della classe di gestione delle propieta' afs
53 - (id)initWithAfsPath:(NSString*)path;
57 @abstract (brief description)
58 @discussion (comprehensive description)
63 @abstract (brief description)
64 @discussion (comprehensive description)
66 -(NSMutableArray*) getCellList;
71 @abstract (brief description)
72 @discussion (comprehensive description)
74 -(NSArray*) getAllCellsName;
77 @abstract (brief description)
78 @discussion (comprehensive description)
80 -(NSArray*) getUserDefaultForTokenCells;
83 @abstract (brief description)
84 @discussion (comprehensive description)
86 -(NSArray*) getDefaultForTokenCellsName;
89 @abstract (brief description)
90 @discussion (comprehensive description)
92 -(NSString*) getDefaultCellName;
95 @method setDefaultCellByName
96 @abstract set the cell named "name" to be se user default
97 @discussion first clean the last one selected as default and then set the cell named "name" as default user cell
99 -(void) setDefaultCellByName:(NSString*)name;
103 @abstract (brief description)
104 @discussion (comprehensive description)
105 */- (void) setCellName:(NSString*)cell;
109 @abstract Imposta Path
110 @discussion Imposta il path dove e' installato afs, in modo da leggere e scrivere le configurazioni
112 -(void) setPath:(NSString*)path;
116 @abstract Return the afs base
117 @discussion Return the Afs base installation path
122 @function statCacheEntry
123 @abstract get the afs number of state cache entry
125 @result Number of stat cache entry
127 -(int) statCacheEntry;
131 @function setStatCacheEntry
132 @abstract Set the afs number of state cache entry
134 @result Number of stat cache entry
136 -(void) setStatCacheEntry:(int)statEntry;
140 @abstract return the dCacheDim param value for cache manager
141 @result dCacheDim value
146 @function setDCacheDim
147 @abstract set the setDCacheDim value for cache manager param
148 @discussion <#(description)#>
149 @param dcacheDim cache param value
151 -(void) setDCacheDim:(int)dcacheDim;
154 @function cacheDimension
155 @abstract return the max size of the cache
156 @result Cache dimension
158 -(int) cacheDimension;
161 @function setCacheDimension
162 @abstract Set the max cache dimension
164 @param cacheDim MAx Chace dimension
166 -(void) setCacheDimension:(int)cacheDim;
169 @function daemonNumber
170 @abstract Return the number of daemon for the cache manager
171 @result Number of daemon
176 @function setDaemonNumber
177 @abstract Set the daemon numbero for the cache manager
178 @param dNumber number of daemon
180 -(void) setDaemonNumber:(int)dNumber;
183 @function afsRootMountPoint
184 @abstract Return the path where afs root volume will be mounted
185 @result AFS mount point
187 -(NSString*) afsRootMountPoint;
190 @function setAfsRootMountPoint
191 @abstract Set the AFS mount point
192 @param mountPoint AFS mount point
194 -(void) setAfsRootMountPoint:(NSString*)mountPoint;
198 @abstract Return the nVolEntry for cache manager
199 @result value for nVolEntry cache parameter
204 @function setNVolEntry
205 @abstract Set the nVolEntry parameter for cache manager
206 @param entry value for nVolEntry cache manager parameter
208 -(void) setNVolEntry:(int)entry;
212 @abstract Return the DynRoot parametr for cache manager
213 @result dynRoot parameter value
219 @abstract Set the DynRoot flag value for cache manager
220 @param flag dynRoot state (enable/disable)
222 -(void) setDynRoot:(bool)flag;
225 @abstract Get the afsdb flag value for cache manager
226 @result Return the value of the flag
232 @abstract Set the flag value for afsdb cache manager
233 @param flag AfsDB state (enable/disable)
235 -(void) setAfsDB:(bool)flag;
244 -(void) setVerbose:(bool)flag;
246 @function readCacheInfo
247 @abstract Read the cache info
248 @discussion The cache info is read from the file pointed by filePath param
249 @param filePath file location for the CacheInfo
251 -(void) readCacheInfo:(NSString*)filePath;
254 @function writeCacheInfo
255 @abstract Write the cache info down the file
256 @param filePath where to write the CacheInfo
257 @result return the execution error
259 -(int) writeCacheInfo:(NSString*)filePath;
262 @function readAfsdOption
263 @abstract Read the afs option
264 @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
265 @param filePath file where the parameter are store for default afsd.option or afs.conf
267 -(void) readAfsdOption:(NSString*)filePath;
270 @function readOldAfsdOption
271 @abstract Read the afsd.option file
272 @discussion Read the old afsd.option style afsd option file. If any error accour an NSException wil be trown22
273 @param filePath file path to afsd.option like file
274 @result <#(description)#>
276 -(void) readOldAfsdOption:(NSString*)filePath;
278 @function readAFSDParamLineContent
279 @abstract Try to decode one line of afsd.option or afs.conf
280 @param paramLine one line of file afsd.option(the only one that is present) os afs.conf
282 -(void) readAFSDParamLineContent:(NSString*)paramLine;
284 @function readNewAfsdOption
285 @abstract Read the new afs.conf file format
286 @discussion Scann every line f the afs.conf file ad for each one call the readAFSDParamLineContent with it's content
287 @param filePath path of the new file with afs.conf file format
289 -(void) readNewAfsdOption:(NSString*)filePath;
291 @function writeAfsdOption
292 @abstract <#(description)#>
293 @discussion <#(description)#>
294 @param <#(name) (description)#>
295 @result <#(description)#>
297 -(int) writeAfsdOption:(NSString*)filePath;
299 @function writeOldAfsdOption
300 @abstract Write the cache manager parameter to file
301 @discussion First chech the version of afs installed then choice to save old o new file version(afsd.option or afs.conf)
302 @param filePath file path for file to write into
303 @result <#(description)#>
305 -(int) writeOldAfsdOption:(NSString*)filePath;
307 @function writeNewAfsdOption
308 @abstract Write the cache parameter to a file with the new format
309 @param filePath file path where write into
311 -(int) writeNewAfsdOption:(NSString*)filePath;
313 @function getAfsVersion
314 @abstract Return the string representing the afs version
315 @result The Enteir string returned from the call of fs -version
317 -(NSString*) getAfsVersion;
319 @function getAfsMajorVersionVersion
320 @abstract Return the major version of afs Major.x.x
323 -(int) getAfsMajorVersionVersion;
325 @function getAfsMinorVersionVersion
326 @abstract Return the major version of afs x.Minor.x
329 -(int) getAfsMinorVersionVersion;
332 @function getAfsPatchVersionVersion
333 @abstract Return the major version of afs x.x.Patch
336 -(int) getAfsPatchVersionVersion;
339 @method clearConfiguration
340 @abstract Clear all structure or array that contain value for afs client setting(cells cache param etch)
343 -(void) clearConfiguration;
346 @function exceptionOnInvalidPath
347 @abstract Check the validity of afs path
348 @discussion If the installationPath variable don't point to a valid path, will be fired an NSException
350 -(void) exceptionOnInvalidPath;
353 @method loadConfiguration
354 @abstract load the all afs configuration (ThisCell & CellServDB & cache parameter)
356 -(void) loadConfiguration;
360 @abstract Read the Main Cell Name
362 -(void) readCellInfo:(NSString*) configFile;
365 @abstract Read the CellServDB File
366 @discussion Read the file of all cellservbd ad make the NSArray containing a DBCellElement for aech cell found
368 -(void) readCellDB:(NSString*) configFile;
370 @function readTheseCell
371 @abstract Read the "These Cell"
372 @discussion Read the "These Cell" file that contains all the cell from which the user want to get the token
373 @param configFile TheseCell file path
374 @result NSAray with the cells name
376 -(NSArray*) readTheseCell:(NSString*) configFile;
379 @abstract Stop The AFS
383 -(void) scanIpForCell:(DBCellElement*) cellElement allIP:(NSString*)allIP;
384 -(void) backupConfigurationFiles;
385 -(void) backupFile:(NSString*)localAfsFilePath;
386 -(void) saveConfigurationFiles:(BOOL) makeBackup;
387 -(void) saveCacheConfigurationFiles:(BOOL) makeBackup;
388 -(void) installConfigurationFile:(NSString*)srcConfFile destPath:(NSString*) destPath;
389 -(NSArray*) getTokenList;
390 -(BOOL) checkAfsStatus;
391 -(void) klog:(NSString*)uName uPwd:(NSString*)uPwd cell:(NSString*)theCell;
392 -(void) aklog:(NSString*)theCell noKerberosCall:(BOOL)krb5CallEnable;
393 -(void) getTokens:(BOOL)klogAklogFlag usr:(NSString*)usr pwd:(NSString*)pwd;
394 -(void) unlog:(NSString*)cell;
395 -(NSString*) makeChaceParamString;
396 -(BOOL) useAfsdConfConfigFile;