Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@542 1c488680-804c-0410-94cd-c6b725194a0e
- Loading branch information
Showing
18 changed files
with
599 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<project basedir="." name="Numberguess Example Build" default="restart"> | ||
|
||
<property name="example.name" value="webbeans-translator" /> | ||
<property name="type" value="ear" /> | ||
|
||
<import file="../build.xml" /> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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>parent</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
</parent> | ||
<groupId>org.jboss.webbeans.examples.translator</groupId> | ||
<artifactId>parent</artifactId> | ||
<packaging>pom</packaging> | ||
<name>Web Beans Examples: Translator (parent)</name> | ||
|
||
<description> | ||
Ear Example for the reference implementation of JSR 299: Web Beans | ||
</description> | ||
|
||
<modules> | ||
<module>webbeans-translator-war</module> | ||
<module>webbeans-translator-ejb</module> | ||
<module>webbeans-translator-ear</module> | ||
</modules> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.jboss.webbeans.examples.translator</groupId> | ||
<artifactId>webbeans-translator-war</artifactId> | ||
<version>${webbeans.version}</version> | ||
<type>war</type> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jboss.webbeans.examples.translator</groupId> | ||
<artifactId>webbeans-translator-ear</artifactId> | ||
<version>${webbeans.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jboss.webbeans.examples.translator</groupId> | ||
<artifactId>webbeans-translator-ejb</artifactId> | ||
<version>${webbeans.version}</version> | ||
<type>ejb</type> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<build> | ||
<pluginManagement> | ||
<plugins> | ||
|
||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
|
||
</project> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<?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.translator</groupId> | ||
<artifactId>parent</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<groupId>org.jboss.webbeans.examples</groupId> | ||
<artifactId>webbeans-translator-ear</artifactId> | ||
<packaging>ear</packaging> | ||
<name>Web Beans Examples: Translator (ear)</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.jboss.webbeans.examples.translator</groupId> | ||
<artifactId>webbeans-translator-ejb</artifactId> | ||
<type>ejb</type> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.jboss.webbeans.examples.translator</groupId> | ||
<artifactId>webbeans-translator-war</artifactId> | ||
<type>war</type> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.testng</groupId> | ||
<artifactId>testng</artifactId> | ||
<scope>test</scope> | ||
<classifier>jdk15</classifier> | ||
</dependency> | ||
|
||
<!-- <dependency> | ||
<groupId>org.jboss.el</groupId> | ||
<artifactId>jboss-el</artifactId> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>javax.el</groupId> | ||
<artifactId>el-api</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency>--> | ||
|
||
</dependencies> | ||
|
||
<build> | ||
<finalName>webbeans-translator</finalName> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-ear-plugin</artifactId> | ||
<configuration> | ||
<modules> | ||
<webModule> | ||
<groupId>org.jboss.webbeans.examples.translator</groupId> | ||
<artifactId>webbeans-translator-war</artifactId> | ||
<contextRoot>/webbeans-translator</contextRoot> | ||
</webModule> | ||
</modules> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?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.translator</groupId> | ||
<artifactId>parent</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<groupId>org.jboss.webbeans.examples.translator</groupId> | ||
<artifactId>webbeans-translator-ejb</artifactId> | ||
<packaging>ejb</packaging> | ||
<name>Web Beans Examples: Translator (ejb)</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>webbeans-api</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>javax.faces</groupId> | ||
<artifactId>jsf-api</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
<build> | ||
<finalName>webbeans-translator</finalName> | ||
</build> | ||
|
||
</project> | ||
|
82 changes: 82 additions & 0 deletions
82
...r/webbeans-translator-ejb/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package org.jboss.webbeans.examples.numberguess; | ||
|
||
|
||
import javax.faces.application.FacesMessage; | ||
import javax.faces.context.FacesContext; | ||
import javax.webbeans.Initializer; | ||
import javax.webbeans.Named; | ||
import javax.webbeans.SessionScoped; | ||
|
||
@Named | ||
@SessionScoped | ||
public class Game | ||
{ | ||
private int number; | ||
|
||
private int guess; | ||
private int smallest; | ||
private int biggest; | ||
private int remainingGuesses; | ||
|
||
public Game() | ||
{ | ||
} | ||
|
||
@Initializer | ||
Game(@Random int number, @MaxNumber int maxNumber) | ||
{ | ||
this.number = number; | ||
this.smallest = 1; | ||
this.biggest = maxNumber; | ||
this.remainingGuesses = 10; | ||
} | ||
|
||
public int getNumber() | ||
{ | ||
return number; | ||
} | ||
|
||
public int getGuess() | ||
{ | ||
return guess; | ||
} | ||
|
||
public void setGuess(int guess) | ||
{ | ||
this.guess = guess; | ||
} | ||
|
||
public int getSmallest() | ||
{ | ||
return smallest; | ||
} | ||
|
||
public int getBiggest() | ||
{ | ||
return biggest; | ||
} | ||
|
||
public int getRemainingGuesses() | ||
{ | ||
return remainingGuesses; | ||
} | ||
|
||
public String check() | ||
{ | ||
if (guess>number) | ||
{ | ||
biggest = guess - 1; | ||
} | ||
if (guess<number) | ||
{ | ||
smallest = guess + 1; | ||
} | ||
if (guess == number) | ||
{ | ||
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Correct!")); | ||
} | ||
remainingGuesses--; | ||
return null; | ||
} | ||
|
||
} |
Oops, something went wrong.