You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Berin Loritsch <bl...@apache.org> on 2001/02/21 15:07:33 UTC

Proposed addition to ComponentManager/Selector

One thing we have identified at the Cocoon porject is the
need to hide the implementation facts of whether a Component
is ThreadSafe, Poolable, Factory, etc.

To date, in order to do that we have had to come up with an
inelegant Hack.

The truly elegant and IMO correct way of doing things is to
add a put() or return(Component) method so that every used
Component has a definite beginning and ending.  It is a standard
contract for all Composers to lookup and return components,
that way the implementation details can be absolutely hidden
from the end client of the Component.

interface ComponentManager {
    Component lookup (String role);
    void return (Component usedComponent);
}

interface ComponentSelector implements Component {
    Component select (Object hint);
    void return (Component usedComponent);
}

This request comes from _hard_ _use_ of the ComponentManager
system, and I think reflects a natural evolution that we
should use.