> It looks good, but I really do not like the mass of castings begin done.
Agree it smells.
> interface JAMESComponentContext extends
> MailForwardingContext, DirectoryContext, ShutdownRequestingContext {}
>[..]
> As you can see, all the methods for JAMESComponentContext are there,
> but yet a cast to JAMESComponentContext will fail. However, with a dynamic
> proxy
> this can be solved. Basically, the process will be this:
>
> 1. Find out what Context interface the component expects.
I'd guess that the container in question provides a Context inst that supports all the
context
methods it can support. No config needed. That not workable for 'super-mode'
functions, though
that can be solved in other ways.
> 2. Find all methods in that interface & superinterfaces.
> 3. Verify that all those methods exist in the container's context
> implementation.
> 4. Create a dynamic proxy implementing the required context interface.
> 5. Wrap the container's context impl in that proxy, and wire method calls
> as appropriate.
>
> This way, a component can declare any subset of context functionality as
> required,
> without having to do endless casting, and keep track of *one* interface.
> Meanwhile,
> the container only have to make sure that the subset requirements can be
> fulfilled.
>
> Workable?
I think so, without extra config. I'll bow to your greater wisdom on dynamic proxies
and
ClassCastException...
-Paul
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>