cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leo Sutic" <>
Subject [Propsal][C2/2.1] Cocoon2 component manager hierarchy
Date Mon, 27 Aug 2001 11:01:48 GMT
(I'm posting this both to Cocoon-dev and Avalon-dev, as the subject touches
on both of them.)

The Problem: The sitemap components I write need access to components
besides those available in the default Cocoon2 configuration.

Solution: Define some roles and point user-roles to them.

Why this isn't optimal: This means that every instance of Cocoon will
re-load these roles as there is no system-wide component manager. Thus,
assuming two cocoon webapps in the same Tomcat instance, if both instances
have a threadsafe component there will be two instances of that component.
(For example). Also, one can not easily add a component or reconfigure *all*
C2 webapps from a single file.

What I'd like to have: A way to specify a parent component manager for
Cocoon and generally for servlets. I'll discuss Cocoon here, as an example.
I'm leaning towards letting Cocoon implement Composable, with the option of
letting the ComponentManager parameter be the empty (non null) component

The CocoonServlet would use this pattern to retrieve the parent component



String parentComponentManagerClass =
ComponentManager parentComponentManager = null;
if (parentComponentManagerClass != null)
	parentComponentManager = (ComponentManager) ClassUtils.newInstance
} else {
	parentComponentManager = new ExcaliburComponentManager ();

if (parentComponentManager instanceof Initializable) {
	parentComponentManager.initialize ();


this.cocoon.compose (parentComponentManager);


Now for the Avalon parts: This would be even clearer if one could implement
the Factory pattern here by having a parent component manager Factory
instead of a parent component manager:



String parentComponentManagerFactoryClass =
ComponentManager parentComponentManager = null;
if (parentComponentManagerFactoryClass != null)
	parentComponentManagerFactory = (ComponentManagerFactory)
ClassUtils.newInstance (parentComponentManagerFactoryClass);


if (parentComponentManagerFactory != null) {
	this.cocoon.compose (parentComponentManagerFactory.newComponentManager ());
} else {
      ExcaliburComponentManager empty = new ExcaliburComponentManager ();
	empty.initialize ();
	this.cocoon.compose (empty);


What is needed:
 - (Avalon) A ComponentManagerFactory interface defined like this:

public interface ComponentManagerFactory {
	public ComponentManager newComponentManager ();

 - (Cocoon2) Let Cocoon implement composable. Let it use the CM passed to
compose as a parent component manager.

 - (Cocoon2) Let Cocoon load a ComponentManagerFactory based on the
parent-component-manager-factory parameter in web.xml.


 - (Avalon/Cocoon2) A standardized way of passing parent component managers
to servlets. Thus making configuration easier.


To unsubscribe, e-mail:
For additional commands, email:

View raw message