openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r908504 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: component/creation/AbstractBeanCreator.java config/ManagedBeanConfigurator.java util/WebBeansUtil.java
Date Wed, 10 Feb 2010 14:01:10 GMT
Author: struberg
Date: Wed Feb 10 14:01:09 2010
New Revision: 908504

URL: http://svn.apache.org/viewvc?rev=908504&view=rev
Log:
OWB-6 improve passivation scope checks

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java?rev=908504&r1=908503&r2=908504&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java
Wed Feb 10 14:01:09 2010
@@ -17,7 +17,6 @@
 import java.lang.reflect.Type;
 import java.util.Set;
 
-import javax.enterprise.context.NormalScope;
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.inject.spi.AnnotatedType;
 import javax.enterprise.inject.spi.InjectionPoint;
@@ -148,7 +147,7 @@
         if(isDefaultMetaDataProvider())
         {
             DefinitionUtil.defineScopeType(this.bean, this.beanAnnotations, errorMessage);
-            WebBeansUtil.checkPassivationScope(getBean(), getBean().getScope().getAnnotation(NormalScope.class));
+            WebBeansUtil.checkPassivationScope(getBean(), getBean().getScope());
         }
         else
         {

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java?rev=908504&r1=908503&r2=908504&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
Wed Feb 10 14:01:09 2010
@@ -15,7 +15,6 @@
 import java.util.Set;
 
 import javax.decorator.Decorator;
-import javax.enterprise.context.NormalScope;
 import javax.enterprise.inject.spi.AnnotatedType;
 import javax.interceptor.Interceptor;
 
@@ -123,7 +122,7 @@
         DefinitionUtil.defineScopeType(component, clazzAnns, "Simple WebBean Component implementation
class : " + clazz.getName() + " stereotypes must declare same @Scope annotations");
         
         WebBeansUtil.checkGenericType(component);
-        WebBeansUtil.checkPassivationScope(component, component.getScope().getAnnotation(NormalScope.class));
+        WebBeansUtil.checkPassivationScope(component, component.getScope());
         DefinitionUtil.defineQualifiers(component, clazzAnns);
         DefinitionUtil.defineName(component, clazzAnns, WebBeansUtil.getManagedBeanDefaultName(clazz.getSimpleName()));
 
@@ -165,7 +164,7 @@
         DefinitionUtil.defineScopeType(component, clazzAnns, "Simple WebBean Component implementation
class : " + javaClazz.getName() + " stereotypes must declare same @Scope annotations");
         
         WebBeansUtil.checkGenericType(component);
-        WebBeansUtil.checkPassivationScope(component, component.getScope().getAnnotation(NormalScope.class));
+        WebBeansUtil.checkPassivationScope(component, component.getScope());
         DefinitionUtil.defineQualifiers(component, clazzAnns);
         DefinitionUtil.defineName(component, clazzAnns, WebBeansUtil.getManagedBeanDefaultName(javaClazz.getSimpleName()));
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=908504&r1=908503&r2=908504&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
Wed Feb 10 14:01:09 2010
@@ -1742,13 +1742,13 @@
         return true;
     }
 
-    public static <T> void checkPassivationScope(AbstractBean<T> component, NormalScope
scope)
+    public static <T> void checkPassivationScope(AbstractBean<T> component, Class<?
extends Annotation> scope)
     {
         Asserts.assertNotNull(component, "component parameter can not be null");
 
         if(scope != null)
         {
-            boolean passivating = scope.passivating();
+            boolean passivating = BeanManagerImpl.getManager().isPassivatingScope(scope);
             Class<T> clazz = component.getReturnType();
 
             if (passivating)
@@ -1766,7 +1766,8 @@
                 // if no plugin did check some special conditions, the bean must be Serializable
                 if (!component.isSerializable())
                 {
-                    throw new WebBeansPassivationException("WebBeans component implementation
class : " + clazz.getName() + " with passivating scope @" + scope.annotationType().getName()
+ " must be Serializable");
+                    throw new WebBeansPassivationException("WebBeans component implementation
class : " + clazz.getName() + 
+                            " with passivating scope @" + scope.toString() + " must be Serializable");
                 }
 
                 //X TODO we might check the non-transient childs of the bean for serializability?



Mime
View raw message