cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <joerg.heini...@gmx.de>
Subject Re: generator type value substitution
Date Thu, 29 Apr 2004 00:49:58 GMT
On 29.04.2004 00:05, Ugo Cei wrote:

> Wrap and delegate:
> 
> <map:generate src="superGenerator" src="uri">
>   <map:parameter name="class" value="GeneratorX"/>
> </map:generate>
> 
> public class SuperGenerator implements Generator {
> 
>   Generator specialGenerator;
> 
>   public void setup(SourceResolver resolver, Map objectModel, String 
> srcURI, Parameters par) {
>     specialGenerator = (Generator) 
> Class.forName(par.getParameter("class")).newInstance();
>     specialGenerator.setup(resolver, objectModel, srcURI, par);
>   }
> 
>   public void generate() {
>     specialGenerator.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.

IMO this looks massively like a hack around a restriction we set up. 
Maybe we should think about the restriction itself ...

Joerg

Mime
View raw message