]> err.no Git - sope/blob - sope-appserver/NGObjWeb/NGObjWeb/WOSession.h
increased element nesting depth
[sope] / sope-appserver / NGObjWeb / NGObjWeb / WOSession.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 __NGObjWeb_WOSession_H__
23 #define __NGObjWeb_WOSession_H__
24
25 #import <Foundation/NSObject.h>
26 #import <Foundation/NSLock.h>
27 #import <Foundation/NSDate.h>
28 #include <NGObjWeb/NGObjWebDecls.h>
29
30 @class NSString, NSArray, NSRecursiveLock, NSMutableDictionary, NSDate;
31 @class WOContext, WOApplication;
32 @class WORequest, WOResponse, WOContext, WOComponent;
33
34 struct WOSessionCacheEntry;
35
36 NGObjWeb_EXPORT NSString *WOSessionDidTimeOutNotification;
37 NGObjWeb_EXPORT NSString *WOSessionDidRestoreNotification;
38 NGObjWeb_EXPORT NSString *WOSessionDidCreateNotification;
39 NGObjWeb_EXPORT NSString *WOSessionDidTerminateNotification;
40
41 @interface WOSession : NSObject < NSLocking >
42 {
43 @private
44   NSArray             *wosLanguages;
45   BOOL                isTerminating;
46   NSRecursiveLock     *wosLock;
47   NSString            *wosSessionId;
48   NSMutableDictionary *wosVariables;     // session variables
49   NSTimeInterval      wosTimeOut;
50   id                  wosDefaultEditingContext;
51   struct {
52     BOOL              storesIDsInURLs:1;
53     BOOL              storesIDsInCookies:1;
54     BOOL              isAwake:1;
55   } wosFlags;
56
57 @private
58   struct {
59     struct WOSessionCacheEntry *entries;
60     unsigned short             index;
61     unsigned short             size;
62   } pageCache;
63   struct {
64     struct WOSessionCacheEntry *entries;
65     unsigned short             index;
66     unsigned short             size;
67   } permanentPageCache;
68
69 @protected // transients (non-retained)
70   WOApplication *application;
71   WOContext     *context;
72 }
73
74 /* session */
75
76 - (NSString *)sessionID;
77 - (void)setStoresIDsInURLs:(BOOL)_flag;
78 - (BOOL)storesIDsInURLs;
79 - (void)setStoresIDsInCookies:(BOOL)_flag;
80 - (BOOL)storesIDsInCookies;
81 - (NSString *)domainForIDCookies;
82 - (NSDate *)expirationDateForIDCookies;
83
84 - (void)setDistributionEnabled:(BOOL)_flag;
85 - (BOOL)isDistributionEnabled;
86
87 - (void)setTimeOut:(NSTimeInterval)_timeout;
88 - (NSTimeInterval)timeOut;
89 - (void)terminate;
90 - (BOOL)isTerminating;
91
92 - (WOContext *)context;
93
94 /* editing context */
95
96 - (id)defaultEditingContext;
97
98 /* localization */
99
100 - (void)setLanguages:(NSArray *)_langs;
101 - (NSArray *)languages;
102
103 /* notifications */
104
105 - (void)awake;
106 - (void)sleep;
107
108 /* pages */
109
110 - (id)restorePageForContextID:(NSString *)_idx;
111 - (void)savePage:(WOComponent *)_page;
112 - (void)savePageInPermanentCache:(WOComponent *)_page; // new in WO4
113
114 /* responder */
115
116 - (void)takeValuesFromRequest:(WORequest *)_request inContext:(WOContext *)_ctx;
117 - (id)invokeActionForRequest:(WORequest *)_request inContext:(WOContext *)_ctx;
118 - (void)appendToResponse:(WOResponse *)_response inContext:(WOContext *)_ctx;
119
120 /* multithreading */
121
122 - (void)lock;
123 - (void)unlock;
124 - (BOOL)tryLock;
125
126 /* session variables */
127
128 - (void)setObject:(id)_obj forKey:(NSString *)_key;
129 - (id)objectForKey:(NSString *)_key;
130 - (void)removeObjectForKey:(NSString *)_key;
131
132 /* statistics */
133
134 - (NSArray *)statistics;
135
136 @end
137
138 @interface WOSession(DeprecatedMethodsInWO4)
139
140 - (id)application; // use [WOApplication application] instead
141
142 @end
143
144 @interface WOSession(PrivateMethods)
145 - (void)_awakeWithContext:(WOContext *)_ctx;
146 - (void)_sleepWithContext:(WOContext *)_ctx;
147 @end
148
149 @interface WOSession(NSCoding) < NSCoding >
150 @end
151
152 @interface WOSession(Logging)
153
154 - (void)logWithFormat:(NSString *)_format, ...;
155 - (void)debugWithFormat:(NSString *)_format, ...; // new in WO4
156
157 @end
158
159 #endif /* __NGObjWeb_WOSession_H__ */