cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <>
Subject [RT] ParentAware components (was:Re: Flow Scoping, was...)
Date Sat, 22 Mar 2003 21:23:44 GMT
Christopher Oliver wrote:

> OK. I think you could get that effect by modifying 
> JavaScriptInterpreter.set/getSessionScope(). Right now these associate 
> the scope with the uri prefix of the current environment. Instead, to 
> get the behavior you describe, I guess it should be associated with 
> the top-most parent of the current sitemap that has a flow defined in 
> it. Any ideas on how to implement that?

What if a JavaScriptInterpreter was able to know the 
JavaScriptInterpreter that exists in the parent sitemap ?


This revives an idea I had a long time ago when writing the 
treeprocessor : "parent-aware" components.

The elements in the <map:component> part of the sitemap are 
ComponentSelectors (CS) with a special behaviour : they know their 
"parent", i.e. the component that has the same role in the parent 
ComponentManager (handled by the parent sitemap), in order to implement 
component inheritance : if a CS is asked for a component it doesn't know 
of, it delegates the call to its parent. It is "parent-aware".

This is not useful only for sitemap component selectors if we consider 
the fact that <map:components> is nothing more than an xconf file. 
Consider for example datasources : we have defined global datasources in 
cocoon.xconf, and want local datasources defined (and visible) only in a 
particular subsitemap. Currently, if we write <datasources> in 
<map:components>, we hide global datasources. If we used parent-aware 
selectors, we could _augment_ the set of available datasources. The same 
can be used for InputModules.

Up to know, I thought this behaviour could be mostly useful for 
ComponentSelectors, but the Interpreter use case proves that it can be 
useful for "regular" (i.e. non-CS) components as well.

Implementation-wise, I'm thinking of defininig parent-aware by a new 
lifecycle interfacee :
  public interface ParentAware {
    public void setParent(Object parent)

Any component implementing this interface will be given once (before 
initialize()) the object that implements the same role in the parent 
component manager.

Thoughts ?

Sylvain Wallez                                  Anyware Technologies 
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }

View raw message