Package org.apache.webbeans.intercept.InterceptorResolutionService

Examples of org.apache.webbeans.intercept.InterceptorResolutionService.BeanInterceptorInfo


    }
   
    @Override
    protected void defineLifecycleInterceptors(Bean<T> bean, AnnotatedType<T> annotatedType, WebBeansContext webBeansContext)
    {
        BeanInterceptorInfo interceptorInfo = getInterceptorInfo();
       
        postConstructInterceptors
            = getLifecycleInterceptors(interceptorInfo.getEjbInterceptors(), interceptorInfo.getCdiInterceptors(), InterceptionType.POST_CONSTRUCT);

        preDestroyInterceptors
            = getLifecycleInterceptors(interceptorInfo.getEjbInterceptors(), interceptorInfo.getCdiInterceptors(), InterceptionType.PRE_DESTROY);

        final Constructor<?> constructor = getConstructor().getJavaMember();
        final InterceptorResolutionService.BusinessMethodInterceptorInfo constructorInterceptorInfo =
                                interceptorInfo.getConstructorInterceptorInfos().get(getConstructor().getJavaMember());
        final Interceptor<?>[] constructorEjbInterceptorArray = constructorInterceptorInfo == null ?
                                            null : constructorInterceptorInfo.getEjbInterceptors();
        final List<Interceptor<?>> constructorEjbInterceptors = constructorEjbInterceptorArray == null ?
                                            Collections.<Interceptor<?>>emptyList() : asList(constructorEjbInterceptorArray);
        aroundConstructInterceptors = getLifecycleInterceptors(
                constructorEjbInterceptors,
                interceptorInfo.getConstructorCdiInterceptors(),
                InterceptionType.AROUND_CONSTRUCT);
    }
View Full Code Here


                validatePassivationCapableDependencies(bean, bean.getInjectionPoints());
            }
            if (bean.getProducer() instanceof InjectionTargetImpl)
            {
                InjectionTargetImpl<T> injectionTarget = (InjectionTargetImpl<T>)bean.getProducer();
                BeanInterceptorInfo interceptorInfo = injectionTarget.getInterceptorInfo();
                if (interceptorInfo != null)
                {
                    for (Interceptor<?> ejbInterceptor: interceptorInfo.getEjbInterceptors())
                    {
                        validatePassivationCapableDependency(bean, ejbInterceptor);
                    }
                    for (Interceptor<?> cdiInterceptor: interceptorInfo.getCdiInterceptors())
                    {
                        validatePassivationCapableDependency(bean, cdiInterceptor);
                    }
                    for (Decorator<?> decorators: interceptorInfo.getDecorators())
                    {
                        validatePassivationCapableDependency(bean, decorators);
                    }
                }
            }
View Full Code Here

    }
   
    @Override
    protected void defineLifecycleInterceptors(Bean<T> bean, AnnotatedType<T> annotatedType, WebBeansContext webBeansContext)
    {
        BeanInterceptorInfo interceptorInfo = getInterceptorInfo();
       
        postConstructInterceptors
            = getLifecycleInterceptors(interceptorInfo.getEjbInterceptors(), interceptorInfo.getCdiInterceptors(), InterceptionType.POST_CONSTRUCT);

        preDestroyInterceptors
            = getLifecycleInterceptors(interceptorInfo.getEjbInterceptors(), interceptorInfo.getCdiInterceptors(), InterceptionType.PRE_DESTROY);

        if (CDI11s.AROUND_CONSTRUCT != null)
        {
            aroundConstructInterceptors = getLifecycleInterceptors(interceptorInfo.getEjbInterceptors(), interceptorInfo.getCdiInterceptors(), CDI11s.AROUND_CONSTRUCT);
        }
        else
        {
            aroundConstructInterceptors = new ArrayList<Interceptor<?>>();
        }
View Full Code Here

        InterceptorResolutionService ir = new InterceptorResolutionService(getWebBeansContext());
        AnnotatedType<ClassInterceptedClass> annotatedType = getBeanManager().createAnnotatedType(ClassInterceptedClass.class);
        Bean<ClassInterceptedClass> bean =
                (Bean<ClassInterceptedClass>) getBeanManager().resolve((Set) getBeanManager().getBeans(ClassInterceptedClass.class));

        BeanInterceptorInfo interceptorInfo = ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(), annotatedType);
        Assert.assertNotNull(interceptorInfo);

        Assert.assertNotNull(interceptorInfo.getCdiInterceptors());
        Assert.assertEquals(1, interceptorInfo.getCdiInterceptors().size());

        Assert.assertEquals(0, interceptorInfo.getDecorators().size());

        Map<Method, BusinessMethodInterceptorInfo> methodInterceptorInfos = interceptorInfo.getBusinessMethodsInfo();
        Assert.assertNotNull(methodInterceptorInfos);
        Assert.assertEquals(12, methodInterceptorInfos.size());

        for (BusinessMethodInterceptorInfo mi : methodInterceptorInfos.values())
        {
            Assert.assertEquals(1, mi.getCdiInterceptors().length);
        }

        Assert.assertEquals(2, interceptorInfo.getLifecycleMethodInterceptorInfos().size());
        LifecycleMethodInfo lmiPostConstruct = interceptorInfo.getLifecycleMethodInterceptorInfos().get(InterceptionType.POST_CONSTRUCT);
        Assert.assertNotNull(lmiPostConstruct);
        Assert.assertNull(lmiPostConstruct.getMethodInterceptorInfo().getCdiInterceptors());

        shutDownContainer();
    }
