]> err.no Git - sope/blob - sope-appserver/SoOFS/OFSFolder.h
added strict OSX bundle dependencies
[sope] / sope-appserver / SoOFS / OFSFolder.h
1 /*
2   Copyright (C) 2002-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 __OFS_OFSFolder_H__
23 #define __OFS_OFSFolder_H__
24
25 #include <SoOFS/OFSBaseObject.h>
26
27 /*
28   OFSFolder
29   
30   OFSFolder's map to filesystem directories and are "collections" of other
31   OFS objects. OFSFolder's can also store custom properties in a special file
32   (.props.plist).
33   
34   How collections are loaded
35   ==========================
36   When an OFSFolder is loaded, it doesn't instantiate any of it child objects
37   (since this would result in a cascade sucking in all the filesystem below.
38   As long as OFSFolder isn't sent -allObjects, it isn't fully loaded, instead
39   the objects are stored in the children hash and loaded on demand when the key
40   is looked up.
41   
42   How child objects are instantiated
43   ==================================
44   An OFSFolder also acts as a factory for it's children since it needs to
45   unarchive them into memory. That is, it's the task of the folder to select
46   an appropriate class for the in-memory representation of a childresource.
47   
48   Security
49   ========
50   The folder can manage the owner of the children and manages it's own
51   owner. The own owner is stored in the SoOwner field of the propertylist
52   and the children in the SoChildOwners field (which has to be a dictionary).
53 */
54
55 @class NSArray, NSDictionary, NSMutableDictionary, NSString, NSEnumerator;
56 @class WOResourceManager;
57 @class SoClass;
58 @class OFSFactoryContext, OFSFactoryRegistry;
59
60 @interface OFSFolder : OFSBaseObject
61 {
62 @private
63   NSArray             *childNames;
64   NSMutableDictionary *children;
65   NSDictionary        *props;
66   struct {
67     BOOL didLoadAll:1;
68     BOOL hasCVS:1;
69     BOOL hasSvn:1;
70     BOOL checkedVersionSpecials:1;
71     int  reserved:28;
72   } flags;
73   WOResourceManager *resourceManager;
74 }
75
76 /* mimic a dictionary */
77
78 - (NSArray *)allKeys;
79 - (NSArray *)allValues;
80 - (BOOL)hasKey:(NSString *)_key;
81 - (id)objectForKey:(NSString *)_key;
82 - (NSEnumerator *)keyEnumerator;
83 - (NSEnumerator *)objectEnumerator;
84
85 - (BOOL)isValidKey:(NSString *)_key;
86
87 /* storage */
88
89 - (void)willChange;
90
91 - (NSString *)storagePathForChildKey:(NSString *)_name;
92
93 - (id)restorationFactoryForContext:(OFSFactoryContext *)_ctx;
94 - (id)creationFactoryForContext:(OFSFactoryContext *)_ctx;
95
96 - (NSException *)reload;
97
98 /* actions */
99
100 - (NSString *)defaultMethodNameInContext:(id)_ctx;
101
102 - (id)GETAction:(id)_ctx;
103 - (id)PUTAction:(id)_ctx;
104 - (id)MKCOLAction:(id)_ctx;
105 - (id)DELETEAction:(id)_ctx;
106
107 /* security */
108
109 - (NSString *)ownerInContext:(id)_ctx;
110 - (NSString *)ownerOfChild:(id)_child inContext:(id)_ctx;
111
112 /* WO integration */
113
114 - (WOResourceManager *)resourceManagerInContext:(id)_ctx;
115
116 /* factory lookup */
117
118 - (OFSFactoryRegistry *)factoryRegistry;
119 - (id)restorationFactoryForContext:(OFSFactoryContext *)_ctx;
120 - (id)creationFactoryForContext:(OFSFactoryContext *)_ctx;
121
122 @end
123
124 #endif /* __OFS_OFSFolder_H__ */