cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <stef...@apache.org>
Subject Re: sitemap draft still needs work in the matcher/chooser area
Date Mon, 19 Jun 2000 18:18:28 GMT
Giacomo Pati wrote:
> 
> --- Stefano Mazzocchi <stefano@apache.org> wrote:
> > Donald Ball wrote:
> > >
> > > On Sun, 18 Jun 2000, Stefano Mazzocchi wrote:
> > >
> > > hmm. not sure if i made myself clear. okay, suppose we have a chooser
> > > which relies on a resource from the filesystem - call it the FoobarChooser
> > > to avoid any more fights about doing user auth. i want to have the chooser
> > > use two different files in different parts of the map. we don't have a
> > > syntax for that right now. how about this:
> > >
> > > <choosers>
> > >  <chooser type="foobar" src:class="org.apache.cocoon.tester.FoobarChooser">
> > >   <param name="src" value="/usr/local/etc/foobar.xml"/>
> > >  </chooser>
> > > </choosers>
> > >
> > > <pipeline>
> > >  <choose type="foobar">
> > >   <param name="src" value="/home/balld/etc/foobar.xml"/>
> > >   <when test="foobar('bat')">
> > >    <generator/>
> > >    <serializer/>
> > >   </when>
> > >   <otherwise>
> > >    ...
> > >   </otherwise>
> > >  </choose>
> > > </pipeline>
> > >
> > > that covers the multiple configuration problem. now suppose i wanted to
> > > use a relative path in the src parameter - what would it be relative to?
> > > the sitemap in which the param element appears? could we use xml:base?
> >
> > Good point.... sheesh, the loader namespace doesn't work "inside
> > attributes"... should we get back to URL encoding instead?
> 
> I've mentioned to Donald in a private mail.
> I would suggest to restrict static configuration data (data that doesn't change from
request to
> request) to the sitemap component declaration section. It can be of a performance benefit
if
> configuration of static data can occur at instantiation time of the components. And as
far as I
> see there is nothing that stops us using multiple instances of the same chooser. A sample:
> 
> <sitemap>
>  <components>
>   <chooser type="foobar" src:class="org.apache.cocoon.chooser.FoobarChooser">
>    <parameter name="src" value="/usr/local/etc/foobar.xml"/>
>   </chooser>
>   <chooser type="barbaz" src:class="org.apache.cocoon.chooser.FoobarChooser"/>
>    <parameter name="src" value="/home/balld/etc/foobar.xml"/>
>   </chooser>
>  </components>
>  <pipeline>
>   <choose type="foobar">
>    <when test="foobar('bat')">
>     <generator/>
>     <serializer/>
>    </when>
>    <otherwise>
>      ...
>    </otherwise>
>   </choose>
>   <choose type="barbaz">
>    <when test="foobar('baz')">
>     <generator/>
>     <serializer/>
>    </when>
>    <otherwise>
>      ...
>    </otherwise>
>   </choose>
>  </pipeline>
> </sitemap>
> 
> What do you think of this?

yes, yes, you're right, but I think Donald's point was a totally
different one.

> > sheesh, the loader namespace doesn't work "inside
> > attributes"... should we get back to URL encoding instead?
> 
> What do you mean with "doesn't work inside attributes"?

Ok, let's see, when you do

 <generator src:local="hello/file.xml"/>

it works but if you do

 <generator type="parser">
  <param name="file" src:local="hello/file.xml"/>
 </generator>

what does this mean?

We should use "url-encoding" so that we can do

 <generator type="parser">
  <param name="src"
value="jar://path-to-jar/jar/files.jar#path-inside-jar/file.xml"/>
 </generator>

which is equivalent to 

 <generator type="parser"
src="jar://path-to-jar/jar/files.jar#path-inside-jar/file.xml"/>

using the RDF element/attribute equivalence.

Hmmmm, the loader namespace would require us to do

 <generator type="parser">
  <param name="src:jar"
value="path-to-jar/jar/files.jar#path-inside-jar/file.xml"/>
 </generator>

which is much less understandable.

Sheesh, that loader namespace is a bad idea :-/

> you use the Cocoon loading architecture that allows sitemaps to be cascaded. This assumes

> > > > then you have
> > > >
> > > >  public class URIChooser implements Chooser {
> > > >   Map default(CocoonRequest request, String test) {
> > > >     // perform wildcard matching filling the map with matched tokens
> > > >     if (matched)
> > > >      return tokenMap;
> > > >     else
> > > >      return null;
> > > >   }
> > > >
> > > >   Map regexp(CocoonRequest request, String test) {
> > > >     // perform regexp matching filling the map with matched tokens
> > > >     if (matched)
> > > >      return tokenMap;
> > > >     else
> > > >      return null;
> > > >   }
> > > >  }
> > >
> > > I'm afraid I don't get the Map thing. How would it work for a simple
> > > boolean test like FoobarChooser does?
> >
> >   final static public Map true = new MapImpl();
> >   final static public Map false = null;
> >
> >   if (matched)
> >    return true;
> >   else
> >    return false;
> >
> > Admittedly not super-elegant, but how do we do tests and pass tokens to
> > the pipeline?
> 
> Uh, would you introduce thread-savety issues?

Since these objects are not modifyable, I can't see why...
 
> > Should we peparate "choosers" and "param tokenizers"?
> 
> I've seen in the code that now we have the process tag (which is the uri-chooser) which
translates
> uris to sources using a PatternMatcher because uri and source are available to the process
tag.
> What we need now is a object that can be passed along the pipeline components to put
information
> into it (ie. choosers) or can be queried for information (ie. generators to resolve the
source
> attribute) because the uri and the source attributes are spread on different tags.

What do you mean?

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<stefano@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------



Mime
View raw message