[seam-dev] @Unwrap implementation in weld-extensions

Stuart Douglas stuart at baileyroberts.com.au
Thu Apr 22 08:25:56 EDT 2010


I have just committed an initial implementation of this. For now it uses @ManagedProducer instead of @Unwrap, and it only works for interfaces, as it uses JDK proxies.

If we are prepared to have a dependency on javassist I don't think it would be to hard to extend it to work for all proxiable classes, but I will wait for some feedback before I jump into this.

Stuart

On 21/04/2010, at 2:06 AM, Marius Bogoevici wrote:

> No, that is not the same as a fully stateless scope where the object is looked up everytime it is invoked, not everytime it is injected.
> 
> On 20 Apr 2010, at 17:07, Lincoln Baxter, III wrote:
> 
>> Ok yeah, thats what I thought.
>> 
>> @Produces @New -- would that not work?
>> 
>> On Tue, Apr 20, 2010 at 12:06 PM, Marius Bogoevici <marius.bogoevici at gmail.com> wrote:
>> On 10-04-20 11:31 AM, Lincoln Baxter, III wrote:
>>> Wait -- there's no "Prototype" or "always new" scope?
>> @Dependent or @New, from case to case.
>> 
>>> 
>>> --Lincoln
>>> 
>>> On Tue, Apr 20, 2010 at 6:45 AM, Stuart Douglas <stuart at baileyroberts.com.au> wrote:
>>> I don't think I will be able to implement the injection of InjectionPoint into the producer method, but other than that it should be possible to implement.
>>> 
>>> Stuart
>>> 
>>> 
>>> On 20/04/2010, at 8:15 PM, Pete Muir wrote:
>>> 
>>>> Yes, I agree. I had raised this issue during spec development - that there was no truly stateless scope in CDI, where the bean instance was created every time.
>>>> 
>>>> I would like to hear from the 299 EG about this as well.
>>>> 
>>>> On 20 Apr 2010, at 04:57, Stuart Douglas wrote:
>>>> 
>>>>> I think that there is a real use case for something similar to the @Unwrap feature of seam 2.
>>>>> 
>>>>> I think that it would be possible to implement something like this:
>>>>> 
>>>>> @ConversationScoped
>>>>> public class ManagedPersistenceContext
>>>>> {
>>>>> 
>>>>> EntityManager entityManager;
>>>>> 
>>>>> @Unwrap
>>>>> @SomeQualifier
>>>>> public EntityManager produce(InjectionPoint injectionPoint)
>>>>> {
>>>>>  entityManager.joinTransaction();
>>>>>  return entityManager;
>>>>> }
>>>>> }
>>>>> 
>>>>> public class MyClass
>>>>> {
>>>>> @Inject @SomeQualifier EntityManager entityManager;
>>>>> }
>>>>> 
>>>>> the way I envisage this working is that a proxy gets injected into MyClass, and this proxy calls ManagedPersistenceContext.produce to resolve the correct EntityManager to pass the call to every time a method is invoked on the proxy.
>>>>> 
>>>>> I am pretty sure I can implement this in weld-extensions using JDK proxies, does this sound like a good idea?
>>>>> 
>>>>> Stuart
>>>>> _______________________________________________
>>>>> seam-dev mailing list
>>>>> seam-dev at lists.jboss.org
>>>>> https://lists.jboss.org/mailman/listinfo/seam-dev
>>>> 
>>> 
>>> 
>>> _______________________________________________
>>> seam-dev mailing list
>>> seam-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/seam-dev
>>> 
>>> 
>>> 
>>> -- 
>>> Lincoln Baxter, III
>>> http://ocpsoft.com
>>> http://scrumshark.com
>>> "Keep it Simple"
>>> 
>>> _______________________________________________
>>> seam-dev mailing list
>>> 
>>> seam-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/seam-dev
>>> 
>>> 
>>> 
>> 
>> 
>> 
>> 
>> -- 
>> Lincoln Baxter, III
>> http://ocpsoft.com
>> http://scrumshark.com
>> "Keep it Simple"
>> _______________________________________________
>> seam-dev mailing list
>> seam-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/seam-dev
> 
> 
> _______________________________________________
> seam-dev mailing list
> seam-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/seam-dev




More information about the seam-dev mailing list