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

package org.jboss.ejb3;

import org.jboss.aop.advice.Interceptor;
import org.jboss.aop.joinpoint.Invocation;
import org.jboss.ejb.AllowedOperationsAssociation;
import org.jboss.ejb.AllowedOperationsFlags;

/**
 * @author <a href="mailto:kabir.khan@jboss.org">Kabir Khan</a>
 * @version $Revision: 1.1.2.4 $
 */
public class AllowedOperationsInterceptor implements Interceptor
{

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

   public Object invoke(Invocation invocation) throws Throwable
   {
      try
      {
         AllowedOperationsAssociation.pushInMethodFlag(AllowedOperationsFlags.IN_EJB_TIMEOUT);
         return invocation.invokeNext();
      }
      finally
      {
         AllowedOperationsAssociation.popInMethodFlag();
      }
   }

}
