Author: pete.muir(a)jboss.org
Date: 2008-12-19 19:24:19 -0500 (Fri, 19 Dec 2008)
New Revision: 614
Modified:
doc/trunk/reference/en/modules/decorators.xml
doc/trunk/reference/en/modules/ee.xml
doc/trunk/reference/en/modules/events.xml
doc/trunk/reference/en/modules/example.xml
doc/trunk/reference/en/modules/extend.xml
doc/trunk/reference/en/modules/injection.xml
doc/trunk/reference/en/modules/interceptors.xml
doc/trunk/reference/en/modules/intro.xml
doc/trunk/reference/en/modules/producermethods.xml
doc/trunk/reference/en/modules/scopescontexts.xml
doc/trunk/reference/en/modules/specialization.xml
doc/trunk/reference/en/modules/stereotypes.xml
doc/trunk/reference/en/modules/xml.xml
Log:
syntax highlighting
Modified: doc/trunk/reference/en/modules/decorators.xml
===================================================================
--- doc/trunk/reference/en/modules/decorators.xml 2008-12-19 23:53:02 UTC (rev 613)
+++ doc/trunk/reference/en/modules/decorators.xml 2008-12-20 00:24:19 UTC (rev 614)
@@ -21,7 +21,7 @@
<para>Suppose we have an interface that represents accounts:</para>
-<programlisting><![CDATA[public interface Account {
+<programlisting role="JAVA"><![CDATA[public interface Account {
public BigDecimal getBalance();
public User getOwner();
public void withdraw(BigDecimal amount);
@@ -37,7 +37,7 @@
<para>A decorator is a simple Web Bean that implements the type it
decorates and is annotated <literal>(a)Decorator</literal>.</para>
-<programlisting><![CDATA[@Decorator
+<programlisting role="JAVA"><![CDATA[@Decorator
public abstract class LargeTransactionDecorator
implements Account {
@@ -77,12 +77,12 @@
<para>This delegate attribute specifies that the decorator is bound to
all Web Beans that implement <literal>Account</literal>:</para>
-<programlisting><![CDATA[@Decorates Account
account;]]></programlisting>
+<programlisting role="JAVA"><![CDATA[@Decorates Account
account;]]></programlisting>
<para>A delegate attribute may specify a binding annotation. Then the
decorator will only be bound to Web Beans with the same binding.</para>
-<programlisting><![CDATA[@Decorates @Foreign Account
account;]]></programlisting>
+<programlisting role="JAVA"><![CDATA[@Decorates @Foreign Account
account;]]></programlisting>
<para>A decorator is bound to any Web Bean which:</para>
@@ -107,7 +107,7 @@
<para>We need to <emphasis>enable</emphasis> our decorator in
<literal>web-beans.xml</literal>.</para>
-<programlisting><![CDATA[<Decorators>
+<programlisting role="XML"><![CDATA[<Decorators>
<myapp:LargeTransactionDecorator/>
</Decorators>]]></programlisting>
Modified: doc/trunk/reference/en/modules/ee.xml
===================================================================
--- doc/trunk/reference/en/modules/ee.xml 2008-12-19 23:53:02 UTC (rev 613)
+++ doc/trunk/reference/en/modules/ee.xml 2008-12-20 00:24:19 UTC (rev 614)
@@ -16,7 +16,7 @@
<literal>@PersistenceContext</literal>. We've already seen a couple
of examples of
this, though we didn't pay much attention at the time:</para>
-<programlisting><![CDATA[@Transactional @Interceptor
+<programlisting role="JAVA"><![CDATA[@Transactional @Interceptor
public class TransactionInterceptor {
@Resource Transaction transaction;
@@ -25,7 +25,7 @@
}]]></programlisting>
-<programlisting><![CDATA[@SessionScoped
+<programlisting role="JAVA"><![CDATA[@SessionScoped
public class Login {
@Current Credentials credentials;
@@ -52,7 +52,7 @@
<para>It's easy to use a Web Bean from a Servlet in Java EE 6. Simply
inject
the Web Bean using Web Beans field or initializer method injection.</para>
-<programlisting>public class Login extends HttpServlet {
+<programlisting role="JAVA">public class Login extends HttpServlet {
@Current Credentials credentials;
@Current Login login;
@@ -90,7 +90,7 @@
<para>You can even use Web Beans interceptor bindings for Message-Driven
Beans.</para>
-<programlisting>@Transactional @MessageDriven
+<programlisting role="JAVA">@Transactional @MessageDriven
public class ProcessOrder implements MessageListener {
@Current Inventory inventory;
@@ -127,13 +127,13 @@
queue or topic in <literal>web-beans.xml</literal>, specifying an
associated
binding type and connection factory.</para>
- <programlisting><![CDATA[<Queue>
+ <programlisting role="XML"><![CDATA[<Queue>
<destination>java:comp/env/jms/OrderQueue</destination>
<connectionFactory>java:comp/env/jms/QueueConnectionFactory</connectionFactory>
<myapp:OrderProcessor/>
</Queue>]]></programlisting>
- <programlisting><![CDATA[<Topic>
+ <programlisting role="XML"><![CDATA[<Topic>
<destination>java:comp/env/jms/StockPrices</destination>
<connectionFactory>java:comp/env/jms/TopicConnectionFactory</connectionFactory>
<myapp:StockPrices/>
@@ -145,7 +145,7 @@
<literal>TopicConnection</literal>,
<literal>TopicSession</literal> or
<literal>TopicPublisher</literal> for a topic.</para>
- <programlisting>@OrderProcessor QueueSender orderSender;
+ <programlisting role="JAVA">@OrderProcessor QueueSender orderSender;
@OrderProcessor QueueSession orderSession;
public void sendMessage() {
@@ -154,7 +154,7 @@
orderSender.send(msg);
}</programlisting>
- <programlisting>@StockPrices TopicPublisher pricePublisher;
+ <programlisting role="JAVA">@StockPrices TopicPublisher
pricePublisher;
@StockPrices TopicSession priceSession;
public void sendMessage(String price) {
Modified: doc/trunk/reference/en/modules/events.xml
===================================================================
--- doc/trunk/reference/en/modules/events.xml 2008-12-19 23:53:02 UTC (rev 613)
+++ doc/trunk/reference/en/modules/events.xml 2008-12-20 00:24:19 UTC (rev 614)
@@ -30,7 +30,7 @@
<para>An <emphasis>observer method</emphasis> is a method of a Web
Bean with a
parameter annotated <literal>(a)Observes</literal>.</para>
-<programlisting><![CDATA[public void onAnyDocumentEvent(@Observes Document
document) { ... }]]></programlisting>
+<programlisting role="JAVA"><![CDATA[public void
onAnyDocumentEvent(@Observes Document document) { ... }]]></programlisting>
<para>The annotated parameter is called the <emphasis>event
parameter</emphasis>.
The type of the event parameter is the observed <emphasis>event
type</emphasis>.
@@ -38,7 +38,7 @@
binding types. When a binding type is used as an event selector, it is called an
<emphasis>event binding type</emphasis>.</para>
-<programlisting><![CDATA[@BindingType
+<programlisting role="JAVA"><![CDATA[@BindingType
@Target({PARAMETER, FIELD})
@Retention(RUNTIME)
public @interface Updated { ... }]]></programlisting>
@@ -46,7 +46,7 @@
<para>We specify the event bindings of the observer method by annotating the
event
parameter:</para>
-<programlisting><![CDATA[public void afterDocumentUpdate(@Observes @Updated
Document document) { ... }]]></programlisting>
+<programlisting role="JAVA"><![CDATA[public void
afterDocumentUpdate(@Observes @Updated Document document) { ...
}]]></programlisting>
<para>An observer method need not specify any event bindings—in this
case it
is interested in <emphasis>all</emphasis> events of a particular type. If
it does
@@ -56,7 +56,7 @@
<para>The observer method may have additional parameters, which are injected
according
to the usual Web Beans method parameter injection semantics:</para>
-<programlisting><![CDATA[public void afterDocumentUpdate(@Observes @Updated
Document document, User user) { ... }]]></programlisting>
+<programlisting role="JAVA"><![CDATA[public void
afterDocumentUpdate(@Observes @Updated Document document, User user) { ...
}]]></programlisting>
</section>
@@ -66,7 +66,7 @@
<para>The event producer may obtain an <emphasis>event
notifier</emphasis> object
by injection:</para>
-<programlisting><![CDATA[@Observable Event<Document>
documentEvent]]></programlisting>
+<programlisting role="JAVA"><![CDATA[@Observable Event<Document>
documentEvent]]></programlisting>
<para>The <literal>@Observable</literal> annotation implicitly
defines a Web Bean
with scope <literal>@Dependent</literal> and deployment type
<literal>@Standard</literal>,
@@ -75,7 +75,7 @@
<para>A producer raises events by calling the
<literal>fire()</literal> method
of the <literal>Event</literal> interface, passing an <emphasis>event
object</emphasis>:</para>
-<programlisting><![CDATA[documentEvent.fire(document);]]></programlisting>
+<programlisting
role="JAVA"><![CDATA[documentEvent.fire(document);]]></programlisting>
<para>An event object may be an instance of any Java class that has no type
variables or wildcard type parameters. The event will be delivered to every
@@ -98,7 +98,7 @@
<para>To specify a "selector", the event producer may pass an instance
of the event
binding type to the <literal>fire()</literal> method:</para>
-<programlisting><![CDATA[documentEvent.fire( document, new
AnnotationLiteral<Updated>(){} );]]></programlisting>
+<programlisting role="JAVA"><![CDATA[documentEvent.fire( document, new
AnnotationLiteral<Updated>(){} );]]></programlisting>
<para>The helper class <literal>AnnotationLiteral</literal> makes it
possible to
instantiate binding types inline, since this is otherwise difficult to do in
Java.</para>
@@ -118,7 +118,7 @@
<para>Alternatively, event bindings may be specified by annotating the event
notifier
injection point:</para>
-<programlisting><![CDATA[@Observable @Updated Event<Document>
documentUpdatedEvent]]></programlisting>
+<programlisting role="JAVA"><![CDATA[@Observable @Updated
Event<Document> documentUpdatedEvent]]></programlisting>
<para>Then every event fired via this instance of
<literal>Event</literal> has
the annotated event binding. The event will be delivered to every observer method
@@ -144,12 +144,12 @@
may implement the <literal>Observer</literal> interface and register an
instance
with an event notifier by calling the <literal>observe()</literal>
method.</para>
- <programlisting><![CDATA[documentEvent.observe( new Observer<Document>()
{ public void notify(Document doc) { ... } } );]]></programlisting>
+ <programlisting role="JAVA"><![CDATA[documentEvent.observe( new
Observer<Document>() { public void notify(Document doc) { ... } }
);]]></programlisting>
<para>Event binding types may be specified by the event notifier injection point
or by
passing event binding type instances to the <literal>observe()</literal>
method:</para>
-<programlisting><![CDATA[documentEvent.observe( new Observer<Document>() {
public void notify(Document doc) { ... } },
+<programlisting role="JAVA"><![CDATA[documentEvent.observe( new
Observer<Document>() { public void notify(Document doc) { ... } },
new AnnotationLiteral<Updated>(){}
);]]></programlisting>
</section>
@@ -159,7 +159,7 @@
<para>An event binding type may have annotation members:</para>
-<programlisting><![CDATA[@BindingType
+<programlisting role="JAVA"><![CDATA[@BindingType
@Target({PARAMETER, FIELD})
@Retention(RUNTIME)
public @interface Role {
@@ -168,23 +168,23 @@
<para>The member value is used to narrow the messages delivered to the
observer:</para>
-<programlisting><![CDATA[public void adminLoggedIn(@Observes @Role(ADMIN)
LoggedIn event) { ... }]]></programlisting>
+<programlisting role="JAVA"><![CDATA[public void
adminLoggedIn(@Observes @Role(ADMIN) LoggedIn event) { ... }]]></programlisting>
<para>Event binding type members may be specified statically by the event
producer, via
annotations at the event notifier injection point:</para>
-<programlisting><![CDATA[@Observable @Role(ADMIN) Event<LoggedIn>
LoggedInEvent;}}]]></programlisting>
+<programlisting role="JAVA"><![CDATA[@Observable @Role(ADMIN)
Event<LoggedIn> LoggedInEvent;}}]]></programlisting>
<para>Alternatively, the value of the event binding type member may be determined
dynamically
by the event producer. We start by writing an abstract subclass of
<literal>AnnotationLiteral</literal>:</para>
-<programlisting><![CDATA[abstract class RoleBinding
+<programlisting role="JAVA"><![CDATA[abstract class RoleBinding
extends AnnotationLiteral<Role>
implements Role {}]]></programlisting>
<para>The event producer passes an instance of this class to
<literal>fire()</literal>:</para>
-<programlisting><![CDATA[documentEvent.fire( document, new RoleBinding() {
public void value() { return user.getRole(); } } );]]></programlisting>
+<programlisting role="JAVA"><![CDATA[documentEvent.fire( document, new
RoleBinding() { public void value() { return user.getRole(); } }
);]]></programlisting>
</section>
@@ -193,16 +193,16 @@
<para>Event binding types may be combined, for example:</para>
-<programlisting><![CDATA[@Observable @Blog Event<Document> blogEvent;
+<programlisting role="JAVA"><![CDATA[@Observable @Blog
Event<Document> blogEvent;
...
if (document.isBlog()) blogEvent.fire(document, new
AnnotationLiteral<Updated>(){});]]></programlisting>
<para>When this event occurs, all of the following observer methods will be
notified:</para>
-<programlisting><![CDATA[public void afterBlogUpdate(@Observes @Updated @Blog
Document document) { ... }]]></programlisting>
-<programlisting><![CDATA[public void afterDocumentUpdate(@Observes @Updated
Document document) { ... }]]></programlisting>
-<programlisting><![CDATA[public void onAnyBlogEvent(@Observes @Blog Document
document) { ... }]]></programlisting>
-<programlisting><![CDATA[public void onAnyDocumentEvent(@Observes Document
document) { ... }}}]]></programlisting>
+<programlisting role="JAVA"><![CDATA[public void
afterBlogUpdate(@Observes @Updated @Blog Document document) { ...
}]]></programlisting>
+<programlisting role="JAVA"><![CDATA[public void
afterDocumentUpdate(@Observes @Updated Document document) { ...
}]]></programlisting>
+<programlisting role="JAVA"><![CDATA[public void
onAnyBlogEvent(@Observes @Blog Document document) { ... }]]></programlisting>
+<programlisting role="JAVA"><![CDATA[public void
onAnyDocumentEvent(@Observes Document document) { ... }}}]]></programlisting>
</section>
@@ -215,7 +215,7 @@
the application context, but only when transactions that update the
<literal>Category</literal> tree succeed:</para>
-<programlisting><![CDATA[public void
refreshCategoryTree(@AfterTransactionSuccess @Observes CategoryUpdateEvent event) { ...
}]]></programlisting>
+<programlisting role="JAVA"><![CDATA[public void
refreshCategoryTree(@AfterTransactionSuccess @Observes CategoryUpdateEvent event) { ...
}]]></programlisting>
<para>There are three kinds of transactional observers:</para>
@@ -245,7 +245,7 @@
<para>Imagine that we have cached a JPA query result set in the application
scope:</para>
- <programlisting><![CDATA[@ApplicationScoped @Singleton
+ <programlisting role="JAVA"><![CDATA[@ApplicationScoped @Singleton
public class Catalog {
@PersistenceContext EntityManager em;
@@ -271,7 +271,7 @@
<para>The Web Bean that creates and deletes
<literal>Product</literal>s could raise
events, for example:</para>
- <programlisting><![CDATA[@Stateless
+ <programlisting role="JAVA"><![CDATA[@Stateless
public class ProductManager {
@PersistenceContext EntityManager em;
@@ -294,7 +294,7 @@
<para>And now <literal>Catalog</literal> can observe the events after
successful
completion of the transaction:</para>
- <programlisting><![CDATA[@ApplicationScoped @Singleton
+ <programlisting role="JAVA"><![CDATA[@ApplicationScoped @Singleton
public class Catalog {
...
Modified: doc/trunk/reference/en/modules/example.xml
===================================================================
--- doc/trunk/reference/en/modules/example.xml 2008-12-19 23:53:02 UTC (rev 613)
+++ doc/trunk/reference/en/modules/example.xml 2008-12-20 00:24:19 UTC (rev 614)
@@ -8,7 +8,7 @@
we'll define a Web Bean to hold the username and password entered during
login:</para>
-<programlisting><![CDATA[@Named
+<programlisting role="JAVA"><![CDATA[@Named
public class Credentials {
private String username;
@@ -24,7 +24,7 @@
<para>This Web Bean is bound to the login prompt in the following JSF
form:</para>
-<programlisting><![CDATA[<f:form>
+<programlisting role="JAVA"><![CDATA[<f:form>
<h:panelGrid columns="2" rendered="#{!login.loggedIn}">
<h:outputLabel for="username">Username:</h:outputLabel>
<h:inputText id="username"
value="#{credentials.username}"/>
@@ -39,7 +39,7 @@
information about the currently logged-in user and exposes the
<literal>User</literal>
entity to other Web Beans:</para>
-<programlisting><![CDATA[@SessionScoped @Named
+<programlisting role="JAVA"><![CDATA[@SessionScoped @Named
public class Login {
@Current Credentials credentials;
@@ -77,14 +77,14 @@
<para>Of course, <literal>@LoggedIn</literal> is a binding
annotation:</para>
-<programlisting><![CDATA[@Retention(RUNTIME)
+<programlisting role="JAVA"><![CDATA[@Retention(RUNTIME)
@Target({TYPE, METHOD, FIELD})
@BindingType
public @interface LoggedIn {}]]></programlisting>
<para>Now, any other Web Bean can easily inject the current user:</para>
-<programlisting><![CDATA[public class DocumentEditor {
+<programlisting role="JAVA"><![CDATA[public class DocumentEditor {
@Current Document document;
@LoggedIn User currentUser;
Modified: doc/trunk/reference/en/modules/extend.xml
===================================================================
--- doc/trunk/reference/en/modules/extend.xml 2008-12-19 23:53:02 UTC (rev 613)
+++ doc/trunk/reference/en/modules/extend.xml 2008-12-20 00:24:19 UTC (rev 614)
@@ -31,7 +31,7 @@
<para>The <literal>Manager</literal> interface lets us register and
obtain
Web Beans, interceptors, decorators, observers and contexts
programatically.</para>
-<programlisting><![CDATA[public interface Manager
+<programlisting role="JAVA"><![CDATA[public interface Manager
{
public <T> Set<Bean<T>> resolveByType(Class<T> type,
Annotation... bindings);
@@ -86,7 +86,7 @@
<para>We can obtain an instance of <literal>Manager</literal> via
injection:</para>
-<programlisting>@Current Manager manager</programlisting>
+<programlisting role="JAVA">@Current Manager
manager</programlisting>
</section>
@@ -98,7 +98,7 @@
with the <literal>Manager</literal> object for every Web Bean in the
application.</para>
-<programlisting>public abstract class Bean<T> {
+<programlisting role="JAVA">public abstract class Bean<T>
{
private final Manager manager;
@@ -144,7 +144,7 @@
<para>The <literal>Context</literal> interface supports addition of
new
scopes to Web Beans, or extension of the built-in scopes to new
environments.</para>
-<programlisting>public interface Context {
+<programlisting role="JAVA">public interface Context {
public Class<? extends Annotation> getScopeType();
Modified: doc/trunk/reference/en/modules/injection.xml
===================================================================
--- doc/trunk/reference/en/modules/injection.xml 2008-12-19 23:53:02 UTC (rev 613)
+++ doc/trunk/reference/en/modules/injection.xml 2008-12-20 00:24:19 UTC (rev 614)
@@ -7,7 +7,7 @@
<para>Constructor parameter injection:</para>
-<programlisting><![CDATA[public class Checkout {
+<programlisting role="JAVA"><![CDATA[public class Checkout {
private final ShoppingCart cart;
@@ -20,7 +20,7 @@
<para><emphasis>Initializer</emphasis> method parameter
injection:</para>
-<programlisting><![CDATA[public class Checkout {
+<programlisting role="JAVA"><![CDATA[public class Checkout {
private ShoppingCart cart;
@@ -33,7 +33,7 @@
<para>And direct field injection:</para>
-<programlisting><![CDATA[public class Checkout {
+<programlisting role="JAVA"><![CDATA[public class Checkout {
private @Current ShoppingCart cart;
@@ -72,7 +72,7 @@
<para>Producer methods also support parameter injection:</para>
-<programlisting><![CDATA[@Produces Checkout createCheckout(ShoppingCart cart) {
+<programlisting role="JAVA"><![CDATA[@Produces Checkout
createCheckout(ShoppingCart cart) {
return new Checkout(cart);
}]]></programlisting>
@@ -119,12 +119,12 @@
annotation. For example, there might be two implementations of
<literal>PaymentProcessor</literal>:</para>
-<programlisting><![CDATA[@PayByCheque
+<programlisting role="JAVA"><![CDATA[@PayByCheque
public class ChequePaymentProcessor implements PaymentProcessor {
public void process(Payment payment) { ... }
}]]></programlisting>
-<programlisting><![CDATA[@PayByCreditCard
+<programlisting role="JAVA"><![CDATA[@PayByCreditCard
public class CreditCardPaymentProcessor implements PaymentProcessor {
public void process(Payment payment) { ... }
}]]></programlisting>
@@ -132,12 +132,12 @@
<para>Where <literal>@PayByCheque</literal> and
<literal>@PayByCreditCard</literal>
are binding annotations:</para>
-<programlisting><![CDATA[@Retention(RUNTIME)
+<programlisting role="JAVA"><![CDATA[@Retention(RUNTIME)
@Target({TYPE, METHOD, FIELD, PARAMETER})
@BindingType
public @interface PayByCheque {}]]></programlisting>
-<programlisting><![CDATA[@Retention(RUNTIME)
+<programlisting role="JAVA"><![CDATA[@Retention(RUNTIME)
@Target({TYPE, METHOD, FIELD, PARAMETER})
@BindingType
public @interface PayByCreditCard {}]]></programlisting>
@@ -147,12 +147,12 @@
<para>Using field injection:</para>
-<programlisting><![CDATA[@PayByCheque PaymentProcessor chequePaymentProcessor;
+<programlisting role="JAVA"><![CDATA[@PayByCheque PaymentProcessor
chequePaymentProcessor;
@PayByCreditCard PaymentProcessor
creditCardPaymentProcessor;]]></programlisting>
<para>Using initializer method injection:</para>
-<programlisting><![CDATA[@Initializer
+<programlisting role="JAVA"><![CDATA[@Initializer
public void setPaymentProcessors(@PayByCheque PaymentProcessor chequePaymentProcessor,
@PayByCreditCard PaymentProcessor
creditCardPaymentProcessor) {
this.chequePaymentProcessor = chequePaymentProcessor;
@@ -161,7 +161,7 @@
<para>Or using constructor injection:</para>
-<programlisting><![CDATA[@Initializer
+<programlisting role="JAVA"><![CDATA[@Initializer
public Checkout(@PayByCheque PaymentProcessor chequePaymentProcessor,
@PayByCreditCard PaymentProcessor creditCardPaymentProcessor) {
this.chequePaymentProcessor = chequePaymentProcessor;
@@ -173,7 +173,7 @@
<para>Binding annotations may have members:</para>
-<programlisting><![CDATA[@Retention(RUNTIME)
+<programlisting role="JAVA"><![CDATA[@Retention(RUNTIME)
@Target({TYPE, METHOD, FIELD, PARAMETER})
@BindingType
public @interface PayBy {
@@ -182,7 +182,7 @@
<para>In which case, the member value is significant:</para>
-<programlisting><![CDATA[@PayBy(CHEQUE) PaymentProcessor
chequePaymentProcessor;
+<programlisting role="JAVA"><![CDATA[@PayBy(CHEQUE) PaymentProcessor
chequePaymentProcessor;
@PayBy(CREDIT_CARD) PaymentProcessor
creditCardPaymentProcessor;]]></programlisting>
<para>You can tell the Web Bean manager to ignore a member of a binding
annotation
@@ -195,7 +195,7 @@
<para>An injection point may even specify multiple binding
annotations:</para>
-<programlisting><![CDATA[@Asynchronous @PayByCheque PaymentProcessor
paymentProcessor]]></programlisting>
+<programlisting role="JAVA"><![CDATA[@Asynchronous @PayByCheque
PaymentProcessor paymentProcessor]]></programlisting>
<para>In this case, only a Web Bean which has
<emphasis>both</emphasis> binding
annotations would be eligible for injection.</para>
@@ -207,7 +207,7 @@
<para>Even producer methods may specify binding annotations:</para>
-<programlisting><![CDATA[@Produces
+<programlisting role="JAVA"><![CDATA[@Produces
@Asynchronous @PayByCheque
PaymentProcessor createAsyncPaymentProcessor(@PayByCheque PaymentProcessor processor) {
return new AsynchronousPaymentProcessor(processor);
@@ -251,7 +251,7 @@
which would identify Web Beans that should only be installed when the system executes
inside an integration testing environment:</para>
- <programlisting><![CDATA[@Retention(RUNTIME)
+ <programlisting role="JAVA"><![CDATA[@Retention(RUNTIME)
@Target({TYPE, METHOD})
@DeploymentType
public @interface Mock {}]]></programlisting>
@@ -259,7 +259,7 @@
<para>Suppose we had some Web Bean that interacted with an external system to
process payments:</para>
-<programlisting><![CDATA[public class ExternalPaymentProcessor {
+<programlisting role="JAVA"><![CDATA[public class
ExternalPaymentProcessor {
public void process(Payment p) {
...
@@ -273,7 +273,7 @@
<para>For integration or unit testing, the external system is slow or
unavailable.
So we would create a mock object:</para>
-<programlisting><![CDATA[@Mock
+<programlisting role="JAVA"><![CDATA[@Mock
public class MockPaymentProcessor implements PaymentProcessor {
@Override
@@ -298,7 +298,7 @@
<para>Going back to our example, when we deploy our integration tests, we want
all
our <literal>@Mock</literal> objects to be installed:</para>
-<programlisting><![CDATA[<WebBeans>
+<programlisting role="JAVA"><![CDATA[<WebBeans>
<Deploy>
<Standard/>
<Production/>
@@ -328,7 +328,7 @@
or <literal>MockPaymentProcessor</literal>—to choose. Consider what
happens when
the manager encounters this injection point:</para>
-<programlisting><![CDATA[@Current PaymentProcessor
paymentProcessor]]></programlisting>
+<programlisting role="JAVA"><![CDATA[@Current PaymentProcessor
paymentProcessor]]></programlisting>
<para>There are now two Web Beans which satisfy the
<literal>PaymentProcessor</literal>
contract. Of course, we can't use a binding annotation to disambiguate, since binding
@@ -474,28 +474,28 @@
<para>The application may obtain an instance of the interface
<literal>Manager</literal>
by injection:</para>
- <programlisting><![CDATA[@Current Manager
manager;]]></programlisting>
+ <programlisting role="JAVA"><![CDATA[@Current Manager
manager;]]></programlisting>
<para>The <literal>Manager</literal> object provides a set of methods
for obtaining a
Web Bean instance programatically.</para>
- <programlisting><![CDATA[PaymentProcessor p =
manager.getInstanceByType(PaymentProcessor.class);]]></programlisting>
+ <programlisting role="JAVA"><![CDATA[PaymentProcessor p =
manager.getInstanceByType(PaymentProcessor.class);]]></programlisting>
<para>Binding annotations may be specified by subclassing the helper class
<literal>AnnotationLiteral</literal>, since it is otherwise difficult to
instantiate an
annotation type in Java.</para>
- <programlisting><![CDATA[PaymentProcessor p =
manager.getInstanceByType(PaymentProcessor.class,
+ <programlisting role="JAVA"><![CDATA[PaymentProcessor p =
manager.getInstanceByType(PaymentProcessor.class,
new
AnnotationLiteral<CreditCard>(){});]]></programlisting>
<para>If the binding type has an annotation member, we can't use an anonymous
subclass of
<literal>AnnotationLiteral</literal>—instead we'll need to
create a named subclass:</para>
-<programlisting><![CDATA[abstract class CreditCardBinding
+<programlisting role="JAVA"><![CDATA[abstract class CreditCardBinding
extends AnnotationLiteral<CreditCard>
implements CreditCard {}]]></programlisting>
-<programlisting><![CDATA[PaymentProcessor p =
manager.getInstanceByType(PaymentProcessor.class,
+<programlisting role="JAVA"><![CDATA[PaymentProcessor p =
manager.getInstanceByType(PaymentProcessor.class,
new CreditCardBinding() {
public void value() { return
paymentType; }
} );]]></programlisting>
@@ -551,12 +551,12 @@
<para>Let's look at an example. The following code is verbose, and vulnerable
to refactoring
problems:</para>
-<programlisting><![CDATA[Logger log =
Logger.getLogger(MyClass.class.getName());]]></programlisting>
+<programlisting role="JAVA"><![CDATA[Logger log =
Logger.getLogger(MyClass.class.getName());]]></programlisting>
<para>This clever little producer method lets you inject a JDK
<literal>Logger</literal> without
explicitly specifying the log category:</para>
-<programlisting><![CDATA[class LogFactory {
+<programlisting role="JAVA"><![CDATA[class LogFactory {
@Produces Logger createLogger(InjectionPoint injectionPoint) {
return Logger.getLogger(injectionPoint.getMember().getDeclaringClass().getName());
@@ -566,12 +566,12 @@
<para>We can now write:</para>
-<programlisting><![CDATA[@Current Logger log;]]></programlisting>
+<programlisting role="JAVA"><![CDATA[@Current Logger
log;]]></programlisting>
<para>Not convinced? Then here's a second example. To inject HTTP parameters,
we need to define
a binding type:</para>
-<programlisting><![CDATA[@BindingType
+<programlisting role="JAVA"><![CDATA[@BindingType
@Retention(RUNTIME)
@Target({TYPE, METHOD, FIELD, PARAMETER})
public @interface HttpParam {
@@ -580,12 +580,12 @@
<para>We would use this binding type at injection points as
follows:</para>
-<programlisting><![CDATA[@HttpParam("username") String username;
+<programlisting role="JAVA"><![CDATA[@HttpParam("username")
String username;
@HttpParam("password") String password;]]></programlisting>
<para>The following producer method does the work:</para>
-<programlisting><![CDATA[class HttpParams
+<programlisting role="JAVA"><![CDATA[class HttpParams
@Produces @HttpParam("")
String getParamValue(ServletRequest request, InjectionPoint ip) {
@@ -600,7 +600,7 @@
<para>The Web Bean manager provides a built-in Web Bean that implements the
<literal>InjectionPoint</literal> interface:</para>
-<programlisting><![CDATA[public interface InjectionPoint {
+<programlisting role="JAVA"><![CDATA[public interface InjectionPoint {
public Object getInstance();
public Bean<?> getBean();
public Member getMember():
Modified: doc/trunk/reference/en/modules/interceptors.xml
===================================================================
--- doc/trunk/reference/en/modules/interceptors.xml 2008-12-19 23:53:02 UTC (rev 613)
+++ doc/trunk/reference/en/modules/interceptors.xml 2008-12-20 00:24:19 UTC (rev 614)
@@ -33,14 +33,14 @@
<para>A <emphasis>business method interceptor</emphasis> applies to
invocations of methods of the Web Bean by clients of the Web Bean:</para>
-<programlisting><![CDATA[public class TransactionInterceptor {
+<programlisting role="JAVA"><![CDATA[public class
TransactionInterceptor {
@AroundInvoke public Object manageTransaction(InvocationContext ctx) { ... }
}]]></programlisting>
<para>A <emphasis>lifecycle callback interceptor</emphasis> applies
to
invocations of lifecycle callbacks by the container:</para>
-<programlisting><![CDATA[public class DependencyInjectionInterceptor {
+<programlisting role="JAVA"><![CDATA[public class
DependencyInjectionInterceptor {
@PostConstruct public void injectDependencies(InvocationContext ctx) { ... }
}]]></programlisting>
@@ -56,7 +56,7 @@
The first thing we need is an <emphasis>interceptor binding
annotation</emphasis>
to specify exactly which Web Beans we're interested in:</para>
-<programlisting><![CDATA[@InterceptorBindingType
+<programlisting role="JAVA"><![CDATA[@InterceptorBindingType
@Target({METHOD, TYPE})
@Retention(RUNTIME)
public @interface Transactional {}]]></programlisting>
@@ -64,12 +64,12 @@
<para>Now we can easily specify that our
<literal>ShoppingCart</literal> is a
transactional object:</para>
-<programlisting><![CDATA[@Transactional
+<programlisting role="JAVA"><![CDATA[@Transactional
public class ShoppingCart { ... }]]></programlisting>
<para>Or, if we prefer, we can specify that just one method is
transactional:</para>
-<programlisting><![CDATA[public class ShoppingCart {
+<programlisting role="JAVA"><![CDATA[public class ShoppingCart {
@Transactional public void checkout() { ... }
}]]></programlisting>
@@ -83,7 +83,7 @@
we need to do is create a standard EJB interceptor, and annotate it
<literal>@Interceptor</literal> and
<literal>(a)Transactional</literal>.</para>
-<programlisting><![CDATA[@Transactional @Interceptor
+<programlisting role="JAVA"><![CDATA[@Transactional @Interceptor
public class TransactionInterceptor {
@AroundInvoke public Object manageTransaction(InvocationContext ctx) { ... }
}]]></programlisting>
@@ -91,7 +91,7 @@
<para>All Web Beans interceptors are simple Web Beans, and can take advantage
of dependency injection and contextual lifecycle management.</para>
-<programlisting><![CDATA[@ApplicationScoped @Transactional @Interceptor
+<programlisting role="JAVA"><![CDATA[@ApplicationScoped @Transactional
@Interceptor
public class TransactionInterceptor {
@Resource Transaction transaction;
@@ -110,7 +110,7 @@
<para>Finally, we need to <emphasis>enable</emphasis> our interceptor
in
<literal>web-beans.xml</literal>.</para>
-<programlisting><![CDATA[<Interceptors>
+<programlisting role="XML"><![CDATA[<Interceptors>
<tx:TransactionInterceptor/>
</Interceptors>]]></programlisting>
@@ -131,7 +131,7 @@
<para>For example, we could specify that our security interceptor runs before our
<literal>TransactionInterceptor</literal>.</para>
-<programlisting><![CDATA[<Interceptors>
+<programlisting role="XML"><![CDATA[<Interceptors>
<sx:SecurityInterceptor/>
<tx:TransactionInterceptor/>
</Interceptors>]]></programlisting>
@@ -146,7 +146,7 @@
<para>Suppose we want to add some extra information to our
<literal>@Transactional</literal>
annotation:</para>
-<programlisting><![CDATA[@InterceptorBindingType
+<programlisting role="JAVA"><![CDATA[@InterceptorBindingType
@Target({METHOD, TYPE})
@Retention(RUNTIME)
public @interface Transactional {
@@ -157,21 +157,21 @@
two different interceptors, <literal>TransactionInterceptor</literal> and
<literal>RequiresNewTransactionInterceptor</literal>.</para>
-<programlisting><![CDATA[@Transactional(requiresNew=true) @Interceptor
+<programlisting role="JAVA"><![CDATA[@Transactional(requiresNew=true)
@Interceptor
public class RequiresNewTransactionInterceptor {
@AroundInvoke public Object manageTransaction(InvocationContext ctx) { ... }
}]]></programlisting>
<para>Now we can use
<literal>RequiresNewTransactionInterceptor</literal> like this:</para>
-<programlisting><![CDATA[@Transactional(requiresNew=true)
+<programlisting role="JAVA"><![CDATA[@Transactional(requiresNew=true)
public class ShoppingCart { ... }]]></programlisting>
<para>But what if we only have one interceptor and we want the manager to ignore
the
value of <literal>requiresNew</literal> when binding interceptors? We can
use the
<literal>@NonBinding</literal> annotation:</para>
-<programlisting><![CDATA[@InterceptorBindingType
+<programlisting role="JAVA"><![CDATA[@InterceptorBindingType
@Target({METHOD, TYPE})
@Retention(RUNTIME)
public @interface Secure {
@@ -188,33 +188,33 @@
to bind <literal>TransactionInterceptor</literal> and
<literal>SecurityInterceptor</literal> to the same Web Bean:</para>
-<programlisting><![CDATA[@Secure(rolesAllowed="admin") @Transactional
+<programlisting
role="JAVA"><![CDATA[@Secure(rolesAllowed="admin")
@Transactional
public class ShoppingCart { ... }]]></programlisting>
<para>However, in very complex cases, an interceptor itself may specify some
combination of interceptor binding types:</para>
-<programlisting><![CDATA[@Transactional @Secure @Interceptor
+<programlisting role="JAVA"><![CDATA[@Transactional @Secure
@Interceptor
public class TransactionalSecureInterceptor { ... }]]></programlisting>
<para>Then this interceptor could be bound to the
<literal>checkout()</literal>
method using any one of the following combinations:</para>
-<programlisting><![CDATA[public class ShoppingCart {
+<programlisting role="JAVA"><![CDATA[public class ShoppingCart {
@Transactional @Secure public void checkout() { ... }
}]]></programlisting>
-<programlisting><![CDATA[@Secure
+<programlisting role="JAVA"><![CDATA[@Secure
public class ShoppingCart {
@Transactional public void checkout() { ... }
}]]></programlisting>
-<programlisting><![CDATA[@Transactionl
+<programlisting role="JAVA"><![CDATA[@Transactionl
public class ShoppingCart {
@Secure public void checkout() { ... }
}]]></programlisting>
-<programlisting><![CDATA[@Transactional @Secure
+<programlisting role="JAVA"><![CDATA[@Transactional @Secure
public class ShoppingCart {
public void checkout() { ... }
}]]></programlisting>
@@ -228,14 +228,14 @@
of annotation inheritance. Really, annotations should have reuse built in, to
allow this kind of thing to work:</para>
-<programlisting><![CDATA[public @interface Action extends Transactional, Secure
{ ... }]]></programlisting>
+<programlisting role="JAVA"><![CDATA[public @interface Action extends
Transactional, Secure { ... }]]></programlisting>
<para>Well, fortunately, Web Beans works around this missing feature of Java.
We may annotate one interceptor binding type with other interceptor binding
types. The interceptor bindings are transitive—any Web Bean with the first
interceptor binding inherits the interceptor bindings declared as
meta-annotations.</para>
-<programlisting><![CDATA[@Transactional @Secure
+<programlisting role="JAVA"><![CDATA[@Transactional @Secure
@InterceptorBindingType
@Target(TYPE)
@Retention(RUNTIME)
@@ -253,7 +253,7 @@
<para>The <literal>@Interceptors</literal> annotation defined by the
EJB specification
is supported for both enterprise and simple Web Beans, for example:</para>
-<programlisting><![CDATA[(a)Interceptors({TransactionInterceptor.class,
@SecurityInterceptor.class})
+<programlisting
role="JAVA"><![CDATA[(a)Interceptors({TransactionInterceptor.class,
@SecurityInterceptor.class})
public class ShoppingCart {
public void checkout() { ... }
}]]></programlisting>
Modified: doc/trunk/reference/en/modules/intro.xml
===================================================================
--- doc/trunk/reference/en/modules/intro.xml 2008-12-19 23:53:02 UTC (rev 613)
+++ doc/trunk/reference/en/modules/intro.xml 2008-12-20 00:24:19 UTC (rev 614)
@@ -26,7 +26,7 @@
for years in various applications. The first class parses a string into a
list of sentences:</para>
- <programlisting><![CDATA[public class SentenceParser {
+ <programlisting role="JAVA"><![CDATA[public class SentenceParser
{
public List<String> parse(String text) { ... }
}]]></programlisting>
@@ -34,14 +34,14 @@
external system that is able to translate sentences from one language to
another:</para>
- <programlisting><![CDATA[@Stateless
+ <programlisting role="JAVA"><![CDATA[@Stateless
public class SentenceTranslator implements Translator {
public String translate(String sentence) { ... }
}]]></programlisting>
<para>Where <literal>Translator</literal> is the local
interface:</para>
- <programlisting><![CDATA[@Local
+ <programlisting role="JAVA"><![CDATA[@Local
public interface Translator {
public String translate(String sentence);
}]]></programlisting>
@@ -49,7 +49,7 @@
<para>Unfortunately, we don't have a preexisting class that translates
whole
text documents. So let's write a Web Bean that does this job:</para>
- <programlisting><![CDATA[public class TextTranslator {
+ <programlisting role="JAVA"><![CDATA[public class TextTranslator
{
private SentenceParser sentenceParser;
private Translator sentenceTranslator;
@@ -73,7 +73,7 @@
<para>We may obtain an instance of
<literal>TextTranslator</literal> by
injecting it into a Web Bean, Servlet or EJB:</para>
- <programlisting><![CDATA[@Initializer
+ <programlisting role="JAVA"><![CDATA[@Initializer
public setTextTranslator(TextTranslator textTranslator) {
this.textTranslator = textTranslator;
}]]></programlisting>
@@ -81,7 +81,7 @@
<para>Alternatively, we may obtain an instance by directly calling a method
of the Web Bean manager:</para>
- <programlisting><![CDATA[TextTranslator tt =
manager.getInstanceByType(TextTranslator.class);]]></programlisting>
+ <programlisting role="JAVA"><![CDATA[TextTranslator tt =
manager.getInstanceByType(TextTranslator.class);]]></programlisting>
<para>But wait: <literal>TextTranslator</literal> does not have a
constructor
with no parameters! Is it still a Web Bean? Well, a class that does not have a
@@ -218,7 +218,7 @@
injection point has API type <literal>PaymentProcessor</literal> and
binding
type <literal>@CreditCard</literal>:</para>
-<programlisting><![CDATA[@CreditCard PaymentProcessor
paymentProcessor]]></programlisting>
+<programlisting role="JAVA"><![CDATA[@CreditCard PaymentProcessor
paymentProcessor]]></programlisting>
<para>If no binding type is explicitly specified at an injection point, the
default binding type <literal>@Current</literal> is assumed.</para>
@@ -231,7 +231,7 @@
and implements the API type <literal>PaymentProcessor</literal>. It could
therefore be injected to the example injection point:</para>
-<programlisting><![CDATA[@CreditCard
+<programlisting role="JAVA"><![CDATA[@CreditCard
public class CreditCardPaymentProcessor
implements PaymentProcessor { ... }]]></programlisting>
@@ -262,7 +262,7 @@
<para>In a testing environment, we might want to replace the
<literal>SentenceTranslator</literal>
Web Bean with a "mock object":</para>
-<programlisting><![CDATA[@Mock
+<programlisting role="JAVA"><![CDATA[@Mock
public class MockSentenceTranslator implements Translator {
public String translate(String sentence) {
return "Lorem ipsum dolor sit amet";
@@ -291,7 +291,7 @@
<para>For example, any web application may have <emphasis>session
scoped</emphasis>
Web Beans:</para>
-<programlisting><![CDATA[@SessionScoped
+<programlisting role="JAVA"><![CDATA[@SessionScoped
public class ShoppingCart { ... }]]></programlisting>
<para>An instance of a session scoped Web Bean is bound to a user session
@@ -313,19 +313,19 @@
used in Unified EL expressions. It's easy to specify the name of a Web
Bean:</para>
-<programlisting><![CDATA[@SessionScoped @Named("cart")
+<programlisting role="JAVA"><![CDATA[@SessionScoped
@Named("cart")
public class ShoppingCart { ... }]]></programlisting>
<para>Now we can easily use the Web Bean in any JSF or JSP page:</para>
-<programlisting><![CDATA[<h:dataTable value="#{cart.lineItems}"
var="item">
+<programlisting role="HTML"><![CDATA[<h:dataTable
value="#{cart.lineItems}" var="item">
....
</h:dataTable>]]></programlisting>
<para>It's even easier to just let the name be defaulted by the Web Bean
manager:</para>
-<programlisting><![CDATA[@SessionScoped @Named
+<programlisting role="JAVA"><![CDATA[@SessionScoped @Named
public class ShoppingCart { ... }]]></programlisting>
<para>In this case, the name defaults to
<literal>shoppingCart</literal>—the
@@ -344,7 +344,7 @@
<para>It remains possible to directly specify the interceptor class via
use of the <literal>@Interceptors</literal> annotation:</para>
-<programlisting><![CDATA[@SessionScoped
+<programlisting role="JAVA"><![CDATA[@SessionScoped
@Interceptors(TransactionInterceptor.class)
public class ShoppingCart { ... }]]></programlisting>
@@ -352,7 +352,7 @@
interceptor binding through an <emphasis>interceptor binding
type</emphasis>:</para>
-<programlisting><![CDATA[@SessionScoped @Transactional
+<programlisting role="JAVA"><![CDATA[@SessionScoped @Transactional
public class ShoppingCart { ... }]]></programlisting>
<para>We'll discuss Web Beans interceptors and decorators in
@@ -420,7 +420,7 @@
end of its lifecycle. This method is called the
<emphasis>destructor</emphasis>
method of the enterprise Web Bean.</para>
-<programlisting><![CDATA[@Stateful @SessionScoped
+<programlisting role="JAVA"><![CDATA[@Stateful @SessionScoped
public class ShoppingCart {
...
@@ -485,7 +485,7 @@
of the instantiation process, instead of leaving instantiation to the Web Bean
manager. For example:</para>
-<programlisting><![CDATA[@ApplicationScoped
+<programlisting role="JAVA"><![CDATA[@ApplicationScoped
public class Generator {
private Random random = new Random( System.currentTimeMillis() );
@@ -498,7 +498,7 @@
<para>The result of a producer method is injected just like any other Web
Bean.</para>
- <programlisting><![CDATA[@Random int
randomNumber]]></programlisting>
+ <programlisting role="JAVA"><![CDATA[@Random int
randomNumber]]></programlisting>
<para>The method return type and all interfaces it extends/implements directly
or indirectly
are API types of the producer method. If the return type is a class, all superclasses
are
@@ -506,13 +506,13 @@
<para>Some producer methods return objects that require explicit
destruction:</para>
-<programlisting><![CDATA[@Produces @RequestScoped Connection connect(User user)
{
+<programlisting role="JAVA"><![CDATA[@Produces @RequestScoped
Connection connect(User user) {
return createConnection( user.getId(), user.getPassword() );
}]]></programlisting>
<para>These producer methods may define matching <emphasis>disposal
methods</emphasis>:</para>
-<programlisting><![CDATA[void close(@Disposes Connection connection) {
+<programlisting role="JAVA"><![CDATA[void close(@Disposes Connection
connection) {
connection.close();
}]]></programlisting>
Modified: doc/trunk/reference/en/modules/producermethods.xml
===================================================================
--- doc/trunk/reference/en/modules/producermethods.xml 2008-12-19 23:53:02 UTC (rev 613)
+++ doc/trunk/reference/en/modules/producermethods.xml 2008-12-20 00:24:19 UTC (rev 614)
@@ -53,7 +53,7 @@
of deployment-time polymorphism. But once the system is deployed, the Web Bean
implementation is fixed. A producer method has no such limitation:</para>
-<programlisting><![CDATA[@SessionScoped
+<programlisting role="JAVA"><![CDATA[@SessionScoped
public class Preferences {
private PaymentStrategyType paymentStrategy;
@@ -74,7 +74,7 @@
<para>Consider an injection point:</para>
-<programlisting><![CDATA[@Preferred PaymentStrategy
paymentStrat;]]></programlisting>
+<programlisting role="JAVA"><![CDATA[@Preferred PaymentStrategy
paymentStrat;]]></programlisting>
<para>This injection point has the same type and binding annotations as the
producer
method, so it resolves to the producer method using the usual Web Beans injection
@@ -92,7 +92,7 @@
<para>To change this behavior, we can add a
<literal>@SessionScoped</literal> annotation
to the method.</para>
-<programlisting><![CDATA[@Produces @Preferred @SessionScoped
+<programlisting role="JAVA"><![CDATA[@Produces @Preferred
@SessionScoped
public PaymentStrategy getPaymentStrategy() {
...
}]]></programlisting>
@@ -114,7 +114,7 @@
<para>If this isn't what we want we can use dependency injection into the
producer method to obtain Web Bean instances:</para>
-<programlisting><![CDATA[@Produces @Preferred @SessionScoped
+<programlisting role="JAVA"><![CDATA[@Produces @Preferred
@SessionScoped
public PaymentStrategy getPaymentStrategy(CreditCardPaymentStrategy ccps,
ChequePaymentStrategy cps,
PayPalPaymentStrategy ppps) {
@@ -150,7 +150,7 @@
<para>Consider the following producer method:</para>
-<programlisting><![CDATA[@Produces @Preferred @SessionScoped
+<programlisting role="JAVA"><![CDATA[@Produces @Preferred
@SessionScoped
public PaymentStrategy getPaymentStrategy(@New CreditCardPaymentStrategy ccps,
@New ChequePaymentStrategy cps,
@New PayPalPaymentStrategy ppps) {
Modified: doc/trunk/reference/en/modules/scopescontexts.xml
===================================================================
--- doc/trunk/reference/en/modules/scopescontexts.xml 2008-12-19 23:53:02 UTC (rev 613)
+++ doc/trunk/reference/en/modules/scopescontexts.xml 2008-12-20 00:24:19 UTC (rev 614)
@@ -34,7 +34,7 @@
<para>Web Beans features an <emphasis>extensible context
model</emphasis>. It is possible
to define new scopes by creating a new scope type annotation:</para>
-<programlisting><![CDATA[@Retention(RUNTIME)
+<programlisting role="JAVA"><![CDATA[@Retention(RUNTIME)
@Target({TYPE, METHOD})
@ScopeType
public @interface ClusterScoped {}]]></programlisting>
@@ -47,7 +47,7 @@
<para>We can apply a scope type annotation to a Web Bean implementation class to
specify
the scope of the Web Bean:</para>
-<programlisting><![CDATA[@ClusterScoped
+<programlisting role="JAVA"><![CDATA[@ClusterScoped
public class SecondLevelCache { ... }]]></programlisting>
<!--
@@ -156,7 +156,7 @@
<para>Web Beans provides a built-in Web Bean for controlling the lifecyle of
conversations in a JSF application. This Web Bean may be obtained by
injection:</para>
- <programlisting>@Current Conversation conversation;</programlisting>
+ <programlisting role="JAVA">@Current Conversation
conversation;</programlisting>
<para>To promote the conversation associated with the current request to a
long-running conversation, call the <literal>begin()</literal> method from
@@ -166,7 +166,7 @@
<para>In the following example, a conversation-scoped Web Bean controls the
conversation with which it is associated:</para>
-<programlisting>@ConversationScoped @Stateful
+<programlisting role="JAVA">@ConversationScoped @Stateful
public class OrderBuilder {
private Order order;
@@ -219,7 +219,7 @@
<para>Therefore, the following link propagates the conversation:</para>
- <programlisting><![CDATA[<a
href="/addProduct.jsp?cid=#{conversation.id}">Add
Product</a>]]></programlisting>
+ <programlisting role="HTML"><![CDATA[<a
href="/addProduct.jsp?cid=#{conversation.id}">Add
Product</a>]]></programlisting>
<para>The Web Bean manager is also required to propagate conversations
across any redirect, even if the conversation is not marked long-running.
@@ -243,7 +243,7 @@
the timeout. This is a hint to the Web Bean manager, which is free to ignore
the setting.</para>
-
<programlisting>conversation.setTimeout(timeoutInMillis);</programlisting>
+ <programlisting
role="JAVA">conversation.setTimeout(timeoutInMillis);</programlisting>
</section>
@@ -258,7 +258,7 @@
<para>For example, this Web Bean has the scope type
<literal>@Dependent</literal>:</para>
-<programlisting><![CDATA[public class Calculator { ...
}]]></programlisting>
+<programlisting role="JAVA"><![CDATA[public class Calculator { ...
}]]></programlisting>
<para>When an injection point of a Web Bean resolves to a dependent Web Bean,
a new instance of the dependent Web Bean is created every time the first
@@ -285,7 +285,7 @@
<emphasis>implicit</emphasis> definition of a dependent Web Bean at an
injection point.
Suppose we declare the following injected field:</para>
-<programlisting><![CDATA[@New Calculator
calculator;]]></programlisting>
+<programlisting role="JAVA"><![CDATA[@New Calculator
calculator;]]></programlisting>
<para>Then a Web Bean with scope <literal>@Dependent</literal>, binding
type
<literal>@New</literal>, API type <literal>Calculator</literal>,
implementation class
@@ -295,13 +295,13 @@
<para>This is true even if <literal>Calculator</literal> is
<emphasis>already</emphasis>
declared with a different scope type, for example:</para>
-<programlisting><![CDATA[@ConversationScoped
+<programlisting role="JAVA"><![CDATA[@ConversationScoped
public class Calculator { ... }]]></programlisting>
<para>So the following injected attributes each get a different instance of
<literal>Calculator</literal>:</para>
-<programlisting><![CDATA[public class PaymentCalc {
+<programlisting role="JAVA"><![CDATA[public class PaymentCalc {
@Current Calculator calculator;
@New Calculator newCalculator;
Modified: doc/trunk/reference/en/modules/specialization.xml
===================================================================
--- doc/trunk/reference/en/modules/specialization.xml 2008-12-19 23:53:02 UTC (rev 613)
+++ doc/trunk/reference/en/modules/specialization.xml 2008-12-20 00:24:19 UTC (rev 614)
@@ -8,7 +8,7 @@
time. For example, the following enterprise Web Bean provides an implementation
of the API <literal>PaymentProcessor</literal> in production:</para>
-<programlisting>@CreditCard @Stateless
+<programlisting role="JAVA">@CreditCard @Stateless
public class CreditCardPaymentProcessor
implements PaymentProcessor {
...
@@ -17,7 +17,7 @@
<para>But in our staging environment, we override that implementation of
<literal>PaymentProcessor</literal> with a different Web
Bean:</para>
-<programlisting>@CreditCard @Stateless @Staging
+<programlisting role="JAVA">@CreditCard @Stateless @Staging
public class StagingCreditCardPaymentProcessor
implements PaymentProcessor {
...
@@ -29,7 +29,7 @@
would have a higher priority than the default deployment type
<literal>@Production</literal>,
and therefore clients with the following injection point:</para>
-<programlisting>@CreditCard PaymentProcessor ccpp</programlisting>
+<programlisting role="JAVA">@CreditCard PaymentProcessor
ccpp</programlisting>
<para>Would receive an instance of
<literal>StagingCreditCardPaymentProcessor</literal>.</para>
@@ -82,7 +82,7 @@
</listitem>
</itemizedlist>
-<programlisting>@Stateless @Staging @Specializes
+<programlisting role="JAVA">@Stateless @Staging @Specializes
public class StagingCreditCardPaymentProcessor
extends CreditCardPaymentProcessor {
...
Modified: doc/trunk/reference/en/modules/stereotypes.xml
===================================================================
--- doc/trunk/reference/en/modules/stereotypes.xml 2008-12-19 23:53:02 UTC (rev 613)
+++ doc/trunk/reference/en/modules/stereotypes.xml 2008-12-20 00:24:19 UTC (rev 614)
@@ -41,14 +41,14 @@
<para>A stereotype is a Java annotation type. This stereotype identifies
action classes in some MVC framework:</para>
-<programlisting><![CDATA[@Retention(RUNTIME)
+<programlisting role="JAVA"><![CDATA[@Retention(RUNTIME)
@Target(TYPE)
@Stereotype
public @interface Action {}]]></programlisting>
<para>We use the stereotype by applying the annotation to a Web
Bean.</para>
-<programlisting><![CDATA[@Action
+<programlisting role="JAVA"><![CDATA[@Action
public class LoginAction { ... }]]></programlisting>
<section>
@@ -60,7 +60,7 @@
be deployed when the system executes as a web application, we might
specify the following defaults for action classes:</para>
-<programlisting><![CDATA[@Retention(RUNTIME)
+<programlisting role="JAVA"><![CDATA[@Retention(RUNTIME)
@Target(TYPE)
@RequestScoped
@WebTier
@@ -70,7 +70,7 @@
<para>Of course, a particular action may still override these defaults
if necessary:</para>
-<programlisting><![CDATA[@Dependent @Mock @Action
+<programlisting role="JAVA"><![CDATA[@Dependent @Mock @Action
public class MockLoginAction { ... }]]></programlisting>
<para>If we want to force all actions to a particular scope, we can
@@ -85,7 +85,7 @@
scopes. Web Beans lets us explicitly specify the set of allowed scopes
for Web Beans with a certain stereotype. For example:</para>
-<programlisting><![CDATA[@Retention(RUNTIME)
+<programlisting role="JAVA"><![CDATA[@Retention(RUNTIME)
@Target(TYPE)
@RequestScoped
@WebTier
@@ -99,7 +99,7 @@
<para>We can also force all Web Bean with a certain stereotype to
implement an interface or extend a class:</para>
-<programlisting><![CDATA[@Retention(RUNTIME)
+<programlisting role="JAVA"><![CDATA[@Retention(RUNTIME)
@Target(TYPE)
@RequestScoped
@WebTier
@@ -118,7 +118,7 @@
<para>A stereotype may specify a set of interceptor bindings to be
inherited by all Web Beans with that stereotype.</para>
-<programlisting><![CDATA[@Retention(RUNTIME)
+<programlisting role="JAVA"><![CDATA[@Retention(RUNTIME)
@Target(TYPE)
@RequestScoped
@Transactional(requiresNew=true)
@@ -140,7 +140,7 @@
referenced in JSP pages, so they're a perfect use case for this feature.
All we need to do is add an empty <literal>@Named</literal>
annotation:</para>
-<programlisting><![CDATA[@Retention(RUNTIME)
+<programlisting role="JAVA"><![CDATA[@Retention(RUNTIME)
@Target(TYPE)
@RequestScoped
@Transactional(requiresNew=true)
@@ -163,7 +163,7 @@
<para>Web Beans defines one further standard stereotype:</para>
-<programlisting><![CDATA[@Named
+<programlisting role="JAVA"><![CDATA[@Named
@RequestScoped
@Stereotype
@Target({TYPE, METHOD})
Modified: doc/trunk/reference/en/modules/xml.xml
===================================================================
--- doc/trunk/reference/en/modules/xml.xml 2008-12-19 23:53:02 UTC (rev 613)
+++ doc/trunk/reference/en/modules/xml.xml 2008-12-20 00:24:19 UTC (rev 614)
@@ -53,7 +53,7 @@
<para>For example, the element
<literal><util:Date/></literal> in the following
XML fragment refers to the class
<literal>java.util.Date</literal>:</para>
-<programlisting><![CDATA[<WebBeans xmlns="urn:java:javax.webbeans"
+<programlisting role="XML"><![CDATA[<WebBeans
xmlns="urn:java:javax.webbeans"
xmlns:util="urn:java:java.util">
<util:Date/>
@@ -64,7 +64,7 @@
a simple Web Bean! An instance of <literal>Date</literal> may now be
injected by
any other Web Bean:</para>
-<programlisting><![CDATA[@Current Date date]]></programlisting>
+<programlisting role="JAVA"><![CDATA[@Current Date
date]]></programlisting>
</section>
@@ -74,7 +74,7 @@
<para>We can declare the scope, deployment type and interceptor binding types
using direct child elements of the Web Bean declaration:</para>
-<programlisting><![CDATA[<myapp:ShoppingCart>
+<programlisting role="XML"><![CDATA[<myapp:ShoppingCart>
<SessionScoped/>
<myfwk:Transactional requiresNew="true"/>
<myfwk:Secure/>
@@ -82,7 +82,7 @@
<para>We use exactly the same approach to specify names and binding
type:</para>
-<programlisting><![CDATA[<util:Date>
+<programlisting role="XML"><![CDATA[<util:Date>
<Named>currentTime</Named>
</util:Date>
@@ -101,13 +101,13 @@
<para>Where <literal>@Login</literal> and
<literal>@SystemStart</literal> are
binding annotations types.</para>
-<programlisting><![CDATA[@Current Date currentTime;
+<programlisting role="JAVA"><![CDATA[@Current Date currentTime;
@Login Date loginTime;
@SystemStart Date systemStartTime;]]></programlisting>
<para>As usual, a Web Bean may support multiple binding types:</para>
-<programlisting><![CDATA[<myapp:AsynchronousChequePaymentProcessor>
+<programlisting
role="XML"><![CDATA[<myapp:AsynchronousChequePaymentProcessor>
<myapp:PayByCheque/>
<myapp:Asynchronous/>
</myapp:AsynchronousChequePaymentProcessor>]]></programlisting>
@@ -115,7 +115,7 @@
<para>Interceptors and decorators are just simple Web Beans, so they may be
declared just like any other simple Web Bean:</para>
-<programlisting><![CDATA[<myfwk:TransactionInterceptor>
+<programlisting
role="XML"><![CDATA[<myfwk:TransactionInterceptor>
<Interceptor/>
<myfwk:Transactional/>
</myfwk:TransactionInterceptor>]]></programlisting>
@@ -136,7 +136,7 @@
<para>Web Beans lets us define a Web Bean at an injection point. For
example:</para>
-<programlisting><![CDATA[<myapp:System>
+<programlisting role="XML"><![CDATA[<myapp:System>
<ApplicationScoped/>
<myapp:admin>
<myapp:Name>
@@ -167,7 +167,7 @@
a schema. There's nothing specific to Web Beans about writing or using the
schema.</para>
-<programlisting><![CDATA[<WebBeans xmlns="urn:java:javax.webbeans"
+<programlisting role="XML"><![CDATA[<WebBeans
xmlns="urn:java:javax.webbeans"
xmlns:myapp="urn:java:com.mydomain.myapp"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:java:javax.webbeans
http://java.sun.com/jee/web-beans-1.0.xsd