1 22 package org.jboss.ejb3.interceptor; 23 24 import java.lang.reflect.Method ; 25 import org.jboss.aop.advice.Interceptor; 26 import org.jboss.aop.joinpoint.Invocation; 27 import org.jboss.ejb3.EJBContainerInvocation; 28 import org.jboss.logging.Logger; 29 30 36 public class EJB3InterceptorsInterceptor implements Interceptor 37 { 38 protected static Logger log = Logger.getLogger(EJB3InterceptorsInterceptor.class); 39 private InterceptorInfo[] interceptorInfos; 40 private Method [] beanAroundInvokes; 41 42 public EJB3InterceptorsInterceptor(InterceptorInfo[] interceptorInfos, Method [] beanAroundInvokes) 43 { 44 this.interceptorInfos = interceptorInfos; 45 this.beanAroundInvokes = beanAroundInvokes; 46 } 47 48 public String getName() 49 { 50 return getClass().getName(); 51 } 52 53 public Object invoke(Invocation invocation) throws Throwable 54 { 55 EJBContainerInvocation inv = (EJBContainerInvocation) invocation; 56 57 Object [] interceptors = inv.getBeanContext().getInterceptorInstances(interceptorInfos); 61 if (interceptors != null && interceptors.length == 0 && beanAroundInvokes != null && beanAroundInvokes.length == 0) return invocation.invokeNext(); 62 InvocationContextImpl ctx = new InvocationContextImpl(inv, interceptorInfos, interceptors, beanAroundInvokes); 63 return ctx.proceed(); 64 } 65 66 } 67 | Popular Tags |