cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grzegorz Kossakowski <>
Subject Re: What's the use of fillContext method
Date Wed, 08 Aug 2007 15:51:16 GMT
Vadim Gritsenko pisze:
> Grzegorz Kossakowski wrote:
> Like:
>  <map:transform type="xslt" src="...">
>    <map:parameter name="param" value="some value"/>
> ?


> Well in this case, IIRC, these are *not* available in Cocoon 2.1 during 
> pipeline execution. Is there, given huge price of implementation, a 
> reason to make them available in Cocoon 2.2?

Ok, they are available during component's setup phase but no one can stop component from preserving
parameters for later use, right? Exactly 
that happens in o.a.c.generation.AbstractGenerator.setup() method so it's quite common practise.

>> It's basically price of having ObjectModel (and environment in 
>> general) as a singleton object (actually it's scoped to the execution 
>> of block, but it's not important here).
> How parameters above relate to ObjectModel? I'm confused. Especially if 
> we assume they are not needed. :-?

Take a look at JXTemplateGenerator[1] and its performGeneration method:

     public void performGeneration(Event startEvent, Event endEvent) throws SAXException {
         FlowObjectModelHelper.fillNewObjectModelWithFOM(newObjectModel, objectModel, parameters);
         XMLConsumer consumer = new AttributeAwareXMLConsumerImpl(new RedundantNamespacesFilter(this.xmlConsumer));
         ((Map) newObjectModel.get("cocoon")).put("consumer", consumer);
         Invoker.execute(consumer, this.newObjectModel, new ExecutionContext(this.definitions,
                 this.manager), null, namespaces, startEvent, null);

The most interesting line is the second one. fillNewObjectModelWithFOM method looks like this:
     public static void fillNewObjectModelWithFOM(ObjectModel newObjectModel,
                                                             final Map objectModel, final
Parameters parameters) {
         ((Map)newObjectModel.get("cocoon")).put("parameters", new ParametersMap(parameters));

(ok, this whole helper is going to be removed at all)

Now you can see that parameters are available during pipeline execution in the ObjectModel
so it's possible to have such expressions:


> Still not sure how all this relates, so do not have good opinion.

I hope that you can understand the problem, now.


Grzegorz Kossakowski

View raw message