bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1617155 - in /bval/branches/bval-11: bval-jsr/src/main/java/org/apache/bval/cdi/BValExtension.java bval-tck11/pom.xml
Date Sun, 10 Aug 2014 20:46:57 GMT
Author: rmannibucau
Date: Sun Aug 10 20:46:57 2014
New Revision: 1617155

URL: http://svn.apache.org/r1617155
Log:
missing API + skipping known classes for cdi integration

Modified:
    bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/cdi/BValExtension.java
    bval/branches/bval-11/bval-tck11/pom.xml

Modified: bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/cdi/BValExtension.java
URL: http://svn.apache.org/viewvc/bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/cdi/BValExtension.java?rev=1617155&r1=1617154&r2=1617155&view=diff
==============================================================================
--- bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/cdi/BValExtension.java (original)
+++ bval/branches/bval-11/bval-jsr/src/main/java/org/apache/bval/cdi/BValExtension.java Sun
Aug 10 20:46:57 2014
@@ -48,6 +48,7 @@ import java.lang.reflect.Modifier;
 import java.lang.reflect.Type;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
@@ -61,6 +62,17 @@ import java.util.logging.Logger;
 public class BValExtension implements Extension {
     private static final Logger LOGGER = Logger.getLogger(BValExtension.class.getName());
 
+    // extension point, we can add a SPI if needed, today mainly a fallback "API" for TomEE
if we encounter an issue
+    public static Collection<String> SKIPPED_PREFIXES = new HashSet<String>();
+    static {
+        SKIPPED_PREFIXES.add("java.");
+        SKIPPED_PREFIXES.add("javax.");
+        SKIPPED_PREFIXES.add("org.apache.bval.");
+        SKIPPED_PREFIXES.add("org.apache.openejb.");
+        SKIPPED_PREFIXES.add("org.apache.deltaspike."); // should be checked when upgrading
+        SKIPPED_PREFIXES.add("org.apache.myfaces."); // should be checked when upgrading
+    }
+
     private static BValExtension bmpSingleton = null;
     private volatile Map<ClassLoader, BeanManagerInfo> bmInfos = new ConcurrentHashMap<ClassLoader,
BeanManagerInfo>();
 
@@ -139,6 +151,15 @@ public class BValExtension implements Ex
         beforeBeanDiscovery.addAnnotatedType(beanManager.createAnnotatedType(BValInterceptor.class));
     }
 
+    protected boolean skip(final String name) {
+        for (final String p : SKIPPED_PREFIXES) {
+            if (name.startsWith(p)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     public <A> void processAnnotatedType(final @Observes ProcessAnnotatedType<A>
pat) {
         if (!isExecutableValidationEnabled) {
             return;
@@ -147,8 +168,12 @@ public class BValExtension implements Ex
         final AnnotatedType<A> annotatedType = pat.getAnnotatedType();
         final Class<A> javaClass = annotatedType.getJavaClass();
         final int modifiers = javaClass.getModifiers();
-        if (!javaClass.getName().startsWith("javax.") && !javaClass.getName().startsWith("org.apache.bval")
-                && !javaClass.isInterface() && !Modifier.isFinal(modifiers)
&& !Modifier.isAbstract(modifiers)) {
+        final String name = javaClass.getName();
+        if (skip(name)) {
+            return;
+        }
+
+        if (!javaClass.isInterface() && !Modifier.isFinal(modifiers) && !Modifier.isAbstract(modifiers))
{
             try {
                 ensureFactoryValidator();
                 final BeanDescriptor classConstraints = validator.getConstraintsForClass(javaClass);

Modified: bval/branches/bval-11/bval-tck11/pom.xml
URL: http://svn.apache.org/viewvc/bval/branches/bval-11/bval-tck11/pom.xml?rev=1617155&r1=1617154&r2=1617155&view=diff
==============================================================================
--- bval/branches/bval-11/bval-tck11/pom.xml (original)
+++ bval/branches/bval-11/bval-tck11/pom.xml Sun Aug 10 20:46:57 2014
@@ -61,6 +61,12 @@ under the License.
         </dependency>
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-annotation_1.2_spec</artifactId>
+            <version>1.0.MR2-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-interceptor_1.2_spec</artifactId>
             <version>1.0-SNAPSHOT</version>
             <scope>provided</scope>



Mime
View raw message