[seam-commits] Seam SVN: r12108 - in modules/xml/trunk: examples and 26 other directories.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Sat Mar 6 01:53:46 EST 2010
Author: swd847
Date: 2010-03-06 01:53:46 -0500 (Sat, 06 Mar 2010)
New Revision: 12108
Added:
modules/xml/trunk/examples/
modules/xml/trunk/examples/princess-rescue/
modules/xml/trunk/examples/princess-rescue/pom.xml
modules/xml/trunk/examples/princess-rescue/src/
modules/xml/trunk/examples/princess-rescue/src/main/
modules/xml/trunk/examples/princess-rescue/src/main/java/
modules/xml/trunk/examples/princess-rescue/src/main/java/org/
modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/
modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/
modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/
modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/
modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/
modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/GameManager.java
modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/GameMessage.java
modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/GameRoom.java
modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/Room.java
modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/RoomType.java
modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/ShootEffect.java
modules/xml/trunk/examples/princess-rescue/src/main/resources/
modules/xml/trunk/examples/princess-rescue/src/main/resources/META-INF/
modules/xml/trunk/examples/princess-rescue/src/main/resources/META-INF/beans.xml
modules/xml/trunk/examples/princess-rescue/src/main/resources/META-INF/seam-beans.xml
modules/xml/trunk/examples/princess-rescue/src/main/webapp/
modules/xml/trunk/examples/princess-rescue/src/main/webapp/META-INF/
modules/xml/trunk/examples/princess-rescue/src/main/webapp/META-INF/context.xml
modules/xml/trunk/examples/princess-rescue/src/main/webapp/WEB-INF/
modules/xml/trunk/examples/princess-rescue/src/main/webapp/WEB-INF/faces-config.xml
modules/xml/trunk/examples/princess-rescue/src/main/webapp/WEB-INF/templates/
modules/xml/trunk/examples/princess-rescue/src/main/webapp/WEB-INF/templates/default.xhtml
modules/xml/trunk/examples/princess-rescue/src/main/webapp/WEB-INF/web.xml
modules/xml/trunk/examples/princess-rescue/src/main/webapp/home.xhtml
modules/xml/trunk/examples/princess-rescue/src/main/webapp/index.jsp
modules/xml/trunk/examples/princess-rescue/src/main/webapp/play.xhtml
modules/xml/trunk/examples/princess-rescue/src/main/webapp/resources/
modules/xml/trunk/examples/princess-rescue/src/main/webapp/resources/css/
modules/xml/trunk/examples/princess-rescue/src/main/webapp/resources/css/screen.css
modules/xml/trunk/examples/princess-rescue/src/main/webapp/resources/gfx/
modules/xml/trunk/examples/princess-rescue/src/main/webapp/resources/gfx/banner.png
modules/xml/trunk/examples/princess-rescue/src/main/webapp/resources/gfx/weld.png
modules/xml/trunk/examples/princess-rescue/src/test/
modules/xml/trunk/examples/princess-rescue/src/test/java/
modules/xml/trunk/examples/princess-rescue/src/test/java/org/
modules/xml/trunk/examples/princess-rescue/src/test/java/org/jboss/
modules/xml/trunk/examples/princess-rescue/src/test/java/org/jboss/seam/
modules/xml/trunk/examples/princess-rescue/src/test/java/org/jboss/seam/xml/
modules/xml/trunk/examples/princess-rescue/src/test/java/org/jboss/seam/xml/examples/
modules/xml/trunk/examples/princess-rescue/src/test/resources/
modules/xml/trunk/examples/princess-rescue/src/test/resources/jetty-env.xml
Log:
added start of seam xml example
Property changes on: modules/xml/trunk/examples/princess-rescue
___________________________________________________________________
Name: svn:ignore
+ .classpath
.project
.settings
Added: modules/xml/trunk/examples/princess-rescue/pom.xml
===================================================================
--- modules/xml/trunk/examples/princess-rescue/pom.xml (rev 0)
+++ modules/xml/trunk/examples/princess-rescue/pom.xml 2010-03-06 06:53:46 UTC (rev 12108)
@@ -0,0 +1,204 @@
+<?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>
+ <groupId>org.jboss.seam.xml.examples</groupId>
+ <artifactId>princess-rescue</artifactId>
+ <packaging>war</packaging>
+ <name>princess-rescue</name>
+ <version>1.0.0-SNAPSHOT</version>
+
+ <properties>
+ <!--
+ Explicitly declaring the source encoding eliminates the following message:
+ [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
+ -->
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <!-- The version of Weld extensions in use -->
+ <weld.extensions.version>1.0.1-SNAPSHOT</weld.extensions.version>
+ </properties>
+
+ <repositories>
+ <!-- Several key Java EE APIs and RIs are missing from the Maven Central Repository -->
+ <!-- The goal is to eventually eliminate the reliance on the JBoss repository -->
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <url>http://repository.jboss.org/maven2</url>
+ </repository>
+ </repositories>
+
+ <dependencyManagement>
+ <dependencies>
+ <!-- Import scope will provide versions for dependencies below. -->
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-extensions-bom</artifactId>
+ <version>${weld.extensions.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>seam-xml</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </dependency>
+
+ <!-- Common to JEE and Servlet containers -->
+ <dependency>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>jsr250-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- JSF 2.0 API -->
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ </dependency>
+
+ <!-- Optional, but pretty useful. -->
+ <!--
+ <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> </dependency>
+ -->
+
+ <!-- Optional, but highly recommended. -->
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>5.10</version>
+ <scope>test</scope>
+ <classifier>jdk15</classifier>
+ </dependency>
+
+ <!-- Jetty/Tomcat-specific scopes and artifacts -->
+
+ <!-- JSF 2.0 -->
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <version>2.0.1-FCS</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>2.0.1-FCS</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.weld.servlet</groupId>
+ <artifactId>weld-servlet</artifactId>
+ <version>1.0.1-Final</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.glassfish.web</groupId>
+ <artifactId>el-impl</artifactId>
+ <version>2.1.2-b04</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <!-- end Jetty/Tomcat-specific scopes and artifacts -->
+
+ <!-- Bean Validation API (JSR 303) -->
+ <dependency>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ </dependency>
+
+ <!-- Bean Validation Implementation -->
+ <!-- Provides portable constraints such as @NotEmpty, @Email and @Url -->
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>4.0.0.GA</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>princess-rescue</finalName>
+ <plugins>
+ <!-- Compiler plugin enforces Java 1.5 compatibility -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+
+ <!-- Eclipse plugin - download source and JavaDoc jars automatically -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <configuration>
+ <wtpversion>2.0</wtpversion>
+ <downloadSources>true</downloadSources>
+ <downloadJavadocs>true</downloadJavadocs>
+ </configuration>
+ </plugin>
+
+ <!-- Embedded Jetty (jetty:run) -->
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>maven-jetty-plugin</artifactId>
+ <configuration>
+ <!-- Delete this block to have Jetty run default port (8080) -->
+ <connectors>
+ <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
+ <port>9090</port>
+ </connector>
+ </connectors>
+ <!-- force friendly name instead of artifact name + version -->
+ <contextPath>${project.build.finalName}</contextPath>
+ <!-- Where the BeanManager is constructed. This is where you'll declare datasources. -->
+ <jettyEnvXml>${basedir}/src/test/resources/jetty-env.xml</jettyEnvXml>
+ <!-- This parameter will auto-deploy modified classes. -->
+ <!-- You can save changes in a file or class and refresh your browser to view the changes. -->
+ <scanIntervalSeconds>3</scanIntervalSeconds>
+ </configuration>
+ </plugin>
+
+ <!-- Embedded Tomcat (package tomcat:run) -->
+ <!-- Standalone Tomcat (package tomcat:deploy) -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>tomcat-maven-plugin</artifactId>
+ <configuration>
+ <path>/${project.build.finalName}</path>
+ <!-- Embedded port -->
+ <port>9090</port>
+ <!--
+ The default authentication credentials for remote deployment are username "admin" with no password To
+ override credentials, define a server in settings.xml and activate it using the <server> element
+ -->
+ <url>http://localhost:8080/manager</url>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/GameManager.java
===================================================================
--- modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/GameManager.java (rev 0)
+++ modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/GameManager.java 2010-03-06 06:53:46 UTC (rev 12108)
@@ -0,0 +1,217 @@
+package org.jboss.seam.xml.examples.princess;
+
+import java.io.Serializable;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+ at SessionScoped
+ at Named
+public class GameManager implements Serializable
+{
+
+ Instance<GameRoom> allRooms;
+
+ @Inject
+ GameMessage gameMessage;
+
+ GameRoom startRoom;
+
+ GameRoom currentRoom;
+
+ String emptyRoomShootMessage;
+
+ String startMessage;
+
+ boolean gameOver = true;
+
+ public String newGame()
+ {
+ for (GameRoom i : allRooms)
+ {
+ i.reset();
+ }
+ gameMessage.add(startMessage);
+ runRoom(startRoom);
+ gameOver = false;
+ return "play";
+ }
+
+ public void runRoom(GameRoom room)
+ {
+ currentRoom = room;
+ if (currentRoom.isMonsterKilled())
+ {
+ gameMessage.add(room.getKilledRoomMessage());
+ }
+ else
+ {
+ gameMessage.add(room.getMessage());
+ }
+ if (room.getRoomType() == RoomType.GAMEOVER)
+ {
+ gameOver = true;
+ }
+ for (GameRoom g : getAdjacentRooms())
+ {
+ gameMessage.add(g.getAdjacentMessage());
+ }
+ }
+
+ public void runShoot(GameRoom room)
+ {
+ if (room.getRoomType() == RoomType.MONSTER)
+ {
+ gameMessage.add(room.getShootMessage());
+ if (room.getShootEffect() == ShootEffect.KILL)
+ {
+ room.setMonsterKilled(true);
+ }
+ else if (room.getShootEffect() == ShootEffect.ANNOY)
+ {
+ gameOver = true;
+ }
+ }
+ else
+ {
+ gameMessage.add(emptyRoomShootMessage);
+ }
+ }
+
+ private Set<GameRoom> getAdjacentRooms()
+ {
+ HashSet<GameRoom> ret = new HashSet<GameRoom>();
+ if (currentRoom.getNorth() != null)
+ {
+ ret.add(currentRoom.getNorth());
+ }
+ if (currentRoom.getSouth() != null)
+ {
+ ret.add(currentRoom.getSouth());
+ }
+ if (currentRoom.getEast() != null)
+ {
+ ret.add(currentRoom.getEast());
+ }
+ if (currentRoom.getWest() != null)
+ {
+ ret.add(currentRoom.getWest());
+ }
+ return ret;
+ }
+
+ public void shootNorth()
+ {
+ if (currentRoom.getNorth() != null)
+ {
+ runShoot(currentRoom.getNorth());
+ }
+ else
+ {
+ gameMessage.add("You cannot shoot that way");
+ }
+ }
+
+ public void shootSouth()
+ {
+ if (currentRoom.getSouth() != null)
+ {
+ runShoot(currentRoom.getSouth());
+ }
+ else
+ {
+ gameMessage.add("You cannot shoot that way");
+ }
+ }
+
+ public void shootEast()
+ {
+ if (currentRoom.getEast() != null)
+ {
+ runShoot(currentRoom.getEast());
+ }
+ else
+ {
+ gameMessage.add("You cannot shoot that way");
+ }
+ }
+
+ public void shootWest()
+ {
+ if (currentRoom.getWest() != null)
+ {
+ runShoot(currentRoom.getWest());
+ }
+ else
+ {
+ gameMessage.add("You cannot shoot that way");
+ }
+ }
+
+ public void moveNorth()
+ {
+ if (currentRoom.getNorth() != null)
+ {
+ runRoom(currentRoom.getNorth());
+ }
+ else
+ {
+ gameMessage.add("You cannot move that way");
+ }
+ }
+
+ public void moveSouth()
+ {
+ if (currentRoom.getSouth() != null)
+ {
+ runRoom(currentRoom.getSouth());
+ }
+ else
+ {
+ gameMessage.add("You cannot move that way");
+ }
+ }
+
+ public void moveEast()
+ {
+ if (currentRoom.getEast() != null)
+ {
+ runRoom(currentRoom.getEast());
+ }
+ else
+ {
+ gameMessage.add("You cannot move that way");
+ }
+ }
+
+ public void moveWest()
+ {
+ if (currentRoom.getWest() != null)
+ {
+ runRoom(currentRoom.getWest());
+ }
+ else
+ {
+ gameMessage.add("You cannot move that way");
+ }
+ }
+
+ public GameRoom getCurrentRoom()
+ {
+ return currentRoom;
+ }
+
+ public void setCurrentRoom(GameRoom currentRoom)
+ {
+ this.currentRoom = currentRoom;
+ }
+
+ public boolean isGameOver()
+ {
+ return gameOver;
+ }
+}
Added: modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/GameMessage.java
===================================================================
--- modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/GameMessage.java (rev 0)
+++ modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/GameMessage.java 2010-03-06 06:53:46 UTC (rev 12108)
@@ -0,0 +1,29 @@
+package org.jboss.seam.xml.examples.princess;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Named;
+
+ at RequestScoped
+ at Named
+public class GameMessage implements Serializable
+{
+
+ StringBuilder builder = new StringBuilder();
+
+ public void add(String message)
+ {
+ if (message != null)
+ {
+ builder.append(message);
+ builder.append('\n');
+ }
+ }
+
+ public String getMessage()
+ {
+ return builder.toString();
+ }
+
+}
Added: modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/GameRoom.java
===================================================================
--- modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/GameRoom.java (rev 0)
+++ modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/GameRoom.java 2010-03-06 06:53:46 UTC (rev 12108)
@@ -0,0 +1,170 @@
+package org.jboss.seam.xml.examples.princess;
+
+import java.io.Serializable;
+
+/**
+ * represents a room in the game. All configuration is done via XML
+ *
+ * @author stuart
+ *
+ */
+public class GameRoom implements Serializable
+{
+
+ public GameRoom()
+ {
+
+ }
+
+ /**
+ * message that is displayed when the player enters the room.
+ */
+ String message;
+ /**
+ * message that is displayed when the player is adjacent to the room
+ */
+ String adjacentMessage;
+ /**
+ * What happens if an arrow is fired into the room
+ */
+ ShootEffect shootEffect = ShootEffect.NOTHING;
+ /**
+ * Message that is displayed when the arrow hits something, even if it is
+ * just annoyed
+ */
+ String shootMessage;
+ /**
+ * Message that is display when a player enters a room that has something
+ * they just shot.
+ */
+ String killedRoomMessage;
+
+ /**
+ * if the monster in the room has been killed.
+ */
+ boolean monsterKilled = false;
+
+ /**
+ * what happens when the player enters the room. There is no difference
+ * between dying and winning, only a different message is displayed
+ */
+ RoomType roomType;
+
+ GameRoom north, south, east, west;
+
+ public void reset()
+ {
+ monsterKilled = false;
+ }
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ public void setMessage(String message)
+ {
+ this.message = message;
+ }
+
+ public String getAdjacentMessage()
+ {
+ return adjacentMessage;
+ }
+
+ public void setAdjacentMessage(String adjacentMessage)
+ {
+ this.adjacentMessage = adjacentMessage;
+ }
+
+ public ShootEffect getShootEffect()
+ {
+ return shootEffect;
+ }
+
+ public void setShootEffect(ShootEffect shootEffect)
+ {
+ this.shootEffect = shootEffect;
+ }
+
+ public String getShootMessage()
+ {
+ return shootMessage;
+ }
+
+ public void setShootMessage(String shootMessage)
+ {
+ this.shootMessage = shootMessage;
+ }
+
+ public String getKilledRoomMessage()
+ {
+ return killedRoomMessage;
+ }
+
+ public void setKilledRoomMessage(String killedRoomMessage)
+ {
+ this.killedRoomMessage = killedRoomMessage;
+ }
+
+ public RoomType getRoomType()
+ {
+ return roomType;
+ }
+
+ public void setRoomType(RoomType roomType)
+ {
+ this.roomType = roomType;
+ }
+
+ public GameRoom getNorth()
+ {
+ return north;
+ }
+
+ public void setNorth(GameRoom north)
+ {
+ this.north = north;
+ }
+
+ public GameRoom getSouth()
+ {
+ return south;
+ }
+
+ public void setSouth(GameRoom south)
+ {
+ this.south = south;
+ }
+
+ public GameRoom getEast()
+ {
+ return east;
+ }
+
+ public void setEast(GameRoom east)
+ {
+ this.east = east;
+ }
+
+ public GameRoom getWest()
+ {
+ return west;
+ }
+
+ public void setWest(GameRoom west)
+ {
+ this.west = west;
+ }
+
+ public boolean isMonsterKilled()
+ {
+ return monsterKilled;
+ }
+
+ public void setMonsterKilled(boolean monsterKilled)
+ {
+ this.monsterKilled = monsterKilled;
+ }
+
+}
Added: modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/Room.java
===================================================================
--- modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/Room.java (rev 0)
+++ modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/Room.java 2010-03-06 06:53:46 UTC (rev 12108)
@@ -0,0 +1,10 @@
+package org.jboss.seam.xml.examples.princess;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface Room
+{
+ String value();
+}
Added: modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/RoomType.java
===================================================================
--- modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/RoomType.java (rev 0)
+++ modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/RoomType.java 2010-03-06 06:53:46 UTC (rev 12108)
@@ -0,0 +1,6 @@
+package org.jboss.seam.xml.examples.princess;
+
+public enum RoomType
+{
+ NORMAL, MONSTER, GAMEOVER;
+}
Added: modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/ShootEffect.java
===================================================================
--- modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/ShootEffect.java (rev 0)
+++ modules/xml/trunk/examples/princess-rescue/src/main/java/org/jboss/seam/xml/examples/princess/ShootEffect.java 2010-03-06 06:53:46 UTC (rev 12108)
@@ -0,0 +1,6 @@
+package org.jboss.seam.xml.examples.princess;
+
+public enum ShootEffect
+{
+ NOTHING, KILL, ANNOY;
+}
Added: modules/xml/trunk/examples/princess-rescue/src/main/resources/META-INF/beans.xml
===================================================================
--- modules/xml/trunk/examples/princess-rescue/src/main/resources/META-INF/beans.xml (rev 0)
+++ modules/xml/trunk/examples/princess-rescue/src/main/resources/META-INF/beans.xml 2010-03-06 06:53:46 UTC (rev 12108)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ The contents of this file is permitted to be empty.
+ The schema definition is provided for your convenience.
+-->
+<beans 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/beans_1_0.xsd">
+</beans>
Added: 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 (rev 0)
+++ modules/xml/trunk/examples/princess-rescue/src/main/resources/META-INF/seam-beans.xml 2010-03-06 06:53:46 UTC (rev 12108)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Beans xmlns="urn:seam:core"
+ xmlns:p="org.jboss.seam.xml.examples.princess">
+ <!-- Makes the Room annotation a qualifier -->
+ <p:Room>
+ <Qualifier/>
+ </p:Room>
+
+ <p:GameManager>
+ <extends/>
+ <p:allRooms>
+ <Any/>
+ <Inject/>
+ </p:allRooms>
+ <p:emptyRoomShootMessage>Your arrow does not appear to hit anything.</p:emptyRoomShootMessage>
+ <p:startMessage>You enter the dungeon, with you bow in your hand and your heart in your mouth.</p:startMessage>
+ <p:startRoom>
+ <!-- Inject the starting room -->
+ <Inject/>
+ <p:Room>startRoom</p:Room>
+ </p:startRoom>
+ </p:GameManager>
+
+ <p:GameRoom>
+ <p:Room value="startRoom"/>
+ <p:north><Inject/><p:Room>emptyRoom1</p:Room></p:north>
+ </p:GameRoom>
+
+ <p:GameRoom>
+ <p:Room>emptyRoom1</p:Room>
+ <!-- <p:north><Inject/><Room>emptyRoom3</Room></p:north> -->
+ <p:west><Inject/><p:Room>dwarfRoom</p:Room></p:west>
+ <p:east><Inject/><p:Room>pitRoom1</p:Room></p:east>
+ <p:south><Inject/><p:Room>startRoom</p:Room></p:south>
+ </p:GameRoom>
+
+ <p:GameRoom>
+ <p:Room>dwarfRoom</p:Room>
+ <p:roomType>MONSTER</p:roomType>
+ <p:shootEffect>KILL</p:shootEffect>
+ <p:adjacentMessage>You hear drunken singing.</p:adjacentMessage>
+ <p:message>You find a drunken dwarven miner. He belches in your direction, falls over, and then seems to forget you are there.</p:message>
+ <p:shootMessage>You hear a 'Thud', followed by a surprised yell.</p:shootMessage>
+ <p:killedRoomMessage>You find a dead dwarven miner with something that looks suspiciously like one of your arrows sticking out of his chest. Probably best you don't mention this to anyone...</p:killedRoomMessage>
+ <p:east><Inject/><p:Room>emptyRoom1</p:Room></p:east>
+ </p:GameRoom>
+
+ <p:GameRoom>
+ <p:Room>pitRoom1</p:Room>
+ <p:roomType>GAMEOVER</p:roomType>
+ <p:adjacentMessage>You feel a breeze.</p:adjacentMessage>
+ <p:message>You fall into a bottomless pit. Game Over. </p:message>
+ <p:west><Inject/><p:Room>emptyRoom1</p:Room></p:west>
+ </p:GameRoom>
+
+</Beans>
\ No newline at end of file
Added: modules/xml/trunk/examples/princess-rescue/src/main/webapp/META-INF/context.xml
===================================================================
--- modules/xml/trunk/examples/princess-rescue/src/main/webapp/META-INF/context.xml (rev 0)
+++ modules/xml/trunk/examples/princess-rescue/src/main/webapp/META-INF/context.xml 2010-03-06 06:53:46 UTC (rev 12108)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Context>
+ <!-- disable storage of sessions across restarts -->
+ <Manager pathname=""/>
+ <Resource name="BeanManager" auth="Container" type="javax.enterprise.inject.spi.BeanManager" factory="org.jboss.weld.resources.ManagerObjectFactory"/>
+ <!-- Uncomment to enable injection into Servlets, Servlet Listeners and Filters in Tomcat -->
+ <!-- <Listener className="org.jboss.weld.environment.tomcat.WeldLifecycleListener"/> -->
+</Context>
Added: modules/xml/trunk/examples/princess-rescue/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- modules/xml/trunk/examples/princess-rescue/src/main/webapp/WEB-INF/faces-config.xml (rev 0)
+++ modules/xml/trunk/examples/princess-rescue/src/main/webapp/WEB-INF/faces-config.xml 2010-03-06 06:53:46 UTC (rev 12108)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This file is not required if you don't need any extra configuration. -->
+<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_2_0.xsd">
+</faces-config>
Added: modules/xml/trunk/examples/princess-rescue/src/main/webapp/WEB-INF/templates/default.xhtml
===================================================================
--- modules/xml/trunk/examples/princess-rescue/src/main/webapp/WEB-INF/templates/default.xhtml (rev 0)
+++ modules/xml/trunk/examples/princess-rescue/src/main/webapp/WEB-INF/templates/default.xhtml 2010-03-06 06:53:46 UTC (rev 12108)
@@ -0,0 +1,52 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+ <h:head>
+ <title>CDI and JSF 2 Starter Application</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <h:outputStylesheet name="css/screen.css"/>
+ </h:head>
+ <h:body>
+ <div id="container">
+ <div id="content">
+ <div id="sidebar">
+ <h3>Find out more</h3>
+ <p>
+ Explore JavaServer Faces.
+ </p>
+ <ul>
+ <li><a href="http://www.javaserverfaces.org">JSF community site</a></li>
+ </ul>
+ <p>
+ Learn more about Java EE 6 and the extensions provided by Weld and Seam.
+ </p>
+ <ul>
+ <li><a href="http://seamframework.org/Weld/JSR299AndWeldOverview">Overview</a></li>
+ <li><a href="http://seamframework.org">Project site</a></li>
+ <li><a href="http://seamframework.org/Documentation/SeamDocumentation#H-WeldReferenceDocumentation">Documentation</a></li>
+ <li><a href="http://seamframework.org/Community/Forums">User forums</a></li>
+ <li><a href="http://seamframework.org/Community/MailingLists">Mailing lists</a></li>
+ <li><a href="https://jira.jboss.org/jira/browse/WELD">Issue tracker</a></li>
+ </ul>
+ <p>
+ If you have an add-on, please <a href="http://seamframework.org/Community/Forums">let us know</a> and
+ consider <a href="http://seamframework.org/Community/Contribute">contributing</a> it back to the
+ community!
+ </p>
+ </div>
+ <ui:insert name="content">
+ [Template content will be inserted here]
+ </ui:insert>
+ </div>
+ <div id="footer">
+ <h:graphicImage value="/resources/gfx/weld.png" alt="Weld logo"/>
+ <p>
+ This project was generated from a Maven archetype maintained by the Weld team.<br/>
+ Weld is the reference implementation of CDI, released under the Apache License, Version 2.0.<br/>
+ </p>
+ </div>
+ </div>
+ </h:body>
+</html>
Added: modules/xml/trunk/examples/princess-rescue/src/main/webapp/WEB-INF/web.xml
===================================================================
--- modules/xml/trunk/examples/princess-rescue/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ modules/xml/trunk/examples/princess-rescue/src/main/webapp/WEB-INF/web.xml 2010-03-06 06:53:46 UTC (rev 12108)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.5"
+ 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-app_2_5.xsd">
+
+ <!-- Activate the JSF 2.0 servlet -->
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <!-- Tell the context which URLs to send through JSF -->
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+
+ <!-- This is an optional parameter, but it makes troubleshooting errors much easier -->
+ <!-- You are advised to remove this context parameter before a production deployment -->
+ <context-param>
+ <param-name>facelets.DEVELOPMENT</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <!-- Weld Jetty/Tomcat specific configuration parameters -->
+ <!-- *** The <listener> and <resource-env-ref> elements can be deleted when running in a Java EE 6 container *** -->
+ <listener>
+ <listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
+ </listener>
+
+ <resource-env-ref>
+ <description>Object factory for the CDI Bean Manager</description>
+ <resource-env-ref-name>BeanManager</resource-env-ref-name>
+ <resource-env-ref-type>javax.enterprise.inject.spi.BeanManager</resource-env-ref-type>
+ </resource-env-ref>
+
+</web-app>
Added: modules/xml/trunk/examples/princess-rescue/src/main/webapp/home.xhtml
===================================================================
--- modules/xml/trunk/examples/princess-rescue/src/main/webapp/home.xhtml (rev 0)
+++ modules/xml/trunk/examples/princess-rescue/src/main/webapp/home.xhtml 2010-03-06 06:53:46 UTC (rev 12108)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ template="/WEB-INF/templates/default.xhtml">
+ <ui:define name="content">
+ <h1>Welcome to Princess Rescue</h1>
+ <p>The princess has been kidnaped by a dragon, and you are the only one who can save her. Armed only with your trusty bow you bravely head into the dragon's lair, who know what horrors you will encounter, some say the caves are even home to the dreaded Wumpus.</p>
+
+ <h:form id="bv">
+ <h:commandButton id="next" action="#{gameManager.newGame}" value="Play Game"/>
+ </h:form>
+ </ui:define>
+</ui:composition>
Added: modules/xml/trunk/examples/princess-rescue/src/main/webapp/index.jsp
===================================================================
--- modules/xml/trunk/examples/princess-rescue/src/main/webapp/index.jsp (rev 0)
+++ modules/xml/trunk/examples/princess-rescue/src/main/webapp/index.jsp 2010-03-06 06:53:46 UTC (rev 12108)
@@ -0,0 +1 @@
+<% response.sendRedirect("home.jsf"); %>
Added: modules/xml/trunk/examples/princess-rescue/src/main/webapp/play.xhtml
===================================================================
--- modules/xml/trunk/examples/princess-rescue/src/main/webapp/play.xhtml (rev 0)
+++ modules/xml/trunk/examples/princess-rescue/src/main/webapp/play.xhtml 2010-03-06 06:53:46 UTC (rev 12108)
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ template="/WEB-INF/templates/default.xhtml">
+ <ui:define name="content">
+ <h1>Princess Rescue</h1>
+ <p>
+ <h:outputText value="#{gameMessage.message}" />
+ </p>
+ <h:form id="bv">
+ <table>
+ <tr>
+ <td>
+ <table>
+ <tr><td colspan="3"><b>Move</b></td></tr>
+ <tr><td/><td><h:commandButton disabled="#{gameManager.currentRoom.north == null or gameManager.gameOver}" action="#{gameManager.moveNorth}" value="North"/></td><td/></tr>
+ <tr>
+ <td><h:commandButton disabled="#{gameManager.currentRoom.west == null or gameManager.gameOver}" action="#{gameManager.moveWest}" value="West"/></td>
+ <td/>
+ <td><h:commandButton disabled="#{gameManager.currentRoom.east == null or gameManager.gameOver}" action="#{gameManager.moveEast}" value="East"/></td>
+ </tr>
+ <tr><td/><td><h:commandButton disabled="#{gameManager.currentRoom.south == null or gameManager.gameOver}" action="#{gameManager.moveSouth}" value="South"/></td><td/></tr>
+ </table>
+ </td>
+ <td>
+ <table>
+ <tr><td colspan="3"><b>Shoot</b></td></tr>
+ <tr><td/><td><h:commandButton disabled="#{gameManager.currentRoom.north == null or gameManager.gameOver}" action="#{gameManager.shootNorth}" value="North"/></td><td/></tr>
+ <tr>
+ <td><h:commandButton disabled="#{gameManager.currentRoom.west == null or gameManager.gameOver}" action="#{gameManager.shootWest}" value="West"/></td>
+ <td/>
+ <td><h:commandButton disabled="#{gameManager.currentRoom.east == null or gameManager.gameOver}" action="#{gameManager.shootEast}" value="East"/></td>
+ </tr>
+ <tr><td/><td><h:commandButton disabled="#{gameManager.currentRoom.south == null or gameManager.gameOver}" action="#{gameManager.shootSouth}" value="South"/></td><td/></tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ <h:commandButton value="New Game" action="home"/>
+ </h:form>
+ </ui:define>
+</ui:composition>
Added: modules/xml/trunk/examples/princess-rescue/src/main/webapp/resources/css/screen.css
===================================================================
--- modules/xml/trunk/examples/princess-rescue/src/main/webapp/resources/css/screen.css (rev 0)
+++ modules/xml/trunk/examples/princess-rescue/src/main/webapp/resources/css/screen.css 2010-03-06 06:53:46 UTC (rev 12108)
@@ -0,0 +1,39 @@
+body {
+ margin: 0;
+ padding: 0;
+ background-color: #EAECEE;
+ font-family: Verdana, sans-serif;
+ font-size: 0.9em;
+}
+#container {
+ margin: 0 auto;
+ padding: 0 20px 10px 20px;
+ border: 1px solid #666666;
+ width: 865px; /* subtract 40px from banner width for padding */
+ background: #FFFFFF url(#{request.contextPath}/resources/gfx/banner.png) no-repeat;
+ padding-top: 110px;
+}
+#sidebar {
+ font-size: 0.9em;
+ width: 225px;
+ float: right;
+ border: 1px solid #666666;
+ background: #EAECEE;
+ padding: 0 15px 5px 15px;
+}
+#sidebar ul {
+ padding-left: 30px;
+}
+#footer {
+ clear: both;
+ text-align: center;
+ color: #666666;
+ font-size: 0.85em;
+}
+code {
+ font-size: 1.1em;
+}
+span.invalid {
+ padding-left: 3px;
+ color: red;
+}
\ No newline at end of file
Added: modules/xml/trunk/examples/princess-rescue/src/main/webapp/resources/gfx/banner.png
===================================================================
(Binary files differ)
Property changes on: modules/xml/trunk/examples/princess-rescue/src/main/webapp/resources/gfx/banner.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/xml/trunk/examples/princess-rescue/src/main/webapp/resources/gfx/weld.png
===================================================================
(Binary files differ)
Property changes on: modules/xml/trunk/examples/princess-rescue/src/main/webapp/resources/gfx/weld.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: modules/xml/trunk/examples/princess-rescue/src/test/resources/jetty-env.xml
===================================================================
--- modules/xml/trunk/examples/princess-rescue/src/test/resources/jetty-env.xml (rev 0)
+++ modules/xml/trunk/examples/princess-rescue/src/test/resources/jetty-env.xml 2010-03-06 06:53:46 UTC (rev 12108)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!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="beanManager" class="org.mortbay.jetty.plus.naming.Resource">
+ <Arg>
+ <Ref id="webAppCtx"/>
+ </Arg>
+ <Arg>BeanManager</Arg>
+ <Arg>
+ <New class="javax.naming.Reference">
+ <Arg>javax.enterprise.inject.spi.BeanManager</Arg>
+ <Arg>org.jboss.weld.resources.ManagerObjectFactory</Arg>
+ <Arg/>
+ </New>
+ </Arg>
+ </New>
+</Configure>
More information about the seam-commits
mailing list