From: helge Date: Tue, 21 Sep 2004 13:50:21 +0000 (+0000) Subject: started support for non-userspecific server defaults X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c85388c3033bc28681047abe6c2bd46bc67efa39;p=sope started support for non-userspecific server defaults git-svn-id: http://svn.opengroupware.org/SOPE/trunk@150 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- diff --git a/sope-appserver/NGObjWeb/ChangeLog b/sope-appserver/NGObjWeb/ChangeLog index 9f9e42d3..0d49fb0e 100644 --- a/sope-appserver/NGObjWeb/ChangeLog +++ b/sope-appserver/NGObjWeb/ChangeLog @@ -1,3 +1,13 @@ +2004-09-21 Helge Hess + + * v4.3.41 + + * WOWatchDogApplicationMain.m: added new function + WOWatchDogApplicationMainWithServerDefaults() which installs the + WOServerDefaults class as the default NSUserDefaults class + + * added WOServerDefaults class (not implemented yet) + 2004-09-21 Marcus Mueller * v4.3.41 diff --git a/sope-appserver/NGObjWeb/GNUmakefile b/sope-appserver/NGObjWeb/GNUmakefile index f4242598..6b122734 100644 --- a/sope-appserver/NGObjWeb/GNUmakefile +++ b/sope-appserver/NGObjWeb/GNUmakefile @@ -126,6 +126,10 @@ libNGObjWeb_OBJC_FILES = \ WOStats.m \ WOWatchDogApplicationMain.m \ +ifeq ($(FOUNDATION_LIB),fd) +NGObjWebCore_OBJC_FILES += WOServerDefaults.m +endif + # ----- SoCore product for SOPE core registrations BUNDLE_NAME = SoCore diff --git a/sope-appserver/NGObjWeb/NGObjWeb/WOCoreApplication.h b/sope-appserver/NGObjWeb/NGObjWeb/WOCoreApplication.h index daf6c902..6b583780 100644 --- a/sope-appserver/NGObjWeb/NGObjWeb/WOCoreApplication.h +++ b/sope-appserver/NGObjWeb/NGObjWeb/WOCoreApplication.h @@ -101,6 +101,9 @@ NGObjWeb_EXPORT NSString *WOApplicationDidTerminateNotification; int WOApplicationMain(NSString *_appClassName, int argc, const char *argv[]); int WOWatchDogApplicationMain (NSString *_appClassName, int argc, const char *argv[]); +int WOWatchDogApplicationMainWithServerDefaults + (NSString *_appClassName, int argc, const char *argv[], + NSString *globalDomainPath, NSString *appDomainPath); @interface WOCoreApplication(DeprecatedMethodsInWO4) diff --git a/sope-appserver/NGObjWeb/WOScriptedComponent.m b/sope-appserver/NGObjWeb/WOScriptedComponent.m index f1869710..cb2edb4d 100644 --- a/sope-appserver/NGObjWeb/WOScriptedComponent.m +++ b/sope-appserver/NGObjWeb/WOScriptedComponent.m @@ -1,7 +1,7 @@ /* - Copyright (C) 2000-2003 SKYRIX Software AG + Copyright (C) 2000-2004 SKYRIX Software AG - This file is part of OGo + This file is part of OpenGroupware.org. OGo is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the @@ -18,7 +18,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id: WOScriptedComponent.m 1 2004-08-20 10:08:27Z znek $ #include "WOScriptedComponent.h" #include diff --git a/sope-appserver/NGObjWeb/WOServerDefaults.m b/sope-appserver/NGObjWeb/WOServerDefaults.m new file mode 100644 index 00000000..8b1ea460 --- /dev/null +++ b/sope-appserver/NGObjWeb/WOServerDefaults.m @@ -0,0 +1,44 @@ +/* + Copyright (C) 2004 SKYRIX Software AG + + This file is part of OpenGroupware.org. + + OGo is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + OGo is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with OGo; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ + +#import + +@interface WOServerDefaults : NSUserDefaults +{ + NSUserDefaults *userDefaults; + NSString *globalDomainPath; + NSString *appDomainPath; +} + +@end + +#include "common.h" + +@implementation WOServerDefaults + ++ (id)hackInServerDefaults:(NSUserDefaults *)_ud + withAppDomainPath:(NSString *)_appDomainPath + globalDomainPath:(NSString *)_globalDomainPath +{ + return _ud; +} + +@end /* WOServerDefaults */ diff --git a/sope-appserver/NGObjWeb/WOWatchDogApplicationMain.m b/sope-appserver/NGObjWeb/WOWatchDogApplicationMain.m index c1a33f9c..a9062d05 100644 --- a/sope-appserver/NGObjWeb/WOWatchDogApplicationMain.m +++ b/sope-appserver/NGObjWeb/WOWatchDogApplicationMain.m @@ -18,7 +18,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id$ #import #include @@ -419,3 +418,44 @@ int WOWatchDogApplicationMain } } #endif + +/* main function which initializes server defaults (usually in /etc) */ + +@interface NSUserDefaults(ServerDefaults) ++ (id)hackInServerDefaults:(NSUserDefaults *)_ud + withAppDomainPath:(NSString *)_appDomainPath + globalDomainPath:(NSString *)_globalDomainPath; +@end + +int WOWatchDogApplicationMainWithServerDefaults +(NSString *appName, int argc, const char *argv[], + NSString *globalDomainPath, NSString *appDomainPath) +{ + NSAutoreleasePool *pool; + Class defClass; + + pool = [[NSAutoreleasePool alloc] init]; +#if LIB_FOUNDATION_LIBRARY || defined(GS_PASS_ARGUMENTS) + { + extern char **environ; + [NSProcessInfo initializeWithArguments:(void*)argv count:argc + environment:(void*)environ]; + } +#endif + + if ((defClass = NSClassFromString(@"WOServerDefaults")) != nil) { + NSUserDefaults *ud, *sd; + + ud = [NSUserDefaults standardUserDefaults]; + sd = [defClass hackInServerDefaults:ud + withAppDomainPath:appDomainPath + globalDomainPath:globalDomainPath]; + + if (((sd == nil) || (sd == ud)) && (appDomainPath != nil)) { + NSLog(@"Note: not using server defaults: '%@' " + @"(not supported on this Foundation)", appDomainPath); + } + } + + return WOWatchDogApplicationMain(appName, argc, argv); +}