]> err.no Git - sope/blob - sope-appserver/NGObjWeb/NGObjWeb/WOApplication.h
bumped Xcode projects to version 4.7. Added a new Xcode project for the STXSaxDriver.
[sope] / sope-appserver / NGObjWeb / NGObjWeb / WOApplication.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_WOApplication_H__
23 #define __NGObjWeb_WOApplication_H__
24
25 #import <Foundation/NSObject.h>
26 #import <Foundation/NSLock.h>
27 #import <Foundation/NSMapTable.h>
28 #include <NGObjWeb/NGObjWebDecls.h>
29 #include <NGObjWeb/WOCoreApplication.h>
30
31 @class NSString, NSRunLoop, NSArray, NSTimer, NSException, NSNumber, NSURL;
32 @class NSMutableDictionary, NSDictionary;
33 @class WOResourceManager, WOComponent, WOContext, WOSession;
34 @class WORequest, WOResponse, WOAdaptor, WORequestHandler;
35 @class WOSessionStore, WODynamicElement, WOElement, WOStatisticsStore;
36
37 @interface WOApplication : WOCoreApplication
38 {
39 @private
40   int                 minimumActiveSessionsCount;
41   NSString            *name;
42   NSString            *path;
43   WORequestHandler    *defaultRequestHandler;
44   NSMapTable          *requestHandlerRegistry;
45   WOSessionStore      *iSessionStore;
46   WOStatisticsStore   *iStatisticsStore;
47   WOResourceManager   *resourceManager;
48   void                *_unused;
49   NSTimer             *expirationTimer;
50   NSString            *instanceNumber;
51   short               pageCacheSize;
52   short               permanentPageCacheSize;
53
54   struct {
55     BOOL doesRefuseNewSessions:1;
56     BOOL isPageRefreshOnBacktrackEnabled:1;
57     BOOL isCachingEnabled:1;
58   } appFlags;
59 }
60
61 /* accessors */
62
63 - (NSString *)name;
64 - (BOOL)monitoringEnabled;
65 - (NSString *)path;
66 - (NSString *)number;
67
68 /* request handlers */
69
70 - (void)registerRequestHandler:(WORequestHandler *)_hdl forKey:(NSString *)_key;
71 - (void)removeRequestHandlerForKey:(NSString *)_key;
72 - (void)setDefaultRequestHandler:(WORequestHandler *)_hdl;
73 - (WORequestHandler *)defaultRequestHandler;
74 - (NSArray *)registeredRequestHandlerKeys;
75
76 /* sessions */
77
78 - (id)createSessionForRequest:(WORequest *)_request;
79 - (id)restoreSessionWithID:(NSString *)_id inContext:(WOContext *)_ctx;
80 - (void)saveSessionForContext:(WOContext *)_ctx;
81
82 - (void)setSessionStore:(WOSessionStore *)_store;
83 - (WOSessionStore *)sessionStore;
84 - (NSString *)sessionStoreClassName;
85 - (void)refuseNewSessions:(BOOL)_flag;
86 - (BOOL)isRefusingNewSessions;
87 - (int)activeSessionsCount;
88
89 - (void)setMinimumActiveSessionsCount:(int)_minimum;
90 - (int)minimumActiveSessionsCount;
91
92 - (WOResponse *)handleSessionCreationErrorInContext:(WOContext *)_context;
93 - (WOResponse *)handleSessionRestorationErrorInContext:(WOContext *)_context;
94 - (WOResponse *)handlePageRestorationErrorInContext:(WOContext *)_context;
95
96 /* statistics */
97
98 - (void)setStatisticsStore:(WOStatisticsStore *)_statStore;
99 - (WOStatisticsStore *)statisticsStore;
100 - (bycopy NSDictionary *)statistics;
101
102 /* resources */
103
104 - (void)setResourceManager:(WOResourceManager *)_manager;
105 - (WOResourceManager *)resourceManager;
106 - (NSURL *)baseURL;
107 - (NSString *)pathForResourceNamed:(NSString *)_name ofType:(NSString *)_type;
108
109 /* notifications */
110
111 - (void)awake;
112 - (void)sleep;
113
114 /* responder */
115
116 - (void)takeValuesFromRequest:(WORequest *)_req  inContext:(WOContext *)_ctx;
117 - (id)invokeActionForRequest:(WORequest *)_req   inContext:(WOContext *)_ctx;
118 - (void)appendToResponse:(WOResponse *)_response inContext:(WOContext *)_ctx;
119
120 /* dynamic elements */
121
122 - (WOElement *)dynamicElementWithName:(NSString *)_name // element class name
123   associations:(NSDictionary *)_associations            // bindings
124   template:(WOElement *)_template                       // child elements
125   languages:(NSArray *)_languages;
126
127 /* pages */
128
129 - (void)setPageRefreshOnBacktrackEnabled:(BOOL)_flag;
130 - (BOOL)isPageRefreshOnBacktrackEnabled;
131 - (void)setCachingEnabled:(BOOL)_flag;
132 - (BOOL)isCachingEnabled;
133 - (void)setPageCacheSize:(int)_size;
134 - (int)pageCacheSize;
135 - (void)setPermanentPageCacheSize:(int)_size;
136 - (int)permanentPageCacheSize;
137
138 - (id)pageWithName:(NSString *)_name inContext:(WOContext *)_ctx;
139 - (id)pageWithName:(NSString *)_name forRequest:(WORequest *)_req;
140
141 /* exceptions */
142
143 - (WOResponse *)handleException:(NSException *)_exc
144   inContext:(WOContext *)_ctx;
145
146 @end
147
148 @interface WOApplication(DeprecatedMethodsInWO4)
149
150 - (id)session;
151 - (WOContext *)context;
152
153 - (id)createSession;
154 - (id)restoreSession;
155 - (void)saveSession:(WOSession *)_session;
156
157 - (WOResponse *)handleSessionCreationError;
158 - (WOResponse *)handleSessionRestorationError;
159 - (WOResponse *)handlePageRestorationError;
160
161 - (void)savePage:(WOComponent *)_page;
162 - (id)restorePageForContextID:(NSString *)_ctxId;
163
164 - (id)pageWithName:(NSString *)_name;
165
166 - (WOResponse *)handleException:(NSException *)_exception;
167 - (WOResponse *)handleRequest:(WORequest *)_request;
168
169 - (WOElement *)dynamicElementWithName:(NSString *)_name // element class name
170   associations:(NSDictionary *)_associations            // bindings
171   template:(WOElement *)_template;                      // child elements
172
173 - (NSString *)stringForKey:(NSString *)_key
174   inTableNamed:(NSString *)_tableName
175   withDefaultValue:(NSString *)_default;
176
177 @end
178
179 @interface WOApplication(NonWOMethods)
180
181 - (WORequestHandler *)requestHandlerForKey:(NSString *)_key;
182
183 - (NSString *)sessionIDFromRequest:(WORequest *)_request;
184 - (NSString *)createSessionIDForSession:(WOSession *)_session;
185
186 + (Class)eoEditingContextClass;
187 + (BOOL)implementsEditingContexts;
188
189 @end
190
191 @interface WOApplication(Defaults)
192
193 /* WOComponentRequestHandlerKey */
194 + (void)setComponentRequestHandlerKey:(NSString *)_key;
195 + (NSString *)componentRequestHandlerKey;
196
197 /* WODirectActionRequestHandlerKey */
198 + (void)setDirectActionRequestHandlerKey:(NSString *)_key;
199 + (NSString *)directActionRequestHandlerKey;
200
201 /* WOResourceRequestHandlerKey */
202 + (void)setResourceRequestHandlerKey:(NSString *)_key;
203 + (NSString *)resourceRequestHandlerKey;
204
205 /* WODefaultSessionTimeOut */
206 + (void)setSessionTimeOut:(NSNumber *)_timeOut;
207 + (NSNumber *)sessionTimeOut;
208
209 /* WOCachingEnabled */
210 + (BOOL)isCachingEnabled;
211
212 /* WODebuggingEnabled */
213 + (BOOL)isDebuggingEnabled;
214
215 + (BOOL)isDirectConnectEnabled;
216 + (void)setCGIAdaptorURL:(NSString *)_url;
217 + (NSString *)cgiAdaptorURL;
218
219 @end
220
221 @interface WOApplication(WODebugging)
222 /* implemented in NGExtensions */
223
224 - (void)debugWithFormat:(NSString *)_format, ...;
225 - (void)logWithFormat:(NSString *)_format, ...;
226
227 @end
228
229 #endif /* __NGObjWeb_WOApplication_H__ */