2 Copyright (C) 2000-2004 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
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
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.
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
23 #ifndef __NGObjWeb_WOApplication_H__
24 #define __NGObjWeb_WOApplication_H__
26 #import <Foundation/NSObject.h>
27 #import <Foundation/NSLock.h>
28 #import <Foundation/NSMapTable.h>
29 #include <NGObjWeb/NGObjWebDecls.h>
30 #include <NGObjWeb/WOCoreApplication.h>
32 @class NSString, NSRunLoop, NSArray, NSTimer, NSException, NSNumber, NSURL;
33 @class NSMutableDictionary, NSDictionary;
34 @class WOResourceManager, WOComponent, WOContext, WOSession;
35 @class WORequest, WOResponse, WOAdaptor, WORequestHandler;
36 @class WOSessionStore, WODynamicElement, WOElement, WOStatisticsStore;
38 @interface WOApplication : WOCoreApplication
41 int minimumActiveSessionsCount;
44 WORequestHandler *defaultRequestHandler;
45 NSMapTable *requestHandlerRegistry;
46 WOSessionStore *iSessionStore;
47 WOStatisticsStore *iStatisticsStore;
48 WOResourceManager *resourceManager;
50 NSTimer *expirationTimer;
51 NSString *instanceNumber;
53 short permanentPageCacheSize;
56 BOOL doesRefuseNewSessions:1;
57 BOOL isPageRefreshOnBacktrackEnabled:1;
58 BOOL isCachingEnabled:1;
65 - (BOOL)monitoringEnabled;
69 /* request handlers */
71 - (void)registerRequestHandler:(WORequestHandler *)_hdl forKey:(NSString *)_key;
72 - (void)removeRequestHandlerForKey:(NSString *)_key;
73 - (void)setDefaultRequestHandler:(WORequestHandler *)_hdl;
74 - (WORequestHandler *)defaultRequestHandler;
75 - (NSArray *)registeredRequestHandlerKeys;
79 - (id)createSessionForRequest:(WORequest *)_request;
80 - (id)restoreSessionWithID:(NSString *)_id inContext:(WOContext *)_ctx;
81 - (void)saveSessionForContext:(WOContext *)_ctx;
83 - (void)setSessionStore:(WOSessionStore *)_store;
84 - (WOSessionStore *)sessionStore;
85 - (NSString *)sessionStoreClassName;
86 - (void)refuseNewSessions:(BOOL)_flag;
87 - (BOOL)isRefusingNewSessions;
88 - (int)activeSessionsCount;
90 - (void)setMinimumActiveSessionsCount:(int)_minimum;
91 - (int)minimumActiveSessionsCount;
93 - (WOResponse *)handleSessionCreationErrorInContext:(WOContext *)_context;
94 - (WOResponse *)handleSessionRestorationErrorInContext:(WOContext *)_context;
95 - (WOResponse *)handlePageRestorationErrorInContext:(WOContext *)_context;
99 - (void)setStatisticsStore:(WOStatisticsStore *)_statStore;
100 - (WOStatisticsStore *)statisticsStore;
101 - (bycopy NSDictionary *)statistics;
105 - (void)setResourceManager:(WOResourceManager *)_manager;
106 - (WOResourceManager *)resourceManager;
108 - (NSString *)pathForResourceNamed:(NSString *)_name ofType:(NSString *)_type;
117 - (void)takeValuesFromRequest:(WORequest *)_req inContext:(WOContext *)_ctx;
118 - (id)invokeActionForRequest:(WORequest *)_req inContext:(WOContext *)_ctx;
119 - (void)appendToResponse:(WOResponse *)_response inContext:(WOContext *)_ctx;
121 /* dynamic elements */
123 - (WOElement *)dynamicElementWithName:(NSString *)_name // element class name
124 associations:(NSDictionary *)_associations // bindings
125 template:(WOElement *)_template // child elements
126 languages:(NSArray *)_languages;
130 - (void)setPageRefreshOnBacktrackEnabled:(BOOL)_flag;
131 - (BOOL)isPageRefreshOnBacktrackEnabled;
132 - (void)setCachingEnabled:(BOOL)_flag;
133 - (BOOL)isCachingEnabled;
134 - (void)setPageCacheSize:(int)_size;
135 - (int)pageCacheSize;
136 - (void)setPermanentPageCacheSize:(int)_size;
137 - (int)permanentPageCacheSize;
139 - (id)pageWithName:(NSString *)_name inContext:(WOContext *)_ctx;
140 - (id)pageWithName:(NSString *)_name forRequest:(WORequest *)_req;
144 - (WOResponse *)handleException:(NSException *)_exc
145 inContext:(WOContext *)_ctx;
149 @interface WOApplication(DeprecatedMethodsInWO4)
152 - (WOContext *)context;
155 - (id)restoreSession;
156 - (void)saveSession:(WOSession *)_session;
158 - (WOResponse *)handleSessionCreationError;
159 - (WOResponse *)handleSessionRestorationError;
160 - (WOResponse *)handlePageRestorationError;
162 - (void)savePage:(WOComponent *)_page;
163 - (id)restorePageForContextID:(NSString *)_ctxId;
165 - (id)pageWithName:(NSString *)_name;
167 - (WOResponse *)handleException:(NSException *)_exception;
168 - (WOResponse *)handleRequest:(WORequest *)_request;
170 - (WOElement *)dynamicElementWithName:(NSString *)_name // element class name
171 associations:(NSDictionary *)_associations // bindings
172 template:(WOElement *)_template; // child elements
174 - (NSString *)stringForKey:(NSString *)_key
175 inTableNamed:(NSString *)_tableName
176 withDefaultValue:(NSString *)_default;
180 @interface WOApplication(NonWOMethods)
182 - (WORequestHandler *)requestHandlerForKey:(NSString *)_key;
184 - (NSString *)sessionIDFromRequest:(WORequest *)_request;
185 - (NSString *)createSessionIDForSession:(WOSession *)_session;
187 + (Class)eoEditingContextClass;
188 + (BOOL)implementsEditingContexts;
192 @interface WOApplication(Defaults)
194 /* WOComponentRequestHandlerKey */
195 + (void)setComponentRequestHandlerKey:(NSString *)_key;
196 + (NSString *)componentRequestHandlerKey;
198 /* WODirectActionRequestHandlerKey */
199 + (void)setDirectActionRequestHandlerKey:(NSString *)_key;
200 + (NSString *)directActionRequestHandlerKey;
202 /* WOResourceRequestHandlerKey */
203 + (void)setResourceRequestHandlerKey:(NSString *)_key;
204 + (NSString *)resourceRequestHandlerKey;
206 /* WODefaultSessionTimeOut */
207 + (void)setSessionTimeOut:(NSNumber *)_timeOut;
208 + (NSNumber *)sessionTimeOut;
210 /* WOCachingEnabled */
211 + (BOOL)isCachingEnabled;
213 /* WODebuggingEnabled */
214 + (BOOL)isDebuggingEnabled;
218 @interface WOApplication(WODebugging)
219 /* implemented in NGExtensions */
221 - (void)debugWithFormat:(NSString *)_format, ...;
222 - (void)logWithFormat:(NSString *)_format, ...;
226 #endif /* __NGObjWeb_WOApplication_H__ */