cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grzegorz Kossakowski <g...@tuffmail.com>
Subject Re: ChainMetaModule quirk (possible rewrite?)
Date Wed, 31 Jan 2007 13:16:00 GMT
Grzegorz Kossakowski napisaƂ(a):
> 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);
>     }
>   
Even more misleading is the documentation of this modules :(
Take a look at this[1]:

Configuration:

It can be controlled whether it returns a flat or a deep view, i.e.
whether only values from the first module are returned if non-null or
they are merged with values from other modules
|<all-values>true</all-values>|. The same is possible for the attribute
names (|<all-names/>|). In addition, empty strings could be treated the
same as null values (|<empty-as-null/>|).

Do I get it that if all-values is true getAttribute should return list
of values of configured modules, exactly one value per configured input
module? And then getAttributes should just merge attributes from all
configured input modules. However, looking at the snippet above it's
clear no of situations described take place!
I've got enough confidence to rewrite it...

-- 
Grzegorz Kossakowski


Mime
View raw message