[webbeans-commits] Webbeans SVN: r3802 - doc/trunk/reference/en-US.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Tue Sep 29 11:25:36 EDT 2009


Author: pete.muir at jboss.org
Date: 2009-09-29 11:25:36 -0400 (Tue, 29 Sep 2009)
New Revision: 3802

Modified:
   doc/trunk/reference/en-US/environments.xml
   doc/trunk/reference/en-US/gettingstarted.xml
Log:
Start to update

Modified: doc/trunk/reference/en-US/environments.xml
===================================================================
--- doc/trunk/reference/en-US/environments.xml	2009-09-29 13:57:56 UTC (rev 3801)
+++ doc/trunk/reference/en-US/environments.xml	2009-09-29 15:25:36 UTC (rev 3802)
@@ -113,6 +113,11 @@
                <literal>dom4j.jar</literal>
             </para>
          </listitem>
+         <listitem>
+            <para>
+               <literal>google-collections.jar</literal>
+            </para>
+         </listitem>
       </itemizedlist>
       
       <para>
@@ -130,15 +135,15 @@
 
          <para>
             Tomcat has a read-only JNDI, so Web Beans can't automatically bind 
-            the Manager. To bind the Manager into JNDI, you should populate 
+            the BeanManager. To bind the BeanManager into JNDI, you should populate 
             <literal>META-INF/context.xml</literal> with the following
 			contents:
          </para>
       
          <programlisting role="XML"><![CDATA[<Context>
-   <Resource name="app/Manager" 
+   <Resource name="BeanManager" 
       auth="Container"
-      type="javax.inject.manager.Manager"
+      type="javax.enterprise.inject.spi.BeanManager"
       factory="org.jboss.webbeans.resources.ManagerObjectFactory"/>
 </Context>]]></programlisting>
 
@@ -149,17 +154,17 @@
       
          <programlisting role="XML"><![CDATA[<resource-env-ref>
    <resource-env-ref-name>
-      app/Manager
+      BeanManager
    </resource-env-ref-name>
    <resource-env-ref-type>
-      javax.inject.manager.Manager
+      javax.enterprise.inject.spi.BeanManager
    </resource-env-ref-type>
 </resource-env-ref>]]></programlisting>
 
          <para>
             Tomcat only allows you to bind entries to
-            <literal>java:comp/env</literal>, so the Manager will be available 
-            at <literal>java:comp/env/app/Manager</literal>
+            <literal>java:comp/env</literal>, so the BeanManager will be available 
+            at <literal>java:comp/env/BeanManager</literal>
          </para>
       
          <para>
@@ -186,12 +191,12 @@
          <programlisting role="XML"><![CDATA[<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
    "http://jetty.mortbay.org/configure.dtd">
 <Configure id="webAppCtx" class="org.mortbay.jetty.webapp.WebAppContext">
-   <New id="appManager" class="org.mortbay.jetty.plus.naming.Resource">
+   <New id="BeanManager" class="org.mortbay.jetty.plus.naming.Resource">
       <Arg><Ref id="webAppCtx"/></Arg> 
-      <Arg>app/Manager</Arg>
+      <Arg>BeanManager</Arg>
       <Arg>
          <New class="javax.naming.Reference">
-            <Arg>javax.inject.manager.Manager</Arg> 
+            <Arg>javax.enterprise.inject.spi.BeanManager</Arg> 
             <Arg>org.jboss.webbeans.resources.ManagerObjectFactory</Arg>
             <Arg/>
          </New>
@@ -208,8 +213,8 @@
 
          <para>
             Jetty only allows you to bind entries to
-            <literal>java:comp/env</literal>, so the Manager will be available 
-            at <literal>java:comp/env/app/Manager</literal>
+            <literal>java:comp/env</literal>, so the BeanManager will be available 
+            at <literal>java:comp/env/BeanManager</literal>
          </para>
 
          <para>

Modified: doc/trunk/reference/en-US/gettingstarted.xml
===================================================================
--- doc/trunk/reference/en-US/gettingstarted.xml	2009-09-29 13:57:56 UTC (rev 3801)
+++ doc/trunk/reference/en-US/gettingstarted.xml	2009-09-29 15:25:36 UTC (rev 3802)
@@ -12,11 +12,10 @@
 
     <para>
       Web Beans comes with a two deployable example applications:
-      <literal>webbeans-numberguess</literal>, a war example, containing only
+      <literal>webbeans-numberguess</literal>, a war example which runs on 
+      JBoss AS, Tomcat, Jetty and Google App Engine, containing only
       simple beans, and <literal>webbeans-translator</literal> an ear example,
-      containing enterprise beans. There are also two variations on the 
-      numberguess example, the tomcat example (suitable for deployment to 
-      Tomcat) and the jsf2 example, which you can use if you are running JSF2.
+      containing enterprise beans.
       To run the examples you'll need the following:
    </para>
    
@@ -25,9 +24,12 @@
        <para>the latest release of Web Beans,</para>
      </listitem>
      <listitem>
-       <para>JBoss AS 5.0.1.GA, or</para>
+       <para>JBoss AS 5.2.0, or</para>
      </listitem>
      <listitem>
+       <para>Jetty 6.1.x, or</para>
+     </listitem>
+     <listitem>
        <para>Apache Tomcat 6.0.x, and</para>
      </listitem>
      <listitem>
@@ -39,56 +41,21 @@
       <title>Using JBoss AS 5</title>
    
       <para> 
-         You'll need to download JBoss AS 5.0.1.GA from 
+         You'll need to download JBoss AS 5.2.0 from 
          <ulink url="http://www.jboss.org/jbossas/downloads/">jboss.org</ulink>,
          and unzip it. For example:
       </para>
       
       <programlisting><![CDATA[$ cd /Applications
-$ unzip ~/jboss-5.0.1.GA.zip]]></programlisting>
+$ unzip ~/jboss-5.2.0.Beta.zip]]></programlisting>
 
