Package javax.enterprise.inject.spi

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


                    {
                        if(parameter.getBaseType().equals(InjectionPoint.class))
                        {
                            BeanManager manager = injectionOwnerBean.getWebBeansContext().getBeanManagerImpl();
                            Bean<?> injectionPointBean = manager.getBeans(InjectionPoint.class, new DefaultLiteral()).iterator().next();
                            Object reference = manager.getReference(injectionPointBean, InjectionPoint.class, manager.createCreationalContext(injectionPointBean));

                            dependentParameters.put(injectionPointBean, reference);
                            list.add(reference);
                           
                            injectionPoint = true;
View Full Code Here


           
            BeanManager manager = WebBeansContext.getInstance().getBeanManagerImpl();
            Set<Bean<?>> beans = manager.getBeans(Car.class, new Annotation[0]);
            Bean<?> carBean = beans.iterator().next();
           
            Car car = (Car)manager.getReference(carBean , Car.class , manager.createCreationalContext(carBean));
           
            return Tck.testsFor(car, false, true);
           
        } catch(DeploymentException e)
        {
View Full Code Here

        BeanManager bm = getBeanManager();
        Set<Bean<?>> beans = getBeanManager().getBeans(PersonalDataBean.class);
        Assert.assertNotNull(beans);
        Assert.assertTrue(beans.size() == 1);
        Bean pdbBean = beans.iterator().next();
        CreationalContext<PersonalDataBean> pdbCreational = bm.createCreationalContext(pdbBean);
        Assert.assertNotNull(pdbCreational);

        // oki, now let's serializeBean the CreationalContext
        byte[] serial = serializeObject(pdbCreational);
        CreationalContext<?> cc2 = (CreationalContext<?>) deSerializeObject(serial);
View Full Code Here

    @SuppressWarnings("unchecked")
    public Conversation getConversationBeanReference()
    {
        BeanManager beanManager = webBeansContext.getBeanManagerImpl();
        Bean<Conversation> bean = (Bean<Conversation>)beanManager.getBeans(Conversation.class, new DefaultLiteral()).iterator().next();
        Conversation conversation =(Conversation) beanManager.getReference(bean, Conversation.class, beanManager.createCreationalContext(bean));

        return conversation;
    }

    /**
 
View Full Code Here

      BeanManager bm = InfinispanExtension.getBeanManagerController().getRegisteredBeanManager();
      ContextInputCache.set(inputCache);
      Class<Callable<T>> clazz = (Class<Callable<T>>) task.getClass();
      AnnotatedType<Callable<T>> type = bm.createAnnotatedType(clazz);
      InjectionTarget<Callable<T>> it = bm.createInjectionTarget(type);
      CreationalContext<Callable<T>> ctx = bm.createCreationalContext(null);
      it.inject(task, ctx);
      it.postConstruct(task);   
   }

   @Override
View Full Code Here

      BeanManager bm = InfinispanExtension.getBeanManagerController().getRegisteredBeanManager();
      ContextInputCache.set(inputCache);
      Class<Mapper<KIn, VIn, KOut, VOut>> clazz = (Class<Mapper<KIn, VIn, KOut, VOut>>) mapper.getClass();
      AnnotatedType<Mapper<KIn, VIn, KOut, VOut>> type = bm.createAnnotatedType(clazz);
      InjectionTarget<Mapper<KIn, VIn, KOut, VOut>> it = bm.createInjectionTarget(type);
      CreationalContext<Mapper<KIn, VIn, KOut, VOut>> ctx = bm.createCreationalContext(null);
      it.inject(mapper, ctx);
      it.postConstruct(mapper);
   }

   @Override
View Full Code Here

   public <KOut, VOut> void onPreExecute(Reducer<KOut, VOut> reducer, Cache<?,?> cache) {
      BeanManager bm = InfinispanExtension.getBeanManagerController().getRegisteredBeanManager();
      Class<Reducer<KOut, VOut>> clazz = (Class<Reducer<KOut, VOut>>) reducer.getClass();
      AnnotatedType<Reducer<KOut, VOut>> type = bm.createAnnotatedType(clazz);
      InjectionTarget<Reducer<KOut, VOut>> it = bm.createInjectionTarget(type);
      CreationalContext<Reducer<KOut, VOut>> ctx = bm.createCreationalContext(null);
      it.inject(reducer, ctx);
      it.postConstruct(reducer);
   }

   @Override
View Full Code Here

    }

    private ApplicationUtils getUtils() {
        BeanManager bm = getBeanManager();
        Bean<ApplicationUtils> bean = (Bean<ApplicationUtils>) bm.getBeans(ApplicationUtils.class).iterator().next();
        CreationalContext<ApplicationUtils> ctx = bm.createCreationalContext(bean);
        ApplicationUtils utils = (ApplicationUtils) bm.getReference(bean, ApplicationUtils.class, ctx);
            // this could be inlined, but intentionally left this way
        return utils;
    }
}
View Full Code Here

                    logger.error("the mbean " + mbeanClass + " can't be registered because it can't be accessed", e);
                    return;
                }
                creationalContext = null;
            } else {
                creationalContext = bm.createCreationalContext(bean);
                instance = bm.getReference(bean, clazz, creationalContext);
            }

            final MBeanServer server = LocalMBeanServer.get();
            try {
View Full Code Here

{
   public static Dialogue dialogue(ServletContext servletContext)
   {
      BeanManager beanManager = new BeanManagerLocator().getBeanManager();
      Bean<?> bean = beanManager.resolve(beanManager.getBeans(Dialogue.class));
      return (Dialogue) beanManager.getReference(bean, Dialogue.class, beanManager.createCreationalContext(bean));
   }

   public static DialogueManager dialogueManager(ServletContext servletContext)
   {
      BeanManager beanManager = new BeanManagerLocator().getBeanManager();
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.