cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ugo Cei <>
Subject Re: generator type value substitution
Date Wed, 28 Apr 2004 22:05:05 GMT
Il giorno 28/apr/04, alle 20:44, Leszek Gawron ha scritto:

>> Missed the original e-mail, why not just push the problem down a 
>> level:
>> 	<map:generate type="superGenerator" src="{1}"/>
>> SuperGenerator can then figure out what to do by looking at the
>> source...
> I have already thought of that but the problemis that here the 
> "source" is the
> generator name. Do you know how should I lookup a generator, setup it 
> properly
> (to support map:parameter for example) and than invoke it? with 
> everything
> done not to break sitemap reloading (new generators may come in place, 
> old may
> be deleted), caching and other stuff I cannot really comprehend :)

Wrap and delegate:

<map:generate src="superGenerator" src="uri">
   <map:parameter name="class" value="GeneratorX"/>

public class SuperGenerator implements Generator {

   Generator specialGenerator;

   public void setup(SourceResolver resolver, Map objectModel, String 
srcURI, Parameters par) {
     specialGenerator = (Generator) 
     specialGenerator.setup(resolver, objectModel, srcURI, par);

   public void generate() {

You could also make all your generators Avalon components and retrieve 
them via a ServiceManager, if you wish, instead of using Class.forName.

Hope you get the idea.


View raw message