-      <para>
-         Next, download Web Beans from 
-         <ulink url="http://seamframework.org/Download">seamframework.org</ulink>,
-         and unzip it. For example
-      </para>
-      
-      <programlisting><![CDATA[$ cd ~/
-$ unzip ~/webbeans-$VERSION.zip]]></programlisting>
-
-   
-      <para>
-         Next, we need to tell Web Beans where JBoss is located. Edit
-         <literal>jboss-as/build.properties</literal> and set the
-         <literal>jboss.home</literal> property. For example:
-      </para>
-      
-      <programlisting>jboss.home=/Applications/jboss-5.0.1.GA</programlisting>
-      
-      <para>
-         To install Web Beans, you'll need Ant 1.7.0 installed, and the 
-         <literal>ANT_HOME</literal> environment variable set. For example:
-      </para>
-      
       <note>
          <para>
-            JBoss 5.1.0 comes with Web Beans built in, so there is no need to
-            update the server.
+            JBoss AS 5.2.0 comes with Web Beans built in.
          </para>
       </note>
       
-         <programlisting>$ unzip apache-ant-1.7.0.zip
-$ export ANT_HOME=~/apache-ant-1.7.0</programlisting>
-
       <para>
-         Then, you can install the update. The update script will use Maven to
-         download Web Beans automatically.
-      </para>
-      
-      <programlisting>$ cd webbeans-$VERSION/jboss-as
-$ ant update</programlisting>
-
-      <para>
          Now, you're ready to deploy your first example!
       </para>
       
@@ -132,14 +99,14 @@
          To deploy the numberguess example:
       </para>
    
-      <programlisting>$ cd examples/numberguess
+      <programlisting>$ cd examples/jsf/numberguess
 ant deploy</programlisting>
 
       <para>
          Start JBoss AS:
       </para>
       
-      <programlisting>$ /Application/jboss-5.0.0.GA/bin/run.sh</programlisting>
+      <programlisting>$ /Application/jboss-5.2.0.Beta/bin/run.sh</programlisting>
       
       <tip>
          <para>
@@ -189,12 +156,6 @@
       
       <programlisting><![CDATA[$ cd ~/
 $ unzip ~/webbeans-$VERSION.zip]]></programlisting>
-
-      <para>
-         Next, we need to tell Web Beans where Tomcat is located. Edit
-         <literal>jboss-as/build.properties</literal> and set the
-         <literal>tomcat.home</literal> property. For example:
-      </para>
       
       <programlisting>tomcat.home=/Applications/apache-tomcat-6.0.18</programlisting>
 
@@ -206,47 +167,36 @@
          <itemizedlist>
             <listitem>
                <para>
-                  <literal>ant tomcat.restart</literal> - deploy the example in exploded 
-                  format
+                  <literal>mvn war:inplace tomcat:run -Ptomcat</literal> - deploy the example in an embedded Tomcat
                </para>
             </listitem>
             <listitem>
                <para>