View Full Code Here

        InterceptorResolutionService ir = new InterceptorResolutionService(getWebBeansContext());
        AnnotatedType<StereotypeInterceptedClass> annotatedType = getBeanManager().createAnnotatedType(StereotypeInterceptedClass.class);
        Bean<StereotypeInterceptedClass> bean =
                (Bean<StereotypeInterceptedClass>) getBeanManager().resolve((Set) getBeanManager().getBeans(StereotypeInterceptedClass.class));

        BeanInterceptorInfo interceptorInfo = ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(), annotatedType);
        Assert.assertNotNull(interceptorInfo);

        Assert.assertNotNull(interceptorInfo.getCdiInterceptors());
        Assert.assertEquals(1, interceptorInfo.getCdiInterceptors().size());

        shutDownContainer();
    }
View Full Code Here

        InterceptorResolutionService ir = new InterceptorResolutionService(getWebBeansContext());
        AnnotatedType<ClassMultiInterceptedClass> annotatedType = getBeanManager().createAnnotatedType(ClassMultiInterceptedClass.class);
        Bean<ClassMultiInterceptedClass> bean =
                (Bean<ClassMultiInterceptedClass>) getBeanManager().resolve((Set) getBeanManager().getBeans(ClassMultiInterceptedClass.class));

        BeanInterceptorInfo interceptorInfo = ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(), annotatedType);
        Assert.assertNotNull(interceptorInfo);

        Assert.assertNotNull(interceptorInfo.getCdiInterceptors());
        Assert.assertEquals(3, interceptorInfo.getCdiInterceptors().size());

        Assert.assertEquals(0, interceptorInfo.getDecorators().size());

        Map<Method, BusinessMethodInterceptorInfo> methodInterceptorInfos = interceptorInfo.getBusinessMethodsInfo();
        Assert.assertNotNull(methodInterceptorInfos);
        Assert.assertEquals(7, methodInterceptorInfos.size());

        for (BusinessMethodInterceptorInfo mi : methodInterceptorInfos.values())
        {
            Assert.assertEquals(3, mi.getCdiInterceptors().length);
        }

        Assert.assertEquals(2, interceptorInfo.getLifecycleMethodInterceptorInfos().size());
        LifecycleMethodInfo lmiPostConstruct = interceptorInfo.getLifecycleMethodInterceptorInfos().get(InterceptionType.POST_CONSTRUCT);
        Assert.assertNotNull(lmiPostConstruct);
        Assert.assertNotNull(lmiPostConstruct.getMethodInterceptorInfo().getCdiInterceptors());

        shutDownContainer();
    }
