/** GSWResourceManager.m -
GSWeb: Class GSWResourceManager
Copyright (C) 1999-2005 Free Software Foundation, Inc.
Written by: Manuel Guesdon
Date: Jan 1999
$Revision$
$Date$
This file is part of the GNUstep Web Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
#include "config.h"
RCS_ID("$Id$")
#include "GSWeb.h"
//====================================================================
@implementation GSWResourceManager
GSWBundle* globalAppGSWBundle=nil;
GSWProjectBundle* globalAppProjectBundle=nil;
NSDictionary* globalMime=nil;
NSString* globalMimePListPathName=nil;
NSDictionary* localGS2ISOLanguages=nil;
NSDictionary* localISO2GSLanguages=nil;
NSString* globalLanguagesPListPathName=nil;
NSString* localNotFoundMarker=@"NOTFOUND";
//--------------------------------------------------------------------
+(void)initialize
{
if (self==[GSWResourceManager class])
{
NSBundle* mainBundle=nil;
GSWDeployedBundle* deployedBundle=nil;
GSWLogC("Start GSWResourceManager +initialize");
//if ((self=[[super superclass] initialize]))
{
NSString* bundlePath=nil;
mainBundle=[GSWApplication mainBundle];
//NSDebugMLLog(@"resmanager",@"mainBundle:%p",mainBundle);
//NSDebugMLLog(@"resmanager",@"mainBundle:%@",mainBundle);
bundlePath=[mainBundle bundlePath];
//NSDebugMLLog(@"resmanager",@"bundlePath:%@",bundlePath);
deployedBundle=(GSWDeployedBundle*)[GSWDeployedBundle bundleWithPath:bundlePath];
//NSDebugMLLog(@"resmanager",@"deployedBundle:%@",deployedBundle);
globalAppProjectBundle=[[deployedBundle projectBundle] retain];
//NSDebugMLLog(@"resmanager",@"globalAppProjectBundle=%@",globalAppProjectBundle);
NSAssert(globalAppProjectBundle,@"no globalAppProjectBundle");
// LOGDumpObject(globalAppProjectBundle,2);
//call deployedBundle bundlePath
//call globalAppProjectBundle bundlePath
//call isDebuggingEnabled
};
GSWLogC("Stop GSWResourceManager +init");
};
};
//--------------------------------------------------------------------
+(void)dealloc
{
GSWLogC("Dealloc GSWResourceManager Class");
DESTROY(globalAppGSWBundle);
DESTROY(globalAppProjectBundle);
DESTROY(globalMime);
DESTROY(globalMimePListPathName);
DESTROY(localGS2ISOLanguages);
DESTROY(localISO2GSLanguages);
DESTROY(globalLanguagesPListPathName);
GSWLogC("End Dealloc GSWResourceManager Class");
};
//--------------------------------------------------------------------
-(id)init
{
LOGObjectFnStart();
if ((self=[super init]))
{
//TODO NSBundle* mainBundle=[NSBundle mainBundle];
NSArray* allFrameworks=[NSBundle allFrameworks];
int i=0;
int allFrameworksCount=[allFrameworks count];
NSString* bundlePath=nil;
NSBundle* bundle=nil;
NSDictionary* infoDictionary=nil;
for(i=0;i",
object_get_class_name(self),
(void*)self,
(void*)_frameworkProjectBundlesCache,
_appURLs,
_frameworkURLs,
_appPaths,
_frameworkPaths,
_urlValuedElementsData,
_frameworkClassPaths];
}
NS_HANDLER
{
NSDebugMLLog(@"resmanager",@"EXCEPTION:%@ (%@) [%s %d]",
localException,[localException reason],__FILE__,__LINE__);
//TODO
[self unlock];
[localException raise];
}
NS_ENDHANDLER;
[self unlock];
return dscr;
};
//--------------------------------------------------------------------
-(void)_initFrameworkProjectBundles
{
//OK
NSArray* allFrameworks=nil;
int i=0;
int allFrameworksCount=0;
NSBundle* bundle=nil;
NSString* frameworkName=nil;
LOGObjectFnStart();
NSDebugMLLog(@"resmanager",@"globalAppProjectBundle=%@",globalAppProjectBundle);
allFrameworks=[NSBundle allFrameworks];
NSDebugMLLog(@"resmanager",@"allBundles=%@",[NSBundle allBundles]);
NSDebugMLLog(@"resmanager",@"allFrameworks=%@",allFrameworks);
allFrameworksCount=[allFrameworks count];
for(i=0;i