-                  <literal>ant tomcat.explode</literal> - update an exploded example, without
-                  restarting the deployment
+                  <literal>mvn compile war:exploded tomcat:exploded -Ptomcat</literal> - deploy the example to a running Tomcat install
                </para>
             </listitem>
-            <listitem>
-               <para>
-                  <literal>ant tomcat.deploy</literal> - deploy the example in compressed jar format
-               </para>
-            </listitem>
-            <listitem>
-               <para>
-                  <literal>ant tomcat.undeploy</literal> - remove the example (in compressed jar format) from the server
-               </para>
-            </listitem>
-            <listitem>
-               <para>
-                  <literal>ant tomcat.unexplode</literal> - remove the example (in exploded format) from the server
-               </para>
-            </listitem>
-            <listitem>
-               <para>
-                  <literal>ant tomcat.clean</literal> - clean the example
-              </para>
-            </listitem>
          </itemizedlist>
+         <para>
+            See the <code>jsf/numberguess/readme.txt</code> for more details.
+         </para>
       </tip>
       
       <para>
          To deploy the numberguess example for tomcat:
       </para>
    
-      <programlisting>$ cd examples/tomcat
+      <programlisting>$ cd examples/jsf/numberguess
 ant tomcat.deploy</programlisting>
 
       <para>
+         Edit <code>$TOMCAT_HOME/conf/tomcat-users.xml</code> and add
+      </para>
+      
+      <programlisting><![CDATA[<user username="admin" password="" roles="manager"/>]]></programlisting>
+   
+      <para>This allows Maven to communicate with Tomcat.</para>
+   
+      <para>
          Start Tomcat:
       </para>
       
@@ -257,6 +207,10 @@
             If you use Windows, use the <literal>startup.bat</literal>script.
          </para>
       </tip>
+      
+      <para>Deploy the application</para>
+      
+      <programlisting>$ mvn compile war:exploded tomcat:exploded -Ptomcat</programlisting>
    
       <para>
          Wait for the application to deploy, and enjoy hours of fun at
@@ -562,39 +516,38 @@
       
       <programlisting role="JAVA"><![CDATA[package org.jboss.webbeans.examples.numberguess;
 
+import java.io.Serializable;
 
 import javax.annotation.PostConstruct;
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.Instance;
 import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIInput;
 import javax.faces.context.FacesContext;
-import javax.webbeans.AnnotationLiteral;
-import javax.webbeans.Current;
-import javax.webbeans.Initializer;
-import javax.webbeans.Named;
-import javax.webbeans.SessionScoped;
-import javax.webbeans.manager.Manager;
+import javax.inject.Inject;
+import javax.inject.Named;
 
 @Named
 @SessionScoped
-public class Game
+public class Game implements Serializable
 {
    private int number;
    
    private int guess;
    private int smallest;
+   
+   @Inject @MaxNumber
+   private int maxNumber;
+   
    private int biggest;
    private int remainingGuesses;
    
-   @Current Manager manager;
+   @Inject @Random Instance<Integer> randomNumber;
    
    public Game()
    {
    }
-   
-   @Initializer
-   Game(@MaxNumber int maxNumber)
-   {      
-      this.biggest = maxNumber;
-   }
 
    public int getNumber()
    {
@@ -650,11 +603,32 @@
       this.smallest = 0;
       this.guess = 0;
       this.remainingGuesses = 10;
-      this.number = manager.getInstanceByType(Integer.class, new AnnotationLiteral<Random>(){});
+      this.biggest = maxNumber;
+      this.number = randomNumber.get();
    }
    
-}]]></programlisting>
+   public void validateNumberRange(FacesContext context,  UIComponent toValidate, Object value)
+   {
+      if (remainingGuesses <= 0)
+      {
+         FacesMessage message = new FacesMessage("No guesses left!");
+         context.addMessage(toValidate.getClientId(context), message);
+         ((UIInput)toValidate).setValid(false);
+         return;
+      }
+      int input = (Integer) value;
 
+      if (input < smallest || input > biggest) 
+      {
+         ((UIInput)toValidate).setValid(false);
+
+         FacesMessage message = new FacesMessage("Invalid guess");
+         context.addMessage(toValidate.getClientId(context), message);
+      }
+   }
+}
+]]></programlisting>
+
       <section>
          <title>The numberguess example in Tomcat</title>
          




More information about the weld-commits mailing list