On 13 Aug 2009, at 18:12, Kenneth Saks wrote:
On Aug 13, 2009, at 1:00 PM, Pete Muir wrote:
>
> On 13 Aug 2009, at 17:03, Kenneth Saks wrote:
>
>>>> Let's add a web beans provided interceptor that the EJB container
>>>> will register after any
>>>> EJB-style interceptors. That can handle all interceptors that are
>>>> specified via
>>>> CDI-style metadata.
>>>
>>> I was just talking with Carlo about how to do this. Since we are
>>> now
>>> doing such deep integration, I would prefer to switch to using an
>>> SPI
>>> to specify the interceptors to apply to a session bean. Of course,
>>> the
>>> EJB container could choose to use an interceptor to attach them
>>> (essentially moving the built in SPI to the container). I guess
>>> such
>>> an SPI would look like [1]:
>>>
>>> interface EjbServices {
>>>
>>> ...
>>>
>>> void registerInterceptors(EjbDescriptor<?> descriptor,
>>> Collection<Interceptor<?>> interceptors);
>>> }
>>>
>>> This would completely remove the Web Beans built in EJB interceptor
>>> (more flexible for integrators).
>>
>> Does this represent
>>
>> a) the CDI impl's system-level interceptor
>>
>> or
>>
>> b) application-level interceptors that are specified via CDI-
>> specific metadata
>>
>> Or are you saying there is no longer a need for a) ?
>>
>> It's an important distinction since a) would need to be registered
>> before *any*
>> application-level interceptors, whereas b) would be registered after
>> interceptors
>> specified via the EJB interceptor metadata.
>
> It represents (b), and with it, we would no longer need (a).
1. Is the Interceptor type in this signature a new kind of
descriptor? What information does
it hold?
It's a CDI defined interface.
http://anonsvn.jboss.org/repos/webbeans/ri/trunk/api/src/main/java/javax/...
- you could also use the create() method to make an instance.
2. interceptors should be a List instead of a Collection since it
needs to
convey the ordering.
Yes, my bad.
Does the CDI-specified interceptor metadata
allow method-level
granularity for @AroundInvoke? If so, a single ordered list of
interceptor classes isn't
sufficient.
Yes. Can you propose an alternative structure, as I guess you have a
similar structure in EJB?
3. At what point in time will the CDI impl call registerInterceptors()
for each EJB component?
We can call it anytime during or after the deployBeans() phase of
bootstrap. Is that early enough? When would be best?