From 1bfce800bb8f9c147f56e85f44b06e1cf2e2a717 Mon Sep 17 00:00:00 2001 From: helge Date: Sat, 13 Nov 2004 16:20:34 +0000 Subject: [PATCH] minor fixes git-svn-id: http://svn.opengroupware.org/SOPE/trunk@370 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-appserver/NGObjWeb/ChangeLog | 5 + sope-appserver/NGObjWeb/Version | 2 +- sope-appserver/NGObjWeb/WOApplication.m | 6 +- sope-core/NGExtensions/ChangeLog | 4 + sope-core/NGExtensions/NGBundleManager.m | 147 ++++++++++-------- .../NGExtensions/NSObject+ExtendedLogging.h | 2 +- sope-core/NGExtensions/Version | 2 +- 7 files changed, 98 insertions(+), 70 deletions(-) diff --git a/sope-appserver/NGObjWeb/ChangeLog b/sope-appserver/NGObjWeb/ChangeLog index 29d27316..14bb58ea 100644 --- a/sope-appserver/NGObjWeb/ChangeLog +++ b/sope-appserver/NGObjWeb/ChangeLog @@ -1,3 +1,8 @@ +2004-11-13 Helge Hess + + * WOApplication.m: changed wrapper-missing-log from warn to debug + (v4.5.86) + 2004-11-13 Helge Hess * WOApplication.m, WOCoreApplication.m: do not use deprecated logger diff --git a/sope-appserver/NGObjWeb/Version b/sope-appserver/NGObjWeb/Version index 6049a6b8..9b30ff55 100644 --- a/sope-appserver/NGObjWeb/Version +++ b/sope-appserver/NGObjWeb/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=85 +SUBMINOR_VERSION:=86 # v4.5.84 required libNGExtensions v4.5.127 # v4.3.42 requires libNGExtensions v4.3.116 diff --git a/sope-appserver/NGObjWeb/WOApplication.m b/sope-appserver/NGObjWeb/WOApplication.m index 86774834..7dafabd1 100644 --- a/sope-appserver/NGObjWeb/WOApplication.m +++ b/sope-appserver/NGObjWeb/WOApplication.m @@ -359,10 +359,12 @@ static NSString *rapidTurnAroundPath = nil; } - (NSString *)path { static BOOL missingPath = NO; - if (missingPath) return nil; + if (missingPath) + return nil; + if (self->path == nil) { if ((self->path = [[self _lookupAppPath] copy]) == nil) { - [self logWarnWithFormat:@"could not find wrapper of application !"]; + [self logDebugWithFormat:@"could not find wrapper of application !"]; missingPath = YES; return nil; } diff --git a/sope-core/NGExtensions/ChangeLog b/sope-core/NGExtensions/ChangeLog index 901c9b84..8557cd20 100644 --- a/sope-core/NGExtensions/ChangeLog +++ b/sope-core/NGExtensions/ChangeLog @@ -1,3 +1,7 @@ +2004-11-13 Helge Hess + + * NGBundleManager.m: some code cleanups (v4.5.129) + 2004-11-12 Helge Hess * NGLogging: code cleanup (v4.5.128) diff --git a/sope-core/NGExtensions/NGBundleManager.m b/sope-core/NGExtensions/NGBundleManager.m index 2f7066dd..f4774237 100644 --- a/sope-core/NGExtensions/NGBundleManager.m +++ b/sope-core/NGExtensions/NGBundleManager.m @@ -1159,83 +1159,100 @@ static BOOL _doesInfoMatch(NSArray *keys, NSDictionary *dict, NSDictionary *info NSFileManager *fm; NSEnumerator *e; NSString *path; + + if (debugOn) { + NSLog(@"BM LOOKUP pathes (%d bundles loaded): %@ / %@", + NSCountMapTable(self->loadedBundles), _resourceName, _type); + } fm = [NSFileManager defaultManager]; result = [NSMutableArray arrayWithCapacity:64]; + // TODO: look in loaded bundles + + /* check physical pathes */ + e = [self->bundleSearchPaths objectEnumerator]; - while ((path = [e nextObject])) { - BOOL isDir = NO; + while ((path = [e nextObject]) != nil) { + NSEnumerator *dir; + BOOL isDir = NO; + NSString *tmp, *bundleDirPath; + id info = nil; - if ([fm fileExistsAtPath:path isDirectory:&isDir]) { - NSString *tmp; - id info = nil; - if (!isDir) continue; - - /* check whether an appropriate bundle is contained in 'path' */ - { - NSEnumerator *dir; - - dir = [[fm directoryContentsAtPath:path] objectEnumerator]; - while ((tmp = [dir nextObject])) { - NSDictionary *bundleInfo = nil; - NSEnumerator *providedResources = nil; - NSString *infoPath; - id info; + if (![fm fileExistsAtPath:path isDirectory:&isDir]) + continue; + + if (!isDir) continue; + + /* check whether an appropriate bundle is contained in 'path' */ + + dir = [[fm directoryContentsAtPath:path] objectEnumerator]; + while ((bundleDirPath = [dir nextObject]) != nil) { + NSDictionary *bundleInfo = nil; + NSEnumerator *providedResources = nil; + NSString *infoPath; + id info; - tmp = [path stringByAppendingPathComponent:tmp]; - infoPath = [self makeBundleInfoPath:tmp]; - - if ((bundleInfo = NSMapGet(self->pathToBundleInfo, infoPath)) == nil) { - if (![fm fileExistsAtPath:infoPath]) - continue; - - bundleInfo = [self _loadBundleInfoAtExistingPath:infoPath]; - } - - providedResources = - [[(NSDictionary *)[bundleInfo objectForKey:@"provides"] - objectForKey:_type] - objectEnumerator]; - if (providedResources == nil) continue; + bundleDirPath = [path stringByAppendingPathComponent:bundleDirPath]; + infoPath = [self makeBundleInfoPath:bundleDirPath]; + + // TODO: can we use _doesBundleInfo:path:providedResource:... ? + if ((bundleInfo = NSMapGet(self->pathToBundleInfo, infoPath))==nil) { + if (![fm fileExistsAtPath:infoPath]) + continue; - // scan provide array - while ((info = [providedResources nextObject])) { - NSString *name; + bundleInfo = [self _loadBundleInfoAtExistingPath:infoPath]; + } + + providedResources = + [[(NSDictionary *)[bundleInfo objectForKey:@"provides"] + objectForKey:_type] + objectEnumerator]; + if (providedResources == nil) continue; + + /* scan 'provides' array */ + while ((info = [providedResources nextObject])) { + NSString *name; - name = [[(NSDictionary *)info objectForKey:@"name"] stringValue]; - if (name == nil) continue; - - if (_resourceName) { - if (![name isEqualToString:_resourceName]) - continue; - } - if (_selector) { - if (!_selector(name, _type, tmp, info, self, _context)) - continue; - } - - [result addObject:tmp]; - break; - } - } + name = [[(NSDictionary *)info objectForKey:@"name"] stringValue]; + if (name == nil) continue; + + if (_resourceName != nil) { + if (![name isEqualToString:_resourceName]) + continue; + } + if (_selector != NULL) { + if (!_selector(name, _type, bundleDirPath, info, self, _context)) + continue; + } + + [result addObject:bundleDirPath]; + break; } + } + + /* check for direct match (NGBundlePath element is a bundle) */ + + tmp = [self makeBundleInfoPath:path]; - /* check for direct match */ - - tmp = [self makeBundleInfoPath:path]; - - if ((info = NSMapGet(self->pathToBundleInfo, tmp)) == nil) { - if ([fm fileExistsAtPath:tmp]) - info = [self _loadBundleInfoAtExistingPath:tmp]; - } - - [self _processInfoForProvidedResources:info ofType:_type path:path - resourceName:_resourceName resourceSelector:_selector - context:_context - andAddToResultArray:result]; + if ((info = NSMapGet(self->pathToBundleInfo, tmp)) == nil) { + if ([fm fileExistsAtPath:tmp]) + info = [self _loadBundleInfoAtExistingPath:tmp]; } + + [self _processInfoForProvidedResources:info ofType:_type path:path + resourceName:_resourceName resourceSelector:_selector + context:_context + andAddToResultArray:result]; } + + if ([result count] == 0) { + [self logWithFormat: + @"Note(%s): method does not search in loaded bundles for " + @"resources of type '%@'", + __PRETTY_FUNCTION__, _type]; + } + return [[result copy] autorelease]; } @@ -1979,7 +1996,7 @@ static BOOL _doesInfoMatch(NSArray *keys, NSDictionary *dict, NSDictionary *info - (NSString *)description { char buffer[1024]; - + sprintf (buffer, "<%s %p fullPath: %s infoDictionary: %p loaded=%s>", (char*)object_get_class_name(self), diff --git a/sope-core/NGExtensions/NGExtensions/NSObject+ExtendedLogging.h b/sope-core/NGExtensions/NGExtensions/NSObject+ExtendedLogging.h index 548f0778..e4cd2dab 100644 --- a/sope-core/NGExtensions/NGExtensions/NSObject+ExtendedLogging.h +++ b/sope-core/NGExtensions/NGExtensions/NSObject+ExtendedLogging.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2000-2004 SKYRIX Software AG + Copyright (C) 2004 SKYRIX Software AG This file is part of OpenGroupware.org. diff --git a/sope-core/NGExtensions/Version b/sope-core/NGExtensions/Version index 195a3590..9f7ca49b 100644 --- a/sope-core/NGExtensions/Version +++ b/sope-core/NGExtensions/Version @@ -1,6 +1,6 @@ # version -SUBMINOR_VERSION:=128 +SUBMINOR_VERSION:=129 # v4.3.115 requires libFoundation v1.0.59 # v4.2.72 requires libEOControl v4.2.39 -- 2.39.5