Author: arne
Date: Sun Jan 6 09:09:46 2013
New Revision: 1429482
URL: http://svn.apache.org/viewvc?rev=1429482&view=rev
Log:
OWB-745: Moved stuff into AbstractInjectionTargetBeanCreator
Added:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ExtensionBeanCreatorImpl.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/NewManagedBeanCreatorImpl.java
Modified:
openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbUtility.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/NewManagedBean.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractInjecionTargetBeanCreator.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java
Modified:
openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbUtility.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbUtility.java?rev=1429482&r1=1429481&r2=1429482&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbUtility.java
(original)
+++
openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbUtility.java
Sun Jan 6 09:09:46 2013
@@ -49,7 +49,6 @@ import org.apache.webbeans.portable.even
import org.apache.webbeans.portable.events.ProcessProducerImpl;
import org.apache.webbeans.portable.events.ProcessSessionBeanImpl;
import org.apache.webbeans.portable.events.generics.GProcessSessionBean;
-import org.apache.webbeans.util.WebBeansAnnotatedTypeUtil;
import org.apache.webbeans.util.WebBeansUtil;
@SuppressWarnings("unchecked")
@@ -169,6 +168,7 @@ public final class EjbUtility
public static <T> void defineSpecializedData(Class<T> clazz,
BaseEjbBean<T> ejbBean)
{
+
final String message = "There are errors that are added by %s event
observers for %s. Look at logs for further details";
final WebBeansContext webBeansContext = ejbBean.getWebBeansContext();
@@ -176,13 +176,13 @@ public final class EjbUtility
final AnnotatedElementFactory annotatedElementFactory =
webBeansContext.getAnnotatedElementFactory();
- final AnnotatedType<T> annotatedType =
annotatedElementFactory.newAnnotatedType(clazz);
+ final AnnotatedType<T> annotatedType = ejbBean.getAnnotatedType();
- final WebBeansAnnotatedTypeUtil util =
webBeansContext.getAnnotatedTypeUtil();
+ final EjbBeanCreatorImpl<T> ejbBeanCreator = new
EjbBeanCreatorImpl<T>(ejbBean);
- final Set<ProducerMethodBean<?>> producerMethodBeans =
util.defineProducerMethods(ejbBean, annotatedType);
+ final Set<ProducerMethodBean<?>> producerMethodBeans =
ejbBeanCreator.defineProducerMethods();
- final Set<ProducerFieldBean<?>> producerFieldBeans =
util.defineProducerFields(ejbBean, annotatedType);
+ final Set<ProducerFieldBean<?>> producerFieldBeans =
ejbBeanCreator.defineProducerFields();
checkProducerMethods(producerMethodBeans, ejbBean);
@@ -227,7 +227,6 @@ public final class EjbUtility
manager.getBeans().addAll(producerMethodBeans);
manager.getBeans().addAll(producerFieldBeans);
- EjbBeanCreatorImpl<T> ejbBeanCreator = new
EjbBeanCreatorImpl<T>(ejbBean);
ejbBeanCreator.defineDisposalMethods();
}
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/NewManagedBean.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/NewManagedBean.java?rev=1429482&r1=1429481&r2=1429482&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/NewManagedBean.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/NewManagedBean.java
Sun Jan 6 09:09:46 2013
@@ -18,7 +18,6 @@
*/
package org.apache.webbeans.component;
-import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.AnnotatedType;
import org.apache.webbeans.config.WebBeansContext;
@@ -38,18 +37,6 @@ public class NewManagedBean<T> extends M
super(returnType, annotatedType, webBeansContext);
}
- @Override
- protected T createInstance(CreationalContext<T> creationalContext)
- {
- return super.createInstance(creationalContext);
- }
-
- @Override
- protected void destroyInstance(T instance, CreationalContext<T>
creationalContext)
- {
- super.destroyInstance(instance, creationalContext);
- }
-
/**
* always true for New qualifier
*/
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractInjecionTargetBeanCreator.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractInjecionTargetBeanCreator.java?rev=1429482&r1=1429481&r2=1429482&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractInjecionTargetBeanCreator.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractInjecionTargetBeanCreator.java
Sun Jan 6 09:09:46 2013
@@ -21,26 +21,44 @@ package org.apache.webbeans.component.cr
import static
org.apache.webbeans.util.InjectionExceptionUtils.throwUnsatisfiedResolutionException;
import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
+import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import javax.enterprise.context.Dependent;
+import javax.enterprise.event.Observes;
+import javax.enterprise.event.Reception;
import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.Specializes;
+import javax.enterprise.inject.spi.AnnotatedField;
import javax.enterprise.inject.spi.AnnotatedMethod;
import javax.enterprise.inject.spi.AnnotatedParameter;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.ObserverMethod;
+import javax.inject.Inject;
+import javax.inject.Named;
import org.apache.webbeans.annotation.AnnotationManager;
+import org.apache.webbeans.annotation.DependentScopeLiteral;
import org.apache.webbeans.component.AbstractInjectionTargetBean;
import org.apache.webbeans.component.ProducerFieldBean;
import org.apache.webbeans.component.ProducerMethodBean;
+import org.apache.webbeans.component.ResourceBean;
+import org.apache.webbeans.config.DefinitionUtil;
import org.apache.webbeans.config.WebBeansContext;
import org.apache.webbeans.container.InjectionResolver;
import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.spi.api.ResourceReference;
import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.ClassUtil;
import org.apache.webbeans.util.WebBeansAnnotatedTypeUtil;
+import org.apache.webbeans.util.WebBeansUtil;
/**
* Abstract implementation of {@link InjectionTargetBeanCreator}.
@@ -148,7 +166,59 @@ public abstract class AbstractInjecionTa
*/
public void defineInjectedFields()
{
- webBeansContext.getAnnotatedTypeUtil().defineInjectedFields(getBean(),
getAnnotatedType());
+ AnnotationManager annotationManager =
webBeansContext.getAnnotationManager();
+
+ Set<AnnotatedField<? super T>> annotatedFields =
getAnnotatedType().getFields();
+ for(AnnotatedField<? super T> annotatedField: annotatedFields)
+ {
+
if(Modifier.isPublic(annotatedField.getJavaMember().getModifiers()) &&
!annotatedField.isStatic())
+ {
+
if(webBeansContext.getBeanManagerImpl().isNormalScope(getBean().getScope()))
+ {
+ throw new WebBeansConfigurationException("If bean has a
public field, bean scope must be defined as @Scope. Bean is : "
+ + getBean().toString());
+ }
+ }
+
+ if(!annotatedField.isAnnotationPresent(Inject.class))
+ {
+ continue;
+ }
+
+ if (annotatedField.isAnnotationPresent(Produces.class))
+ {
+ throw new WebBeansConfigurationException("Injection fields can
not be annotated with @Produces");
+ }
+
+ Field field = annotatedField.getJavaMember();
+ Annotation[] anns =
AnnotationUtil.getAnnotationsFromSet(annotatedField.getAnnotations());
+ if(Modifier.isPublic(field.getModifiers()))
+ {
+ if(!getBean().getScope().equals(Dependent.class))
+ {
+ throw new WebBeansConfigurationException("Error in
annotated field : " + annotatedField
+ +" while definining
injected field. If bean has a public modifier injection point, bean scope must
be defined as @Dependent");
+ }
+ }
+
+ Annotation[] qualifierAnns =
annotationManager.getQualifierAnnotations(anns);
+
+ if (qualifierAnns.length > 0)
+ {
+ if (qualifierAnns.length > 0)
+ {
+
annotationManager.checkForNewQualifierForDeployment(annotatedField.getBaseType(),
annotatedField.getDeclaringType().getJavaClass(), field.getName(), anns);
+ }
+
+ int mod = field.getModifiers();
+
+ if (!Modifier.isStatic(mod) && !Modifier.isFinal(mod))
+ {
+ getBean().addInjectedField(field);
+
webBeansContext.getAnnotatedTypeUtil().addFieldInjectionPointMetaData(getBean(),
annotatedField);
+ }
+ }
+ }
}
/**
@@ -156,7 +226,35 @@ public abstract class AbstractInjecionTa
*/
public void defineInjectedMethods()
{
-
webBeansContext.getAnnotatedTypeUtil().defineInjectedMethods(getBean(),
getAnnotatedType());
+ Set<AnnotatedMethod<? super T>> annotatedMethods =
getAnnotatedType().getMethods();
+
+ for (AnnotatedMethod<? super T> annotatedMethod : annotatedMethods)
+ {
+ boolean isInitializer =
annotatedMethod.isAnnotationPresent(Inject.class);
+
+ if (isInitializer)
+ {
+ //Do not support static
+ if(annotatedMethod.isStatic())
+ {
+ continue;
+ }
+
+
WebBeansAnnotatedTypeUtil.checkForInjectedInitializerMethod(getBean(),
(AnnotatedMethod<T>)annotatedMethod);
+ }
+ else
+ {
+ continue;
+ }
+
+ Method method = annotatedMethod.getJavaMember();
+
+ if (!Modifier.isStatic(method.getModifiers()))
+ {
+ getBean().addInjectedMethod(method);
+
webBeansContext.getAnnotatedTypeUtil().addMethodInjectionPointMetaData(getBean(),
annotatedMethod);
+ }
+ }
}
/**
@@ -164,7 +262,54 @@ public abstract class AbstractInjecionTa
*/
public Set<ObserverMethod<?>> defineObserverMethods()
{
- return
webBeansContext.getAnnotatedTypeUtil().defineObserverMethods(getBean(),
getAnnotatedType());
+ Set<ObserverMethod<?>> definedObservers = new
HashSet<ObserverMethod<?>>();
+ Set<AnnotatedMethod<? super T>> annotatedMethods =
getAnnotatedType().getMethods();
+ for (AnnotatedMethod<? super T> annotatedMethod : annotatedMethods)
+ {
+ AnnotatedMethod<T> annt = (AnnotatedMethod<T>)annotatedMethod;
+ List<AnnotatedParameter<T>> parameters = annt.getParameters();
+ boolean found = false;
+ for(AnnotatedParameter<T> parameter : parameters)
+ {
+ if(parameter.isAnnotationPresent(Observes.class))
+ {
+ found = true;
+ break;
+ }
+ }
+
+ if(found)
+ {
+
WebBeansAnnotatedTypeUtil.checkObserverMethodConditions(annotatedMethod,
annotatedMethod.getDeclaringType().getJavaClass());
+ if (getBean().getScope().equals(Dependent.class))
+ {
+ //Check Reception
+
AnnotationUtil.getAnnotatedMethodFirstParameterWithAnnotation(annotatedMethod,
Observes.class);
+
+ Observes observes =
AnnotationUtil.getAnnotatedMethodFirstParameterAnnotation(annotatedMethod,
Observes.class);
+ Reception reception = observes.notifyObserver();
+ if(reception.equals(Reception.IF_EXISTS))
+ {
+ throw new WebBeansConfigurationException("Dependent
Bean : " + getBean() + " can not define observer method with @Receiver =
IF_EXIST");
+ }
+ }
+
+ //Add method
+ getBean().addObservableMethod(annotatedMethod.getJavaMember());
+
+ //Add injection point data
+
webBeansContext.getAnnotatedTypeUtil().addMethodInjectionPointMetaData(getBean(),
annotatedMethod);
+
+ //Looking for ObserverMethod
+ ObserverMethod<?> definedObserver =
webBeansContext.getBeanManagerImpl().getNotificationManager().getObservableMethodForAnnotatedMethod(annotatedMethod,
getBean());
+ if(definedObserver != null)
+ {
+ definedObservers.add(definedObserver);
+ }
+ }
+ }
+
+ return definedObservers;
}
/**
@@ -172,7 +317,94 @@ public abstract class AbstractInjecionTa
*/
public Set<ProducerFieldBean<?>> defineProducerFields()
{
- return
webBeansContext.getAnnotatedTypeUtil().defineProducerFields(getBean(),
getAnnotatedType());
+ DefinitionUtil definitionUtil = webBeansContext.getDefinitionUtil();
+ Set<ProducerFieldBean<?>> producerBeans = new
HashSet<ProducerFieldBean<?>>();
+ Set<AnnotatedField<? super T>> annotatedFields =
getAnnotatedType().getFields();
+ for(AnnotatedField<? super T> annotatedField: annotatedFields)
+ {
+ if(annotatedField.isAnnotationPresent(Produces.class) &&
annotatedField.getDeclaringType().equals(getAnnotatedType()))
+ {
+ Type genericType = annotatedField.getBaseType();
+
+ if(ClassUtil.isTypeVariable(genericType))
+ {
+ throw new WebBeansConfigurationException("Producer
annotated field : " + annotatedField + " can not be Wildcard type or Type
variable");
+ }
+ if(ClassUtil.isParametrizedType(genericType))
+ {
+
if(!ClassUtil.checkParametrizedType((ParameterizedType)genericType))
+ {
+ throw new WebBeansConfigurationException("Producer
annotated field : " + annotatedField + " can not be Wildcard type or Type
variable");
+ }
+ }
+
+ Annotation[] anns =
AnnotationUtil.getAnnotationsFromSet(annotatedField.getAnnotations());
+ Field field = annotatedField.getJavaMember();
+
+ //Producer field for resource
+ Annotation resourceAnnotation =
AnnotationUtil.hasOwbInjectableResource(anns);
+ //Producer field for resource
+ if(resourceAnnotation != null)
+ {
+ //Check for valid resource annotation
+
//WebBeansUtil.checkForValidResources(annotatedField.getDeclaringType().getJavaClass(),
field.getType(), field.getName(), anns);
+ if(!Modifier.isStatic(field.getModifiers()))
+ {
+ ResourceReference<T, Annotation> resourceRef = new
ResourceReference<T, Annotation>(getBean().getBeanClass(), field.getName(),
+
(Class<T>)field.getType(), resourceAnnotation);
+
+ //Can not define EL name
+ if(annotatedField.isAnnotationPresent(Named.class))
+ {
+ throw new WebBeansConfigurationException("Resource
producer annotated field : " + annotatedField + " can not define EL name");
+ }
+
+ ResourceBean<T, Annotation> resourceBean = new
ResourceBean<T, Annotation>((Class<T>)field.getType(), getBean(), resourceRef);
+
+
resourceBean.getTypes().addAll(annotatedField.getTypeClosure());
+ definitionUtil.defineQualifiers(resourceBean, anns);
+ resourceBean.setImplScopeType(new
DependentScopeLiteral());
+ resourceBean.setProducerField(field);
+
+ producerBeans.add(resourceBean);
+ }
+ }
+ else
+ {
+ ProducerFieldBean<T> producerFieldBean = new
ProducerFieldBean<T>(getBean(),
(Class<T>)ClassUtil.getClass(annotatedField.getBaseType()));
+ producerFieldBean.setProducerField(field);
+
+ if (producerFieldBean.getReturnType().isPrimitive())
+ {
+ producerFieldBean.setNullable(false);
+ }
+
+ definitionUtil.defineSerializable(producerFieldBean);
+ definitionUtil.defineStereoTypes(producerFieldBean, anns);
+
webBeansContext.getWebBeansUtil().setBeanEnableFlagForProducerBean(getBean(),
producerFieldBean, anns);
+ if (producerFieldBean.getReturnType().isArray())
+ {
+ // TODO this special handling should not be necessary,
seems to be a bug in the tck
+ producerFieldBean.getTypes().add(Object.class);
+
producerFieldBean.getTypes().add(producerFieldBean.getReturnType());
+ }
+ else
+ {
+
producerFieldBean.getTypes().addAll(annotatedField.getTypeClosure());
+ }
+ definitionUtil.defineScopeType(producerFieldBean, anns,
"Annotated producer field: " + annotatedField + "must declare default @Scope
annotation", false);
+
webBeansContext.getWebBeansUtil().checkUnproxiableApiType(producerFieldBean,
+
producerFieldBean.getScope());
+
WebBeansUtil.checkProducerGenericType(producerFieldBean,annotatedField.getJavaMember());
+ definitionUtil.defineQualifiers(producerFieldBean, anns);
+ definitionUtil.defineName(producerFieldBean, anns,
WebBeansUtil.getProducerDefaultName(annotatedField.getJavaMember().getName()));
+
+ producerBeans.add(producerFieldBean);
+ }
+ }
+ }
+
+ return producerBeans;
}
/**
@@ -180,7 +412,75 @@ public abstract class AbstractInjecionTa
*/
public Set<ProducerMethodBean<?>> defineProducerMethods()
{
- return
webBeansContext.getAnnotatedTypeUtil().defineProducerMethods(getBean(),
getAnnotatedType());
+ DefinitionUtil definitionUtil = webBeansContext.getDefinitionUtil();
+ Set<ProducerMethodBean<?>> producerBeans = new
HashSet<ProducerMethodBean<?>>();
+ Set<AnnotatedMethod<? super T>> annotatedMethods =
getAnnotatedType().getMethods();
+
+ for(AnnotatedMethod<? super T> annotatedMethod: annotatedMethods)
+ {
+ if(annotatedMethod.isAnnotationPresent(Produces.class) &&
annotatedMethod.getDeclaringType().equals(getAnnotatedType()))
+ {
+
WebBeansAnnotatedTypeUtil.checkProducerMethodForDeployment(annotatedMethod);
+ boolean specialize = false;
+ if(annotatedMethod.isAnnotationPresent(Specializes.class))
+ {
+ if (annotatedMethod.isStatic())
+ {
+ throw new WebBeansConfigurationException("Specializing
annotated producer method : " + annotatedMethod + " can not be static");
+ }
+
+ specialize = true;
+ }
+
+ ProducerMethodBean<T> producerMethodBean = new
ProducerMethodBean<T>(getBean(),
(Class<T>)ClassUtil.getClass(annotatedMethod.getBaseType()));
+
producerMethodBean.setCreatorMethod(annotatedMethod.getJavaMember());
+
+ if(specialize)
+ {
+
WebBeansAnnotatedTypeUtil.configureProducerSpecialization(producerMethodBean,
(AnnotatedMethod<T>)annotatedMethod);
+ }
+
+ if
(ClassUtil.getClass(annotatedMethod.getBaseType()).isPrimitive())
+ {
+ producerMethodBean.setNullable(false);
+ }
+
+ definitionUtil.defineSerializable(producerMethodBean);
+ definitionUtil.defineStereoTypes(producerMethodBean,
AnnotationUtil.getAnnotationsFromSet(annotatedMethod.getAnnotations()));
+
webBeansContext.getWebBeansUtil().setBeanEnableFlagForProducerBean(getBean(),
+
producerMethodBean,
+
AnnotationUtil.getAnnotationsFromSet(annotatedMethod.getAnnotations()));
+
+ if (producerMethodBean.getReturnType().isArray())
+ {
+ // TODO this special handling should not be necessary,
seems to be a bug in the tck
+ producerMethodBean.getTypes().add(Object.class);
+
producerMethodBean.getTypes().add(producerMethodBean.getReturnType());
+ }
+ else
+ {
+
producerMethodBean.getTypes().addAll(annotatedMethod.getTypeClosure());
+ }
+ definitionUtil.defineScopeType(producerMethodBean,
+
AnnotationUtil.getAnnotationsFromSet(annotatedMethod.getAnnotations()),
+
"Annotated producer method : " + annotatedMethod + "must declare default
@Scope annotation",
+
false);
+
webBeansContext.getWebBeansUtil().checkUnproxiableApiType(producerMethodBean,
+
producerMethodBean.getScope());
+
WebBeansUtil.checkProducerGenericType(producerMethodBean,annotatedMethod.getJavaMember());
+ definitionUtil.defineName(producerMethodBean,
+
AnnotationUtil.getAnnotationsFromSet(annotatedMethod.getAnnotations()),
+
WebBeansUtil.getProducerDefaultName(annotatedMethod.getJavaMember().getName()));
+ definitionUtil.defineQualifiers(producerMethodBean,
AnnotationUtil.getAnnotationsFromSet(annotatedMethod.getAnnotations()));
+
+
webBeansContext.getAnnotatedTypeUtil().addMethodInjectionPointMetaData(producerMethodBean,
annotatedMethod);
+ producerBeans.add(producerMethodBean);
+
+ }
+
+ }
+
+ return producerBeans;
}
/**
Added:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ExtensionBeanCreatorImpl.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ExtensionBeanCreatorImpl.java?rev=1429482&view=auto
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ExtensionBeanCreatorImpl.java
(added)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ExtensionBeanCreatorImpl.java
Sun Jan 6 09:09:46 2013
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.component.creation;
+
+import org.apache.webbeans.component.ExtensionBean;
+import org.apache.webbeans.config.WebBeansContext;
+
+public class ExtensionBeanCreatorImpl<T> extends
AbstractInjecionTargetBeanCreator<T>
+{
+
+ public ExtensionBeanCreatorImpl(Class<T> type, WebBeansContext
webBeansContext)
+ {
+ super(new ExtensionBean<T>(type, webBeansContext));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public ExtensionBean<T> getBean()
+ {
+ return (ExtensionBean<T>)super.getBean();
+ }
+}
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java?rev=1429482&r1=1429481&r2=1429482&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java
Sun Jan 6 09:09:46 2013
@@ -70,7 +70,7 @@ public class ManagedBeanCreatorImpl<T> e
this(new ManagedBean<T>(annotatedType.getJavaClass(), annotatedType,
webBeansContext));
}
- private ManagedBeanCreatorImpl(ManagedBean<T> managedBean)
+ protected ManagedBeanCreatorImpl(ManagedBean<T> managedBean)
{
super(managedBean);
webBeansContext = managedBean.getWebBeansContext();
Added:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/NewManagedBeanCreatorImpl.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/NewManagedBeanCreatorImpl.java?rev=1429482&view=auto
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/NewManagedBeanCreatorImpl.java
(added)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/NewManagedBeanCreatorImpl.java
Sun Jan 6 09:09:46 2013
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.component.creation;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+
+import org.apache.webbeans.component.NewManagedBean;
+import org.apache.webbeans.component.WebBeansType;
+import org.apache.webbeans.config.WebBeansContext;
+
+public class NewManagedBeanCreatorImpl<T> extends ManagedBeanCreatorImpl<T>
+{
+
+ public NewManagedBeanCreatorImpl(AnnotatedType<T> annotatedType,
WebBeansContext webBeansContext)
+ {
+ super(new NewManagedBean<T>(annotatedType.getJavaClass(),
WebBeansType.MANAGED, annotatedType, webBeansContext));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public NewManagedBean<T> getBean()
+ {
+ return (NewManagedBean<T>)super.getBean();
+ }
+}
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java?rev=1429482&r1=1429481&r2=1429482&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java
Sun Jan 6 09:09:46 2013
@@ -19,44 +19,26 @@
package org.apache.webbeans.util;
import org.apache.webbeans.annotation.AnnotationManager;
-import org.apache.webbeans.annotation.DependentScopeLiteral;
import org.apache.webbeans.component.AbstractInjectionTargetBean;
import org.apache.webbeans.component.AbstractOwbBean;
-import org.apache.webbeans.component.InjectionTargetBean;
import org.apache.webbeans.component.OwbBean;
-import org.apache.webbeans.component.ProducerFieldBean;
-import org.apache.webbeans.component.ProducerMethodBean;
-import org.apache.webbeans.component.ResourceBean;
-import org.apache.webbeans.config.DefinitionUtil;
import org.apache.webbeans.config.WebBeansContext;
import org.apache.webbeans.exception.WebBeansConfigurationException;
import org.apache.webbeans.inject.impl.InjectionPointFactory;
-import org.apache.webbeans.spi.api.ResourceReference;
-import javax.enterprise.context.Dependent;
import javax.enterprise.event.Observes;
-import javax.enterprise.event.Reception;
import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Produces;
-import javax.enterprise.inject.Specializes;
import javax.enterprise.inject.spi.AnnotatedConstructor;
import javax.enterprise.inject.spi.AnnotatedField;
import javax.enterprise.inject.spi.AnnotatedMethod;
import javax.enterprise.inject.spi.AnnotatedParameter;
import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.InjectionPoint;
-import javax.enterprise.inject.spi.ObserverMethod;
import javax.inject.Inject;
-import javax.inject.Named;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Field;
import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -163,321 +145,6 @@ public final class WebBeansAnnotatedType
}
}
- @SuppressWarnings("unchecked")
- public <X> Set<ObserverMethod<?>>
defineObserverMethods(AbstractInjectionTargetBean<X> bean,AnnotatedType<X>
annotatedType)
- {
- WebBeansContext webBeansContext = bean.getWebBeansContext();
- Set<ObserverMethod<?>> definedObservers = new
HashSet<ObserverMethod<?>>();
- Set<AnnotatedMethod<? super X>> annotatedMethods =
annotatedType.getMethods();
- for (AnnotatedMethod<? super X> annotatedMethod : annotatedMethods)
- {
- AnnotatedMethod<X> annt = (AnnotatedMethod<X>)annotatedMethod;
- List<AnnotatedParameter<X>> parameters = annt.getParameters();
- boolean found = false;
- for(AnnotatedParameter<X> parameter : parameters)
- {
- if(parameter.isAnnotationPresent(Observes.class))
- {
- found = true;
- break;
- }
- }
-
- if(found)
- {
- checkObserverMethodConditions(annotatedMethod,
annotatedMethod.getDeclaringType().getJavaClass());
- if(bean.getScope().equals(Dependent.class))
- {
- //Check Reception
-
AnnotationUtil.getAnnotatedMethodFirstParameterWithAnnotation(annotatedMethod,
Observes.class);
-
- Observes observes =
AnnotationUtil.getAnnotatedMethodFirstParameterAnnotation(annotatedMethod,
Observes.class);
- Reception reception = observes.notifyObserver();
- if(reception.equals(Reception.IF_EXISTS))
- {
- throw new WebBeansConfigurationException("Dependent
Bean : " + bean + " can not define observer method with @Receiver = IF_EXIST");
- }
- }
-
- //Add method
- bean.addObservableMethod(annotatedMethod.getJavaMember());
-
- //Add injection point data
- addMethodInjectionPointMetaData(bean, annotatedMethod);
-
- //Looking for ObserverMethod
- ObserverMethod<?> definedObserver =
webBeansContext.getBeanManagerImpl().getNotificationManager().getObservableMethodForAnnotatedMethod(annotatedMethod,
bean);
- if(definedObserver != null)
- {
- definedObservers.add(definedObserver);
- }
- }
- }
-
- return definedObservers;
- }
-
- @SuppressWarnings("unchecked")
- public <X> void defineInjectedMethods(AbstractInjectionTargetBean<X>
bean,AnnotatedType<X> annotatedType)
- {
- Set<AnnotatedMethod<? super X>> annotatedMethods =
annotatedType.getMethods();
-
- for (AnnotatedMethod<? super X> annotatedMethod : annotatedMethods)
- {
- boolean isInitializer =
annotatedMethod.isAnnotationPresent(Inject.class);
-
- if (isInitializer)
- {
- //Do not support static
- if(annotatedMethod.isStatic())
- {
- continue;
- }
-
- checkForInjectedInitializerMethod(bean,
(AnnotatedMethod<X>)annotatedMethod);
- }
- else
- {
- continue;
- }
-
- Method method = annotatedMethod.getJavaMember();
-
- if (!Modifier.isStatic(method.getModifiers()))
- {
- bean.addInjectedMethod(method);
- addMethodInjectionPointMetaData(bean, annotatedMethod);
- }
- }
- }
-
- public <X> void defineInjectedFields(AbstractInjectionTargetBean<X>
bean,AnnotatedType<X> annotatedType)
- {
- AnnotationManager annotationManager =
bean.getWebBeansContext().getAnnotationManager();
-
- Set<AnnotatedField<? super X>> annotatedFields =
annotatedType.getFields();
- for(AnnotatedField<? super X> annotatedField: annotatedFields)
- {
-
if(Modifier.isPublic(annotatedField.getJavaMember().getModifiers()) &&
!annotatedField.isStatic())
- {
-
if(webBeansContext.getBeanManagerImpl().isNormalScope(bean.getScope()))
- {
- throw new WebBeansConfigurationException("If bean has a
public field, bean scope must be defined as @Scope. Bean is : "
- + bean.toString());
- }
- }
-
- if(!annotatedField.isAnnotationPresent(Inject.class))
- {
- continue;
- }
-
- if (annotatedField.isAnnotationPresent(Produces.class))
- {
- throw new WebBeansConfigurationException("Injection fields can
not be annotated with @Produces");
- }
-
- Field field = annotatedField.getJavaMember();
- Annotation[] anns =
AnnotationUtil.getAnnotationsFromSet(annotatedField.getAnnotations());
- if(Modifier.isPublic(field.getModifiers()))
- {
- if(!bean.getScope().equals(Dependent.class))
- {
- throw new WebBeansConfigurationException("Error in
annotated field : " + annotatedField
- +" while definining
injected field. If bean has a public modifier injection point, bean scope must
be defined as @Dependent");
- }
- }
-
- Annotation[] qualifierAnns =
annotationManager.getQualifierAnnotations(anns);
-
- if (qualifierAnns.length > 0)
- {
- if (qualifierAnns.length > 0)
- {
-
annotationManager.checkForNewQualifierForDeployment(annotatedField.getBaseType(),
annotatedField.getDeclaringType().getJavaClass(), field.getName(), anns);
- }
-
- int mod = field.getModifiers();
-
- if (!Modifier.isStatic(mod) && !Modifier.isFinal(mod))
- {
- bean.addInjectedField(field);
- addFieldInjectionPointMetaData(bean, annotatedField);
- }
- }
- }
- }
-
-
- @SuppressWarnings("unchecked")
- public <X> Set<ProducerFieldBean<?>>
defineProducerFields(InjectionTargetBean<X> bean, AnnotatedType<X>
annotatedType)
- {
- DefinitionUtil definitionUtil = webBeansContext.getDefinitionUtil();
- Set<ProducerFieldBean<?>> producerBeans = new
HashSet<ProducerFieldBean<?>>();
- Set<AnnotatedField<? super X>> annotatedFields =
annotatedType.getFields();
- for(AnnotatedField<? super X> annotatedField: annotatedFields)
- {
- if(annotatedField.isAnnotationPresent(Produces.class) &&
annotatedField.getDeclaringType().equals(annotatedType))
- {
- Type genericType = annotatedField.getBaseType();
-
- if(ClassUtil.isTypeVariable(genericType))
- {
- throw new WebBeansConfigurationException("Producer
annotated field : " + annotatedField + " can not be Wildcard type or Type
variable");
- }
- if(ClassUtil.isParametrizedType(genericType))
- {
-
if(!ClassUtil.checkParametrizedType((ParameterizedType)genericType))
- {
- throw new WebBeansConfigurationException("Producer
annotated field : " + annotatedField + " can not be Wildcard type or Type
variable");
- }
- }
-
- Annotation[] anns =
AnnotationUtil.getAnnotationsFromSet(annotatedField.getAnnotations());
- Field field = annotatedField.getJavaMember();
-
- //Producer field for resource
- Annotation resourceAnnotation =
AnnotationUtil.hasOwbInjectableResource(anns);
- //Producer field for resource
- if(resourceAnnotation != null)
- {
- //Check for valid resource annotation
-
//WebBeansUtil.checkForValidResources(annotatedField.getDeclaringType().getJavaClass(),
field.getType(), field.getName(), anns);
- if(!Modifier.isStatic(field.getModifiers()))
- {
- ResourceReference<X,Annotation> resourceRef = new
ResourceReference<X, Annotation>(bean.getBeanClass(), field.getName(),
-
(Class<X>)field.getType(), resourceAnnotation);
-
- //Can not define EL name
- if(annotatedField.isAnnotationPresent(Named.class))
- {
- throw new WebBeansConfigurationException("Resource
producer annotated field : " + annotatedField + " can not define EL name");
- }
-
- ResourceBean<X,Annotation> resourceBean = new
ResourceBean((Class<X>)field.getType(),bean, resourceRef);
-
-
resourceBean.getTypes().addAll(annotatedField.getTypeClosure());
- definitionUtil.defineQualifiers(resourceBean, anns);
- resourceBean.setImplScopeType(new
DependentScopeLiteral());
- resourceBean.setProducerField(field);
-
- producerBeans.add(resourceBean);
- }
- }
- else
- {
- ProducerFieldBean<X> producerFieldBean = new
ProducerFieldBean<X>(bean,
(Class<X>)ClassUtil.getClass(annotatedField.getBaseType()));
- producerFieldBean.setProducerField(field);
-
- if (producerFieldBean.getReturnType().isPrimitive())
- {
- producerFieldBean.setNullable(false);
- }
-
- definitionUtil.defineSerializable(producerFieldBean);
- definitionUtil.defineStereoTypes(producerFieldBean, anns);
-
webBeansContext.getWebBeansUtil().setBeanEnableFlagForProducerBean(bean,
producerFieldBean, anns);
- if (producerFieldBean.getReturnType().isArray())
- {
- // TODO this special handling should not be necessary,
seems to be a bug in the tck
- producerFieldBean.getTypes().add(Object.class);
-
producerFieldBean.getTypes().add(producerFieldBean.getReturnType());
- }
- else
- {
-
producerFieldBean.getTypes().addAll(annotatedField.getTypeClosure());
- }
- definitionUtil.defineScopeType(producerFieldBean, anns,
"Annotated producer field: " + annotatedField + "must declare default @Scope
annotation", false);
-
webBeansContext.getWebBeansUtil().checkUnproxiableApiType(producerFieldBean,
-
producerFieldBean.getScope());
-
WebBeansUtil.checkProducerGenericType(producerFieldBean,annotatedField.getJavaMember());
- definitionUtil.defineQualifiers(producerFieldBean, anns);
- definitionUtil.defineName(producerFieldBean, anns,
WebBeansUtil.getProducerDefaultName(annotatedField.getJavaMember().getName()));
-
- producerBeans.add(producerFieldBean);
- }
- }
- }
-
- return producerBeans;
- }
-
-
- @SuppressWarnings("unchecked")
- public <X> Set<ProducerMethodBean<?>>
defineProducerMethods(InjectionTargetBean<X> bean, AnnotatedType<X>
annotatedType)
- {
- DefinitionUtil definitionUtil = webBeansContext.getDefinitionUtil();
- Set<ProducerMethodBean<?>> producerBeans = new
HashSet<ProducerMethodBean<?>>();
- Set<AnnotatedMethod<? super X>> annotatedMethods =
annotatedType.getMethods();
-
- for(AnnotatedMethod<? super X> annotatedMethod: annotatedMethods)
- {
- if(annotatedMethod.isAnnotationPresent(Produces.class) &&
annotatedMethod.getDeclaringType().equals(annotatedType))
- {
- checkProducerMethodForDeployment(annotatedMethod);
- boolean specialize = false;
- if(annotatedMethod.isAnnotationPresent(Specializes.class))
- {
- if (annotatedMethod.isStatic())
- {
- throw new WebBeansConfigurationException("Specializing
annotated producer method : " + annotatedMethod + " can not be static");
- }
-
- specialize = true;
- }
-
- ProducerMethodBean<X> producerMethodBean = new
ProducerMethodBean<X>(bean,
(Class<X>)ClassUtil.getClass(annotatedMethod.getBaseType()));
-
producerMethodBean.setCreatorMethod(annotatedMethod.getJavaMember());
-
- if(specialize)
- {
- configureProducerSpecialization(producerMethodBean,
(AnnotatedMethod<X>)annotatedMethod);
- }
-
- if
(ClassUtil.getClass(annotatedMethod.getBaseType()).isPrimitive())
- {
- producerMethodBean.setNullable(false);
- }
-
- definitionUtil.defineSerializable(producerMethodBean);
- definitionUtil.defineStereoTypes(producerMethodBean,
AnnotationUtil.getAnnotationsFromSet(annotatedMethod.getAnnotations()));
-
webBeansContext.getWebBeansUtil().setBeanEnableFlagForProducerBean(bean,
-
producerMethodBean,
-
AnnotationUtil.getAnnotationsFromSet(annotatedMethod.getAnnotations()));
-
- if (producerMethodBean.getReturnType().isArray())
- {
- // TODO this special handling should not be necessary,
seems to be a bug in the tck
- producerMethodBean.getTypes().add(Object.class);
-
producerMethodBean.getTypes().add(producerMethodBean.getReturnType());
- }
- else
- {
-
producerMethodBean.getTypes().addAll(annotatedMethod.getTypeClosure());
- }
- definitionUtil.defineScopeType(producerMethodBean,
-
AnnotationUtil.getAnnotationsFromSet(annotatedMethod.getAnnotations()),
-
"Annotated producer method : " + annotatedMethod + "must declare default
@Scope annotation",
-
false);
-
webBeansContext.getWebBeansUtil().checkUnproxiableApiType(producerMethodBean,
-
producerMethodBean.getScope());
-
WebBeansUtil.checkProducerGenericType(producerMethodBean,annotatedMethod.getJavaMember());
- definitionUtil.defineName(producerMethodBean,
-
AnnotationUtil.getAnnotationsFromSet(annotatedMethod.getAnnotations()),
-
WebBeansUtil.getProducerDefaultName(annotatedMethod.getJavaMember().getName()));
- definitionUtil.defineQualifiers(producerMethodBean,
AnnotationUtil.getAnnotationsFromSet(annotatedMethod.getAnnotations()));
-
- addMethodInjectionPointMetaData(producerMethodBean,
annotatedMethod);
- producerBeans.add(producerMethodBean);
-
- }
-
- }
-
- return producerBeans;
- }
-
-
/**
* Check producer method is ok for deployment.
*
@@ -540,7 +207,7 @@ public final class WebBeansAnnotatedType
/**
* add the definitions for a @Initializer method.
*/
- private static <X> void
checkForInjectedInitializerMethod(AbstractInjectionTargetBean<X> component,
AnnotatedMethod<X> annotatedMethod)
+ public static <X> void
checkForInjectedInitializerMethod(AbstractInjectionTargetBean<X> component,
AnnotatedMethod<X> annotatedMethod)
{
Method method = annotatedMethod.getJavaMember();
@@ -633,6 +300,4 @@ public final class WebBeansAnnotatedType
+ clazz.getName() + " can
not annotated with annotation @Disposes");
}
}
-
-
}
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=1429482&r1=1429481&r2=1429482&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
Sun Jan 6 09:09:46 2013
@@ -117,7 +117,9 @@ import org.apache.webbeans.component.Pro
import org.apache.webbeans.component.ResourceBean;
import org.apache.webbeans.component.WebBeansType;
import org.apache.webbeans.component.creation.AnnotatedTypeBeanCreatorImpl;
+import org.apache.webbeans.component.creation.ExtensionBeanCreatorImpl;
import org.apache.webbeans.component.creation.ManagedBeanCreatorImpl;
+import org.apache.webbeans.component.creation.NewManagedBeanCreatorImpl;
import org.apache.webbeans.config.DefinitionUtil;
import org.apache.webbeans.config.EJBWebBeansConfigurator;
import org.apache.webbeans.config.OWBLogConst;
@@ -598,13 +600,15 @@ public final class WebBeansUtil
if (webBeansContext.getWebBeansUtil().isManagedBean(clazz))
{
- comp = new NewManagedBean<T>(clazz, WebBeansType.MANAGED,
webBeansContext.getAnnotatedElementFactory().newAnnotatedType(clazz),
webBeansContext);
+ NewManagedBeanCreatorImpl<T> newBeanCreator
+ = new
NewManagedBeanCreatorImpl<T>(webBeansContext.getAnnotatedElementFactory().newAnnotatedType(clazz),
webBeansContext);
+ comp = newBeanCreator.getBean();
comp.setImplScopeType(new DependentScopeLiteral());
comp.setConstructor(defineConstructor(clazz));
definitionUtil.addConstructorInjectionPointMetaData(comp,
comp.getConstructor());
- webBeansContext.getAnnotatedTypeUtil().defineInjectedFields(comp,
comp.getAnnotatedType());
- webBeansContext.getAnnotatedTypeUtil().defineInjectedMethods(comp,
comp.getAnnotatedType());
+ newBeanCreator.defineInjectedFields();
+ newBeanCreator.defineInjectedMethods();
}
else if (EJBWebBeansConfigurator.isSessionBean(clazz, webBeansContext))
{
@@ -643,12 +647,9 @@ public final class WebBeansUtil
public <T> ExtensionBean<T> createExtensionComponent(Class<T> clazz)
{
Asserts.nullCheckForClass(clazz);
-
- ExtensionBean<T> comp = null;
- comp = new ExtensionBean<T>(clazz, webBeansContext);
- webBeansContext.getAnnotatedTypeUtil().defineObserverMethods(comp,
comp.getAnnotatedType());
-
- return comp;
+ ExtensionBeanCreatorImpl<T> extensionBeanCreator = new
ExtensionBeanCreatorImpl<T>(clazz, webBeansContext);
+ extensionBeanCreator.defineObserverMethods();
+ return extensionBeanCreator.getBean();
}
Modified:
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java?rev=1429482&r1=1429481&r2=1429482&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java
Sun Jan 6 09:09:46 2013
@@ -553,7 +553,7 @@ public abstract class TestContext implem
//Dropped from the speicification
//WebBeansUtil.checkSteroTypeRequirements(component,
clazz.getDeclaredAnnotations(), "Simple WebBean Component implementation class
: " + clazz.getName());
- Set<ProducerMethodBean<?>> producerMethods =
annotatedTypeUtil.defineProducerMethods(component,
component.getAnnotatedType());
+ Set<ProducerMethodBean<?>> producerMethods =
managedBeanCreator.defineProducerMethods();
for (ProducerMethodBean<?> producerMethod : producerMethods)
{
// add them one after the other to enable serialization handling
et al
@@ -561,7 +561,7 @@ public abstract class TestContext implem
producerMethod.setProducer(new
ProducerBeansProducer(producerMethod));
}
- Set<ProducerFieldBean<?>> producerFields =
annotatedTypeUtil.defineProducerFields(component, component.getAnnotatedType());
+ Set<ProducerFieldBean<?>> producerFields =
managedBeanCreator.defineProducerFields();
for (ProducerFieldBean<?> producerField : producerFields)
{
// add them one after the other to enable serialization handling
et al
@@ -570,9 +570,9 @@ public abstract class TestContext implem
}
managedBeanCreator.defineDisposalMethods();
- annotatedTypeUtil.defineInjectedFields(component,
component.getAnnotatedType());
- annotatedTypeUtil.defineInjectedMethods(component,
component.getAnnotatedType());
- annotatedTypeUtil.defineObserverMethods(component,
component.getAnnotatedType());
+ managedBeanCreator.defineInjectedFields();
+ managedBeanCreator.defineInjectedMethods();
+ managedBeanCreator.defineObserverMethods();
return component;
}