[webbeans-dev] Hierarchical Managers

Gavin King gavin at hibernate.org
Thu Nov 27 17:30:59 EST 2008


On the concall, we made some significant progress with the design for
hierarchical Managers. We decided to develop the following approach:

(1) web beans belonging to a child manager may have any scope
(2) each child manager has its own set of contexts (there is a
parallel context hierarchy for each scope) that "belong" to, and have
the same lifecycle as, the parent contexts
(3) therefore the web beans belonging to the child are not visible to
web beans belonging to the parent
(4) however, web beans belonging to the parent *are* visible to web
beans belonging to the child
(5) a child manager may be associated with a context by calling
Manager.setCurrent(ScopeType), and is then automagically propagated
with the context
(6) web beans belonging to the child manager may be obtained via EL
evaluation whenever the child manager is in scope, or by directly
calling a getInstance() method of the child manager

The needed API changes are as follows:

Manager {
    public Manager createChild();
    public void setCurrent(Class<? extends Annotation> scope);
    public void validate();
}

Context {
    getChild(Manager childManager);
}

There is one question remaining open:

Should it *ever* be possible to access a web bean belonging to the
child manager via a reference that was injected into a web bean
belonging to the parent manager or into some non-contextual object
such as a servlet or MDB?

For example, we might choose to support this in the case that the
child manager web bean specializes the parent manager web bean.

Bill, is this a feature that Oracle requires? If not, I'm inclined to
*not* support it in web beans 1.0.

-- 
Gavin King
gavin.king at gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org



More information about the weld-dev mailing list