[seam-dev] Interceptor packaging convention

Mark Struberg struberg at yahoo.de
Thu Mar 25 20:49:56 EDT 2010


+1 for that.

Even if you have 10 interceptors (or more) in a project, only few of them will get used on the same class at a time. And even in this rare cases, in 95% the ordering will make absolutely no difference at all.

Also I cannot read this restriction from the spec, please point me to the location.

IF there is any ordering needed, those interceptors have to be defined in the same beans.xml. 

So an algorithm like the following is imo enough:

if (beans.xml contains <interceptors>) {
  if (interceptors.size() > 1) {
    removeInterceptorsIfAlreadyDefined(interceptors);
    addInterceptors(interceptors); //make sure they are now in the right order
  } else {
    addInterceptorIfNotYetDefined(interceptor);
  }
} 

or something like that.

This would remove most of the problems. The only problematic situation remains if 2 beans.xmls defines a different ordering for the same interceptors.

LieGrue,
strub

--- Shane Bryzak <sbryzak at redhat.com> schrieb am Fr, 26.3.2010:

Von: Shane Bryzak <sbryzak at redhat.com>
Betreff: Re: [seam-dev] Interceptor packaging convention
An: "Lincoln Baxter, III" <lincolnbaxter at gmail.com>
CC: "Seam Dev List" <seam-dev at lists.jboss.org>
Datum: Freitag, 26. März, 2010 01:27 Uhr





  
This will be a major inconvenience for our users if we expect them to
manually add all the interceptors they need for conversations,
security, transactions, and who knows what else.  Is there absolutely
no other way that we can automatically register these in the
extension?  Also I'm not a big fan of having to use the
org.jboss.seam.intercept namespace, I don't want to have to include a
lone class in this package if all my other classes are in (for example
the security module) org.jboss.seam.security.



On 26/03/10 10:14, Lincoln Baxter, III wrote:
Seam Devs,

  

Dan and I have been working on the @Begin and @End conversation support
for Seam Faces, and we've discovered that there is a new fact of life
for consumers of portable CDI extensions. Due to the fact that
@Interceptors cannot be enabled in the extensions themselves (due to
restrictions on beans.xml for purposes of absolute ordering in the
application. See: http://seamframework.org/Community/EnablingAnInterceptorInALibrary
)

  

This presents an interesting issue; we want to be providing a good
out-of-box experience, but interceptors must be registered manually.

  

This means that @Interceptor classes must be:

  
    Exposed to the developer
    Registered manually by the developer in beans.xml -
<interceptors>...</interceptors>

    
    Consistently named and packaged to prevent refactoring /
backwards compatibility issues
    Checked at startup in order to warn devs that they are using
annotations with no enabled @Interceptor

    
  
We would like to propose the following conventions in order to address
the above concerns:

  

All @Interceptor classes must:

  
    Adhere to the following package and naming scheme:
org.jboss.seam.intercept.*Interceptor

    
    Warn users (or Error out when appropriate) if they are using
interceptable @Annotations when the @Inteceptor itself is not
registered:

(@Interceptor registration can be checked in the Extension class
AfterBeanDiscovery via BeanManager.resolveInterceptors(type,
interceptorBindings)

    
  
This presents users with:

  
    A consistent naming scheme to help prevent typos.
    A safety net to catch them when they fall down (because we
forgot to tie the ladder.)
    A protected namespace so that when we refactor, we don't break
their world. (Even though #2 would catch it.)

    
  
I've updated the Seam 3 Development Guidelines to reflect these
conventions - they can be changed as needed pending the outcome of this
discussion :)

  

-- 

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
  



 

-----Integrierter Anhang folgt-----

_______________________________________________
seam-dev mailing list
seam-dev at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/seam-dev


__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. 
http://mail.yahoo.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/seam-dev/attachments/20100326/80897a5a/attachment-0001.html 


More information about the seam-dev mailing list