avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leo Sutic" <leo.su...@inspireinfrastructure.com>
Subject RE: Divergence from Avalon (was Re: [RT] Is Poolable Harmful?)
Date Fri, 11 Jan 2002 15:35:19 GMT

> From: Paulo Gaspar [mailto:paulo.gaspar@krankikom.de]
> Hi Leo, answer inline...
> > -----Original Message-----
> > From: Leo Sutic [mailto:leo.sutic@inspireinfrastructure.com]
> > 
> > But the difference is between ONE contract for ALL ComponentManagers
> > and potentially ONE contract for EACH ComponentManager.
> I NEVER believe one size fits all.
> I ONLY believe maximum ease of reuse.

I read that you are not interested in changing the CM interface, but rather
to refactor the ECM implementation. As I said in a previous mail, this is
something entirely different.
> > I think Berin's suggestion - with a role followed by an optional Context
> > is ideal. Then, by allowing the context to be interpreted by a
> > ComponentSelector, we decouple the Context interpretation from the CM.
> It is a different "syntax" with the same problem:
>  - If your component that uses the ComponentManager does not know how to
>    fill the right values on the Context, everything fails in exactly the
>    same way as it would fail with the wrong type of Component.

No. With you approach the interface to the CM will change, making it
necessary to have Composable, AdvancedComposable, etc. interfaces where
each interface specifies a compose() method taking the corresponding
CM interface as single parameter. Now, with one interface per domain, 
it just won't scale at all.

>    So, both the Component and the CM still must be aware of its domain 
>    specifics.

No. Only if you allow the CM to interpret the Context. If you let the CM
pass the Context along to a ComponentSelector, there is no such problem.

Since the domain-specific interpretation is hidden away in the CS, the CM
need not be changed.

I imagine something like this configuration:

  <!-- Straightforward -->
  <component role="my.Component" class="my.ComponentImpl"/>

  <!-- Selector in use -->
  <selector role="my.SelectedComponent" class="my.ComponentSelector">
    <component hint="key=abc" class="my.SelectedComponentImpl1"/>
    <component hint="key=def" class="my.SelectedComponentImpl2"/>


  lookup("my.Component") => my.ComponentImpl

  Context ctx = new DefaultContext ();
  ctx.put ("key", "abc");
  lookup("my.SelectedComponent", ctx) => my.ComponentImpl1

  ctx = new DefaultContext ();
  ctx.put ("key", "def");
  lookup("my.SelectedComponent", ctx) => my.ComponentImpl2

This means a strengthening of the contract between CS and CM, but it completely
decouples the CM from domain-specific stuff.


To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>

View raw message