[seam-commits] Seam SVN: r12436 - in modules/xml/trunk: impl/src/main/java/org/jboss/seam/xml/bootstrap and 1 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Mon Apr 12 17:28:52 EDT 2010
Author: swd847
Date: 2010-04-12 17:28:51 -0400 (Mon, 12 Apr 2010)
New Revision: 12436
Added:
modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/bootstrap/XmlProcessAnnotatedType.java
modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/core/XmlConfiguredBean.java
Modified:
modules/xml/trunk/docs/en-US/master.xml
modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/bootstrap/XmlExtension.java
Log:
fire ProcessAnnotatedType for XML configured beans. This is temporary until WELD-485 is fixed
Modified: modules/xml/trunk/docs/en-US/master.xml
===================================================================
--- modules/xml/trunk/docs/en-US/master.xml 2010-04-12 21:15:52 UTC (rev 12435)
+++ modules/xml/trunk/docs/en-US/master.xml 2010-04-12 21:28:51 UTC (rev 12436)
@@ -6,6 +6,7 @@
<toc/>
<title>Seam XML Configuration</title>
+ <xi:include href="xml-introduction.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="xml-general.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</book>
\ No newline at end of file
Modified: modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/bootstrap/XmlExtension.java
===================================================================
--- modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/bootstrap/XmlExtension.java 2010-04-12 21:15:52 UTC (rev 12435)
+++ modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/bootstrap/XmlExtension.java 2010-04-12 21:28:51 UTC (rev 12436)
@@ -18,12 +18,15 @@
import javax.enterprise.event.Observes;
import javax.enterprise.inject.spi.AfterBeanDiscovery;
import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.BeforeBeanDiscovery;
import javax.enterprise.inject.spi.Extension;
import javax.enterprise.inject.spi.ProcessAnnotatedType;
import javax.enterprise.inject.spi.ProcessInjectionTarget;
+import javax.enterprise.util.AnnotationLiteral;
import org.jboss.seam.xml.core.BeanResult;
+import org.jboss.seam.xml.core.XmlConfiguredBean;
import org.jboss.seam.xml.core.XmlId;
import org.jboss.seam.xml.core.XmlResult;
import org.jboss.seam.xml.fieldset.FieldValueObject;
@@ -59,7 +62,7 @@
List<Exception> errors = new ArrayList<Exception>();
- Set<XmlProcessAnnotatedType<?>> queuedEvents = new HashSet<XmlProcessAnnotatedType<?>>();
+ Set<XmlProcessAnnotatedType> queuedEvents = new HashSet<XmlProcessAnnotatedType>();
/**
* This is the entry point for the extension
@@ -127,9 +130,12 @@
}
for (BeanResult<?> bb : r.getBeans())
{
-
+ bb.getBuilder().addToClass(new AnnotationLiteral<XmlConfiguredBean>()
+ {
+ });
AnnotatedType<?> tp = bb.getBuilder().create();
log.info("Adding XML definied bean: " + tp.getJavaClass().getName());
+ queuedEvents.add(new XmlProcessAnnotatedType(tp));
event.addAnnotatedType(tp);
}
@@ -138,13 +144,22 @@
}
}
- public <T> void processAnotated(@Observes ProcessAnnotatedType<T> event)
+ public <T> void processAnotated(@Observes ProcessAnnotatedType<T> event, BeanManager manager)
{
- // do not re-process events that we fired
- if (event instanceof XmlProcessAnnotatedType<?>)
+ if (event.getAnnotatedType().isAnnotationPresent(XmlConfiguredBean.class))
{
return;
}
+ // first see if we should fire queued events
+ if (!queuedEvents.isEmpty())
+ {
+ for (XmlProcessAnnotatedType i : queuedEvents)
+ {
+ manager.fireEvent(i);
+ }
+ queuedEvents.clear();
+ }
+
// veto implementation
if (veto.contains(event.getAnnotatedType().getJavaClass()))
{
Added: modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/bootstrap/XmlProcessAnnotatedType.java
===================================================================
--- modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/bootstrap/XmlProcessAnnotatedType.java (rev 0)
+++ modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/bootstrap/XmlProcessAnnotatedType.java 2010-04-12 21:28:51 UTC (rev 12436)
@@ -0,0 +1,29 @@
+package org.jboss.seam.xml.bootstrap;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+
+public class XmlProcessAnnotatedType implements ProcessAnnotatedType
+{
+ final AnnotatedType annotatedType;
+
+ XmlProcessAnnotatedType(AnnotatedType annotatedType)
+ {
+ this.annotatedType = annotatedType;
+ }
+
+ public AnnotatedType getAnnotatedType()
+ {
+ return annotatedType;
+ }
+
+ public void setAnnotatedType(AnnotatedType type)
+ {
+ // nop for now
+ }
+
+ public void veto()
+ {
+ // nop for now
+ }
+}
Added: modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/core/XmlConfiguredBean.java
===================================================================
--- modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/core/XmlConfiguredBean.java (rev 0)
+++ modules/xml/trunk/impl/src/main/java/org/jboss/seam/xml/core/XmlConfiguredBean.java 2010-04-12 21:28:51 UTC (rev 12436)
@@ -0,0 +1,16 @@
+package org.jboss.seam.xml.core;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * marker for XML configured annotated types
+ *
+ * @author stuart
+ *
+ */
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface XmlConfiguredBean
+{
+
+}
More information about the seam-commits
mailing list