Author: pete.muir(a)jboss.org
Date: 2009-10-11 12:37:25 -0400 (Sun, 11 Oct 2009)
New Revision: 3927
Added:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractDefinitionContainerEvent.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractDeploymentContainerEvent.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessClassBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessProducerBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessBeanImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerFieldImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerMethodImpl.java
Removed:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessBean.java
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/DisposalMethod.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractBeanDiscoveryEvent.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractContainerEvent.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterBeanDiscoveryImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterDeploymentValidationImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeBeanDiscoveryImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeShutdownImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessAnnotatedTypeImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessInjectionTargetImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessManagedBeanImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessObserverMethodImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSessionBeanImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/event/ObserverMethodImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/injection/ConstructorInjectionPoint.java
core/trunk/impl/src/main/java/org/jboss/weld/injection/MethodInjectionPoint.java
core/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWeldConstructor.java
core/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWeldMethod.java
core/trunk/impl/src/main/java/org/jboss/weld/introspector/WeldCallable.java
core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WeldConstructorImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WeldMethodImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java
core/trunk/jboss-as/build.properties
core/trunk/tests/src/main/java/org/jboss/weld/mock/MockBeanDeploymentArchive.java
Log:
implement ProcessBean*, refactor lifecycle events to be cleaner, various other fixes
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java 2009-10-11
16:34:00 UTC (rev 3926)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -52,9 +52,9 @@
* @author Pete Muir
*
* @param <T> the type of bean
- * @param <E> the Class<?> of the bean type
+ * @param <S> the Class<?> of the bean type
*/
-public abstract class AbstractBean<T, E> extends RIBean<T>
+public abstract class AbstractBean<T, S> extends RIBean<T>
{
private static final Annotation ANY_LITERAL = new AnyLiteral();
@@ -71,7 +71,7 @@
// The scope type
protected Class<? extends Annotation> scopeType;
// The merged stereotypes
- private MergedStereotypes<T, E> mergedStereotypes;
+ private MergedStereotypes<T, S> mergedStereotypes;
// Is it a policy, either defined by stereotypes or directly?
private boolean policy;
// The type
@@ -134,7 +134,7 @@
protected void initStereotypes()
{
- mergedStereotypes = new MergedStereotypes<T,
E>(getAnnotatedItem().getMetaAnnotations(Stereotype.class), manager);
+ mergedStereotypes = new MergedStereotypes<T,
S>(getAnnotatedItem().getMetaAnnotations(Stereotype.class), manager);
}
protected void checkDelegateInjectionPoints()
@@ -331,7 +331,7 @@
*
* @return The annotated item
*/
- public abstract WeldAnnotated<T, E> getAnnotatedItem();
+ public abstract WeldAnnotated<T, S> getAnnotatedItem();
/**
* Gets the binding types
@@ -366,7 +366,7 @@
*
* @return The set of merged stereotypes
*/
- protected MergedStereotypes<T, E> getMergedStereotypes()
+ protected MergedStereotypes<T, S> getMergedStereotypes()
{
return mergedStereotypes;
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/DisposalMethod.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/DisposalMethod.java 2009-10-11
16:34:00 UTC (rev 3926)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/DisposalMethod.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -34,11 +34,14 @@
import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
import org.jboss.weld.injection.MethodInjectionPoint;
import org.jboss.weld.introspector.WeldMethod;
+import org.jboss.weld.introspector.WeldParameter;
public class DisposalMethod<X, T> extends AbstractReceiverBean<X, T, Method>
{
- protected MethodInjectionPoint<T, ?> disposalMethodInjectionPoint;
+ protected MethodInjectionPoint<T, X> disposalMethodInjectionPoint;
+
+ private WeldParameter<?, X> disposesParameter;
protected DisposalMethod(BeanManagerImpl manager, WeldMethod<T, X>
disposalMethod, AbstractClassBean<X> declaringBean)
{
@@ -51,12 +54,23 @@
initPolicy();
}
+ private void initDisposesParameter()
+ {
+ this.disposesParameter =
getAnnotatedItem().getAnnotatedWBParameters(Disposes.class).get(0);
+ }
+
+ public WeldParameter<?, X> getDisposesParameter()
+ {
+ return disposesParameter;
+ }
+
@Override
public void initialize(BeanDeployerEnvironment environment)
{
addInjectionPoint(disposalMethodInjectionPoint);
super.initialize(environment);
checkDisposalMethod();
+ initDisposesParameter();
}
@SuppressWarnings("unchecked")
@@ -66,7 +80,7 @@
}
@Override
- public WeldMethod<T, ?> getAnnotatedItem()
+ public WeldMethod<T, X> getAnnotatedItem()
{
return disposalMethodInjectionPoint;
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java 2009-10-11 16:34:00
UTC (rev 3926)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java 2009-10-11 16:37:25
UTC (rev 3927)
@@ -143,7 +143,7 @@
public void preDestroy(T instance)
{
-
+ defaultPreDestroy(instance);
}
public void dispose(T instance)
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java
===================================================================
---
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java 2009-10-11
16:34:00 UTC (rev 3926)
+++
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -17,22 +17,14 @@
package org.jboss.weld.bootstrap;
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.ProcessAnnotatedType;
-import javax.enterprise.inject.spi.ProcessInjectionTarget;
-import javax.enterprise.inject.spi.ProcessManagedBean;
-import javax.enterprise.inject.spi.ProcessObserverMethod;
-import javax.enterprise.inject.spi.ProcessProducer;
-import javax.enterprise.inject.spi.ProcessSessionBean;
import javax.inject.Inject;
import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.DefinitionException;
import org.jboss.weld.bean.AbstractClassBean;
import org.jboss.weld.bean.AbstractProducerBean;
import org.jboss.weld.bean.DecoratorImpl;
@@ -48,11 +40,13 @@
import org.jboss.weld.bean.SessionBean;
import org.jboss.weld.bean.ee.EEResourceProducerField;
import org.jboss.weld.bean.ee.PersistenceContextProducerField;
-import org.jboss.weld.bootstrap.events.ProcessAnnotatedTypeImpl;
+import org.jboss.weld.bootstrap.events.ProcessBeanImpl;
import org.jboss.weld.bootstrap.events.ProcessInjectionTargetImpl;
import org.jboss.weld.bootstrap.events.ProcessManagedBeanImpl;
import org.jboss.weld.bootstrap.events.ProcessObserverMethodImpl;
+import org.jboss.weld.bootstrap.events.ProcessProducerFieldImpl;
import org.jboss.weld.bootstrap.events.ProcessProducerImpl;
+import org.jboss.weld.bootstrap.events.ProcessProducerMethodImpl;
import org.jboss.weld.bootstrap.events.ProcessSessionBeanImpl;
import org.jboss.weld.ejb.EJBApiAbstraction;
import org.jboss.weld.ejb.InternalEjbDescriptor;
@@ -67,7 +61,6 @@
import org.jboss.weld.persistence.PersistenceApiAbstraction;
import org.jboss.weld.servlet.ServletApiAbstraction;
import org.jboss.weld.util.Reflections;
-import org.jboss.weld.util.reflection.ParameterizedTypeImpl;
import org.jboss.weld.ws.WSApiAbstraction;
public class AbstractBeanDeployer<E extends BeanDeployerEnvironment>
@@ -113,20 +106,32 @@
{
if (bean instanceof AbstractProducerBean<?, ?, ?>)
{
- fireProcessProducerEvent((AbstractProducerBean<?, ?, Member>)
bean);
+ ProcessProducerImpl.fire(manager, (AbstractProducerBean<?, ?,
Member>) bean);
}
- if (bean instanceof AbstractClassBean<?>)
+ else if (bean instanceof AbstractClassBean<?>)
{
- fireProcessInjectionTargetEvent((AbstractClassBean<?>) bean);
+ ProcessInjectionTargetImpl.fire(manager, (AbstractClassBean<?>)
bean);
}
if (bean instanceof ManagedBean<?>)
{
- fireProcessManagedBeanEvent((ManagedBean<?>) bean);
+ ProcessManagedBeanImpl.fire(manager, (ManagedBean<?>) bean);
}
- if (bean instanceof SessionBean<?>)
+ else if (bean instanceof SessionBean<?>)
{
- fireProcessSessionBeanEvent((SessionBean<Object>) bean);
+ ProcessSessionBeanImpl.fire(manager, (SessionBean<Object>) bean);
}
+ else if (bean instanceof ProducerField<?, ?>)
+ {
+ ProcessProducerFieldImpl.fire(manager, (ProducerField<?, ?>) bean);
+ }
+ else if (bean instanceof ProducerMethod<?, ?>)
+ {
+ ProcessProducerMethodImpl.fire(manager, (ProducerMethod<?, ?>)
bean);
+ }
+ else
+ {
+ ProcessBeanImpl.fire(getManager(), bean);
+ }
}
manager.addBean(bean);
log.debug("Bean: " + bean);
@@ -135,7 +140,7 @@
{
log.debug("Observer : " + observer);
observer.initialize();
- fireProcessObserverMethodEvent(observer);
+ ProcessObserverMethodImpl.fire(manager, observer);
manager.addObserver(observer);
}
@@ -203,63 +208,6 @@
getEnvironment().addBean(bean);
}
- private <X, T> void fireProcessProducerEvent(AbstractProducerBean<X, T,
Member> producer)
- {
- 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 <X> void fireProcessInjectionTargetEvent(AbstractClassBean<X>
classBean)
- {
- ProcessInjectionTargetImpl<X> payload = new
ProcessInjectionTargetImpl<X>(classBean.getAnnotatedItem(), classBean) {};
- fireEvent(payload, ProcessInjectionTarget.class,
classBean.getAnnotatedItem().getBaseType());
- if (!payload.getDefinitionErrors().isEmpty())
- {
- // FIXME communicate all the captured definition errors in this exception
- throw new DefinitionException(payload.getDefinitionErrors().get(0));
- }
- }
-
- protected <X> ProcessAnnotatedTypeImpl<X>
fireProcessAnnotatedTypeEvent(WeldClass<X> clazz)
- {
- ProcessAnnotatedTypeImpl<X> payload = new
ProcessAnnotatedTypeImpl<X>(clazz) {};
- fireEvent(payload, ProcessAnnotatedType.class, clazz.getBaseType());
- return payload;
- }
-
- private <X> void fireProcessManagedBeanEvent(ManagedBean<X> bean)
- {
- ProcessManagedBeanImpl<X> payload = new ProcessManagedBeanImpl<X>(bean)
{};
- fireEvent(payload, ProcessManagedBean.class,
bean.getAnnotatedItem().getBaseType());
- if (!payload.getDefinitionErrors().isEmpty())
- {
- // FIXME communicate all the captured definition errors in this exception
- throw new DefinitionException(payload.getDefinitionErrors().get(0));
- }
- }
-
- private <X> void fireProcessSessionBeanEvent(SessionBean<Object> bean)
- {
- ProcessSessionBeanImpl<X> payload = new ProcessSessionBeanImpl<X>(bean)
{};
- fireEvent(payload, ProcessSessionBean.class,
bean.getAnnotatedItem().getBaseType());
- if (!payload.getDefinitionErrors().isEmpty())
- {
- // FIXME communicate all the captured definition errors in this exception
- throw new DefinitionException(payload.getDefinitionErrors().get(0));
- }
- }
-
- protected 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, WeldClass<X> annotatedClass)
{
for (WeldField<?, X> field :
annotatedClass.getDeclaredAnnotatedWeldFields(Produces.class))
@@ -281,18 +229,6 @@
ObserverMethodImpl<X, T> observer = ObserverFactory.create(method,
declaringBean, manager);
getEnvironment().addObserver(observer);
}
-
- private <X, T> void fireProcessObserverMethodEvent(ObserverMethodImpl<X,
T> observer)
- {
- 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(WeldClass<T> annotatedClass)
{
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java 2009-10-11
16:34:00 UTC (rev 3926)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -58,7 +58,7 @@
ClassTransformer classTransformer =
Container.instance().deploymentServices().get(ClassTransformer.class);
if (!clazz.isAnnotation() && !clazz.isEnum())
{
- ProcessAnnotatedTypeImpl<?> event =
fireProcessAnnotatedTypeEvent(classTransformer.loadClass(clazz));
+ ProcessAnnotatedTypeImpl<?> event =
ProcessAnnotatedTypeImpl.fire(deploymentManager, classTransformer.loadClass(clazz));
if (!event.isVeto())
{
if (event.getAnnotatedType() instanceof WeldClass<?>)
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java 2009-10-11
16:34:00 UTC (rev 3926)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -22,15 +22,11 @@
import java.util.Set;
import java.util.Map.Entry;
-import javax.enterprise.inject.spi.BeforeBeanDiscovery;
-import javax.enterprise.inject.spi.BeforeShutdown;
import javax.enterprise.inject.spi.Extension;
import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.Container;
import org.jboss.weld.ContextualStore;
-import org.jboss.weld.DefinitionException;
-import org.jboss.weld.DeploymentException;
import org.jboss.weld.Validator;
import org.jboss.weld.bean.builtin.ManagerBean;
import org.jboss.weld.bootstrap.api.Bootstrap;
@@ -157,7 +153,7 @@
private Map<BeanDeploymentArchive, BeanDeployment> beanDeployments;
private Environment environment;
private Deployment deployment;
- private ExtensionBeanDeployerEnvironment extensionBeanDeployerEnvironment;
+ private ExtensionBeanDeployerEnvironment extensionDeployerEnvironment;
public Bootstrap startContainer(Environment environment, Deployment deployment,
BeanStore applicationBeanStore)
{
@@ -216,9 +212,9 @@
// Start the application context
Container.instance().deploymentServices().get(ContextLifecycle.class).beginApplication(applicationBeanStore);
- this.extensionBeanDeployerEnvironment = new
ExtensionBeanDeployerEnvironment(EjbDescriptors.EMPTY, deploymentManager);
+ this.extensionDeployerEnvironment = new
ExtensionBeanDeployerEnvironment(EjbDescriptors.EMPTY, deploymentManager);
- DeploymentVisitor deploymentVisitor = new DeploymentVisitor(deploymentManager,
environment, deployment, extensionBeanDeployerEnvironment);
+ DeploymentVisitor deploymentVisitor = new DeploymentVisitor(deploymentManager,
environment, deployment, extensionDeployerEnvironment);
beanDeployments = deploymentVisitor.visit();
return this;
@@ -264,14 +260,14 @@
throw new IllegalStateException("Manager has not been
initialized");
}
- ExtensionBeanDeployer extensionBeanDeployer = new
ExtensionBeanDeployer(deploymentManager, extensionBeanDeployerEnvironment);
+ ExtensionBeanDeployer extensionBeanDeployer = new
ExtensionBeanDeployer(deploymentManager, extensionDeployerEnvironment);
extensionBeanDeployer.addExtensions(ServiceLoader.load(Extension.class));
extensionBeanDeployer.createBeans().deploy();
// Add the Deployment BeanManager Bean to the Deployment BeanManager
deploymentManager.addBean(new ManagerBean(deploymentManager));
- fireBeforeBeanDiscoveryEvent();
+ BeforeBeanDiscoveryImpl.fire(deploymentManager, deployment, beanDeployments,
extensionDeployerEnvironment);
}
return this;
}
@@ -284,7 +280,7 @@
{
entry.getValue().deployBeans(environment);
}
- fireAfterBeanDiscoveryEvent();
+ AfterBeanDiscoveryImpl.fire(deploymentManager, deployment, beanDeployments,
extensionDeployerEnvironment);
log.debug("Weld initialized. Validating beans.");
}
return this;
@@ -298,7 +294,7 @@
{
deployment.getServices().get(Validator.class).validateDeployment(entry.getValue().getBeanManager(),
entry.getValue().getBeanDeployer().getEnvironment());
}
- fireAfterDeploymentValidationEvent();
+ AfterDeploymentValidationImpl.fire(deploymentManager);
}
return this;
}
@@ -314,71 +310,6 @@
return this;
}
- private void fireBeforeBeanDiscoveryEvent()
- {
- BeforeBeanDiscovery event = new BeforeBeanDiscoveryImpl(deploymentManager,
deployment, beanDeployments, extensionBeanDeployerEnvironment);
- try
- {
- deploymentManager.fireEvent(event);
- }
- catch (Exception e)
- {
- throw new DefinitionException(e);
- }
- }
-
- private void fireBeforeShutdownEvent()
- {
- BeforeShutdown event = new BeforeShutdownImpl();
- try
- {
- deploymentManager.fireEvent(event);
- }
- catch (Exception e)
- {
- throw new DeploymentException(e);
- }
- }
-
- private void fireAfterBeanDiscoveryEvent()
- {
- AfterBeanDiscoveryImpl event = new AfterBeanDiscoveryImpl(deploymentManager,
deployment, beanDeployments, extensionBeanDeployerEnvironment);
- try
- {
- deploymentManager.fireEvent(event);
- }
- catch (Exception e)
- {
- event.addDefinitionError(e);
- }
-
- if (event.getDefinitionErrors().size() > 0)
- {
- // FIXME communicate all the captured definition errors in this exception
- throw new DefinitionException(event.getDefinitionErrors().get(0));
- }
- }
-
- private void fireAfterDeploymentValidationEvent()
- {
- AfterDeploymentValidationImpl event = new AfterDeploymentValidationImpl();
-
- try
- {
- deploymentManager.fireEvent(event);
- }
- catch (Exception e)
- {
- event.addDeploymentProblem(e);
- }
-
- if (event.getDeploymentProblems().size() > 0)
- {
- // FIXME communicate all the captured deployment problems in this exception
- throw new DeploymentException(event.getDeploymentProblems().get(0));
- }
- }
-
/**
* Gets version information
*
@@ -417,7 +348,7 @@
{
try
{
- fireBeforeShutdownEvent();
+ BeforeShutdownImpl.fire(deploymentManager);
}
finally
{
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractBeanDiscoveryEvent.java
===================================================================
---
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractBeanDiscoveryEvent.java 2009-10-11
16:34:00 UTC (rev 3926)
+++
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractBeanDiscoveryEvent.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -16,6 +16,7 @@
*/
package org.jboss.weld.bootstrap.events;
+import java.lang.reflect.Type;
import java.util.Map;
import org.jboss.weld.BeanManagerImpl;
@@ -28,18 +29,17 @@
/**
* @author pmuir
*/
-public abstract class AbstractBeanDiscoveryEvent extends AbstractContainerEvent
+public abstract class AbstractBeanDiscoveryEvent extends
AbstractDefinitionContainerEvent
{
-
+
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)
+ public AbstractBeanDiscoveryEvent(BeanManagerImpl deploymentManager, Type rawType,
Map<BeanDeploymentArchive, BeanDeployment> beanDeployments, Deployment deployment,
ExtensionBeanDeployerEnvironment extensionBeanDeployerEnvironment)
{
+ super(deploymentManager, rawType, EMPTY_TYPE_ARRAY);
this.beanDeployments = beanDeployments;
- this.deploymentManager = deploymentManager;
this.deployment = deployment;
this.extensionBeanDeployerEnvironment = extensionBeanDeployerEnvironment;
}
@@ -60,14 +60,6 @@
return deployment;
}
- /**
- * @return the deploymentManager
- */
- protected BeanManagerImpl getDeploymentManager()
- {
- return deploymentManager;
- }
-
protected TypeStore getTypeStore()
{
return getDeployment().getServices().get(TypeStore.class);
@@ -89,7 +81,7 @@
}
else
{
- BeanDeployment beanDeployment = new BeanDeployment(beanDeploymentArchive,
getDeploymentManager(), deployment, extensionBeanDeployerEnvironment,
deployment.getServices());
+ BeanDeployment beanDeployment = new BeanDeployment(beanDeploymentArchive,
getBeanManager(), getDeployment(), extensionBeanDeployerEnvironment,
getDeployment().getServices());
getBeanDeployments().put(beanDeploymentArchive, beanDeployment);
return beanDeployment;
}
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractContainerEvent.java
===================================================================
---
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractContainerEvent.java 2009-10-11
16:34:00 UTC (rev 3926)
+++
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractContainerEvent.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -1,36 +1,29 @@
-/*
- * 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.weld.bootstrap.events;
+import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
-/**
- * @author pmuir
- *
- */
-public class AbstractContainerEvent
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.DefinitionException;
+import org.jboss.weld.util.reflection.ParameterizedTypeImpl;
+
+public abstract class AbstractContainerEvent
{
+
+ protected static final Type[] EMPTY_TYPE_ARRAY = new Type[0];
private final List<Throwable> errors;
-
- public AbstractContainerEvent()
+ private final BeanManagerImpl beanManager;
+ private final Type[] actualTypeArguments;
+ private final Type rawType;
+
+ protected AbstractContainerEvent(BeanManagerImpl beanManager, Type rawType, Type[]
actualTypeArguments)
{
this.errors = new ArrayList<Throwable>();
+ this.beanManager = beanManager;
+ this.actualTypeArguments = actualTypeArguments;
+ this.rawType = rawType;
}
/**
@@ -40,5 +33,33 @@
{
return errors;
}
+
+ protected BeanManagerImpl getBeanManager()
+ {
+ return beanManager;
+ }
+
+ protected void fire()
+ {
+ Type eventType = new ParameterizedTypeImpl(getRawType(), getEmptyTypeArray(),
null);
+ try
+ {
+ beanManager.fireEvent(eventType, this);
+ }
+ catch (Exception e)
+ {
+ getErrors().add(new DefinitionException(e));
+ }
+ }
-}
+ protected Type getRawType()
+ {
+ return rawType;
+ }
+
+ protected Type[] getEmptyTypeArray()
+ {
+ return actualTypeArguments;
+ }
+
+}
\ No newline at end of file
Copied:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractDefinitionContainerEvent.java
(from rev 3909,
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractContainerEvent.java)
===================================================================
---
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractDefinitionContainerEvent.java
(rev 0)
+++
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractDefinitionContainerEvent.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -0,0 +1,47 @@
+/*
+ * 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.weld.bootstrap.events;
+
+import java.lang.reflect.Type;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.DefinitionException;
+
+/**
+ * @author pmuir
+ *
+ */
+public abstract class AbstractDefinitionContainerEvent extends AbstractContainerEvent
+{
+
+ protected AbstractDefinitionContainerEvent(BeanManagerImpl beanManager, Type rawType,
Type[] actualTypeArguments)
+ {
+ super(beanManager, rawType, actualTypeArguments);
+ }
+
+ @Override
+ protected void fire()
+ {
+ super.fire();
+ if (!getErrors().isEmpty())
+ {
+ // FIXME communicate all the captured definition errors in this exception
+ throw new DefinitionException(getErrors().get(0));
+ }
+ }
+
+}
Property changes on:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractDefinitionContainerEvent.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractDeploymentContainerEvent.java
===================================================================
---
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractDeploymentContainerEvent.java
(rev 0)
+++
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractDeploymentContainerEvent.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -0,0 +1,47 @@
+/*
+ * 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.weld.bootstrap.events;
+
+import java.lang.reflect.Type;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.DeploymentException;
+
+/**
+ * @author pmuir
+ *
+ */
+public abstract class AbstractDeploymentContainerEvent extends AbstractContainerEvent
+{
+
+ protected AbstractDeploymentContainerEvent(BeanManagerImpl beanManager, Type rawType,
Type[] actualTypeArguments)
+ {
+ super(beanManager, rawType, actualTypeArguments);
+ }
+
+ @Override
+ protected void fire()
+ {
+ super.fire();
+ if (!getErrors().isEmpty())
+ {
+ // FIXME communicate all the captured deployment errors in this exception
+ throw new DeploymentException(getErrors().get(0));
+ }
+ }
+
+}
Property changes on:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractDeploymentContainerEvent.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Deleted:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessBean.java
===================================================================
---
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessBean.java 2009-10-11
16:34:00 UTC (rev 3926)
+++
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessBean.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -1,40 +0,0 @@
-package org.jboss.weld.bootstrap.events;
-
-import java.util.List;
-
-import javax.enterprise.inject.spi.Annotated;
-import javax.enterprise.inject.spi.ProcessBean;
-
-import org.jboss.weld.bean.AbstractBean;
-
-public abstract class AbstractProcessBean<X, B extends AbstractBean<X, ?>>
extends AbstractContainerEvent implements ProcessBean<X>
-{
-
- private final B bean;
-
- public AbstractProcessBean(B bean)
- {
- this.bean = bean;
- }
-
- public void addDefinitionError(Throwable t)
- {
- getErrors().add(t);
- }
-
- public List<Throwable> getDefinitionErrors()
- {
- return super.getErrors();
- }
-
- public Annotated getAnnotated()
- {
- return bean.getAnnotatedItem();
- }
-
- public B getBean()
- {
- return bean;
- }
-
-}
Copied:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessClassBean.java
(from rev 3909,
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessBean.java)
===================================================================
---
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessClassBean.java
(rev 0)
+++
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessClassBean.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -0,0 +1,37 @@
+package org.jboss.weld.bootstrap.events;
+
+import java.lang.reflect.Type;
+
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.ProcessBean;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.bean.AbstractClassBean;
+
+public abstract class AbstractProcessClassBean<X, B extends
AbstractClassBean<X>> extends AbstractDefinitionContainerEvent implements
ProcessBean<X>
+{
+
+ private final B bean;
+
+ public AbstractProcessClassBean(BeanManagerImpl beanManager, Type rawType, Type[]
actualTypeArguments, B bean)
+ {
+ super(beanManager, rawType, actualTypeArguments);
+ this.bean = bean;
+ }
+
+ public void addDefinitionError(Throwable t)
+ {
+ getErrors().add(t);
+ }
+
+ public Annotated getAnnotated()
+ {
+ return bean.getAnnotatedItem();
+ }
+
+ public B getBean()
+ {
+ return bean;
+ }
+
+}
Property changes on:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessClassBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessProducerBean.java
===================================================================
---
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessProducerBean.java
(rev 0)
+++
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessProducerBean.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -0,0 +1,37 @@
+package org.jboss.weld.bootstrap.events;
+
+import java.lang.reflect.Type;
+
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.ProcessBean;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.bean.AbstractProducerBean;
+
+public abstract class AbstractProcessProducerBean<X, T, B extends
AbstractProducerBean<X, T, ? >> extends AbstractDefinitionContainerEvent
implements ProcessBean<T>
+{
+
+ private final B bean;
+
+ public AbstractProcessProducerBean(BeanManagerImpl beanManager, Type rawType, Type[]
actualTypeArguments, B bean)
+ {
+ super(beanManager, rawType, actualTypeArguments);
+ this.bean = bean;
+ }
+
+ public void addDefinitionError(Throwable t)
+ {
+ getErrors().add(t);
+ }
+
+ public Annotated getAnnotated()
+ {
+ return bean.getAnnotatedItem();
+ }
+
+ public B getBean()
+ {
+ return bean;
+ }
+
+}
Property changes on:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AbstractProcessProducerBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterBeanDiscoveryImpl.java
===================================================================
---
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterBeanDiscoveryImpl.java 2009-10-11
16:34:00 UTC (rev 3926)
+++
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterBeanDiscoveryImpl.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -33,11 +33,16 @@
public class AfterBeanDiscoveryImpl extends AbstractBeanDiscoveryEvent implements
AfterBeanDiscovery
{
-
- public AfterBeanDiscoveryImpl(BeanManagerImpl deploymentManager, Deployment
deployment, Map<BeanDeploymentArchive, BeanDeployment> beanDeployments,
ExtensionBeanDeployerEnvironment extensionDeployerEnvironment)
+
+ public static void fire(BeanManagerImpl deploymentManager, Deployment deployment,
Map<BeanDeploymentArchive, BeanDeployment> beanDeployments,
ExtensionBeanDeployerEnvironment extensionDeployerEnvironment)
{
- super(beanDeployments, deploymentManager, deployment,
extensionDeployerEnvironment);
+ new AfterBeanDiscoveryImpl(deploymentManager, deployment, beanDeployments,
extensionDeployerEnvironment).fire();
}
+
+ protected AfterBeanDiscoveryImpl(BeanManagerImpl deploymentManager, Deployment
deployment, Map<BeanDeploymentArchive, BeanDeployment> beanDeployments,
ExtensionBeanDeployerEnvironment extensionDeployerEnvironment)
+ {
+ super(deploymentManager, AfterBeanDiscovery.class, beanDeployments, deployment,
extensionDeployerEnvironment);
+ }
public void addDefinitionError(Throwable t)
{
@@ -51,12 +56,14 @@
public void addBean(Bean<?> bean)
{
- getOrCreateBeanDeployment(bean.getBeanClass()).getBeanManager().addBean(bean);
+ BeanManagerImpl beanManager =
getOrCreateBeanDeployment(bean.getBeanClass()).getBeanManager();
+ beanManager.addBean(bean);
+ ProcessBeanImpl.fire(beanManager, bean);
}
public void addContext(Context context)
{
- getDeploymentManager().addContext(context);
+ getBeanManager().addContext(context);
}
public void addObserverMethod(ObserverMethod<?, ?> observerMethod)
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterDeploymentValidationImpl.java
===================================================================
---
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterDeploymentValidationImpl.java 2009-10-11
16:34:00 UTC (rev 3926)
+++
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterDeploymentValidationImpl.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -16,22 +16,27 @@
*/
package org.jboss.weld.bootstrap.events;
-import java.util.Collections;
-import java.util.List;
-
import javax.enterprise.inject.spi.AfterDeploymentValidation;
+import org.jboss.weld.BeanManagerImpl;
-public class AfterDeploymentValidationImpl extends AbstractContainerEvent implements
AfterDeploymentValidation
+
+public class AfterDeploymentValidationImpl extends AbstractDeploymentContainerEvent
implements AfterDeploymentValidation
{
+ public static void fire(BeanManagerImpl deploymentManager)
+ {
+ new AfterDeploymentValidationImpl(deploymentManager).fire();
+ }
+
+ protected AfterDeploymentValidationImpl(BeanManagerImpl beanManager)
+ {
+ super(beanManager, AfterDeploymentValidation.class, EMPTY_TYPE_ARRAY);
+ }
+
public void addDeploymentProblem(Throwable t)
{
getErrors().add(t);
}
-
- public List<Throwable> getDeploymentProblems()
- {
- return Collections.unmodifiableList(getErrors());
- }
+
}
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeBeanDiscoveryImpl.java
===================================================================
---
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeBeanDiscoveryImpl.java 2009-10-11
16:34:00 UTC (rev 3926)
+++
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeBeanDiscoveryImpl.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -34,12 +34,17 @@
public class BeforeBeanDiscoveryImpl extends AbstractBeanDiscoveryEvent implements
BeforeBeanDiscovery
{
-
- public BeforeBeanDiscoveryImpl(BeanManagerImpl deploymentManager, Deployment
deployment, Map<BeanDeploymentArchive, BeanDeployment> beanDeployments,
ExtensionBeanDeployerEnvironment extensionBeanDeployerEnvironment)
+
+ public static void fire(BeanManagerImpl deploymentManager, Deployment deployment,
Map<BeanDeploymentArchive, BeanDeployment> beanDeployments,
ExtensionBeanDeployerEnvironment extensionDeployerEnvironment)
{
- super(beanDeployments, deploymentManager, deployment,
extensionBeanDeployerEnvironment);
+ new BeforeBeanDiscoveryImpl(deploymentManager, deployment, beanDeployments,
extensionDeployerEnvironment).fire();
}
+ protected BeforeBeanDiscoveryImpl(BeanManagerImpl deploymentManager, Deployment
deployment, Map<BeanDeploymentArchive, BeanDeployment> beanDeployments,
ExtensionBeanDeployerEnvironment extensionBeanDeployerEnvironment)
+ {
+ super(deploymentManager, BeforeBeanDiscovery.class, beanDeployments, deployment,
extensionBeanDeployerEnvironment);
+ }
+
public void addQualifier(Class<? extends Annotation> bindingType)
{
getTypeStore().add(bindingType, new BindingTypeLiteral());
@@ -50,8 +55,7 @@
getTypeStore().add(bindingType, new InterceptorBindingTypeLiteral());
}
- public void addScope(Class<? extends Annotation> scopeType,
- boolean normal, boolean passivating)
+ public void addScope(Class<? extends Annotation> scopeType, boolean normal,
boolean passivating)
{
if (normal)
{
@@ -63,17 +67,14 @@
}
}
- public void addStereotype(Class<? extends Annotation> stereotype,
- Annotation... stereotypeDef)
+ public void addStereotype(Class<? extends Annotation> stereotype, Annotation...
stereotypeDef)
{
throw new UnsupportedOperationException();
}
-
+
public void addAnnotatedType(AnnotatedType<?> type)
{
getOrCreateBeanDeployment(type.getJavaClass()).getBeanDeployer().addClass(type);
}
-
-
}
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeShutdownImpl.java
===================================================================
---
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeShutdownImpl.java 2009-10-11
16:34:00 UTC (rev 3926)
+++
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/BeforeShutdownImpl.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -18,11 +18,23 @@
import javax.enterprise.inject.spi.BeforeShutdown;
+import org.jboss.weld.BeanManagerImpl;
+
/**
* @author pmuir
*
*/
-public class BeforeShutdownImpl implements BeforeShutdown
+public class BeforeShutdownImpl extends AbstractContainerEvent implements BeforeShutdown
{
+
+ public static void fire(BeanManagerImpl beanManager)
+ {
+ new BeforeShutdownImpl(beanManager).fire();
+ }
+
+ public BeforeShutdownImpl(BeanManagerImpl beanManager)
+ {
+ super(beanManager, BeforeShutdown.class, EMPTY_TYPE_ARRAY);
+ }
}
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessAnnotatedTypeImpl.java
===================================================================
---
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessAnnotatedTypeImpl.java 2009-10-11
16:34:00 UTC (rev 3926)
+++
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessAnnotatedTypeImpl.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -16,9 +16,14 @@
*/
package org.jboss.weld.bootstrap.events;
+import java.lang.reflect.Type;
+
import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.ProcessAnnotatedType;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.introspector.WeldClass;
+
/**
* Container lifecycle event for each Java class or interface discovered by
* the container.
@@ -27,14 +32,22 @@
* @author David Allen
*
*/
-public class ProcessAnnotatedTypeImpl<X> implements ProcessAnnotatedType<X>
+public class ProcessAnnotatedTypeImpl<X> extends AbstractDefinitionContainerEvent
implements ProcessAnnotatedType<X>
{
+ public static <X> ProcessAnnotatedTypeImpl<X> fire(BeanManagerImpl
beanManager, WeldClass<X> clazz)
+ {
+ ProcessAnnotatedTypeImpl<X> payload = new
ProcessAnnotatedTypeImpl<X>(beanManager, clazz) {};
+ payload.fire();
+ return payload;
+ }
+
private AnnotatedType<X> annotatedType;
private boolean veto;
- public ProcessAnnotatedTypeImpl(AnnotatedType<X> annotatedType)
+ public ProcessAnnotatedTypeImpl(BeanManagerImpl beanManager, AnnotatedType<X>
annotatedType)
{
+ super(beanManager, ProcessAnnotatedType.class, new Type[] {
annotatedType.getBaseType() });
this.annotatedType = annotatedType;
}
Added: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessBeanImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessBeanImpl.java
(rev 0)
+++
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessBeanImpl.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -0,0 +1,46 @@
+package org.jboss.weld.bootstrap.events;
+
+import java.lang.reflect.Type;
+
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.ProcessBean;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.introspector.WeldAnnotated;
+import org.jboss.weld.resources.ClassTransformer;
+
+public abstract class ProcessBeanImpl<X> extends AbstractDefinitionContainerEvent
implements ProcessBean<X>
+{
+
+ public static <X> void fire(BeanManagerImpl beanManager, Bean<X> bean)
+ {
+ new ProcessBeanImpl<X>(beanManager, bean) {}.fire();
+ }
+
+ private final Bean<X> bean;
+ private final WeldAnnotated<?, ?> annotated;
+
+ public ProcessBeanImpl(BeanManagerImpl beanManager, Bean<X> bean)
+ {
+ super(beanManager, ProcessBean.class, new Type[] {bean.getBeanClass()});
+ this.bean = bean;
+ this.annotated =
beanManager.getServices().get(ClassTransformer.class).loadClass(bean.getBeanClass());
+ }
+
+ public void addDefinitionError(Throwable t)
+ {
+ getErrors().add(t);
+ }
+
+ public Annotated getAnnotated()
+ {
+ return annotated;
+ }
+
+ public Bean<X> getBean()
+ {
+ return bean;
+ }
+
+}
Property changes on:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessBeanImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessInjectionTargetImpl.java
===================================================================
---
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessInjectionTargetImpl.java 2009-10-11
16:34:00 UTC (rev 3926)
+++
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessInjectionTargetImpl.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -1,23 +1,31 @@
package org.jboss.weld.bootstrap.events;
+import java.lang.reflect.Type;
import java.util.List;
import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.InjectionTarget;
import javax.enterprise.inject.spi.ProcessInjectionTarget;
+import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bean.AbstractClassBean;
-public class ProcessInjectionTargetImpl<T> extends AbstractContainerEvent
implements ProcessInjectionTarget<T>
+public class ProcessInjectionTargetImpl<T> extends AbstractDefinitionContainerEvent
implements ProcessInjectionTarget<T>
{
+ public static <X> void fire(BeanManagerImpl beanManager,
AbstractClassBean<X> bean)
+ {
+ new ProcessInjectionTargetImpl<X>(beanManager, bean.getAnnotatedItem(), bean)
{}.fire();
+ }
+
private final AnnotatedType<T> annotatedType;
private AbstractClassBean<T> classBean;
- public ProcessInjectionTargetImpl(AnnotatedType<T> annotatedType,
AbstractClassBean<T> classBean)
+ public ProcessInjectionTargetImpl(BeanManagerImpl beanManager, AnnotatedType<T>
annotatedType, AbstractClassBean<T> bean)
{
- this.classBean = classBean;
+ super(beanManager, ProcessInjectionTarget.class, new Type[] {
bean.getAnnotatedItem().getBaseType() });
+ this.classBean = bean;
this.annotatedType = annotatedType;
}
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessManagedBeanImpl.java
===================================================================
---
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessManagedBeanImpl.java 2009-10-11
16:34:00 UTC (rev 3926)
+++
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessManagedBeanImpl.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -1,17 +1,25 @@
package org.jboss.weld.bootstrap.events;
+import java.lang.reflect.Type;
+
import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.ProcessManagedBean;
+import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bean.ManagedBean;
-public class ProcessManagedBeanImpl<X> extends AbstractProcessBean<X,
ManagedBean<X>> implements ProcessManagedBean<X>
+public class ProcessManagedBeanImpl<X> extends AbstractProcessClassBean<X,
ManagedBean<X>> implements ProcessManagedBean<X>
{
- public ProcessManagedBeanImpl(ManagedBean<X> bean)
+ public static <X> void fire(BeanManagerImpl beanManager, ManagedBean<X>
bean)
{
- super(bean);
+ new ProcessManagedBeanImpl<X>(beanManager, bean) {}.fire();
}
+
+ public ProcessManagedBeanImpl(BeanManagerImpl beanManager, ManagedBean<X> bean)
+ {
+ super(beanManager, ProcessManagedBean.class, new Type[] {
bean.getAnnotatedItem().getBaseType() }, bean);
+ }
public AnnotatedType<X> getAnnotatedBeanClass()
{
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessObserverMethodImpl.java
===================================================================
---
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessObserverMethodImpl.java 2009-10-11
16:34:00 UTC (rev 3926)
+++
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessObserverMethodImpl.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -17,6 +17,7 @@
package org.jboss.weld.bootstrap.events;
+import java.lang.reflect.Type;
import java.util.Collections;
import java.util.List;
@@ -24,6 +25,9 @@
import javax.enterprise.inject.spi.ObserverMethod;
import javax.enterprise.inject.spi.ProcessObserverMethod;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.event.ObserverMethodImpl;
+
/**
* Implementation of the event used to notify observers for each observer
* method that is added.
@@ -31,13 +35,20 @@
* @author David Allen
*
*/
-public class ProcessObserverMethodImpl<X, T> extends AbstractContainerEvent
implements ProcessObserverMethod<X, T>
+public class ProcessObserverMethodImpl<X, T> extends
AbstractDefinitionContainerEvent implements ProcessObserverMethod<X, T>
{
+
+ public static <X, T> void fire(BeanManagerImpl beanManager,
ObserverMethodImpl<X, T> observer)
+ {
+ new ProcessObserverMethodImpl<X, T>(beanManager, observer.getMethod(),
observer) {}.fire();
+ }
+
private final AnnotatedMethod<X> beanMethod;
private final ObserverMethod<X, T> observerMethod;
- public ProcessObserverMethodImpl(AnnotatedMethod<X> beanMethod,
ObserverMethod<X, T> observerMethod)
+ public ProcessObserverMethodImpl(BeanManagerImpl beanManager, AnnotatedMethod<X>
beanMethod, ObserverMethodImpl<X, T> observerMethod)
{
+ super(beanManager, ProcessObserverMethod.class, new Type[] {
observerMethod.getMethod().getDeclaringType().getBaseType(),
observerMethod.getObservedType() });
this.beanMethod = beanMethod;
this.observerMethod = observerMethod;
}
Added:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerFieldImpl.java
===================================================================
---
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerFieldImpl.java
(rev 0)
+++
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerFieldImpl.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -0,0 +1,30 @@
+package org.jboss.weld.bootstrap.events;
+
+import java.lang.reflect.Type;
+
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.ProcessProducerField;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.bean.ProducerField;
+
+public class ProcessProducerFieldImpl<X, T> extends
AbstractProcessProducerBean<X, T, ProducerField<X, T>> implements
ProcessProducerField<X, T>
+{
+
+
+ public static <X, T> void fire(BeanManagerImpl beanManager, ProducerField<X,
T> bean)
+ {
+ new ProcessProducerFieldImpl<X, T>(beanManager, bean) {}.fire();
+ }
+
+ public ProcessProducerFieldImpl(BeanManagerImpl beanManager, ProducerField<X, T>
bean)
+ {
+ super(beanManager, ProcessProducerField.class, new Type[] {
bean.getAnnotatedItem().getDeclaringType().getBaseType(),
bean.getAnnotatedItem().getBaseType() }, bean);
+ }
+
+ public AnnotatedField<X> getAnnotatedProducerField()
+ {
+ return getBean().getAnnotatedItem();
+ }
+
+}
Property changes on:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerFieldImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerImpl.java
===================================================================
---
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerImpl.java 2009-10-11
16:34:00 UTC (rev 3926)
+++
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerImpl.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -1,22 +1,30 @@
package org.jboss.weld.bootstrap.events;
-import java.util.List;
+import java.lang.reflect.Member;
+import java.lang.reflect.Type;
import javax.enterprise.inject.spi.AnnotatedMember;
import javax.enterprise.inject.spi.ProcessProducer;
import javax.enterprise.inject.spi.Producer;
+import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bean.AbstractProducerBean;
-public class ProcessProducerImpl<X, T> extends AbstractContainerEvent implements
ProcessProducer<X, T>
+public class ProcessProducerImpl<X, T> extends AbstractDefinitionContainerEvent
implements ProcessProducer<X, T>
{
+ public static <X, T> void fire(BeanManagerImpl beanManager,
AbstractProducerBean<X, T, Member> producer)
+ {
+ new ProcessProducerImpl<X, T>(beanManager, producer.getAnnotatedItem(),
producer) {}.fire();
+ }
+
private final AnnotatedMember<X> annotatedMember;
private AbstractProducerBean<X, T, ?> bean;
- public ProcessProducerImpl(AnnotatedMember<X> annotatedMember,
AbstractProducerBean<X, T, ?> bean)
+ public ProcessProducerImpl(BeanManagerImpl beanManager, AnnotatedMember<X>
annotatedMember, AbstractProducerBean<X, T, ?> bean)
{
+ super(beanManager, ProcessProducer.class, new Type[] {
bean.getAnnotatedItem().getDeclaringType().getBaseType(),
bean.getAnnotatedItem().getBaseType() });
this.bean = bean;
this.annotatedMember = annotatedMember;
}
@@ -25,11 +33,6 @@
{
getErrors().add(t);
}
-
- public List<Throwable> getDefinitionErrors()
- {
- return super.getErrors();
- }
public AnnotatedMember<X> getAnnotatedMember()
{
Added:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerMethodImpl.java
===================================================================
---
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerMethodImpl.java
(rev 0)
+++
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerMethodImpl.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -0,0 +1,38 @@
+package org.jboss.weld.bootstrap.events;
+
+import java.lang.reflect.Type;
+
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.ProcessProducerMethod;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.bean.ProducerMethod;
+
+public class ProcessProducerMethodImpl<X, T> extends
AbstractProcessProducerBean<X, T, ProducerMethod<X, T>> implements
ProcessProducerMethod<X, T>
+{
+
+
+ public static <X, T> void fire(BeanManagerImpl beanManager, ProducerMethod<X,
T> bean)
+ {
+ new ProcessProducerMethodImpl<X, T>(beanManager, bean) {}.fire();
+ }
+
+ public ProcessProducerMethodImpl(BeanManagerImpl beanManager, ProducerMethod<X,
T> bean)
+ {
+ super(beanManager, ProcessProducerMethod.class, new Type[] {
bean.getAnnotatedItem().getDeclaringType().getBaseType(),
bean.getAnnotatedItem().getBaseType() }, bean);
+ }
+
+ public AnnotatedParameter<X> getAnnotatedDisposedParameter()
+ {
+ return getBean().getDisposalMethod().getDisposesParameter();
+ }
+
+ public AnnotatedMethod<X> getAnnotatedProducerMethod()
+ {
+ return getBean().getAnnotatedItem();
+ }
+
+
+
+}
Property changes on:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessProducerMethodImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSessionBeanImpl.java
===================================================================
---
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSessionBeanImpl.java 2009-10-11
16:34:00 UTC (rev 3926)
+++
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/ProcessSessionBeanImpl.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -1,17 +1,25 @@
package org.jboss.weld.bootstrap.events;
+import java.lang.reflect.Type;
+
import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.ProcessSessionBean;
import javax.enterprise.inject.spi.SessionBeanType;
+import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.bean.SessionBean;
-public class ProcessSessionBeanImpl<X> extends AbstractProcessBean<Object,
SessionBean<Object>> implements ProcessSessionBean<X>
+public class ProcessSessionBeanImpl<X> extends AbstractProcessClassBean<Object,
SessionBean<Object>> implements ProcessSessionBean<X>
{
+
+ public static <X> void fire(BeanManagerImpl beanManager,
SessionBean<Object> bean)
+ {
+ new ProcessSessionBeanImpl<X>(beanManager, bean) {}.fire();
+ }
- public ProcessSessionBeanImpl(SessionBean<Object> bean)
+ public ProcessSessionBeanImpl(BeanManagerImpl beanManager, SessionBean<Object>
bean)
{
- super(bean);
+ super(beanManager, ProcessSessionBean.class, new Type[] {
bean.getAnnotatedItem().getBaseType() }, bean);
}
public AnnotatedType<X> getAnnotatedSessionBeanClass()
Modified: core/trunk/impl/src/main/java/org/jboss/weld/event/ObserverMethodImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/event/ObserverMethodImpl.java 2009-10-11
16:34:00 UTC (rev 3926)
+++ core/trunk/impl/src/main/java/org/jboss/weld/event/ObserverMethodImpl.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -95,7 +95,7 @@
private void checkObserverMethod()
{
// Make sure exactly one and only one parameter is annotated with Observes
- List<WeldParameter<?, ?>> eventObjects =
this.observerMethod.getAnnotatedParameters(Observes.class);
+ List<WeldParameter<?, X>> eventObjects =
this.observerMethod.getAnnotatedParameters(Observes.class);
if (this.notifyType.equals(Notify.IF_EXISTS) &&
declaringBean.getScope().equals(Dependent.class))
{
throw new DefinitionException(this + " is invalid because it is a
conditional observer method, and is declared by a @Dependent scoped bean");
@@ -125,7 +125,7 @@
}
}
// Check for parameters annotated with @Disposes
- List<WeldParameter<?, ?>> disposeParams =
this.observerMethod.getAnnotatedParameters(Disposes.class);
+ List<WeldParameter<?, X>> disposeParams =
this.observerMethod.getAnnotatedParameters(Disposes.class);
if (disposeParams.size() > 0)
{
throw new DefinitionException(this + " cannot have any parameters annotated
with @Disposes");
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/injection/ConstructorInjectionPoint.java
===================================================================
---
core/trunk/impl/src/main/java/org/jboss/weld/injection/ConstructorInjectionPoint.java 2009-10-11
16:34:00 UTC (rev 3926)
+++
core/trunk/impl/src/main/java/org/jboss/weld/injection/ConstructorInjectionPoint.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -42,17 +42,17 @@
public class ConstructorInjectionPoint<T> extends
ForwardingWeldConstructor<T> implements WeldInjectionPoint<T,
Constructor<T>>
{
- private abstract class ForwardingParameterInjectionPointList extends
AbstractList<ParameterInjectionPoint<?, ?>>
+ private static abstract class ForwardingParameterInjectionPointList<T, X>
extends AbstractList<ParameterInjectionPoint<T, X>>
{
- protected abstract List<? extends WeldParameter<?, ?>> delegate();
+ protected abstract List<? extends WeldParameter<T, X>> delegate();
- protected abstract Bean<?> declaringBean();;
+ protected abstract Bean<X> declaringBean();;
@Override
- public ParameterInjectionPoint<?, ?> get(int index)
+ public ParameterInjectionPoint<T, X> get(int index)
{
- return ParameterInjectionPoint.of(declaringBean, delegate().get(index));
+ return ParameterInjectionPoint.of(declaringBean(), delegate().get(index));
}
@Override
@@ -65,16 +65,16 @@
private static final Annotation[] EMPTY_ANNOTATION_ARRAY = new Annotation[0];
- private final Bean<?> declaringBean;
+ private final Bean<T> declaringBean;
private final WeldConstructor<T> constructor;
private final boolean delegate;
- public static <T> ConstructorInjectionPoint<T> of(Bean<?>
declaringBean, WeldConstructor<T> constructor)
+ public static <T> ConstructorInjectionPoint<T> of(Bean<T>
declaringBean, WeldConstructor<T> constructor)
{
return new ConstructorInjectionPoint<T>(declaringBean, constructor);
}
- protected ConstructorInjectionPoint(Bean<?> declaringBean,
WeldConstructor<T> constructor)
+ protected ConstructorInjectionPoint(Bean<T> declaringBean,
WeldConstructor<T> constructor)
{
this.declaringBean = declaringBean;
this.constructor = constructor;
@@ -92,6 +92,7 @@
return declaringBean;
}
+ @Override
public Set<Annotation> getQualifiers()
{
return delegate().getQualifiers();
@@ -123,20 +124,20 @@
}
@Override
- public List<ParameterInjectionPoint<?, ?>> getWBParameters()
+ public List<ParameterInjectionPoint<?, T>> getWBParameters()
{
- final List<? extends WeldParameter<?, ?>> delegate =
super.getWBParameters();
+ final List<? extends WeldParameter<?, T>> delegate =
super.getWBParameters();
return new ForwardingParameterInjectionPointList()
{
@Override
- protected Bean<?> declaringBean()
+ protected Bean<T> declaringBean()
{
return declaringBean;
}
@Override
- protected List<? extends WeldParameter<?, ?>> delegate()
+ protected List<? extends WeldParameter<?, T>> delegate()
{
return delegate;
}
@@ -157,12 +158,12 @@
* @param manager The Bean manager
* @return The object array of looked up values
*/
- protected Object[] getParameterValues(List<ParameterInjectionPoint<?, ?>>
parameters,
+ protected Object[] getParameterValues(List<ParameterInjectionPoint<?, T>>
parameters,
Object specialVal, Class<? extends Annotation> specialParam,
BeanManagerImpl manager, CreationalContext<?> creationalContext)
{
Object[] parameterValues = new Object[parameters.size()];
- Iterator<ParameterInjectionPoint<?, ?>> iterator =
parameters.iterator();
+ Iterator<ParameterInjectionPoint<?, T>> iterator =
parameters.iterator();
for (int i = 0; i < parameterValues.length; i++)
{
ParameterInjectionPoint<?, ?> param = iterator.next();
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/injection/MethodInjectionPoint.java
===================================================================
---
core/trunk/impl/src/main/java/org/jboss/weld/injection/MethodInjectionPoint.java 2009-10-11
16:34:00 UTC (rev 3926)
+++
core/trunk/impl/src/main/java/org/jboss/weld/injection/MethodInjectionPoint.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -42,17 +42,17 @@
public class MethodInjectionPoint<T, X> extends ForwardingWeldMethod<T, X>
implements WeldInjectionPoint<T, Method>
{
- private abstract class ForwardingParameterInjectionPointList extends
AbstractList<ParameterInjectionPoint<?, ?>>
+ private static abstract class ForwardingParameterInjectionPointList<T, X>
extends AbstractList<ParameterInjectionPoint<T, X>>
{
- protected abstract List<? extends WeldParameter<?, ?>> delegate();
+ protected abstract List<? extends WeldParameter<T, X>> delegate();
- protected abstract Bean<?> declaringBean();;
+ protected abstract Bean<X> declaringBean();
@Override
- public ParameterInjectionPoint<?, ?> get(int index)
+ public ParameterInjectionPoint<T, X> get(int index)
{
- return ParameterInjectionPoint.of(declaringBean, delegate().get(index));
+ return ParameterInjectionPoint.of(declaringBean(), delegate().get(index));
}
@Override
@@ -92,6 +92,7 @@
return declaringBean;
}
+ @Override
public Set<Annotation> getQualifiers()
{
return delegate().getQualifiers();
@@ -200,9 +201,9 @@
}
@Override
- public List<ParameterInjectionPoint<?, ?>> getWBParameters()
+ public List<ParameterInjectionPoint<?, X>> getWBParameters()
{
- final List<? extends WeldParameter<?, ?>> delegate =
super.getWBParameters();
+ final List<? extends WeldParameter<?, X>> delegate =
super.getWBParameters();
return new ForwardingParameterInjectionPointList()
{
@@ -213,7 +214,7 @@
}
@Override
- protected List<? extends WeldParameter<?, ?>> delegate()
+ protected List<? extends WeldParameter<?, X>> delegate()
{
return delegate;
}
@@ -249,12 +250,12 @@
* @param manager The Bean manager
* @return The object array of looked up values
*/
- protected Object[] getParameterValues(List<ParameterInjectionPoint<?, ?>>
parameters,
+ protected Object[] getParameterValues(List<ParameterInjectionPoint<?, X>>
parameters,
Class<? extends Annotation> specialParam, Object specialVal,
BeanManagerImpl manager, CreationalContext<?> creationalContext)
{
Object[] parameterValues = new Object[parameters.size()];
- Iterator<ParameterInjectionPoint<?, ?>> iterator =
parameters.iterator();
+ Iterator<ParameterInjectionPoint<?, X>> iterator =
parameters.iterator();
for (int i = 0; i < parameterValues.length; i++)
{
ParameterInjectionPoint<?, ?> param = iterator.next();
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWeldConstructor.java
===================================================================
---
core/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWeldConstructor.java 2009-10-11
16:34:00 UTC (rev 3926)
+++
core/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWeldConstructor.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -29,17 +29,18 @@
@Override
protected abstract WeldConstructor<T> delegate();
- public List<WeldParameter<?, ?>> getAnnotatedWBParameters(Class<?
extends Annotation> annotationType)
+ public List<WeldParameter<?, T>> getAnnotatedWBParameters(Class<?
extends Annotation> annotationType)
{
return delegate().getAnnotatedWBParameters(annotationType);
}
+ @Override
public WeldClass<T> getDeclaringType()
{
return delegate().getDeclaringType();
}
- public List<? extends WeldParameter<?, ?>> getWBParameters()
+ public List<? extends WeldParameter<?, T>> getWBParameters()
{
return delegate().getWBParameters();
}
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWeldMethod.java
===================================================================
---
core/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWeldMethod.java 2009-10-11
16:34:00 UTC (rev 3926)
+++
core/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWeldMethod.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -34,7 +34,7 @@
return delegate().getAnnotatedMethod();
}
- public List<WeldParameter<?, ?>> getAnnotatedParameters(Class<? extends
Annotation> metaAnnotationType)
+ public List<WeldParameter<?, X>> getAnnotatedParameters(Class<? extends
Annotation> metaAnnotationType)
{
return delegate().getAnnotatedWBParameters(metaAnnotationType);
}
@@ -44,7 +44,7 @@
return delegate().getParameterTypesAsArray();
}
- public List<? extends WeldParameter<?, ?>> getWBParameters()
+ public List<? extends WeldParameter<?, X>> getWBParameters()
{
return delegate().getWBParameters();
}
@@ -74,7 +74,7 @@
return delegate().getSignature();
}
- public List<WeldParameter<?, ?>> getAnnotatedWBParameters(Class<?
extends Annotation> metaAnnotationType)
+ public List<WeldParameter<?, X>> getAnnotatedWBParameters(Class<?
extends Annotation> metaAnnotationType)
{
return delegate().getAnnotatedWBParameters(metaAnnotationType);
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/introspector/WeldCallable.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/introspector/WeldCallable.java 2009-10-11
16:34:00 UTC (rev 3926)
+++ core/trunk/impl/src/main/java/org/jboss/weld/introspector/WeldCallable.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -35,7 +35,7 @@
* @return A list of parameters. Returns an empty list if no parameters are
* present.
*/
- public List<? extends WeldParameter<?, ?>> getWBParameters();
+ public List<? extends WeldParameter<?, X>> getWBParameters();
/**
* Gets the list of annotated parameters for a given annotation
@@ -44,6 +44,6 @@
* @return A set of matching parameter abstractions. Returns an empty list if
* there are no matches.
*/
- public List<WeldParameter<?, ?>> getAnnotatedWBParameters(Class<?
extends Annotation> metaAnnotationType);
+ public List<WeldParameter<?, X>> getAnnotatedWBParameters(Class<?
extends Annotation> metaAnnotationType);
}
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WeldConstructorImpl.java
===================================================================
---
core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WeldConstructorImpl.java 2009-10-11
16:34:00 UTC (rev 3926)
+++
core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WeldConstructorImpl.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -60,9 +60,9 @@
private final Constructor<T> constructor;
// The list of parameter abstractions
- private final List<WeldParameter<?, ?>> parameters;
+ private final List<WeldParameter<?, T>> parameters;
// The mapping of annotation -> parameter abstraction
- private final ListMultimap<Class<? extends Annotation>, WeldParameter<?,
?>> annotatedParameters;
+ private final ListMultimap<Class<? extends Annotation>, WeldParameter<?,
T>> annotatedParameters;
private final ConstructorSignature signature;
@@ -95,13 +95,13 @@
this.toString = new StringBuilder().append("constructor
").append(constructor.toString()).toString();
this.constructor = constructor;
- this.parameters = new ArrayList<WeldParameter<?, ?>>();
- annotatedParameters = Multimaps.newListMultimap(new HashMap<Class<? extends
Annotation>, Collection<WeldParameter<?, ?>>>(), new Supplier<
List<WeldParameter<?, ?>>>()
+ this.parameters = new ArrayList<WeldParameter<?, T>>();
+ annotatedParameters = Multimaps.newListMultimap(new HashMap<Class<? extends
Annotation>, Collection<WeldParameter<?, T>>>(), new Supplier<
List<WeldParameter<?, T>>>()
{
- public List<WeldParameter<?, ?>> get()
+ public List<WeldParameter<?, T>> get()
{
- return new ArrayList<WeldParameter<?, ?>>();
+ return new ArrayList<WeldParameter<?, T>>();
}
});
@@ -122,7 +122,7 @@
{
Class<?> clazz = constructor.getParameterTypes()[i];
Type type = constructor.getGenericParameterTypes()[i];
- WeldParameter<?, ?> parameter = null;
+ WeldParameter<?, T> parameter = null;
if (annotatedTypeParameters.containsKey(i))
{
AnnotatedParameter<?> annotatedParameter =
annotatedTypeParameters.get(i);
@@ -152,7 +152,7 @@
{
type = clazz;
}
- WeldParameter<?, ?> parameter = WeldParameterImpl.of(new Annotation[0],
clazz, type, this, i, classTransformer);
+ WeldParameter<?, T> parameter = WeldParameterImpl.of(new Annotation[0],
clazz, type, this, i, classTransformer);
parameters.add(parameter);
for (Annotation annotation : parameter.getAnnotations())
@@ -194,7 +194,7 @@
*
* @see org.jboss.weld.introspector.WeldConstructor#getWBParameters()
*/
- public List<WeldParameter<?, ?>> getWBParameters()
+ public List<WeldParameter<?, T>> getWBParameters()
{
return Collections.unmodifiableList(parameters);
}
@@ -210,7 +210,7 @@
*
* @see org.jboss.weld.introspector.WeldConstructor#getAnnotatedWBParameters(Class)
*/
- public List<WeldParameter<?, ?>> getAnnotatedWBParameters(Class<?
extends Annotation> annotationType)
+ public List<WeldParameter<?, T>> getAnnotatedWBParameters(Class<?
extends Annotation> annotationType)
{
return Collections.unmodifiableList(annotatedParameters.get(annotationType));
}
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WeldMethodImpl.java
===================================================================
---
core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WeldMethodImpl.java 2009-10-11
16:34:00 UTC (rev 3926)
+++
core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/WeldMethodImpl.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -61,10 +61,10 @@
private final Method method;
// The abstracted parameters
- private final List<WeldParameter<?, ?>> parameters;
+ private final List<WeldParameter<?, X>> parameters;
// A mapping from annotation type to parameter abstraction with that
// annotation present
- private final ListMultimap<Class<? extends Annotation>, WeldParameter<?,
?>> annotatedParameters;
+ private final ListMultimap<Class<? extends Annotation>, WeldParameter<?,
X>> annotatedParameters;
// The property name
private final String propertyName;
@@ -101,13 +101,13 @@
super(annotationStore, method, (Class<T>) method.getReturnType(),
method.getGenericReturnType(), declaringClass);
this.method = method;
this.toString = new StringBuilder().append("method
").append(method.toString()).toString();
- this.parameters = new ArrayList<WeldParameter<?, ?>>();
- this.annotatedParameters = Multimaps.newListMultimap(new HashMap<Class<?
extends Annotation>, Collection<WeldParameter<?, ?>>>(), new
Supplier< List<WeldParameter<?, ?>>>()
+ this.parameters = new ArrayList<WeldParameter<?, X>>();
+ this.annotatedParameters = Multimaps.newListMultimap(new HashMap<Class<?
extends Annotation>, Collection<WeldParameter<?, X>>>(), new
Supplier<List<WeldParameter<?, X>>>()
{
- public List<WeldParameter<?, ?>> get()
+ public List<WeldParameter<?, X>> get()
{
- return new ArrayList<WeldParameter<?, ?>>();
+ return new ArrayList<WeldParameter<?, X>>();
}
});
@@ -128,7 +128,7 @@
{
Class<? extends Object> clazz = method.getParameterTypes()[i];
Type type = method.getGenericParameterTypes()[i];
- WeldParameter<?, ?> parameter = null;
+ WeldParameter<?, X> parameter = null;
if (annotatedTypeParameters.containsKey(i))
{
AnnotatedParameter<?> annotatedParameter =
annotatedTypeParameters.get(i);
@@ -151,7 +151,7 @@
{
Class<? extends Object> clazz = method.getParameterTypes()[i];
Type type = method.getGenericParameterTypes()[i];
- WeldParameter<?, ?> parameter = WeldParameterImpl.of(new Annotation[0],
(Class<Object>) clazz, type, this, i, classTransformer);
+ WeldParameter<?, X> parameter = WeldParameterImpl.of(new Annotation[0],
(Class<Object>) clazz, type, this, i, classTransformer);
this.parameters.add(parameter);
}
}
@@ -180,7 +180,7 @@
return method;
}
- public List<WeldParameter<?, ?>> getWBParameters()
+ public List<WeldParameter<?, X>> getWBParameters()
{
return Collections.unmodifiableList(parameters);
}
@@ -190,7 +190,7 @@
return method.getParameterTypes();
}
- public List<WeldParameter<?, ?>> getAnnotatedWBParameters(Class<?
extends Annotation> annotationType)
+ public List<WeldParameter<?, X>> getAnnotatedWBParameters(Class<?
extends Annotation> annotationType)
{
return Collections.unmodifiableList(annotatedParameters.get(annotationType));
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java 2009-10-11 16:34:00 UTC
(rev 3926)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java 2009-10-11 16:37:25 UTC
(rev 3927)
@@ -17,9 +17,8 @@
package org.jboss.weld.util;
import java.lang.annotation.Annotation;
+import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
-import java.lang.reflect.Member;
-import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -40,11 +39,10 @@
import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.Interceptor;
-import javax.enterprise.inject.spi.AnnotatedMethod;
import javax.inject.Inject;
-import javax.interceptor.AroundInvoke;
+import org.jboss.interceptor.model.InterceptionType;
+import org.jboss.interceptor.model.InterceptionTypeRegistry;
import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.DefinitionException;
import org.jboss.weld.bean.AbstractProducerBean;
@@ -59,15 +57,19 @@
import org.jboss.weld.injection.spi.EjbInjectionServices;
import org.jboss.weld.injection.spi.JpaInjectionServices;
import org.jboss.weld.injection.spi.ResourceInjectionServices;
-import org.jboss.weld.introspector.*;
+import org.jboss.weld.introspector.MethodSignature;
+import org.jboss.weld.introspector.WeldClass;
+import org.jboss.weld.introspector.WeldConstructor;
+import org.jboss.weld.introspector.WeldField;
+import org.jboss.weld.introspector.WeldMember;
+import org.jboss.weld.introspector.WeldMethod;
+import org.jboss.weld.introspector.WeldParameter;
import org.jboss.weld.log.Log;
import org.jboss.weld.log.Logging;
import org.jboss.weld.metadata.cache.BindingTypeModel;
import org.jboss.weld.metadata.cache.InterceptorBindingModel;
import org.jboss.weld.metadata.cache.MetaAnnotationStore;
import org.jboss.weld.persistence.PersistenceApiAbstraction;
-import org.jboss.interceptor.model.InterceptionType;
-import org.jboss.interceptor.model.InterceptionTypeRegistry;
import com.google.common.base.Supplier;
import com.google.common.collect.Multimap;
@@ -576,7 +578,7 @@
return false;
}
- public static <T> ConstructorInjectionPoint<T>
getBeanConstructor(Bean<?> declaringBean, WeldClass<T> type)
+ public static <T> ConstructorInjectionPoint<T>
getBeanConstructor(Bean<T> declaringBean, WeldClass<T> type)
{
ConstructorInjectionPoint<T> constructor = null;
Set<WeldConstructor<T>> initializerAnnotatedConstructors =
type.getAnnotatedWeldConstructors(Inject.class);
Modified: core/trunk/jboss-as/build.properties
===================================================================
--- core/trunk/jboss-as/build.properties 2009-10-11 16:34:00 UTC (rev 3926)
+++ core/trunk/jboss-as/build.properties 2009-10-11 16:37:25 UTC (rev 3927)
@@ -1,6 +1,6 @@
# Container a number of properties associated with installing Weld into JBoss AS and
running the TCK in JBoss AS
jboss.home=/Applications/jboss-5.2.0.Beta
-org.jboss.testharness.container.javaOpts=-Xms128m -Xmx384m -XX:MaxPermSize=128m
-Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000
-Dsun.rmi.dgc.server.gcInterval=3600000
+org.jboss.testharness.container.javaOpts=-Xms128m -Xmx384m -XX:MaxPermSize=192m
-Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000
-Dsun.rmi.dgc.server.gcInterval=3600000
# time to allow before attempting to restart JBoss AS
# org.jboss.testharness.container.shutdownDelay=15000
Modified:
core/trunk/tests/src/main/java/org/jboss/weld/mock/MockBeanDeploymentArchive.java
===================================================================
---
core/trunk/tests/src/main/java/org/jboss/weld/mock/MockBeanDeploymentArchive.java 2009-10-11
16:34:00 UTC (rev 3926)
+++
core/trunk/tests/src/main/java/org/jboss/weld/mock/MockBeanDeploymentArchive.java 2009-10-11
16:37:25 UTC (rev 3927)
@@ -24,6 +24,7 @@
import java.util.List;
import java.util.Set;
+import javax.ejb.EnterpriseBean;
import javax.ejb.MessageDriven;
import javax.ejb.Singleton;
import javax.ejb.Stateful;
@@ -94,7 +95,7 @@
Set<Class<?>> ejbs = new HashSet<Class<?>>();
for (Class<?> clazz : webBeanClasses)
{
- if (clazz.isAnnotationPresent(Stateless.class) ||
clazz.isAnnotationPresent(Stateful.class) ||
clazz.isAnnotationPresent(MessageDriven.class) ||
clazz.isAnnotationPresent(Singleton.class))
+ if (clazz.isAnnotationPresent(Stateless.class) ||
clazz.isAnnotationPresent(Stateful.class) ||
clazz.isAnnotationPresent(MessageDriven.class) ||
clazz.isAnnotationPresent(Singleton.class) ||
EnterpriseBean.class.isAssignableFrom(clazz))
{
ejbs.add(clazz);
}