View Full Code Here

        InterceptorResolutionService ir = new InterceptorResolutionService(getWebBeansContext());
        AnnotatedType<MethodInterceptedClass> annotatedType = getBeanManager().createAnnotatedType(MethodInterceptedClass.class);
        Bean<MethodInterceptedClass> bean =
                (Bean<MethodInterceptedClass>) getBeanManager().resolve((Set) getBeanManager().getBeans(MethodInterceptedClass.class));

        BeanInterceptorInfo interceptorInfo = ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(), annotatedType);
        Assert.assertNotNull(interceptorInfo);

        Assert.assertNotNull(interceptorInfo.getCdiInterceptors());
        Assert.assertEquals(2, interceptorInfo.getCdiInterceptors().size());

        Assert.assertEquals(0, interceptorInfo.getDecorators().size());

        Map<Method, BusinessMethodInterceptorInfo> methodInterceptorInfos = interceptorInfo.getBusinessMethodsInfo();
        Assert.assertNotNull(methodInterceptorInfos);
        Assert.assertEquals(2, methodInterceptorInfos.size());

        for (Map.Entry<Method, BusinessMethodInterceptorInfo> mi : methodInterceptorInfos.entrySet())
        {
            if (mi.getKey().getName().equals("getMeaningOfLife"))
            {
                Assert.assertEquals(1, mi.getValue().getCdiInterceptors().length);
            }
            else if (mi.getKey().getName().equals("setMeaningOfLife"))
            {
                Assert.assertEquals(2, mi.getValue().getCdiInterceptors().length);
            }
        }

        Assert.assertEquals(1, interceptorInfo.getNonInterceptedMethods().size());

        shutDownContainer();
    }
View Full Code Here

        InterceptorResolutionService ir = new InterceptorResolutionService(getWebBeansContext());
        AnnotatedType<DecoratedClass> annotatedType = getBeanManager().createAnnotatedType(DecoratedClass.class);
        Bean<DecoratedClass> bean =
                (Bean<DecoratedClass>) getBeanManager().resolve((Set) getBeanManager().getBeans(DecoratedClass.class, new AnnotationLiteral<Binding1>() {}));

        BeanInterceptorInfo interceptorInfo = ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(), annotatedType);
        Assert.assertNotNull(interceptorInfo);

        Assert.assertNotNull(interceptorInfo.getBusinessMethodsInfo());
        Assert.assertEquals(1, interceptorInfo.getBusinessMethodsInfo().size());

        Assert.assertNotNull(interceptorInfo.getDecorators());
        Assert.assertEquals(1, interceptorInfo.getDecorators().size());

        shutDownContainer();
    }
View Full Code Here

        InterceptorResolutionService ir = new InterceptorResolutionService(getWebBeansContext());
        AnnotatedType<Cow> annotatedType = getBeanManager().createAnnotatedType(Cow.class);
        Bean<Cow> bean = (Bean<Cow>) getBeanManager().resolve((Set) getBeanManager().getBeans(Cow.class));
        Assert.assertNotNull(bean);

        BeanInterceptorInfo interceptorInfo = ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(), annotatedType);
        Assert.assertNotNull(interceptorInfo);

        Assert.assertNotNull(interceptorInfo.getBusinessMethodsInfo());
        Assert.assertEquals(1, interceptorInfo.getBusinessMethodsInfo().size());

        Assert.assertNotNull(interceptorInfo.getDecorators());
        Assert.assertEquals(1, interceptorInfo.getDecorators().size());

        shutDownContainer();
    }
View Full Code Here

        InterceptorResolutionService ir = new InterceptorResolutionService(getWebBeansContext());
        AnnotatedType<InterceptedComponent> annotatedType = getBeanManager().createAnnotatedType(InterceptedComponent.class);
        Bean<InterceptedComponent> bean
                = (Bean<InterceptedComponent>) getBeanManager().resolve((Set) getBeanManager().getBeans(InterceptedComponent.class));

        BeanInterceptorInfo interceptorInfo = ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(), annotatedType);
        Assert.assertNotNull(interceptorInfo);
        Assert.assertNotNull(interceptorInfo.getBusinessMethodsInfo());
        Assert.assertEquals(2, interceptorInfo.getBusinessMethodsInfo().size());

        for (Map.Entry<Method, BusinessMethodInterceptorInfo> mi : interceptorInfo.getBusinessMethodsInfo().entrySet())
        {
            Assert.assertNotNull(mi.getValue().getEjbInterceptors());
            Assert.assertEquals(1, mi.getValue().getEjbInterceptors().length);
        }
View Full Code Here

TOP

Related Classes of org.apache.webbeans.intercept.InterceptorResolutionService.BeanInterceptorInfo

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.