/*
 * JBoss, the OpenSource J2EE webOS
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */

import org.jboss.aop.joinpoint.Invocation;
import org.jboss.aop.advice.Interceptor;
import org.jboss.aop.InterceptorDef;
import org.jboss.aop.Bind;
import org.jboss.aop.TypeDef;
import org.jboss.aop.pointcut.Typedef;

/**
 *
 * @author <a href="mailto:bill@jboss.org">Bill Burke</a>
 * @version $Revision: 1.2.8.2 $
 */
@InterceptorDef
@Bind (pointcut = "all($typedef{SimpleInterceptor.myTypedef})")
public class SimpleInterceptor implements Interceptor
{
   @TypeDef ("(class(POJO) AND has(* *->method(..))) OR class($instanceof{ExecutionTypedefInterface})")
   public static Typedef myTypedef;

   public String getName() { return "SimpleInterceptor"; }

   public Object invoke(Invocation invocation) throws Throwable
   {
      try
      {
         System.out.println("<<< Entering SimpleInterceptor");
         return invocation.invokeNext();
      }
      finally
      {
         System.out.println(">>> Leaving SimpleInterceptor");
      }
   }
}
