Package org.springframework.aop.framework

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


    ProxyFactory factory = new ProxyFactory();
    factory.setTarget(target);
    factory.addInterface(Serializable.class);
    factory.addInterface(Cloneable.class);
    factory.addInterface(Comparable.class);
    factory.addInterface(Map.class);
    Object proxy = factory.getProxy();
    map.addAttribute(proxy);
    assertSame(proxy, map.get("map"));
  }
View Full Code Here


  public void afterPropertiesSet() {
    super.afterPropertiesSet();

    // Build a proxy that also exposes the JAX-WS BindingProvider interface.
    ProxyFactory pf = new ProxyFactory();
    pf.addInterface(getServiceInterface());
    pf.addInterface(BindingProvider.class);
    pf.addAdvice(this);
    this.serviceProxy = pf.getProxy(this.beanClassLoader);
  }
View Full Code Here

    super.afterPropertiesSet();

    // Build a proxy that also exposes the JAX-WS BindingProvider interface.
    ProxyFactory pf = new ProxyFactory();
    pf.addInterface(getServiceInterface());
    pf.addInterface(BindingProvider.class);
    pf.addAdvice(this);
    this.serviceProxy = pf.getProxy(this.beanClassLoader);
  }

View Full Code Here

  protected RepositoryInterface createProxy(RepositoryInterfaceImpl target) {
    MapPersistenceExceptionTranslator mpet = new MapPersistenceExceptionTranslator();
    mpet.addTranslation(persistenceException1,
        new InvalidDataAccessApiUsageException("", persistenceException1));
    ProxyFactory pf = new ProxyFactory(target);
    pf.addInterface(RepositoryInterface.class);
    addPersistenceExceptionTranslation(pf, mpet);
    return (RepositoryInterface) pf.getProxy();
  }

  protected void addPersistenceExceptionTranslation(ProxyFactory pf, PersistenceExceptionTranslator pet) {
View Full Code Here

    SerializablePerson sp2 = new SerializablePerson();
    sp1.setName("Gordon");
   
    HotSwappableTargetSource hts = new HotSwappableTargetSource(sp1);
    ProxyFactory pf = new ProxyFactory();
    pf.addInterface(Person.class);
    pf.setTargetSource(hts);
    pf.addAdvisor(new DefaultPointcutAdvisor(new SerializableNopInterceptor()));
    Person p = (Person) pf.getProxy();
   
    assertEquals(sp1.getName(), p.getName());
View Full Code Here

    SerializablePerson serializableTarget = new SerializablePerson();
    String name = "Tony";
    serializableTarget.setName("Tony");
   
    ProxyFactory factory = new ProxyFactory(serializableTarget);
    factory.addInterface(Person.class);
    long time = 1000;
    TimeStamped ts = new SerializableTimeStamped(time);
 
    factory.addAdvisor(new DefaultIntroductionAdvisor(new DelegatingIntroductionInterceptor(ts)));
    factory.addAdvice(new SerializableNopInterceptor());
View Full Code Here

        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.
        // Not sure if this is needed....
        pf.addInterface(AopInfrastructureBean.class);

        return pf.getProxy(cbf.getBeanClassLoader());
    }

    /**
 
View Full Code Here

    if (!shouldProxyTargetClass(beanClass, beanName)) {
      // Must allow for introductions; can't just set interfaces to
      // the target's interfaces only.
      Class[] targetInterfaces = ClassUtils.getAllInterfacesForClass(beanClass, this.proxyClassLoader);
      for (int i = 0; i < targetInterfaces.length; i++) {
        proxyFactory.addInterface(targetInterfaces[i]);
      }
    }

    Advisor[] advisors = buildAdvisors(beanName, specificInterceptors);
    for (int i = 0; i < advisors.length; i++) {
View Full Code Here

   */
  protected Object getProxyForService() {
    checkService();
    checkServiceInterface();
    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.addInterface(getServiceInterface());
    if (isRegisterTraceInterceptor()) {
      proxyFactory.addAdvice(new RemoteInvocationTraceInterceptor(getExporterName()));
    }
    proxyFactory.setTarget(getService());
    return proxyFactory.getProxy(getBeanClassLoader());
View Full Code Here

        for(int i=0; i<advisors.length; ++i)
        {
            proxyFactory.addAdvisor(advisors[i]);
        }

        proxyFactory.addInterface(SpringProxy.class);
        return proxyFactory.getProxy(instance.getClass().getClassLoader());
    }
}
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.