]> err.no Git - sope/blob - sope-appserver/NGObjWeb/SoObjects/SoObject.h
fixed copyrights for 2005
[sope] / sope-appserver / NGObjWeb / SoObjects / SoObject.h
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 __SoObjects_SoObject_H__
23 #define __SoObjects_SoObject_H__
24
25 #import <Foundation/NSObject.h>
26
27 /*
28   This mostly defines a new KVC interface on NSObject. The major difference
29   to KVC is, that KVC calls method keys while SoObjectLookup returns an
30   invocation object.
31   It also introduces a new "class" hierachy used for "web" methods and classes
32   that basically mirrors the Python object system (where ivars and methods are
33   both "attributes").
34 */
35
36 @class NSString, NSException, NSClassDescription, NSArray;
37 @class SoClass, SoClassSecurityInfo;
38
39 @interface NSObject(SoObject)
40
41 /* classes */
42
43 + (SoClass *)soClass;
44 - (SoClass *)soClass;
45 + (SoClassSecurityInfo *)soClassSecurityInfo;
46 - (NSClassDescription *)soClassDescription;
47
48 /* basic names */
49
50 - (BOOL)hasName:(NSString *)_key  inContext:(id)_ctx;
51 - (id)lookupName:(NSString *)_key inContext:(id)_ctx acquire:(BOOL)_flag;
52 - (NSException *)validateName:(NSString *)_key inContext:(id)_ctx;
53
54 /* invocation */
55
56 - (BOOL)isCallable;
57 - (id)clientObject;
58 - (id)callOnObject:(id)_client inContext:(id)_ctx;
59 - (NSString *)defaultMethodNameInContext:(id)_ctx;
60 - (id)lookupDefaultMethod;
61
62 /* binding (returns self by default [unbound objects]) */
63
64 - (id)bindToObject:(id)_object inContext:(id)_ctx;
65
66 /* security */
67
68 - (NSString *)ownerInContext:(id)_ctx;
69 - (id)authenticatorInContext:(id)_ctx;
70
71 /* containment */
72
73 - (id)container;
74 - (void)detachFromContainer;
75 - (NSString *)nameInContainer;
76 - (NSArray *)objectContainmentStack;
77 - (NSArray *)pathArrayToSoObject;
78 - (NSArray *)reversedPathArrayToSoObject;
79
80 - (NSString *)baseURLInContext:(id)_ctx;
81 - (NSString *)rootURLInContext:(id)_ctx;
82
83 @end
84
85 @interface NSObject(SoObjectLookup)
86
87 /* your object can override this methods to use specialized lookup */
88
89 - (id)traverseKey:(NSString *)_key inContext:(id)_ctx;
90
91 /* traversal implementation */
92
93 - (id)handleValidationError:(NSException *)_error 
94   duringTraveralOfKey:(NSString *)_key
95   inContext:(id)_ctx;
96 - (id)traverseKey:(NSString *)_name
97   inContext:(id)_ctx
98   error:(NSException **)_error
99   acquire:(BOOL)_acquire;
100
101 - (id)traversePathArray:(NSArray *)traversalPath
102   inContext:(id)_ctx
103   error:(NSException **)_error
104   acquire:(BOOL)_acquire;
105
106 /*
107   The following is a convenience method, it creates a context for
108   traversal and returns the error as the result - the right thing
109   for all "custom" lookups.
110 */
111 - (id)traversePath:(id)_tp acquire:(BOOL)_acquire;
112 - (id)traversePathArray:(NSArray *)_tp acquire:(BOOL)_acquire;
113
114 @end
115
116 #endif /* __SoObjects_SoObject_H__ */