Examples of WeldManager


Examples of org.jboss.weld.manager.api.WeldManager

      this.bootstrapBean = bootstrapBean;
   }

   public <T> T create(Class<T> clazz, Object[] objects) throws IllegalArgumentException, InvalidConstructionParamsException, BeanInstantiationException
   {
      WeldManager weldManager = getWeldManager();
      EjbDescriptor<Object> ejbDescriptor = weldManager.getEjbDescriptor(enterpriseBeanMetaData.getEjbName());
      if (ejbDescriptor.getBeanClass().equals(clazz))
      {
         SessionBean<Object> bean = (SessionBean) weldManager.getBean(ejbDescriptor);
         InjectionTarget<Object> injectionTarget = weldManager.createInjectionTarget(ejbDescriptor);
         CreationalContext<Object> creationalContext = weldManager.createCreationalContext(bean);
         T instance = (T) injectionTarget.produce(creationalContext);
         return instance;
      }
      else
      {
View Full Code Here

Examples of org.jboss.weld.manager.api.WeldManager

      }
   }

   private WeldManager getWeldManager()
   {
      WeldManager weldManager = weldManagerRef.get();
      if (weldManager == null)
      {
         weldManager = locateWeldManager();
      }
      weldManagerRef.compareAndSet(null, weldManager);
View Full Code Here

Examples of org.jboss.weld.manager.api.WeldManager

   }

   public <T> void inject(InjectionContext<T> injectionContext) throws InjectionException
   {
       if (isInterceptor(injectionContext.getInjectionTarget())) {
           WeldManager weldManager = initWeldManagerIfNecessary();
           Object instance = injectionContext.getInjectionTarget();

           if (weldManager == null)
              throw new IllegalArgumentException("Null bean manager.");

           CreationalContext<Object> creationalContext =  weldManager.createCreationalContext(null);
           InjectionTarget<Object> injectionTarget = (InjectionTarget<Object>) weldManager.fireProcessInjectionTarget(weldManager.createAnnotatedType(instance.getClass()));
           injectionTarget.inject(instance, creationalContext);
       }
       injectionContext.proceed();
   }
View Full Code Here

Examples of org.jboss.weld.manager.api.WeldManager

       injectionContext.proceed();
   }

   private WeldManager initWeldManagerIfNecessary()
   {
      WeldManager weldManager = weldManagerRef.get();
      if (weldManager == null)
      {
         weldManager = locateWeldManager();
      }
      weldManagerRef.compareAndSet(null, weldManager);
View Full Code Here

Examples of org.jboss.weld.manager.api.WeldManager

      this.bootstrapBean = bootstrapBean;
   }

   public <T> void inject(InjectionContext<T> injectionContext) throws InjectionException
   {
      WeldManager weldManager = initWeldManagerIfNecessary();
      Object instance = injectionContext.getInjectionTarget();

      if (weldManager == null)
         throw new IllegalArgumentException("Null bean manager.");

      CreationalContext<Object> creationalContext =  weldManager.createCreationalContext(null);
      InjectionTarget<Object> injectionTarget = (InjectionTarget<Object>) weldManager.fireProcessInjectionTarget(weldManager.createAnnotatedType(instance.getClass()));
      injectionTarget.inject(instance, creationalContext);
      injectionContext.proceed();
   }
View Full Code Here

Examples of org.jboss.weld.manager.api.WeldManager

      injectionContext.proceed();
   }

   private WeldManager initWeldManagerIfNecessary()
   {
      WeldManager weldManager = weldManagerRef.get();
      if (weldManager == null)
      {
         weldManager = locateWeldManager();
      }
      weldManagerRef.compareAndSet(null, weldManager);
View Full Code Here

Examples of org.jboss.weld.manager.api.WeldManager

    * @param instance to operate upon
    */
   private void handleWeldInjection(final Object instance)
   {
       try {
           WeldManager beanManager = (WeldManager) new InitialContext().lookup(BEAN_MANAGER_JNDI_NAME);
           NonContextualObjectInjectionHelper.injectNonContextualInstance(instance, beanManager);
       } catch (NamingException e) {
           throw new IllegalStateException("Unable to locate BeanManager");
       }
   }
View Full Code Here

Examples of org.jboss.weld.manager.api.WeldManager

                  .startInitialization()
                  .deployBeans()
                  .validateBeans()
                  .endInitialization();

      WeldManager manager = bootstrap.getManager(beanArchive);
     
      weldBootstrapProducer.set(bootstrap);
      weldManagerProducer.set(manager);
      beanManagerProducer.set(manager);
     
View Full Code Here

Examples of org.jboss.weld.manager.api.WeldManager

        // First get BeanDeploymentArchive for this ejb
        BeanDeploymentArchive bda = getBDAForBeanClass(topLevelBundleDesc, ejb.getEjbClassName());
    
        WeldBootstrap bootstrap = weldDeployer.getBootstrapForApp(ejb.getEjbBundleDescriptor().getApplication());
        WeldManager weldManager = bootstrap.getManager(bda);

        org.jboss.weld.ejb.spi.EjbDescriptor ejbDesc = weldManager.getEjbDescriptor(ejb.getName());

        // Get an the Bean object
        Bean<?> bean = weldManager.getBean(ejbDesc);

        // Create the injection target
        InjectionTarget it = weldManager.createInjectionTarget(ejbDesc);

        // Per instance required, create the creational context
        CreationalContext<?> cc = weldManager.createCreationalContext(bean);  
 
      Object beanInstance = instance;
   
      if( beanInstance == null ) {
          // Create instance , perform constructor injection.
View Full Code Here

Examples of org.jboss.weld.manager.api.WeldManager

        // First get BeanDeploymentArchive for this ejb
        BeanDeploymentArchive bda = getBDAForBeanClass(topLevelBundleDesc, ejb.getEjbClassName());
    
        WeldBootstrap bootstrap = weldDeployer.getBootstrapForApp(ejb.getEjbBundleDescriptor().getApplication());
        WeldManager weldManager = bootstrap.getManager(bda);

        org.jboss.weld.ejb.spi.EjbDescriptor ejbDesc = weldManager.getEjbDescriptor(ejb.getName());

        // Get an the Bean object
        Bean<?> bean = weldManager.getBean(ejbDesc);

        // Create the injection target
        InjectionTarget it = weldManager.createInjectionTarget(ejbDesc);

        // Per instance required, create the creational context
        CreationalContext<?> cc = weldManager.createCreationalContext(bean);  
 
      Object beanInstance = instance;
   
      if( beanInstance == null ) {
          // Create instance , perform constructor injection.
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.