Package org.springframework.aop.support

Examples of org.springframework.aop.support.DefaultPointcutAdvisor


    AfterReturningAdvice advice = new AfterReturningAdvice() {
      @Override
      public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable {
      }
    };
    DefaultPointcutAdvisor advisor = new DefaultPointcutAdvisor(this.anyOldPointcut, advice);
    advisor.setOrder(order);
    return advisor;
  }
View Full Code Here


  }

  private Advisor createSpringAOPBeforeAdvice(int order) {
    BeforeAdvice advice = new BeforeAdvice() {
    };
    DefaultPointcutAdvisor advisor = new DefaultPointcutAdvisor(this.anyOldPointcut, advice);
    advisor.setOrder(order);
    return advisor;
  }
View Full Code Here

    final Class<?> targetClass = AopUtils.getTargetClass(bean);

    if (AopUtils.canApply(pointcut, targetClass)) {
      final Advice advice = adviceFactory.getAdvice(bean, targetClass);
      final Advisor advisor = new DefaultPointcutAdvisor(pointcut, advice);

      if (bean instanceof Advised) {
        LOG.debug("Bean {} is already proxied, adding Advisor to existing proxy", beanName);

        ((Advised) bean).addAdvisor(0, advisor);
View Full Code Here

   */
  @Override
  protected Object createMainInterceptor() {
    this.transactionInterceptor.afterPropertiesSet();
    if (this.pointcut != null) {
      return new DefaultPointcutAdvisor(this.pointcut, this.transactionInterceptor);
    }
    else {
      // Rely on default pointcut.
      return new TransactionAttributeSourceAdvisor(this.transactionInterceptor);
    }
View Full Code Here

    int added = 0;
    for (String adviceName : pointcuts.keySet()) {
      Pointcut pc = pointcuts.get(adviceName);
      if (AopUtils.canApply(pc, originallyCreatedBean.getClass())) {
        Advice advice = (Advice) childBeanFactory.getBean(adviceName);
        DefaultPointcutAdvisor a = new DefaultPointcutAdvisor(pc, advice);

        // Order advisors if necessary
        if (pc instanceof Ordered) {
          a.setOrder(((Ordered) pc).getOrder());
          int insertionPos = 0;
          for (Advisor ad : pf.getAdvisors()) {
            if (!(ad instanceof Ordered)) {
              break;
            }
            if (((Ordered) ad).getOrder() < a.getOrder()) {
              ++insertionPos;
            }
            else {
              break;
            }
View Full Code Here

        GenericWebApplicationContext wac = new GenericWebApplicationContext();
        wac.registerBeanDefinition("controller", new RootBeanDefinition(MyController.class));
        DefaultAdvisorAutoProxyCreator autoProxyCreator = new DefaultAdvisorAutoProxyCreator();
        autoProxyCreator.setBeanFactory(wac.getBeanFactory());
        wac.getBeanFactory().addBeanPostProcessor(autoProxyCreator);
        wac.getBeanFactory().registerSingleton("advisor", new DefaultPointcutAdvisor(new SimpleTraceInterceptor()));
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());
View Full Code Here

        wac.registerBeanDefinition("controller", new RootBeanDefinition(MyFormController.class));
        wac.registerBeanDefinition("viewResolver", new RootBeanDefinition(TestViewResolver.class));
        DefaultAdvisorAutoProxyCreator autoProxyCreator = new DefaultAdvisorAutoProxyCreator();
        autoProxyCreator.setBeanFactory(wac.getBeanFactory());
        wac.getBeanFactory().addBeanPostProcessor(autoProxyCreator);
        wac.getBeanFactory().registerSingleton("advisor", new DefaultPointcutAdvisor(new SimpleTraceInterceptor()));
        wac.refresh();
        return wac;
      }
    };
    servlet.init(new MockServletConfig());
View Full Code Here

    }
    else {
      proxyFactory.setTarget(delegate);
    }
    proxyFactory.setInterfaces(listenerInterfaces.toArray(new Class[0]));
    proxyFactory.addAdvisor(new DefaultPointcutAdvisor(new MethodInvokerMethodInterceptor(invokerMap, ordered)));
    return proxyFactory.getProxy();

  }
View Full Code Here

      TransactionInterceptor advice = new TransactionInterceptor(transactionManager,
          PropertiesConverter.stringToProperties("create*=PROPAGATION_REQUIRES_NEW,"
              + isolationLevelForCreate + "\ngetLastJobExecution*=PROPAGATION_REQUIRES_NEW,"
              + isolationLevelForCreate + "\n*=PROPAGATION_REQUIRED"));
      if (validateTransactionState) {
        DefaultPointcutAdvisor advisor = new DefaultPointcutAdvisor(new MethodInterceptor() {
          @Override
          public Object invoke(MethodInvocation invocation) throws Throwable {
            if (TransactionSynchronizationManager.isActualTransactionActive()) {
              throw new IllegalStateException(
                  "Existing transaction detected in JobRepository. "
                      + "Please fix this and try again (e.g. remove @Transactional annotations from client).");
            }
            return invocation.proceed();
          }
        });
        NameMatchMethodPointcut pointcut = new NameMatchMethodPointcut();
        pointcut.addMethodName("create*");
        advisor.setPointcut(pointcut);
        proxyFactory.addAdvisor(advisor);
      }
      proxyFactory.addAdvice(advice);
      proxyFactory.setProxyTargetClass(false);
      proxyFactory.addInterface(JobRepository.class);
 
View Full Code Here

   *
   */
  public void initializeProxy() {
    ProxyFactory factory = new ProxyFactory();
    for (int i = 0; i < advices.length; i++) {
      DefaultPointcutAdvisor advisor = new DefaultPointcutAdvisor(advices[i]);
      NameMatchMethodPointcut pointcut = new NameMatchMethodPointcut();
      pointcut.addMethodName("receiveAndExecute");
      advisor.setPointcut(pointcut);
      factory.addAdvisor(advisor);
    }
    factory.setProxyTargetClass(false);
    factory.addInterface(ContainerDelegate.class);
    factory.setTarget(delegate);
View Full Code Here

TOP

Related Classes of org.springframework.aop.support.DefaultPointcutAdvisor

Copyright © 2018 www.massapicom. 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.