cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathaniel, Alfred" <>
Subject RE: [C3] new pipeline component: variabelExpander
Date Fri, 16 Dec 2011 12:38:48 GMT
Hi Simone,

Why this special API call to add it to the pipeline?

I think is should be a regular transformer you can add any number of time wherever you need

        VariableExpander expander = new VariableExpander();
        expander.addProperty( "build.base", "/Users/cocoon" );
        expander.addProperty( "build.home", "${build.base}/workspace" );
        expander.addProperty( "dist.home", "${build.base}/downloads" );
        expander.addProperty( "", "Cocoon3 rocks!" );

then creating and run their pipeline adding the VariableExpander:

getClass().getResource( "/variables-expander.xml" ) )
                               .addTransformer( expander )
                               .setup( System.out )

That makes it also easier to add configuration to the expander, for example:

* use other marker than ${}, in case you may want generate generate a file using that syntax
for its own purposes 
* what to do if there if the property name is undefined: replace it by nothing / leave as
is / throw exception

Also by not just using a stupid property map, it is much easier to avoid infinite recursions
such as setProperty("build.home","${build.home}/workspace"). 

Cheers, Alfred.

-----Original Message-----
From: [] On Behalf Of Simone Tripodi
Sent: Donnerstag, 15. Dezember 2011 18:02
Subject: Re: [C3] new pipeline component: variabelExpander

Hi Robby :)

On Thu, Dec 15, 2011 at 5:56 PM, Robby Pelssers <> wrote:
> Would it be justified to say that it acts as some kind of transformer (although non-xslt
based) in this case which replaces all variable references with the value from the Map or
Properties provided?

exactly, it just replaces plain text inside attributes/body elements :P

> And I suppose it works on any text, not just XML?!

Not ATM, it works as XmlTransformer :(

> Bring it on ;-)

I'll do, thanks! :)

The content of this e-mail is intended only for the confidential use of the person addressed.

If you are not the intended recipient, please notify the sender and delete this e-mail immediately.
Thank you.
View raw message