2002-08-04 18:00:11 +00:00
|
|
|
/** GSWComponentDefinition.m - <title>GSWeb: Class GSWComponentDefinition</title>
|
|
|
|
|
|
|
|
Copyright (C) 1999-2002 Free Software Foundation, Inc.
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2002-08-04 18:00:11 +00:00
|
|
|
Written by: Manuel Guesdon <mguesdon@orange-concept.com>
|
|
|
|
Date: Jan 1999
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2002-08-04 18:00:11 +00:00
|
|
|
$Revision$
|
|
|
|
$Date$
|
2002-11-27 20:25:22 +00:00
|
|
|
$Id$
|
2002-08-04 18:00:11 +00:00
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
This file is part of the GNUstep Web Library.
|
|
|
|
|
2002-08-04 18:00:11 +00:00
|
|
|
<license>
|
2000-01-22 12:49:49 +00:00
|
|
|
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.
|
2002-08-04 18:00:11 +00:00
|
|
|
</license>
|
|
|
|
**/
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2003-01-22 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWeb.framework/Makefile.postamble:
o use $(LN_S) -f in install-WO-headers
o added $(MKDIRS) $(GNUSTEP_HEADERS)/$(GSWExtensions_wo_HEADER_FILES_INSTALL_DIR);
* GSWExtensionsGSW.framework/Makefile.postamble: use $(LN_S) -f in install-WO-headers
2003-01-20 David Ayers <d.ayers@inode.at>
* Makefile.postamble
o added support for make gswnames=(gsw,wo,all) (corrected
typo)
o reinserted support for $(INSTALL_ROOT_DIR)
* config.h.in
o added HAVE_GDL2
* configure
o added support for --with-gswnames=(gsw,wo,all)
o set LIBWRAP during configure
o added config.mak.in as configurable file
* configure.ac
o (see configure)
* config.mak: removed (replaced by config.mak.in)
* config.mak.in: new file
o added support for make gswnames=(gsw,wo,all)
* gsweb.make.in
o add GSANTLR as auxiliary lib
o add gsweb libs to AUXILIARY_GSW_LIBS
o include correct extensions for GSW/WO-libs
* gsweb_wo.make: new file
* GSWeb/GSWConfig.h
o changed support for GSWEB_WONAMES
o conditionally import file GSWWOCompatiblity
here instead of in GSWeb.h
* GSWeb/GNUMakefile
o added support for make gswnames=(gsw,wo,all)
o ensure each lib gets built with its own object files
o removed deactivated framework extension determination code
o removed reference to unused files:
GSWeb.m, GSWWOCompatibility.m
o added references to new files:
GSWExtenstions.h, GSWExtWOCompatibility.h
o added support to create WO header files
* GSWeb/Makefile.postamble
o changed support to install WO header files according to
make gswnames=(gsw,wo,all)
o remove Makefile.preamble during distclean
* GSWeb/Makefile.preamble.in
o fixed typo
* GSWeb/GSWeb.h
o moved GSW/WO-Name-mapping to GSWWOCompatibility.h
o replaced inclusions of
<GSWeb/file.h> with "file.h"
* GSWeb/GSWeb.m: removed
* GSWeb/GSWWOCompatibility.h
o changed GSWEB_WONAMES handling
o removed hybrid namespace WO subclasses
o moved & reorganized GSW/WO-Name-mapping from GSWeb.h
o inlucluded missing GSW/WO-Name-mappings
* GSWeb/GSWWOCompatibility.m: removed
* GSWeb/*.m
o replaced inclusions of
<GSWeb/file.h> with "file.h"
* GSWeb/GSWApplication.m
o remove special GSW/WO handling of WOApp
* GSWeb/WebObject/WO*: removed
* GSWeb/WebObject/WebObjects
o replaced inclusions of
<GSWeb/file.h> with "file.h"
* GSWExtensions/GNUMakefile
o added support for make gswnames=(gsw,wo,all)
o ensure each lib gets built with its own object files
o removed deactivated framework extension determination code
o added references to new files:
GSWExtenstions.h, GSWExtWOCompatibility.h
o added support to create WO header files
* GSWExtensions/Makefile.preamble
o let gnustep make figure whether to link agains debug libs
o added support for make gswnames=(gsw,wo,all)
* GSWExtensions/Makefile.postamble
o changed support to install WO header files according to
make gswnames=(gsw,wo,all)
* GSWExtensions/*.m
o replaced inclusions of
<GSWeb/GSWeb.h> with "GSWExtWOCompatibility.h"
o replaces inclusions of
<GSWExtensions/file.h> with "file.h"
* GSWExtensions/GSWExtensions.h: new file
* GSWExtensions/WOExtensions.h: new file
* GSWExtensions/GSWExtWOCompatibility.h: new file
* GSWExtensionsGSW/GNUMakefile
o added support for make gswnames=(gsw,wo,all)
o ensure each lib gets built with its own object files
o removed deactivated framework extension determination code
o added references to new file GSWExtGSWWOCompatibility.h
o added support to create WO header files
* GSWExtensionsGSW/Makefile.pramble
o let gnustep make figure whether to link agains debug libs
o added support for make gswnames=(gsw,wo,all)
o removed GSWExtensions from ADDITIONAL_LIB_DIRS
* GSWExtensionsGSW/*.m
o replaced inclusions of
<GSWeb/GSWeb.h> with "GSWExtGSWWOCompatibility.h"
* GSWExtensions/GSWExtGSWWOCompatibility.h: new file
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@15675 72102866-910b-0410-8b05-ffd578937521
2003-01-22 12:24:26 +00:00
|
|
|
#include "GSWeb.h"
|
2010-06-05 21:08:12 +00:00
|
|
|
#include <GNUstepBase/NSObject+GNUstepBase.h>
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//====================================================================
|
2007-04-13 18:32:02 +00:00
|
|
|
|
|
|
|
/* Static variables */
|
|
|
|
|
|
|
|
static NSLock * ComponentConstructorLock;
|
|
|
|
static NSLock * TemplateLock;
|
|
|
|
static GSWContext * TheTemporaryContext;
|
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
@implementation GSWComponentDefinition
|
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
+ (void) initialize
|
|
|
|
{
|
|
|
|
if (self == [GSWComponentDefinition class]) {
|
|
|
|
ComponentConstructorLock = [[NSLock alloc] init];
|
|
|
|
TemplateLock = [[NSLock alloc] init];
|
|
|
|
TheTemporaryContext = nil;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// that Method is used INTERNAL.
|
|
|
|
+ (GSWContext *) TheTemporaryContext
|
|
|
|
{
|
|
|
|
return TheTemporaryContext;
|
|
|
|
}
|
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
//--------------------------------------------------------------------
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2008-08-20 20:32:10 +00:00
|
|
|
// CHECKME: missing Languages?
|
2007-04-13 18:32:02 +00:00
|
|
|
// we my have a different name and class?
|
|
|
|
// aName StartPage
|
|
|
|
// aPath /Users/dave/projects/new/PBXBilling/trunk/PBX.gswa/Resources/StartPage.wo
|
|
|
|
// baseURL /WebObjects/PBX.gswa/Resources/StartPage.wo
|
|
|
|
|
2002-08-04 18:00:11 +00:00
|
|
|
-(id)initWithName:(NSString*)aName
|
|
|
|
path:(NSString*)aPath
|
|
|
|
baseURL:(NSString*)baseURL
|
|
|
|
frameworkName:(NSString*)aFrameworkName
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
NSString * myBasePath = nil;
|
|
|
|
NSFileManager * defaultFileManager = nil;
|
|
|
|
|
|
|
|
[super init];
|
|
|
|
ASSIGN(_name, [aName stringByDeletingPathExtension]); // does it ever happen that
|
|
|
|
ASSIGN(_className, aName); // those are different? dw.
|
|
|
|
_componentClass = NSClassFromString(_className);
|
|
|
|
ASSIGN(_path, aPath);
|
|
|
|
ASSIGN(_url, baseURL);
|
|
|
|
ASSIGN(_frameworkName, aFrameworkName);
|
|
|
|
DESTROY(_language);
|
|
|
|
_hasBeenAccessed = NO;
|
|
|
|
_hasContextConstructor = NO;
|
|
|
|
_isStateless = NO;
|
|
|
|
DESTROY(_instancePool);
|
|
|
|
_instancePool = [NSMutableArray new];
|
|
|
|
_lockInstancePool = [GSWApp isConcurrentRequestHandlingEnabled];
|
|
|
|
|
|
|
|
if ((_name != nil) && (_frameworkName != nil)) {
|
|
|
|
NSBundle * nsbundle = [NSBundle bundleForClass:NSClassFromString(_className)];
|
|
|
|
if (nsbundle != nil) {
|
|
|
|
_componentClass = NSClassFromString(_className);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
myBasePath = [aPath stringByAppendingPathComponent: aName];
|
|
|
|
ASSIGN(_htmlPath,[myBasePath stringByAppendingPathExtension:@"html"]);
|
|
|
|
ASSIGN(_wodPath,[myBasePath stringByAppendingPathExtension:GSWComponentDeclarationsSuffix[GSWebNamingConv]]);
|
|
|
|
ASSIGN(_wooPath,[myBasePath stringByAppendingPathExtension:GSWArchiveSuffix[GSWebNamingConv]]);
|
|
|
|
|
|
|
|
defaultFileManager = [NSFileManager defaultManager];
|
|
|
|
|
|
|
|
if (_componentClass == Nil) {
|
|
|
|
[self autorelease];
|
|
|
|
NSLog(@"%s: No component class for component named '%@' found", __PRETTY_FUNCTION__, _name);
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
// if (([defaultFileManager fileExistsAtPath: _htmlPath] == NO) ||
|
|
|
|
// ([defaultFileManager fileExistsAtPath: _wodPath] == NO) ||
|
|
|
|
// ([defaultFileManager fileExistsAtPath: _wooPath] == NO) ||
|
|
|
|
// (_componentClass == Nil)) {
|
|
|
|
//
|
|
|
|
// [NSException raise:NSInvalidArgumentException
|
|
|
|
// format:@"%s: No template found for component named '%@'",
|
|
|
|
// __PRETTY_FUNCTION__, _name];
|
|
|
|
// }
|
|
|
|
_archive = nil;
|
|
|
|
_encoding = NSUTF8StringEncoding;
|
|
|
|
_template = nil;
|
|
|
|
[self setCachingEnabled:[[GSWApp class] isCachingEnabled]];
|
|
|
|
_isAwake = NO;
|
|
|
|
if (_frameworkName == nil) {
|
2002-08-04 18:00:11 +00:00
|
|
|
_bundle=[[GSWBundle alloc] initWithPath:aPath
|
|
|
|
baseURL:baseURL
|
2007-04-13 18:32:02 +00:00
|
|
|
inFrameworkNamed: nil];
|
|
|
|
} else {
|
|
|
|
_bundle=[[GSWBundle alloc] initWithPath:aPath
|
|
|
|
baseURL:baseURL
|
|
|
|
inFrameworkNamed: _frameworkName];
|
|
|
|
if (_bundle == nil)
|
|
|
|
{
|
|
|
|
[NSException raise:NSInvalidArgumentException
|
|
|
|
format:@"%s: No framework named '%@'",
|
|
|
|
__PRETTY_FUNCTION__, _frameworkName];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_instancePoolLock = [[NSLock alloc] init];
|
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
return self;
|
2007-04-13 18:32:02 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(void)dealloc
|
|
|
|
{
|
2002-08-04 18:00:11 +00:00
|
|
|
DESTROY(_name);
|
2007-04-13 18:32:02 +00:00
|
|
|
DESTROY(_path);
|
|
|
|
DESTROY(_url);
|
2002-08-04 18:00:11 +00:00
|
|
|
DESTROY(_frameworkName);
|
2007-04-13 18:32:02 +00:00
|
|
|
DESTROY(_language);
|
|
|
|
DESTROY(_className);
|
|
|
|
_componentClass = Nil;
|
|
|
|
DESTROY(_template);
|
|
|
|
DESTROY(_htmlPath);
|
|
|
|
DESTROY(_wodPath);
|
|
|
|
DESTROY(_wooPath);
|
|
|
|
DESTROY(_archive);
|
|
|
|
DESTROY(_bundle);
|
|
|
|
DESTROY(_sharedInstance);
|
|
|
|
DESTROY(_instancePool);
|
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
[super dealloc];
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2007-04-13 18:32:02 +00:00
|
|
|
|
|
|
|
- (void) checkInComponentInstance:(GSWComponent*) component
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
if (_sharedInstance == nil)
|
|
|
|
{
|
|
|
|
_sharedInstance = component;
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
[_instancePool addObject:component];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) _checkInComponentInstance:(GSWComponent*) component
|
|
|
|
{
|
|
|
|
BOOL locked = NO;
|
|
|
|
|
|
|
|
if (_lockInstancePool) {
|
|
|
|
NS_DURING
|
|
|
|
[_instancePoolLock lock];
|
|
|
|
locked = YES;
|
|
|
|
[self checkInComponentInstance: component];
|
|
|
|
locked = NO;
|
|
|
|
[_instancePoolLock unlock];
|
|
|
|
|
|
|
|
NS_HANDLER
|
|
|
|
if (locked) {
|
|
|
|
[_instancePoolLock unlock];
|
|
|
|
}
|
|
|
|
localException=[localException exceptionByAddingUserInfoFrameInfoFormat:@"In %s",
|
|
|
|
__PRETTY_FUNCTION__];
|
|
|
|
[localException raise];
|
|
|
|
NS_ENDHANDLER;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
[self checkInComponentInstance: component];
|
|
|
|
}
|
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(NSString*)frameworkName
|
|
|
|
{
|
2002-08-04 18:00:11 +00:00
|
|
|
return _frameworkName;
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(NSString*)baseURL
|
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
return _url;
|
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(NSString*)path
|
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
return _path;
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(NSString*)name
|
|
|
|
{
|
2002-08-04 18:00:11 +00:00
|
|
|
return _name;
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(NSString*)description
|
|
|
|
{
|
|
|
|
//TODO
|
2007-04-13 18:32:02 +00:00
|
|
|
return [NSString stringWithFormat:@"<%s %p - name:[%@] bundle:[%@] frameworkName=[%@] componentClass=[%@] isCachingEnabled=[%s] isAwake=[%s]>",
|
2010-04-22 04:28:50 +00:00
|
|
|
object_getClassName(self),
|
2000-01-22 12:49:49 +00:00
|
|
|
(void*)self,
|
2002-08-04 18:00:11 +00:00
|
|
|
_name,
|
|
|
|
_bundle,
|
|
|
|
_frameworkName,
|
|
|
|
_componentClass,
|
2007-04-13 18:32:02 +00:00
|
|
|
_caching ? "YES" : "NO",
|
2002-08-04 18:00:11 +00:00
|
|
|
_isAwake ? "YES" : "NO"];
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(void)sleep
|
|
|
|
{
|
|
|
|
//OK
|
2002-08-04 18:00:11 +00:00
|
|
|
_isAwake=NO;
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2007-04-13 18:32:02 +00:00
|
|
|
// dw
|
2000-01-22 12:49:49 +00:00
|
|
|
-(void)awake
|
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
if (!_isAwake) {
|
|
|
|
_isAwake = YES;
|
|
|
|
if (! _caching) {
|
|
|
|
[self componentClass];
|
|
|
|
}
|
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(BOOL)isCachingEnabled
|
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
return _caching;
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2002-08-04 18:00:11 +00:00
|
|
|
-(void)setCachingEnabled:(BOOL)flag
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
_caching = flag;
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
-(void)_clearCache
|
|
|
|
{
|
|
|
|
//OK
|
2002-08-04 18:00:11 +00:00
|
|
|
[_bundle clearCache];
|
2008-08-20 20:32:10 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2002-08-04 18:00:11 +00:00
|
|
|
-(GSWElement*)templateWithName:(NSString*)aName
|
|
|
|
languages:(NSArray*)languages
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-08-04 18:00:11 +00:00
|
|
|
GSWElement* element=nil;
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-08-04 18:00:11 +00:00
|
|
|
element=[_bundle templateNamed:aName
|
|
|
|
languages:languages];
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
return element;
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2002-08-04 18:00:11 +00:00
|
|
|
-(NSString*)pathForResourceNamed:(NSString*)aName
|
|
|
|
ofType:(NSString*)aType
|
|
|
|
languages:(NSArray*)languages
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2002-08-04 18:00:11 +00:00
|
|
|
NSString* path=nil;
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-08-04 18:00:11 +00:00
|
|
|
path=[_bundle pathForResourceNamed:aName
|
|
|
|
ofType:aType
|
|
|
|
languages:languages];
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-08-04 18:00:11 +00:00
|
|
|
return path;
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-08-20 20:32:10 +00:00
|
|
|
// CHECKME
|
2000-01-22 12:49:49 +00:00
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
-(GSWComponent*) _componentInstanceInContext:(GSWContext*) aContext
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
Class myClass = [self componentClass];
|
|
|
|
GSWComponent * component = nil;
|
|
|
|
IMP instanceInitIMP = NULL;
|
|
|
|
IMP componentInitIMP = NULL;
|
|
|
|
GSWComponent * myInstance = nil;
|
|
|
|
BOOL locked = NO;
|
|
|
|
|
2010-04-14 13:20:16 +00:00
|
|
|
if ([myClass isSubclassOfClass: [GSWComponent class]]) {
|
2007-04-13 18:32:02 +00:00
|
|
|
[aContext _setComponentName:_className];
|
|
|
|
}
|
|
|
|
[aContext _setTempComponentDefinition:self];
|
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
NS_DURING
|
2007-04-13 18:32:02 +00:00
|
|
|
|
|
|
|
if (!_hasBeenAccessed) {
|
|
|
|
myInstance = [myClass alloc];
|
|
|
|
instanceInitIMP = [myInstance methodForSelector:@selector(init)];
|
|
|
|
componentInitIMP = [GSWComponent instanceMethodForSelector:@selector(init)];
|
|
|
|
|
|
|
|
if (instanceInitIMP != componentInitIMP) {
|
2010-04-22 04:28:50 +00:00
|
|
|
// NSLog(@"Class %s should implement initWithContext: and not init", object_getClassName(myClass));
|
2007-04-13 18:32:02 +00:00
|
|
|
[ComponentConstructorLock lock];
|
|
|
|
locked = YES;
|
|
|
|
TheTemporaryContext = aContext;
|
|
|
|
component = AUTORELEASE([myInstance init]);
|
|
|
|
TheTemporaryContext = nil;
|
|
|
|
locked = NO;
|
|
|
|
_hasContextConstructor = NO;
|
|
|
|
[ComponentConstructorLock unlock];
|
|
|
|
} else {
|
|
|
|
component = AUTORELEASE([myInstance initWithContext: aContext]);
|
|
|
|
_hasContextConstructor = YES;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// check if we can use some intelligent caching here.
|
|
|
|
myInstance = [myClass alloc];
|
|
|
|
|
|
|
|
if (_hasContextConstructor == NO) {
|
|
|
|
[ComponentConstructorLock lock];
|
|
|
|
locked = YES;
|
|
|
|
TheTemporaryContext = aContext;
|
|
|
|
component = AUTORELEASE([myInstance init]);
|
|
|
|
TheTemporaryContext = nil;
|
|
|
|
locked = NO;
|
|
|
|
[ComponentConstructorLock unlock];
|
|
|
|
} else {
|
|
|
|
component = AUTORELEASE([myInstance initWithContext: aContext]);
|
|
|
|
}
|
2002-08-04 18:00:11 +00:00
|
|
|
}
|
2000-01-22 12:49:49 +00:00
|
|
|
NS_HANDLER
|
2007-04-13 18:32:02 +00:00
|
|
|
if (locked) {
|
|
|
|
[ComponentConstructorLock unlock];
|
|
|
|
}
|
|
|
|
localException=[localException exceptionByAddingUserInfoFrameInfoFormat:@"In %s",
|
|
|
|
__PRETTY_FUNCTION__];
|
2002-08-04 18:00:11 +00:00
|
|
|
[localException raise];
|
2000-01-22 12:49:49 +00:00
|
|
|
NS_ENDHANDLER;
|
2007-04-13 18:32:02 +00:00
|
|
|
|
|
|
|
if ([component context] == nil) {
|
|
|
|
[NSException raise:NSInvalidArgumentException
|
|
|
|
format:@"Component '%@' was not properly initialized. Make sure [super initWithContext:] is called. In %s",
|
|
|
|
_className,
|
|
|
|
__PRETTY_FUNCTION__];
|
|
|
|
}
|
|
|
|
return component;
|
|
|
|
}
|
2002-11-18 11:14:55 +00:00
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
- (BOOL) isStateless
|
|
|
|
{
|
|
|
|
return _isStateless;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// this is called when we are already holding a lock.
|
|
|
|
|
|
|
|
-(GSWComponent*) _sharedInstanceInContext:(GSWContext*)aContext
|
|
|
|
{
|
|
|
|
GSWComponent * component = nil;
|
|
|
|
|
|
|
|
if (_sharedInstance != nil) {
|
|
|
|
component = _sharedInstance;
|
|
|
|
_sharedInstance = nil;
|
|
|
|
} else {
|
|
|
|
if ([_instancePool count] > 0) {
|
|
|
|
component = AUTORELEASE(RETAIN([_instancePool lastObject]));
|
|
|
|
[_instancePool removeLastObject];
|
|
|
|
} else {
|
|
|
|
component = [self _componentInstanceInContext:aContext];
|
|
|
|
}
|
|
|
|
}
|
2002-08-04 18:00:11 +00:00
|
|
|
return component;
|
2007-04-13 18:32:02 +00:00
|
|
|
}
|
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2007-04-13 18:32:02 +00:00
|
|
|
-(GSWComponent*)componentInstanceInContext:(GSWContext*)aContext
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2007-04-13 18:32:02 +00:00
|
|
|
GSWComponent* component=nil;
|
|
|
|
BOOL locked = NO;
|
|
|
|
|
|
|
|
if (aContext == nil) {
|
|
|
|
[NSException raise:NSInvalidArgumentException
|
|
|
|
format:@"Attempt to create component instance without a context. In %s",
|
|
|
|
__PRETTY_FUNCTION__];
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_DURING
|
|
|
|
|
|
|
|
if (!_hasBeenAccessed) {
|
|
|
|
component = [self _componentInstanceInContext: aContext];
|
|
|
|
_isStateless = [component isStateless];
|
|
|
|
_hasBeenAccessed = YES;
|
|
|
|
} else {
|
|
|
|
if (_isStateless) {
|
|
|
|
if (_lockInstancePool) {
|
|
|
|
[_instancePoolLock lock];
|
|
|
|
locked = YES;
|
|
|
|
component = [self _sharedInstanceInContext:aContext];
|
|
|
|
locked = NO;
|
|
|
|
[_instancePoolLock unlock];
|
|
|
|
} else {
|
|
|
|
component = [self _sharedInstanceInContext:aContext];
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
component = [self _componentInstanceInContext:aContext];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_HANDLER
|
|
|
|
|
|
|
|
localException=[localException exceptionByAddingUserInfoFrameInfoFormat:@"In %s",
|
|
|
|
__PRETTY_FUNCTION__];
|
|
|
|
if (_lockInstancePool && locked) {
|
|
|
|
[_instancePoolLock unlock];
|
|
|
|
}
|
|
|
|
[localException raise];
|
|
|
|
|
|
|
|
NS_ENDHANDLER;
|
|
|
|
|
|
|
|
return component;
|
|
|
|
}
|
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2002-11-18 11:14:55 +00:00
|
|
|
/** Find the class of the component **/
|
2007-04-13 18:32:02 +00:00
|
|
|
-(Class) componentClass
|
|
|
|
{
|
|
|
|
Class componentClass = Nil;
|
|
|
|
|
|
|
|
if (_componentClass) {
|
|
|
|
return _componentClass;
|
|
|
|
}
|
|
|
|
|
|
|
|
componentClass = _componentClass;
|
|
|
|
if (!componentClass) {
|
2002-08-04 18:00:11 +00:00
|
|
|
componentClass=NSClassFromString(_name);//???
|
2007-04-13 18:32:02 +00:00
|
|
|
}
|
2002-11-18 11:14:55 +00:00
|
|
|
if (!componentClass) // There's no class with that name
|
2002-08-04 18:00:11 +00:00
|
|
|
{
|
|
|
|
BOOL createClassesOk=NO;
|
|
|
|
NSString* superClassName=nil;
|
|
|
|
if (!WOStrictFlag)
|
|
|
|
{
|
2002-11-18 11:14:55 +00:00
|
|
|
// Search component archive for a superclass (superClassName keyword)
|
2002-08-04 18:00:11 +00:00
|
|
|
NSDictionary* archive=[_bundle archiveNamed:_name];
|
|
|
|
superClassName=[archive objectForKey:@"superClassName"];
|
|
|
|
if (superClassName)
|
2001-03-11 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWeb.framework/GSWWOCompatibility.h/.m: added
* GSWeb.framework/GNUmakefile: added GSWWOCompatibility.h/.m
* GSWeb.framework/GSWApplication.h/m: added WOApplicationMain, handle WO/GSWeb names
* GSWeb.framework/GSWContext.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWConstants.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWDynamicURLString.m: handle WO/GSWeb names
* GSWeb.framework/GSWProjectBundle.m/.h: handle WO/GSWeb names, suppress warnings
* GSWeb.framework/GSWSession.m: handle WO/GSWeb names
* GSWeb.framework/GSWRequest.m: handle WO/GSWeb names
* GSWeb.framework/GSWTemplateParser.m: handle WO/GSWeb names,
added tag counts to help errors hunt
* GSWeb.framework/GSWBundle.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWResourceManager.m: handle WO/GSWeb names
* GSWeb.framework/GSWURLValuedElementData.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponentRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWDirectAction.m: handle WO/GSWeb names
* GSWeb.framework/GSWForm.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWHyperlink.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWResourceRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWDirectActionRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWActiveImage.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWBindingNameAssociation.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWBrowser.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponent.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWHTMLURLValuedElement.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWImageButton.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWInput.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWPopUpButton.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWString.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWAssociation.m: handle WO/GSWeb names
* GSWeb.framework/GSWCheckBox.m: handle WO/GSWeb names
* GSWeb.framework/GSWCheckBoxList.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponentDefinition.m: handle WO/GSWeb names
* GSWeb.framework/GSWRadioButton.m: handle WO/GSWeb names
* GSWeb.framework/GSWRadioButtonList.m: handle WO/GSWeb names
* GSWeb.framework/GSWText.m: handle WO/GSWeb names
* GSWeb.framework/GSWTextField.m: handle WO/GSWeb names
* GSWeb.framework/GSWDeployedBundle.m: warnings
* GSWeb.framework/GSWeb.h: added include GSWeb/GSWSessionTimeOut.h, GSWWOCompatibility.h
* GSWeb.framework/GSWAdaptor.m: traces
* GSWeb.framework/GSWDefaultAdaptor.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWDefaultAdaptorThread.m/.h: handle WO/GSWeb names
* GSWeb.framework/NSNonBlockingFileHandle.m: added traces
* GSWeb.framework/GSWTemplateParserANTLR.m: handle WO/GSWeb names
* GSWeb.framework/GSWTemplateParserXML.m: handle WO/GSWeb names
added tag count to help errors hunt
remove "Tag gsweb invalid" message
handle unicode strings in node content traces
remove html and body tags if they are not present in the template
* GSWeb.framework/GSWTemplateParseXML.h: added ivar _isHTMLTag, _isBodyTag
* GSWeb.framework/GSWSessionTimeOutManager.m: dealloc sessionOrderedTimeOuts instead
of deallocating 2 times sessionTimeOuts
* GSWExtensions.framework/French.lproj/GSWSessionRestorationErrorPage.gswc/GSWSessionRestorationErrorPage.html:
tag mismatch, Encode french characters
* GSWExtensions.framework/GSWSessionRestorationErrorPage.gswc/GSWSessionRestorationErrorPage.html:
tag mismatch
* GSWHTMLBareString.m: handle unicode strings in description
* GSWExtensions.framework/French.lproj/GSWExceptionPage.gswc/GSWExceptionPage.html:
Encode french characters, Tag Mismatch
* GSWExtensions.framework/French.lproj/GSWPageRestorationErrorPage.gswc/GSWPageRestorationErrorPage.html:
Encode french characters
* GSWExtensions.framework/French.lproj/GSWSessionCreationErrorPage.gswc/GSWSessionCreationErrorPage.html:
Encode french characters
* GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.html:
Tag Mismatch
* GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.gswd:
added convertHTMLEntities for strings
* GSWeb.framework/GSWRepetition.m: added traces, fix "count" property bug, standardize ivars
* GSWeb.framework/NSObject+IVarAccess+PerformSel.m: added traces, handle underscored ivars search
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@9332 72102866-910b-0410-8b05-ffd578937521
2001-03-11 17:15:44 +00:00
|
|
|
{
|
2002-08-04 18:00:11 +00:00
|
|
|
if (!NSClassFromString(superClassName))
|
|
|
|
{
|
|
|
|
ExceptionRaise(NSGenericException,@"Superclass %@ of component %@ doesn't exist",
|
|
|
|
superClassName,
|
|
|
|
_name);
|
|
|
|
};
|
2001-03-11 Manuel Guesdon <mguesdon@orange-concept.com>
* GSWeb.framework/GSWWOCompatibility.h/.m: added
* GSWeb.framework/GNUmakefile: added GSWWOCompatibility.h/.m
* GSWeb.framework/GSWApplication.h/m: added WOApplicationMain, handle WO/GSWeb names
* GSWeb.framework/GSWContext.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWConstants.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWDynamicURLString.m: handle WO/GSWeb names
* GSWeb.framework/GSWProjectBundle.m/.h: handle WO/GSWeb names, suppress warnings
* GSWeb.framework/GSWSession.m: handle WO/GSWeb names
* GSWeb.framework/GSWRequest.m: handle WO/GSWeb names
* GSWeb.framework/GSWTemplateParser.m: handle WO/GSWeb names,
added tag counts to help errors hunt
* GSWeb.framework/GSWBundle.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWResourceManager.m: handle WO/GSWeb names
* GSWeb.framework/GSWURLValuedElementData.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponentRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWDirectAction.m: handle WO/GSWeb names
* GSWeb.framework/GSWForm.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWHyperlink.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWResourceRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWDirectActionRequestHandler.m: handle WO/GSWeb names
* GSWeb.framework/GSWActiveImage.m/.h: handle WO/GSWeb names
* GSWeb.framework/GSWBindingNameAssociation.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWBrowser.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponent.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWHTMLURLValuedElement.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWImageButton.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWInput.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWPopUpButton.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWString.h/.m: handle WO/GSWeb names
* GSWeb.framework/GSWAssociation.m: handle WO/GSWeb names
* GSWeb.framework/GSWCheckBox.m: handle WO/GSWeb names
* GSWeb.framework/GSWCheckBoxList.m: handle WO/GSWeb names
* GSWeb.framework/GSWComponentDefinition.m: handle WO/GSWeb names
* GSWeb.framework/GSWRadioButton.m: handle WO/GSWeb names
* GSWeb.framework/GSWRadioButtonList.m: handle WO/GSWeb names
* GSWeb.framework/GSWText.m: handle WO/GSWeb names
* GSWeb.framework/GSWTextField.m: handle WO/GSWeb names
* GSWeb.framework/GSWDeployedBundle.m: warnings
* GSWeb.framework/GSWeb.h: added include GSWeb/GSWSessionTimeOut.h, GSWWOCompatibility.h
* GSWeb.framework/GSWAdaptor.m: traces
* GSWeb.framework/GSWDefaultAdaptor.m: handle WO/GSWeb names, added traces
* GSWeb.framework/GSWDefaultAdaptorThread.m/.h: handle WO/GSWeb names
* GSWeb.framework/NSNonBlockingFileHandle.m: added traces
* GSWeb.framework/GSWTemplateParserANTLR.m: handle WO/GSWeb names
* GSWeb.framework/GSWTemplateParserXML.m: handle WO/GSWeb names
added tag count to help errors hunt
remove "Tag gsweb invalid" message
handle unicode strings in node content traces
remove html and body tags if they are not present in the template
* GSWeb.framework/GSWTemplateParseXML.h: added ivar _isHTMLTag, _isBodyTag
* GSWeb.framework/GSWSessionTimeOutManager.m: dealloc sessionOrderedTimeOuts instead
of deallocating 2 times sessionTimeOuts
* GSWExtensions.framework/French.lproj/GSWSessionRestorationErrorPage.gswc/GSWSessionRestorationErrorPage.html:
tag mismatch, Encode french characters
* GSWExtensions.framework/GSWSessionRestorationErrorPage.gswc/GSWSessionRestorationErrorPage.html:
tag mismatch
* GSWHTMLBareString.m: handle unicode strings in description
* GSWExtensions.framework/French.lproj/GSWExceptionPage.gswc/GSWExceptionPage.html:
Encode french characters, Tag Mismatch
* GSWExtensions.framework/French.lproj/GSWPageRestorationErrorPage.gswc/GSWPageRestorationErrorPage.html:
Encode french characters
* GSWExtensions.framework/French.lproj/GSWSessionCreationErrorPage.gswc/GSWSessionCreationErrorPage.html:
Encode french characters
* GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.html:
Tag Mismatch
* GSWExtensions.framework/GSWExceptionPage.gswc/GSWExceptionPage.gswd:
added convertHTMLEntities for strings
* GSWeb.framework/GSWRepetition.m: added traces, fix "count" property bug, standardize ivars
* GSWeb.framework/NSObject+IVarAccess+PerformSel.m: added traces, handle underscored ivars search
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@9332 72102866-910b-0410-8b05-ffd578937521
2001-03-11 17:15:44 +00:00
|
|
|
};
|
2002-08-04 18:00:11 +00:00
|
|
|
};
|
2002-11-18 11:14:55 +00:00
|
|
|
// If we haven't found a superclass, use GSWComponent as the superclass
|
2002-08-04 18:00:11 +00:00
|
|
|
if (!superClassName)
|
|
|
|
superClassName=@"GSWComponent";
|
2002-11-18 11:14:55 +00:00
|
|
|
// Create class
|
2002-08-04 18:00:11 +00:00
|
|
|
createClassesOk=[GSWApplication createUnknownComponentClasses:[NSArray arrayWithObject:_name]
|
|
|
|
superClassName:superClassName];
|
2002-11-18 11:14:55 +00:00
|
|
|
|
|
|
|
// Use it
|
2002-08-04 18:00:11 +00:00
|
|
|
componentClass=NSClassFromString(_name);
|
|
|
|
};
|
2002-11-18 11:14:55 +00:00
|
|
|
//call GSWApp isCaching
|
2007-04-13 18:32:02 +00:00
|
|
|
_componentClass=componentClass;
|
|
|
|
|
2002-08-04 18:00:11 +00:00
|
|
|
return componentClass;
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2002-08-04 18:00:11 +00:00
|
|
|
-(GSWComponentReference*)componentReferenceWithAssociations:(NSDictionary*)associations
|
|
|
|
template:(GSWElement*)template
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
|
|
|
//OK
|
2002-08-04 18:00:11 +00:00
|
|
|
GSWComponentReference* componentReference=nil;
|
|
|
|
componentReference=[[[GSWComponentReference alloc]initWithName:_name
|
|
|
|
associations:associations
|
|
|
|
template:template] autorelease];
|
|
|
|
return componentReference;
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//NDFN
|
|
|
|
-(NSDictionary*)componentAPI
|
|
|
|
{
|
2002-08-04 18:00:11 +00:00
|
|
|
NSDictionary* componentAPI=nil;
|
|
|
|
componentAPI=[_bundle apiNamed:_name];
|
2007-04-13 18:32:02 +00:00
|
|
|
|
2002-08-04 18:00:11 +00:00
|
|
|
return componentAPI;
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2007-04-13 18:32:02 +00:00
|
|
|
-(void) finishInitializingComponent:(GSWComponent*)component
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
|
|
|
//OK
|
2002-08-04 18:00:11 +00:00
|
|
|
NSDictionary* archive=nil;
|
|
|
|
archive=[_bundle archiveNamed:_name];
|
|
|
|
[_bundle initializeObject:component
|
|
|
|
fromArchive:archive];
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2002-08-04 18:00:11 +00:00
|
|
|
-(void)_notifyObserversForDyingComponent:(GSWComponent*)aComponent
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2010-06-05 21:08:12 +00:00
|
|
|
[self notImplemented: _cmd]; //TODOFN
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2002-08-04 18:00:11 +00:00
|
|
|
-(void)_awakeObserversForComponent:(GSWComponent*)aComponent
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2010-06-05 21:08:12 +00:00
|
|
|
[self notImplemented: _cmd]; //TODOFN
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2002-08-04 18:00:11 +00:00
|
|
|
-(void)_deallocForComponent:(GSWComponent*)aComponent
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2010-06-05 21:08:12 +00:00
|
|
|
[self notImplemented: _cmd]; //TODOFN
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2002-08-04 18:00:11 +00:00
|
|
|
-(void)_awakeForComponent:(GSWComponent*)aComponent
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2010-06-05 21:08:12 +00:00
|
|
|
[self notImplemented: _cmd]; //TODOFN
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2002-08-04 18:00:11 +00:00
|
|
|
-(void)_registerObserver:(id)observer
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2010-06-05 21:08:12 +00:00
|
|
|
[self notImplemented: _cmd]; //TODOFN
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
2002-08-04 18:00:11 +00:00
|
|
|
+(void)_registerObserver:(id)observer
|
2000-01-22 12:49:49 +00:00
|
|
|
{
|
2010-06-05 21:08:12 +00:00
|
|
|
[self notImplemented: _cmd]; //TODOFN
|
2000-01-22 12:49:49 +00:00
|
|
|
};
|
|
|
|
|
2007-04-13 18:32:02 +00:00
|
|
|
- (GSWElement *) template
|
|
|
|
{
|
|
|
|
BOOL htmlChangedOnDisk = NO;
|
|
|
|
BOOL wodChangedOnDisk = NO;
|
|
|
|
BOOL doCache = [self isCachingEnabled];
|
|
|
|
|
|
|
|
if (doCache == NO) {
|
|
|
|
htmlChangedOnDisk = YES; // todo compare last chage date with load date
|
|
|
|
if (_htmlPath != nil && !htmlChangedOnDisk) {
|
|
|
|
wodChangedOnDisk = YES; // todo compare last chage date with load date
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_htmlPath != nil && (_template == nil || htmlChangedOnDisk || wodChangedOnDisk)) {
|
|
|
|
NS_DURING
|
|
|
|
[TemplateLock lock];
|
|
|
|
DESTROY(_template);
|
|
|
|
|
|
|
|
_template = RETAIN([_bundle templateNamed: _name
|
|
|
|
languages:nil]); // _language? array?
|
|
|
|
[TemplateLock unlock];
|
|
|
|
NS_HANDLER
|
|
|
|
DESTROY(_template);
|
|
|
|
[TemplateLock unlock];
|
|
|
|
[localException raise];
|
|
|
|
NS_ENDHANDLER
|
|
|
|
|
|
|
|
}
|
|
|
|
return _template;
|
|
|
|
}
|
|
|
|
|
2008-08-20 20:32:10 +00:00
|
|
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
|
|
|
{
|
2010-06-05 21:08:12 +00:00
|
|
|
[self notImplemented: _cmd];
|
2008-08-20 20:32:10 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
|
|
|
{
|
2010-06-05 21:08:12 +00:00
|
|
|
[self notImplemented: _cmd];
|
2008-08-20 20:32:10 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) copyWithZone: (NSZone*)z
|
|
|
|
{
|
|
|
|
|
2010-06-05 21:08:12 +00:00
|
|
|
[self notImplemented: _cmd];
|
2008-08-20 20:32:10 +00:00
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2000-01-22 12:49:49 +00:00
|
|
|
@end
|