Examples of createCreationalContext()


Examples of javax.enterprise.inject.spi.BeanManager.createCreationalContext()

            if (manager != null && Container.available()) {

                final Bean<BoundSessionContext> sessionContextBean = (Bean<BoundSessionContext>) manager.resolve(manager
                        .getBeans(BoundSessionContext.class, BoundLiteral.INSTANCE));
                CreationalContext<?> ctx = manager.createCreationalContext(sessionContextBean);
                final BoundSessionContext sessionContext = (BoundSessionContext) manager.getReference(sessionContextBean,
                        BoundSessionContext.class, ctx);
                sessionContext.associate(sessionContexts.get());
                sessionContext.activate();
View Full Code Here

Examples of javax.enterprise.inject.spi.BeanManager.createCreationalContext()

                sessionContext.associate(sessionContexts.get());
                sessionContext.activate();

                final Bean<BoundRequestContext> requestContextBean = (Bean<BoundRequestContext>) manager.resolve(manager
                        .getBeans(BoundRequestContext.class, BoundLiteral.INSTANCE));
                ctx = manager.createCreationalContext(requestContextBean);
                final BoundRequestContext requestContext = (BoundRequestContext) manager.getReference(requestContextBean,
                        BoundRequestContext.class, ctx);
                requestContext.associate(requestContexts.get());
                requestContext.activate();
View Full Code Here

Examples of javax.enterprise.inject.spi.BeanManager.createCreationalContext()

                requestContext.associate(requestContexts.get());
                requestContext.activate();

                final Bean<BoundConversationContext> conversationContextBean = (Bean<BoundConversationContext>) manager
                        .resolve(manager.getBeans(BoundConversationContext.class, BoundLiteral.INSTANCE));
                ctx = manager.createCreationalContext(conversationContextBean);
                final BoundConversationContext conversationContext = (BoundConversationContext) manager.getReference(
                        conversationContextBean, BoundConversationContext.class, ctx);
                BoundRequest request = new MutableBoundRequest(requestContexts.get(), sessionContexts.get());
                boundRequests.set(request);
                conversationContext.associate(request);
View Full Code Here

Examples of javax.enterprise.inject.spi.BeanManager.createCreationalContext()

            final BeanManager manager = (BeanManager) new InitialContext().lookup("java:comp/BeanManager");

            if (manager != null && Container.available()) {
                final Bean<BoundSessionContext> sessionContextBean = (Bean<BoundSessionContext>) manager.resolve(manager.getBeans(
                        BoundSessionContext.class, BoundLiteral.INSTANCE));
                CreationalContext<?> ctx = manager.createCreationalContext(sessionContextBean);
                final BoundSessionContext sessionContext = (BoundSessionContext) manager.getReference(sessionContextBean,
                        BoundSessionContext.class, ctx);
                sessionContext.deactivate();
                sessionContext.dissociate(sessionContexts.get());
View Full Code Here

Examples of javax.enterprise.inject.spi.BeanManager.createCreationalContext()

                sessionContext.deactivate();
                sessionContext.dissociate(sessionContexts.get());

                final Bean<BoundRequestContext> requestContextBean = (Bean<BoundRequestContext>) manager.resolve(manager.getBeans(
                        BoundRequestContext.class, BoundLiteral.INSTANCE));
                ctx = manager.createCreationalContext(requestContextBean);
                final BoundRequestContext requestContext = (BoundRequestContext) manager.getReference(requestContextBean,
                        BoundRequestContext.class, ctx);
                requestContext.deactivate();
                requestContext.dissociate(requestContexts.get());
View Full Code Here

Examples of javax.enterprise.inject.spi.BeanManager.createCreationalContext()

                requestContext.deactivate();
                requestContext.dissociate(requestContexts.get());

                final Bean<BoundConversationContext> conversationContextBean = (Bean<BoundConversationContext>) manager
                        .resolve(manager.getBeans(BoundConversationContext.class, BoundLiteral.INSTANCE));
                ctx = manager.createCreationalContext(conversationContextBean);
                final BoundConversationContext conversationContext = (BoundConversationContext) manager.getReference(
                        conversationContextBean, BoundConversationContext.class, ctx);
                conversationContext.deactivate();
                conversationContext.dissociate(boundRequests.get());
            }
View Full Code Here

Examples of javax.enterprise.inject.spi.BeanManager.createCreationalContext()

    }

    public <T> T injectFields(T instance)
    {
        BeanManager beanManager = getBeanManager();
        CreationalContext creationalContext = beanManager.createCreationalContext(null);

        AnnotatedType annotatedType = beanManager.createAnnotatedType(instance.getClass());
        InjectionTarget injectionTarget = beanManager.createInjectionTarget(annotatedType);
        injectionTarget.inject(instance, creationalContext);
        return instance;
View Full Code Here

Examples of javax.enterprise.inject.spi.BeanManager.createCreationalContext()

     */
    public <TYPE> TYPE lookup(Class<TYPE> clazz) throws BeanLocationException {
        BeanManager beanManager = jndiLookup("java:comp/BeanManager", BeanManager.class);

        Bean<TYPE> handlerBean = (Bean<TYPE>) beanManager.getBeans(clazz).iterator().next();
        CreationalContext<TYPE> ctx = beanManager.createCreationalContext(handlerBean);
        return (TYPE) beanManager.getReference(handlerBean, clazz, ctx);

    }

    /**
 
View Full Code Here

Examples of javax.enterprise.inject.spi.BeanManager.createCreationalContext()

        Set<Bean<?>> beans  = bm.getBeans(name);
        if (beans.isEmpty()) throw new IllegalArgumentException("Bean not found by name: " + name);

        // Get the first bean found for the given name
        Bean bean = beans.iterator().next();
        CreationalContext ctx = bm.createCreationalContext(bean);
        Object o = bm.getReference(bean, bean.getBeanClass(), ctx);
        return o;
    }

    public static <T> T getBeanByType(Class<T> type) {
View Full Code Here

Examples of javax.enterprise.inject.spi.BeanManager.createCreationalContext()

        if (beans.isEmpty()) throw new IllegalArgumentException("Bean not found by type: " + type.getName());

        // Get the bean that matches exactly the given class.
        for (Bean<?> bean : beans) {
            if (bean.getBeanClass().equals(type)) {
                CreationalContext ctx = bm.createCreationalContext(bean);
                Object o = bm.getReference(bean, bean.getBeanClass(), ctx);
                return type.cast(o);
            }
        }
        // Get the first bean found that implements the given type.
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.