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