1 /*
2   Copyright (C) 2000-2005 SKYRIX Software AG
3 
4   This file is part of SOPE.
5 
6   SOPE is free software; you can redistribute it and/or modify it under
7   the terms of the GNU Lesser General Public License as published by the
8   Free Software Foundation; either version 2, or (at your option) any
9   later version.
10 
11   SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
12   WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15 
16   You should have received a copy of the GNU Lesser General Public
17   License along with SOPE; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21 
22 #ifndef __NGCustomFileManager_H__
23 #define __NGCustomFileManager_H__
24 
25 #include <NGExtensions/NGFileManager.h>
26 
27 /*
28   An abstract baseclass for developing custom filemanagers which are ideally
29   based on other filemanager classes.
30 */
31 
32 @class NGCustomFileManagerInfo;
33 
34 @interface NGCustomFileManager : NGFileManager
35 {
36 }
37 
38 /* customization */
39 
40 - (NSString *)makeAbsolutePath:(NSString *)_path;
41 - (NGCustomFileManagerInfo *)fileManagerInfoForPath:(NSString *)_path;
42 
43 @end
44 
45 @interface NGCustomFileManager(NGFileManagerVersioning)
46 
47 /* versioning */
48 
49 - (BOOL)checkoutFileAtPath:(NSString *)_path handler:(id)_handler;
50 - (BOOL)releaseFileAtPath:(NSString *)_path  handler:(id)_handler;
51 - (BOOL)rejectFileAtPath:(NSString *)_path   handler:(id)_handler;
52 - (BOOL)checkoutFileAtPath:(NSString *)_path version:(NSString *)_version
53   handler:(id)_handler;
54 
55 /* versioning data */
56 
57 - (NSString *)lastVersionAtPath:(NSString *)_path;
58 - (NSArray *)versionsAtPath:(NSString *)_path;
59 - (NSData *)contentsAtPath:(NSString *)_path version:(NSString *)_version;
60 - (NSDictionary *)fileAttributesAtPath:(NSString *)_path
61   traverseLink:(BOOL)_followLink
62   version:(NSString *)_version;
63 
64 @end
65 
66 @interface NGCustomFileManager(NGFileManagerDataSources)
67 
68 /* datasources (work on folders) */
69 
70 - (EODataSource *)dataSourceAtPath:(NSString *)_path;
71 - (EODataSource *)dataSource; // works on current-directory-path
72 
73 @end
74 
75 @interface NGCustomFileManager(NGFileManagerLocking)
76 
77 - (BOOL)lockFileAtPath:(NSString *)_path handler:(id)_handler;
78 - (BOOL)unlockFileAtPath:(NSString *)_path handler:(id)_handler;
79 - (BOOL)isFileLockedAtPath:(NSString *)_path;
80 
81 /* access rights */
82 - (BOOL)isLockableFileAtPath:(NSString *)_path;
83 - (BOOL)isUnlockableFileAtPath:(NSString *)_path;
84 
85 @end
86 
87 @interface NGCustomFileManagerInfo : NSObject
88 {
89 @private
90   NGCustomFileManager        *master;      /* non retained */
91   id<NGFileManager,NSObject> fileManager;
92 }
93 
94 - (id)initWithCustomFileManager:(NGCustomFileManager *)_master
95   fileManager:(id<NGFileManager,NSObject>)_fm;
96 
97 - (void)resetMaster;
98 
99 /* accessors */
100 
101 - (NGCustomFileManager *)master;
102 - (id<NGFileManager,NSObject>)fileManager;
103 
104 /* operations */
105 
106 - (NSString *)rewriteAbsolutePath:(NSString *)_path;
107 
108 /* capabilities */
109 
110 - (BOOL)supportsGlobalIDs;
111 
112 @end
113 
114 #endif /* __NGCustomFileManager_H__ */
115