On Sun, Nov 23, 2008 at 7:22 PM, Scott Ferguson <ferg(a)caucho.com> wrote:
But the mixin problem (proxy mixin) is different from the JMS problem
(tuple
projection). So they don't really compete, they are different problems.
Yes, I think I agree with that. In which case I'm thinking that we
should do @Prototype and not @Composes since solving "mixin
inheritance for Java" is not really within the scope of what we should
be trying to do in Web Beans 1.0.
Anyway, I think I can just about implement @Composes as a portable extension ;-)
But it's not a common problem. Look at it from the perspective
of
Manager.getInstanceByType. @Composes doesn't do the right thing for JMS.
For JMS, the returned objects need to be the real objects, not a mixin:
Queue queue = manager.getInstanceByType(Queue.class);
QueueSender sender = manager.getInstanceByType(QueueSender.class);
The queue and sender object need to be different, because the JMS provider
would expect its own Queue, and methods like equals() need to work
correctly. Correspondingly, manager.resolveByType(Queue.class) and
resolveByType(QueueSender.class) would also return different Bean objects.
But @Composes returns a single instance from getInstanceByType and a single
Bean from manager.resolveByType:
Queue queue = manager.getInstanceByType(Queue.class);
QueueSender sender = manager.getInstanceByType(QueueSender.class);
For @Composes, the queue and sender are the same object, and the Queue does
not extend the JMS provider's Queue, it extends QueueEndpoint, which would
be very confusing or useless to the JMS provider. For @Composes, the Bean
object for resolveByType is a single Bean with multiple types, not multiple
Beans with a single type.
So, JMS needs something more like @Prototype, while a new mixin feature
could use @Composes.
Good, so that's a good answer to the question I'm asking ;-)
--
Gavin King
gavin.king(a)gmail.com
http://in.relation.to/Bloggers/Gavin
http://hibernate.org
http://seamframework.org