Package org.shiftone.jrat.aop.aspectwerkz

Source Code of org.shiftone.jrat.aop.aspectwerkz.AspectWerkzAroundAdvice

package org.shiftone.jrat.aop.aspectwerkz;

import org.codehaus.aspectwerkz.intercept.AroundAdvice;
import org.codehaus.aspectwerkz.joinpoint.JoinPoint;
import org.codehaus.aspectwerkz.joinpoint.Rtti;
import org.codehaus.aspectwerkz.joinpoint.impl.MethodRttiImpl;
import org.shiftone.jrat.api.Monitor;

/**
* @author $Author: jeffdrost $
* @version $Revision: 1.7 $
*/
public class AspectWerkzAroundAdvice implements AroundAdvice {

  public Object invoke(JoinPoint joinPoint) throws Throwable {

    Rtti rtti = joinPoint.getRtti();
    if (rtti instanceof MethodRttiImpl) {
      MethodRttiImpl methodRtti = (MethodRttiImpl) rtti;
      return Monitor.execute(methodRtti.getMethod(), joinPoint.getThis(), // todo
          // or
          // target?
          new AspectWerkzJoinPointCommand(joinPoint));
    } else {
      // this is not a method - not sure why we were called, but might as
      // well
      // just proceed and not cause any problems.
      return joinPoint.proceed();
    }
  }
}
TOP

Related Classes of org.shiftone.jrat.aop.aspectwerkz.AspectWerkzAroundAdvice

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.