beehive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chad Schoettger" <chad.schoett...@gmail.com>
Subject Re: Proposal for class-level interceptor support (BEEHIVE-1076)
Date Tue, 27 Mar 2007 15:32:33 GMT
Hi Ken,

Thanks for taking a look a my proposal.  Your summary for #3 sounds
correct.  But after taking a closer look at the current interceptor
code, I think I'll need to change #3 to:

3) If a method within a class is annotated with the same interceptor
annotation as the class that interceptor will only be fired once when
the method is invoked.

Here's why:

A Beehive interceptor annotation must specify a service class for the
interceptor implementation.  When we generate the control bean we
include (on a per method basis) any interceptor services which should
be invoked for that method.

If the same interceptor is applied to a class and a method in that
class then all we can really do is invoke that interceptor service
(once).

The interceptor service implementation needs to determine if the
interceptor annotation was placed on the method, class, or method and
class.  If placed on both the method and class utilmately it will be
up to the interceptor implementation which (if either) it chooses to
use.

  - Chad



On 3/26/07, Ken Tam <kentaminator@gmail.com> wrote:
> On 3/8/07, Chad Schoettger <chad.schoettger@gmail.com> wrote:
> > I would like to propose a solution for BEEHIVE-1076:
> >
> >  "interceptors for annotations don't get wired into generated control
> > beans if the annotation is at the class level"
> >
> >
> > Just to be clear this is not a bug, it is an enhancement to existing
> > functionality.  Since this work introduces new functionality it
> > becomes necessary to clearly define the behavior of class-level
> > interceptors in Beehive.
> >
> > I prefer a simple design which is intuitive for Beehive developers, so
> > here's what I am proposing:
> >
> > 1) Use the existing Beehive annotation @InterceptorAnnotation to meta-annotate
> >    class-level interceptor annotations.  The only difference between a
> >    class-level and method-level interceptor annotation would be the type it
> >    annotates.  This would allow a developer to create a single interceptor
> >    annotation which could be used at the class or method level.
> >
> > 2) A class-level interceptor gets applied to each method in the class
> >    (including inherited methods).
> >
> > 3) If a method within an class is annotated with the same interceptor
> >    annotation as the class only the method's interceptor is fired.
> >
> > 4) Interceptor prioritization does not change, method-level and class-level
> >    interceptor priorities could still be defined in the same manner by
> >    controls-interceptors.config file.
> >
> >
> > Questions/Comments?  Any input is greatly appreciated.
>
> +1, seems straightforward.  Just to clarify #3 -- I'm reading your
> proposal as "if a given method is somehow parameterized by the same
> interceptor annotation multiple times (via some combination of
> annotated inheritance and/or annotation at both type and method
> level), then the most specific (most inherited, method level) instance
> of the annotation wins".  Sound right?
>
> >
> >  - Thanks, Chad
> >
>

Mime
View raw message