Package org.springframework.aop

Examples of org.springframework.aop.TargetSource


     * be returned from this method.
     */
    public static Object getRealBean(Object proxy) throws Exception
    {
        Advised advised = (Advised) proxy;
        TargetSource targetSource = advised.getTargetSource();
        Object real = targetSource.getTarget();
       
        // Possibly we could add a method on the ScopedBeanTargetSource class to test
        // whether the target bean exists. Then here we could cast TargetSource to
        // ScopedBeanTargetSource and return null if the target does not exist. This
        // might be useful, but let's leave that until someone actually has a use-case
View Full Code Here


    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
        this.beanFactory = beanFactory;
    }

    public ExecutorTemplate get() {
        TargetSource targetSource = (TargetSource) this.beanFactory.getBean("executorTemplateTargetSource");
        try {
            return (ExecutorTemplate) targetSource.getTarget();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

            throw new RuntimeException(e);
        }
    }

    public void release(ExecutorTemplate target) {
        TargetSource targetSource = (TargetSource) this.beanFactory.getBean("executorTemplateTargetSource");
        try {
            targetSource.releaseTarget(target);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

    protected Class<?> getRealClassInternal(Object o) {
        if (AopUtils.isAopProxy(o) && (o instanceof Advised)) {
            Advised advised = (Advised)o;
            try {
                TargetSource targetSource = advised.getTargetSource();
               
                Object target = null;
               
                try {
                    target = targetSource.getTarget();
                } catch (BeanCreationException ex) {
                    // some scopes such as 'request' may not
                    // be active on the current thread yet
                    return getRealClassFromClassInternal(targetSource.getTargetClass());
                }
               
                if (target == null) {
                    Class<?> targetClass = AopUtils.getTargetClass(o);
                    if (targetClass != null) {
View Full Code Here

        Project basicProjectTargetReturned = basicProjectProxyUtil
                .getTarget(basicProject);

        // Project est un proxy, il faut récupérer la target
        TargetSource targetSource = ((Advised) basicProject).getTargetSource();
        Object target = ((SingletonTargetSource) targetSource).getTarget();

        assertEquals(basicProjectTargetReturned, target);

    }
View Full Code Here

    public Project getTarget(Project project) {

        if (project instanceof Advised) {

            // Project est un proxy, il faut récupérer la target
            TargetSource targetSource = ((Advised) project)
                    .getTargetSource();
            Object target = ((SingletonTargetSource) targetSource).getTarget();

            // retour de la target
            return (Project) target;
View Full Code Here

       
        // Test le retour de la liste
        assertEquals(set, basicProject.getMembers());
       
        // test que la liste est bien stock�e dans l'object targett�
        TargetSource targetSource = ((Advised) basicProject).getTargetSource();       
        Object target = ((SingletonTargetSource) targetSource).getTarget();
        Project basicProjectTarget = (Project) target;
       
        assertEquals(set, basicProjectTarget.getMembers());
View Full Code Here

        // Test le retour de la liste
        assertEquals(set2, basicProject.getMembers());
       
        // test que la liste est bien stock�e dans l'object targett�
        TargetSource targetSource = ((Advised) basicProject).getTargetSource();       
        Object target = ((SingletonTargetSource) targetSource).getTarget();
        Project basicProjectTarget = (Project) target;
       
        assertEquals(set2, basicProjectTarget.getMembers());
View Full Code Here

        // Test sur la retour de la liste
        assertEquals(set2, basicProject.getMembers());
       
        // test que la liste est bien stock�e dans l'object targett�
        TargetSource targetSource = ((Advised) basicProject).getTargetSource();       
        Object target = ((SingletonTargetSource) targetSource).getTarget();
        Project basicProjectTarget = (Project) target;
       
        assertEquals(set2, basicProjectTarget.getMembers());
View Full Code Here

        Project basicProjectTargetReturned = basicProjectProxyUtil
                .getTarget(basicProject);

        // Project est un proxy, il faut r�cup�rer la target
        TargetSource targetSource = ((Advised) basicProject).getTargetSource();
        Object target = ((SingletonTargetSource) targetSource).getTarget();

        assertEquals(basicProjectTargetReturned, target);

    }
View Full Code Here

TOP

Related Classes of org.springframework.aop.TargetSource

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.