David,

Yes all method calls will go through the interceptor you add. It is
thus up to the interceptor to decide whether it should actually do
something or just pass on to the delegate. For the interceptor to know
what to do the interceptor factory must pass the parameters (in your
case <include> and <exclude>) on (e.g. through the interceptor
constructor).

If you like you can also take a look at HiveMind's logging interceptor
LoggingInterceptorFactory. It uses Javassist to create an interceptor
class and an instance thereof on the fly. The <include> and <exclude>
method matching logic is encapsulated directly by this generated
class. You may of course also prefer the dynamic proxy approach and
code a generic interceptor class yourself. YMMV.

HTH,

--knut

On 5/9/05, David J. M. Karlsen <[EMAIL PROTECTED]> wrote:
> Knut Wannheden wrote:
> 
> Super! Exactly what I needed! Over to the next problem:
> I only want to profile some of the methods called, my config:
> 
> In my service-declaration:
> 
> <interceptor service-id="ProxyTimingInterceptor">
>         <include method="*execute*"/>
>         <exclude method="*"/>
> </interceptor>
> 
> but still, all methods are going through the interceptor.
> 
> Any ideas?
> 
> > David,
> >
> > In the interceptor factory implementation you get passed the
> > InterceptorStack object, which declares a getServiceInterface()
> > method. You should be able to pass that into the constructor of your
> > interceptor. The Class returned by getServiceInterface() will be a
> > synthesized interface if the service in question is a bean service.
> 
> >>I'm writing an interceptor for timing of method-calls (based on jamon).
> >>
> >>I want to get the name of the implemented service-interface from the
> >>delegate passed to the constructor. (Following the example at:
> >>http://jakarta.apache.org/hivemind/hivemind-examples/logging.html)
> >>
> >>How could I get the name the easiest way possible? Is there a
> >>helper-class somewhere? How am I assured to get the name of the
> >>interface of the service (in all cases, the delegate is another class
> >>depending on service-model, other interceptors and so on). I want to
> >>avoid a lot of introspection and checking on Hivemind specific
> >>service-models etc.).
> 
> --
> David J. M. Karlsen - +47 90 68 22 43
> http://www.davidkarlsen.com
> http://mp3.davidkarlsen.com
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to