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: Calling an InputModule from flowscript
Date Fri, 19 Oct 2007 13:42:37 GMT
On 10/17/07 12:20 PM, Tobia Conforto wrote:

> But I cannot pass null to my own input module in place of the third
> parameter (Map objectModel) because I use that objectModel in my class!
> 
> Is this the recommended way of accessing input modules from flowscript?
> If so, how do I pass it the objectModel map?

The object model is indeed not made available in the flow script. You 
can get it from the Avalon context though (code from FOM_Cocoon.java):
ContextHelper.getObjectModel(avalonContext)
Unfortuntely, this one is neither available by default. I remember Ard 
posted a solution a while ago to retrieve the Avalon context in a 
hackish way.

Another workaround is to create a map in your flowscript with the 
necessary data.

To dev: How is this supposed to be handled? Should access to object 
model be granted? What does the unified object model change about this?

> Question #2:
> 
> Both the post and the sample fail to call cocoon.releaseComponent() on
> the InputModule selector, after calling getComponent() on it.  I was
> under the impression that you should go to great lengths (try/finally)
> to release every Avalon component you acquire.  Is it not so?

That's what you should do. Otherwise life cycle methods like recycle() 
don't get called. It depends on your component if it results in an 
actual problem. Of course the using code should not be aware of the 
component's implementation details - and that's why it should always 
release the component.

Joerg

Mime
View raw message