Author: swd847
Date: 2010-03-06 16:42:25 -0500 (Sat, 06 Mar 2010)
New Revision: 12110
Modified:
modules/xml/trunk/docs/en-US/xml-general.xml
modules/xml/trunk/examples/princess-rescue/src/main/resources/META-INF/seam-beans.xml
Log:
upadted xml docs
Modified: modules/xml/trunk/docs/en-US/xml-general.xml
===================================================================
--- modules/xml/trunk/docs/en-US/xml-general.xml 2010-03-06 07:50:27 UTC (rev 12109)
+++ modules/xml/trunk/docs/en-US/xml-general.xml 2010-03-06 21:42:25 UTC (rev 12110)
@@ -4,13 +4,13 @@
<chapter id="remoting">
<title>Seam XML General</title>
- <para>Seam provides a method for configuring JSR-299 beans using XML. By default
the XML configuration defines new beans,
- it does not change existing beans.
+ <para>Seam provides a method for configuring JSR-299 beans using XML. Using XML
it is possible to add new beans, override existing beans, and add
+ extra configuration to existing beans. The default is to add a new bean.
</para>
<section>
<title>Configuration</title>
- <para>No special configuration is required to use seam-xml, all that is
required is to include the jar file in your delpoyment. </para>
+ <para>No special configuration is required to use seam-xml, all that is
required is to include the jar file in your deployment. </para>
</section>
<section>
@@ -122,7 +122,9 @@
<itemizedlist>
<listitem><para><literal>Beans</literal></para></listitem>
-
<listitem><para><literal>veto</literal></para></listitem>
+
<listitem><para><literal>extends</literal></para></listitem>
+
<listitem><para><literal>override</literal></para></listitem>
+
<listitem><para><literal>parameters</literal></para></listitem>
<listitem><para><literal>value</literal></para></listitem>
<listitem><para><literal>key</literal></para></listitem>
<listitem><para><literal>entry</literal></para></listitem>
@@ -152,10 +154,6 @@
<listitem><para><literal>javax.enterprise.event</literal></para></listitem>
<listitem><para><literal>javax.decorator</literal></para></listitem>
<listitem><para><literal>javax.interceptor</literal></para></listitem>
-
<listitem><para><literal>javax.persistence</literal></para></listitem>
-
<listitem><para><literal>javax.xml.ws</literal></para></listitem>
-
<listitem><para><literal>javax.jms</literal></para></listitem>
-
<listitem><para><literal>javax.sql</literal></para></listitem>
</itemizedlist>
<para>So the <literal><Produces></literal>
element above actually resolved to
<literal>java.enterprise.inject.Produces</literal>
@@ -164,18 +162,24 @@
</section>
<section>
- <title>Replacing existing bean declarations</title>
- <para>It is possible to prevent an existing bean being installed using the
<literal><veto/></literal> tag:</para>
+ <title>Overriding and extending beans</title>
+ <para>The may be cases where you want to modify an existing bean rather
that adding a new one. The <literal><override></literal> and
<literal><extends></literal>
+ tags allow you to do this. The
<literal><override></literal> tag prevents the existing bean
from being installed, and registers a new one with the given configuration.
+ The <literal><extends></literal> tag allows you to add
extra configuration to an existing bean.</para>
<programlisting>
<![CDATA[
-<veto>
- <test:ProducerBean/>
- <test:RecieverBean/>
-</veto>
+<test:MyBean>
+ <extends>
+ <test:NewQualifier/>
+</test:MyBean>
+
+<test:OtherBean>
+ <override>
+ <test:NewQualifier/>
+</test:OtherBean>
]]>
</programlisting>
- <para>The code above would prevent the
<literal>ProducerBean</literal> and
<literal>RecieverBean</literal> that was discovered in the bean discovery
phase from being installed.
- Using the veto tag it is possible to replace beans instead of just installing
new ones. </para>
+ <para>The first entry above adds a new qualifier to an existing bean
definition. The second prevents the existing bean from being installed, and registers a
new bean with a single qualifier.</para>
</section>
<section>
@@ -286,16 +290,22 @@
The first <literal><test:method></literal> entry in the
XML file configures the method that takes no arguments.
The <literal><Produces></literal> element makes it into
a producer method. The next entry in the file configures
the method that takes a <literal>MethodValueBean</literal> as a
parameter. The final entry configures a method that takes a two
- dimensional array of<literal>MethodValueBean</literal>'s as a
parameter. When configuring methods non-annotation classes are
- considered to represent method paramters. If these parameters have annotation
children they are taken to be annotations
- on the parameter.</para>
+ dimensional array of<literal>MethodValueBean</literal>'s as a
parameter. Method Parameters a specified inside the
<literal><parameters></literal>
+ tag. If these parameters have annotation children they are taken to be
annotations on the parameter. </para>
- <para>In this instance the corresponding java declaration would
be:</para>
+ <para>The corresponding java declaration for the xml above would
be:</para>
<programlisting>
<![CDATA[
@Produces
+public int method() {//method body}
+
+@Produces
@Qualifier1
public int method(@Qualifier2 MethodValueBean param) {//method body}
+
+@Produces
+@Qualifier1
+public int method(@Qualifier2 MethodValueBean[][] param) {//method body}
]]>
</programlisting>
<para>Array parameters can be represented using the
<literal><array></literal> element, with a child element to
Modified:
modules/xml/trunk/examples/princess-rescue/src/main/resources/META-INF/seam-beans.xml
===================================================================
---
modules/xml/trunk/examples/princess-rescue/src/main/resources/META-INF/seam-beans.xml 2010-03-06
07:50:27 UTC (rev 12109)
+++
modules/xml/trunk/examples/princess-rescue/src/main/resources/META-INF/seam-beans.xml 2010-03-06
21:42:25 UTC (rev 12110)
@@ -22,11 +22,13 @@
</p:GameManager>
<p:GameRoom>
+ <SessionScoped/>
<p:Room value="startRoom"/>
<p:north><Inject/><p:Room>emptyRoom1</p:Room></p:north>
</p:GameRoom>
<p:GameRoom>
+ <SessionScoped/>
<p:Room>emptyRoom1</p:Room>
<p:north><Inject/><p:Room>emptyRoom3</p:Room></p:north>
<p:west><Inject/><p:Room>dwarfRoom</p:Room></p:west>
@@ -35,6 +37,7 @@
</p:GameRoom>
<p:GameRoom>
+ <SessionScoped/>
<p:Room>dwarfRoom</p:Room>
<p:roomType>MONSTER</p:roomType>
<p:shootEffect>KILL</p:shootEffect>
@@ -46,6 +49,7 @@
</p:GameRoom>
<p:GameRoom>
+ <SessionScoped/>
<p:Room>pitRoom1</p:Room>
<p:roomType>GAMEOVER</p:roomType>
<p:adjacentMessage>You feel a breeze.</p:adjacentMessage>
@@ -54,12 +58,14 @@
</p:GameRoom>
<p:GameRoom>
+ <SessionScoped/>
<p:Room>emptyRoom2</p:Room>
<p:north><Inject/><p:Room>emptyRoom4</p:Room></p:north>
<p:west><Inject/><p:Room>pitRoom1</p:Room></p:west>
</p:GameRoom>
<p:GameRoom>
+ <SessionScoped/>
<p:Room>emptyRoom3</p:Room>
<p:north><Inject/><p:Room>pitRoom2</p:Room></p:north>
<p:east><Inject/><p:Room>batRoom</p:Room></p:east>
@@ -67,6 +73,7 @@
</p:GameRoom>
<p:GameRoom>
+ <SessionScoped/>
<p:Room>batRoom</p:Room>
<p:adjacentMessage>You hear a screeching noise.</p:adjacentMessage>
<p:message>A swarm of bats lands on you and tries to pick you up. They fail
miserably. You swat them away with your bow.</p:message>
@@ -78,6 +85,7 @@
</p:GameRoom>
<p:GameRoom>
+ <SessionScoped/>
<p:Room>emptyRoom4</p:Room>
<p:east><Inject/><p:Room>emptyRoom5</p:Room></p:east>
<p:south><Inject/><p:Room>emptyRoom2</p:Room></p:south>
@@ -85,6 +93,7 @@
</p:GameRoom>
<p:GameRoom>
+ <SessionScoped/>
<p:Room>emptyRoom5</p:Room>
<p:north><Inject/><p:Room>emptyRoom7</p:Room></p:north>
<p:east><Inject/><p:Room>dragonRoom</p:Room></p:east>
@@ -92,6 +101,7 @@
</p:GameRoom>
<p:GameRoom>
+ <SessionScoped/>
<p:Room>dragonRoom</p:Room>
<p:adjacentMessage>You hear a snoring noise. With every snore you see a
flickering light, as if something were breathing flames from its
nostrils.</p:adjacentMessage>
<p:roomType>GAMEOVER</p:roomType>
@@ -103,6 +113,7 @@
</p:GameRoom>
<p:GameRoom>
+ <SessionScoped/>
<p:Room>pitRoom2</p:Room>
<p:roomType>GAMEOVER</p:roomType>
<p:adjacentMessage>You feel a breeze.</p:adjacentMessage>
@@ -112,6 +123,7 @@
</p:GameRoom>
<p:GameRoom>
+ <SessionScoped/>
<p:Room>emptyRoom6</p:Room>
<p:north><Inject/><p:Room>emptyRoom8</p:Room></p:north>
<p:west><Inject/><p:Room>pitRoom2</p:Room></p:west>
@@ -119,6 +131,7 @@
</p:GameRoom>
<p:GameRoom>
+ <SessionScoped/>
<p:Room>emptyRoom7</p:Room>
<p:north><Inject/><p:Room>emptyRoom10</p:Room></p:north>
<p:east><Inject/><p:Room>princessRoom</p:Room></p:east>
@@ -126,6 +139,7 @@
</p:GameRoom>
<p:GameRoom>
+ <SessionScoped/>
<p:Room>princessRoom</p:Room>
<p:adjacentMessage>You hear a sobbing noise.</p:adjacentMessage>
<p:roomType>GAMEOVER</p:roomType>
@@ -137,12 +151,14 @@
</p:GameRoom>
<p:GameRoom>
+ <SessionScoped/>
<p:Room>emptyRoom8</p:Room>
<p:east><Inject/><p:Room>emptyRoom9</p:Room></p:east>
<p:south><Inject/><p:Room>emptyRoom6</p:Room></p:south>
</p:GameRoom>
<p:GameRoom>
+ <SessionScoped/>
<p:Room>emptyRoom9</p:Room>
<p:north><Inject/><p:Room>wumpusRoom</p:Room></p:north>
<p:east><Inject/><p:Room>emptyRoom10</p:Room></p:east>
@@ -150,12 +166,14 @@
</p:GameRoom>
<p:GameRoom>
+ <SessionScoped/>
<p:Room>emptyRoom10</p:Room>
<p:south><Inject/><p:Room>emptyRoom7</p:Room></p:south>
<p:west><Inject/><p:Room>emptyRoom9</p:Room></p:west>
</p:GameRoom>
<p:GameRoom>
+ <SessionScoped/>
<p:roomType>MONSTER</p:roomType>
<p:adjacentMessage>You smell a Wumpus</p:adjacentMessage>
<p:shootMessage>You hear a 'Thud', followed by a roar of
pain.</p:shootMessage>