1 15 16 package com.jdon.aop.joinpoint; 17 18 19 import java.util.ArrayList ; 20 import java.util.Iterator ; 21 import java.util.List ; 22 23 import org.aopalliance.intercept.MethodInterceptor; 24 25 import com.jdon.aop.interceptor.InterceptorsChain; 26 import com.jdon.bussinessproxy.TargetMetaDef; 27 import com.jdon.util.Debug; 28 29 30 34 public class AdvisorChainFactory { 35 36 private final static String module = AdvisorChainFactory.class.getName(); 37 38 private InterceptorsChain interceptorsChain; 39 40 43 public AdvisorChainFactory(InterceptorsChain interceptorsChain) { 44 super(); 45 this.interceptorsChain = interceptorsChain; 46 } 47 48 55 public List create(TargetMetaDef targetMetaDef) throws Exception { 56 Debug.logVerbose("[JdonFramework] enter create PointcutAdvisor " , module); 57 List interceptors = new ArrayList (interceptorsChain.size()); 58 interceptors.addAll(interceptorsChain.getInterceptors(Pointcut.TARGET_PROPS_SERVICES)); 59 Debug.logVerbose("[JdonFramework] find all service's interceptos size=" + interceptors.size(), module); 60 if (targetMetaDef.isEJB()){ 61 List ejbInterceptors = interceptorsChain.getInterceptors(Pointcut.EJB_TARGET_PROPS_SERVICES); 62 if ((ejbInterceptors != null) && (ejbInterceptors.size() > 0)){ 63 interceptors.addAll(ejbInterceptors); 64 Debug.logVerbose("[JdonFramework] find ejbService's interceptos size=" + interceptors.size(), module); 65 } 66 }else{ 67 List pojoInterceptors = interceptorsChain.getInterceptors(Pointcut.POJO_TARGET_PROPS_SERVICES); 68 69 Iterator iter = pojoInterceptors.iterator(); 70 while(iter.hasNext()){ 71 MethodInterceptor i = (MethodInterceptor)iter.next(); 72 } 73 74 if ((pojoInterceptors != null) && (pojoInterceptors.size() > 0)){ 75 interceptors.addAll(pojoInterceptors); 76 Debug.logVerbose("[JdonFramework] find pojoService's interceptos size=" + interceptors.size(), module); 77 } 78 } 79 return interceptors; 80 } 81 82 83 } 84 | Popular Tags |