[webbeans-commits] Webbeans SVN: r3729 - in examples/trunk/jsf/numberguess: src/main/java/org/jboss/webbeans/examples/numberguess and 1 other directories.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Tue Sep 22 10:52:13 EDT 2009
Author: pete.muir at jboss.org
Date: 2009-09-22 10:52:13 -0400 (Tue, 22 Sep 2009)
New Revision: 3729
Added:
examples/trunk/jsf/numberguess/pom-jboss5.xml
examples/trunk/jsf/numberguess/readme.txt
Removed:
examples/trunk/jsf/numberguess/pom.xml
Modified:
examples/trunk/jsf/numberguess/build.xml
examples/trunk/jsf/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java
examples/trunk/jsf/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/MaxNumber.java
examples/trunk/jsf/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Random.java
examples/trunk/jsf/numberguess/src/main/webapp/WEB-INF/faces-config.xml
Log:
update to latest spec, update to JSF2, make useful for non JBoss AS targets
Modified: examples/trunk/jsf/numberguess/build.xml
===================================================================
--- examples/trunk/jsf/numberguess/build.xml 2009-09-22 14:50:48 UTC (rev 3728)
+++ examples/trunk/jsf/numberguess/build.xml 2009-09-22 14:52:13 UTC (rev 3729)
@@ -1,7 +1,8 @@
<project basedir="." name="Numberguess Example Build" default="restart">
<property name="example.name" value="webbeans-numberguess" />
+ <property name="pom.file" value="pom-jboss5.xml" />
- <import file="../build.xml" />
+ <import file="../../build.xml" />
-</project>
\ No newline at end of file
+</project>
Copied: examples/trunk/jsf/numberguess/pom-jboss5.xml (from rev 3695, examples/trunk/jsf/numberguess/pom.xml)
===================================================================
--- examples/trunk/jsf/numberguess/pom-jboss5.xml (rev 0)
+++ examples/trunk/jsf/numberguess/pom-jboss5.xml 2009-09-22 14:52:13 UTC (rev 3729)
@@ -0,0 +1,86 @@
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.jboss.webbeans.examples</groupId>
+ <artifactId>webbeans-examples-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.jboss.webbeans.examples</groupId>
+ <artifactId>webbeans-numberguess</artifactId>
+ <packaging>war</packaging>
+ <name>Web Beans Examples: Numberguess for JBoss AS 5.x</name>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>codehaus snapshot repository</id>
+ <url>http://snapshots.repository.codehaus.org/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <scope>test</scope>
+ <classifier>jdk15</classifier>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.webbeans</groupId>
+ <artifactId>jsr299-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.facelets</groupId>
+ <artifactId>jsf-facelets</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+
+ <!-- <dependency>
+ <groupId>org.jboss.el</groupId>
+ <artifactId>jboss-el</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>-->
+
+ <dependency>
+ <groupId>org.glassfish.web</groupId>
+ <artifactId>el-impl</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>jsr250-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>webbeans-numberguess</finalName>
+ </build>
+
+</project>
+
Deleted: examples/trunk/jsf/numberguess/pom.xml
===================================================================
--- examples/trunk/jsf/numberguess/pom.xml 2009-09-22 14:50:48 UTC (rev 3728)
+++ examples/trunk/jsf/numberguess/pom.xml 2009-09-22 14:52:13 UTC (rev 3729)
@@ -1,86 +0,0 @@
-<?xml version="1.0"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.jboss.webbeans.examples</groupId>
- <artifactId>webbeans-examples-parent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- </parent>
-
- <groupId>org.jboss.webbeans.examples</groupId>
- <artifactId>webbeans-numberguess</artifactId>
- <packaging>war</packaging>
- <name>Web Beans Examples: Numberguess</name>
-
- <pluginRepositories>
- <pluginRepository>
- <id>codehaus snapshot repository</id>
- <url>http://snapshots.repository.codehaus.org/</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- </pluginRepository>
- </pluginRepositories>
-
- <dependencies>
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <scope>test</scope>
- <classifier>jdk15</classifier>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>jsr299-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>com.sun.facelets</groupId>
- <artifactId>jsf-facelets</artifactId>
- <scope>runtime</scope>
- </dependency>
-
- <!-- <dependency>
- <groupId>org.jboss.el</groupId>
- <artifactId>jboss-el</artifactId>
- <exclusions>
- <exclusion>
- <groupId>javax.el</groupId>
- <artifactId>el-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>-->
-
- <dependency>
- <groupId>org.glassfish.web</groupId>
- <artifactId>el-impl</artifactId>
- <exclusions>
- <exclusion>
- <groupId>javax.el</groupId>
- <artifactId>el-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>javax.annotation</groupId>
- <artifactId>jsr250-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- </dependencies>
-
- <build>
- <finalName>webbeans-numberguess</finalName>
- </build>
-
-</project>
-
Copied: examples/trunk/jsf/numberguess/readme.txt (from rev 3695, examples/trunk/jsf/servlet-numberguess/readme.txt)
===================================================================
--- examples/trunk/jsf/numberguess/readme.txt (rev 0)
+++ examples/trunk/jsf/numberguess/readme.txt 2009-09-22 14:52:13 UTC (rev 3729)
@@ -0,0 +1,77 @@
+Web Beans Numberguess Example (Servlet Container)
+=================================================
+
+This example demonstrates the use of Web Beans in a Servlet container
+environment (Tomcat 6 / Jetty 6) and in JBoss AS. No alterations are expected to be made to the
+Servlet container. All services are self-contained within the deployment.
+
+This example uses a Maven 2 build. Execute the following command to build the
+WAR. The WAR will will be located in the target directory after completion of
+the build.
+
+ mvn
+
+Now you're ready to deploy.
+
+== Deploying with an embedded servlet container
+
+Run this command to execute the application in an embedded Jetty 6 container:
+
+ mvn war:inplace jetty:run
+
+You can also execute the application in an embedded Tomcat 6 container:
+
+ mvn war:inplace tomcat:run
+
+In both cases, any changes to assets in WebContent take affect immediately. If
+a change to a webapp configuration file is made, the application may
+automatically redeploy. The redeploy behavior can be fined tuned in the plugin
+configuration (at least for Jetty). If you make a change to a classpath
+resource, you need to execute a build:
+
+ mvn compile war:inplace
+
+Note that war:inplace copies the compiled classes and JARs inside WebContent,
+under WEB-INF/classes and WEB-INF/lib, respectively, mixing source and compiled
+files. However, the build does work around these temporary files by excluding
+them from the packaged WAR and cleaning them during the Maven clean phase.
+These folders are also ignored by SVN.
+
+== Deploying to standalone Tomcat
+
+If you want to run the application on a standalone Tomcat 6, first download and
+extract Tomcat 6. This build assumes you will be running Tomcat in its default
+configuration, with a hostname of localhost and port 8080. Before starting
+Tomcat, add the following line to conf/tomcat-users.xml to allow the Maven
+Tomcat plugin to access the manager application, then start Tomcat:
+
+ <user username="admin" password="" roles="manager"/>
+
+To override this username and password, add a <server> with id tomcat in your
+Maven 2 settings.xml file, set the <username> and <password> elements to the
+appropriate values and uncomment the <server> element inside the
+tomcat-maven-plugin configuration in the pom.xml.
+
+You can deploy the packaged archive to Tomcat via HTTP PUT using this command:
+
+ mvn package tomcat:deploy
+
+Then you use this command to undeploy the application:
+
+ mvn tomcat:undeploy
+
+Instead of packaging the WAR, you can deploy it as an exploded archive
+immediately after the war goal is finished assembling the exploded structure:
+
+ mvn compile war:exploded tomcat:exploded
+
+Once the application is deployed, you can redeploy it using the following command:
+
+ mvn tomcat:redeploy
+
+But likely you want to run one or more build goals first before you redeploy:
+
+ mvn compile tomcat:redeploy
+ mvn war:exploded tomcat:redeploy
+ mvn compile war:exploded tomcat:redeploy
+
Modified: examples/trunk/jsf/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java
===================================================================
--- examples/trunk/jsf/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java 2009-09-22 14:50:48 UTC (rev 3728)
+++ examples/trunk/jsf/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java 2009-09-22 14:52:13 UTC (rev 3729)
@@ -5,11 +5,12 @@
import javax.annotation.PostConstruct;
import javax.enterprise.context.SessionScoped;
import javax.enterprise.inject.Instance;
-import javax.enterprise.inject.Named;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
import javax.faces.context.FacesContext;
+import javax.inject.Inject;
+import javax.inject.Named;
@Named
@SessionScoped
@@ -20,13 +21,13 @@
private int guess;
private int smallest;
- @MaxNumber
+ @Inject @MaxNumber
private int maxNumber;
private int biggest;
private int remainingGuesses;
- @Random Instance<Integer> randomNumber;
+ @Inject @Random Instance<Integer> randomNumber;
public Game()
{
Modified: examples/trunk/jsf/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/MaxNumber.java
===================================================================
--- examples/trunk/jsf/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/MaxNumber.java 2009-09-22 14:50:48 UTC (rev 3728)
+++ examples/trunk/jsf/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/MaxNumber.java 2009-09-22 14:52:13 UTC (rev 3729)
@@ -11,12 +11,12 @@
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
-import javax.enterprise.inject.BindingType;
+import javax.inject.Qualifier;
@Target( { TYPE, METHOD, PARAMETER, FIELD })
@Retention(RUNTIME)
@Documented
- at BindingType
+ at Qualifier
public @interface MaxNumber
{
Modified: examples/trunk/jsf/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Random.java
===================================================================
--- examples/trunk/jsf/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Random.java 2009-09-22 14:50:48 UTC (rev 3728)
+++ examples/trunk/jsf/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Random.java 2009-09-22 14:52:13 UTC (rev 3729)
@@ -11,12 +11,12 @@
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
-import javax.enterprise.inject.BindingType;
+import javax.inject.Qualifier;
@Target( { TYPE, METHOD, PARAMETER, FIELD })
@Retention(RUNTIME)
@Documented
- at BindingType
+ at Qualifier
public @interface Random
{
Modified: examples/trunk/jsf/numberguess/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- examples/trunk/jsf/numberguess/src/main/webapp/WEB-INF/faces-config.xml 2009-09-22 14:50:48 UTC (rev 3728)
+++ examples/trunk/jsf/numberguess/src/main/webapp/WEB-INF/faces-config.xml 2009-09-22 14:52:13 UTC (rev 3729)
@@ -1,11 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
-<faces-config version="1.2"
+<faces-config version="2.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
-
- <application>
- <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
- </application>
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">
</faces-config>
More information about the weld-commits
mailing list