Author: pete.muir(a)jboss.org
Date: 2009-10-04 08:19:01 -0400 (Sun, 04 Oct 2009)
New Revision: 3838
Added:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ExtensionBeanDeployerEnvironment.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/AbstractBeanDiscoveryEvent.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/AbstractContainerEvent.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/AfterBeanDiscoveryImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/AfterDeploymentValidationImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/BeforeBeanDiscoveryImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/BeforeShutdownImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/ProcessAnnotatedTypeImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/ProcessObserverMethodImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/ProcessProducerImpl.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/Tabby.java
Removed:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDiscoveryEvent.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractContainerEvent.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AfterBeanDiscoveryImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AfterDeploymentValidationImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeforeBeanDiscoveryImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeforeShutdownImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ProcessAnnotatedTypeImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ProcessObserverMethodImpl.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/PreferredDogProducer.java
Modified:
ri/trunk/api/src/main/java/javax/enterprise/inject/spi/AnnotatedMember.java
ri/trunk/api/src/main/java/javax/enterprise/inject/spi/ProcessProducer.java
ri/trunk/api/src/main/java/javax/enterprise/inject/spi/ProcessProducerField.java
ri/trunk/api/src/main/java/javax/enterprise/inject/spi/ProcessProducerMethod.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractReceiverBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethod.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerField.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethod.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SessionBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/EEResourceProducerField.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextProducerField.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployment.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ExtensionBeanDeployer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/ejb/EjbDescriptors.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverFactory.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverMethodImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBClass.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBClass.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBClassImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/TypeSafeDisposerResolver.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/singleProducerMethod/BootstrapTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractJSR299Test.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/observer/ProcessObserverMethodEventTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/observer/ProcessObserverMethodObserver.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/Cat.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/DogProducer.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/ProducerProcessor.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/ProducerTest.java
Log:
Support for ProcessProducer and ProcessObserverMethod event
Modified: ri/trunk/api/src/main/java/javax/enterprise/inject/spi/AnnotatedMember.java
===================================================================
--- ri/trunk/api/src/main/java/javax/enterprise/inject/spi/AnnotatedMember.java 2009-10-04
12:02:24 UTC (rev 3837)
+++ ri/trunk/api/src/main/java/javax/enterprise/inject/spi/AnnotatedMember.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -27,7 +27,7 @@
*
* @author Pete Muir
*
- * @param <X> the type of the member
+ * @param <X> the type of the declaring type
*/
public interface AnnotatedMember<X> extends Annotated
{
Modified: ri/trunk/api/src/main/java/javax/enterprise/inject/spi/ProcessProducer.java
===================================================================
--- ri/trunk/api/src/main/java/javax/enterprise/inject/spi/ProcessProducer.java 2009-10-04
12:02:24 UTC (rev 3837)
+++ ri/trunk/api/src/main/java/javax/enterprise/inject/spi/ProcessProducer.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -17,13 +17,13 @@
package javax.enterprise.inject.spi;
-public interface ProcessProducer<X, T>
+public interface ProcessProducer<T, X>
{
- public AnnotatedMember<X> getAnnotatedMember();
+ public AnnotatedMember<T> getAnnotatedMember();
- public Producer<T> getProducer();
+ public Producer<X> getProducer();
- public void setProducer(Producer<T> producer);
+ public void setProducer(Producer<X> producer);
public void addDefinitionError(Throwable t);
}
Modified:
ri/trunk/api/src/main/java/javax/enterprise/inject/spi/ProcessProducerField.java
===================================================================
---
ri/trunk/api/src/main/java/javax/enterprise/inject/spi/ProcessProducerField.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
ri/trunk/api/src/main/java/javax/enterprise/inject/spi/ProcessProducerField.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -16,7 +16,7 @@
*/
package javax.enterprise.inject.spi;
-public interface ProcessProducerField<X, T> extends ProcessBean<T>
+public interface ProcessProducerField<T, X> extends ProcessBean<X>
{
- public AnnotatedField<X> getAnnotatedProducerField();
+ public AnnotatedField<T> getAnnotatedProducerField();
}
\ No newline at end of file
Modified:
ri/trunk/api/src/main/java/javax/enterprise/inject/spi/ProcessProducerMethod.java
===================================================================
---
ri/trunk/api/src/main/java/javax/enterprise/inject/spi/ProcessProducerMethod.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
ri/trunk/api/src/main/java/javax/enterprise/inject/spi/ProcessProducerMethod.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -16,9 +16,9 @@
*/
package javax.enterprise.inject.spi;
-public interface ProcessProducerMethod<X, T> extends ProcessBean<T>
+public interface ProcessProducerMethod<T, X> extends ProcessBean<X>
{
- public AnnotatedMethod<X> getAnnotatedProducerMethod();
+ public AnnotatedMethod<T> getAnnotatedProducerMethod();
- public AnnotatedParameter<X> getAnnotatedDisposedParameter();
+ public AnnotatedParameter<T> getAnnotatedDisposedParameter();
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java 2009-10-04
12:02:24 UTC (rev 3837)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -552,12 +552,17 @@
passivationCapableBeans.put(bean.getId(), bean);
decoratorResolver.clear();
}
+
+ public <T> Set<ObserverMethod<?, T>> resolveObserverMethods(T event,
Annotation... bindings)
+ {
+ checkEventObjectType(event);
+ return resolveObserverMethods(event.getClass(), bindings);
+ }
@SuppressWarnings("unchecked")
- public <T> Set<ObserverMethod<?, T>> resolveObserverMethods(T event,
Annotation... bindings)
+ private <T> Set<ObserverMethod<?, T>> resolveObserverMethods(Type
eventType, Annotation... bindings)
{
checkBindingTypes(Arrays.asList(bindings));
- Class<?> clazz = event.getClass();
// Manually hack in the default annotations here. We need to redo all the
annotation defaulting throughout. PLM
HashSet<Annotation> bindingAnnotations = new
HashSet<Annotation>(Arrays.asList(bindings));
@@ -566,9 +571,8 @@
bindingAnnotations.add(new DefaultLiteral());
}
bindingAnnotations.add(new AnyLiteral());
- checkEventType(clazz);
Set<ObserverMethod<?, T>> observers = new
HashSet<ObserverMethod<?, T>>();
- Set<ObserverMethod<?,?>> eventObservers =
observerResolver.resolve(ResolvableFactory.of(new
Reflections.HierarchyDiscovery(clazz).getFlattenedTypes(), bindingAnnotations, null));
+ Set<ObserverMethod<?,?>> eventObservers =
observerResolver.resolve(ResolvableFactory.of(new
Reflections.HierarchyDiscovery(eventType).getFlattenedTypes(), bindingAnnotations,
null));
for (ObserverMethod<?,?> observer : eventObservers)
{
observers.add((ObserverMethod<?, T>) observer);
@@ -593,11 +597,12 @@
}
- private void checkEventType(Type eventType)
+ private void checkEventObjectType(Object event)
{
+ Class<?> eventType = event.getClass();
Type[] types;
Type resolvedType = new
Reflections.HierarchyDiscovery(eventType).getResolvedType();
- if (resolvedType instanceof Class)
+ if (resolvedType instanceof Class<?>)
{
types = new Type[0];
}
@@ -824,10 +829,16 @@
* @see javax.enterprise.inject.spi.BeanManager#fireEvent(java.lang.Object,
* java.lang.annotation.Annotation[])
*/
- public void fireEvent(Object event, Annotation... bindings)
+ public void fireEvent(Object event, Annotation... qualifiers)
{
- notifyObservers(event, resolveObserverMethods(event, bindings));
+ fireEvent(event.getClass(), event, qualifiers);
}
+
+ public void fireEvent(Type eventType, Object event, Annotation... qualifiers)
+ {
+ checkEventObjectType(event);
+ notifyObservers(event, resolveObserverMethods(eventType, qualifiers));
+ }
private <T> void notifyObservers(final T event, final
Set<ObserverMethod<?, T>> observers)
{
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java 2009-10-04 12:02:24 UTC
(rev 3837)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java 2009-10-04 12:19:01 UTC
(rev 3838)
@@ -184,7 +184,7 @@
{
if (!ij.isTransient() && !Beans.isPassivationCapableBean(resolvedBean))
{
- if (resolvedBean.getScope().equals(Dependent.class) && resolvedBean
instanceof AbstractProducerBean<?,?>)
+ if (resolvedBean.getScope().equals(Dependent.class) && resolvedBean
instanceof AbstractProducerBean<?, ?,?>)
{
throw new IllegalProductException("The bean " + ij.getBean() +
" declares a passivating scope but the producer returned a non-serializable bean for
injection: " + resolvedBean);
}
@@ -308,10 +308,10 @@
private void validateDisposalMethods(BeanDeployerEnvironment environment)
{
- Set<DisposalMethod<?>> beans =
environment.getUnresolvedDisposalBeans();
+ Set<DisposalMethod<?, ?>> beans =
environment.getUnresolvedDisposalBeans();
if (!beans.isEmpty())
{
- throw new DefinitionException("The following Disposal methods where not
declared but not resolved to a producer method" + beans);
+ throw new DefinitionException("The following Disposal methods were declared
but did not resolved to a producer method " + beans);
}
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -56,7 +56,7 @@
* @param <T>
* @param <S>
*/
-public abstract class AbstractProducerBean<T, S extends Member> extends
AbstractReceiverBean<T, S> implements Producer<T>
+public abstract class AbstractProducerBean<X, T, S extends Member> extends
AbstractReceiverBean<X, T, S> implements Producer<T>
{
private static final LogProvider log =
Logging.getLogProvider(AbstractProducerBean.class);
@@ -65,13 +65,13 @@
* @param declaringBean The declaring bean
* @param manager The Web Beans manager
*/
- public AbstractProducerBean(String idSuffix, AbstractClassBean<?> declaringBean,
BeanManagerImpl manager)
+ public AbstractProducerBean(String idSuffix, AbstractClassBean<X> declaringBean,
BeanManagerImpl manager)
{
super(idSuffix, declaringBean, manager);
}
@Override
- protected abstract WBMember<T, ?, S> getAnnotatedItem();
+ public abstract WBMember<T, X, S> getAnnotatedItem();
@Override
// Overriden to provide the class of the bean that declares the producer method/field
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractReceiverBean.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractReceiverBean.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractReceiverBean.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -32,15 +32,15 @@
* @author pmuir
*
*/
-public abstract class AbstractReceiverBean<T, S extends Member> extends
AbstractBean<T, S>
+public abstract class AbstractReceiverBean<X, T, S extends Member> extends
AbstractBean<T, S>
{
private static final LogProvider log =
Logging.getLogProvider(AbstractReceiverBean.class);
- private AbstractClassBean<?> declaringBean;
+ private AbstractClassBean<X> declaringBean;
private boolean policy;
- public AbstractReceiverBean(String idSuffix, AbstractClassBean<?> declaringBean,
BeanManagerImpl manager)
+ public AbstractReceiverBean(String idSuffix, AbstractClassBean<X> declaringBean,
BeanManagerImpl manager)
{
super(idSuffix, manager);
this.declaringBean = declaringBean;
@@ -87,7 +87,7 @@
*
* @return The bean representation
*/
- public AbstractClassBean<?> getDeclaringBean()
+ public AbstractClassBean<X> getDeclaringBean()
{
return declaringBean;
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethod.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethod.java 2009-10-04
12:02:24 UTC (rev 3837)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethod.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -35,12 +35,12 @@
import org.jboss.webbeans.injection.MethodInjectionPoint;
import org.jboss.webbeans.introspector.WBMethod;
-public class DisposalMethod<T> extends AbstractReceiverBean<T, Method>
+public class DisposalMethod<X, T> extends AbstractReceiverBean<X, T, Method>
{
protected MethodInjectionPoint<T, ?> disposalMethodInjectionPoint;
- protected DisposalMethod(BeanManagerImpl manager, WBMethod<T, ?> disposalMethod,
AbstractClassBean<?> declaringBean)
+ protected DisposalMethod(BeanManagerImpl manager, WBMethod<T, X> disposalMethod,
AbstractClassBean<X> declaringBean)
{
super(new
StringBuilder().append(DisposalMethod.class.getSimpleName()).append(BEAN_ID_SEPARATOR).append(declaringBean.getAnnotatedItem().getName()).append(disposalMethod.getSignature().toString()).toString(),
declaringBean, manager);
this.disposalMethodInjectionPoint = MethodInjectionPoint.of(this, disposalMethod);
@@ -71,9 +71,9 @@
return disposalMethodInjectionPoint;
}
- public static <T> DisposalMethod<T> of(BeanManagerImpl manager,
WBMethod<T, ?> disposalMethod, AbstractClassBean<?> declaringBean)
+ public static <X, T> DisposalMethod<X, T> of(BeanManagerImpl manager,
WBMethod<T, X> disposalMethod, AbstractClassBean<X> declaringBean)
{
- return new DisposalMethod<T>(manager, disposalMethod, declaringBean);
+ return new DisposalMethod<X, T>(manager, disposalMethod, declaringBean);
}
@Override
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerField.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerField.java 2009-10-04
12:02:24 UTC (rev 3837)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerField.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -35,10 +35,10 @@
*
* @param <T>
*/
-public class ProducerField<T> extends AbstractProducerBean<T, Field>
+public class ProducerField<X, T> extends AbstractProducerBean<X, T, Field>
{
// The underlying field
- private WBField<T, ?> field;
+ private WBField<T, X> field;
private final String id;
/**
@@ -49,9 +49,9 @@
* @param manager the current manager
* @return A producer field
*/
- public static <T> ProducerField<T> of(WBField<T, ?> field,
AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
+ public static <X, T> ProducerField<X, T> of(WBField<T, X> field,
AbstractClassBean<X> declaringBean, BeanManagerImpl manager)
{
- return new ProducerField<T>(field, declaringBean, manager);
+ return new ProducerField<X, T>(field, declaringBean, manager);
}
/**
@@ -61,7 +61,7 @@
* @param declaringBean The declaring bean
* @param manager The Web Beans manager
*/
- protected ProducerField(WBField<T, ?> field, AbstractClassBean<?>
declaringBean, BeanManagerImpl manager)
+ protected ProducerField(WBField<T, X> field, AbstractClassBean<X>
declaringBean, BeanManagerImpl manager)
{
super(new
StringBuilder().append(ProducerField.class.getSimpleName()).append(BEAN_ID_SEPARATOR).append(declaringBean.getAnnotatedItem().getName()).append(field.getName()).toString(),
declaringBean, manager);
this.field = field;
@@ -104,7 +104,7 @@
* @return The annotated item
*/
@Override
- protected WBField<T, ?> getAnnotatedItem()
+ public WBField<T, X> getAnnotatedItem()
{
return field;
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethod.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethod.java 2009-10-04
12:02:24 UTC (rev 3837)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethod.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -43,14 +43,14 @@
*
* @param <T>
*/
-public class ProducerMethod<T> extends AbstractProducerBean<T, Method>
+public class ProducerMethod<X, T> extends AbstractProducerBean<X, T, Method>
{
// The underlying method
- private MethodInjectionPoint<T, ?> method;
+ private MethodInjectionPoint<T, X> method;
- private DisposalMethod<?> disposalMethodBean;
+ private DisposalMethod<X, ?> disposalMethodBean;
- private ProducerMethod<?> specializedBean;
+ private ProducerMethod<?, ?> specializedBean;
private final String id;
@@ -62,14 +62,14 @@
* @param manager the current manager
* @return A producer Web Bean
*/
- public static <T> ProducerMethod<T> of(WBMethod<T, ?> method,
AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
+ public static <X, T> ProducerMethod<X, T> of(WBMethod<T, X> method,
AbstractClassBean<X> declaringBean, BeanManagerImpl manager)
{
- return new ProducerMethod<T>(method, declaringBean, manager);
+ return new ProducerMethod<X, T>(method, declaringBean, manager);
}
- protected ProducerMethod(WBMethod<T, ?> method, AbstractClassBean<?>
declaringBean, BeanManagerImpl manager)
+ protected ProducerMethod(WBMethod<T, X> method, AbstractClassBean<X>
declaringBean, BeanManagerImpl manager)
{
- super(new
StringBuilder().append(ProducerMethod.class.getSimpleName()).append(BEAN_ID_SEPARATOR).append(declaringBean.getAnnotatedItem().getName()).append(method.getSignature().toString()).toString(),
declaringBean, manager);
+ super(new
StringBuilder().append(ProducerMethod.class.getSimpleName()).append(BEAN_ID_SEPARATOR).append(declaringBean.getAnnotatedItem().getName()).append(".").append(method.getSignature().toString()).toString(),
declaringBean, manager);
this.method = MethodInjectionPoint.of(this, method);
initType();
initTypes();
@@ -163,7 +163,7 @@
*/
protected void initDisposalMethod(BeanDeployerEnvironment environment)
{
- Set<DisposalMethod<?>> disposalBeans =
environment.resolveDisposalBeans(getTypes(), getQualifiers(), getDeclaringBean());
+ Set<DisposalMethod<X, ?>> disposalBeans =
environment.<X>resolveDisposalBeans(getTypes(), getQualifiers(),
getDeclaringBean());
if (disposalBeans.size() == 1)
{
@@ -205,7 +205,7 @@
* @return The annotated item
*/
@Override
- public WBMethod<T, ?> getAnnotatedItem()
+ public WBMethod<T, X> getAnnotatedItem()
{
return method;
}
@@ -226,7 +226,7 @@
*
* @return The method representation
*/
- public DisposalMethod<?> getDisposalMethod()
+ public DisposalMethod<X, ?> getDisposalMethod()
{
return disposalMethodBean;
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SessionBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SessionBean.java 2009-10-04
12:02:24 UTC (rev 3837)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SessionBean.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -348,7 +348,7 @@
*/
protected void checkObserverMethods()
{
- for (WBMethod<?, ?> method :
this.annotatedItem.getWBDeclaredMethodsWithAnnotatedParameters(Observes.class))
+ for (WBMethod<?, ?> method :
this.annotatedItem.getDeclaredWBMethodsWithAnnotatedParameters(Observes.class))
{
if (!method.isStatic())
{
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/EEResourceProducerField.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/EEResourceProducerField.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/EEResourceProducerField.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -29,7 +29,7 @@
* @author pmuir
*
*/
-public class EEResourceProducerField<T> extends ProducerField<T>
+public class EEResourceProducerField<X, T> extends ProducerField<X, T>
{
/**
@@ -40,12 +40,12 @@
* @param manager the current manager
* @return A producer field
*/
- public static <T> EEResourceProducerField<T> of(WBField<T, ?> field,
AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
+ public static <X, T> EEResourceProducerField<X, T> of(WBField<T, X>
field, AbstractClassBean<X> declaringBean, BeanManagerImpl manager)
{
- return new EEResourceProducerField<T>(field, declaringBean, manager);
+ return new EEResourceProducerField<X, T>(field, declaringBean, manager);
}
- protected EEResourceProducerField(WBField<T, ?> field,
AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
+ protected EEResourceProducerField(WBField<T, X> field,
AbstractClassBean<X> declaringBean, BeanManagerImpl manager)
{
super(field, declaringBean, manager);
}
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextProducerField.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextProducerField.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ee/PersistenceContextProducerField.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -26,7 +26,7 @@
* @author pmuir
*
*/
-public class PersistenceContextProducerField<T extends EntityManager> extends
EEResourceProducerField<T>
+public class PersistenceContextProducerField<X, T extends EntityManager> extends
EEResourceProducerField<X, T>
{
/**
@@ -37,9 +37,9 @@
* @param manager the current manager
* @return A producer field
*/
- public static <T extends EntityManager> EEResourceProducerField<T>
of(WBField<T, ?> field, AbstractClassBean<?> declaringBean, BeanManagerImpl
manager)
+ public static <X, T extends EntityManager> EEResourceProducerField<X, T>
of(WBField<T, X> field, AbstractClassBean<X> declaringBean, BeanManagerImpl
manager)
{
- return new PersistenceContextProducerField<T>(field, declaringBean,
manager);
+ return new PersistenceContextProducerField<X, T>(field, declaringBean,
manager);
}
/**
@@ -47,11 +47,12 @@
* @param declaringBean
* @param manager
*/
- protected PersistenceContextProducerField(WBField<T, ?> field,
AbstractClassBean<?> declaringBean, BeanManagerImpl manager)
+ protected PersistenceContextProducerField(WBField<T, X> field,
AbstractClassBean<X> declaringBean, BeanManagerImpl manager)
{
super(field, declaringBean, manager);
}
+ @Override
public void dispose(T instance)
{
instance.close();
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -16,20 +16,21 @@
*/
package org.jboss.webbeans.bootstrap;
-import java.util.ArrayList;
-import java.util.List;
+import java.lang.reflect.Member;
+import java.lang.reflect.Type;
import java.util.Set;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Produces;
-import javax.enterprise.inject.spi.AnnotatedMethod;
-import javax.enterprise.inject.spi.ObserverMethod;
import javax.enterprise.inject.spi.ProcessObserverMethod;
+import javax.enterprise.inject.spi.ProcessProducer;
import javax.inject.Inject;
import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.DefinitionException;
import org.jboss.webbeans.bean.AbstractClassBean;
+import org.jboss.webbeans.bean.AbstractProducerBean;
import org.jboss.webbeans.bean.DecoratorImpl;
import org.jboss.webbeans.bean.DisposalMethod;
import org.jboss.webbeans.bean.ManagedBean;
@@ -41,6 +42,8 @@
import org.jboss.webbeans.bean.SessionBean;
import org.jboss.webbeans.bean.ee.EEResourceProducerField;
import org.jboss.webbeans.bean.ee.PersistenceContextProducerField;
+import org.jboss.webbeans.bootstrap.events.ProcessObserverMethodImpl;
+import org.jboss.webbeans.bootstrap.events.ProcessProducerImpl;
import org.jboss.webbeans.ejb.EJBApiAbstraction;
import org.jboss.webbeans.ejb.InternalEjbDescriptor;
import org.jboss.webbeans.event.ObserverFactory;
@@ -54,18 +57,18 @@
import org.jboss.webbeans.persistence.PersistenceApiAbstraction;
import org.jboss.webbeans.servlet.ServletApiAbstraction;
import org.jboss.webbeans.util.Reflections;
+import org.jboss.webbeans.util.reflection.ParameterizedTypeImpl;
import org.jboss.webbeans.ws.WSApiAbstraction;
-public class AbstractBeanDeployer
+public class AbstractBeanDeployer<E extends BeanDeployerEnvironment>
{
private static final LogProvider log =
Logging.getLogProvider(AbstractBeanDeployer.class);
private final BeanManagerImpl manager;
- private final BeanDeployerEnvironment environment;
- private final List<Throwable> definitionErrors = new
ArrayList<Throwable>();
+ private final E environment;
- public AbstractBeanDeployer(BeanManagerImpl manager, BeanDeployerEnvironment
environment)
+ public AbstractBeanDeployer(BeanManagerImpl manager, E environment)
{
this.manager = manager;
this.environment = environment;
@@ -76,9 +79,9 @@
return manager;
}
- public AbstractBeanDeployer deploy()
+ public AbstractBeanDeployer<E> deploy()
{
- Set<RIBean<?>> beans = getEnvironment().getBeans();
+ Set<? extends RIBean<?>> beans = getEnvironment().getBeans();
// ensure that all decorators are initialized before initializing
// the rest of the beans
for (DecoratorImpl<?> bean : getEnvironment().getDecorators())
@@ -90,6 +93,11 @@
for (RIBean<?> bean : beans)
{
bean.initialize(getEnvironment());
+ if (bean instanceof AbstractProducerBean<?, ?, ?>)
+ {
+ AbstractProducerBean<?, ?, Member> producer =
(AbstractProducerBean<?, ?, Member>) bean;
+ createAndFireProcessProducerEvent(producer);
+ }
manager.addBean(bean);
log.debug("Bean: " + bean);
}
@@ -97,6 +105,7 @@
{
log.debug("Observer : " + observer);
observer.initialize();
+ createAndFireProcessObserverMethodEvent(observer);
manager.addObserver(observer);
}
@@ -122,33 +131,33 @@
}
- protected void createProducerMethods(AbstractClassBean<?> declaringBean,
WBClass<?> annotatedClass)
+ protected <X> void createProducerMethods(AbstractClassBean<X>
declaringBean, WBClass<X> annotatedClass)
{
- for (WBMethod<?, ?> method :
annotatedClass.getDeclaredAnnotatedWBMethods(Produces.class))
+ for (WBMethod<?, X> method :
annotatedClass.getDeclaredAnnotatedWBMethods(Produces.class))
{
createProducerMethod(declaringBean, method);
}
}
- protected void createDisposalMethods(AbstractClassBean<?> declaringBean,
WBClass<?> annotatedClass)
+ protected <X> void createDisposalMethods(AbstractClassBean<X>
declaringBean, WBClass<X> annotatedClass)
{
- for (WBMethod<?, ?> method :
annotatedClass.getWBDeclaredMethodsWithAnnotatedParameters(Disposes.class))
+ for (WBMethod<?, X> method :
annotatedClass.getDeclaredWBMethodsWithAnnotatedParameters(Disposes.class))
{
- DisposalMethod<?> disposalBean = DisposalMethod.of(manager, method,
declaringBean);
+ DisposalMethod<X, ?> disposalBean = DisposalMethod.of(manager, method,
declaringBean);
disposalBean.initialize(getEnvironment());
getEnvironment().addBean(disposalBean);
}
}
- protected <T> void createProducerMethod(AbstractClassBean<?>
declaringBean, WBMethod<T, ?> annotatedMethod)
+ protected <X, T> void createProducerMethod(AbstractClassBean<X>
declaringBean, WBMethod<T, X> annotatedMethod)
{
- ProducerMethod<T> bean = ProducerMethod.of(annotatedMethod, declaringBean,
manager);
+ ProducerMethod<X, T> bean = ProducerMethod.of(annotatedMethod, declaringBean,
manager);
getEnvironment().addBean(bean);
}
- protected <T> void createProducerField(AbstractClassBean<?> declaringBean,
WBField<T, ?> field)
+ protected <X, T> void createProducerField(AbstractClassBean<X>
declaringBean, WBField<T, X> field)
{
- ProducerField<T> bean;
+ ProducerField<X, T> bean;
if (isPersistenceContextProducerField(field))
{
bean = PersistenceContextProducerField.of(field, declaringBean, manager);
@@ -164,17 +173,34 @@
getEnvironment().addBean(bean);
}
- protected void createProducerFields(AbstractClassBean<?> declaringBean,
WBClass<?> annotatedClass)
+ private <X, T> void createAndFireProcessProducerEvent(AbstractProducerBean<X,
T, Member> producer)
{
- for (WBField<?, ?> field :
annotatedClass.getDeclaredAnnotatedWBFields(Produces.class))
+ ProcessProducerImpl<X, T> payload = new ProcessProducerImpl<X,
T>(producer.getAnnotatedItem(), producer) {};
+ fireEvent(payload, ProcessProducer.class,
producer.getAnnotatedItem().getDeclaringType().getBaseType(),
producer.getAnnotatedItem().getBaseType());
+ if (!payload.getDefinitionErrors().isEmpty())
{
+ // FIXME communicate all the captured definition errors in this exception
+ throw new DefinitionException(payload.getDefinitionErrors().get(0));
+ }
+ }
+
+ private void fireEvent(Object payload, Type rawType, Type... actualTypeArguments)
+ {
+ Type eventType = new ParameterizedTypeImpl(rawType, actualTypeArguments, null);
+ manager.fireEvent(eventType, payload);
+ }
+
+ protected <X> void createProducerFields(AbstractClassBean<X>
declaringBean, WBClass<X> annotatedClass)
+ {
+ for (WBField<?, X> field :
annotatedClass.getDeclaredAnnotatedWBFields(Produces.class))
+ {
createProducerField(declaringBean, field);
}
}
protected <X> void createObserverMethods(RIBean<X> declaringBean,
WBClass<X> annotatedClass)
{
- for (WBMethod<?, X> method :
annotatedClass.getWBDeclaredMethodsWithAnnotatedParameters(Observes.class))
+ for (WBMethod<?, X> method :
annotatedClass.getDeclaredWBMethodsWithAnnotatedParameters(Observes.class))
{
createObserverMethod(declaringBean, method);
}
@@ -183,14 +209,19 @@
protected <X, T> void createObserverMethod(RIBean<X> declaringBean,
WBMethod<T, X> method)
{
ObserverMethodImpl<X, T> observer = ObserverFactory.create(method,
declaringBean, manager);
- ProcessObserverMethod<?, ?> event =
createProcessObserverMethodEvent(observer, method);
- manager.fireEvent(event);
getEnvironment().addObserver(observer);
}
- private <X, T> ProcessObserverMethod<X, T>
createProcessObserverMethodEvent(ObserverMethod<X, T> observer,
AnnotatedMethod<X> method)
+ private <X, T> void
createAndFireProcessObserverMethodEvent(ObserverMethodImpl<X, T> observer)
{
- return new ProcessObserverMethodImpl<X, T>(method, observer,
definitionErrors) {};
+ ProcessObserverMethodImpl<X, T> payload = new ProcessObserverMethodImpl<X,
T>(observer.getMethod(), observer) {};
+ fireEvent(payload, ProcessObserverMethod.class,
observer.getMethod().getDeclaringType().getBaseType(), observer.getObservedType());
+ if (!payload.getDefinitionErrors().isEmpty())
+ {
+ // FIXME communicate all the captured definition errors in this exception
+ throw new DefinitionException(payload.getDefinitionErrors().get(0));
+ }
+ return;
}
protected <T> void createSimpleBean(WBClass<T> annotatedClass)
@@ -260,7 +291,7 @@
return type.getNoArgsWBConstructor() != null ||
type.getAnnotatedWBConstructors(Inject.class).size() > 0;
}
- public BeanDeployerEnvironment getEnvironment()
+ public E getEnvironment()
{
return environment;
}
Deleted:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDiscoveryEvent.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDiscoveryEvent.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDiscoveryEvent.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -1,95 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed 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.jboss.webbeans.bootstrap;
-
-import java.util.Map;
-
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
-import org.jboss.webbeans.bootstrap.spi.Deployment;
-import org.jboss.webbeans.metadata.TypeStore;
-
-/**
- * @author pmuir
- */
-public abstract class AbstractBeanDiscoveryEvent extends AbstractContainerEvent
-{
-
- private final Map<BeanDeploymentArchive, BeanDeployment> beanDeployments;
- private final BeanManagerImpl deploymentManager;
- private final Deployment deployment;
-
- public AbstractBeanDiscoveryEvent(Map<BeanDeploymentArchive, BeanDeployment>
beanDeployments, BeanManagerImpl deploymentManager, Deployment deployment)
- {
- this.beanDeployments = beanDeployments;
- this.deploymentManager = deploymentManager;
- this.deployment = deployment;
- }
-
- /**
- * @return the beanDeployments
- */
- protected Map<BeanDeploymentArchive, BeanDeployment> getBeanDeployments()
- {
- return beanDeployments;
- }
-
- /**
- * @return the deployment
- */
- protected Deployment getDeployment()
- {
- return deployment;
- }
-
- /**
- * @return the deploymentManager
- */
- protected BeanManagerImpl getDeploymentManager()
- {
- return deploymentManager;
- }
-
- protected TypeStore getTypeStore()
- {
- return getDeployment().getServices().get(TypeStore.class);
- }
-
-
- protected BeanDeployment getOrCreateBeanDeployment(Class<?> clazz)
- {
- BeanDeploymentArchive beanDeploymentArchive =
getDeployment().loadBeanDeploymentArchive(clazz);
- if (beanDeploymentArchive == null)
- {
- throw new IllegalStateException("Unable to find Bean Deployment Archive for
" + clazz);
- }
- else
- {
- if (getBeanDeployments().containsKey(beanDeploymentArchive))
- {
- return getBeanDeployments().get(beanDeploymentArchive);
- }
- else
- {
- BeanDeployment beanDeployment = new BeanDeployment(beanDeploymentArchive,
getDeploymentManager(), deployment.getServices());
- getBeanDeployments().put(beanDeploymentArchive, beanDeployment);
- return beanDeployment;
- }
- }
- }
-
-}
\ No newline at end of file
Deleted:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractContainerEvent.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractContainerEvent.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractContainerEvent.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed 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.jboss.webbeans.bootstrap;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author pmuir
- *
- */
-public class AbstractContainerEvent
-{
-
- private final List<Throwable> errors;
-
- public AbstractContainerEvent()
- {
- this.errors = new ArrayList<Throwable>();
- }
-
- /**
- * @return the errors
- */
- protected List<Throwable> getErrors()
- {
- return errors;
- }
-
-}
Deleted:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AfterBeanDiscoveryImpl.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AfterBeanDiscoveryImpl.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AfterBeanDiscoveryImpl.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -1,65 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed 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.jboss.webbeans.bootstrap;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import javax.enterprise.context.spi.Context;
-import javax.enterprise.inject.spi.AfterBeanDiscovery;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.ObserverMethod;
-
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
-import org.jboss.webbeans.bootstrap.spi.Deployment;
-
-public class AfterBeanDiscoveryImpl extends AbstractBeanDiscoveryEvent implements
AfterBeanDiscovery
-{
-
- public AfterBeanDiscoveryImpl(BeanManagerImpl deploymentManager, Deployment
deployment, Map<BeanDeploymentArchive, BeanDeployment> beanDeployments)
- {
- super(beanDeployments, deploymentManager, deployment);
- }
-
- public void addDefinitionError(Throwable t)
- {
- getErrors().add(t);
- }
-
- public List<Throwable> getDefinitionErrors()
- {
- return Collections.unmodifiableList(getErrors());
- }
-
- public void addBean(Bean<?> bean)
- {
- getOrCreateBeanDeployment(bean.getBeanClass()).getBeanManager().addBean(bean);
- }
-
- public void addContext(Context context)
- {
- getDeploymentManager().addContext(context);
- }
-
- public void addObserverMethod(ObserverMethod<?, ?> observerMethod)
- {
-
getOrCreateBeanDeployment(observerMethod.getBean().getBeanClass()).getBeanManager().addObserver(observerMethod);
- }
-
-}
Deleted:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AfterDeploymentValidationImpl.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AfterDeploymentValidationImpl.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AfterDeploymentValidationImpl.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed 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.jboss.webbeans.bootstrap;
-
-import java.util.Collections;
-import java.util.List;
-
-import javax.enterprise.inject.spi.AfterDeploymentValidation;
-
-public class AfterDeploymentValidationImpl extends AbstractContainerEvent implements
AfterDeploymentValidation
-{
-
- public void addDeploymentProblem(Throwable t)
- {
- getErrors().add(t);
- }
-
- public List<Throwable> getDeploymentProblems()
- {
- return Collections.unmodifiableList(getErrors());
- }
-}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java 2009-10-04
12:02:24 UTC (rev 3837)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -25,6 +25,7 @@
import org.jboss.webbeans.BeanManagerImpl;
import org.jboss.webbeans.Container;
+import org.jboss.webbeans.bootstrap.events.ProcessAnnotatedTypeImpl;
import org.jboss.webbeans.ejb.EjbDescriptors;
import org.jboss.webbeans.ejb.InternalEjbDescriptor;
import org.jboss.webbeans.introspector.WBClass;
@@ -34,7 +35,7 @@
* @author pmuir
*
*/
-public class BeanDeployer extends AbstractBeanDeployer
+public class BeanDeployer extends AbstractBeanDeployer<BeanDeployerEnvironment>
{
private final BeanManagerImpl deploymentManager;
@@ -52,7 +53,7 @@
this.deploymentManager = deploymentManager;
}
- public AbstractBeanDeployer addClass(Class<?> clazz)
+ public BeanDeployer addClass(Class<?> clazz)
{
ClassTransformer classTransformer =
Container.instance().deploymentServices().get(ClassTransformer.class);
if (!clazz.isAnnotation() && !clazz.isEnum())
@@ -81,14 +82,14 @@
}
// TODO Do we need to fire PAT for annotated types added via BBD? Probably not PLM.
- public AbstractBeanDeployer addClass(AnnotatedType<?> clazz)
+ public BeanDeployer addClass(AnnotatedType<?> clazz)
{
ClassTransformer classTransformer =
Container.instance().deploymentServices().get(ClassTransformer.class);
classes.add(classTransformer.loadClass(clazz));
return this;
}
- public AbstractBeanDeployer addClasses(Iterable<Class<?>> classes)
+ public BeanDeployer addClasses(Iterable<Class<?>> classes)
{
for (Class<?> clazz : classes)
{
@@ -97,7 +98,7 @@
return this;
}
- public AbstractBeanDeployer createBeans()
+ public BeanDeployer createBeans()
{
for (WBClass<?> clazz : classes)
{
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -47,11 +47,11 @@
{
private final Map<WBClass<?>, AbstractClassBean<?>> classBeanMap;
- private final Map<WBMethod<?, ?>, ProducerMethod<?>>
producerMethodBeanMap;
+ private final Map<WBMethod<?, ?>, ProducerMethod<?, ?>>
producerMethodBeanMap;
private final Set<RIBean<?>> beans;
private final Set<ObserverMethodImpl<?, ?>> observers;
- private final List<DisposalMethod<?>> allDisposalBeans;
- private final Set<DisposalMethod<?>> resolvedDisposalBeans;
+ private final List<DisposalMethod<?, ?>> allDisposalBeans;
+ private final Set<DisposalMethod<?, ?>> resolvedDisposalBeans;
private final Set<DecoratorImpl<?>> decorators;
private final EjbDescriptors ejbDescriptors;
private final TypeSafeDisposerResolver disposalMethodResolver;
@@ -59,9 +59,9 @@
public BeanDeployerEnvironment(EjbDescriptors ejbDescriptors, BeanManagerImpl
manager)
{
this.classBeanMap = new HashMap<WBClass<?>,
AbstractClassBean<?>>();
- this.producerMethodBeanMap = new HashMap<WBMethod<?, ?>,
ProducerMethod<?>>();
- this.allDisposalBeans = new ArrayList<DisposalMethod<?>>();
- this.resolvedDisposalBeans = new HashSet<DisposalMethod<?>>();
+ this.producerMethodBeanMap = new HashMap<WBMethod<?, ?>,
ProducerMethod<?, ?>>();
+ this.allDisposalBeans = new ArrayList<DisposalMethod<?, ?>>();
+ this.resolvedDisposalBeans = new HashSet<DisposalMethod<?, ?>>();
this.beans = new HashSet<RIBean<?>>();
this.decorators = new HashSet<DecoratorImpl<?>>();
this.observers = new HashSet<ObserverMethodImpl<?, ?>>();
@@ -69,7 +69,7 @@
this.disposalMethodResolver = new TypeSafeDisposerResolver(manager,
allDisposalBeans);
}
- public ProducerMethod<?> getProducerMethod(WBMethod<?, ?> method)
+ public <X, T> ProducerMethod<X, T> getProducerMethod(WBMethod<X, T>
method)
{
if (!producerMethodBeanMap.containsKey(method))
{
@@ -77,9 +77,9 @@
}
else
{
- ProducerMethod<?> bean = producerMethodBeanMap.get(method);
+ ProducerMethod<?, ?> bean = producerMethodBeanMap.get(method);
bean.initialize(this);
- return bean;
+ return (ProducerMethod<X, T>) bean;
}
}
@@ -97,13 +97,13 @@
}
}
- public void addBean(ProducerMethod<?> bean)
+ public void addBean(ProducerMethod<?, ?> bean)
{
producerMethodBeanMap.put(bean.getAnnotatedItem(), bean);
beans.add(bean);
}
- public void addBean(ProducerField<?> bean)
+ public void addBean(ProducerField<?, ?> bean)
{
beans.add(bean);
}
@@ -132,7 +132,7 @@
decorators.add(bean);
}
- public void addBean(DisposalMethod<?> bean)
+ public void addBean(DisposalMethod<?, ?> bean)
{
allDisposalBeans.add(bean);
}
@@ -142,7 +142,7 @@
this.observers.add(observer);
}
- public Set<RIBean<?>> getBeans()
+ public Set<? extends RIBean<?>> getBeans()
{
return Collections.unmodifiableSet(beans);
}
@@ -158,9 +158,9 @@
}
- public Set<DisposalMethod<?>> getUnresolvedDisposalBeans()
+ public Set<DisposalMethod<?, ?>> getUnresolvedDisposalBeans()
{
- Set<DisposalMethod<?>> beans = new
HashSet<DisposalMethod<?>>(allDisposalBeans);
+ Set<DisposalMethod<?, ?>> beans = new HashSet<DisposalMethod<?,
?>>(allDisposalBeans);
beans.removeAll(resolvedDisposalBeans);
return Collections.unmodifiableSet(beans);
}
@@ -179,9 +179,9 @@
* @param bindings The binding types to match
* @return The set of matching disposal methods
*/
- public Set<DisposalMethod<?>> resolveDisposalBeans(Set<Type> types,
Set<Annotation> bindings, AbstractClassBean<?> declaringBean)
+ public <X> Set<DisposalMethod<X, ?>>
resolveDisposalBeans(Set<Type> types, Set<Annotation> bindings,
AbstractClassBean<X> declaringBean)
{
- Set<DisposalMethod<?>> beans =
disposalMethodResolver.resolve(ResolvableFactory.of(types, bindings, declaringBean));
+ Set<DisposalMethod<X, ?>> beans = (Set)
disposalMethodResolver.resolve(ResolvableFactory.of(types, bindings, declaringBean));
resolvedDisposalBeans.addAll(beans);
return Collections.unmodifiableSet(beans);
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployment.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployment.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployment.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -19,6 +19,7 @@
import org.jboss.webbeans.BeanManagerImpl;
import org.jboss.webbeans.bean.builtin.DefaultValidatorBean;
import org.jboss.webbeans.bean.builtin.DefaultValidatorFactoryBean;
+import org.jboss.webbeans.bean.builtin.ExtensionBean;
import org.jboss.webbeans.bean.builtin.InjectionPointBean;
import org.jboss.webbeans.bean.builtin.ManagerBean;
import org.jboss.webbeans.bean.builtin.PrincipalBean;
@@ -30,12 +31,14 @@
import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
import org.jboss.webbeans.bootstrap.api.helpers.SimpleServiceRegistry;
import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.webbeans.bootstrap.spi.Deployment;
import org.jboss.webbeans.conversation.ConversationImpl;
import org.jboss.webbeans.conversation.JavaSEConversationTerminator;
import org.jboss.webbeans.conversation.NumericConversationIdGenerator;
import org.jboss.webbeans.conversation.ServletConversationManager;
import org.jboss.webbeans.ejb.EjbDescriptors;
import org.jboss.webbeans.ejb.spi.EjbServices;
+import org.jboss.webbeans.event.ObserverMethodImpl;
import org.jboss.webbeans.log.Log;
import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.resources.spi.ResourceLoader;
@@ -56,10 +59,14 @@
private final BeanDeploymentArchive beanDeploymentArchive;
private final BeanManagerImpl beanManager;
+ private final ExtensionBeanDeployerEnvironment extensionBeanDeployerEnvironment;
private final BeanDeployer beanDeployer;
+ private final Deployment deployment;
- public BeanDeployment(BeanDeploymentArchive beanDeploymentArchive, BeanManagerImpl
deploymentManager, ServiceRegistry deploymentServices)
+ public BeanDeployment(BeanDeploymentArchive beanDeploymentArchive, BeanManagerImpl
deploymentManager, Deployment deployment, ExtensionBeanDeployerEnvironment
extensionBeanDeployerEnvironment, ServiceRegistry deploymentServices)
{
+ this.extensionBeanDeployerEnvironment = extensionBeanDeployerEnvironment;
+ this.deployment = deployment;
this.beanDeploymentArchive = beanDeploymentArchive;
EjbDescriptors ejbDescriptors = new EjbDescriptors();
beanDeploymentArchive.getServices().add(EjbDescriptors.class, ejbDescriptors);
@@ -149,6 +156,20 @@
beanDeployer.getEnvironment().addBean(new DefaultValidatorBean(beanManager));
beanDeployer.getEnvironment().addBean(new
DefaultValidatorFactoryBean(beanManager));
}
+ for (ExtensionBean bean : extensionBeanDeployerEnvironment.getBeans())
+ {
+ if
(deployment.loadBeanDeploymentArchive(bean.getBeanClass()).equals(beanDeploymentArchive))
+ {
+ beanDeployer.getManager().addBean(bean);
+ }
+ }
+ for (ObserverMethodImpl<?, ?> observerMethod :
extensionBeanDeployerEnvironment.getObservers())
+ {
+ if
(deployment.loadBeanDeploymentArchive(observerMethod.getBean().getBeanClass()).equals(beanDeploymentArchive))
+ {
+ beanDeployer.getManager().addObserver(observerMethod);
+ }
+ }
beanDeployer.createBeans().deploy();
}
Deleted:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeforeBeanDiscoveryImpl.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeforeBeanDiscoveryImpl.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeforeBeanDiscoveryImpl.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -1,77 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed 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.jboss.webbeans.bootstrap;
-
-import java.lang.annotation.Annotation;
-import java.util.Map;
-
-import javax.enterprise.inject.spi.AnnotatedType;
-import javax.enterprise.inject.spi.BeforeBeanDiscovery;
-
-import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
-import org.jboss.webbeans.bootstrap.spi.Deployment;
-import org.jboss.webbeans.literal.BindingTypeLiteral;
-import org.jboss.webbeans.literal.InterceptorBindingTypeLiteral;
-import org.jboss.webbeans.literal.NormalScopeLiteral;
-import org.jboss.webbeans.literal.ScopeLiteral;
-
-public class BeforeBeanDiscoveryImpl extends AbstractBeanDiscoveryEvent implements
BeforeBeanDiscovery
-{
-
- public BeforeBeanDiscoveryImpl(BeanManagerImpl deploymentManager, Deployment
deployment, Map<BeanDeploymentArchive, BeanDeployment> beanDeployments)
- {
- super(beanDeployments, deploymentManager, deployment);
- }
-
- public void addQualifier(Class<? extends Annotation> bindingType)
- {
- getTypeStore().add(bindingType, new BindingTypeLiteral());
- }
-
- public void addInterceptorBindingType(Class<? extends Annotation> bindingType)
- {
- getTypeStore().add(bindingType, new InterceptorBindingTypeLiteral());
- }
-
- public void addScope(Class<? extends Annotation> scopeType,
- boolean normal, boolean passivating)
- {
- if (normal)
- {
- getTypeStore().add(scopeType, new NormalScopeLiteral(passivating));
- }
- else
- {
- getTypeStore().add(scopeType, new ScopeLiteral());
- }
- }
-
- public void addStereotype(Class<? extends Annotation> stereotype,
- Annotation... stereotypeDef)
- {
- throw new UnsupportedOperationException();
- }
-
- public void addAnnotatedType(AnnotatedType<?> type)
- {
- getOrCreateBeanDeployment(type.getJavaClass()).getBeanDeployer().addClass(type);
- }
-
-
-
-}
Deleted: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeforeShutdownImpl.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeforeShutdownImpl.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeforeShutdownImpl.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -1,28 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed 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.jboss.webbeans.bootstrap;
-
-import javax.enterprise.inject.spi.BeforeShutdown;
-
-/**
- * @author pmuir
- *
- */
-public class BeforeShutdownImpl implements BeforeShutdown
-{
-
-}
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ExtensionBeanDeployer.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ExtensionBeanDeployer.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ExtensionBeanDeployer.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -24,7 +24,6 @@
import org.jboss.webbeans.BeanManagerImpl;
import org.jboss.webbeans.Container;
import org.jboss.webbeans.bean.builtin.ExtensionBean;
-import org.jboss.webbeans.ejb.EjbDescriptors;
import org.jboss.webbeans.introspector.WBClass;
import org.jboss.webbeans.resources.ClassTransformer;
@@ -32,18 +31,19 @@
* @author pmuir
*
*/
-public class ExtensionBeanDeployer extends AbstractBeanDeployer
+public class ExtensionBeanDeployer extends
AbstractBeanDeployer<ExtensionBeanDeployerEnvironment>
{
-
+
+
private final Set<Extension> extensions;
- public ExtensionBeanDeployer(BeanManagerImpl manager)
+ public ExtensionBeanDeployer(BeanManagerImpl manager, ExtensionBeanDeployerEnvironment
environment)
{
- super(manager, new BeanDeployerEnvironment(new EjbDescriptors(), manager));
+ super(manager, environment);
this.extensions = new HashSet<Extension>();
}
- public AbstractBeanDeployer createBeans()
+ public ExtensionBeanDeployer createBeans()
{
ClassTransformer classTransformer =
Container.instance().deploymentServices().get(ClassTransformer.class);
for (Extension extension : extensions)
@@ -52,6 +52,7 @@
WBClass<Extension> clazz = (WBClass<Extension>)
classTransformer.loadClass(extension.getClass());
ExtensionBean bean = new ExtensionBean(getManager(), clazz, extension);
+ this.
getEnvironment().addBean(bean);
createObserverMethods(bean, clazz);
}
Added:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ExtensionBeanDeployerEnvironment.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ExtensionBeanDeployerEnvironment.java
(rev 0)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ExtensionBeanDeployerEnvironment.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -0,0 +1,34 @@
+package org.jboss.webbeans.bootstrap;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.bean.builtin.ExtensionBean;
+import org.jboss.webbeans.ejb.EjbDescriptors;
+
+public class ExtensionBeanDeployerEnvironment extends BeanDeployerEnvironment
+{
+
+ private final Set<ExtensionBean> extensionBeans;
+
+
+ public ExtensionBeanDeployerEnvironment(EjbDescriptors ejbDescriptors, BeanManagerImpl
manager)
+ {
+ super(ejbDescriptors, manager);
+ this.extensionBeans = new HashSet<ExtensionBean>();
+ }
+
+ @Override
+ public Set<ExtensionBean> getBeans()
+ {
+ return extensionBeans;
+ }
+
+ @Override
+ public void addBean(ExtensionBean bean)
+ {
+ extensionBeans.add(bean);
+ }
+
+}
Property changes on:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ExtensionBeanDeployerEnvironment.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ProcessAnnotatedTypeImpl.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ProcessAnnotatedTypeImpl.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ProcessAnnotatedTypeImpl.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -1,65 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed 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.jboss.webbeans.bootstrap;
-
-import javax.enterprise.inject.spi.AnnotatedType;
-import javax.enterprise.inject.spi.ProcessAnnotatedType;
-
-/**
- * Container lifecycle event for each Java class or interface discovered by
- * the container.
- *
- * @author pmuir
- * @author David Allen
- *
- */
-public class ProcessAnnotatedTypeImpl<X> implements ProcessAnnotatedType<X>
-{
-
- private AnnotatedType<X> annotatedType;
- private boolean veto;
-
- public ProcessAnnotatedTypeImpl(AnnotatedType<X> annotatedType)
- {
- this.annotatedType = annotatedType;
- }
-
- public AnnotatedType<X> getAnnotatedType()
- {
- return annotatedType;
- }
-
- public void setAnnotatedType(AnnotatedType<X> type)
- {
- if (type == null)
- {
- throw new IllegalArgumentException("Cannot set the type to null (if you
want to stop the type being used, call veto()) " + this);
- }
- this.annotatedType = type;
- }
-
- public void veto()
- {
- this.veto = true;
- }
-
- public boolean isVeto()
- {
- return veto;
- }
-
-}
Deleted:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ProcessObserverMethodImpl.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ProcessObserverMethodImpl.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ProcessObserverMethodImpl.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -1,61 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed 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.jboss.webbeans.bootstrap;
-
-import java.util.List;
-
-import javax.enterprise.inject.spi.AnnotatedMethod;
-import javax.enterprise.inject.spi.ObserverMethod;
-import javax.enterprise.inject.spi.ProcessObserverMethod;
-
-/**
- * Implementation of the event used to notify observers for each observer
- * method that is added.
- *
- * @author David Allen
- *
- */
-public class ProcessObserverMethodImpl<X, T> implements ProcessObserverMethod<X,
T>
-{
- private final AnnotatedMethod<X> beanMethod;
- private final ObserverMethod<X, T> observerMethod;
- private final List<Throwable> definitionErrors;
-
- public ProcessObserverMethodImpl(AnnotatedMethod<X> beanMethod,
ObserverMethod<X, T> observerMethod, List<Throwable> definitionErrors)
- {
- this.beanMethod = beanMethod;
- this.observerMethod = observerMethod;
- this.definitionErrors = definitionErrors;
- }
-
- public void addDefinitionError(Throwable t)
- {
- this.definitionErrors.add(t);
- }
-
- public AnnotatedMethod<X> getAnnotatedMethod()
- {
- return beanMethod;
- }
-
- public ObserverMethod<X, T> getObserverMethod()
- {
- return observerMethod;
- }
-
-}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -40,6 +40,10 @@
import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
import org.jboss.webbeans.bootstrap.api.helpers.ServiceRegistries;
import org.jboss.webbeans.bootstrap.api.helpers.SimpleServiceRegistry;
+import org.jboss.webbeans.bootstrap.events.AfterBeanDiscoveryImpl;
+import org.jboss.webbeans.bootstrap.events.AfterDeploymentValidationImpl;
+import org.jboss.webbeans.bootstrap.events.BeforeBeanDiscoveryImpl;
+import org.jboss.webbeans.bootstrap.events.BeforeShutdownImpl;
import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
import org.jboss.webbeans.bootstrap.spi.Deployment;
import org.jboss.webbeans.context.AbstractApplicationContext;
@@ -52,6 +56,7 @@
import org.jboss.webbeans.context.SingletonContext;
import org.jboss.webbeans.context.api.BeanStore;
import org.jboss.webbeans.ejb.EJBApiAbstraction;
+import org.jboss.webbeans.ejb.EjbDescriptors;
import org.jboss.webbeans.jsf.JsfApiAbstraction;
import org.jboss.webbeans.log.Log;
import org.jboss.webbeans.log.Logging;
@@ -89,12 +94,14 @@
private final BeanManagerImpl deploymentManager;
private final Environment environment;
private final Deployment deployment;
+ private final ExtensionBeanDeployerEnvironment extensionBeanDeployerEnvironment;
- public DeploymentVisitor(BeanManagerImpl deploymentManager, Environment
environment, Deployment deployment)
+ public DeploymentVisitor(BeanManagerImpl deploymentManager, Environment
environment, Deployment deployment, ExtensionBeanDeployerEnvironment
extensionBeanDeployerEnvironment)
{
this.deploymentManager = deploymentManager;
this.environment = environment;
this.deployment = deployment;
+ this.extensionBeanDeployerEnvironment = extensionBeanDeployerEnvironment;
}
public Map<BeanDeploymentArchive, BeanDeployment> visit()
@@ -114,7 +121,7 @@
verifyServices(beanDeploymentArchive.getServices(),
environment.getRequiredBeanDeploymentArchiveServices());
// Create the BeanDeployment and attach
- BeanDeployment parent = new BeanDeployment(beanDeploymentArchive,
deploymentManager, deployment.getServices());
+ BeanDeployment parent = new BeanDeployment(beanDeploymentArchive,
deploymentManager, deployment, extensionBeanDeployerEnvironment,
deployment.getServices());
managerAwareBeanDeploymentArchives.put(beanDeploymentArchive, parent);
seenBeanDeploymentArchives.add(beanDeploymentArchive);
for (BeanDeploymentArchive archive :
beanDeploymentArchive.getBeanDeploymentArchives())
@@ -144,7 +151,8 @@
private Map<BeanDeploymentArchive, BeanDeployment> beanDeployments;
private Environment environment;
private Deployment deployment;
-
+ private ExtensionBeanDeployerEnvironment extensionBeanDeployerEnvironment;
+
public Bootstrap startContainer(Environment environment, Deployment deployment,
BeanStore applicationBeanStore)
{
synchronized (this)
@@ -202,7 +210,9 @@
// Start the application context
Container.instance().deploymentServices().get(ContextLifecycle.class).beginApplication(applicationBeanStore);
- DeploymentVisitor deploymentVisitor = new DeploymentVisitor(deploymentManager,
environment, deployment);
+ this.extensionBeanDeployerEnvironment = new
ExtensionBeanDeployerEnvironment(EjbDescriptors.EMPTY, deploymentManager);
+
+ DeploymentVisitor deploymentVisitor = new DeploymentVisitor(deploymentManager,
environment, deployment, extensionBeanDeployerEnvironment);
beanDeployments = deploymentVisitor.visit();
return this;
@@ -248,7 +258,7 @@
throw new IllegalStateException("Manager has not been
initialized");
}
- ExtensionBeanDeployer extensionBeanDeployer = new
ExtensionBeanDeployer(deploymentManager);
+ ExtensionBeanDeployer extensionBeanDeployer = new
ExtensionBeanDeployer(deploymentManager, extensionBeanDeployerEnvironment);
extensionBeanDeployer.addExtensions(ServiceLoader.load(Extension.class));
extensionBeanDeployer.createBeans().deploy();
@@ -300,7 +310,7 @@
private void fireBeforeBeanDiscoveryEvent()
{
- BeforeBeanDiscovery event = new BeforeBeanDiscoveryImpl(deploymentManager,
deployment, beanDeployments);
+ BeforeBeanDiscovery event = new BeforeBeanDiscoveryImpl(deploymentManager,
deployment, beanDeployments, extensionBeanDeployerEnvironment);
try
{
deploymentManager.fireEvent(event);
@@ -326,7 +336,7 @@
private void fireAfterBeanDiscoveryEvent()
{
- AfterBeanDiscoveryImpl event = new AfterBeanDiscoveryImpl(deploymentManager,
deployment, beanDeployments);
+ AfterBeanDiscoveryImpl event = new AfterBeanDiscoveryImpl(deploymentManager,
deployment, beanDeployments, extensionBeanDeployerEnvironment);
try
{
deploymentManager.fireEvent(event);
Copied:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/AbstractBeanDiscoveryEvent.java
(from rev 3828,
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDiscoveryEvent.java)
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/AbstractBeanDiscoveryEvent.java
(rev 0)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/AbstractBeanDiscoveryEvent.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.webbeans.bootstrap.events;
+
+import java.util.Map;
+
+import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.bootstrap.BeanDeployment;
+import org.jboss.webbeans.bootstrap.ExtensionBeanDeployerEnvironment;
+import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.webbeans.bootstrap.spi.Deployment;
+import org.jboss.webbeans.metadata.TypeStore;
+
+/**
+ * @author pmuir
+ */
+public abstract class AbstractBeanDiscoveryEvent extends AbstractContainerEvent
+{
+
+ private final Map<BeanDeploymentArchive, BeanDeployment> beanDeployments;
+ private final BeanManagerImpl deploymentManager;
+ private final Deployment deployment;
+ private final ExtensionBeanDeployerEnvironment extensionBeanDeployerEnvironment;
+
+ public AbstractBeanDiscoveryEvent(Map<BeanDeploymentArchive, BeanDeployment>
beanDeployments, BeanManagerImpl deploymentManager, Deployment deployment,
ExtensionBeanDeployerEnvironment extensionBeanDeployerEnvironment)
+ {
+ this.beanDeployments = beanDeployments;
+ this.deploymentManager = deploymentManager;
+ this.deployment = deployment;
+ this.extensionBeanDeployerEnvironment = extensionBeanDeployerEnvironment;
+ }
+
+ /**
+ * @return the beanDeployments
+ */
+ protected Map<BeanDeploymentArchive, BeanDeployment> getBeanDeployments()
+ {
+ return beanDeployments;
+ }
+
+ /**
+ * @return the deployment
+ */
+ protected Deployment getDeployment()
+ {
+ return deployment;
+ }
+
+ /**
+ * @return the deploymentManager
+ */
+ protected BeanManagerImpl getDeploymentManager()
+ {
+ return deploymentManager;
+ }
+
+ protected TypeStore getTypeStore()
+ {
+ return getDeployment().getServices().get(TypeStore.class);
+ }
+
+
+ protected BeanDeployment getOrCreateBeanDeployment(Class<?> clazz)
+ {
+ BeanDeploymentArchive beanDeploymentArchive =
getDeployment().loadBeanDeploymentArchive(clazz);
+ if (beanDeploymentArchive == null)
+ {
+ throw new IllegalStateException("Unable to find Bean Deployment Archive for
" + clazz);
+ }
+ else
+ {
+ if (getBeanDeployments().containsKey(beanDeploymentArchive))
+ {
+ return getBeanDeployments().get(beanDeploymentArchive);
+ }
+ else
+ {
+ BeanDeployment beanDeployment = new BeanDeployment(beanDeploymentArchive,
getDeploymentManager(), deployment, extensionBeanDeployerEnvironment,
deployment.getServices());
+ getBeanDeployments().put(beanDeploymentArchive, beanDeployment);
+ return beanDeployment;
+ }
+ }
+ }
+
+}
\ No newline at end of file
Property changes on:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/AbstractBeanDiscoveryEvent.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/AbstractContainerEvent.java
(from rev 3828,
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractContainerEvent.java)
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/AbstractContainerEvent.java
(rev 0)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/AbstractContainerEvent.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.webbeans.bootstrap.events;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author pmuir
+ *
+ */
+public class AbstractContainerEvent
+{
+
+ private final List<Throwable> errors;
+
+ public AbstractContainerEvent()
+ {
+ this.errors = new ArrayList<Throwable>();
+ }
+
+ /**
+ * @return the errors
+ */
+ protected List<Throwable> getErrors()
+ {
+ return errors;
+ }
+
+}
Property changes on:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/AbstractContainerEvent.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/AfterBeanDiscoveryImpl.java
(from rev 3828,
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AfterBeanDiscoveryImpl.java)
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/AfterBeanDiscoveryImpl.java
(rev 0)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/AfterBeanDiscoveryImpl.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.webbeans.bootstrap.events;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.ObserverMethod;
+
+import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.bootstrap.BeanDeployment;
+import org.jboss.webbeans.bootstrap.ExtensionBeanDeployerEnvironment;
+import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.webbeans.bootstrap.spi.Deployment;
+
+public class AfterBeanDiscoveryImpl extends AbstractBeanDiscoveryEvent implements
AfterBeanDiscovery
+{
+
+ public AfterBeanDiscoveryImpl(BeanManagerImpl deploymentManager, Deployment
deployment, Map<BeanDeploymentArchive, BeanDeployment> beanDeployments,
ExtensionBeanDeployerEnvironment extensionDeployerEnvironment)
+ {
+ super(beanDeployments, deploymentManager, deployment,
extensionDeployerEnvironment);
+ }
+
+ public void addDefinitionError(Throwable t)
+ {
+ getErrors().add(t);
+ }
+
+ public List<Throwable> getDefinitionErrors()
+ {
+ return Collections.unmodifiableList(getErrors());
+ }
+
+ public void addBean(Bean<?> bean)
+ {
+ getOrCreateBeanDeployment(bean.getBeanClass()).getBeanManager().addBean(bean);
+ }
+
+ public void addContext(Context context)
+ {
+ getDeploymentManager().addContext(context);
+ }
+
+ public void addObserverMethod(ObserverMethod<?, ?> observerMethod)
+ {
+
getOrCreateBeanDeployment(observerMethod.getBean().getBeanClass()).getBeanManager().addObserver(observerMethod);
+ }
+
+}
Copied:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/AfterDeploymentValidationImpl.java
(from rev 3828,
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AfterDeploymentValidationImpl.java)
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/AfterDeploymentValidationImpl.java
(rev 0)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/AfterDeploymentValidationImpl.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.webbeans.bootstrap.events;
+
+import java.util.Collections;
+import java.util.List;
+
+import javax.enterprise.inject.spi.AfterDeploymentValidation;
+
+
+public class AfterDeploymentValidationImpl extends AbstractContainerEvent implements
AfterDeploymentValidation
+{
+
+ public void addDeploymentProblem(Throwable t)
+ {
+ getErrors().add(t);
+ }
+
+ public List<Throwable> getDeploymentProblems()
+ {
+ return Collections.unmodifiableList(getErrors());
+ }
+}
Copied:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/BeforeBeanDiscoveryImpl.java
(from rev 3828,
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeforeBeanDiscoveryImpl.java)
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/BeforeBeanDiscoveryImpl.java
(rev 0)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/BeforeBeanDiscoveryImpl.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.webbeans.bootstrap.events;
+
+import java.lang.annotation.Annotation;
+import java.util.Map;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+
+import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.bootstrap.BeanDeployment;
+import org.jboss.webbeans.bootstrap.ExtensionBeanDeployerEnvironment;
+import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.webbeans.bootstrap.spi.Deployment;
+import org.jboss.webbeans.literal.BindingTypeLiteral;
+import org.jboss.webbeans.literal.InterceptorBindingTypeLiteral;
+import org.jboss.webbeans.literal.NormalScopeLiteral;
+import org.jboss.webbeans.literal.ScopeLiteral;
+
+public class BeforeBeanDiscoveryImpl extends AbstractBeanDiscoveryEvent implements
BeforeBeanDiscovery
+{
+
+ public BeforeBeanDiscoveryImpl(BeanManagerImpl deploymentManager, Deployment
deployment, Map<BeanDeploymentArchive, BeanDeployment> beanDeployments,
ExtensionBeanDeployerEnvironment extensionBeanDeployerEnvironment)
+ {
+ super(beanDeployments, deploymentManager, deployment,
extensionBeanDeployerEnvironment);
+ }
+
+ public void addQualifier(Class<? extends Annotation> bindingType)
+ {
+ getTypeStore().add(bindingType, new BindingTypeLiteral());
+ }
+
+ public void addInterceptorBindingType(Class<? extends Annotation> bindingType)
+ {
+ getTypeStore().add(bindingType, new InterceptorBindingTypeLiteral());
+ }
+
+ public void addScope(Class<? extends Annotation> scopeType,
+ boolean normal, boolean passivating)
+ {
+ if (normal)
+ {
+ getTypeStore().add(scopeType, new NormalScopeLiteral(passivating));
+ }
+ else
+ {
+ getTypeStore().add(scopeType, new ScopeLiteral());
+ }
+ }
+
+ public void addStereotype(Class<? extends Annotation> stereotype,
+ Annotation... stereotypeDef)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void addAnnotatedType(AnnotatedType<?> type)
+ {
+ getOrCreateBeanDeployment(type.getJavaClass()).getBeanDeployer().addClass(type);
+ }
+
+
+
+}
Copied:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/BeforeShutdownImpl.java
(from rev 3828,
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeforeShutdownImpl.java)
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/BeforeShutdownImpl.java
(rev 0)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/BeforeShutdownImpl.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.webbeans.bootstrap.events;
+
+import javax.enterprise.inject.spi.BeforeShutdown;
+
+/**
+ * @author pmuir
+ *
+ */
+public class BeforeShutdownImpl implements BeforeShutdown
+{
+
+}
Property changes on:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/BeforeShutdownImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/ProcessAnnotatedTypeImpl.java
(from rev 3828,
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ProcessAnnotatedTypeImpl.java)
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/ProcessAnnotatedTypeImpl.java
(rev 0)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/ProcessAnnotatedTypeImpl.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.webbeans.bootstrap.events;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+
+/**
+ * Container lifecycle event for each Java class or interface discovered by
+ * the container.
+ *
+ * @author pmuir
+ * @author David Allen
+ *
+ */
+public class ProcessAnnotatedTypeImpl<X> implements ProcessAnnotatedType<X>
+{
+
+ private AnnotatedType<X> annotatedType;
+ private boolean veto;
+
+ public ProcessAnnotatedTypeImpl(AnnotatedType<X> annotatedType)
+ {
+ this.annotatedType = annotatedType;
+ }
+
+ public AnnotatedType<X> getAnnotatedType()
+ {
+ return annotatedType;
+ }
+
+ public void setAnnotatedType(AnnotatedType<X> type)
+ {
+ if (type == null)
+ {
+ throw new IllegalArgumentException("Cannot set the type to null (if you
want to stop the type being used, call veto()) " + this);
+ }
+ this.annotatedType = type;
+ }
+
+ public void veto()
+ {
+ this.veto = true;
+ }
+
+ public boolean isVeto()
+ {
+ return veto;
+ }
+
+}
Property changes on:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/ProcessAnnotatedTypeImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/ProcessObserverMethodImpl.java
(from rev 3828,
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/ProcessObserverMethodImpl.java)
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/ProcessObserverMethodImpl.java
(rev 0)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/ProcessObserverMethodImpl.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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.jboss.webbeans.bootstrap.events;
+
+import java.util.Collections;
+import java.util.List;
+
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.ObserverMethod;
+import javax.enterprise.inject.spi.ProcessObserverMethod;
+
+/**
+ * Implementation of the event used to notify observers for each observer
+ * method that is added.
+ *
+ * @author David Allen
+ *
+ */
+public class ProcessObserverMethodImpl<X, T> extends AbstractContainerEvent
implements ProcessObserverMethod<X, T>
+{
+ private final AnnotatedMethod<X> beanMethod;
+ private final ObserverMethod<X, T> observerMethod;
+
+ public ProcessObserverMethodImpl(AnnotatedMethod<X> beanMethod,
ObserverMethod<X, T> observerMethod)
+ {
+ this.beanMethod = beanMethod;
+ this.observerMethod = observerMethod;
+ }
+
+ public void addDefinitionError(Throwable t)
+ {
+ getErrors().add(t);
+ }
+
+ public AnnotatedMethod<X> getAnnotatedMethod()
+ {
+ return beanMethod;
+ }
+
+ public ObserverMethod<X, T> getObserverMethod()
+ {
+ return observerMethod;
+ }
+
+ public List<Throwable> getDefinitionErrors()
+ {
+ return Collections.unmodifiableList(getErrors());
+ }
+
+}
Property changes on:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/ProcessObserverMethodImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/ProcessProducerImpl.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/ProcessProducerImpl.java
(rev 0)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/ProcessProducerImpl.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -0,0 +1,47 @@
+package org.jboss.webbeans.bootstrap.events;
+
+import java.util.List;
+
+import javax.enterprise.inject.spi.AnnotatedMember;
+import javax.enterprise.inject.spi.ProcessProducer;
+import javax.enterprise.inject.spi.Producer;
+
+
+public class ProcessProducerImpl<X, T> extends AbstractContainerEvent implements
ProcessProducer<X, T>
+{
+
+ private final AnnotatedMember<X> annotatedMember;
+ private Producer<T> producer;
+
+ public ProcessProducerImpl(AnnotatedMember<X> annotatedMember, Producer<T>
producer)
+ {
+ this.producer = producer;
+ this.annotatedMember = annotatedMember;
+ }
+
+ public void addDefinitionError(Throwable t)
+ {
+ getErrors().add(t);
+ }
+
+ public List<Throwable> getDefinitionErrors()
+ {
+ return super.getErrors();
+ }
+
+ public AnnotatedMember<X> getAnnotatedMember()
+ {
+ return annotatedMember;
+ }
+
+ public Producer<T> getProducer()
+ {
+ return producer;
+ }
+
+ public void setProducer(Producer<T> producer)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+}
Property changes on:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/events/ProcessProducerImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/ejb/EjbDescriptors.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/ejb/EjbDescriptors.java 2009-10-04
12:02:24 UTC (rev 3837)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/ejb/EjbDescriptors.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -37,6 +37,35 @@
private final Map<String, InternalEjbDescriptor<?>> ejbs;
private final Collection<Class<?>> ejbClasses;
+
+ public static final EjbDescriptors EMPTY = new EjbDescriptors()
+ {
+ @Override
+ public <T> void add(EjbDescriptor<T> ejbDescriptor)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void addAll(Iterable<EjbDescriptor<?>> ejbDescriptors)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void cleanup()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void clear()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+
+ };
/**
* Constructor
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventImpl.java 2009-10-04
12:02:24 UTC (rev 3837)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventImpl.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -42,7 +42,7 @@
private static final long serialVersionUID = 656782657242515455L;
- public static <E> Event<E> of(Type eventType, BeanManagerImpl manager,
Set<Annotation> bindings)
+ public static <E> EventImpl<E> of(Type eventType, BeanManagerImpl manager,
Set<Annotation> bindings)
{
return new EventImpl<E>(eventType, manager, bindings);
}
@@ -90,7 +90,7 @@
return selectEvent(subtype.getType(), bindings);
}
- private <U extends T> Event<U> selectEvent(Type subtype, Annotation[]
bindings)
+ public <U extends T> Event<U> selectEvent(Type subtype, Annotation[]
bindings)
{
return new EventImpl<U>(
subtype,
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverFactory.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverFactory.java 2009-10-04
12:02:24 UTC (rev 3837)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverFactory.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -41,7 +41,7 @@
* @param manager The Web Beans manager
* @return An observer implementation built from the method abstraction
*/
- public static <X, T> ObserverMethodImpl<X, T> create(WBMethod<?, ?>
method, RIBean<?> declaringBean, BeanManagerImpl manager)
+ public static <X, T> ObserverMethodImpl<X, T> create(WBMethod<T, X>
method, RIBean<X> declaringBean, BeanManagerImpl manager)
{
ObserverMethodImpl<X, T> result = null;
TransactionPhase transactionPhase = getTransactionalPhase(method);
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -63,8 +63,8 @@
private final Type eventType;
protected BeanManagerImpl manager;
private final Notify notifyType;
- protected final RIBean<?> declaringBean;
- protected final MethodInjectionPoint<?, ?> observerMethod;
+ protected final RIBean<X> declaringBean;
+ protected final MethodInjectionPoint<T, X> observerMethod;
protected TransactionPhase transactionPhase;
/**
@@ -75,7 +75,7 @@
* @param declaringBean The observer bean
* @param manager The Web Beans manager
*/
- protected ObserverMethodImpl(final WBMethod<?, ?> observer, final
RIBean<?> declaringBean, final BeanManagerImpl manager)
+ protected ObserverMethodImpl(final WBMethod<T, X> observer, final
RIBean<X> declaringBean, final BeanManagerImpl manager)
{
this.manager = manager;
this.declaringBean = declaringBean;
@@ -146,7 +146,7 @@
@SuppressWarnings("unchecked")
public Bean<X> getBean()
{
- return (Bean<X>) declaringBean;
+ return declaringBean;
}
public Annotation[] getBindingsAsArray()
@@ -154,11 +154,6 @@
return bindings.toArray(new Annotation[0]);
}
- public Type getEventType()
- {
- return eventType;
- }
-
public Notify getNotify()
{
return notifyType;
@@ -182,7 +177,7 @@
/**
* @return the observerMethod
*/
- public MethodInjectionPoint<?, ?> getMethod()
+ public MethodInjectionPoint<T, X> getMethod()
{
return observerMethod;
}
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverMethodImpl.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverMethodImpl.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverMethodImpl.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -38,7 +38,7 @@
* @param observerBean The bean declaring the observer method
* @param manager The JCDI manager in use
*/
- protected TransactionalObserverMethodImpl(WBMethod<?, ?> observer,
RIBean<?> observerBean, TransactionPhase transactionPhase, BeanManagerImpl manager)
+ protected TransactionalObserverMethodImpl(WBMethod<T, X> observer,
RIBean<X> observerBean, TransactionPhase transactionPhase, BeanManagerImpl manager)
{
super(observer, observerBean, manager);
this.transactionPhase = transactionPhase;
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBClass.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBClass.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBClass.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -23,6 +23,7 @@
public abstract class ForwardingWBClass<T> extends ForwardingWBAnnotated<T,
Class<T>> implements WBClass<T>
{
+ @Override
protected abstract WBClass<T> delegate();
public Set<WBConstructor<T>> getAnnotatedWBConstructors(Class<? extends
Annotation> annotationType)
@@ -55,19 +56,19 @@
return delegate().getWBMethods();
}
- public Set<WBField<?, ?>> getDeclaredAnnotatedWBFields(Class<? extends
Annotation> annotationType)
+ public Set<WBField<?, T>> getDeclaredAnnotatedWBFields(Class<? extends
Annotation> annotationType)
{
return delegate().getDeclaredAnnotatedWBFields(annotationType);
}
- public Set<WBMethod<?, ?>> getDeclaredAnnotatedWBMethods(Class<?
extends Annotation> annotationType)
+ public Set<WBMethod<?, T>> getDeclaredAnnotatedWBMethods(Class<?
extends Annotation> annotationType)
{
return delegate().getDeclaredAnnotatedWBMethods(annotationType);
}
- public Set<WBMethod<?, T>>
getWBDeclaredMethodsWithAnnotatedParameters(Class<? extends Annotation>
annotationType)
+ public Set<WBMethod<?, T>>
getDeclaredWBMethodsWithAnnotatedParameters(Class<? extends Annotation>
annotationType)
{
- return delegate().getWBDeclaredMethodsWithAnnotatedParameters(annotationType);
+ return delegate().getDeclaredWBMethodsWithAnnotatedParameters(annotationType);
}
public Set<WBField<?, ?>> getWBFields()
@@ -111,6 +112,7 @@
return delegate().isNonStaticMemberClass();
}
+ @Override
public boolean isParameterizedType()
{
return delegate().isParameterizedType();
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBClass.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBClass.java 2009-10-04
12:02:24 UTC (rev 3837)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBClass.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -80,7 +80,7 @@
* @return A set of abstracted fields with the given annotation. Returns an
* empty set if there are no matches
*/
- public Set<WBField<?, ?>> getDeclaredAnnotatedWBFields(Class<? extends
Annotation> annotationType);
+ public Set<WBField<?, T>> getDeclaredAnnotatedWBFields(Class<? extends
Annotation> annotationType);
/**
* Gets all fields which are meta-annotated with metaAnnotationType
@@ -138,7 +138,7 @@
* @return A set of abstracted methods with the given annotation. Returns an
* empty set if there are no matches
*/
- public Set<WBMethod<?, ?>> getDeclaredAnnotatedWBMethods(Class<?
extends Annotation> annotationType);
+ public Set<WBMethod<?, T>> getDeclaredAnnotatedWBMethods(Class<?
extends Annotation> annotationType);
/**
* Find the annotated method for a given methodDescriptor
@@ -197,7 +197,7 @@
* @return A set of abstracted methods with the given annotation. Returns an
* empty set if there are no matches
*/
- public Set<WBMethod<?, T>>
getWBDeclaredMethodsWithAnnotatedParameters(Class<? extends Annotation>
annotationType);
+ public Set<WBMethod<?, T>>
getDeclaredWBMethodsWithAnnotatedParameters(Class<? extends Annotation>
annotationType);
/**
* Gets the superclass.
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBClassImpl.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBClassImpl.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBClassImpl.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -88,7 +88,7 @@
private final Set<WBField<?, ?>> declaredFields;
private final Map<String, WBField<?, ?>> declaredFieldsByName;
// The map from annotation type to abstracted field with annotation
- private final SetMultimap<Class<? extends Annotation>, WBField<?,
?>> declaredAnnotatedFields;
+ private final SetMultimap<Class<? extends Annotation>, WBField<?,
T>> declaredAnnotatedFields;
// The map from annotation type to abstracted field with meta-annotation
private final SetMultimap<Class<? extends Annotation>, WBField<?,
?>> declaredMetaAnnotatedFields;
@@ -104,7 +104,7 @@
// The set of abstracted methods
private final Set<WBMethod<?, ?>> declaredMethods;
// The map from annotation type to abstracted method with annotation
- private final SetMultimap<Class<? extends Annotation>, WBMethod<?,
?>> declaredAnnotatedMethods;
+ private final SetMultimap<Class<? extends Annotation>, WBMethod<?,
T>> declaredAnnotatedMethods;
// The map from annotation type to method with a parameter with annotation
private final SetMultimap<Class<? extends Annotation>, WBMethod<?,
T>> declaredMethodsByAnnotatedParameters;
@@ -176,12 +176,12 @@
});
this.declaredFields = new HashSet<WBField<?, ?>>();
this.declaredFieldsByName = new HashMap<String, WBField<?, ?>>();
- this.declaredAnnotatedFields = Multimaps.newSetMultimap(new HashMap<Class<?
extends Annotation>, Collection<WBField<?, ?>>>(), new Supplier<
Set<WBField<?, ?>>>()
+ this.declaredAnnotatedFields = Multimaps.newSetMultimap(new HashMap<Class<?
extends Annotation>, Collection<WBField<?, T>>>(), new Supplier<
Set<WBField<?, T>>>()
{
- public Set<WBField<?, ?>> get()
+ public Set<WBField<?, T>> get()
{
- return new HashSet<WBField<?, ?>>();
+ return new HashSet<WBField<?, T>>();
}
});
@@ -216,14 +216,14 @@
{
field.setAccessible(true);
}
- WBField<?, ?> annotatedField = null;
+ WBField<?, T> annotatedField = null;
if (annotatedTypeFields.containsKey(field))
{
annotatedField = WBFieldImpl.of(annotatedTypeFields.get(field),
this.<T>getDeclaringWBClass(field, classTransformer), classTransformer);
}
else
{
- annotatedField = WBFieldImpl.of(field, getDeclaringWBClass(field,
classTransformer), classTransformer);
+ annotatedField = WBFieldImpl.of(field,
this.<T>getDeclaringWBClass(field, classTransformer), classTransformer);
}
this.fields.add(annotatedField);
@@ -345,12 +345,12 @@
});
this.declaredMethods = new HashSet<WBMethod<?, ?>>();
- this.declaredAnnotatedMethods = Multimaps.newSetMultimap(new HashMap<Class<?
extends Annotation>, Collection<WBMethod<?, ?>>>(), new Supplier<
Set<WBMethod<?, ?>>>()
+ this.declaredAnnotatedMethods = Multimaps.newSetMultimap(new HashMap<Class<?
extends Annotation>, Collection<WBMethod<?, T>>>(), new Supplier<
Set<WBMethod<?, T>>>()
{
- public Set<WBMethod<?, ?>> get()
+ public Set<WBMethod<?, T>> get()
{
- return new HashSet<WBMethod<?, ?>>();
+ return new HashSet<WBMethod<?, T>>();
}
});
@@ -479,7 +479,7 @@
return (WBField<F, ?>) declaredFieldsByName.get(fieldName);
}
- public Set<WBField<?, ?>> getDeclaredAnnotatedWBFields(Class<? extends
Annotation> annotationType)
+ public Set<WBField<?, T>> getDeclaredAnnotatedWBFields(Class<? extends
Annotation> annotationType)
{
return Collections.unmodifiableSet(declaredAnnotatedFields.get(annotationType));
}
@@ -563,7 +563,7 @@
return Collections.unmodifiableSet(annotatedMethods.get(annotationType));
}
- public Set<WBMethod<?, ?>> getDeclaredAnnotatedWBMethods(Class<?
extends Annotation> annotationType)
+ public Set<WBMethod<?, T>> getDeclaredAnnotatedWBMethods(Class<?
extends Annotation> annotationType)
{
return Collections.unmodifiableSet(declaredAnnotatedMethods.get(annotationType));
}
@@ -598,7 +598,7 @@
return
Collections.unmodifiableSet(constructorsByAnnotatedParameters.get(annotationType));
}
- public Set<WBMethod<?, T>>
getWBDeclaredMethodsWithAnnotatedParameters(Class<? extends Annotation>
annotationType)
+ public Set<WBMethod<?, T>>
getDeclaredWBMethodsWithAnnotatedParameters(Class<? extends Annotation>
annotationType)
{
return
Collections.unmodifiableSet(declaredMethodsByAnnotatedParameters.get(annotationType));
}
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/TypeSafeDisposerResolver.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/TypeSafeDisposerResolver.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/TypeSafeDisposerResolver.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -28,19 +28,19 @@
* @author pmuir
*
*/
-public class TypeSafeDisposerResolver extends
TypeSafeResolver<DisposalMethod<?>>
+public class TypeSafeDisposerResolver extends TypeSafeResolver<DisposalMethod<?,
?>>
{
private final BeanManagerImpl manager;
- public TypeSafeDisposerResolver(BeanManagerImpl manager,
Iterable<DisposalMethod<?>> disposers)
+ public TypeSafeDisposerResolver(BeanManagerImpl manager,
Iterable<DisposalMethod<?, ?>> disposers)
{
super(disposers);
this.manager = manager;
}
@Override
- protected boolean matches(Resolvable resolvable, DisposalMethod<?> disposer)
+ protected boolean matches(Resolvable resolvable, DisposalMethod<?, ?> disposer)
{
return resolvable.getDeclaringBean().equals(disposer.getDeclaringBean())
&& Reflections.isAssignableFrom(disposer.getType(), resolvable.getTypeClosure())
&& Beans.containsAllBindings(disposer.getQualifiers(), resolvable.getQualifiers(),
manager);
}
@@ -54,7 +54,7 @@
}
@Override
- protected Set<DisposalMethod<?>>
filterResult(Set<DisposalMethod<?>> matched)
+ protected Set<DisposalMethod<?, ?>>
filterResult(Set<DisposalMethod<?, ?>> matched)
{
return matched;
}
@@ -66,7 +66,7 @@
}
@Override
- protected Set<DisposalMethod<?>>
sortResult(Set<DisposalMethod<?>> matched)
+ protected Set<DisposalMethod<?, ?>> sortResult(Set<DisposalMethod<?,
?>> matched)
{
return matched;
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java 2009-10-04 12:02:24 UTC
(rev 3837)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java 2009-10-04 12:19:01 UTC
(rev 3838)
@@ -112,9 +112,9 @@
{
return ((SessionBean<?>) bean).getEjbDescriptor().isStateful();
}
- else if (bean instanceof AbstractProducerBean<?, ?>)
+ else if (bean instanceof AbstractProducerBean<?, ?, ?>)
{
- return Reflections.isSerializable(((AbstractProducerBean<?, ?>)
bean).getType());
+ return Reflections.isSerializable(((AbstractProducerBean<?, ?, ?>)
bean).getType());
}
else
{
@@ -150,11 +150,17 @@
injectableFieldsList.add(0, fields);
for (WBField<?, ?> annotatedField :
t.getDeclaredAnnotatedWBFields(Inject.class))
{
- addFieldInjectionPoint(annotatedField, fields, declaringBean);
+ if (!annotatedField.isStatic())
+ {
+ addFieldInjectionPoint(annotatedField, fields, declaringBean);
+ }
}
for (WBField<?, ?> annotatedField :
t.getAnnotatedWBFields(Decorates.class))
{
- addFieldInjectionPoint(annotatedField, fields, declaringBean);
+ if (!annotatedField.isStatic())
+ {
+ addFieldInjectionPoint(annotatedField, fields, declaringBean);
+ }
}
t = t.getWBSuperclass();
}
@@ -306,7 +312,7 @@
initializerMethodsList.add(0, initializerMethods);
for (WBMethod<?, ?> method : t.getDeclaredWBMethods())
{
- if (method.isAnnotationPresent(Inject.class))
+ if (method.isAnnotationPresent(Inject.class) && !method.isStatic())
{
if (method.getAnnotation(Produces.class) != null)
{
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java 2009-10-04
12:02:24 UTC (rev 3837)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -53,8 +53,10 @@
private static final Log log = Logging.getLog(Reflections.class);
- private static final Type[] EMPTY_TYPES = {};
+ public static final Type[] EMPTY_TYPES = {};
+ public static final Annotation[] EMPTY_ANNOTATIONS = {};
+
public static class HierarchyDiscovery
{
@@ -460,6 +462,12 @@
}
return false;
}
+
+ public static Set<Type> createTypeClosure(Class<?> rawType, Type[]
actualTypeArguments)
+ {
+ Type type = new ParameterizedTypeImpl(rawType, actualTypeArguments,
rawType.getDeclaringClass());
+ return new HierarchyDiscovery(type).getFlattenedTypes();
+ }
/**
* Invokes a method and wraps exceptions
Modified:
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/singleProducerMethod/BootstrapTest.java
===================================================================
---
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/singleProducerMethod/BootstrapTest.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/singleProducerMethod/BootstrapTest.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -37,7 +37,7 @@
assert classes.containsKey(Tarantula.class);
assert classes.get(TarantulaProducer.class) instanceof ManagedBean<?>;
- assert classes.get(Tarantula.class) instanceof ProducerMethod<?>;
+ assert classes.get(Tarantula.class) instanceof ProducerMethod<?, ?>;
}
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractJSR299Test.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractJSR299Test.java 2009-10-04
12:02:24 UTC (rev 3837)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractJSR299Test.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -155,7 +155,7 @@
}
else if (beans.size() > 1)
{
- throw new AmbiguousResolutionException("More than one bean available
(" + beans.size() + ")");
+ throw new AmbiguousResolutionException("More than one bean available
(" + beans + ")");
}
return beans.iterator().next();
}
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/observer/ProcessObserverMethodEventTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/observer/ProcessObserverMethodEventTest.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/observer/ProcessObserverMethodEventTest.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -40,7 +40,7 @@
@SpecVersion(spec="cdi", version="PFD2")
public class ProcessObserverMethodEventTest extends AbstractJSR299Test
{
- @Test(groups = "ri-broken")
+ @Test
// Event resolution seems to be broken here
@SpecAssertion(section = "11.5.9", id = "aaa")
public void testProcessObserverMethodEventsSent()
@@ -48,14 +48,14 @@
assert ProcessObserverMethodObserver.getEventtypes().contains(EventA.class);
}
- @Test(groups = "ri-broken")
+ @Test
@SpecAssertion(section = "11.5.9", id = "aba")
public void testGetAnnotatedMethod()
{
assert
ProcessObserverMethodObserver.getAnnotatedMethod().getParameters().iterator().next().getBaseType().equals(EventA.class);
}
- @Test(groups = "ri-broken")
+ @Test
@SpecAssertion(section = "11.5.9", id = "ba")
public void testGetObserverMethod()
{
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/observer/ProcessObserverMethodObserver.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/observer/ProcessObserverMethodObserver.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/observer/ProcessObserverMethodObserver.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -9,13 +9,13 @@
import javax.enterprise.inject.spi.ObserverMethod;
import javax.enterprise.inject.spi.ProcessObserverMethod;
-class ProcessObserverMethodObserver implements Extension
+public class ProcessObserverMethodObserver implements Extension
{
private static final HashSet<Type> eventTypes = new HashSet<Type>();
private static AnnotatedMethod<?> annotatedMethod;
private static ObserverMethod<?, ?> observerMethod;
- public void observeObserverMethodForEventA(@Observes ProcessObserverMethod<?, ?>
event)
+ public void observeObserverMethodForEventA(@Observes
ProcessObserverMethod<EventAObserver, EventA> event)
{
eventTypes.add(event.getObserverMethod().getObservedType());
annotatedMethod = event.getAnnotatedMethod();
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/Cat.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/Cat.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/Cat.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -4,25 +4,46 @@
class Cat
{
+ private static boolean constructorCalled;
private static boolean initializerCalled;
@Inject
protected CatFoodDish foodDish;
+ private Bird bird;
+
@Inject
public Cat(LitterBox litterBox)
{
- initializerCalled = true;
+ constructorCalled = true;
assert litterBox != null;
}
+
+ @Inject
+ public void setBird(Bird bird)
+ {
+ assert bird != null;
+ initializerCalled = true;
+ }
+ public static boolean isConstructorCalled()
+ {
+ return constructorCalled;
+ }
+
public static boolean isInitializerCalled()
{
return initializerCalled;
}
- public static void setInitializerCalled(boolean initializerCalled)
+ public static void reset()
{
- Cat.initializerCalled = initializerCalled;
+ Cat.constructorCalled = false;
+ Cat.initializerCalled = false;
}
+
+ public void ping()
+ {
+
+ }
}
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/DogProducer.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/DogProducer.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/DogProducer.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -5,41 +5,39 @@
class DogProducer
{
- public static final String DOG_COLOR = "Black";
+ public static final String QUIET_DOG_COLOR = "Black";
+ public static final String NOISY_DOG_COLOR = "White";
private static boolean noisyDogProducerCalled;
+ private static boolean noisyDogDisposerCalled;
@Produces @Quiet
- private Dog quietDog = new Dog(DOG_COLOR);
+ private Dog quietDog = new Dog(QUIET_DOG_COLOR);
@Produces @Noisy
public Dog produceNoisyDog(DogBed dogBed)
{
noisyDogProducerCalled = true;
- return new Dog();
+ return new Dog(NOISY_DOG_COLOR);
}
public void disposeNoisyDog(@Disposes @Noisy Dog dog)
{
-
+ noisyDogDisposerCalled = true;
}
- public void disposeQuietDog(@Disposes @Quiet Dog dog)
- {
-
- }
-
public static boolean isNoisyDogProducerCalled()
{
return noisyDogProducerCalled;
}
-
- public static void setNoisyDogProducerCalled(boolean noisyDogProducerCalled)
+
+ public static boolean isNoisyDogDisposerCalled()
{
- DogProducer.noisyDogProducerCalled = noisyDogProducerCalled;
+ return noisyDogDisposerCalled;
}
- public Dog getQuietDog()
+ public static void reset()
{
- return quietDog;
+ DogProducer.noisyDogProducerCalled = false;
+ DogProducer.noisyDogDisposerCalled = false;
}
}
Deleted:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/PreferredDogProducer.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/PreferredDogProducer.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/PreferredDogProducer.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -1,71 +0,0 @@
-package org.jboss.jsr299.tck.tests.extensions.producer;
-
-import javax.enterprise.inject.Disposes;
-import javax.enterprise.inject.Produces;
-import javax.enterprise.inject.Specializes;
-
-@Specializes @Preferred
-class PreferredDogProducer extends DogProducer
-{
-
- public static final String DOG_COLOR = "Gray";
- private static boolean noisyDogProducerCalled;
- private static boolean noisyDogDisposed;
- private static boolean quietDogDisposed;
-
- @Produces @Quiet
- private Dog preferredQuietDog = new Dog(DOG_COLOR);
-
- @Override
- public Dog getQuietDog()
- {
- return preferredQuietDog;
- }
-
- @Override @Produces @Noisy
- public Dog produceNoisyDog(DogBed dogBed)
- {
- return new Dog(DOG_COLOR);
- }
-
- public void disposeNoisyDog(@Disposes @Noisy Dog dog)
- {
- noisyDogDisposed = true;
- }
-
- public void disposeQuietDog(@Disposes @Quiet Dog dog)
- {
- quietDogDisposed = true;
- }
-
- public static boolean isNoisyDogProducerCalled()
- {
- return noisyDogProducerCalled;
- }
-
- public static void setNoisyDogProducerCalled(boolean noisyDogProducerCalled)
- {
- PreferredDogProducer.noisyDogProducerCalled = noisyDogProducerCalled;
- }
-
- public static boolean isNoisyDogDisposed()
- {
- return noisyDogDisposed;
- }
-
- public static boolean isQuietDogDisposed()
- {
- return quietDogDisposed;
- }
-
- public static void setNoisyDogDisposed(boolean noisyDogDisposed)
- {
- PreferredDogProducer.noisyDogDisposed = noisyDogDisposed;
- }
-
- public static void setQuietDogDisposed(boolean quietDogDisposed)
- {
- PreferredDogProducer.quietDogDisposed = quietDogDisposed;
- }
-
-}
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/ProducerProcessor.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/ProducerProcessor.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/ProducerProcessor.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -10,22 +10,16 @@
import javax.enterprise.inject.spi.ProcessProducer;
import javax.enterprise.inject.spi.Producer;
-class ProducerProcessor implements Extension
+public class ProducerProcessor implements Extension
{
- private static Producer<Dog> dogProducer;
- private static Producer<Cat> catProducer;
+ private static InjectionTarget<Cat> catInjectionTarget;
private static Producer<Dog> noisyDogProducer;
private static Producer<Dog> quietDogProducer;
private static InjectionTarget<Dog> dogInjectionTarget;
private static AnnotatedType<Dog> dogAnnotatedType;
- public void processDogProducer(@Observes ProcessProducer<Dog, Dog>
producerEvent)
+ public void processDogProducerProducer(@Observes ProcessProducer<DogProducer,
Dog> producerEvent)
{
- dogProducer = producerEvent.getProducer();
- }
-
- public void processDogProducerProducer(@Observes
ProcessProducer<PreferredDogProducer, Dog> producerEvent)
- {
if (producerEvent.getAnnotatedMember().isAnnotationPresent(Noisy.class))
{
noisyDogProducer = producerEvent.getProducer();
@@ -38,9 +32,9 @@
}
}
- public void processCatProducer(@Observes ProcessProducer<Cat, Cat>
producerEvent)
+ public void processCatProducer(@Observes ProcessInjectionTarget<Cat>
producerEvent)
{
- catProducer = producerEvent.getProducer();
+ catInjectionTarget = producerEvent.getInjectionTarget();
}
public void processDogInjectionTarget(@Observes ProcessInjectionTarget<Dog>
injectionTargetEvent)
@@ -50,11 +44,6 @@
dogAnnotatedType = injectionTargetEvent.getAnnotatedType();
}
- public static Producer<Dog> getDogProducer()
- {
- return dogProducer;
- }
-
public static Producer<Dog> getNoisyDogProducer()
{
return noisyDogProducer;
@@ -65,9 +54,9 @@
return quietDogProducer;
}
- public static Producer<Cat> getCatProducer()
+ public static InjectionTarget<Cat> getCatInjectionTarget()
{
- return catProducer;
+ return catInjectionTarget;
}
public static InjectionTarget<Dog> getDogInjectionTarget()
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/ProducerTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/ProducerTest.java 2009-10-04
12:02:24 UTC (rev 3837)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/ProducerTest.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -35,40 +35,30 @@
{
@Test(groups = "ri-broken")
@SpecAssertions({
- @SpecAssertion(section = "11.2", id = "ba"),
- @SpecAssertion(section = "11.5.7", id = "ba")
+ @SpecAssertion(section = "11.2", id = "ba")
})
- public void testProduceCallsInitializer()
+ public void testProduceCallsInitializerAndConstructor()
{
- Producer<Cat> producer = ProducerProcessor.getCatProducer();
- Cat.setInitializerCalled(false);
- producer.produce(new CreationalContextImpl<Cat>());
+ InjectionTarget<Cat> injectionTarget =
ProducerProcessor.getCatInjectionTarget();
+ Bean<Cat> catBean = getUniqueBean(Cat.class);
+ Cat.reset();
+ injectionTarget.produce(getCurrentManager().createCreationalContext(catBean));
+ assert Cat.isConstructorCalled();
assert Cat.isInitializerCalled();
}
- @Test(groups = "ri-broken")
+ @Test(groups = "broken")
@SpecAssertions({
- @SpecAssertion(section = "11.2", id = "ba")
- })
- public void testProduceCallsConstructor()
- {
- Producer<Dog> producer = ProducerProcessor.getDogProducer();
- Dog.setConstructorCalled(false);
- producer.produce(new CreationalContextImpl<Dog>());
- assert Dog.isConstructorCalled();
- }
-
- @Test(groups = "ri-broken")
- @SpecAssertions({
@SpecAssertion(section = "11.2", id = "c")
})
public void testDisposeDoesNothing()
{
- Producer<Dog> producer = ProducerProcessor.getDogProducer();
- Dog dog = getInstanceByType(Dog.class);
- producer.dispose(dog);
+ InjectionTarget<Cat> injectionTarget =
ProducerProcessor.getCatInjectionTarget();
+
+ Cat cat = getInstanceByType(Cat.class);
+ injectionTarget.dispose(cat);
// The instance should still be available
- assert dog == getInstanceByType(Dog.class);
+ cat.ping();
}
@Test(groups = "ri-broken")
@@ -77,10 +67,10 @@
})
public void testGetInjectionPointsForFields()
{
- Producer<Cat> producer = ProducerProcessor.getCatProducer();
- assert producer.getInjectionPoints().size() == 2;
+ InjectionTarget<Cat> injectionTarget =
ProducerProcessor.getCatInjectionTarget();
+ assert injectionTarget.getInjectionPoints().size() == 3;
boolean injectionPointPresent = false;
- for (InjectionPoint injectionPoint : producer.getInjectionPoints())
+ for (InjectionPoint injectionPoint : injectionTarget.getInjectionPoints())
{
if (injectionPoint.getType().equals(CatFoodDish.class))
{
@@ -94,12 +84,12 @@
@SpecAssertions({
@SpecAssertion(section = "11.2", id = "db")
})
- public void testGetInjectionPointsForConstructor()
+ public void testGetInjectionPointsForConstructorAndInitializer()
{
- Producer<Cat> producer = ProducerProcessor.getCatProducer();
- assert producer.getInjectionPoints().size() == 2;
+ InjectionTarget<Cat> injectionTarget =
ProducerProcessor.getCatInjectionTarget();
+ assert injectionTarget.getInjectionPoints().size() == 3;
boolean dogIPPresent = false;
- for (InjectionPoint injectionPoint : producer.getInjectionPoints())
+ for (InjectionPoint injectionPoint : injectionTarget.getInjectionPoints())
{
if (injectionPoint.getType().equals(Dog.class))
{
@@ -115,78 +105,80 @@
})
public void testGetInjectionPointsForInitializer()
{
- Producer<Dog> producer = ProducerProcessor.getDogProducer();
- assert producer.getInjectionPoints().size() == 1;
- assert
producer.getInjectionPoints().iterator().next().getType().equals(DogBed.class);
+ InjectionTarget<Cat> injectionTarget =
ProducerProcessor.getCatInjectionTarget();
+ assert injectionTarget.getInjectionPoints().size() == 3;
+ boolean injectionPointPresent = false;
+ for (InjectionPoint injectionPoint : injectionTarget.getInjectionPoints())
+ {
+ if (injectionPoint.getType().equals(Bird.class))
+ {
+ injectionPointPresent = true;
+ }
+ }
+ assert injectionPointPresent;
}
- @Test(groups = "ri-broken")
+ @Test
@SpecAssertions({
@SpecAssertion(section = "11.2", id = "eaa"),
- @SpecAssertion(section = "11.5.7", id = "a"),
+ @SpecAssertion(section = "11.5.7", id = "aa"),
@SpecAssertion(section = "11.5.7", id = "ba"),
- @SpecAssertion(section = "11.5.7", id = "c"),
- @SpecAssertion(section = "11.5.7", id = "d"),
+ @SpecAssertion(section = "11.5.7", id = "ca"),
+ @SpecAssertion(section = "11.5.7", id = "da"),
@SpecAssertion(section = "12.3", id = "ha")
})
public void testProduceCallsProducerMethod()
{
- PreferredDogProducer.setNoisyDogProducerCalled(false);
Producer<Dog> producer = ProducerProcessor.getNoisyDogProducer();
- Dog dog = producer.produce(new CreationalContextImpl<Dog>());
- assert PreferredDogProducer.isNoisyDogProducerCalled();
- assert dog.getColor().equals(PreferredDogProducer.DOG_COLOR);
+ Bean<Dog> dogBean = getUniqueBean(Dog.class, new
AnnotationLiteral<Noisy>() {});
+ DogProducer.reset();
+ Dog dog = producer.produce(getCurrentManager().createCreationalContext(dogBean));
+ assert DogProducer.isNoisyDogProducerCalled();
+ assert dog.getColor().equals(DogProducer.NOISY_DOG_COLOR);
}
- @Test(groups = "ri-broken")
+ @Test
@SpecAssertions({
@SpecAssertion(section = "11.2", id = "eba"),
- @SpecAssertion(section = "11.5.7", id = "a"),
- @SpecAssertion(section = "11.5.7", id = "ba"),
- @SpecAssertion(section = "11.5.7", id = "c"),
- @SpecAssertion(section = "11.5.7", id = "d"),
+ @SpecAssertion(section = "11.5.7", id = "ab"),
+ @SpecAssertion(section = "11.5.7", id = "bb"),
+ @SpecAssertion(section = "11.5.7", id = "cb"),
+ @SpecAssertion(section = "11.5.7", id = "db"),
@SpecAssertion(section = "12.3", id = "hb")
})
public void testProduceAccessesProducerField()
{
Producer<Dog> producer = ProducerProcessor.getQuietDogProducer();
- Dog dog = producer.produce(new CreationalContextImpl<Dog>());
- assert dog.getColor().equals(PreferredDogProducer.DOG_COLOR);
+ Bean<Dog> dogBean = getUniqueBean(Dog.class, new
AnnotationLiteral<Quiet>() {});
+ DogProducer.reset();
+ Dog dog = producer.produce(getCurrentManager().createCreationalContext(dogBean));
+ assert dog.getColor().equals(DogProducer.QUIET_DOG_COLOR);
}
- @Test(groups = "ri-broken")
+ @Test
@SpecAssertions({
@SpecAssertion(section = "11.2", id = "faa")
})
public void testProducerForMethodDisposesProduct()
{
- PreferredDogProducer.setNoisyDogDisposed(false);
+
+ Bean<Dog> dogBean = getUniqueBean(Dog.class, new
AnnotationLiteral<Noisy>() {});
Producer<Dog> producer = ProducerProcessor.getNoisyDogProducer();
- Dog dog = producer.produce(new CreationalContextImpl<Dog>());
+ DogProducer.reset();
+ Dog dog = producer.produce(getCurrentManager().createCreationalContext(dogBean));
+ assert DogProducer.isNoisyDogProducerCalled();
producer.dispose(dog);
- assert PreferredDogProducer.isNoisyDogDisposed();
+ assert DogProducer.isNoisyDogDisposerCalled();
}
- @Test(groups = "ri-broken")
+ @Test
@SpecAssertions({
- @SpecAssertion(section = "11.2", id = "fba")
- })
- public void testProducerForFieldDisposesProduct()
- {
- PreferredDogProducer.setQuietDogDisposed(false);
- Producer<Dog> producer = ProducerProcessor.getQuietDogProducer();
- Dog dog = producer.produce(new CreationalContextImpl<Dog>());
- producer.dispose(dog);
- assert PreferredDogProducer.isQuietDogDisposed();
- }
-
- @Test(groups = "ri-broken")
- @SpecAssertions({
@SpecAssertion(section = "11.2", id = "g")
})
public void testInjectionPointsForProducerMethod()
{
Producer<Dog> producer = ProducerProcessor.getNoisyDogProducer();
+ DogProducer.reset();
assert producer.getInjectionPoints().size() == 1;
assert
producer.getInjectionPoints().iterator().next().getType().equals(DogBed.class);
}
@@ -238,7 +230,7 @@
@Test(groups = "ri-broken")
@SpecAssertions({
@SpecAssertion(section = "11.5.6", id = "bb"),
- @SpecAssertion(section = "11.5.6", id = "e")
+ @SpecAssertion(section = "11.5.6", id = "ea")
})
public void testSettingInjectionTargetReplacesIt()
{
@@ -249,7 +241,7 @@
@Test(groups = "ri-broken")
@SpecAssertions({
- @SpecAssertion(section = "11.5.6", id = "ab")
+ @SpecAssertion(section = "11.5.6", id = "aba")
})
public void testGetAnnotatedTypeOnProcessInjectionTarget()
{
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/Tabby.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/Tabby.java
(rev 0)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/Tabby.java 2009-10-04
12:19:01 UTC (rev 3838)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.extensions.producer;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@Qualifier
+@interface Tabby
+{
+
+}
Property changes on:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/producer/Tabby.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain