001 package org.shiftone.jrat.integration.aop.aspectwerkz; 002 003 004 import org.codehaus.aspectwerkz.intercept.AroundAdvice; 005 import org.codehaus.aspectwerkz.joinpoint.JoinPoint; 006 import org.codehaus.aspectwerkz.joinpoint.Rtti; 007 import org.codehaus.aspectwerkz.joinpoint.impl.MethodRttiImpl; 008 import org.shiftone.jrat.api.Monitor; 009 010 011 /** 012 * @author jeff@shiftone.org (Jeff Drost) 013 */ 014 public class AspectWerkzAroundAdvice implements AroundAdvice { 015 016 public Object invoke(JoinPoint joinPoint) throws Throwable { 017 018 Rtti rtti = joinPoint.getRtti(); 019 020 if (rtti instanceof MethodRttiImpl) { 021 MethodRttiImpl methodRtti = (MethodRttiImpl) rtti; 022 023 return Monitor.execute(methodRtti.getMethod(), joinPoint.getThis(), // todo 024 025 // or 026 // target? 027 new AspectWerkzJoinPointCommand(joinPoint)); 028 } else { 029 030 // this is not a method - not sure why we were called, but might as 031 // well 032 // just proceed and not cause any problems. 033 return joinPoint.proceed(); 034 } 035 } 036 }