Author: rmannibucau
Date: Sat Feb  2 14:35:21 2013
New Revision: 1441753

URL: http://svn.apache.org/viewvc?rev=1441753&view=rev
Log:
managing mutiple packages limit for entities scannnig

Modified:
    
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java

Modified: 
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
URL: 
http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java?rev=1441753&r1=1441752&r2=1441753&view=diff
==============================================================================
--- 
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
 (original)
+++ 
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
 Sat Feb  2 14:35:21 2013
@@ -1511,6 +1511,10 @@ public class AnnotationDeployer implemen
                         if ((pu.isExcludeUnlistedClasses() == null || 
!pu.isExcludeUnlistedClasses())
                                 && 
"true".equalsIgnoreCase(pu.getProperties().getProperty(OPENEJB_JPA_AUTO_SCAN))) 
{
                             final String packageName = 
pu.getProperties().getProperty(OPENEJB_JPA_AUTO_SCAN_PACKAGE);
+                            String[] packageNames = null;
+                            if (packageName != null) {
+                                packageNames = packageName.split(",");
+                            }
 
                             // no need of meta currently since JPA providers 
doesn't support it
                             final List<Class<?>> classes = new 
ArrayList<Class<?>>();
@@ -1520,8 +1524,18 @@ public class AnnotationDeployer implemen
                             final List<String> existingClasses = pu.getClazz();
                             for (Class<?> clazz : classes) {
                                 final String name = clazz.getName();
-                                if ((packageName == null || 
name.startsWith(packageName)) && !existingClasses.contains(name)) {
+                                if (existingClasses.contains(name)) {
+                                    continue;
+                                }
+
+                                if (packageNames == null) {
                                     pu.getClazz().add(name);
+                                } else {
+                                    for (String pack : packageNames) {
+                                        if (name.startsWith(pack)) {
+                                            pu.getClazz().add(name);
+                                        }
+                                    }
                                 }
                             }
                             pu.setScanned(true);


Reply via email to