Package org.springframework.aop.framework

Examples of org.springframework.aop.framework.ProxyFactory


        } else {
            targetClass = null;
        }
       
        ServiceEndpointTargetSource targetSource = new ListBackedRegistryTargetSource(this.list, targetClass);
        ProxyFactory proxyFactory = new ProxyFactory();
       
        if (targetSource.getTargetClass() == null) {
            //not proxying by class, so proxy by interface
            ProxyFactorySourceUtils.addInterfaces(proxyFactory, proxyTypes);
        }
View Full Code Here


     * @param the bean for which the proxy is being created.
     */
    public final ProxyFactory createProxyFactory(ProxyFactorySource proxyFactorySource, String beanName) {
       
        proxyFactorySource.init();
        ProxyFactory proxyFactory = proxyFactorySource.getProxyFactory();
        ServiceEndpointTargetSource targetSource = proxyFactorySource.getTargetSource();
       
        addInterceptor(beanName, proxyFactory, targetSource);
       
        return proxyFactory;
View Full Code Here

        super.init();
    }

    protected Object maybeGetProxy(ServiceRegistryEntry reference) {
        final StaticServiceReferenceProxyFactorySource proxyFactorySource = new StaticServiceReferenceProxyFactorySource(getProxyTypes(), reference);
        final ProxyFactory proxyFactory = this.proxyFactoryCreator.createProxyFactory(proxyFactorySource, beanName);
        return proxyFactory.getProxy();
    }
View Full Code Here

        super.init();
    }

    protected Object maybeGetProxy(ServiceRegistryEntry reference) {
        final StaticServiceReferenceProxyFactorySource proxyFactorySource = new StaticServiceReferenceProxyFactorySource(getProxyTypes(), reference);
        final ProxyFactory proxyFactory = this.proxyFactoryCreator.createProxyFactory(proxyFactorySource, beanName);
        return proxyFactory.getProxy();
    }
View Full Code Here

       
        Assert.notNull(reference, "reference cannot be null");
       
        ServiceEndpointTargetSource targetSource = new StaticServiceRegistryTargetSource(reference);
       
        ProxyFactory proxyFactory = new ProxyFactory();
        if (!ArrayUtils.isNullOrEmpty(proxyTypes)) {
            ProxyFactorySourceUtils.addInterfaces(proxyFactory, proxyTypes);
        } else {
            boolean isFinal = Modifier.isFinal(reference.getServiceBeanReference().getService().getClass().getModifiers());
            if (isFinal) {
View Full Code Here

    protected ProxyFactory createProxyFactory() {
       
        BeanRetrievingProxyFactorySource source = new BeanRetrievingProxyFactorySource(super.getServiceRegistry(), exportTypes, getBeanName(), true);
       
        ProxyFactory createDynamicProxyFactory = getProxyFactoryCreator().createProxyFactory(source, getBeanName());
        return createDynamicProxyFactory;
    }
View Full Code Here

    protected ProxyFactory createProxyFactory() {
        String registryBeanName = getRegistryExportName();
       
        BeanRetrievingProxyFactorySource source = new BeanRetrievingProxyFactorySource(super.getServiceRegistry(), proxyTypes, registryBeanName, false);
       
        ProxyFactory createDynamicProxyFactory = getProxyFactoryCreator().createProxyFactory(source, getBeanName());
        return createDynamicProxyFactory;
    }
View Full Code Here

        Assert.notNull(proxyTypes, "proxyTypes cannot be null");
        Assert.notEmpty(proxyTypes, "proxyTypes cannot be empty");
       
        //this will return a non-null value if single interface which is concrete class
        ServiceEndpointTargetSource targetSource = new BeanRetrievingServiceRegistryTargetSource(this.serviceRegistry, registryBeanName, proxyTypes, exportTypesOnly);
        ProxyFactory proxyFactory = new ProxyFactory();
       
        if (targetSource.getTargetClass() == null) {
            //not proxying by class, so proxy by interface
            ProxyFactorySourceUtils.addInterfaces(proxyFactory, proxyTypes);
        }
View Full Code Here

   
    public void testInfrastructure() throws Exception {
        final List<String> list = new ArrayList<String>();
        ServiceRegistryEntry ref = new StaticServiceRegistryEntry(list, "mybean", "mymod", ClassUtils.getDefaultClassLoader());
       
        final ProxyFactory proxyFactory = creator.createProxyFactory(new StaticServiceReferenceProxyFactorySource(classes, ref), null, null);
       
        Object proxy = proxyFactory.getProxy();
        assertTrue(proxy instanceof List);
        assertFalse(proxy instanceof ArrayList);
        assertTrue(proxy instanceof InfrastructureProxy);
       
        InfrastructureProxy iproxy = (InfrastructureProxy) proxy;
View Full Code Here

   
    public void testInfrastructureClassOnly() throws Exception {
        final List<String> list = new ArrayList<String>();
        ServiceRegistryEntry ref = new StaticServiceRegistryEntry(list, "mybean", "mymod", ClassUtils.getDefaultClassLoader());
       
        final ProxyFactory proxyFactory = creator.createProxyFactory(new StaticServiceReferenceProxyFactorySource(null, ref), null, null);
       
        Object proxy = proxyFactory.getProxy();
        assertTrue(proxy instanceof ArrayList);
        assertFalse(proxy instanceof InfrastructureProxy);
    }
View Full Code Here

TOP

Related Classes of org.springframework.aop.framework.ProxyFactory

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.