cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Berin Loritsch" <>
Subject Configuration Patterns and Sitemap Generation
Date Mon, 23 Oct 2000 18:58:19 GMT
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)"html/foo");

returns the first matcher,

matcher = (Matcher)"foo/bar/baz.pdf");

returns the last matcher,

matcher = (Matcher)"");

returns the second matcher.

I think this beats generating a bunch of if statements
and creating method names and such.

If you lust for Ham and Eggs, you have
committed breakfast in your heart
already.   -- C. S. Lewis

View raw message