Weld SVN: r4938 - doc/trunk/reference/en-US.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-11-10 00:02:06 -0500 (Tue, 10 Nov 2009)
New Revision: 4938
Modified:
doc/trunk/reference/en-US/master.xml
doc/trunk/reference/en-US/part1.xml
Log:
updates
Modified: doc/trunk/reference/en-US/master.xml
===================================================================
--- doc/trunk/reference/en-US/master.xml 2009-11-10 04:37:59 UTC (rev 4937)
+++ doc/trunk/reference/en-US/master.xml 2009-11-10 05:02:06 UTC (rev 4938)
@@ -33,7 +33,7 @@
<toc/>
<part id="1">
- <title>Loosely-coupled, contextual components with strong typing</title>
+ <title>Beans</title>
<xi:include href="part1.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
Modified: doc/trunk/reference/en-US/part1.xml
===================================================================
--- doc/trunk/reference/en-US/part1.xml 2009-11-10 04:37:59 UTC (rev 4937)
+++ doc/trunk/reference/en-US/part1.xml 2009-11-10 05:02:06 UTC (rev 4938)
@@ -65,14 +65,11 @@
<itemizedlist>
<listitem>
- <para>managed beans</para>
+ <para>managed beans, and</para>
</listitem>
<listitem>
- <para>EJB session beans, and</para>
+ <para>EJB session beans.</para>
</listitem>
- <listitem>
- <para>JAX-RS resources.</para>
- </listitem>
</itemizedlist>
<para>
14 years, 7 months
Weld SVN: r4937 - doc/trunk/reference/en-US.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-11-09 23:37:59 -0500 (Mon, 09 Nov 2009)
New Revision: 4937
Modified:
doc/trunk/reference/en-US/events.xml
doc/trunk/reference/en-US/injection.xml
Log:
updates
Modified: doc/trunk/reference/en-US/events.xml
===================================================================
--- doc/trunk/reference/en-US/events.xml 2009-11-10 04:19:00 UTC (rev 4936)
+++ doc/trunk/reference/en-US/events.xml 2009-11-10 04:37:59 UTC (rev 4937)
@@ -93,7 +93,7 @@
<para>
Event producers fire events using an instance of the parameterized <literal>Event</literal> interface.
- An instance of this interface are obtained by injection:
+ An instance of this interface is obtained by injection:
</para>
<programlisting role="JAVA"><![CDATA[@Inject @Any Event<Document> documentEvent;]]></programlisting>
@@ -126,27 +126,27 @@
</para>
<para>
- Qualifiers can be applied to an event type in one of two ways:
+ Qualifiers can be applied to an event in one of two ways:
</para>
<itemizedlist>
<listitem>
- <para>Add qualifier annotations to the field where <literal>Event</literal> is injected or</para>
+ <para>by annotating the <literal>Event</literal> injection point, or</para>
</listitem>
<listitem>
- <para>pass qualifier annotation literals to the <literal>select()</literal> of <literal>Event</literal>.</para>
+ <para>by passing qualifiers to the <literal>select()</literal> of <literal>Event</literal>.</para>
</listitem>
</itemizedlist>
<para>
- The first option is the simplest:
+ Specifying the qualifiers at the injection point is far simpler:
</para>
<programlisting role="JAVA"><![CDATA[@Inject @Updated Event<Document> documentUpdatedEvent;]]></programlisting>
<para>
Then, every event fired via this instance of <literal>Event</literal> has the event qualifier
- <literal>@Updated</literal>. The event will be delivered to every observer method that:
+ <literal>@Updated</literal>. The event is delivered to every observer method that:
</para>
<itemizedlist>
@@ -162,50 +162,39 @@
</itemizedlist>
<para>
- The downside of annotating the injection point is that you can not specify the qualifiers dynamically.
- Fortunately, CDI provides an alternative way of generating derived <literal>Event</literal> instances
- from an <literal>Event</literal> instance using the <literal>select()</literal> method and passing
- in qualifier annotation literals. Events can then be fired from that narrower source:
+ The downside of annotating the injection point is that we can't specify the qualifier dynamically. CDI
+ lets us obtain a qualifier instance by subclassing the helper class <literal>AnnotationLiteral</literal>.
+ That way, we can pass the qualifier to the <literal>select()</literal> method of <literal>Event</literal>.
</para>
<programlisting role="JAVA"><![CDATA[documentEvent.select(new AnnotationLiteral<Updated>(){}).fire(document);]]></programlisting>
-
- <para>
- There is no difference between the firing of this event and the previous one, were the qualifiers were
- specified at the injection point. Both events carry the <literal>@Updated</literal> qualifier.
- </para>
<para>
- As mentioned earlier, the helper class <literal>AnnotationLiteral</literal> makes it possible to instantiate
- qualifiers inline, since this is otherwise difficult to do in Java.
+ Events can have multiple event qualifiers, assembled using any combination of annotations at the
+ <literal>Event</literal> injection point and qualifier instances passed to the <literal>select()</literal>
+ method.
</para>
- <para>
- Event types can have multiple event qualifier types as well, assembled using any combination of annotations
- at the injection point and annotations passed to the <literal>select()</literal> method.
- </para>
-
</section>
<section>
<title>Conditional observer methods</title>
<para>
- Normally, observer beans will be "woken up", so to speak, when an event is fired so that they can respond to
- the event. This behavior isn't always what you want. You may be interested in delivering an event only to
- instances of the observers that exist in one of the currently active contexts.
+ By default, if there is no instance of an observer in the current context, the container will instantiate the
+ observer in order to deliver an event to it. This behavior isn't always desirable. We may want to deliver events
+ only to instances of the observer that already exist in the current contexts.
</para>
<para>
- A conditional observer is specified by adding <literal>receive = IF_EXISTS</literal> to the
- <literal>@Observes</literal> annotation. The default is to always receive, which means creating
- an instance of the bean.
+ A conditional observer is specified by adding <literal>receive = IF_EXISTS</literal> to the <literal>@Observes</literal>
+ annotation.
</para>
<programlisting role="JAVA"><![CDATA[public void refreshOnDocumentUpdate(@Observes(receive = IF_EXISTS) @Updated Document d) { ... }]]></programlisting>
<para>
- A dependent-scoped bean cannot be a conditional observer, essentially because it's not a contextual bean.
+ A bean with scope <literal>@Dependent</literal> cannot be a conditional observer, since it would never be called!
</para>
</section>
@@ -313,8 +302,8 @@
</itemizedlist>
<para>
- Transactional observers are very important in a stateful object model because state is often held for longer
- than a single atomic transaction.
+ Transactional observers are very important in a stateful object model because state is often held for
+ longer than a single atomic transaction.
</para>
<para>Imagine that we have cached a JPA query result set in the application scope:</para>
Modified: doc/trunk/reference/en-US/injection.xml
===================================================================
--- doc/trunk/reference/en-US/injection.xml 2009-11-10 04:19:00 UTC (rev 4936)
+++ doc/trunk/reference/en-US/injection.xml 2009-11-10 04:37:59 UTC (rev 4937)
@@ -526,12 +526,30 @@
<programlisting role="JAVA"><![CDATA[PaymentProcessor p = paymentProcessorSource.get();]]></programlisting>
<para>
- Qualifiers can be specified at the injection point:
+ Qualifiers can be specified in one of two ways:
</para>
+ <itemizedlist>
+ <listitem>
+ <para>by annotating the <literal>Instance</literal> injection point, or</para>
+ </listitem>
+ <listitem>
+ <para>by passing qualifiers to the <literal>select()</literal> of <literal>Event</literal>.</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>
+ Specifying the qualifiers at the injection point is much, much easier:
+ </para>
+
<programlisting role="JAVA"><![CDATA[@Inject @Asynchronous Instance<PaymentProcessor> paymentProcessorSource;]]></programlisting>
-
+
<para>
+ Now, the <literal>PaymentProcessor</literal> returned by <literal>get()</literal> will have the qualifier
+ <literal>@Asynchronous</literal>.
+ </para>
+
+ <para>
Alternatively, we can specify the qualifier dynamically. First, we add the <literal>@Any</literal> qualifier to
the injection point, to suppress the default qualifier. (All beans have the qualifier <literal>@Any</literal>.)
</para>
14 years, 7 months
Weld SVN: r4936 - doc/trunk/reference/en-US.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-11-09 23:19:00 -0500 (Mon, 09 Nov 2009)
New Revision: 4936
Modified:
doc/trunk/reference/en-US/part3.xml
Log:
ws
Modified: doc/trunk/reference/en-US/part3.xml
===================================================================
--- doc/trunk/reference/en-US/part3.xml 2009-11-10 04:14:25 UTC (rev 4935)
+++ doc/trunk/reference/en-US/part3.xml 2009-11-10 04:19:00 UTC (rev 4936)
@@ -10,7 +10,7 @@
<para>
You don't see string-based identifiers in CDI code, not because the framework is hiding them from you using clever
- defaulting rules — so-called "configuration by convention" — but because there are simply no strings
+ defaulting rules—so-called "configuration by convention"—but because there are simply no strings
there to begin with!
</para>
14 years, 7 months
Weld SVN: r4935 - doc/trunk/reference/en-US.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-11-09 23:14:25 -0500 (Mon, 09 Nov 2009)
New Revision: 4935
Modified:
doc/trunk/reference/en-US/specialization.xml
doc/trunk/reference/en-US/stereotypes.xml
Log:
updates
Modified: doc/trunk/reference/en-US/specialization.xml
===================================================================
--- doc/trunk/reference/en-US/specialization.xml 2009-11-10 03:56:39 UTC (rev 4934)
+++ doc/trunk/reference/en-US/specialization.xml 2009-11-10 04:14:25 UTC (rev 4935)
@@ -17,18 +17,22 @@
The CDI specification recognizes two distinct scenarios in which one bean extends another:
</para>
+ <blockquote>
<itemizedlist>
<listitem>
<para>
- The second bean specializes the first bean in certain deployment scenarios. In these deployments, the second
- bean completely replaces the first, fulfilling the same role in the system.
+ The second bean <emphasis>specializes</emphasis> the first bean in certain deployment scenarios. In these
+ deployments, the second bean completely replaces the first, fulfilling the same role in the system.
</para>
+ </listitem>
+ <listitem>
<para>
The second bean is simply reusing the Java implementation, and otherwise bears no relation to the first
bean. The first bean may not even have been designed for use as a contextual object.
</para>
</listitem>
</itemizedlist>
+ </blockquote>
<para>
The second case is the default assumed by CDI. It's possible to have two beans in the system with the same part
@@ -39,15 +43,15 @@
<para>
The first case is the exception, and also requires more care. In any given deployment, only one bean can fulfill a
given role at a time. That means one bean needs to be enabled and the other disabled. There are a two modifiers
- involved: <literal>@Alternative</literal> and <literal>@Specializes</literal>. We'll start by looking at bean
+ involved: <literal>@Alternative</literal> and <literal>@Specializes</literal>. We'll start by looking at
alternatives and then show the guarantees that specialization adds.
</para>
<section id="alternatives">
- <title>Bean alternatives</title>
+ <title>Alternatives</title>
<para>
- CDI let's you <emphasis>override</emphasis> the implementation of a bean type at deployment time using a bean
+ CDI lets you <emphasis>override</emphasis> the implementation of a bean type at deployment time using an
alternative. For example, the following bean provides an implementation of the
<literal>PaymentProcessor</literal> bean type in the default environment:
</para>
@@ -144,7 +148,7 @@
<programlisting role="JAVA"><![CDATA[@LargeTransaction @CreditCard PaymentProcessor paymentProcessor;]]></programlisting>
<para>
- So we haven't completely replaced the default implementation in a particular deployment of the system. The only
+ So we haven't completely replaced the default implementation in this deployment of the system. The only
way one bean can completely override a second bean at all injection points is if it implements all the bean
types and declares all the qualifiers of the second bean. However, if the second bean declares a producer
method or observer method, then even this is not enough to ensure that the second bean is never called! We need
@@ -191,25 +195,20 @@
When an enabled bean specializes another bean, the other bean is never instantiated or called by the container.
Even if the other bean defines a producer or observer method, the method will never be called.
</para>
- </section>
-
- <section>
- <title>Inheritance</title>
-
+
<para>
So why does specialization work, and what does it have to do with inheritance?
</para>
<para>
- Since you are informing the container that your alternative bean is meant to stand in as a replacement for the
- default implementation, the container automatically adds any qualifiers that are on the default implementation
- to the alternative implementation. Thus, in our example, <literal>MockCreditCardPaymentProcessor</literal> has
- the qualifiers <literal>@Default</literal> and <literal>@CreditCard</literal>. Therefore, there are no
- circumstances when the default implementation is going to get used because it is completely shadowed.
+ Since we're informing the container that our alternative bean is meant to stand in as a replacement for the
+ default implementation, the alternative implementation automatically inherits all qualifiers of the default
+ implementation. Thus, in our example, <literal>MockCreditCardPaymentProcessor</literal> inherits the qualifiers
+ <literal>@Default</literal> and <literal>@CreditCard</literal>.
</para>
<para>
- Additionally, if the default implementation declares a bean EL name using <literal>@Named</literal>, the name
+ Furthermore, if the default implementation declares a bean EL name using <literal>@Named</literal>, the name
is inherited by the specialized alternative bean.
</para>
Modified: doc/trunk/reference/en-US/stereotypes.xml
===================================================================
--- doc/trunk/reference/en-US/stereotypes.xml 2009-11-10 03:56:39 UTC (rev 4934)
+++ doc/trunk/reference/en-US/stereotypes.xml 2009-11-10 04:14:25 UTC (rev 4935)
@@ -143,6 +143,7 @@
<para>
A stereotype can indicate that all beans to which it is applied are <literal>@Alternative</literal>s.
+ An <emphasis>alternative stereotype</emphasis> lets us classify beans by deployment scenario.
</para>
<programlisting role="JAVA"><![CDATA[@Alternative
@@ -158,12 +159,14 @@
<programlisting role="JAVA"><![CDATA[@Mock
public class MockLoginAction extends LoginAction { ... }]]></programlisting>
-
+<!--
<programlisting role="JAVA"><![CDATA[<beans>
<alternatives>
<stereotype>org.mycompany.testing.Mock</stereotype>
</alternatives>
</beans>]]></programlisting>
+-->
+
</section>
<section>
@@ -177,7 +180,8 @@
</para>
<para>
- Here's an example that combines the <literal>@Action</literal> and <literal>@Auditable</literal> stereotypes:
+ Here's an example that combines the <literal>@Action</literal> and <literal>@Auditable</literal>
+ stereotypes:
</para>
<programlisting role="JAVA"><![CDATA[@Auditable
14 years, 7 months
Weld SVN: r4934 - doc/trunk/reference/en-US.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-11-09 22:56:39 -0500 (Mon, 09 Nov 2009)
New Revision: 4934
Modified:
doc/trunk/reference/en-US/events.xml
doc/trunk/reference/en-US/stereotypes.xml
Log:
updates
Modified: doc/trunk/reference/en-US/events.xml
===================================================================
--- doc/trunk/reference/en-US/events.xml 2009-11-10 03:43:13 UTC (rev 4933)
+++ doc/trunk/reference/en-US/events.xml 2009-11-10 03:56:39 UTC (rev 4934)
@@ -5,80 +5,55 @@
<para>
Dependency injection enables loose-coupling by allowing the implementation of the injected bean type to vary,
- either a deployment time or runtime. Events provide a whole other level of decoupling in which there is no compile
- time dependency between the interacting beans at all. Event <emphasis>producers</emphasis> raise (or fire) events
- that are delivered to event <emphasis>observers</emphasis>, an exchange orchestrated by the container.
+ either a deployment time or runtime. Events go one step further, allowing beans to interact with no compile
+ time dependency at all. Event <emphasis>producers</emphasis> raise events that are delivered to event
+ <emphasis>observers</emphasis> by the container.
</para>
- <para>
- CDI provides an event notification facility like the one just described. It does so using the same type safe
- approach that you've become accustomed to with CDI's dependency injection service. In fact, it consists of all the
- same ingredients:
- </para>
-
+ <para>This basic schema might sound like the familiar observer/observable pattern, but there are a couple of
+ twists:</para>
+
<itemizedlist>
- <listitem><para>bean types,</para></listitem>
- <listitem><para>qualifier annotations and</para></listitem>
- <listitem><para>type-safe resolution.</para></listitem>
- </itemizedlist>
-
- <para>
- It also supports a couple of convenient features that extend beyond the basic observer/observable pattern:
- </para>
-
- <itemizedlist>
<listitem>
- <para>events are qualified using annotations on the event producer object,</para>
+ <para>not only are event producers decoupled from observers; observers are completely decoupled from
+ producers,</para>
</listitem>
<listitem>
- <para>observers are completely decoupled from producers,</para>
- </listitem>
- <listitem>
<para>
- observers can specify a combination of "selectors" to narrow the set of event notifications (described by
- qualifiers) they will receive, and
+ observers can specify a combination of "selectors" to narrow the set of event notifications they will
+ receive, and
</para>
</listitem>
<listitem>
<para>
- observers can be notified immediately, or can specify that delivery of the event should be delayed until the
- end of the current transaction (a very useful feature for enterprise web applications).
+ observers can be notified immediately, or can specify that delivery of the event should be delayed until
+ the end of the current transaction.
</para>
</listitem>
</itemizedlist>
-
- <para>
- Before getting into how events are produced, let's first consider what's used as the event payload and how those
- events are observed. We'll then hook everything together by looking at how an event is fired.
- </para>
-
+
+ <para>The CDI event notification facility uses more or less the same typesafe approach that we've already
+ seen with the dependency injection service.</para>
+
<section>
<title>Event payload</title>
<para>
- The event payload carries state from producer to consumer. The event is nothing more than a plain Java
- object--an instance of any Java type. (The only restriction is that an event type may not contain type
- variables). No special interfaces or wrappers. In addition, that object can be assigned qualifiers, which helps
- observers distinguish it from other events of the same type. In a way, the qualifiers are like topic selectors,
- since they allow the observers to narrow the set of events it observes.
+ The event object carries state from producer to consumer. The event object is nothing more than an instance of
+ a concrete Java class. (The only restriction is that an event type may not contain type variables). An event
+ may be assigned qualifiers, which allows observers to distinguish it from other events of the same type. The
+ qualifiers function like topic selectors, allowing an observer to narrow the set of events it observes.
</para>
<para>
- So what's an event qualifier? An event qualifier is just a normal qualifier, the same ones you assigned to
- beans and injection points. Here's an example.
+ An event qualifier is just a normal qualifier, defined using <literal>@Qualifier</literal>. Here's an example:
</para>
<programlisting role="JAVA"><![CDATA[@Qualifier
@Target({FIELD, PARAMETER})
@Retention(RUNTIME)
-public @interface Updated {}]]></programlisting>
+public @interface Updated {}]]></programlisting>
- <para>
- These qualifiers may or may not come into play when selecting an observer. As before, a qualifier type can have
- members. Those members are considered as well when selecting an observer. However, only if the member is not
- annotated <literal>@NonBinding</literal>, which causes it to be ignored by the selection process.
- </para>
-
</section>
<section>
@@ -93,26 +68,20 @@
<para>
The annotated parameter is called the <emphasis>event parameter</emphasis>. The type of the event parameter is
- the observed <emphasis>event type</emphasis>, in this case <literal>Document</literal>, a class in the
- application. Observer methods may also specify "selectors", which are just qualifiers, as just described. When
- a qualifier is used as an event selector, it's called an <emphasis>event qualifier type</emphasis>.
+ the observed <emphasis>event type</emphasis>, in this case <literal>Document</literal>. The event parameter may
+ also specify qualifiers.
</para>
- <para>
- We specify the event qualifiers of the observer method by annotating the event parameter:
- </para>
-
<programlisting role="JAVA"><![CDATA[public void afterDocumentUpdate(@Observes @Updated Document document) { ... }]]></programlisting>
<para>
- An observer method need not specify any event qualifiers — in this case it is interested in
- <emphasis>all</emphasis> events of a particular type. If it does specify event bindings, it's only interested
- in events which also have those qualifiers.
+ An observer method need not specify any event qualifiers—in this case it is interested in
+ <emphasis>all</emphasis> events of a particular type. If it does specify qualifiers, it's only interested
+ in events which have those qualifiers.
</para>
<para>
- The observer method may have <emphasis>additional</emphasis> parameters, which are injected according to the
- usual bean method parameter injection semantics:
+ The observer method may have additional parameters, which are injection points:
</para>
<programlisting role="JAVA"><![CDATA[public void afterDocumentUpdate(@Observes @Updated Document document, User user) { ... }]]></programlisting>
@@ -120,18 +89,18 @@
</section>
<section>
- <title>Event producers (Firing events)</title>
+ <title>Event producers</title>
<para>
- Producers (i.e., beans) fire events using an instance of the parameterized <literal>Event</literal> interface.
- Instances of this interface are obtained through injection:
+ Event producers fire events using an instance of the parameterized <literal>Event</literal> interface.
+ An instance of this interface are obtained by injection:
</para>
<programlisting role="JAVA"><![CDATA[@Inject @Any Event<Document> documentEvent;]]></programlisting>
<para>
A producer raises events by calling the <literal>fire()</literal> method of the <literal>Event</literal>
- interface, passing an <emphasis>event object</emphasis>:
+ interface, passing the event object:
</para>
<programlisting role="JAVA"><![CDATA[documentEvent.fire(document);]]></programlisting>
@@ -142,10 +111,11 @@
<itemizedlist>
<listitem>
- <para>has an event parameter to which the event object is assignable (i.e., <literal>Document</literal>), and</para>
+ <para>has an event parameter to which the event object (the <literal>Document</literal>) is assignable,
+ and</para>
</listitem>
<listitem>
- <para>specifies no qualifier bindings.</para>
+ <para>specifies no qualifiers.</para>
</listitem>
</itemizedlist>
@@ -185,8 +155,8 @@
</listitem>
<listitem>
<para>
- does not have any event qualifier <emphasis>except</emphasis> for the event qualifiers that match those
- on the producer (in this case at the <literal>Event</literal> inject point).
+ does not have any event qualifier <emphasis>except</emphasis> for the event qualifiers that match
+ those specified at the <literal>Event</literal> injection point.
</para>
</listitem>
</itemizedlist>
Modified: doc/trunk/reference/en-US/stereotypes.xml
===================================================================
--- doc/trunk/reference/en-US/stereotypes.xml 2009-11-10 03:43:13 UTC (rev 4933)
+++ doc/trunk/reference/en-US/stereotypes.xml 2009-11-10 03:56:39 UTC (rev 4934)
@@ -10,7 +10,7 @@
<para>
In many systems, use of architectural patterns produces a set of recurring bean roles. A stereotype allows a
- framework de- veloper to identify such a role and declare some common metadata for beans with that role in a
+ framework developer to identify such a role and declare some common metadata for beans with that role in a
central place.
</para>
@@ -46,14 +46,14 @@
</blockquote>
<para>
- In layman's terms, a stereotype is a meta-annotation (an annotation used on another annotation) annotated with
- <literal>@Stereotype</literal> that bundles other Java annotations to give them a particular semantic. For
- instance, the following stereotype identifies action classes in some MVC framework:
+ A stereotype is an annotation, annotated <literal>@Stereotype</literal>, that packages several other annotations.
+ For instance, the following stereotype identifies action classes in some MVC framework:
</para>
<programlisting role="JAVA"><![CDATA[@Stereotype
@Retention(RUNTIME)
@Target(TYPE)
+...
public @interface Action {}]]></programlisting>
<para>
@@ -64,16 +64,14 @@
public class LoginAction { ... }]]></programlisting>
<para>
- Of course, we need to associate our stereotype annotation with some other annotations or else it isn't doing much
- for us. Let's see how to add them.
+ Of course, we need to apply some other annotations to our stereotype or else it wouldn't be adding much value.
</para>
<section>
<title>Default scope for a stereotype</title>
<para>
- A stereotype may specify a default scope for beans annotated with the stereotype. For example, if the we might
- specify the following defaults for action classes in a web application:
+ A stereotype may specify a default scope for beans annotated with the stereotype. For example:
</para>
<programlisting role="JAVA"><![CDATA[@RequestScoped
@@ -83,7 +81,7 @@
public @interface Action {}]]></programlisting>
<para>
- Of course, a particular action may still override this default if necessary:
+ A particular action may still override this default if necessary:
</para>
<programlisting role="JAVA"><![CDATA[@Dependent @Action
@@ -122,8 +120,7 @@
<para>
We can specify that all beans with a certain stereotype have a defaulted EL name when a name is not explicitly
- defined on that bean. Actions are often referenced in JSF views, so they're a perfect use case for this
- feature. All we need to do is add an empty <literal>@Named</literal> annotation:
+ defined for that bean. All we need to do is add an empty <literal>@Named</literal> annotation:
</para>
<programlisting role="JAVA"><![CDATA[@RequestScoped
@@ -136,18 +133,16 @@
public @interface Action {}]]></programlisting>
<para>
- Now, <literal>LoginAction</literal> bean from above will have the name <literal>loginAction</literal>.
+ Now, the <literal>LoginAction</literal> bean will have the defaulted name <literal>loginAction</literal>.
</para>
</section>
<section>
- <title>Alternatives as stereotypes</title>
+ <title>Alternative stereotypes</title>
<para>
- A stereotype can indicate that all beans to which it is applied are <literal>@Alternative</literal> beans. If
- you can remember back to the early days of the specification, this is the closest match to a deployment type.
- Whole sets of beans can be enabled or left disabled by activating a single stereotype.
+ A stereotype can indicate that all beans to which it is applied are <literal>@Alternative</literal>s.
</para>
<programlisting role="JAVA"><![CDATA[@Alternative
@@ -157,12 +152,18 @@
public @interface Mock {}]]></programlisting>
<para>
- Now you apply this stereotype to beans that should be active in mock environments.
+ We can apply an alternative stereotype to a whole set of beans, and activate them all with one line
+ of code in <literal>beans.xml</literal>.
</para>
<programlisting role="JAVA"><![CDATA[@Mock
public class MockLoginAction extends LoginAction { ... }]]></programlisting>
+ <programlisting role="JAVA"><![CDATA[<beans>
+ <alternatives>
+ <stereotype>org.mycompany.testing.Mock</stereotype>
+ </alternatives>
+</beans>]]></programlisting>
</section>
<section>
@@ -209,7 +210,7 @@
public @interface Model {}]]></programlisting>
<para>
- Instead of using JSF managed beans, just annotate a Web Bean <literal>@Model</literal>, and use it directly in
+ Instead of using JSF managed beans, just annotate a bean <literal>@Model</literal>, and use it directly in
your JSF view!
</para>
14 years, 7 months
Weld SVN: r4933 - in cdi-tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference and 4 other directories.
by weld-commits@lists.jboss.org
Author: marius.bogoevici
Date: 2009-11-09 22:43:13 -0500 (Mon, 09 Nov 2009)
New Revision: 4933
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/Airborne.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/Cruiser.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/Missile.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/MissileInterceptor.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/MissileLocal.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/SessionBeanInterceptorOnNonContextualEjbReferenceTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/Ship.java
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/beans.xml
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/SessionBeanInterceptorDefinitionTest.java
cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml
Log:
WELD-36 Adding assertion 7.2 h for validation @EJB-injected session beans. Enabling simple session intercetion test 7.2 c.
Copied: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/Airborne.java (from rev 4932, cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/Airborne.java)
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/Airborne.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/Airborne.java 2009-11-10 03:43:13 UTC (rev 4933)
@@ -0,0 +1,20 @@
+package org.jboss.jsr299.tck.tests.interceptors.definition.enterprise.nonContextualReference;
+
+import static java.lang.annotation.ElementType.METHOD;
+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.interceptor.InterceptorBinding;
+
+@Target( { TYPE, METHOD})
+@Retention(RUNTIME)
+@Documented
+@InterceptorBinding
+public @interface Airborne
+{
+
+}
\ No newline at end of file
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/Cruiser.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/Cruiser.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/Cruiser.java 2009-11-10 03:43:13 UTC (rev 4933)
@@ -0,0 +1,15 @@
+package org.jboss.jsr299.tck.tests.interceptors.definition.enterprise.nonContextualReference;
+
+import javax.ejb.EJB;
+
+public class Cruiser implements Ship
+{
+
+ @EJB
+ MissileLocal missile;
+
+ public void defend()
+ {
+ missile.fire();
+ }
+}
Copied: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/Missile.java (from rev 4932, cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/Missile.java)
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/Missile.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/Missile.java 2009-11-10 03:43:13 UTC (rev 4933)
@@ -0,0 +1,10 @@
+package org.jboss.jsr299.tck.tests.interceptors.definition.enterprise.nonContextualReference;
+
+import javax.ejb.Stateful;
+
+@Stateful
+@Airborne
+public class Missile implements MissileLocal
+{
+ public void fire() {}
+}
\ No newline at end of file
Copied: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/MissileInterceptor.java (from rev 4932, cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/MissileInterceptor.java)
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/MissileInterceptor.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/MissileInterceptor.java 2009-11-10 03:43:13 UTC (rev 4933)
@@ -0,0 +1,19 @@
+package org.jboss.jsr299.tck.tests.interceptors.definition.enterprise.nonContextualReference;
+
+import java.io.Serializable;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+@Interceptor @Airborne
+class MissileInterceptor implements Serializable
+{
+ public static boolean intercepted = false;
+
+ @AroundInvoke public Object alwaysReturnThis(InvocationContext ctx) throws Exception
+ {
+ intercepted = true;
+ return ctx.proceed();
+ }
+}
\ No newline at end of file
Copied: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/MissileLocal.java (from rev 4932, cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/MissileLocal.java)
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/MissileLocal.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/MissileLocal.java 2009-11-10 03:43:13 UTC (rev 4933)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.interceptors.definition.enterprise.nonContextualReference;
+
+import javax.ejb.Local;
+
+@Local
+public interface MissileLocal
+{
+ void fire();
+}
\ No newline at end of file
Copied: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/SessionBeanInterceptorOnNonContextualEjbReferenceTest.java (from rev 4932, cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/SessionBeanInterceptorDefinitionTest.java)
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/SessionBeanInterceptorOnNonContextualEjbReferenceTest.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/SessionBeanInterceptorOnNonContextualEjbReferenceTest.java 2009-11-10 03:43:13 UTC (rev 4933)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright <Year>, Red Hat, Inc. and/or its affiliates, 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.jsr299.tck.tests.interceptors.definition.enterprise.nonContextualReference;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecVersion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Packaging;
+import org.jboss.testharness.impl.packaging.PackagingType;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+
+@IntegrationTest
+@Artifact
+(a)Packaging(PackagingType.EAR)
+@SpecVersion(spec="cdi", version="20091101")
+@BeansXml("beans.xml")
+public class SessionBeanInterceptorOnNonContextualEjbReferenceTest extends AbstractJSR299Test
+{
+ @Test
+ @SpecAssertion(section = "7.2", id = "h")
+ public void testNonContextualSessionBeanReferenceIsIntercepted()
+ {
+ MissileInterceptor.intercepted = false;
+
+ Ship cruiser = getInstanceByType(Ship.class);
+ cruiser.defend();
+
+ assert MissileInterceptor.intercepted;
+ }
+}
\ No newline at end of file
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/Ship.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/Ship.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/Ship.java 2009-11-10 03:43:13 UTC (rev 4933)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.interceptors.definition.enterprise.nonContextualReference;
+
+import javax.ejb.Local;
+
+@Local
+public interface Ship
+{
+ void defend();
+}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/SessionBeanInterceptorDefinitionTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/SessionBeanInterceptorDefinitionTest.java 2009-11-10 03:14:14 UTC (rev 4932)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/SessionBeanInterceptorDefinitionTest.java 2009-11-10 03:43:13 UTC (rev 4933)
@@ -18,7 +18,7 @@
@BeansXml("beans.xml")
public class SessionBeanInterceptorDefinitionTest extends AbstractJSR299Test
{
- @Test(groups = "jboss-as-broken")
+ @Test
@SpecAssertion(section = "7.2", id = "c")
public void testSessionBeanIsIntercepted()
{
Copied: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/beans.xml (from rev 4932, cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/beans.xml)
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/beans.xml (rev 0)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/nonContextualReference/beans.xml 2009-11-10 03:43:13 UTC (rev 4933)
@@ -0,0 +1,5 @@
+<beans>
+ <interceptors>
+ <class>org.jboss.jsr299.tck.tests.interceptors.definition.enterprise.nonContextualReference.MissileInterceptor</class>
+ </interceptors>
+</beans>
\ No newline at end of file
Modified: cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml 2009-11-10 03:14:14 UTC (rev 4932)
+++ cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml 2009-11-10 03:43:13 UTC (rev 4933)
@@ -4066,6 +4066,11 @@
<assertion id="g">
<text>If the invocation is not a business method invocation, it is treated as a normal Java method call and is not intercepted by the container.</text>
</assertion>
+
+ <assertion id="h" implied="true">
+ <text>Verify that a non-contextual session bean reference is intercepted</text>
+ </assertion>
+
</section>
<section id="7.3" title="Lifecycle of contextual instances">
14 years, 7 months
Weld SVN: r4932 - in cdi-tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder and 6 other directories.
by weld-commits@lists.jboss.org
Author: marius.bogoevici
Date: 2009-11-09 22:14:14 -0500 (Mon, 09 Nov 2009)
New Revision: 4932
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/Airborne.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/Missile.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/MissileInterceptor.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/MissileLocal.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/RadarInterceptor.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/SessionBeanInterceptorOrderTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/Airborne.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/Missile.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/MissileInterceptor.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/MissileLocal.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/SessionBeanInterceptorDefinitionTest.java
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/beans.xml
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/beans.xml
Removed:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/Airborne.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/Missile.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/MissileInterceptor.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/MissileLocal.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/SessionBeanInterceptorDefinitionTest.java
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/beans.xml
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/interceptorOrder/InterceptorOrderTest.java
cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml
Log:
Split assertion 9.4 f into fa (with managed bean) and fb (with session bean) as the mechanisms to implement interception on EJBs are different from session beans.
Deleted: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/Airborne.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/Airborne.java 2009-11-10 03:07:46 UTC (rev 4931)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/Airborne.java 2009-11-10 03:14:14 UTC (rev 4932)
@@ -1,19 +0,0 @@
-package org.jboss.jsr299.tck.tests.interceptors.definition.enterprise;
-
-import java.lang.annotation.Target;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Documented;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.ElementType.METHOD;
-
-import javax.interceptor.InterceptorBinding;
-
-@Target( { TYPE, METHOD})
-@Retention(RUNTIME)
-@Documented
-@InterceptorBinding
-public @interface Airborne
-{
-
-}
\ No newline at end of file
Deleted: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/Missile.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/Missile.java 2009-11-10 03:07:46 UTC (rev 4931)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/Missile.java 2009-11-10 03:14:14 UTC (rev 4932)
@@ -1,11 +0,0 @@
-package org.jboss.jsr299.tck.tests.interceptors.definition.enterprise;
-
-import javax.ejb.Stateful;
-import javax.interceptor.Interceptors;
-
-@Stateful
-@Airborne
-public class Missile implements MissileLocal
-{
- public void fire() {}
-}
Deleted: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/MissileInterceptor.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/MissileInterceptor.java 2009-11-10 03:07:46 UTC (rev 4931)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/MissileInterceptor.java 2009-11-10 03:14:14 UTC (rev 4932)
@@ -1,19 +0,0 @@
-package org.jboss.jsr299.tck.tests.interceptors.definition.enterprise;
-
-import java.io.Serializable;
-
-import javax.interceptor.AroundInvoke;
-import javax.interceptor.Interceptor;
-import javax.interceptor.InvocationContext;
-
-@Interceptor @Airborne
-class MissileInterceptor implements Serializable
-{
- public static boolean intercepted = false;
-
- @AroundInvoke public Object alwaysReturnThis(InvocationContext ctx) throws Exception
- {
- intercepted = true;
- return ctx.proceed();
- }
-}
Deleted: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/MissileLocal.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/MissileLocal.java 2009-11-10 03:07:46 UTC (rev 4931)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/MissileLocal.java 2009-11-10 03:14:14 UTC (rev 4932)
@@ -1,9 +0,0 @@
-package org.jboss.jsr299.tck.tests.interceptors.definition.enterprise;
-
-import javax.ejb.Local;
-
-@Local
-public interface MissileLocal
-{
- void fire();
-}
Deleted: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/SessionBeanInterceptorDefinitionTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/SessionBeanInterceptorDefinitionTest.java 2009-11-10 03:07:46 UTC (rev 4931)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/SessionBeanInterceptorDefinitionTest.java 2009-11-10 03:14:14 UTC (rev 4932)
@@ -1,32 +0,0 @@
-package org.jboss.jsr299.tck.tests.interceptors.definition.enterprise;
-
-import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.test.audit.annotations.SpecAssertion;
-import org.jboss.test.audit.annotations.SpecVersion;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.IntegrationTest;
-import org.jboss.testharness.impl.packaging.Packaging;
-import org.jboss.testharness.impl.packaging.PackagingType;
-import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
-import org.testng.annotations.Test;
-
-
-@IntegrationTest
-@Artifact
-(a)Packaging(PackagingType.EAR)
-@SpecVersion(spec="cdi", version="20091101")
-@BeansXml("beans.xml")
-public class SessionBeanInterceptorDefinitionTest extends AbstractJSR299Test
-{
- @Test(groups = "jboss-as-broken")
- @SpecAssertion(section = "7.2", id = "c")
- public void testSessionBeanIsIntercepted()
- {
- MissileInterceptor.intercepted = false;
-
- MissileLocal missile = getInstanceByType(MissileLocal.class);
- missile.fire();
-
- assert MissileInterceptor.intercepted;
- }
-}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/Airborne.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/Airborne.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/Airborne.java 2009-11-10 03:14:14 UTC (rev 4932)
@@ -0,0 +1,20 @@
+package org.jboss.jsr299.tck.tests.interceptors.definition.enterprise.interceptorOrder;
+
+import static java.lang.annotation.ElementType.METHOD;
+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.interceptor.InterceptorBinding;
+
+@Target( { TYPE, METHOD})
+@Retention(RUNTIME)
+@Documented
+@InterceptorBinding
+public @interface Airborne
+{
+
+}
\ No newline at end of file
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/Missile.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/Missile.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/Missile.java 2009-11-10 03:14:14 UTC (rev 4932)
@@ -0,0 +1,12 @@
+package org.jboss.jsr299.tck.tests.interceptors.definition.enterprise.interceptorOrder;
+
+import javax.ejb.Stateful;
+import javax.interceptor.Interceptors;
+
+@Stateful
+@Airborne
+(a)Interceptors(RadarInterceptor.class)
+public class Missile implements MissileLocal
+{
+ public void fire() {}
+}
\ No newline at end of file
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/MissileInterceptor.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/MissileInterceptor.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/MissileInterceptor.java 2009-11-10 03:14:14 UTC (rev 4932)
@@ -0,0 +1,19 @@
+package org.jboss.jsr299.tck.tests.interceptors.definition.enterprise.interceptorOrder;
+
+import java.io.Serializable;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+@Interceptor @Airborne
+class MissileInterceptor implements Serializable
+{
+ public static boolean intercepted = false;
+
+ @AroundInvoke public Object alwaysReturnThis(InvocationContext ctx) throws Exception
+ {
+ intercepted = true;
+ return ctx.proceed();
+ }
+}
\ No newline at end of file
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/MissileLocal.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/MissileLocal.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/MissileLocal.java 2009-11-10 03:14:14 UTC (rev 4932)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.interceptors.definition.enterprise.interceptorOrder;
+
+import javax.ejb.Local;
+
+@Local
+public interface MissileLocal
+{
+ void fire();
+}
\ No newline at end of file
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/RadarInterceptor.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/RadarInterceptor.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/RadarInterceptor.java 2009-11-10 03:14:14 UTC (rev 4932)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright <Year>, Red Hat, Inc. and/or its affiliates, 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.jsr299.tck.tests.interceptors.definition.enterprise.interceptorOrder;
+
+import java.io.Serializable;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+public class RadarInterceptor implements Serializable
+{
+ public static boolean intercepted = false;
+ public static boolean interceptedFirst = false;
+
+ @AroundInvoke public Object alwaysReturnThis(InvocationContext ctx) throws Exception
+ {
+ intercepted = true;
+ interceptedFirst = !MissileInterceptor.intercepted;
+ return ctx.proceed();
+ }
+}
\ No newline at end of file
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/SessionBeanInterceptorOrderTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/SessionBeanInterceptorOrderTest.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/SessionBeanInterceptorOrderTest.java 2009-11-10 03:14:14 UTC (rev 4932)
@@ -0,0 +1,36 @@
+package org.jboss.jsr299.tck.tests.interceptors.definition.enterprise.interceptorOrder;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecVersion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Packaging;
+import org.jboss.testharness.impl.packaging.PackagingType;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+
+@IntegrationTest
+@Artifact
+(a)Packaging(PackagingType.EAR)
+@SpecVersion(spec="cdi", version="20091101")
+@BeansXml("beans.xml")
+public class SessionBeanInterceptorOrderTest extends AbstractJSR299Test
+{
+ @Test(groups = "jboss-as-broken")
+ @SpecAssertion(section = "9.4", id = "fb")
+ public void testInterceptorsDeclaredUsingInterceptorsCalledBeforeInterceptorBinding()
+ {
+ MissileInterceptor.intercepted = false;
+ RadarInterceptor.intercepted = false;
+ RadarInterceptor.interceptedFirst = false;
+
+ MissileLocal missile = getInstanceByType(MissileLocal.class);
+ missile.fire();
+
+ assert MissileInterceptor.intercepted;
+ assert RadarInterceptor.intercepted;
+ assert RadarInterceptor.interceptedFirst;
+ }
+}
\ No newline at end of file
Copied: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/Airborne.java (from rev 4862, cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/Airborne.java)
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/Airborne.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/Airborne.java 2009-11-10 03:14:14 UTC (rev 4932)
@@ -0,0 +1,19 @@
+package org.jboss.jsr299.tck.tests.interceptors.definition.enterprise.simpleInterception;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Documented;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.METHOD;
+
+import javax.interceptor.InterceptorBinding;
+
+@Target( { TYPE, METHOD})
+@Retention(RUNTIME)
+@Documented
+@InterceptorBinding
+public @interface Airborne
+{
+
+}
\ No newline at end of file
Copied: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/Missile.java (from rev 4862, cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/Missile.java)
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/Missile.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/Missile.java 2009-11-10 03:14:14 UTC (rev 4932)
@@ -0,0 +1,10 @@
+package org.jboss.jsr299.tck.tests.interceptors.definition.enterprise.simpleInterception;
+
+import javax.ejb.Stateful;
+
+@Stateful
+@Airborne
+public class Missile implements MissileLocal
+{
+ public void fire() {}
+}
Copied: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/MissileInterceptor.java (from rev 4862, cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/MissileInterceptor.java)
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/MissileInterceptor.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/MissileInterceptor.java 2009-11-10 03:14:14 UTC (rev 4932)
@@ -0,0 +1,19 @@
+package org.jboss.jsr299.tck.tests.interceptors.definition.enterprise.simpleInterception;
+
+import java.io.Serializable;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+
+@Interceptor @Airborne
+class MissileInterceptor implements Serializable
+{
+ public static boolean intercepted = false;
+
+ @AroundInvoke public Object alwaysReturnThis(InvocationContext ctx) throws Exception
+ {
+ intercepted = true;
+ return ctx.proceed();
+ }
+}
Copied: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/MissileLocal.java (from rev 4862, cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/MissileLocal.java)
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/MissileLocal.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/MissileLocal.java 2009-11-10 03:14:14 UTC (rev 4932)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.interceptors.definition.enterprise.simpleInterception;
+
+import javax.ejb.Local;
+
+@Local
+public interface MissileLocal
+{
+ void fire();
+}
Copied: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/SessionBeanInterceptorDefinitionTest.java (from rev 4862, cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/SessionBeanInterceptorDefinitionTest.java)
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/SessionBeanInterceptorDefinitionTest.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/SessionBeanInterceptorDefinitionTest.java 2009-11-10 03:14:14 UTC (rev 4932)
@@ -0,0 +1,32 @@
+package org.jboss.jsr299.tck.tests.interceptors.definition.enterprise.simpleInterception;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecVersion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Packaging;
+import org.jboss.testharness.impl.packaging.PackagingType;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+
+@IntegrationTest
+@Artifact
+(a)Packaging(PackagingType.EAR)
+@SpecVersion(spec="cdi", version="20091101")
+@BeansXml("beans.xml")
+public class SessionBeanInterceptorDefinitionTest extends AbstractJSR299Test
+{
+ @Test(groups = "jboss-as-broken")
+ @SpecAssertion(section = "7.2", id = "c")
+ public void testSessionBeanIsIntercepted()
+ {
+ MissileInterceptor.intercepted = false;
+
+ MissileLocal missile = getInstanceByType(MissileLocal.class);
+ missile.fire();
+
+ assert MissileInterceptor.intercepted;
+ }
+}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/interceptorOrder/InterceptorOrderTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/interceptorOrder/InterceptorOrderTest.java 2009-11-10 03:07:46 UTC (rev 4931)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/interceptorOrder/InterceptorOrderTest.java 2009-11-10 03:14:14 UTC (rev 4932)
@@ -29,7 +29,7 @@
}
@Test
- @SpecAssertion(section = "9.4", id = "f")
+ @SpecAssertion(section = "9.4", id = "fa")
public void testInterceptorsDeclaredUsingInterceptorsCalledBeforeInterceptorBinding()
{
TransactionalInterceptor.first = false;
Deleted: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/beans.xml
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/beans.xml 2009-11-10 03:07:46 UTC (rev 4931)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/beans.xml 2009-11-10 03:14:14 UTC (rev 4932)
@@ -1,5 +0,0 @@
-<beans>
- <interceptors>
- <class>org.jboss.jsr299.tck.tests.interceptors.definition.enterprise.MissileInterceptor</class>
- </interceptors>
-</beans>
\ No newline at end of file
Added: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/beans.xml
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/beans.xml (rev 0)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/interceptorOrder/beans.xml 2009-11-10 03:14:14 UTC (rev 4932)
@@ -0,0 +1,5 @@
+<beans>
+ <interceptors>
+ <class>org.jboss.jsr299.tck.tests.interceptors.definition.enterprise.interceptorOrder.MissileInterceptor</class>
+ </interceptors>
+</beans>
\ No newline at end of file
Copied: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/beans.xml (from rev 4862, cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/beans.xml)
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/beans.xml (rev 0)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/interceptors/definition/enterprise/simpleInterception/beans.xml 2009-11-10 03:14:14 UTC (rev 4932)
@@ -0,0 +1,5 @@
+<beans>
+ <interceptors>
+ <class>org.jboss.jsr299.tck.tests.interceptors.definition.enterprise.simpleInterception.MissileInterceptor</class>
+ </interceptors>
+</beans>
\ No newline at end of file
Modified: cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml 2009-11-10 03:07:46 UTC (rev 4931)
+++ cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml 2009-11-10 03:14:14 UTC (rev 4932)
@@ -4610,10 +4610,20 @@
<text>If the same class is listed twice under the |<interceptors>| element, the container automatically detects the problem and treats it as a deployment problem.</text>
</assertion>
- <assertion id="f">
- <text>Interceptors declared using |@Interceptors| or in |ejb-jar.xml| are called before interceptors declared using interceptor bindings.</text>
- </assertion>
+ <group>
+ <text>Interceptors declared using |@Interceptors| or in |ejb-jar.xml| are called before interceptors declared
+ using interceptor bindings.
+ </text>
+ <assertion id="fa">
+ <text>Test with a managed bean</text>
+ </assertion>
+
+ <assertion id="fb">
+ <text>Test with session bean</text>
+ </assertion>
+ </group>
+
<assertion id="g">
<text>Interceptors are called before decorators.</text>
</assertion>
14 years, 7 months
Weld SVN: r4931 - doc/trunk/reference/en-US.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-11-09 22:07:46 -0500 (Mon, 09 Nov 2009)
New Revision: 4931
Modified:
doc/trunk/reference/en-US/decorators.xml
doc/trunk/reference/en-US/next.xml
Log:
revisions
Modified: doc/trunk/reference/en-US/decorators.xml
===================================================================
--- doc/trunk/reference/en-US/decorators.xml 2009-11-10 03:02:49 UTC (rev 4930)
+++ doc/trunk/reference/en-US/decorators.xml 2009-11-10 03:07:46 UTC (rev 4931)
@@ -43,76 +43,66 @@
<programlisting role="JAVA"><![CDATA[@Decorator
public abstract class LargeTransactionDecorator
- implements Account {
+ implements Account {
...
}]]></programlisting>
<para>
- So what goes in the decorator? Well, decorators have to inject the instance of the bean they are decorating,
- termed the <emphasis>delegate injection point</emphasis>. The injection point has the same type as the bean to
- decorate and the annotation <literal>@Delegate</literal>. There can be at most one injection point, which can be a
- constructor, initializer method or field injection.
+ The decorator implements the methods of the decorated type that it wants to intercept.
</para>
-
- <programlisting role="JAVA"><![CDATA[@Decorator
-public abstract class LargeTransactionDecorator
- implements Account {
- @Inject @Delegate @Any Account account;
- ...
-}]]></programlisting>
-
- <para>
- You'll see in a moment that the beans which are decorated can be further restricted by specifying qualifiers at
- the injection point, a familiar pattern in CDI.
- </para>
-
- <para>
- The decorator then implements any methods of the bean type it wants to decorate. The decorator can in turn invoke
- the method on the decorated instance. Note that the method on the decorate is being called by the container
- <emphasis>instead of</emphasis> the method on the bean instance. It's up to the decorator to invoke the method on
- the bean instance. In fact, the decorator can invoke any method on the bean instance.
- </para>
<programlisting role="JAVA"><![CDATA[@Decorator
public abstract class LargeTransactionDecorator
- implements Account {
+ implements Account {
@Inject @Delegate @Any Account account;
@PersistenceContext EntityManager em;
public void withdraw(BigDecimal amount) {
- account.withdraw(amount);
- if ( amount.compareTo(LARGE_AMOUNT)>0 ) {
- em.persist( new LoggedWithdrawl(amount) );
- }
- }
+ ...
+ }
public void deposit(BigDecimal amount);
- account.deposit(amount);
- if ( amount.compareTo(LARGE_AMOUNT)>0 ) {
- em.persist( new LoggedDeposit(amount) );
- }
+ ...
}
}]]></programlisting>
<para>
- Interceptors for a method are called before decorators that apply to that method.
- </para>
-
- <para>
Unlike other beans, a decorator may be an abstract class. Therefore, if there's nothing special the decorator
needs to do for a particular method of the decorated interface, you don't need to implement that method.
</para>
+ <para>
+ Interceptors for a method are called before decorators that apply to the method.
+ </para>
+
<section>
<title>Delegate object</title>
- <para>
- All decorators must have a delegate injection point that injects the delegate object, as shown above. The type
- and qualifier types of the delegate injection point determine which beans the decorator is bound to. The
- delegate object type must implement or extend all interfaces implemented by the decorator.
- </para>
+ <para>
+ Decorators have a special injection point, called the <emphasis>delegate injection point</emphasis>, with the same
+ type as the beans they decorate, and the annotation <literal>@Delegate</literal>. There must be exactly one delegate
+ injection point, which can be a constructor parameter, initializer method parameter or injected field.
+ </para>
+
+ <programlisting role="JAVA"><![CDATA[@Decorator
+public abstract class LargeTransactionDecorator
+ implements Account {
+ @Inject @Delegate @Any Account account;
+ ...
+}]]></programlisting>
+
+ <para>A decorator is bound to any bean which:</para>
+ <itemizedlist>
+ <listitem>
+ <para>has the type of the delegate injection point as a bean type, and</para>
+ </listitem>
+ <listitem>
+ <para>has all qualifiers that are declared at the delegate injection point.</para>
+ </listitem>
+ </itemizedlist>
+
<para>
This delegate injection point specifies that the decorator is bound to all beans that implement
<literal>Account</literal>:
@@ -121,29 +111,40 @@
<programlisting role="JAVA"><![CDATA[@Inject @Delegate @Any Account account;]]></programlisting>
<para>
- A delegate injection point may specify any number of qualifier annotations. Then the decorator will only be
+ A delegate injection point may specify any number of qualifier annotations. The decorator will only be
bound to beans with the same qualifiers.
</para>
<programlisting role="JAVA"><![CDATA[@Inject @Delegate @Foreign Account account;]]></programlisting>
-
- <para>A decorator is bound to any bean which:</para>
- <itemizedlist>
- <listitem>
- <para>has the type of the delegate object as a bean type, and</para>
- </listitem>
- <listitem>
- <para>has all qualifiers that are declared at the delegate injection point.</para>
- </listitem>
- </itemizedlist>
-
<para>
The decorator may invoke the delegate object, which has much the same effect as calling
<literal>InvocationContext.proceed()</literal> from an interceptor. The main difference is that the decorator
can invoke <emphasis>any</emphasis> business method on the delegate object.
</para>
+ <programlisting role="JAVA"><![CDATA[@Decorator
+public abstract class LargeTransactionDecorator
+ implements Account {
+ @Inject @Delegate @Any Account account;
+
+ @PersistenceContext EntityManager em;
+
+ public void withdraw(BigDecimal amount) {
+ account.withdraw(amount);
+ if ( amount.compareTo(LARGE_AMOUNT)>0 ) {
+ em.persist( new LoggedWithdrawl(amount) );
+ }
+ }
+
+ public void deposit(BigDecimal amount);
+ account.deposit(amount);
+ if ( amount.compareTo(LARGE_AMOUNT)>0 ) {
+ em.persist( new LoggedDeposit(amount) );
+ }
+ }
+}]]></programlisting>
+
</section>
<section>
@@ -167,7 +168,7 @@
</beans>]]></programlisting>
<para>
- This declaration serves the same purpose for decorators that the <literal><Interceptors></literal>
+ This declaration serves the same purpose for decorators that the <literal><interceptors></literal>
declaration serves for interceptors:
</para>
Modified: doc/trunk/reference/en-US/next.xml
===================================================================
--- doc/trunk/reference/en-US/next.xml 2009-11-10 03:02:49 UTC (rev 4930)
+++ doc/trunk/reference/en-US/next.xml 2009-11-10 03:07:46 UTC (rev 4931)
@@ -5,12 +5,10 @@
<para>
Because CDI is so new, there's not yet a lot of information available online. That will change over time.
- Regardless, the CDI specification remains the authority for information on CDI. The spec is kept at around 100
- pages intentionally easy to read (don't worry, it's not like your Blue-ray player manual). You may be especially
- interested in reading it since it covers many details that we've skipped over. The spec is available on the
- <ulink src="http://jcp.org/en/jsr/detail?id=299">JSR-299 page</ulink> at the JCP website. Updates to the spec are
- also frequently mailed to the <ulink src="https://lists.jboss.org/mailman/listinfo/weld-dev">weld-dev</ulink>
- mailing list.
+ Regardless, the CDI specification remains the authority for information on CDI. The spec less than 100 pages and
+ is quite readable (don't worry, it's not like your Blu-ray player manual). Of course, it covers many details we've
+ skipped over here. The spec is available on the
+ <ulink src="http://jcp.org/en/jsr/detail?id=299">JSR-299 page</ulink> at the JCP website.
</para>
<para>
14 years, 7 months
Weld SVN: r4930 - cdi-tck/trunk/impl/src/main/resources.
by weld-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-11-09 22:02:49 -0500 (Mon, 09 Nov 2009)
New Revision: 4930
Modified:
cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml
Log:
audit corrections for chapter 12
Modified: cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml 2009-11-10 02:39:43 UTC (rev 4929)
+++ cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml 2009-11-10 03:02:49 UTC (rev 4930)
@@ -6303,25 +6303,33 @@
<section id="12.1" title="Bean deployment archives">
<assertion id="aa" testable="false">
- <text>Bean classes of enabled beans must be deployed in bean deployment archives.</text>
+ <text>Bean classes of enabled beans must be deployed in bean archives.</text>
</assertion>
<assertion id="a" testable="false">
- <text>A library jar, EJB jar, application client jar or rar archive is a bean deployment archive if it has a file named |beans.xml| in the |META-INF| directory. The |WEB-INF/classes| directory of a war is a bean deployment archive if there is a file named |beans.xml| in the |WEBINF| directory of the war. A directory in the JVM classpath is a bean deployment archive if it has a file named |beans.xml| in the |META-INF| directory.</text>
+ <text>A library jar, EJB jar, application client jar or rar archive is a bean archive if it has a file named |beans.xml| in the |META-INF| directory.</text>
+ </assertion>
+
+ <assertion id="ab" testable="false">
+ <text>The |WEB-INF/classes| directory of a war is a bean archive if there is a file named |beans.xml| in the |WEB-INF| directory of the war.</text>
+ </assertion>
+
+ <assertion id="ac" testable="false">
+ <text>A directory in the JVM classpath is a bean deployment archive if it has a file named |beans.xml| in the |META-INF| directory.</text>
<note>covered in bb*, bc*, bd*</note>
</assertion>
<assertion id="b" testable="false">
- <text>The container is not required to support application client jar bean deployment archives.</text>
+ <text>The container is not required to support application client jar bean archives.</text>
</assertion>
<assertion id="ba" testable="false">
- <text>The container searches for beans in bean deployment archives in the application classpath.</text>
+ <text>The container searches for beans in all bean archives in the application classpath.</text>
<note>covered in bb*, bc*, bd*</note>
</assertion>
<group>
- <text>In an application deployed as an ear, the container searches every bean deployment archive bundled with or referenced by the ear, including bean deployment archives bundled with or referenced by wars and EJB jars contained in the ear. The bean deployment archives might be library jars, EJB jars, rars or war |WEB-INF/classes| directories.</text>
+ <text>In an application deployed as an ear, the container searches every bean archive bundled with or referenced by the ear, including bean archives bundled with or referenced by wars and EJB jars contained in the ear. The bean archives might be library jars, EJB jars, rars or war |WEB-INF/classes| directories.</text>
<assertion id="bba">
<text>Check an EJB jar in an EAR</text>
</assertion>
@@ -6343,7 +6351,7 @@
</group>
<group>
- <text>In an application deployed as a war, the container searches every bean deployment archive bundled with or referenced by the war. The bean deployment archives might be library jars or the |WEB-INF/classes| directory.</text>
+ <text>In an application deployed as a war, the container searches every bean archive bundled with or referenced by the war. The bean archives might be library jars or the |WEB-INF/classes| directory.</text>
<assertion id="bca">
<text>Check classes in the war</text>
</assertion>
@@ -6356,7 +6364,7 @@
</group>
<group>
- <text>In an application deployed as an EJB jar, the container searches the EJB jar, if it is a bean deployment archive, and every bean deployment archive referenced by the EJB jar.</text>
+ <text>In an application deployed as an EJB jar, the container searches the EJB jar, if it is a bean archive, and every bean archive referenced by the EJB jar.</text>
<assertion id="bcd">
<text>Check classes in the jar.</text>
@@ -6364,7 +6372,7 @@
</group>
<group>
- <text>An embeddable EJB container searches each bean deployment archive in the JVM classpath that is listed in the value of the embeddable container initialization property |javax.ejb.embeddable.modules|, or every bean deployment archive in the JVM classpath if the property is not specified. The bean deployment archives might be directories, library jars or EJB jars.</text>
+ <text>An embeddable EJB container searches each bean archive in the JVM classpath that is listed in the value of the embeddable container initialization property |javax.ejb.embeddable.modules|, or every bean archive in the JVM classpath if the property is not specified. The bean archives might be directories, library jars or EJB jars.</text>
<assertion id="bda" testable="false">
<text>Check modules specified by |javax.ejb.embeddable.modules|</text>
<note>1.0 release of the TCK does not cover embeddable EJB</note>
@@ -6384,12 +6392,12 @@
</group>
<assertion id="be" testable="false">
- <text>When searching for beans, the container considers any Java class in any bean deployment archive, any |ejb-jar.xml| file in the metadata directory of any EJB bean deployment archive, any Java class referenced by the |@New| qualifier of an injection point of another bean, and any interceptor or decorator class declared in the |beans.xml| file of any bean deployment archive.</text>
+ <text>When searching for beans, the container considers any Java class in any bean archive, any |ejb-jar.xml| file in the metadata directory of any EJB bean archive, any Java class referenced by the |@New| qualifier of an injection point of another bean, and any interceptor or decorator class declared in the |beans.xml| file of any bean archive.</text>
<note>covered in bb*, bc*, bd*</note>
</assertion>
<assertion id="d" testable="false">
- <text>If a bean class is deployed in two different bean deployment archives, non-portable behaviour results. Portable applications must deploy each bean class in exactly one bean deployment archive.</text>
+ <text>If a bean class is deployed in two different bean archives, non-portable behaviour results. Portable applications must deploy each bean class in no more than one bean archive.</text>
<note>Describes undefined behavior</note>
</assertion>
</section>
@@ -6409,7 +6417,7 @@
</assertion>
<group>
- <text>Next, the container must perform bean discovery, and abort initialization of the application if any definition errors exist, as defined in Section 12.4, "Problems detected automatically by the container". Additionally, for every Java EE component class supporting injection that may be instantiated by the container at runtime, the container must create an |InjectionTarget| for the class, as defined in 11.2, "The Producer and InjectionTarget interfaces", and fire an event of type ProcessInjectionTarget, as defined in Section 11.5.6, "ProcessInjectionTarget event".</text>
+ <text>Next, the container must perform bean discovery, and abort initialization of the application if any definition errors exist, as defined in Section 2.8, "Problems detected automatically by the container". Additionally, for every Java EE component class supporting injection that may be instantiated by the container at runtime, the container must create an |InjectionTarget| for the class, as defined in 11.2, "The Producer and InjectionTarget interfaces", and fire an event of type ProcessInjectionTarget, as defined in Section 11.5.6, "ProcessInjectionTarget event".</text>
<assertion id="da">
<text>Check beans are discovered</text>
@@ -6427,7 +6435,7 @@
</assertion>
<assertion id="f">
- <text>Next, the container must detect deployment problems by validating bean dependencies and specialization and abort initialization of the application if any deployment problems exist, as defined in Section 12.4, "Problems detected automatically by the container".</text>
+ <text>Next, the container must detect deployment problems by validating bean dependencies and specialization and abort initialization of the application if any deployment problems exist, as defined in Section 2.8, "Problems detected automatically by the container".</text>
</assertion>
<assertion id="g">
@@ -6442,12 +6450,12 @@
<section id="12.3" title="Bean discovery">
<assertion id="a" testable="false">
- <text>The container automatically discovers managed beans (according to the rules of Section 3.2.1, "Which Java classes are managed beans?") and session beans in bean deployment archives and searches the bean classes for producer methods, producer fields, disposer methods and observer methods.</text>
+ <text>The container automatically discovers managed beans (according to the rules of Section 3.1.1, "Which Java classes are managed beans?") and session beans in bean archives and searches the bean classes for producer methods, producer fields, disposer methods and observer methods.</text>
<note>Statement of intent</note>
</assertion>
<group>
- <text>For each Java class or interface deployed in a bean deployment archive, the container must create an |AnnotatedType| representing the type and fire an event of type |ProcessAnnotatedType|, as defined in Section 11.5.5, "ProcessAnnotatedType event".</text>
+ <text>For each Java class or interface deployed in a bean archive, the container must create an |AnnotatedType| representing the type and fire an event of type |ProcessAnnotatedType|, as defined in Section 11.5.5, "ProcessAnnotatedType event".</text>
<assertion id="ba">
<text>Check managed bean</text>
</assertion>
@@ -6484,17 +6492,17 @@
</group>
<assertion id="c" testable="false">
- <text>For each Java class in any bean deployment archive, the container must inspect the type metadata to determine if it is a bean or other Java EE component class supporting injection.</text>
+ <text>For each Java class in any bean archive, the container must inspect the type metadata to determine if it is a bean or other Java EE component class supporting injection.</text>
<note>No consequence</note>
</assertion>
<assertion id="d" testable="false">
- <text>For each Java class in any bean deployment archive, the container must detect definition errors by validating the class and its metadata.</text>
+ <text>For each Java class in any bean archive, the container must detect definition errors by validating the class and its metadata.</text>
<note>Tested elsewhere</note>
</assertion>
<group>
- <text>For each Java class in any bean deployment archive, the container must, if the class is a managed bean, session bean, producer method or field, or other Java EE component class supporting injection, create an |InjectionTarget| for the class, as defined in Section 11.2, "The Producer and InjectionTarget interfaces", and fire an event of type |ProcessInjectionTarget|, as defined in Section 11.5.6, "ProcessInjectionTarget event"</text>
+ <text>For each Java class in any bean archive, the container must, if the class is a managed bean, session bean, or other Java EE component class supporting injection, create an |InjectionTarget| for the class, as defined in Section 11.2, "The Producer and InjectionTarget interfaces", and fire an event of type |ProcessInjectionTarget|, as defined in Section 11.5.6, "ProcessInjectionTarget event"</text>
<assertion id="da">
<text>Check managed bean</text>
</assertion>
@@ -6531,7 +6539,7 @@
</group>
<group>
- <text>For each Java class in any bean deployment archive, the container must, if the class is an enabled bean, interceptor or decorator, create a |Bean| object that implements the rules defined in Section 7.3.1, "Lifecycle of managed beans", Section 7.3.2, "Lifecycle of stateful session beans" or Section 7.3.3, "Lifecycle of stateless session and singleton beans", and fire an event which is a subtype of |ProcessBean|, as defined in Section 11.5.8, "ProcessBean event".</text>
+ <text>For each Java class in any bean archive, the container must, if the class is an enabled bean, interceptor or decorator, create a |Bean| object that implements the rules defined in Section 7.3.1, "Lifecycle of managed beans", Section 7.3.2, "Lifecycle of stateful session beans" or Section 7.3.3, "Lifecycle of stateless session and singleton beans", and fire an event which is a subtype of |ProcessBean|, as defined in Section 11.5.8, "ProcessBean event".</text>
<assertion id="fa">
<text>Check a managed bean</text>
</assertion>
@@ -6560,7 +6568,7 @@
</assertion>
<group>
- <text>The container determines which alternatives, interceptors and decorators are enabled, according to the rules defined in Section 5.2.2, "Enabled and disabled beans", Section 9.4, "Interceptor enablement and ordering" and Section 8.2, "Decorator enablement and ordering", taking into account any |<enable>|, |<interceptors>| and |<decorators>| declarations in the |beans.xml| files, and registers the |Bean| and |ObserverMethod| objects.</text>
+ <text>The container determines which alternatives, interceptors and decorators are enabled, according to the rules defined in Section 5.1.2, "Enabled and disabled beans", Section 9.4, "Interceptor enablement and ordering" and Section 8.2, "Decorator enablement and ordering", taking into account any |<enable>|, |<interceptors>| and |<decorators>| declarations in the |beans.xml| files, and registers the |Bean| and |ObserverMethod| objects.</text>
<assertion id="ka">
<text>Check only beans for enabled policies registered</text>
</assertion>
@@ -6596,15 +6604,15 @@
<assertion id="a">
<text>The container must provide a Unified EL |ELResolver| to the servlet engine and JSF implementation that resolves bean EL names using the rules of name resolution defined in 5.3, "EL name resolution" and resolving ambiguities according to Section 5.3.1, "Ambiguous EL names".</text>
</assertion>
+
+ <assertion id="c">
+ <text>If a name used in an EL expression does not resolve to any bean, the |ELResolver| must return a null value.</text>
+ </assertion>
<assertion id="b">
<text>If a name used in an EL expression resolves to more than one bean, the |ELResolver| must throw an |AmbiguousResolutionException|.</text>
</assertion>
- <assertion id="c">
- <text>If a name used in an EL expression does not resolve to any bean, the |ELResolver| must return a null value.</text>
- </assertion>
-
<assertion id="d">
<text>Otherwise, if a name used in an EL expression resolves to exactly one bean, the |ELResolver| must return a contextual instance of the bean, as defined in Section 6.5.2, "Contextual instance of a bean".</text>
</assertion>
14 years, 7 months
Weld SVN: r4929 - in cdi-tck/trunk/impl/src/main: resources and 1 other directory.
by weld-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-11-09 21:39:43 -0500 (Mon, 09 Nov 2009)
New Revision: 4929
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/beanManager/BeanManagerTest.java
cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml
Log:
audit corrections for chapter 11
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/beanManager/BeanManagerTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/beanManager/BeanManagerTest.java 2009-11-10 02:33:04 UTC (rev 4928)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/beanManager/BeanManagerTest.java 2009-11-10 02:39:43 UTC (rev 4929)
@@ -97,10 +97,7 @@
}
@Test(expectedExceptions = InjectionException.class)
- @SpecAssertions({
- @SpecAssertion(section = "11.3.8", id = "a"),
- @SpecAssertion(section = "11.3.8", id = "b")
- })
+ @SpecAssertion(section = "11.3.8", id = "a")
public void testValidateThrowsException()
{
DogHouse dogHouse = getInstanceByType(DogHouse.class);
Modified: cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml 2009-11-10 02:33:04 UTC (rev 4928)
+++ cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml 2009-11-10 02:39:43 UTC (rev 4929)
@@ -5129,11 +5129,11 @@
</assertion>
<assertion id="bd">
- <text>|isNullable()| must return |true| if the method |create()| sometimes returns a |null| value, and |false| otherwise, as defined in Section 5.3.4, "Primitive types and null values".</text>
+ <text>|isNullable()| must return |true| if the method |create()| sometimes returns a |null| value, and |false| otherwise, as defined in Section 5.2.4, "Primitive types and null values".</text>
</assertion>
<assertion id="c">
- <text>|getInjectionPoints()| returns a set of |InjectionPoint| objects, defined in Section 5.6.9, "Injection point metadata", representing injection points of the bean, that will be validated by the container at initialization time.</text>
+ <text>|getInjectionPoints()| returns a set of |InjectionPoint| objects, defined in Section 5.5.7, "Injection point metadata", representing injection points of the bean, that will be validated by the container at initialization time.</text>
</assertion>
<assertion id="f">
@@ -5141,7 +5141,7 @@
</assertion>
<assertion id="g" testable="false">
- <text>A portable extension may add support for new kinds of beans beyond those defined by the this specification (managed beans, session beans, producer methods and fields, resources and message destinations) by implementing |Bean| and registering beans with the container, using the mechanism defined in Section 11.5.2, "AfterBeanDiscovery event".</text>
+ <text>A portable extension may add support for new kinds of beans beyond those defined by the this specification (managed beans, session beans, producer methods, producer fields and resources) by implementing |Bean| and registering beans with the container, using the mechanism defined in Section 11.5.2, "AfterBeanDiscovery event".</text>
</assertion>
</section>
@@ -5169,7 +5169,7 @@
</assertion>
<assertion id="b">
- <text>|getInterceptorBindingTypes()| returns the interceptor bindings of the interceptor.</text>
+ <text>|getInterceptorBindings()| returns the interceptor bindings of the interceptor.</text>
</assertion>
<assertion id="c">
@@ -5195,7 +5195,7 @@
</assertion>
<assertion id="b">
- <text>|getBean()| returns the bean with the observer method.</text>
+ <text>|getBeanClass()| returns the bean class of the bean that declares the observer method.</text>
</assertion>
<assertion id="c">
@@ -5211,7 +5211,7 @@
</assertion>
<assertion id="f">
- <text>|notify()| calls the observer method, as defined in Section 5.6.8 "Invocation of observer methods".</text>
+ <text>|notify()| calls the observer method, as defined in Section 5.5.6 "Invocation of observer methods".</text>
</assertion>
<assertion id="ga">
@@ -5226,7 +5226,7 @@
</assertion>
<group>
- <text>For a |Producer| that represents a class, |produce()| calls the constructor annotated |@Inject| if it exists, or the constructor with no parameters otherwise, as defined in Section 5.6.3, "Injection using the bean constructor". and returns the resulting instance. If the class has interceptors, |produce()| is responsible for building the interceptors and decorators of the instance.</text>
+ <text>For a |Producer| that represents a class, |produce()| calls the constructor annotated |@Inject| if it exists, or the constructor with no parameters otherwise, as defined in Section 5.5.1, "Injection using the bean constructor". and returns the resulting instance. If the class has interceptors, |produce()| is responsible for building the interceptors and decorators of the instance.</text>
<assertion id="ba">
<text>Test field injection occurs</text>
</assertion>
@@ -5249,20 +5249,24 @@
<text>For a |Producer| that represents a class, |dispose()| does nothing.</text>
</assertion>
- <assertion id="da">
- <text>For a |Producer| that represents a class, |getInjectionPoints()| returns a set of |InjectionPoint| objects representing all _injected fields_, bean constructor parameters and initializer method parameters.</text>
- </assertion>
+ <group>
+ <text>For a |Producer| that represents a class, |getInjectionPoints()| returns a set of |InjectionPoint| objects representing all injected fields, bean constructor parameters and initializer method parameters.</text>
+
+ <assertion id="da">
+ <text>Test injected fields.</text>
+ </assertion>
+
+ <assertion id="db">
+ <text>Test bean constructor parameters.</text>
+ </assertion>
+
+ <assertion id="dc">
+ <text>Test initializer method parameters.</text>
+ </assertion>
+ </group>
- <assertion id="db">
- <text>For a |Producer| that represents a class, |getInjectionPoints()| returns a set of |InjectionPoint| objects representing all injected fields, _bean constructor parameters_ and initializer method parameters.</text>
- </assertion>
-
- <assertion id="dc">
- <text>For a |Producer| that represents a class, |getInjectionPoints()| returns a set of |InjectionPoint| objects representing all injected fields, bean constructor parameters and _initializer method parameters_.</text>
- </assertion>
-
<group>
- <text>For a |Producer| that represents a producer method or field, |produce()| calls the producer method on, or accesses the producer field of, a contextual instance of the bean that declares the producer method, as defined in Section 5.6.6, "Invocation of producer or disposer methods".</text>
+ <text>For a |Producer| that represents a producer method or field, |produce()| calls the producer method on, or accesses the producer field of, a contextual instance of the bean that declares the producer method, as defined in Section 5.5.4, "Invocation of producer or disposer methods".</text>
<assertion id="eaa">
<text>Test with producer method.</text>
@@ -5274,7 +5278,7 @@
</group>
<group>
- <text>For a Producer that represents a producer method or field, |dispose()| calls the disposer method, if any, on a contextual instance of the bean that declares the disposer method, as defined in Section 5.6.6, "Invocation of producer or disposer methods", or performs any additional required cleanup, if any, to destroy state associated with a resource.</text>
+ <text>For a Producer that represents a producer method or field, |dispose()| calls the disposer method, if any, on a contextual instance of the bean that declares the disposer method, as defined in Section 5.5.4, "Invocation of producer or disposer methods", or performs any additional required cleanup, if any, to destroy state associated with a resource.</text>
<assertion id="faa">
<text>Test with producer method.</text>
@@ -5292,7 +5296,7 @@
</assertion>
<assertion id="i">
- <text>|inject()| performs dependency injection upon the given object. The container performs Java EE component environment injection, according to the semantics required by the Java EE platform specification, sets the value of all injected fields, and calls all initializer methods, as defined in Section 5.6.4, "Injection of fields and initializer methods".</text>
+ <text>|inject()| performs dependency injection upon the given object. The container performs Java EE component environment injection, according to the semantics required by the Java EE platform specification, sets the value of all injected fields, and calls all initializer methods, as defined in Section 5.5.2, "Injection of fields and initializer methods".</text>
</assertion>
<assertion id="j">
@@ -5345,15 +5349,23 @@
</assertion>
<assertion id="b">
- <text>The first parameter is the |Bean| object representing the bean. The second parameter represents the bean type that must be implemented by any client proxy that is returned.</text>
+ <text>The first parameter is the |Bean| object representing the bean. The second parameter represents the bean type that must be implemented by any client proxy that is returned. The third parameter is an instance of |CreationalContext| that may be used to destroy any object with scope |@Dependent| that is created.</text>
</assertion>
+
+ <assertion id="c">
+ <text>If the given type is not a bean type of the given bean, an |IllegalArgumentException| is thrown.</text>
+ </assertion>
</section>
<section id="11.3.2" title="Obtaining an injectable reference">
<assertion id="a">
- <text>The method |BeanManager.getInjectableReference()| returns an injectable reference for a given injection point, as defined in Section 5.6.1, "Injectable references".</text>
+ <text>The method |BeanManager.getInjectableReference()| returns an injectable reference for a given injection point, as defined in Section 6.5.5, "Injectable references".</text>
</assertion>
+ <assertion id="ab">
+ <text>The first parameter represents the target injection point. The second parameter is an instance of |CreationalContext| that may be used to destroy any object with scope |@Dependent| that is created.</text>
+ </assertion>
+
<assertion id="b">
<text>If the |InjectionPoint| represents a decorator delegate injection point, |getInjectableReference()| returns a delegate, as defined in Section 8.1.2, "Decorator delegate injection points".</text>
</assertion>
@@ -5384,7 +5396,7 @@
<section id="11.3.4" title="Obtaining a Bean by type">
<assertion id="aa">
- <text>The method |BeanManager.getBeans()| returns the set of beans which have the given required type and qualifiers and are available for injection in the module or library containing the class into which the |BeanManager| was injected or the Java EE component from whose JNDI environment namespace the |BeanManager| was obtained, according to the rules of typesafe resolution defined in Section 5.3, "Typesafe resolution".</text>
+ <text>The method |BeanManager.getBeans()| returns the set of beans which have the given required type and qualifiers and are available for injection in the module or library containing the class into which the |BeanManager| was injected or the Java EE component from whose JNDI environment namespace the |BeanManager| was obtained, according to the rules of typesafe resolution defined in Section 5.2, "Typesafe resolution".</text>
</assertion>
<assertion id="b">
@@ -5410,7 +5422,7 @@
<section id="11.3.5" title="Obtaining a Bean by name">
<assertion id="aa">
- <text>The method |BeanManager.getBeans()| which accepts a string returns the set of beans which have the given EL name and are available for injection in the module or library containing the class into which the |BeanManager| was injected or the Java EE component from whose JNDI environment namespace the |BeanManager| was obtained, according to the rules of EL name resolution defined in Section 5.4, "EL name resolution".</text>
+ <text>The method |BeanManager.getBeans()| which accepts a string returns the set of beans which have the given EL name and are available for injection in the module or library containing the class into which the |BeanManager| was injected or the Java EE component from whose JNDI environment namespace the |BeanManager| was obtained, according to the rules of EL name resolution defined in Section 5.3, "EL name resolution".</text>
</assertion>
<assertion id="b">
@@ -5420,13 +5432,13 @@
<section id="11.3.6" title="Obtaining a passivation capable bean by identifier">
<assertion id="a">
- <text>The method |BeanManager.getPassivationCapableBean()| returns the |PassivationCapableBean| with the given identifier.</text>
+ <text>The method |BeanManager.getPassivationCapableBean()| returns the |PassivationCapable| bean with the given identifier (see Section 6.6.1, "Passivation capable beans").</text>
</assertion>
</section>
<section id="11.3.7" title="Resolving an ambiguous dependency">
<assertion id="a">
- <text>The method |BeanManager.resolve()| applies the ambiguous dependency resolution rules defined in Section 5.3.1, "Unsatisfied and ambiguous dependencies" to a set of |Bean|s.</text>
+ <text>The method |BeanManager.resolve()| applies the ambiguous dependency resolution rules defined in Section 5.2.1, "Unsatisfied and ambiguous dependencies" to a set of |Bean|s.</text>
</assertion>
<assertion id="b">
@@ -5434,13 +5446,13 @@
</assertion>
</section>
- <section id="11.3.8" title="Validating a dependency">
+ <section id="11.3.8" title="Validating an injection point">
<assertion id="a">
- <text>The |BeanManager.validate()| operation validates a dependency.</text>
+ <text>The |BeanManager.validate()| operation validates an injection point and throws an |InjectionException| if there is a deployment problem (for example, an unsatisfied or unresolvable ambiguous dependency) associated with the injection point.</text>
<note>Statement of intent</note>
</assertion>
- <assertion id="b">
+ <assertion id="a">
<text>The method |validate()| validates the dependency and throws an |InjectionException| if there is a deployment problem (for example, an unsatisfied or unresolvable ambiguous dependency) associated with the injection point.</text>
</assertion>
</section>
@@ -5465,12 +5477,7 @@
<assertion id="e">
<text>If an instance of an annotation that is not a qualifier type is given, an |IllegalArgumentException| is thrown.</text>
</assertion>
-
- <assertion id="f" testable="false">
- <text>If an instance of |javax.enterprise.inject.New| is passed to |getBeans()|, non-portable behavior results. Portable applications should not pass qualifiers of type |@New| to |getBeans()|.</text>
- <note>Describes non-portable behavior</note>
- </assertion>
-
+
</section>
<section id="11.3.10" title="Observer method resolution">
@@ -5497,7 +5504,7 @@
<section id="11.3.11" title="Decorator resolution">
<assertion id="a">
- <text>The method |BeanManager.resolveDecorators()| returns the ordered list of decorators for a set of bean types and a set of qualifiers, as defined in Section 8.3, "Decorator resolution".</text>
+ <text>The method |BeanManager.resolveDecorators()| returns the ordered list of decorators for a set of bean types and a set of qualifiers which are enabled in the module or library containing the class into which the |BeanManager| was injected or the Java EE component from whose JNDI environment namespace the |BeanManager| was obtained, as defined in Section 8.3, "Decorator resolution".</text>
</assertion>
<assertion id="b">
@@ -5519,7 +5526,7 @@
<section id="11.3.12" title="Interceptor resolution">
<assertion id="a">
- <text>The method |BeanManager.resolveInterceptors()| returns the ordered list of interceptors for a set of interceptor qualifiers, as defined in Section 9.5, "Interceptor resolution".</text>
+ <text>The method |BeanManager.resolveInterceptors()| returns the ordered list of interceptors for a set of interceptor bindings and a type of interception which are enabled in the module or library containing the class into which the |BeanManager| was injected or the Java EE component from whose JNDI environment namespace the |BeanManager| was obtained, as defined in Section 9.5, "Interceptor resolution".</text>
</assertion>
<assertion id="b">
@@ -5577,7 +5584,7 @@
<section id="11.3.15" title="Obtaining the ELResolver">
<assertion id="a">
- <text>The method |BeanManager.getELResolver()| returns the |javax.el.ELResolver| specified in Section 5.8, "Integration with Unified EL".</text>
+ <text>The method |BeanManager.getELResolver()| returns the |javax.el.ELResolver| specified in Section 12.4, "Integration with Unified EL".</text>
</assertion>
</section>
@@ -5593,7 +5600,7 @@
<section id="11.3.17" title="Obtaining an AnnotatedType for a class">
<assertion id="a">
- <text>The method |BeanManager.createAnnotatedType()| returns an |AnnotatedType| for the given Java class.</text>
+ <text>The method |BeanManager.createAnnotatedType()| returns an |AnnotatedType| that may be used to read the annotations of a given Java class or interface.</text>
</assertion>
</section>
@@ -5640,7 +5647,7 @@
</assertion>
<assertion id="g">
- <text>|isAnnotationPresent()| returns true if the program element has an annotation of the given annotation type, or false otherwise.</text>
+ <text>|isAnnotationPresent()| returns |true| if the program element has an annotation of the given annotation type, or |false| otherwise.</text>
</assertion>
<group>
@@ -5789,20 +5796,19 @@
</assertion>
<assertion id="b">
- <text>Observer methods of these events must belong to extensions. An extension is a service provider |javax.enterprise.inject.spi.Extension| declared in |META-INF/services|.</text>
+ <text>Observer methods of these events must belong to extensions. An extension is a service provider of the service |javax.enterprise.inject.spi.Extension| declared in |META-INF/services|.</text>
</assertion>
-
- <assertion id="c">
- <text>The container instantiates a single instance of each service provider at the beginning of the application initialization process and maintains a reference to it until the application shuts down.</text>
+
+ <assertion id="bb">
+ <text>Service providers may have observer methods, which may observer any event, including any container lifecycle event, and obtain an injected |BeanManager| reference.</text>
</assertion>
-
+
<assertion id="d">
<text>The container instantiates a single instance of each extension at the beginning of the application initialization process and maintains a reference to it until the application shuts down. The container delivers event notifications to this instance by calling its observer methods.</text>
</assertion>
<assertion id="e">
- <text>For each service provider, the container must provide a bean of scope |@ApplicationScoped| and qualifier |@Default|, supporting injection of a reference to the service provider instance. The bean types of this bean include the class of the service
-provider and all superclases and interfaces.</text>
+ <text>For each service provider, the container must provide a bean of scope |@ApplicationScoped| and qualifier |@Default|, supporting injection of a reference to the service provider instance. The bean types of this bean include the class of the service provider and all superclases and interfaces.</text>
</assertion>
</section>
@@ -5838,7 +5844,7 @@
<section id="11.5.2" title="AfterBeanDiscovery event">
<assertion id="a">
- <text>The container must fire a second event when it has fully completed the bean discovery process, validated that there are no definition errors relating to the discovered beans, and registered |Bean| and |Observer| objects for the discovered beans, but before detecting deployment problems. The event object must be of type |javax.enterprise.inject.spi.AfterBeanDiscovery|.</text>
+ <text>The container must fire a second event when it has fully completed the bean discovery process, validated that there are no definition errors relating to the discovered beans, and registered |Bean| and |ObserverMethod| objects for the discovered beans, but before detecting deployment problems. The event object must be of type |javax.enterprise.inject.spi.AfterBeanDiscovery|.</text>
</assertion>
<assertion id="ca">
@@ -5876,9 +5882,13 @@
</group>
<assertion id="f">
- <text>|addContext()| registers a custom |Context| object with the container. A portable extension may take advantage of this event to register beans, interceptors, decorators, observer methods and custom context objects with the container.</text>
+ <text>|addContext()| registers a custom |Context| object with the container.</text>
</assertion>
+ <assertion id="fb">
+ <text>A portable extension may take advantage of this event to register beans, interceptors, decorators, observer methods and custom context objects with the container.</text>
+ </assertion>
+
<assertion id="g">
<text>If any observer method of the |AfterBeanDiscovery| event throws an exception, the exception is treated as a definition error by the container.</text>
</assertion>
@@ -5914,7 +5924,7 @@
<section id="11.5.5" title="ProcessAnnotatedType event">
<assertion id="a">
- <text>The container must fire an event for each Java class it discovers in a bean deployment archive, before it reads the declared annotations. The event object must be of type |javax.enterprise.inject.spi.ProcessAnnotatedType<X>|, where |X| is the class.</text>
+ <text>The container must fire an event for each Java class it discovers in a bean archive, before it reads the declared annotations. The event object must be of type |javax.enterprise.inject.spi.ProcessAnnotatedType<X>|, where |X| is the class.</text>
</assertion>
<assertion id="ba">
@@ -5997,6 +6007,10 @@
</assertion>
</group>
+ <assertion id="aaz">
+ <text>The event object must be of type |javax.enterprise.inject.spi.ProcessInjectionTarget<X>|, where |x| is the managed bean class, session bean class or Java EE component class supporting injection.</text>
+ </assertion>
+
<group>
<text>|getAnnotatedType()| returns the |AnnotatedType| representing the managed bean class, session bean or other Java EE component class supporting injection.</text>
<assertion id="aba">
@@ -6028,6 +6042,10 @@
</assertion>
</group>
+ <assertion id="ba">
+ <text>|getInjectionTarget()| returns the |InjectionTarget| object that will be used by the container to perform injection.</text>
+ </assertion>
+
<assertion id="bb">
<text>|setInjectionTarget()| replaces the |InjectionTarget|.</text>
</assertion>
@@ -6141,7 +6159,7 @@
<section id="11.5.8" title="ProcessBean event">
<assertion id="aa" testable="false">
- <text>The container must fire an event for each enabled bean, interceptor or decorator deployed in a bean deployment archive, before registering the |Bean| object. No event is fired for any |@New| qualified bean, defined in Section 3.12, "@New qualified beans".</text>
+ <text>The container must fire an event for each enabled bean, interceptor or decorator deployed in a bean archive, before registering the |Bean| object. No event is fired for any |@New| qualified bean, defined in Section 3.12, "@New qualified beans".</text>
<note>Tested below</note>
</assertion>
@@ -6213,7 +6231,6 @@
</assertion>
</group>
-
<assertion id="h">
<text>|addDefinitionError()| registers a definition error with the container, causing the container to abort deployment after bean discovery is complete.</text>
</assertion>
14 years, 7 months