/*
 * 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.joinpoint.MethodInvocation;
import org.jboss.aop.advice.Interceptor;
import org.jboss.aop.Bind;
import org.jboss.aop.InterceptorDef;

/**
 *
 * @author <a href="mailto:bill@jboss.org">Bill Burke</a>
 * @version $Revision: 1.1.10.2 $
 */
@InterceptorDef
@Bind (pointcut="execution(void POJO->method1())", cflow="SimpleDynamicCFlow")
public class SimpleInterceptor implements Interceptor
{
   public String getName() { return "SimpleInterceptor"; }


   public Object invoke(Invocation invocation) throws Throwable
   {
      try
      {
         MethodInvocation mi = (MethodInvocation)invocation;
         System.out.println("<<< Entering SimpleInterceptor for: " + mi.getMethod().toString());
         return invocation.invokeNext();
      }
      finally
      {
         System.out.println(">>> Leaving SimpleInterceptor");
      }
   }
}
