cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Fagerstrom <dani...@nada.kth.se>
Subject Re: ChainMetaModule quirk (possible rewrite?)
Date Wed, 31 Jan 2007 19:55:17 GMT
Grzegorz Kossakowski skrev:
> Hello,
> 
> I'm still working on refactoring Forms and Ajax. Following Daniel's
> advice[1] I try to configure LinkRewriterTransformer for needs of
> rewriting servlet: links to the resources. I need use ChainMetaModule,
> because it has concatation feature (<all-values> configuration option).
> Sadly, I've encountered its quirk, take a look at getAttribute method:
>     public Object getAttribute( String attr, Configuration modeConf, Map
> objectModel )
>     throws ConfigurationException {
>         Object[] values =
> this.getAttributeValues(attr,modeConf,objectModel);
>         if (getLogger().isDebugEnabled()) getLogger().debug("result
> chaining single for "+attr+" is "+(values != null? values[0] : "null"));
>         return (values != null? values[0] : null);
>     }
> 
> In order to get one value it scans through all modules listing all
> possible values! Not only this is inefficient but also narrows possible
> usage. Block-path module obviously does not support listing all values
> because list would be endless. Given this, ChainMetaModule is useless in
> this case.
> 
> I would like to ask few questions:
> 1. Does anyone know why ChainMetaModule behaves the way described above?

No idea.

> 2. Would you be happy if I rewritten it from scratch with
> back-compatibility in mind?

Yes.

> 3. If so, would be happy if I used Java 1.5 features?

No, Cocoon 2.2 is supposed to work with Java 1.4. We had a vote about it 
some while ago.

> Or do you have better options?

Maybe it would be a better idea to write a special purpose link rewriter 
for the block protocol. Where you only configure what attributes to 
rewrite. Looking at the code for the link rewriting transformer, the 
actual work is just a few rows. Most of it is about handling all the 
bewildering amount of configuration options.

/Daniel


Mime
View raw message