From: znek Date: Sun, 31 Dec 2006 17:00:53 +0000 (+0000) Subject: improved support for using custom components X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e357a5b2e9e8a5320c32d24cb8fbe14396116b3;p=sope improved support for using custom components git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1396 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- diff --git a/sope-appserver/SoOFS/ChangeLog b/sope-appserver/SoOFS/ChangeLog index 91e6e38b..9862421c 100644 --- a/sope-appserver/SoOFS/ChangeLog +++ b/sope-appserver/SoOFS/ChangeLog @@ -1,3 +1,14 @@ +2006-12-31 Marcus Mueller + + * v4.5.25 + + * OFSResourceManager.m: try to locate component class in runtime, + according to the name of the template. If that cannot be found, + fall back to WOComponent. + + * sope.m: accept --bundle commandline parameters for loading + custom classes, i.e. custom component classes. + 2006-12-30 Marcus Mueller * OFSResourceManager.m: assign self as resourceManager to components diff --git a/sope-appserver/SoOFS/OFSResourceManager.m b/sope-appserver/SoOFS/OFSResourceManager.m index 2b22cbbb..ea5cfaea 100644 --- a/sope-appserver/SoOFS/OFSResourceManager.m +++ b/sope-appserver/SoOFS/OFSResourceManager.m @@ -142,11 +142,24 @@ static BOOL debugOn = NO; languages:(NSArray *)_languages { WOComponentDefinition *cdef; - + NSRange r; + NSString *name; + Class cClass; + cdef = [super definitionForComponent:_name inFramework:_framework languages:_languages]; - [cdef setComponentClass:NSClassFromString(@"WOComponent")]; + r = [_name rangeOfString:@"."]; + if (r.length > 0) + name = [_name substringToIndex:r.location]; + else + name = _name; + + cClass = NSClassFromString(name); + if (cClass == Nil) + cClass = NSClassFromString(@"WOComponent"); + + [cdef setComponentClass:cClass]; return cdef; } diff --git a/sope-appserver/SoOFS/SoOFS.xcodeproj/project.pbxproj b/sope-appserver/SoOFS/SoOFS.xcodeproj/project.pbxproj index 1eac9080..d5e12fb0 100644 --- a/sope-appserver/SoOFS/SoOFS.xcodeproj/project.pbxproj +++ b/sope-appserver/SoOFS/SoOFS.xcodeproj/project.pbxproj @@ -522,7 +522,7 @@ buildSettings = { COPY_PHASE_STRIP = NO; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 4.5.24; + DYLIB_CURRENT_VERSION = 4.5.25; FRAMEWORK_SEARCH_PATHS = "$(LOCAL_LIBRARY_DIR)/Frameworks"; FRAMEWORK_VERSION = A; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; @@ -563,7 +563,7 @@ DEPLOYMENT_POSTPROCESSING = YES; DSTROOT = /; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 4.5.24; + DYLIB_CURRENT_VERSION = 4.5.25; DYLIB_INSTALL_NAME_BASE = "@executable_path/../Frameworks/"; FRAMEWORK_SEARCH_PATHS = "$(USER_LIBRARY_DIR)/EmbeddedFrameworks"; FRAMEWORK_VERSION = A; @@ -606,7 +606,7 @@ isa = XCBuildConfiguration; buildSettings = { DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 4.5.24; + DYLIB_CURRENT_VERSION = 4.5.25; FRAMEWORK_SEARCH_PATHS = "$(LOCAL_LIBRARY_DIR)/Frameworks"; FRAMEWORK_VERSION = A; GCC_PRECOMPILE_PREFIX_HEADER = YES; diff --git a/sope-appserver/SoOFS/Version b/sope-appserver/SoOFS/Version index c68bd2a4..cd99f938 100644 --- a/sope-appserver/SoOFS/Version +++ b/sope-appserver/SoOFS/Version @@ -1,5 +1,5 @@ # version file -SUBMINOR_VERSION:=24 +SUBMINOR_VERSION:=25 # v4.5.23 requires libNGObjWeb v4.5.263 diff --git a/sope-appserver/SoOFS/sope.m b/sope-appserver/SoOFS/sope.m index ba559bf3..70ce2200 100644 --- a/sope-appserver/SoOFS/sope.m +++ b/sope-appserver/SoOFS/sope.m @@ -233,12 +233,43 @@ static BOOL debugRootObject = NO; int main(int argc, char **argv, char **env) { NSAutoreleasePool *pool; - + NSEnumerator *args; + NSString *arg; + id self; + pool = [[NSAutoreleasePool alloc] init]; #if LIB_FOUNDATION_LIBRARY [NSProcessInfo initializeWithArguments:argv count:argc environment:env]; #endif - + + self = pool; + args = [[[NSProcessInfo processInfo] arguments] objectEnumerator]; + [args nextObject]; + + while ((arg = [args nextObject]) != nil) { + if ([arg isEqualToString:@"--bundle"]) { + NSString *path = [args nextObject]; + if (path != nil) { + NSBundle *bundle; + bundle = [NSBundle bundleWithPath:path]; + if (!bundle) { + [self errorWithFormat:@"No loadable bundle at path: '%@'!", path]; + exit(1); + } + [bundle load]; + } + else { + [self errorWithFormat:@"Missing path for --bundle argument!"]; + exit(1); + } + } +#if 0 + else { + [self errorWithFormat:@"Unknown argument: '%@', skipping.", arg]; + } +#endif + } + WOWatchDogApplicationMain(@"SOPE", argc, (void*)argv); [pool release];