Ian,

Thanks for the "advice" ;)  Your suggestion helped me fix the problem,
in fact, I don't even need to bother with targetClass since the 
ServiceCallPointcut is associated with only that class (actually, 
object instance) via the ProxyFactory.addAdvisor call.

ProxyFactory factory = new ProxyFactory(svc);
factory.addAdvisor(new DefaultPointcutAdvisor(new ServiceCallPointcut(),
new AuthenticationChecker()));

   -Chris


-----Original Message-----
From: Ian Roberts [mailto:[EMAIL PROTECTED]
Sent: Sun 25/05/2008 12:08 PM
To: [email protected]
Subject: Re: Using AOP in CXF service impl
 
Wolf, Chris (IT) wrote:
>   static class ServiceCallPointcut extends StaticMethodMatcherPointcut
{
>       public boolean matches(Method m, Class targetClass) {
>           return (targetClass == this.getClass() &&
> m.getName().matches("(add.*)|(delete.*)|(fetch.*)|(login.*)"));
>       }
>   }

I'm suspicious of the targetClass == this.getClass() - this is only true

if the targetClass is a ServiceCallPointcut...  Did you mean something 
like MyServiceImpl.this.getClass()?

As for the "wrong" targetClass issue, if you're only using this advice 
with a single instance of MyServiceImpl you could always store the impl 
object in a field of the AuthenticationChecker, then you can always get 
at the "real" object even if Spring passes a proxy to the before method.

Ian

-- 
Ian Roberts               | Department of Computer Science
[EMAIL PROTECTED]  | University of Sheffield, UK
--------------------------------------------------------

NOTICE: If received in error, please destroy and notify sender. Sender does not 
intend to waive confidentiality or privilege. Use of this email is prohibited 
when received in error.

Reply via email to