1 /*
2   Copyright (C) 2004-2005 SKYRIX Software AG
3 
4   This file is part of OpenGroupware.org.
5 
6   OGo 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   OGo 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 OGo; 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 __GDLContentStore_GCSFolderManager_H__
23 #define __GDLContentStore_GCSFolderManager_H__
24 
25 
26 /*
27   GCSFolderManager
28 
29   Objects of this class manage the "folder_info" table, they manage the
30   model and manage the tables required for a folder.
31 */
32 
33 @class NSString, NSArray, NSURL, NSDictionary, NSException;
34 @class GCSChannelManager, GCSAlarmsFolder, GCSFolder, GCSFolderType, GCSSessionsFolder;
35 
36 @interface GCSFolderManager : NSObject
37 {
38   GCSChannelManager *channelManager;
39   NSDictionary      *nameToType;
40   NSURL             *folderInfoLocation;
41   NSURL             *storeLocation;
42   NSURL             *aclLocation;
43   NSURL             *cacheFolderLocation;
44 }
45 
46 + (BOOL) singleStoreMode;
47 + (id)defaultFolderManager;
48 - (id)initWithFolderInfoLocation: (NSURL *)_infoUrl
49                 andStoreLocation: (NSURL *)_storeUrl
50                   andAclLocation: (NSURL *)_aclUrl
51 	  andCacheFolderLocation: (NSURL *)_cacheFolderUrl;
52 
53 /* accessors */
54 
55 - (NSURL *)folderInfoLocation;
56 - (NSString *)folderInfoTableName;
57 - (NSURL *)storeLocation;
58 - (NSString *)storeTableName;
59 - (NSURL *)aclLocation;
60 - (NSString *)aclTableName;
61 - (NSURL *)cacheFolderLocation;
62 - (NSString *)cacheFolderTableName;
63 
64 /* connection */
65 
66 - (GCSChannelManager *)channelManager;
67 - (BOOL)canConnect;
68 
69 /* handling folder names */
70 
71 - (NSString *)internalNameFromPath:(NSString *)_path;
72 - (NSArray *)internalNamesFromPath:(NSString *)_path;
73 - (NSString *)pathFromInternalName:(NSString *)_name;
74 
75 /* operations */
76 
77 - (BOOL)folderExistsAtPath:(NSString *)_path;
78 - (NSArray *)listSubFoldersAtPath:(NSString *)_path recursive:(BOOL)_flag;
79 
80 - (NSDictionary *) recordAtPath: (NSString *) _path;
81 - (GCSFolder *)folderAtPath:(NSString *)_path;
82 
83 - (NSException *)createFolderOfType:(NSString *)_type withName:(NSString *)_name atPath:(NSString *)_path;
84 - (NSException *)deleteFolderAtPath:(NSString *)_path;
85 
86 /* alarms */
87 - (GCSAlarmsFolder *)alarmsFolder;
88 
89 /* sessions */
90 - (GCSSessionsFolder *)sessionsFolder;
91 
92 /* folder types */
93 
94 - (GCSFolderType *)folderTypeWithName:(NSString *)_name;
95 
96 /* cache management */
97 
98 - (void)reset;
99 
100 @end
101 
102 #endif /* __GDLContentStore_GCSFolderManager_H__ */
103