openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1664165 - /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SpecializationUtil.java
Date Wed, 04 Mar 2015 22:09:41 GMT
Author: rmannibucau
Date: Wed Mar  4 22:09:41 2015
New Revision: 1664165

URL: http://svn.apache.org/r1664165
Log:
is a normal bean specializes an ejb then fail

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SpecializationUtil.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SpecializationUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SpecializationUtil.java?rev=1664165&r1=1664164&r2=1664165&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SpecializationUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SpecializationUtil.java
Wed Mar  4 22:09:41 2015
@@ -40,6 +40,7 @@ import org.apache.webbeans.exception.Web
 import org.apache.webbeans.exception.InconsistentSpecializationException;
 import org.apache.webbeans.inject.AlternativesManager;
 import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.spi.plugins.OpenWebBeansEjbPlugin;
 
 /**
  * This class contains a few helpers for handling
@@ -50,12 +51,14 @@ public class SpecializationUtil
     private final AlternativesManager alternativesManager;
     private final WebBeansUtil webBeansUtil;
     private final WebBeansContext webBeansContext;
+    private final OpenWebBeansEjbPlugin ejbPlugin;
 
     public SpecializationUtil(WebBeansContext webBeansContext)
     {
         this.webBeansContext = webBeansContext;
         this.alternativesManager = webBeansContext.getAlternativesManager();
         this.webBeansUtil = webBeansContext.getWebBeansUtil();
+        this.ejbPlugin = webBeansContext.getPluginLoader().getEjbPlugin();
     }
 
     /**
@@ -84,6 +87,11 @@ public class SpecializationUtil
                 {
                     Class<?> specialClass = annotatedType.getJavaClass();
                     Class<?> superClass = specialClass.getSuperclass();
+                    if (ejbPlugin != null && ejbPlugin.isSessionBean(superClass)
&& !ejbPlugin.isSessionBean(specialClass))
+                    {
+                        throw new WebBeansConfigurationException(specialClass + " specializes
and EJB " + superClass + ". That's forbidden.");
+                    }
+
                     if (attributeProvider != null)
                     {
                         BeanAttributes<?> ba = attributeProvider.get(annotatedType);



Mime
View raw message