[weld-commits] Weld SVN: r5393 - core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee and 1 other directories.

weld-commits at lists.jboss.org weld-commits at lists.jboss.org
Thu Jan 7 13:21:12 EST 2010


Author: pete.muir at jboss.org
Date: 2010-01-07 13:21:11 -0500 (Thu, 07 Jan 2010)
New Revision: 5393

Removed:
   cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/PersistenceContextDesctructionTest.java
   core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/PersistenceContextProducerField.java
Modified:
   core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java
Log:
WELD-341

Deleted: cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/PersistenceContextDesctructionTest.java
===================================================================
--- cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/PersistenceContextDesctructionTest.java	2010-01-07 16:49:41 UTC (rev 5392)
+++ cdi-tck/branches/1.0/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/resource/persistenceContext/PersistenceContextDesctructionTest.java	2010-01-07 18:21:11 UTC (rev 5393)
@@ -1,49 +0,0 @@
-package org.jboss.jsr299.tck.tests.implementation.simple.resource.persistenceContext;
-
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.spi.Bean;
-import javax.persistence.EntityManager;
-
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.test.audit.annotations.SpecAssertion;
-import org.jboss.test.audit.annotations.SpecAssertions;
-import org.jboss.test.audit.annotations.SpecVersion;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.IntegrationTest;
-import org.jboss.testharness.impl.packaging.Packaging;
-import org.jboss.testharness.impl.packaging.PackagingType;
-import org.jboss.testharness.impl.packaging.Resource;
-import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
-import org.testng.annotations.Test;
-
-/**
- * Injection of persistence related objects.
- *
- * @author David Allen
- */
- at Artifact
- at Packaging(PackagingType.WAR)
- at IntegrationTest
- at Resource(source = "persistence.xml", destination = "WEB-INF/classes/META-INF/persistence.xml")
-//@PersistenceXml("persistence.xml")
- at BeansXml("beans.xml")
- at SpecVersion(spec="cdi", version="20091101")
-public class PersistenceContextDesctructionTest extends AbstractJSR299Test
-{
-   
-   @Test(groups = { "beanLifecycle", "commonAnnotations", "integration" })
-   @SpecAssertions( {
-      @SpecAssertion(section="7.3.6", id = "nb")
-   })
-   public void testDestructionOfPersistenceContext() throws Exception
-   {
-      Bean<ManagedBean> managedBean = getBeans(ManagedBean.class).iterator().next();
-      CreationalContext<ManagedBean> creationalContext = getCurrentManager().createCreationalContext(managedBean);
-      ManagedBean instance = managedBean.create(creationalContext);
-      EntityManager em = instance.getPersistenceContext();
-      assert em.isOpen();
-      managedBean.destroy(instance, creationalContext);
-      assert !em.isOpen();
-   }
-   
-}

Deleted: core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/PersistenceContextProducerField.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/PersistenceContextProducerField.java	2010-01-07 16:49:41 UTC (rev 5392)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/PersistenceContextProducerField.java	2010-01-07 18:21:11 UTC (rev 5393)
@@ -1,61 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,  
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.weld.bean.builtin.ee;
-
-import javax.persistence.EntityManager;
-
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.bean.AbstractClassBean;
-import org.jboss.weld.introspector.WeldField;
-
-/**
- * @author pmuir
- *
- */
-public class PersistenceContextProducerField<X, T extends EntityManager> extends EEResourceProducerField<X, T>
-{
-   
-   /**
-    * Creates an EE resource producer field
-    * 
-    * @param field The underlying method abstraction
-    * @param declaringBean The declaring bean abstraction
-    * @param manager the current manager
-    * @return A producer field
-    */
-   public static <X, T extends EntityManager> EEResourceProducerField<X, T> of(WeldField<T, X> field, AbstractClassBean<X> declaringBean, BeanManagerImpl manager)
-   {
-      return new PersistenceContextProducerField<X, T>(field, declaringBean, manager);
-   }
-
-   /**
-    * @param field
-    * @param declaringBean
-    * @param manager
-    */
-   protected PersistenceContextProducerField(WeldField<T, X> field, AbstractClassBean<X> declaringBean, BeanManagerImpl manager)
-   {
-      super(field, declaringBean, manager);
-   }
-   
-   @Override
-   protected void defaultDispose(T instance) 
-   {
-      instance.close();
-   }
-
-}

Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java	2010-01-07 16:49:41 UTC (rev 5392)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java	2010-01-07 18:21:11 UTC (rev 5393)
@@ -47,7 +47,6 @@
 import org.jboss.weld.bean.RIBean;
 import org.jboss.weld.bean.SessionBean;
 import org.jboss.weld.bean.builtin.ee.EEResourceProducerField;
-import org.jboss.weld.bean.builtin.ee.PersistenceContextProducerField;
 import org.jboss.weld.bootstrap.events.ProcessBeanImpl;
 import org.jboss.weld.bootstrap.events.ProcessBeanInjectionTarget;
 import org.jboss.weld.bootstrap.events.ProcessManagedBeanImpl;
@@ -199,12 +198,8 @@
    protected <X, T> void createProducerField(AbstractClassBean<X> declaringBean, WeldField<T, X> field)
    {
       ProducerField<X, T> bean;
-      if (isPersistenceContextProducerField(field))
+      if (isEEResourceProducerField(field))
       {
-         bean = PersistenceContextProducerField.of(field, declaringBean, manager);
-      }
-      else if (isEEResourceProducerField(field))
-      {
          bean = EEResourceProducerField.of(field, declaringBean, manager);
       }
       else
@@ -306,15 +301,9 @@
       EJBApiAbstraction ejbApiAbstraction = manager.getServices().get(EJBApiAbstraction.class);
       PersistenceApiAbstraction persistenceApiAbstraction = manager.getServices().get(PersistenceApiAbstraction.class);
       WSApiAbstraction wsApiAbstraction = manager.getServices().get(WSApiAbstraction.class);
-      return field.isAnnotationPresent(ejbApiAbstraction.EJB_ANNOTATION_CLASS) || field.isAnnotationPresent(ejbApiAbstraction.RESOURCE_ANNOTATION_CLASS) || field.isAnnotationPresent(persistenceApiAbstraction.PERSISTENCE_UNIT_ANNOTATION_CLASS) || field.isAnnotationPresent(wsApiAbstraction.WEB_SERVICE_REF_ANNOTATION_CLASS); 
+      return field.isAnnotationPresent(ejbApiAbstraction.EJB_ANNOTATION_CLASS) || field.isAnnotationPresent(ejbApiAbstraction.RESOURCE_ANNOTATION_CLASS) || field.isAnnotationPresent(persistenceApiAbstraction.PERSISTENCE_UNIT_ANNOTATION_CLASS) || field.isAnnotationPresent(persistenceApiAbstraction.PERSISTENCE_CONTEXT_ANNOTATION_CLASS) || field.isAnnotationPresent(wsApiAbstraction.WEB_SERVICE_REF_ANNOTATION_CLASS); 
    }
    
-   protected boolean isPersistenceContextProducerField(WeldField<?, ?> field)
-   {
-      PersistenceApiAbstraction persistenceApiAbstraction = manager.getServices().get(PersistenceApiAbstraction.class);
-      return field.isAnnotationPresent(persistenceApiAbstraction.PERSISTENCE_CONTEXT_ANNOTATION_CLASS); 
-   }
-   
    private static boolean hasSimpleWebBeanConstructor(WeldClass<?> type)
    {
       return type.getNoArgsWeldConstructor() != null || type.getAnnotatedWeldConstructors(Inject.class).size() > 0;



More information about the weld-commits mailing list