cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <stef...@apache.org>
Subject Re: Configuration Patterns and Sitemap Generation
Date Tue, 24 Oct 2000 09:38:28 GMT
Berin Loritsch wrote:
> 
> I noticed that the compiled sitemap idea can be improved
> now that the new Avalon is integrated.  I will enumerate
> the methods, and it might be that the Sitemap no longer
> needs compilation.
> 
> 1) configure() passes the configuration object to the
>    parent, and then proceeded to create a bunch of
>    SAX events to feed the SAXConfigurationBuilder and
>    build a new Configuration object.
> 
> This is no longer necessary.  The purpose of the
> Configure method is to configure *this* object.
> Avalon includes a DefaultConfiguration object where
> you can directly build Configuration trees.  This results
> in much cleaner code already.
> 
> However, a Sitemap object only needs to read the
> Configuration tree and create the matchers, transformers,
> serializers, readers, and other components.
> 
> 2) There are many dynamically created method names that
>    aren't needed either.
> 
> Avalon includes a ComponentSelector that can take any
> object as a hint.  That means that you can feed the
> URL or string directly to the ComponentSelector, and the
> correct matcher/pipeline would be returned based on the
> logic surrounding the Selector.
> 
> Ex.  I have 3 matchers: "html/*", "", and "**.pdf".
> 
> My SitemapMatcherSelector will take any uri and return
> the appropriate value:
> 
> matcher = (Matcher) selector.select("html/foo");
> 
> returns the first matcher,
> 
> matcher = (Matcher) selector.select("foo/bar/baz.pdf");
> 
> returns the last matcher,
> 
> matcher = (Matcher) selector.select("");
> 
> returns the second matcher.
> 
> I think this beats generating a bunch of if statements
> and creating method names and such.

Beats in terms of simplicity or performance?

I don't think you can be faster than a compiled sitemap.... and we don't
compile because it's easier (it's not!) but because it's faster....

Anyway, I agree that having an "interpreted" sitemap would be totally
cool for development stages compared to having to recompile the whole
thing over and over again.... but when going in production, compiling to
bytecode would still make perfect sense to me, even if the generated
code is a mess.

Stefano.

Mime
View raw message