cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carsten Ziegeler" <cziege...@s-und-n.de>
Subject [RT] Access to the object model
Date Mon, 19 May 2003 10:14:16 GMT
Simple RT today :)

What do you think about making the object model accessible
from non-sitemap components?
Currently, when implementing such a component, you don't
have directly access to the object model that contains
some important information (request, perhaps fom etc).

No, one solution is to add the object model to the
interface of your component. This is not the best
solution as then this component is only usable by
a sitemap component.

Or you can use the RequestLifecycleComponent marker interface
and get via a setup() method the object model set.
But this prevents you from making the component thread safe.

Now, I could imagine three possible solutions:
a) create a static (!) method at ObjectModelHelper that
   provides the object model for the current request.
   Please note, that we already have a static method somewhere
   in cocoon that uses thread local variables and can
   easily be used. So nothing new has to be invented.

b) Create a new marker interface for components and via this
   marker interface a component can get a "handler" for
   the object model.

c) Use the Contextualizable interface and put a "handler" in
   the context object.

Now, the most simple approach is a), but that'S not IoC. - I 
think the cleanest solution is b), but that would require
a new marker interface.

I currently tend to a),

What do you think? Is is bad to get the object model in
a custom component?

Carsten 



Mime
View raw message