cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: [c2] simple sitemap question
Date Mon, 16 Apr 2001 19:36:24 GMT
Davanum Srinivas wrote:
> 
> Donald,
> 
> No, your java code does not need to generate java source code........Please take a look
at
> LangSelect.java. I think you need an Action not a Matcher.

There are three methods of doing conditional processing:

1) Creating a Matcher (Compnent that implements Matcher interface)
2) Creating a CodeFactory (a matcher that is embedded in the sitemap)
3) Creating an Action (Component that implements Action interface)

There are pluses and minuses to each of the approaches.

A Matcher Component is better for complex tests based on URI only that are not really
embeddable.  It has the overhead of being a distinct object, but sometimes the encapsulation
is worth it.

A Matcher Factory is better for simple tests based on URI only that are easily embeddable.
It is more difficult to debug, but usually has little overhead associated with it.

An Action is best when you have multiple criteria and complex tests.  Such a solution
is heavier than either the Matcher solutions, but much more flexible.  There is some
overlap between a Matcher Component and an Action, but the key difference is that Matchers
are not Parameterizable.

In the immortal words of the knight in Indiana Jones In the Last Crusade, "You must choose,
but choose wisely...".

> 
> Thanks,
> dims
> 
> --- Donald Ball <balld@webslingerZ.com> wrote:
> > On Mon, 16 Apr 2001, giacomo wrote:
> >
> > > > i'd like to have a conditional stylesheet in my sitemap. here's my default
> > > > pipeline:
> > > >
> > > >    <map:match pattern="*">
> > > >     <map:generate src="content/{1}.xml" type="serverpages"/>
> > > >     <map:transform src="style/{1}.xsl"/>
> > > >     <map:transform src="style/wziml-html.xsl"/>
> > > >     <map:serialize/>
> > > >    </map:match>
> > >
> > > Use a custom matcher then.
> >
> > perhaps you'd be so kind as to nudge me in the right direction then? i
> > note the matcher api consists of this method:
> >
> > public interface Matcher extends Component {
> >     /**
> >      * Matches the pattern against some <code>Request</code> values
> >      * and returns a <code>Map</code> object with replacements
> >      * for wildcards contained in the pattern.
> >      * @param pattern     The pattern to match against. Depending on the
> >      *                    implementation the pattern can contain wildcards
> >      *                    or regular expressions.
> >      * @param objectModel The <code>Map</code> with object of the
> >      *                    calling environment which can be used
> >      *                    to select values this matchers matches against.
> >      * @return Map        The returned <code>Map</code> object with
> >      *                    replacements for wildcards/regular-expressions
> >      *                    contained in the pattern.
> >      *                    If the return value is null there was no match.
> >      */
> >     Map match (String pattern, Map objectModel);
> > }
> >
> > but i'll be danged if i can find a class which actually implements this
> > interface. is this old?
> >
> > maybe i'm supposed to write my own MatcherFactory class? if so, then let
> > me get this straight - i'm supposed to write my own java class which
> > generates java source code in order to put a condition around a pipeline
> > component?
> >
> > - donald
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> > For additional commands, email: cocoon-dev-help@xml.apache.org
> >
> 
> =====
> Davanum Srinivas, JNI-FAQ Manager
> http://www.jGuru.com/faq/JNI
> 
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail.
> http://personal.mail.yahoo.com/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message