Examples of AdvisorAdapterRegistry


Examples of org.springframework.aop.framework.adapter.AdvisorAdapterRegistry

  public List getInterceptorsAndDynamicInterceptionAdvice(Advised config, Method method, Class targetClass) {
    // This is somewhat tricky... we have to process introductions first,
    // but we need to preserve order in the ultimate list.
    List interceptorList = new ArrayList(config.getAdvisors().length);
    boolean hasIntroductions = hasMatchingIntroductions(config, targetClass);
    AdvisorAdapterRegistry registry = GlobalAdvisorAdapterRegistry.getInstance();
    Advisor[] advisors = config.getAdvisors();
    for (int i = 0; i < advisors.length; i++) {
      Advisor advisor = advisors[i];
      if (advisor instanceof PointcutAdvisor) {
        // Add it conditionally.
        PointcutAdvisor pointcutAdvisor = (PointcutAdvisor) advisor;
        if (config.isPreFiltered() || pointcutAdvisor.getPointcut().getClassFilter().matches(targetClass)) {
          MethodInterceptor[] interceptors = registry.getInterceptors(advisor);
          MethodMatcher mm = pointcutAdvisor.getPointcut().getMethodMatcher();
          if (MethodMatchers.matches(mm, method, targetClass, hasIntroductions)) {
            if (mm.isRuntime()) {
              // Creating a new object instance in the getInterceptors() method
              // isn't a problem as we normally cache created chains.
              for (int j = 0; j < interceptors.length; j++) {
                interceptorList.add(new InterceptorAndDynamicMethodMatcher(interceptors[j], mm));
              }
            }
            else {
              interceptorList.addAll(Arrays.asList(interceptors));
            }
          }
        }
      }
      else if (advisor instanceof IntroductionAdvisor) {
        IntroductionAdvisor ia = (IntroductionAdvisor) advisor;
        if (config.isPreFiltered() || ia.getClassFilter().matches(targetClass)) {
          Interceptor[] interceptors = registry.getInterceptors(advisor);
          interceptorList.addAll(Arrays.asList(interceptors));
        }
      }
      else {
        Interceptor[] interceptors = registry.getInterceptors(advisor);
        interceptorList.addAll(Arrays.asList(interceptors));
      }
    }
    return interceptorList;
  }
View Full Code Here

Examples of org.springframework.aop.framework.adapter.AdvisorAdapterRegistry

    if (this.registerTraceInterceptor != null ?
        this.registerTraceInterceptor.booleanValue() : this.interceptors == null) {
      proxyFactory.addAdvice(new RemoteInvocationTraceInterceptor(getExporterName()));
    }
    if (this.interceptors != null) {
      AdvisorAdapterRegistry adapterRegistry = GlobalAdvisorAdapterRegistry.getInstance();
      for (int i = 0; i < this.interceptors.length; i++) {
        proxyFactory.addAdvisor(adapterRegistry.wrap(this.interceptors[i]));
      }
    }
    proxyFactory.setTarget(getService());
    return proxyFactory.getProxy(getBeanClassLoader());
  }
View Full Code Here

Examples of org.springframework.aop.framework.adapter.AdvisorAdapterRegistry

    if (this.registerTraceInterceptor != null ?
        this.registerTraceInterceptor.booleanValue() : this.interceptors == null) {
      proxyFactory.addAdvice(new RemoteInvocationTraceInterceptor(getExporterName()));
    }
    if (this.interceptors != null) {
      AdvisorAdapterRegistry adapterRegistry = GlobalAdvisorAdapterRegistry.getInstance();
      for (int i = 0; i < this.interceptors.length; i++) {
        proxyFactory.addAdvisor(adapterRegistry.wrap(this.interceptors[i]));
      }
    }
    proxyFactory.setTarget(getService());
    proxyFactory.setOpaque(true);
    return proxyFactory.getProxy(getBeanClassLoader());
View Full Code Here

Examples of org.springframework.aop.framework.adapter.AdvisorAdapterRegistry

    // This is somewhat tricky... we have to process introductions first,
    // but we need to preserve order in the ultimate list.
    List<Object> interceptorList = new ArrayList<Object>(config.getAdvisors().length);
    boolean hasIntroductions = hasMatchingIntroductions(config, targetClass);
    AdvisorAdapterRegistry registry = GlobalAdvisorAdapterRegistry.getInstance();
    for (Advisor advisor : config.getAdvisors()) {
      if (advisor instanceof PointcutAdvisor) {
        // Add it conditionally.
        PointcutAdvisor pointcutAdvisor = (PointcutAdvisor) advisor;
        if (config.isPreFiltered() || pointcutAdvisor.getPointcut().getClassFilter().matches(targetClass)) {
          MethodInterceptor[] interceptors = registry.getInterceptors(advisor);
          MethodMatcher mm = pointcutAdvisor.getPointcut().getMethodMatcher();
          if (MethodMatchers.matches(mm, method, targetClass, hasIntroductions)) {
            if (mm.isRuntime()) {
              // Creating a new object instance in the getInterceptors() method
              // isn't a problem as we normally cache created chains.
              for (MethodInterceptor interceptor : interceptors) {
                interceptorList.add(new InterceptorAndDynamicMethodMatcher(interceptor, mm));
              }
            }
            else {
              interceptorList.addAll(Arrays.asList(interceptors));
            }
          }
        }
      }
      else if (advisor instanceof IntroductionAdvisor) {
        IntroductionAdvisor ia = (IntroductionAdvisor) advisor;
        if (config.isPreFiltered() || ia.getClassFilter().matches(targetClass)) {
          Interceptor[] interceptors = registry.getInterceptors(advisor);
          interceptorList.addAll(Arrays.asList(interceptors));
        }
      }
      else {
        Interceptor[] interceptors = registry.getInterceptors(advisor);
        interceptorList.addAll(Arrays.asList(interceptors));
      }
    }
    return interceptorList;
  }
