[webbeans-commits] Webbeans SVN: r826 - in ri/trunk: webbeans-ri-spi/src/main/java/org/jboss/webbeans/ejb/spi and 1 other directory.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Thu Jan 8 08:00:23 EST 2009


Author: pete.muir at jboss.org
Date: 2009-01-08 08:00:23 -0500 (Thu, 08 Jan 2009)
New Revision: 826

Modified:
   ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbResolver.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
Log:
Small update to SPI, remove injectionPointFactory.push/pop for common annotations injections

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java	2009-01-08 09:31:56 UTC (rev 825)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/SimpleBean.java	2009-01-08 13:00:23 UTC (rev 826)
@@ -23,7 +23,6 @@
 
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
-import javax.persistence.EntityManagerFactory;
 import javax.webbeans.DefinitionException;
 import javax.webbeans.Initializer;
 import javax.webbeans.InjectionPoint;
@@ -222,14 +221,11 @@
     */
    protected void injectEjbAndCommonFields(T beanInstance)
    {
-      InjectionPointFactory injectionPointFactory = manager.getInjectionPointFactory();
       for (AnnotatedField<?> field : annotatedItem.getAnnotatedFields(manager.getEjbResolver().getEJBAnnotation()))
       {
-         injectionPointFactory.pushInjectionPoint(field);
          InjectionPoint injectionPoint = new InjectionPointImpl(field, this, beanInstance);
          Object ejbInstance = manager.getEjbResolver().resolveEjb(injectionPoint, manager.getNaming());
          field.inject(beanInstance, ejbInstance);
-         injectionPointFactory.popInjectionPoint();
       }
 
       for (AnnotatedMethod<?> method : annotatedItem.getAnnotatedMethods(manager.getEjbResolver().getEJBAnnotation()))
@@ -242,9 +238,8 @@
       for (AnnotatedField<?> field : annotatedItem.getAnnotatedFields(manager.getEjbResolver().getPersistenceContextAnnotation()))
       {
          InjectionPoint injectionPoint = new InjectionPointImpl(field, this, beanInstance);
-         EntityManagerFactory entityManagerFactory = manager.getEjbResolver().resolvePersistenceUnit(injectionPoint, manager.getNaming());
-         field.inject(beanInstance, entityManagerFactory.createEntityManager());
-         injectionPointFactory.popInjectionPoint();
+         Object persistenceContext = manager.getEjbResolver().resolvePersistenceUnit(injectionPoint, manager.getNaming());
+         field.inject(beanInstance, persistenceContext);
       }
    }
 

Modified: ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbResolver.java
===================================================================
--- ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbResolver.java	2009-01-08 09:31:56 UTC (rev 825)
+++ ri/trunk/webbeans-ri-spi/src/main/java/org/jboss/webbeans/ejb/spi/EjbResolver.java	2009-01-08 13:00:23 UTC (rev 826)
@@ -2,7 +2,7 @@
 
 import java.lang.annotation.Annotation;
 
-import javax.persistence.EntityManagerFactory;
+import javax.persistence.EntityManager;
 import javax.webbeans.InjectionPoint;
 
 import org.jboss.webbeans.resources.spi.Naming;
@@ -20,7 +20,7 @@
    public static final String PROPERTY_NAME = EjbResolver.class.getName();
    
    /**
-    * Resolve the JNDI name for the @EJB injection point
+    * Resolve the value for the given @EJB injection point
     * 
     * @param injectionPoint The injection point metadata
     * @return the JNDI name
@@ -28,12 +28,12 @@
    public Object resolveEjb(InjectionPoint injectionPoint, Naming naming);
    
    /**
-    * Resolve the JNDI name for the @PersistenceContext injection point
+    * Resolve the value for the given @PersistenceContext injection point
     * 
     * @param injectionPoint The injection point metadata
     * @return the JNDI name
     */
-   public EntityManagerFactory resolvePersistenceUnit(InjectionPoint injectionPoint, Naming naming);
+   public Object resolvePersistenceUnit(InjectionPoint injectionPoint, Naming naming);
    
    public Class<? extends Annotation> getEJBAnnotation();
    




More information about the weld-commits mailing list