Package org.springframework.aop.framework

Examples of org.springframework.aop.framework.ProxyFactory.addAdvice()


  }

  public ApplicationContext mockContext() {
    ProxyFactory factory = new ProxyFactory();
    factory.setInterfaces(new Class[] { ApplicationContext.class });
    factory.addAdvice(new BeanMapInterceptor(beanMap));
    return (ApplicationContext) factory.getProxy();
  }

  public void putBean(String beanName, Object bean) {
    beanMap.putBean(beanName, bean);
View Full Code Here


      proxyFactory.setProxyTargetClass(proxyTargetClass);
    }

    DelegatingIntroductionInterceptor introduction = new DelegatingIntroductionInterceptor(ts);
    introduction.suppressInterface(TargetSource.class);
    proxyFactory.addAdvice(introduction);

    return proxyFactory.getProxy(classLoader);
  }

  /**
 
View Full Code Here

   @SuppressWarnings("unchecked")
   protected <T> T createMock(Class<T> clz, MethodInterceptor interceptor) {
      try {
         ProxyFactory fac = new ProxyFactory();
         fac.setTargetClass(clz);
         fac.addAdvice(interceptor);
         fac.setProxyTargetClass(true);
         return (T)fac.getProxy();
      } catch (Throwable exp) {
         LOG.error(exp.getMessage());
         LOG.debug("Details: ", exp);
View Full Code Here

   @SuppressWarnings("unchecked")
   protected <T> T createMock(Class<T> clz, MethodInterceptor interceptor) {
      try {
         ProxyFactory fac = new ProxyFactory();
         fac.setTargetClass(clz);
         fac.addAdvice(interceptor);
         fac.setProxyTargetClass(true);
         return (T)fac.getProxy();
      } catch (Throwable exp) {
         LOG.error(exp.getMessage());
         LOG.debug("Details: ", exp);
View Full Code Here

    }
    proxyFactory.setInterfaces(interfaces);

    DelegatingIntroductionInterceptor introduction = new DelegatingIntroductionInterceptor(ts);
    introduction.suppressInterface(TargetSource.class);
    proxyFactory.addAdvice(introduction);

    return proxyFactory.getProxy(this.beanClassLoader);
  }

View Full Code Here

              "Cannot deactivate 'lookupOnStartup' without specifying a 'proxyInterface' or 'expectedType'");
        }
        proxyFactory.setInterfaces(ClassUtils.getAllInterfacesForClass(targetClass, jof.beanClassLoader));
      }
      if (jof.exposeAccessContext) {
        proxyFactory.addAdvice(new JndiContextExposingInterceptor(jof.getJndiTemplate()));
      }
      proxyFactory.setTargetSource(targetSource);
      return proxyFactory.getProxy(jof.beanClassLoader);
    }
  }
View Full Code Here

    }
    proxyFactory.setInterfaces(interfaces);

    DelegatingIntroductionInterceptor introduction = new DelegatingIntroductionInterceptor(ts);
    introduction.suppressInterface(TargetSource.class);
    proxyFactory.addAdvice(introduction);

    return proxyFactory.getProxy(this.beanClassLoader);
  }

View Full Code Here

    checkService();
    checkServiceInterface();
    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.addInterface(getServiceInterface());
    if (isRegisterTraceInterceptor()) {
      proxyFactory.addAdvice(new RemoteInvocationTraceInterceptor(getExporterName()));
    }
    proxyFactory.setTarget(getService());
    return proxyFactory.getProxy(this.beanClassLoader);
  }
View Full Code Here

      pf.setInterfaces(ClassUtils.getAllInterfacesForClass(beanType));
    }

    // Add an introduction that implements only the methods on ScopedObject.
    ScopedObject scopedObject = new DefaultScopedObject(cbf, this.scopedTargetSource.getTargetBeanName());
    pf.addAdvice(new DelegatingIntroductionInterceptor(scopedObject));

    // Add the AopInfrastructureBean marker to indicate that the scoped proxy
    // itself is not subject to auto-proxying! Only its target bean is.
    pf.addInterface(AopInfrastructureBean.class);
View Full Code Here

  public MessageEndpoint createEndpoint(XAResource xaResource) throws UnavailableException {
    GenericMessageEndpoint endpoint = (GenericMessageEndpoint) super.createEndpoint(xaResource);
    ProxyFactory proxyFactory = new ProxyFactory(this.messageListener);
    DelegatingIntroductionInterceptor introduction = new DelegatingIntroductionInterceptor(endpoint);
    introduction.suppressInterface(MethodInterceptor.class);
    proxyFactory.addAdvice(introduction);
    return (MessageEndpoint) proxyFactory.getProxy();
  }

  /**
   * Creates a concrete generic message endpoint, internal to this factory.
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.