View Full Code Here

Examples of org.springframework.aop.framework.adapter.AdvisorAdapterRegistry

    // This is somewhat tricky... we have to process introductions first,
    // but we need to preserve order in the ultimate list.
    List interceptorList = new ArrayList(config.getAdvisors().length);
    boolean hasIntroductions = hasMatchingIntroductions(config, targetClass);
    AdvisorAdapterRegistry registry = GlobalAdvisorAdapterRegistry.getInstance();
    Advisor[] advisors = config.getAdvisors();
    for (int i = 0; i < advisors.length; i++) {
      Advisor advisor = advisors[i];
      if (advisor instanceof PointcutAdvisor) {
        // Add it conditionally.
        PointcutAdvisor pointcutAdvisor = (PointcutAdvisor) advisor;
        if (pointcutAdvisor.getPointcut().getClassFilter().matches(targetClass)) {
          MethodInterceptor[] interceptors = registry.getInterceptors(advisor);
          MethodMatcher mm = pointcutAdvisor.getPointcut().getMethodMatcher();
          if (MethodMatchers.matches(mm, method, targetClass, hasIntroductions)) {
            if (mm.isRuntime()) {
              // Creating a new object instance in the getInterceptors() method
              // isn't a problem as we normally cache created chains.
              for (int j = 0; j < interceptors.length; j++) {
                interceptorList.add(new InterceptorAndDynamicMethodMatcher(interceptors[j], mm));
              }
            }
            else {
              interceptorList.addAll(Arrays.asList(interceptors));
            }
          }
        }
      }
      else if (advisor instanceof IntroductionAdvisor) {
        IntroductionAdvisor ia = (IntroductionAdvisor) advisor;
        if (ia.getClassFilter().matches(targetClass)) {
          Interceptor[] interceptors = registry.getInterceptors(advisor);
          interceptorList.addAll(Arrays.asList(interceptors));
        }
      }
    }
    return interceptorList;
View Full Code Here

Examples of org.springframework.aop.framework.adapter.AdvisorAdapterRegistry

    if (this.registerTraceInterceptor != null ?
        this.registerTraceInterceptor.booleanValue() : this.interceptors == null) {
      proxyFactory.addAdvice(new RemoteInvocationTraceInterceptor(getExporterName()));
    }
    if (this.interceptors != null) {
      AdvisorAdapterRegistry adapterRegistry = GlobalAdvisorAdapterRegistry.getInstance();
      for (int i = 0; i < this.interceptors.length; i++) {
        proxyFactory.addAdvisor(adapterRegistry.wrap(this.interceptors[i]));
      }
    }
    proxyFactory.setTarget(getService());
    proxyFactory.setOpaque(true);
    return proxyFactory.getProxy(getBeanClassLoader());
View Full Code Here

Examples of org.springframework.aop.framework.adapter.AdvisorAdapterRegistry

    // This is somewhat tricky... We have to process introductions first,
    // but we need to preserve order in the ultimate list.
    List<Object> interceptorList = new ArrayList<Object>(config.getAdvisors().length);
    Class<?> actualClass = (targetClass != null ? targetClass : method.getDeclaringClass());
    boolean hasIntroductions = hasMatchingIntroductions(config, actualClass);
    AdvisorAdapterRegistry registry = GlobalAdvisorAdapterRegistry.getInstance();

    for (Advisor advisor : config.getAdvisors()) {
      if (advisor instanceof PointcutAdvisor) {
        // Add it conditionally.
        PointcutAdvisor pointcutAdvisor = (PointcutAdvisor) advisor;
        if (config.isPreFiltered() || pointcutAdvisor.getPointcut().getClassFilter().matches(actualClass)) {
          MethodInterceptor[] interceptors = registry.getInterceptors(advisor);
          MethodMatcher mm = pointcutAdvisor.getPointcut().getMethodMatcher();
          if (MethodMatchers.matches(mm, method, actualClass, hasIntroductions)) {
            if (mm.isRuntime()) {
              // Creating a new object instance in the getInterceptors() method
              // isn't a problem as we normally cache created chains.
              for (MethodInterceptor interceptor : interceptors) {
                interceptorList.add(new InterceptorAndDynamicMethodMatcher(interceptor, mm));
              }
            }
            else {
              interceptorList.addAll(Arrays.asList(interceptors));
            }
          }
        }
      }
      else if (advisor instanceof IntroductionAdvisor) {
        IntroductionAdvisor ia = (IntroductionAdvisor) advisor;
        if (config.isPreFiltered() || ia.getClassFilter().matches(actualClass)) {
          Interceptor[] interceptors = registry.getInterceptors(advisor);
          interceptorList.addAll(Arrays.asList(interceptors));
        }
      }
      else {
        Interceptor[] interceptors = registry.getInterceptors(advisor);
        interceptorList.addAll(Arrays.asList(interceptors));
      }
    }

    return interceptorList;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.