You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by ge...@apache.org on 2009/08/30 15:08:41 UTC
svn commit: r809330 - in /incubator/openwebbeans/trunk/webbeans-impl/src:
main/java/org/apache/webbeans/component/creation/
main/java/org/apache/webbeans/config/
main/java/org/apache/webbeans/config/inheritance/
main/java/org/apache/webbeans/container/...
Author: gerdogdu
Date: Sun Aug 30 13:08:38 2009
New Revision: 809330
URL: http://svn.apache.org/viewvc?rev=809330&view=rev
Log:
Changing @ScopeType to @Scope and @NormalScope
Modified:
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/inheritance/BeanInheritedMetaData.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeModel.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessAnnotatedType.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessInjectionTarget.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessManagedBean.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducer.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducerField.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducerMethod.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessSessionBean.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java
incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhScopeType1.java
incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhScopeType2.java
incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockManager.java
incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/exception/EventExceptionTest.java
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java?rev=809330&r1=809329&r2=809330&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java Sun Aug 30 13:08:38 2009
@@ -16,7 +16,7 @@
import java.lang.annotation.Annotation;
import java.util.Set;
-import javax.enterprise.context.ScopeType;
+import javax.enterprise.context.NormalScope;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.enterprise.inject.spi.Producer;
@@ -159,7 +159,7 @@
if(isDefaultMetaDataProvider())
{
DefinitionUtil.defineScopeType(this.bean, this.beanAnnotations, errorMessage);
- WebBeansUtil.checkPassivationScope(getBean(), getBean().getScopeType().getAnnotation(ScopeType.class));
+ WebBeansUtil.checkPassivationScope(getBean(), getBean().getScopeType().getAnnotation(NormalScope.class));
}
else
{
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java?rev=809330&r1=809329&r2=809330&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java Sun Aug 30 13:08:38 2009
@@ -27,10 +27,11 @@
import java.util.Set;
import javax.decorator.Decorates;
-import javax.enterprise.context.ScopeType;
+import javax.enterprise.context.NormalScope;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.Disposes;
import javax.inject.Named;
+import javax.inject.Scope;
import javax.enterprise.inject.NonBinding;
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.UnsatisfiedResolutionException;
@@ -279,10 +280,19 @@
boolean found = false;
for (Annotation annotation : annotations)
- {
- Annotation var = annotation.annotationType().getAnnotation(ScopeType.class);
+ {
+ /*Normal scope*/
+ Annotation var = annotation.annotationType().getAnnotation(NormalScope.class);
+ /*Pseudo scope*/
+ Annotation pseudo = annotation.annotationType().getAnnotation(Scope.class);
+
if (var != null)
{
+ if(pseudo != null)
+ {
+ throw new WebBeansConfigurationException("Not to define both @Scope and @NormalScope on bean : " + component);
+ }
+
if (found)
{
throw new WebBeansConfigurationException(exceptionMessage);
@@ -292,7 +302,21 @@
found = true;
component.setImplScopeType(annotation);
}
-
+ }
+ else
+ {
+ if(pseudo != null)
+ {
+ if (found)
+ {
+ throw new WebBeansConfigurationException(exceptionMessage);
+ }
+ else
+ {
+ found = true;
+ component.setImplScopeType(annotation);
+ }
+ }
}
}
@@ -368,9 +392,21 @@
Set<Class<? extends Annotation>> anns = component.getStereotypes();
for (Class<? extends Annotation> stero : anns)
{
- if (AnnotationUtil.isMetaAnnotationExist(stero.getDeclaredAnnotations(), ScopeType.class))
- {
- Annotation next = AnnotationUtil.getMetaAnnotations(stero.getDeclaredAnnotations(), ScopeType.class)[0];
+ boolean containsNormal = AnnotationUtil.isMetaAnnotationExist(stero.getDeclaredAnnotations(), NormalScope.class);
+
+ if (AnnotationUtil.isMetaAnnotationExist(stero.getDeclaredAnnotations(), NormalScope.class) ||
+ AnnotationUtil.isMetaAnnotationExist(stero.getDeclaredAnnotations(), Scope.class))
+ {
+ Annotation next = null;
+
+ if(containsNormal)
+ {
+ next = AnnotationUtil.getMetaAnnotations(stero.getDeclaredAnnotations(), NormalScope.class)[0];
+ }
+ else
+ {
+ next = AnnotationUtil.getMetaAnnotations(stero.getDeclaredAnnotations(), Scope.class)[0];
+ }
if (defined == null)
{
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java?rev=809330&r1=809329&r2=809330&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java Sun Aug 30 13:08:38 2009
@@ -15,7 +15,7 @@
import java.util.Set;
import javax.decorator.Decorator;
-import javax.enterprise.context.ScopeType;
+import javax.enterprise.context.NormalScope;
import javax.interceptor.Interceptor;
import org.apache.webbeans.component.ManagedBean;
@@ -128,7 +128,7 @@
DefinitionUtil.defineScopeType(component, clazzAnns, "Simple WebBean Component implementation class : " + clazz.getName() + " stereotypes must declare same @ScopeType annotations");
WebBeansUtil.checkGenericType(component);
- WebBeansUtil.checkPassivationScope(component, component.getScopeType().getAnnotation(ScopeType.class));
+ WebBeansUtil.checkPassivationScope(component, component.getScopeType().getAnnotation(NormalScope.class));
DefinitionUtil.defineBindingTypes(component, clazzAnns);
DefinitionUtil.defineName(component, clazzAnns, WebBeansUtil.getSimpleWebBeanDefaultName(clazz.getSimpleName()));
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java?rev=809330&r1=809329&r2=809330&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java Sun Aug 30 13:08:38 2009
@@ -23,7 +23,7 @@
import java.util.Map;
import java.util.Set;
-import javax.enterprise.context.ScopeType;
+import javax.enterprise.context.NormalScope;
import javax.enterprise.inject.deployment.Specializes;
import javax.enterprise.inject.spi.AnnotatedField;
import javax.enterprise.inject.spi.AnnotatedMethod;
@@ -58,7 +58,6 @@
import org.apache.webbeans.portable.events.ProcessAnnotatedTypeImpl;
import org.apache.webbeans.portable.events.ProcessBeanImpl;
import org.apache.webbeans.portable.events.ProcessInjectionTargetImpl;
-import org.apache.webbeans.portable.events.ProcessManagedBeanImpl;
import org.apache.webbeans.portable.events.ProcessProducerImpl;
import org.apache.webbeans.portable.events.discovery.AfterBeanDiscoveryImpl;
import org.apache.webbeans.portable.events.discovery.AfterDeploymentValidationImpl;
@@ -543,16 +542,19 @@
if (beanObj instanceof ManagedBean)
{
ManagedBean<?> component = (ManagedBean<?>) beanObj;
- ScopeType scope = component.getScopeType().getAnnotation(ScopeType.class);
- if (scope.passivating())
+ NormalScope scope = component.getScopeType().getAnnotation(NormalScope.class);
+ if(scope != null)
{
- // TODO Check constructor
+ if (scope.passivating())
+ {
+ // TODO Check constructor
- // TODO Check non-transient fields
+ // TODO Check non-transient fields
- // TODO Check initializer methods
+ // TODO Check initializer methods
- // TODO Check producer methods
+ // TODO Check producer methods
+ }
}
}
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/inheritance/BeanInheritedMetaData.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/inheritance/BeanInheritedMetaData.java?rev=809330&r1=809329&r2=809330&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/inheritance/BeanInheritedMetaData.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/inheritance/BeanInheritedMetaData.java Sun Aug 30 13:08:38 2009
@@ -20,10 +20,11 @@
import java.lang.annotation.Inherited;
import java.util.Set;
-import javax.enterprise.context.ScopeType;
+import javax.enterprise.context.NormalScope;
import javax.enterprise.inject.deployment.DeploymentType;
import javax.enterprise.inject.stereotype.Stereotype;
import javax.inject.Qualifier;
+import javax.inject.Scope;
import javax.interceptor.InterceptorBindingType;
import org.apache.webbeans.component.AbstractBean;
@@ -70,7 +71,9 @@
{
if(this.inheritedClazz != Object.class)
{
- setInheritedType(this.inheritedClazz, ScopeType.class);
+ setInheritedType(this.inheritedClazz, NormalScope.class);
+ setInheritedType(this.inheritedClazz, Scope.class);
+
}
}
@@ -94,7 +97,7 @@
{
Annotation annotation = inheritedAnnotations[0];
- if(annotationType.equals(ScopeType.class))
+ if(annotationType.equals(NormalScope.class) || annotationType.equals(Scope.class))
{
this.inheritedScopeType = annotation;
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java?rev=809330&r1=809329&r2=809330&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java Sun Aug 30 13:08:38 2009
@@ -32,7 +32,7 @@
import javax.el.ELResolver;
import javax.enterprise.context.ContextNotActiveException;
import javax.enterprise.context.Dependent;
-import javax.enterprise.context.ScopeType;
+import javax.enterprise.context.NormalScope;
import javax.enterprise.context.spi.Context;
import javax.enterprise.context.spi.Contextual;
import javax.enterprise.context.spi.CreationalContext;
@@ -52,6 +52,7 @@
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.ObserverMethod;
import javax.enterprise.inject.stereotype.Stereotype;
+import javax.inject.Scope;
import javax.naming.NamingException;
import javax.naming.Reference;
import javax.naming.Referenceable;
@@ -781,19 +782,6 @@
return null;
}
- @Override
- public ScopeType getScopeDefinition(Class<? extends Annotation> scopeType)
- {
- Annotation annotation = AnnotationUtil.getAnnotation(scopeType.getDeclaredAnnotations(), ScopeType.class);
-
- if(annotation != null)
- {
- return (ScopeType)annotation;
- }
-
- return null;
- }
-
@Override
public Set<Annotation> getStereotypeDefinition(Class<? extends Annotation> stereotype)
@@ -810,7 +798,7 @@
}
@Override
- public boolean isBindingType(Class<? extends Annotation> annotationType)
+ public boolean isQualifier(Class<? extends Annotation> annotationType)
{
return AnnotationUtil.isBindingAnnotation(annotationType);
}
@@ -822,15 +810,39 @@
}
@Override
- public boolean isScopeType(Class<? extends Annotation> annotationType)
+ public boolean isScope(Class<? extends Annotation> annotationType)
{
- if(AnnotationUtil.isAnnotationExist(annotationType.getDeclaredAnnotations(), ScopeType.class))
+ if(AnnotationUtil.isAnnotationExist(annotationType.getDeclaredAnnotations(), Scope.class))
{
return true;
}
return false;
}
+
+ @Override
+ public boolean isNormalScope(Class<? extends Annotation> annotationType)
+ {
+ if(AnnotationUtil.isAnnotationExist(annotationType.getDeclaredAnnotations(), NormalScope.class))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean isPassivatingScope(Class<? extends Annotation> annotationType)
+ {
+ if(AnnotationUtil.isAnnotationExist(annotationType.getDeclaredAnnotations(), NormalScope.class))
+ {
+ NormalScope scope = annotationType.getAnnotation(NormalScope.class);
+ return scope.passivating();
+ }
+
+ return false;
+ }
+
@Override
public boolean isStereotype(Class<? extends Annotation> annotationType)
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java?rev=809330&r1=809329&r2=809330&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java Sun Aug 30 13:08:38 2009
@@ -19,7 +19,6 @@
import java.util.Iterator;
import java.util.Set;
-import javax.enterprise.context.ScopeType;
import javax.enterprise.inject.AmbiguousResolutionException;
import javax.enterprise.inject.UnsatisfiedResolutionException;
import javax.enterprise.inject.spi.Bean;
@@ -98,7 +97,7 @@
}
Bean<?> bean = resolvedSet.iterator().next();
- WebBeansUtil.checkUnproxiableApiType(bean, bean.getScopeType().getAnnotation(ScopeType.class));
+ WebBeansUtil.checkUnproxiableApiType(bean, bean.getScopeType());
}
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeModel.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeModel.java?rev=809330&r1=809329&r2=809330&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeModel.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/StereoTypeModel.java Sun Aug 30 13:08:38 2009
@@ -19,8 +19,9 @@
import java.util.HashSet;
import java.util.Set;
-import javax.enterprise.context.ScopeType;
+import javax.enterprise.context.NormalScope;
import javax.enterprise.inject.deployment.DeploymentType;
+import javax.inject.Scope;
import org.apache.webbeans.deployment.stereotype.IStereoTypeModel;
import org.apache.webbeans.exception.WebBeansConfigurationException;
@@ -63,11 +64,16 @@
this.defaultDeploymentType = AnnotationUtil.getMetaAnnotations(clazz.getDeclaredAnnotations(), DeploymentType.class)[0];
}
- if (AnnotationUtil.isMetaAnnotationExist(clazz.getDeclaredAnnotations(), ScopeType.class))
+ if (AnnotationUtil.isMetaAnnotationExist(clazz.getDeclaredAnnotations(), NormalScope.class))
{
- this.defaultScopeType = AnnotationUtil.getMetaAnnotations(clazz.getDeclaredAnnotations(), ScopeType.class)[0];
+ this.defaultScopeType = AnnotationUtil.getMetaAnnotations(clazz.getDeclaredAnnotations(), NormalScope.class)[0];
}
+ if (AnnotationUtil.isMetaAnnotationExist(clazz.getDeclaredAnnotations(), Scope.class))
+ {
+ this.defaultScopeType = AnnotationUtil.getMetaAnnotations(clazz.getDeclaredAnnotations(), Scope.class)[0];
+ }
+
if (AnnotationUtil.isInterceptorBindingMetaAnnotationExist(clazz.getDeclaredAnnotations()))
{
Annotation[] ibs = AnnotationUtil.getInterceptorBindingMetaAnnotations(clazz.getDeclaredAnnotations());
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java?rev=809330&r1=809329&r2=809330&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java Sun Aug 30 13:08:38 2009
@@ -20,8 +20,9 @@
import java.util.List;
import java.util.Set;
-import javax.enterprise.context.ScopeType;
+import javax.enterprise.context.NormalScope;
import javax.inject.Named;
+import javax.inject.Scope;
import javax.enterprise.inject.deployment.DeploymentType;
import org.apache.webbeans.deployment.stereotype.IStereoTypeModel;
@@ -82,16 +83,16 @@
annClazz = (Class<? extends Annotation>) clazz;
Annotation defaultAnn = JavassistProxyFactory.createNewAnnotationProxy(annClazz);
- if (clazz.isAnnotationPresent(ScopeType.class))
+ if (clazz.isAnnotationPresent(NormalScope.class) || clazz.isAnnotationPresent(Scope.class))
{
if (scopeTypeFound)
{
- throw new WebBeansConfigurationException(errorMessage + "@StereoType annotation can not contain more than one @ScopeType annotation");
+ throw new WebBeansConfigurationException(errorMessage + "@StereoType annotation can not contain more than one @Scope/@NormalScope annotation");
}
defaultScopeType = defaultAnn;
scopeTypeFound = true;
- }
+ }
else if (clazz.isAnnotationPresent(DeploymentType.class))
{
if (deploymentTypeFound)
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessAnnotatedType.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessAnnotatedType.java?rev=809330&r1=809329&r2=809330&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessAnnotatedType.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessAnnotatedType.java Sun Aug 30 13:08:38 2009
@@ -17,6 +17,7 @@
import org.apache.webbeans.portable.events.ProcessAnnotatedTypeImpl;
+@SuppressWarnings("unchecked")
public class GProcessAnnotatedType extends ProcessAnnotatedTypeImpl
{
public GProcessAnnotatedType(AnnotatedType annotatedType )
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessInjectionTarget.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessInjectionTarget.java?rev=809330&r1=809329&r2=809330&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessInjectionTarget.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessInjectionTarget.java Sun Aug 30 13:08:38 2009
@@ -18,6 +18,7 @@
import org.apache.webbeans.portable.events.ProcessInjectionTargetImpl;
+@SuppressWarnings("unchecked")
public class GProcessInjectionTarget extends ProcessInjectionTargetImpl
{
public GProcessInjectionTarget(InjectionTarget<?> injectionTarget,AnnotatedType<?> annotatedType)
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessManagedBean.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessManagedBean.java?rev=809330&r1=809329&r2=809330&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessManagedBean.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessManagedBean.java Sun Aug 30 13:08:38 2009
@@ -13,14 +13,12 @@
*/
package org.apache.webbeans.portable.events.generics;
-import javax.enterprise.inject.spi.Annotated;
import javax.enterprise.inject.spi.AnnotatedType;
-import javax.enterprise.inject.spi.Bean;
import org.apache.webbeans.component.ManagedBean;
-import org.apache.webbeans.portable.events.ProcessBeanImpl;
import org.apache.webbeans.portable.events.ProcessManagedBeanImpl;
+@SuppressWarnings("unchecked")
public class GProcessManagedBean extends ProcessManagedBeanImpl
{
public GProcessManagedBean(ManagedBean<?> bean,AnnotatedType<?> annotated)
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducer.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducer.java?rev=809330&r1=809329&r2=809330&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducer.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducer.java Sun Aug 30 13:08:38 2009
@@ -17,6 +17,7 @@
import org.apache.webbeans.portable.events.ProcessProducerImpl;
+@SuppressWarnings("unchecked")
public class GProcessProducer extends ProcessProducerImpl
{
public GProcessProducer(AnnotatedMember<?> annotateMember)
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducerField.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducerField.java?rev=809330&r1=809329&r2=809330&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducerField.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducerField.java Sun Aug 30 13:08:38 2009
@@ -18,6 +18,7 @@
import org.apache.webbeans.component.ProducerFieldBean;
import org.apache.webbeans.portable.events.ProcessProducerFieldImpl;
+@SuppressWarnings("unchecked")
public class GProcessProducerField extends ProcessProducerFieldImpl
{
public GProcessProducerField(ProducerFieldBean<?> bean,AnnotatedField<?> annotatedField)
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducerMethod.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducerMethod.java?rev=809330&r1=809329&r2=809330&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducerMethod.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducerMethod.java Sun Aug 30 13:08:38 2009
@@ -19,6 +19,7 @@
import org.apache.webbeans.component.ProducerMethodBean;
import org.apache.webbeans.portable.events.ProcessProducerMethodImpl;
+@SuppressWarnings("unchecked")
public class GProcessProducerMethod extends ProcessProducerMethodImpl
{
public GProcessProducerMethod(ProducerMethodBean<?> bean,AnnotatedMethod<?> annotatedMethod, AnnotatedParameter dispose)
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessSessionBean.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessSessionBean.java?rev=809330&r1=809329&r2=809330&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessSessionBean.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessSessionBean.java Sun Aug 30 13:08:38 2009
@@ -19,6 +19,7 @@
import org.apache.webbeans.portable.events.ProcessSessionBeanImpl;
+@SuppressWarnings("unchecked")
public class GProcessSessionBean extends ProcessSessionBeanImpl
{
public GProcessSessionBean(Bean<Object> bean, AnnotatedType<?> annotatedType, String name, SessionBeanType type)
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=809330&r1=809329&r2=809330&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java Sun Aug 30 13:08:38 2009
@@ -42,13 +42,14 @@
import javax.enterprise.context.ConversationScoped;
import javax.enterprise.context.Dependent;
import javax.enterprise.context.RequestScoped;
-import javax.enterprise.context.ScopeType;
+import javax.enterprise.context.NormalScope;
import javax.enterprise.context.SessionScoped;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.IllegalProductException;
import javax.enterprise.inject.Instance;
import javax.inject.Named;
+import javax.inject.Scope;
import javax.enterprise.inject.New;
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.UnproxyableResolutionException;
@@ -1257,11 +1258,11 @@
deploymentTypeFound = true;
}
}
- else if (annotType.isAnnotationPresent(ScopeType.class))
+ else if (annotType.isAnnotationPresent(NormalScope.class) || annotType.isAnnotationPresent(Scope.class))
{
if (scopeTypeFound == true)
{
- throw new WebBeansConfigurationException("@StereoType annotation can not contain more than one @ScopeType annotation");
+ throw new WebBeansConfigurationException("@StereoType annotation can not contain more than one @Scope/@NormalScope annotation");
}
else
{
@@ -1421,7 +1422,7 @@
return beans;
}
- public static void checkUnproxiableApiType(Bean<?> bean, ScopeType scopeType)
+ public static void checkUnproxiableApiType(Bean<?> bean, Class<? extends Annotation> scopeType)
{
Asserts.assertNotNull("bean", "bean parameter can not be null");
Asserts.assertNotNull(scopeType, "scopeType parameter can not be null");
@@ -1448,7 +1449,7 @@
if (ClassUtil.isPrimitive(superClass) || ClassUtil.isArray(superClass) || ClassUtil.isFinal(superClass.getModifiers()) || ClassUtil.hasFinalMethod(superClass) || (cons == null || ClassUtil.isPrivate(cons.getModifiers())))
{
- if (scopeType.normal())
+ if (scopeType.isAnnotationPresent(NormalScope.class))
{
throw new UnproxyableResolutionException("WebBeans with api type with normal scope must be proxiable to inject, but class : " + superClass.getName() + " is not proxiable type");
}
@@ -1713,21 +1714,23 @@
return true;
}
- public static <T> void checkPassivationScope(AbstractBean<T> component, ScopeType scope)
+ public static <T> void checkPassivationScope(AbstractBean<T> component, NormalScope scope)
{
Asserts.assertNotNull(component, "component parameter can not be null");
- Asserts.assertNotNull(scope, "scope type parameter can not be null");
- boolean passivating = scope.passivating();
- Class<T> clazz = component.getReturnType();
-
- if (passivating)
+ if(scope != null)
{
- if (!component.isSerializable())
+ boolean passivating = scope.passivating();
+ Class<T> clazz = component.getReturnType();
+
+ if (passivating)
{
- throw new WebBeansConfigurationException("WebBeans component implementation class : " + clazz.getName() + " with passivating scope @" + scope.annotationType().getName() + " must be Serializable");
- }
- }
+ if (!component.isSerializable())
+ {
+ throw new WebBeansConfigurationException("WebBeans component implementation class : " + clazz.getName() + " with passivating scope @" + scope.annotationType().getName() + " must be Serializable");
+ }
+ }
+ }
}
@@ -1769,22 +1772,17 @@
{
Asserts.assertNotNull(scopeType, "scopeType argument can not be null");
- if (scopeType.isAnnotationPresent(ScopeType.class))
+ if (scopeType.isAnnotationPresent(NormalScope.class))
{
- ScopeType scope = scopeType.getAnnotation(ScopeType.class);
- if (scope.normal())
- {
- return true;
- }
-
- else
- {
- return false;
- }
+ return true;
+ }
+ else if(scopeType.isAnnotationPresent(Scope.class))
+ {
+ return false;
}
else
{
- throw new IllegalArgumentException("scopeType argument must be annotated with @ScopeType");
+ throw new IllegalArgumentException("scopeType argument must be annotated with @Scope or @NormalScope");
}
}
@@ -1803,13 +1801,16 @@
public static void checkSerializableScopeType(Class<?> scopeType, boolean isSerializable, String errorMessage)
{
// Scope type check
- ScopeType scope = scopeType.getAnnotation(ScopeType.class);
- if (scope.passivating())
+ NormalScope scope = scopeType.getAnnotation(NormalScope.class);
+ if(scope != null)
{
- if (!isSerializable)
+ if (scope.passivating())
{
- throw new IllegalProductException(errorMessage);
- }
+ if (!isSerializable)
+ {
+ throw new IllegalProductException(errorMessage);
+ }
+ }
}
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java?rev=809330&r1=809329&r2=809330&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java Sun Aug 30 13:08:38 2009
@@ -35,13 +35,14 @@
import java.util.Set;
import javax.decorator.Decorator;
-import javax.enterprise.context.ScopeType;
+import javax.enterprise.context.NormalScope;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.deployment.DeploymentType;
import javax.enterprise.inject.deployment.Production;
import javax.inject.Inject;
+import javax.inject.Scope;
import javax.interceptor.Interceptor;
import org.apache.webbeans.WebBeansConstants;
@@ -1639,10 +1640,15 @@
*/
private <T> void configureScopeType(AbstractBean<T> component, List<Class<? extends Annotation>> annotationSet, List<Element> annotationElementList)
{
- Class<? extends Annotation> scopeType = XMLDefinitionUtil.defineXMLTypeMetaData(component, annotationSet, ScopeType.class, createConfigurationFailedMessage() + "@ScopeType annotation is not configured correctly");
+ Class<? extends Annotation> scopeType = XMLDefinitionUtil.defineXMLTypeMetaData(component, annotationSet, NormalScope.class, createConfigurationFailedMessage() + "@Scope/@NormalScope annotation is not configured correctly");
- if (scopeType == null)
+ if(scopeType == null)
{
+ scopeType = XMLDefinitionUtil.defineXMLTypeMetaData(component, annotationSet, Scope.class, createConfigurationFailedMessage() + "@Scope/@NormalScope annotation is not configured correctly");
+ }
+
+ if (scopeType == null)
+ {
// From stereotype
DefinitionUtil.defineDefaultScopeType(component, createConfigurationFailedMessage() + "@ScopeType annotation is not configured correctly");
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java?rev=809330&r1=809329&r2=809330&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java Sun Aug 30 13:08:38 2009
@@ -25,8 +25,9 @@
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.decorator.Decorator;
-import javax.enterprise.context.ScopeType;
+import javax.enterprise.context.NormalScope;
import javax.inject.Named;
+import javax.inject.Scope;
import javax.enterprise.inject.NonBinding;
import javax.enterprise.inject.UnsatisfiedResolutionException;
import javax.enterprise.inject.deployment.DeploymentType;
@@ -124,7 +125,15 @@
while (it.hasNext())
{
Class<? extends Annotation> clazz = it.next();
- if (clazz.isAnnotationPresent(DeploymentType.class) || clazz.isAnnotationPresent(ScopeType.class) || AnnotationUtil.isBindingAnnotation(clazz) || AnnotationUtil.isInterceptorBindingAnnotation(clazz) || AnnotationUtil.isStereoTypeAnnotation(clazz) || clazz.equals(Named.class) || clazz.equals(Specializes.class) || clazz.equals(javax.interceptor.Interceptor.class) || clazz.equals(Decorator.class))
+ if (clazz.isAnnotationPresent(DeploymentType.class)
+ || clazz.isAnnotationPresent(NormalScope.class)
+ || clazz.isAnnotationPresent(Scope.class)
+ || AnnotationUtil.isBindingAnnotation(clazz)
+ || AnnotationUtil.isInterceptorBindingAnnotation(clazz)
+ || AnnotationUtil.isStereoTypeAnnotation(clazz)
+ || clazz.equals(Named.class)
+ || clazz.equals(Specializes.class) || clazz.equals(javax.interceptor.Interceptor.class)
+ || clazz.equals(Decorator.class))
{
continue;
}
@@ -604,7 +613,7 @@
for (Class<? extends Annotation> memberLevelMetaDataClass : memberLevelMetaData)
{
- if (!memberLevelMetaDataClass.isAnnotationPresent(DeploymentType.class) && !memberLevelMetaDataClass.isAnnotationPresent(ScopeType.class) && !AnnotationUtil.isStereoTypeAnnotation(memberLevelMetaDataClass) && !memberLevelMetaDataClass.equals(Named.class))
+ if (!memberLevelMetaDataClass.isAnnotationPresent(DeploymentType.class) && !memberLevelMetaDataClass.isAnnotationPresent(NormalScope.class) && !AnnotationUtil.isStereoTypeAnnotation(memberLevelMetaDataClass) && !memberLevelMetaDataClass.equals(Named.class))
{
throw new WebBeansConfigurationException(errorMessage + "Defined annotations for producer method name : " + producesMethod.getName() + " in class : " + component.getReturnType().getName() + " is not correct");
}
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhScopeType1.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhScopeType1.java?rev=809330&r1=809329&r2=809330&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhScopeType1.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhScopeType1.java Sun Aug 30 13:08:38 2009
@@ -22,9 +22,9 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import javax.enterprise.context.ScopeType;
+import javax.enterprise.context.NormalScope;
-@ScopeType
+@NormalScope
@Inherited
@Retention(RetentionPolicy.RUNTIME)
@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhScopeType2.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhScopeType2.java?rev=809330&r1=809329&r2=809330&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhScopeType2.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/inheritance/types/InhScopeType2.java Sun Aug 30 13:08:38 2009
@@ -22,9 +22,9 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import javax.enterprise.context.ScopeType;
+import javax.enterprise.context.NormalScope;
-@ScopeType
+@NormalScope
@Inherited
@Retention(RetentionPolicy.RUNTIME)
@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE, ElementType.PARAMETER })
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockManager.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockManager.java?rev=809330&r1=809329&r2=809330&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockManager.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockManager.java Sun Aug 30 13:08:38 2009
@@ -21,7 +21,6 @@
import java.util.Set;
import javax.el.ELResolver;
-import javax.enterprise.context.ScopeType;
import javax.enterprise.context.spi.Context;
import javax.enterprise.context.spi.Contextual;
import javax.enterprise.context.spi.CreationalContext;
@@ -260,13 +259,6 @@
@Override
- public ScopeType getScopeDefinition(Class<? extends Annotation> scopeType)
- {
- return this.manager.getScopeDefinition(scopeType);
- }
-
-
- @Override
public Set<Annotation> getStereotypeDefinition(Class<? extends Annotation> stereotype)
{
return this.manager.getStereotypeDefinition(stereotype);
@@ -274,9 +266,9 @@
@Override
- public boolean isBindingType(Class<? extends Annotation> annotationType)
+ public boolean isQualifier(Class<? extends Annotation> annotationType)
{
- return this.manager.isBindingType(annotationType);
+ return this.manager.isQualifier(annotationType);
}
@@ -288,11 +280,22 @@
@Override
- public boolean isScopeType(Class<? extends Annotation> annotationType)
+ public boolean isScope(Class<? extends Annotation> annotationType)
{
- return this.manager.isScopeType(annotationType);
+ return this.manager.isScope(annotationType);
}
+ @Override
+ public boolean isNormalScope(Class<? extends Annotation> annotationType)
+ {
+ return this.manager.isNormalScope(annotationType);
+ }
+
+ @Override
+ public boolean isPassivatingScope(Class<? extends Annotation> annotationType)
+ {
+ return this.manager.isPassivatingScope(annotationType);
+ }
@Override
public boolean isStereotype(Class<? extends Annotation> annotationType)
Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/exception/EventExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/exception/EventExceptionTest.java?rev=809330&r1=809329&r2=809330&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/exception/EventExceptionTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/exception/EventExceptionTest.java Sun Aug 30 13:08:38 2009
@@ -15,7 +15,7 @@
import java.lang.annotation.Annotation;
-import javax.enterprise.context.ScopeType;
+import javax.enterprise.context.NormalScope;
import javax.enterprise.inject.AnnotationLiteral;
import javax.servlet.ServletContext;
@@ -135,7 +135,7 @@
try
{
Annotation[] anns = new Annotation[1];
- anns[0] = new AnnotationLiteral<ScopeType>()
+ anns[0] = new AnnotationLiteral<NormalScope>()
{
};