From: helge Date: Thu, 17 Feb 2005 14:48:43 +0000 (+0000) Subject: added WODefaultResourceManager default to specify the classname of the X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=39c3f88a63c763b4a42cc2bd127fa5726d631e0a;p=sope added WODefaultResourceManager default to specify the classname of the resource manager being used git-svn-id: http://svn.opengroupware.org/SOPE/trunk@565 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- diff --git a/sope-appserver/NGObjWeb/ChangeLog b/sope-appserver/NGObjWeb/ChangeLog index e17de4cb..f39f03e0 100644 --- a/sope-appserver/NGObjWeb/ChangeLog +++ b/sope-appserver/NGObjWeb/ChangeLog @@ -1,3 +1,9 @@ +2005-02-17 Helge Hess + + * 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 * SoObjects/SoObjectRequestHandler.m: added a safety limit on the URL diff --git a/sope-appserver/NGObjWeb/Defaults.plist b/sope-appserver/NGObjWeb/Defaults.plist index 1b236d5a..c303f68b 100644 --- a/sope-appserver/NGObjWeb/Defaults.plist +++ b/sope-appserver/NGObjWeb/Defaults.plist @@ -35,6 +35,7 @@ WODebugTakeValues = NO; WODebugZipResponse = NO; WODebuggingEnabled = NO; + WODefaultResourceManager = "WOResourceManager"; WODefaultSessionTimeOut = 3600; WODefaultLanguages = ( English, diff --git a/sope-appserver/NGObjWeb/Version b/sope-appserver/NGObjWeb/Version index 1ad5ef21..06ed44f4 100644 --- a/sope-appserver/NGObjWeb/Version +++ b/sope-appserver/NGObjWeb/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=114 +SUBMINOR_VERSION:=116 # v4.5.91 requires libNGExtensions v4.5.134 # v4.5.84 requires libNGExtensions v4.5.127 diff --git a/sope-appserver/NGObjWeb/WOApplication.m b/sope-appserver/NGObjWeb/WOApplication.m index 86206f3a..61bca098 100644 --- a/sope-appserver/NGObjWeb/WOApplication.m +++ b/sope-appserver/NGObjWeb/WOApplication.m @@ -818,23 +818,38 @@ static NSString *defaultCompRqHandlerClassName = @"WOComponentRequestHandler"; /* 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; }