Author: pete.muir(a)jboss.org
Date: 2009-03-26 13:24:45 -0400 (Thu, 26 Mar 2009)
New Revision: 2217
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockJpaServices.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/jpa/spi/JpaServices.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/jpa/spi/helpers/ForwardingJpaServices.java
ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockJpaServices.java
Log:
WBRI-172
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java 2009-03-26
17:14:47 UTC (rev 2216)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java 2009-03-26
17:24:45 UTC (rev 2217)
@@ -30,6 +30,7 @@
import org.jboss.webbeans.introspector.WrappedAnnotatedField;
import org.jboss.webbeans.introspector.WrappedAnnotatedMethod;
import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
+import org.jboss.webbeans.jpa.spi.JpaServices;
import org.jboss.webbeans.jsf.JSFApiAbstraction;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
@@ -250,7 +251,17 @@
JSFApiAbstraction jsfApiAbstraction =
manager.getServices().get(JSFApiAbstraction.class);
ServletApiAbstraction servletApiAbstraction =
manager.getServices().get(ServletApiAbstraction.class);
// TODO: check 3.2.1 for more rules!!!!!!
- return !Reflections.isAbstract(rawType) &&
!Reflections.isParameterizedType(rawType) &&
!servletApiAbstraction.SERVLET_CLASS.isAssignableFrom(rawType) &&
!servletApiAbstraction.FILTER_CLASS.isAssignableFrom(rawType) &&
!servletApiAbstraction.SERVLET_CONTEXT_LISTENER_CLASS.isAssignableFrom(rawType) &&
!servletApiAbstraction.HTTP_SESSION_LISTENER_CLASS.isAssignableFrom(rawType) &&
!servletApiAbstraction.SERVLET_REQUEST_LISTENER_CLASS.isAssignableFrom(rawType) &&
!ejbApiAbstraction.ENTERPRISE_BEAN_CLASS.isAssignableFrom(rawType) &&
!jsfApiAbstraction.UICOMPONENT_CLASS.isAssignableFrom(rawType) &&
hasSimpleWebBeanConstructor(clazz);
+ return !Reflections.isAbstract(rawType) &&
+ !Reflections.isParameterizedType(rawType) &&
+ !servletApiAbstraction.SERVLET_CLASS.isAssignableFrom(rawType) &&
+ !servletApiAbstraction.FILTER_CLASS.isAssignableFrom(rawType) &&
+
!servletApiAbstraction.SERVLET_CONTEXT_LISTENER_CLASS.isAssignableFrom(rawType) &&
+ !servletApiAbstraction.HTTP_SESSION_LISTENER_CLASS.isAssignableFrom(rawType)
&&
+
!servletApiAbstraction.SERVLET_REQUEST_LISTENER_CLASS.isAssignableFrom(rawType) &&
+ !ejbApiAbstraction.ENTERPRISE_BEAN_CLASS.isAssignableFrom(rawType)
&&
+ !jsfApiAbstraction.UICOMPONENT_CLASS.isAssignableFrom(rawType) &&
+ hasSimpleWebBeanConstructor(clazz)
+ &&
!manager.getServices().get(JpaServices.class).discoverEntities().contains(clazz.getRawType());
}
private static boolean hasSimpleWebBeanConstructor(AnnotatedClass<?> type)
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockJpaServices.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockJpaServices.java 2009-03-26
17:14:47 UTC (rev 2216)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockJpaServices.java 2009-03-26
17:24:45 UTC (rev 2217)
@@ -3,6 +3,7 @@
*/
package org.jboss.webbeans.mock;
+import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@@ -27,7 +28,7 @@
return null;
}
- public Iterable<Class<?>> discoverEntities()
+ public Collection<Class<?>> discoverEntities()
{
Set<Class<?>> classes = new HashSet<Class<?>>();
for (Class<?> clazz : webBeanDiscovery.discoverWebBeanClasses())
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/jpa/spi/JpaServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/jpa/spi/JpaServices.java 2009-03-26
17:14:47 UTC (rev 2216)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/jpa/spi/JpaServices.java 2009-03-26
17:24:45 UTC (rev 2217)
@@ -16,6 +16,8 @@
*/
package org.jboss.webbeans.jpa.spi;
+import java.util.Collection;
+
import javax.inject.manager.InjectionPoint;
import org.jboss.webbeans.bootstrap.api.Service;
@@ -35,7 +37,7 @@
*
* @return the entity classes
*/
- public Iterable<Class<?>> discoverEntities();
+ public Collection<Class<?>> discoverEntities();
/**
* Resolve the value for the given @PersistenceContext injection point
Modified:
ri/trunk/spi/src/main/java/org/jboss/webbeans/jpa/spi/helpers/ForwardingJpaServices.java
===================================================================
---
ri/trunk/spi/src/main/java/org/jboss/webbeans/jpa/spi/helpers/ForwardingJpaServices.java 2009-03-26
17:14:47 UTC (rev 2216)
+++
ri/trunk/spi/src/main/java/org/jboss/webbeans/jpa/spi/helpers/ForwardingJpaServices.java 2009-03-26
17:24:45 UTC (rev 2217)
@@ -16,6 +16,8 @@
*/
package org.jboss.webbeans.jpa.spi.helpers;
+import java.util.Collection;
+
import javax.inject.manager.InjectionPoint;
import org.jboss.webbeans.jpa.spi.JpaServices;
@@ -35,7 +37,7 @@
protected abstract JpaServices delegate();
- public Iterable<Class<?>> discoverEntities()
+ public Collection<Class<?>> discoverEntities()
{
return delegate().discoverEntities();
}
Modified:
ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockJpaServices.java
===================================================================
---
ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockJpaServices.java 2009-03-26
17:14:47 UTC (rev 2216)
+++
ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockJpaServices.java 2009-03-26
17:24:45 UTC (rev 2217)
@@ -1,5 +1,7 @@
package org.jboss.webbeans.bootstrap.api.test;
+import java.util.Collection;
+
import javax.inject.manager.InjectionPoint;
import org.jboss.webbeans.jpa.spi.JpaServices;
@@ -7,7 +9,7 @@
public class MockJpaServices implements JpaServices
{
- public Iterable<Class<?>> discoverEntities()
+ public Collection<Class<?>> discoverEntities()
{
// TODO Auto-generated method stub
return null;