+2005-02-17 Helge Hess <helge.hess@skyrix.com>
+
+ * WOApplication.m: the resource manager class to be used for a SOPE
+ application can now be choosen using the 'WODefaultResourceManager'
+ default (defaults to WOResourceManager) (v4.5.116)
+
2005-02-14 Helge Hess <helge.hess@opengroupware.org>
* SoObjects/SoObjectRequestHandler.m: added a safety limit on the URL
/* resources */
+- (void)_setupDefaultResourceManager {
+ NSUserDefaults *ud;
+ Class rmClass;
+ NSString *p;
+
+ ud = [NSUserDefaults standardUserDefaults];
+ p = [ud stringForKey:@"WODefaultResourceManager"];
+ rmClass = ([p length] == 0)
+ ? [WOResourceManager class]
+ : NSClassFromString(p);
+
+ if (rmClass == Nil) {
+ [self errorWithFormat:
+ @"failed to locate class of resource manager: '%@'", p];
+ return;
+ }
+
+ if ([rmClass instancesRespondToSelector:@selector(initWithPath:)])
+ self->resourceManager = [[rmClass alloc] init];
+ else {
+ self->resourceManager =
+ [(WOResourceManager *)[rmClass alloc] initWithPath:[self path]];
+ }
+}
+
- (void)setResourceManager:(WOResourceManager *)_manager {
ASSIGN(self->resourceManager, _manager);
}
- (WOResourceManager *)resourceManager {
- if (self->resourceManager == nil) {
- NSString *p;
-
-#if 0 && DEBUG
- if ([(p = [self path]) length] > 0)
- [self debugWithFormat:@"setup WOResourceManager at path '%@' ...", p];
-#else
- p = [self path];
-#endif
-
- self->resourceManager =
- [(WOResourceManager *)[WOResourceManager alloc] initWithPath:p];
- }
+ if (self->resourceManager == nil)
+ [self _setupDefaultResourceManager];
+
return self->resourceManager;
}