[seam-dev] Interceptor packaging convention

Dan Allen dan.j.allen at gmail.com
Mon Mar 29 23:17:25 EDT 2010


I don't see the harm in prototyping this idea of auto-enablement. That's
exactly what the Seam sandbox is for [1]. I think if someone has an
approach, and other people in the community are interested in said approach,
then we should allow that idea to bloom. That's the spirit of open source
and community. Just because the experts deliberated over it and devised a
solution which that group considers ideal does not mean that developers will
just accept it. Maybe they want to include an extra JAR file. Let's let them
decide what it best for them. We are certainly not spoiling the modules nor
are we attempting to change CDI in any way. This is all in how you consume
it.

So, without further bickering, let's allow the visionaries to carry on with
their vision and see how it plays out. Developers can always choose to stick
with beans.xml if they want to be purists.

-Dan

[1] http://anonsvn.jboss.org/repos/seam/sandbox/trunk/modules/

On Mon, Mar 29, 2010 at 4:32 PM, Lincoln Baxter, III <
lincolnbaxter at gmail.com> wrote:

> For documentation (not conversation) purposes -- this approach has already
> been discussed:
>
> /**
>   * A small non-portable Weld PoC enabler that does not take many factors
> (incl. class runtime availability) into account:
>   */
> public class SeamInterceptorEnablerExtension implements Extension
> {
>    public void beforeBeanDiscovery(@Observes final BeforeBeanDiscovery
> event, final BeanManager manager)
>
>    {
>       if (manager instanceof BeanManagerImpl)
>       {
>          BeanManagerImpl impl = (BeanManagerImpl) manager;
>
>          // Enable interceptors in order here
>          // enableInterceptor(impl, YourInterceptor1.class);
>          // enableInterceptor(impl, YourInterceptor2.class);
>          // enableInterceptor(impl, YourInterceptor3.class); ... and more
>       }
>    }
>
>    private void enableInterceptor(final BeanManagerImpl impl, final
> Class<?> type)
>    {
>       List<Class<?>> list = new ArrayList<Class<?>>();
>       list.addAll(impl.getEnabledInterceptorClasses());
>
>       list.add(type);
>
>       impl.setEnabledInterceptorClasses(list);
>
>    }
> }
>
> On Mon, Mar 29, 2010 at 4:02 PM, Nicklas Karlsson <nickarls at gmail.com>wrote:
>
>> It would probably work for us but would be non-portable, right?
>>
>> *IF* we go down the route of auto-enablement, it would probably be easy to
>> have the Seam 3 config @Injected into the extension and check from a field
>> if the enabling is turned on or off (set in XML or wherever) so no need to
>> exclude/include jars.
>>
>>
>> On Mon, Mar 29, 2010 at 10:50 PM, Ales Justin <ales.justin at gmail.com>wrote:
>>
>>> >> That's why the JAR is included by default via Maven -- or provided in
>>> the
>>> >> "Dump these jars into your app" folder that we have in the
>>> Dist-releases. No
>>> >> extra work required to include it.
>>> >
>>> > And so I repeat my question: how is this better than a pre-written XML
>>> > file that is included by default?
>>>
>>> What is required for a class to be interceptor?
>>> (haven't been in JEE world for a while :-))
>>>
>>> Does it need to implement some interface?
>>> Or is proper api enough -- e.g. a plain class which has the right method?
>>> (in JBoss AOP, afair, it was enough to have single param method "invoke"
>>> with InvocationContext param)
>>>
>>> Just asking on how to easily recognize the interceptors,
>>> since I've just written a single-pass scanning MC lib [1],
>>> where it would be trivial to add recognized interceptors by default to
>>> Weld' metadata.
>>> (we already do/add a bunch of default things for things we recognize as
>>> Weld in JBossAS/MC)
>>>
>>> But I guess we then introduce ordering issue?
>>>
>>> [1] - no more need to do multiple scans in diff JBossAS components
>>> e.g. Hibernate Scanner impl:
>>> http://anonsvn.jboss.org/repos/jbossas/projects/scanning/trunk/plugins/src/main/java/org/jboss/scanning/hibernate/
>>>
>>>
>>> _______________________________________________
>>> seam-dev mailing list
>>> seam-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/seam-dev
>>>
>>
>>
>>
>> --
>> ---
>> Nik
>>
>> _______________________________________________
>> 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
>
>


-- 
Dan Allen
Senior Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597

http://mojavelinux.com
http://mojavelinux.com/seaminaction
http://www.google.com/profiles/dan.j.allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/seam-dev/attachments/20100329/dac16810/attachment-0001.html 


More information about the seam-dev mailing list