openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1646671 - /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DeploymentValidationService.java
Date Fri, 19 Dec 2014 11:15:41 GMT
Author: rmannibucau
Date: Fri Dec 19 11:15:40 2014
New Revision: 1646671

URL: http://svn.apache.org/r1646671
Log:
adding BeanInterceptorInfoProvider to be able to reuse validation of interceptor/decorator
even if bean is not an OWB one - an ejb typically which can need to wrap OWB

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DeploymentValidationService.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DeploymentValidationService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DeploymentValidationService.java?rev=1646671&r1=1646670&r2=1646671&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DeploymentValidationService.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DeploymentValidationService.java
Fri Dec 19 11:15:40 2014
@@ -160,8 +160,17 @@ public class DeploymentValidationService
      */
     public <T> void validatePassivationCapable(OwbBean<T> bean)
     {
-        if (isPassivationCapable(bean) && !EnterpriseBeanMarker.class.isInstance(bean))
+        if (isPassivationCapable(bean))
         {
+            if (EnterpriseBeanMarker.class.isInstance(bean))
+            {
+                if (BeanInterceptorInfoProvider.class.isInstance(bean))
+                {
+                    validatePassivationCapableInterceptorInfo(bean, BeanInterceptorInfoProvider.class.cast(bean).interceptorInfo());
+                }
+                return;
+            }
+
             if (!(bean instanceof ProducerMethodBean))
             {
                 validatePassivationCapableDependencies(bean, bean.getInjectionPoints());
@@ -170,25 +179,30 @@ public class DeploymentValidationService
             {
                 InjectionTargetImpl<T> injectionTarget = (InjectionTargetImpl<T>)bean.getProducer();
                 BeanInterceptorInfo interceptorInfo = injectionTarget.getInterceptorInfo();
-                if (interceptorInfo != null)
-                {
-                    for (Interceptor<?> ejbInterceptor: interceptorInfo.getEjbInterceptors())
-                    {
-                        validatePassivationCapableDependency(bean, ejbInterceptor);
-                    }
-                    for (Interceptor<?> cdiInterceptor: interceptorInfo.getCdiInterceptors())
-                    {
-                        validatePassivationCapableDependency(bean, cdiInterceptor);
-                    }
-                    for (Decorator<?> decorators: interceptorInfo.getDecorators())
-                    {
-                        validatePassivationCapableDependency(bean, decorators);
-                    }
-                }
+                validatePassivationCapableInterceptorInfo(bean, interceptorInfo);
             }
         }
     }
-    
+
+    private <T> void validatePassivationCapableInterceptorInfo(final OwbBean<T>
bean, final BeanInterceptorInfo interceptorInfo)
+    {
+        if (interceptorInfo != null)
+        {
+            for (Interceptor<?> ejbInterceptor: interceptorInfo.getEjbInterceptors())
+            {
+                validatePassivationCapableDependency(bean, ejbInterceptor);
+            }
+            for (Interceptor<?> cdiInterceptor: interceptorInfo.getCdiInterceptors())
+            {
+                validatePassivationCapableDependency(bean, cdiInterceptor);
+            }
+            for (Decorator<?> decorators: interceptorInfo.getDecorators())
+            {
+                validatePassivationCapableDependency(bean, decorators);
+            }
+        }
+    }
+
     private <T> void validatePassivationCapableDependency(Bean<T> bean, Bean<?>
dependentBean)
     {
         if (!isPassivationCapable(dependentBean))
@@ -227,4 +241,9 @@ public class DeploymentValidationService
     {
         return bean instanceof OwbBean? ((OwbBean<?>)bean).isPassivationCapable():
bean instanceof PassivationCapable;
     }
+
+    public static interface BeanInterceptorInfoProvider
+    {
+        BeanInterceptorInfo interceptorInfo();
+    }
 }



Mime
View raw message