]> err.no Git - sope/blob - sope-appserver/NGObjWeb/WebDAV/SoObject+SoDAV.h
improved WebDAV property handling
[sope] / sope-appserver / NGObjWeb / WebDAV / SoObject+SoDAV.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 __WebDAV_SoObject_SoDAV_H__
23 #define __WebDAV_SoObject_SoDAV_H__
24
25 #import <Foundation/NSObject.h>
26
27 /*
28   SoObject DAV Protocol
29   
30   This informal protocol contains methods that can be implemented by
31   SoObject's supporting WebDAV authoring. For most methods a default
32   implementation is provided.
33 */
34
35 @class NSString, NSDate, NSEnumerator, NSException, NSDictionary, NSArray;
36 @class EOFetchSpecification, EOGlobalID, EODataSource;
37 @class SoDAVLockManager;
38
39 @interface NSObject(SoObjectSoDAV)
40
41 /*
42   This method is invoked on SoObjects if a WebDAV PROPFIND or SEARCH
43   request was issued.
44 */
45 - (id)performWebDAVQuery:(EOFetchSpecification *)_fs inContext:(id)_ctx;
46 - (id)performWebDAVBulkQuery:(EOFetchSpecification *)_fs inContext:(id)_ctx;
47 - (NSEnumerator *)davChildKeysInContext:(id)_ctx;
48 - (EODataSource *)contentDataSourceInContext:(id)_ctx;
49 - (NSArray *)davQueryOnSelf:(EOFetchSpecification *)_fs inContext:(id)_ctx;
50
51 - (NSArray *)defaultWebDAVPropertyNamesInContext:(id)_ctx;
52 - (NSArray *)davComplianceClassesInContext:(id)_ctx;
53 - (NSArray *)davAllowedMethodsInContext:(id)_ctx;
54
55 /*
56   Editing the object properties (PROPPATCH)
57 */
58 - (NSException *)davSetProperties:(NSDictionary *)_setProps
59   removePropertiesNamed:(NSArray *)_delProps
60   inContext:(id)_ctx;
61 - (id)davCreateObject:(NSString *)_name
62   properties:(NSDictionary *)_props
63   inContext:(id)_ctx;
64 - (NSException *)davCreateCollection:(NSString *)_name inContext:(id)_ctx;
65
66 - (NSException *)davMoveToTargetObject:(id)_target newName:(NSString *)_name
67   inContext:(id)_ctx;
68 - (NSException *)davCopyToTargetObject:(id)_target newName:(NSString *)_name
69   inContext:(id)_ctx;
70
71 /*
72   Use the attribute map to map WebDAV propery names to KVC keys for the
73   object. If the object returns a map, the SoObjectWebDAVDispatcher will
74   properly justify the EOFetchSpecification for queries.
75 */
76 - (id)davAttributeMapInContext:(id)_ctx;
77 + (id)defaultWebDAVAttributeMap;
78
79 /*
80   WebDAV supports locking/unlocking of resources, you can override the
81   default locking mechanism used by implementing this method.
82 */
83 - (SoDAVLockManager *)davLockManagerInContext:(id)_ctx;
84
85
86 /* some DAV properties are mapped to some keys by default */
87
88 - (BOOL)davIsCollection;  // tries -isCollection and NSFileType, otherwise NO
89 - (BOOL)davIsFolder;      // same as -davIsCollection
90 - (BOOL)davHasSubFolders; // same as -davIsFolder
91 - (BOOL)davIsHidden;      // returns NO
92 - (BOOL)davIsExecutable;  // returns NO
93
94 - (id)davUid;             // tries -globalID, otherwise same as -davURL
95 - (id)davEntityTag;
96 - (id)davURL;             // tries -baseURLInContext:, -baseURL otherwise nil
97 - (id)davContentLength;   // tries NSFileSize, -contentLength, otherwise 0
98 - (NSString *)davContentType;
99
100 - (NSDate *)davLastModified; // tries NSFileModificationDate, otherwise now
101 // tries NSFileCreationDate, NSFileModificationDate, otherwise nil
102 - (NSDate *)davCreationDate;
103
104 // tries -displayName, NSFileSubject,NSFileName,NSFilePath, -path otherwise nil
105 - (NSString *)davDisplayName;
106 - (NSString *)davResourceType; // uses -davIsCollection
107
108 // uses -davIsCollection (urn:content-class:folder or urn:content-class:item)
109 - (NSString *)davContentClass;
110
111
112 - (BOOL)davDenySubFolders;
113 - (unsigned int)davChildCount;
114 - (unsigned int)davObjectCount;
115 - (unsigned int)davVisibleCount;
116
117 @end
118
119 #endif /* __WebDAV_SoObject_SoDAV_H__ */