]> err.no Git - sope/blob - sope-appserver/NGObjWeb/WebDAV/SoObject+SoDAV.h
major improvements in resource/template lookup with SoProduct's
[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 - (id)davQueryOnSelf:(EOFetchSpecification *)_fs inContext:(id)_ctx;
50
51 - (NSArray *)defaultWebDAVPropertyNamesInContext:(id)_ctx;
52
53 /*
54   Editing the object properties (PROPPATCH)
55 */
56 - (NSException *)davSetProperties:(NSDictionary *)_setProps
57   removePropertiesNamed:(NSArray *)_delProps
58   inContext:(id)_ctx;
59 - (id)davCreateObject:(NSString *)_name
60   properties:(NSDictionary *)_props
61   inContext:(id)_ctx;
62 - (NSException *)davCreateCollection:(NSString *)_name inContext:(id)_ctx;
63
64 - (NSException *)davMoveToTargetObject:(id)_target newName:(NSString *)_name
65   inContext:(id)_ctx;
66 - (NSException *)davCopyToTargetObject:(id)_target newName:(NSString *)_name
67   inContext:(id)_ctx;
68
69 /*
70   Use the attribute map to map WebDAV propery names to KVC keys for the
71   object. If the object returns a map, the SoObjectWebDAVDispatcher will
72   properly justify the EOFetchSpecification for queries.
73 */
74 - (id)davAttributeMapInContext:(id)_ctx;
75 + (id)defaultWebDAVAttributeMap;
76
77 /*
78   WebDAV supports locking/unlocking of resources, you can override the
79   default locking mechanism used by implementing this method.
80 */
81 - (SoDAVLockManager *)davLockManagerInContext:(id)_ctx;
82
83
84 /* some DAV properties are mapped to some keys by default */
85
86 - (BOOL)davIsCollection;  // tries -isCollection and NSFileType, otherwise NO
87 - (BOOL)davIsFolder;      // same as -davIsCollection
88 - (BOOL)davHasSubFolders; // same as -davIsFolder
89 - (BOOL)davIsHidden;      // returns NO
90 - (BOOL)davIsExecutable;  // returns NO
91
92 - (id)davUid;             // tries -globalID, otherwise same as -davURL
93 - (id)davEntityTag;
94 - (id)davURL;             // tries -baseURLInContext:, -baseURL otherwise nil
95 - (id)davContentLength;   // tries NSFileSize, -contentLength, otherwise 0
96 - (NSString *)davContentType;
97
98 - (NSDate *)davLastModified; // tries NSFileModificationDate, otherwise now
99 // tries NSFileCreationDate, NSFileModificationDate, otherwise nil
100 - (NSDate *)davCreationDate;
101
102 // tries -displayName, NSFileSubject,NSFileName,NSFilePath, -path otherwise nil
103 - (NSString *)davDisplayName;
104 - (NSString *)davResourceType; // uses -davIsCollection
105
106 // uses -davIsCollection (urn:content-class:folder or urn:content-class:item)
107 - (NSString *)davContentClass;
108
109
110 - (BOOL)davDenySubFolders;
111 - (unsigned int)davChildCount;
112 - (unsigned int)davObjectCount;
113 - (unsigned int)davVisibleCount;
114
115 @end
116
117 #endif /* __WebDAV_SoObject_SoDAV_H__ */