Seam SVN: r10564 - modules/trunk/version-matrix.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-04-21 22:24:08 -0400 (Tue, 21 Apr 2009)
New Revision: 10564
Modified:
modules/trunk/version-matrix/pom.xml
Log:
add Bean Validation
upgrade EAR plugin
Modified: modules/trunk/version-matrix/pom.xml
===================================================================
--- modules/trunk/version-matrix/pom.xml 2009-04-22 02:23:38 UTC (rev 10563)
+++ modules/trunk/version-matrix/pom.xml 2009-04-22 02:24:08 UTC (rev 10564)
@@ -140,6 +140,12 @@
<artifactId>el-ri</artifactId>
<version>1.2</version>
</dependency>
+
+ <dependency>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ <version>1.0.CR1</version>
+ </dependency>
<dependency>
<groupId>org.jboss.webbeans</groupId>
@@ -249,7 +255,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
- <version>2.3.1</version>
+ <version>2.3.2</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
15 years, 10 months
Seam SVN: r10563 - modules/trunk/parent.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-04-21 22:23:38 -0400 (Tue, 21 Apr 2009)
New Revision: 10563
Modified:
modules/trunk/parent/pom.xml
Log:
formatting
add developers
Modified: modules/trunk/parent/pom.xml
===================================================================
--- modules/trunk/parent/pom.xml 2009-04-22 02:22:58 UTC (rev 10562)
+++ modules/trunk/parent/pom.xml 2009-04-22 02:23:38 UTC (rev 10563)
@@ -1,5 +1,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">
+<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</groupId>
<artifactId>seam-parent</artifactId>
<packaging>pom</packaging>
@@ -9,7 +12,7 @@
<groupId>org.jboss.seam</groupId>
<artifactId>seam-version-matrix</artifactId>
<version>3.0.0-SNAPSHOT</version>
- </parent>
+ </parent>
<name>JBoss Seam</name>
<url>http://www.seamframework.org</url>
@@ -30,7 +33,29 @@
</developer>
<developer>
+ <name>Gavin King</name>
+ <roles>
+ <role>Project Founder</role>
+ </roles>
+ <url>http://in.relation.to/Bloggers/Gavin</url>
+ <organization>JBoss, a division of Red Hat</organization>
+ </developer>
+
+ <developer>
+ <name>Norman Richards</name>
+ <roles>
+ <role>Core Developer</role>
+ </roles>
+ <url>http://in.relation.to/Bloggers/Norman</url>
+ <organization>JBoss, a division of Red Hat</organization>
+ </developer>
+
+ <developer>
<name>Shane Bryzak</name>
+ <roles>
+ <role>Core Developer</role>
+ </roles>
+ <url>http://in.relation.to/Bloggers/Shane</url>
<organization>JBoss, a division of Red Hat</organization>
</developer>
@@ -41,8 +66,15 @@
<developer>
<name>Dan Allen</name>
+ <roles>
+ <role>Core Developer</role>
+ </roles>
+ <url>http://in.relation.to/Bloggers/Dan</url>
<organization>JBoss, a division of Red Hat</organization>
</developer>
+
+ <!-- TODO continue adding core developers -->
+
</developers>
<build>
@@ -156,7 +188,7 @@
<url>http://jira.jboss.org/browse/JBSEAM</url>
</issueManagement>
- <inceptionYear>2008</inceptionYear>
+ <inceptionYear>2005</inceptionYear>
<licenses>
<license>
15 years, 10 months
Seam SVN: r10562 - examples/trunk.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-04-21 22:22:58 -0400 (Tue, 21 Apr 2009)
New Revision: 10562
Added:
examples/trunk/pom.xml
Log:
initial import of examples POM
Added: examples/trunk/pom.xml
===================================================================
--- examples/trunk/pom.xml (rev 0)
+++ examples/trunk/pom.xml 2009-04-22 02:22:58 UTC (rev 10562)
@@ -0,0 +1,228 @@
+<?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.seam</groupId>
+ <artifactId>seam-version-matrix</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.jboss.seam.examples</groupId>
+ <artifactId>parent</artifactId>
+ <packaging>pom</packaging>
+ <version>3.0.0-SNAPSHOT</version>
+ <name>Seam Examples</name>
+
+ <description>
+ Examples for the Seam Framework
+ </description>
+
+ <url>http://www.seamframework.org</url>
+
+ <developers>
+ <developer>
+ <name>Pete Muir</name>
+ <roles>
+ <role>Project Lead</role>
+ </roles>
+ <email>pete.muir(a)jboss.org</email>
+ <organization>JBoss, a division of Red Hat</organization>
+ <url>http://in.relation.to/Bloggers/Pete</url>
+ </developer>
+
+ <developer>
+ <name>Gavin King</name>
+ <roles>
+ <role>Project Founder</role>
+ </roles>
+ <url>http://in.relation.to/Bloggers/Gavin</url>
+ <organization>JBoss, a division of Red Hat</organization>
+ </developer>
+
+ <developer>
+ <name>Norman Richards</name>
+ <roles>
+ <role>Core Developer</role>
+ </roles>
+ <url>http://in.relation.to/Bloggers/Norman</url>
+ <organization>JBoss, a division of Red Hat</organization>
+ </developer>
+
+ <developer>
+ <name>Shane Bryzak</name>
+ <roles>
+ <role>Core Developer</role>
+ </roles>
+ <url>http://in.relation.to/Bloggers/Shane</url>
+ <organization>JBoss, a division of Red Hat</organization>
+ </developer>
+
+ <developer>
+ <name>Dan Allen</name>
+ <roles>
+ <role>Core Developer</role>
+ </roles>
+ <url>http://in.relation.to/Bloggers/Dan</url>
+ <organization>JBoss, a division of Red Hat</organization>
+ </developer>
+
+ <!-- TODO continue adding core developers -->
+
+ </developers>
+
+ <modules>
+ <module>booking</module>
+ </modules>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ <version>2.0-beta-8</version>
+ <configuration>
+ <tagBase>https://svn.jboss.org/repos/seam/examples/tags</tagBase>
+ <autoVersionSubmodules>true</autoVersionSubmodules>
+ </configuration>
+ </plugin>
+ </plugins>
+ <defaultGoal>package</defaultGoal>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <addDefaultImplementationEntries>
+ true
+ </addDefaultImplementationEntries>
+ <addDefaultSpecificationEntries>
+ true
+ </addDefaultSpecificationEntries>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>emma-maven-plugin</artifactId>
+ <configuration>
+ <forkMode>once</forkMode>
+ <metadataFile>../target/coverage.em</metadataFile>
+ <outputDirectory>${project.build.directory}/generated-classes</outputDirectory>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <!--
+ <configuration>
+ <warSourceDirectory>${basedir}/WebContent</warSourceDirectory>
+ </configuration>
+ -->
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-ejb-plugin</artifactId>
+ <configuration>
+ <ejbVersion>3.0</ejbVersion>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <ciManagement>
+ <system>Hudson</system>
+ <url />
+ </ciManagement>
+
+ <issueManagement>
+ <system>JIRA</system>
+ <url>http://jira.jboss.org/browse/JBSEAM</url>
+ </issueManagement>
+
+ <inceptionYear>2005</inceptionYear>
+
+ <licenses>
+ <license>
+ <name>Lesser Gnu Public License, Version 2.1</name>
+ <url>http://www.gnu.org/licenses/lgpl-2.1.html</url>
+ </license>
+ </licenses>
+
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/seam/examples</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/seam/examples</developerConnection>
+ <url>http://fisheye.jboss.org/browse/Seam/examples</url>
+ </scm>
+
+ <distributionManagement>
+ <repository>
+ <!-- Copy the dist to the local checkout of the JBoss maven2 repo ${maven.repository.root} -->
+ <!-- It is anticipated that ${maven.repository.root} be set in user's settings.xml -->
+ <!-- todo : replace this with direct svn access once the svnkit providers are available -->
+ <id>repository.jboss.org</id>
+ <url>file://${maven.repository.root}</url>
+ </repository>
+ <snapshotRepository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshot Repository</name>
+ <url>dav:https://snapshots.jboss.org/maven2</url>
+ </snapshotRepository>
+ </distributionManagement>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <configuration>
+ <formats>
+ <format>html</format>
+ <format>xml</format>
+ </formats>
+ <!--
+ <instrumentation>
+ <ignores>
+ <ignore>org.jboss.seam.*</ignore>
+ </ignores>
+ </instrumentation>
+ -->
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+
+</project>
15 years, 10 months
Seam SVN: r10561 - in examples/trunk/booking: seam-booking-ear and 25 other directories.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-04-21 22:21:42 -0400 (Tue, 21 Apr 2009)
New Revision: 10561
Added:
examples/trunk/booking/readme.txt
examples/trunk/booking/seam-booking-ear/
examples/trunk/booking/seam-booking-ear/pom.xml
examples/trunk/booking/seam-booking-ear/src/
examples/trunk/booking/seam-booking-ear/src/main/
examples/trunk/booking/seam-booking-ear/src/main/application/
examples/trunk/booking/seam-booking-ear/src/main/application/seam-booking-ds.xml
examples/trunk/booking/seam-booking-ejb/
examples/trunk/booking/seam-booking-ejb/pom.xml
examples/trunk/booking/seam-booking-ejb/src/
examples/trunk/booking/seam-booking-ejb/src/main/
examples/trunk/booking/seam-booking-ejb/src/main/java/
examples/trunk/booking/seam-booking-ejb/src/main/java/org/
examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/
examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/
examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/
examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/
examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/
examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/HotelSearch.java
examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/HotelSearchBean.java
examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/SearchCriteria.java
examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/binding/
examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/
examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/Booking.java
examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/Hotel.java
examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/User.java
examples/trunk/booking/seam-booking-ejb/src/main/resources/
examples/trunk/booking/seam-booking-ejb/src/main/resources/META-INF/
examples/trunk/booking/seam-booking-ejb/src/main/resources/META-INF/beans.xml
examples/trunk/booking/seam-booking-ejb/src/main/resources/META-INF/persistence.xml
examples/trunk/booking/seam-booking-ejb/src/main/resources/import.sql
examples/trunk/booking/seam-booking-ejb/src/test/
examples/trunk/booking/seam-booking-ejb/src/test/java/
examples/trunk/booking/seam-booking-war/
examples/trunk/booking/seam-booking-war/pom.xml
examples/trunk/booking/seam-booking-war/src/
examples/trunk/booking/seam-booking-war/src/main/
examples/trunk/booking/seam-booking-war/src/main/java/
examples/trunk/booking/seam-booking-war/src/main/webapp/
examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/
examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/faces-config.xml
examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/layout/
examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/layout/template.xhtml
examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/web.xml
examples/trunk/booking/seam-booking-war/src/main/webapp/css/
examples/trunk/booking/seam-booking-war/src/main/webapp/css/screen.css
examples/trunk/booking/seam-booking-war/src/main/webapp/favicon.ico
examples/trunk/booking/seam-booking-war/src/main/webapp/home.xhtml
examples/trunk/booking/seam-booking-war/src/main/webapp/img/
examples/trunk/booking/seam-booking-war/src/main/webapp/img/bg.gif
examples/trunk/booking/seam-booking-war/src/main/webapp/img/btn.bg.gif
examples/trunk/booking/seam-booking-war/src/main/webapp/img/cal-next.png
examples/trunk/booking/seam-booking-war/src/main/webapp/img/cal-prev.png
examples/trunk/booking/seam-booking-war/src/main/webapp/img/cnt.bg.gif
examples/trunk/booking/seam-booking-war/src/main/webapp/img/dtpick.gif
examples/trunk/booking/seam-booking-war/src/main/webapp/img/hdr.ad.jpg
examples/trunk/booking/seam-booking-war/src/main/webapp/img/hdr.bar.jpg
examples/trunk/booking/seam-booking-war/src/main/webapp/img/hdr.bg.gif
examples/trunk/booking/seam-booking-war/src/main/webapp/img/hdr.title.gif
examples/trunk/booking/seam-booking-war/src/main/webapp/img/header_line.gif
examples/trunk/booking/seam-booking-war/src/main/webapp/img/input.bg.gif
examples/trunk/booking/seam-booking-war/src/main/webapp/img/sdb.bg.gif
examples/trunk/booking/seam-booking-war/src/main/webapp/img/spinner.gif
examples/trunk/booking/seam-booking-war/src/main/webapp/img/th.bg.gif
examples/trunk/booking/seam-booking-war/src/main/webapp/index.html
examples/trunk/booking/seam-booking-war/src/main/webapp/main.xhtml
Modified:
examples/trunk/booking/pom.xml
Log:
booking example as an EAR, with hotel search working (mostly)
Modified: examples/trunk/booking/pom.xml
===================================================================
--- examples/trunk/booking/pom.xml 2009-04-22 02:18:08 UTC (rev 10560)
+++ examples/trunk/booking/pom.xml 2009-04-22 02:21:42 UTC (rev 10561)
@@ -1,4 +1,4 @@
-<?xml version="1.0"?>
+<?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">
@@ -10,11 +10,63 @@
<version>3.0.0-SNAPSHOT</version>
</parent>
- <groupId>org.jboss.seam.examples</groupId>
<artifactId>seam-booking</artifactId>
- <packaging>war</packaging>
+ <packaging>pom</packaging>
<name>Seam Booking Example</name>
+ <description>Seam Booking Example</description>
+ <modules>
+ <module>${project.artifactId}-ejb</module>
+ <module>${project.artifactId}-war</module>
+ <module>${project.artifactId}-ear</module>
+ </modules>
+
+ <build>
+ <defaultGoal>package</defaultGoal>
+ <pluginManagement>
+ <plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-ejb-plugin</artifactId>
+ <configuration>
+ <ejbVersion>3.0</ejbVersion>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <dependencyManagement>
+ <dependencies>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>seam-booking-ejb</artifactId>
+ <version>${project.version}</version>
+ <type>ejb</type>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>seam-booking-war</artifactId>
+ <version>${project.version}</version>
+ <type>war</type>
+ </dependency>
+
+ </dependencies>
+ </dependencyManagement>
+
<dependencies>
<dependency>
@@ -24,43 +76,6 @@
<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>
- </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>javax.annotation</groupId>
- <artifactId>jsr250-api</artifactId>
- </dependency>
-
</dependencies>
- <build>
- <finalName>seam-booking</finalName>
- </build>
-
</project>
Added: examples/trunk/booking/readme.txt
===================================================================
--- examples/trunk/booking/readme.txt (rev 0)
+++ examples/trunk/booking/readme.txt 2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,38 @@
+Seam Booking Example
+====================
+
+This example demonstrates the use of Seam 3 in a Java EE 6 environment (or a
+Java EE 5 environment enhanced with JSR-299 [Web Beans] and JSF 2.0).
+Contextual state management and dependency injection are handled by JSR-299.
+Transaction and persistence context management is handled by the EJB 3
+container.
+
+Please consult the Web Beans reference documentation for instructions on how to
+deploy the Web Bean implementation to JBoss AS 5. To upgrade the JSF libraries
+to JSF 2.0, go to the Seam jsf-updater-tool module and follow the instructions
+there.
+
+This example uses a Maven 2 build. To build the EJB and WAR and package them
+inside an EAR, execute the following command:
+
+ mvn
+
+Then, set the JBOSS_HOME environment variable to the location of a JBoss AS 5
+installation. Once that's done, execute the following command to deploy the
+application to JBoss AS via JMX:
+
+ mvn -f seam-booking-ear/pom.xml jboss:deploy
+
+You can undeploy the application via JMX using this command:
+
+ mvn -f seam-booking-ear/pom.xml jboss:undeploy
+
+Here's the restart (mega) command:
+
+mvn -f seam-booking-ear/pom.xml jboss:undeploy && mvn package && mvn -f seam-booking-ear/pom.xml jboss:deploy
+
+If you would rather deploy more traditional way by copying the archive directly
+to the deploy directory of the JBoss AS domain, use this command instead:
+
+ mvn -f seam-booking-ear/pom.xml jboss:harddeploy
+
Added: examples/trunk/booking/seam-booking-ear/pom.xml
===================================================================
--- examples/trunk/booking/seam-booking-ear/pom.xml (rev 0)
+++ examples/trunk/booking/seam-booking-ear/pom.xml 2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,64 @@
+<?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.seam.examples</groupId>
+ <artifactId>seam-booking</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>seam-booking-ear</artifactId>
+ <packaging>ear</packaging>
+ <name>Seam Booking Example (Enterprise application)</name>
+
+ <build>
+ <defaultGoal>package</defaultGoal>
+ <finalName>${project.parent.artifactId}</finalName>
+ <plugins>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-ear-plugin</artifactId>
+ <version>2.3.2</version> <!-- why is this not inheriting? w/o it I get 2.3.1! -->
+ <configuration>
+ <defaultJavaBundleDir>lib</defaultJavaBundleDir>
+ <jboss>
+ <version>4.2</version>
+ <!-- If you use loader-repository, it will break Web Beans -->
+ <!--<loader-repository>${project.groupId}:loader=${project.build.finalName}</loader-repository>-->
+ <data-sources>
+ <data-source>${project.parent.artifactId}-ds.xml</data-source>
+ </data-sources>
+ </jboss>
+ <modules>
+ <webModule>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>seam-booking-war</artifactId>
+ <contextRoot>/seam-booking</contextRoot>
+ </webModule>
+ </modules>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>${project.parent.artifactId}-ejb</artifactId>
+ <type>ejb</type>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>${project.parent.artifactId}-war</artifactId>
+ <type>war</type>
+ </dependency>
+
+ </dependencies>
+</project>
Added: examples/trunk/booking/seam-booking-ear/src/main/application/seam-booking-ds.xml
===================================================================
--- examples/trunk/booking/seam-booking-ear/src/main/application/seam-booking-ds.xml (rev 0)
+++ examples/trunk/booking/seam-booking-ear/src/main/application/seam-booking-ds.xml 2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE datasources
+ PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
+<datasources>
+
+ <local-tx-datasource>
+ <jndi-name>bookingDatasource</jndi-name>
+ <use-java-context>false</use-java-context>
+ <connection-url>jdbc:hsqldb:.</connection-url>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <user-name>sa</user-name>
+ <password></password>
+ </local-tx-datasource>
+
+</datasources>
Added: examples/trunk/booking/seam-booking-ejb/pom.xml
===================================================================
--- examples/trunk/booking/seam-booking-ejb/pom.xml (rev 0)
+++ examples/trunk/booking/seam-booking-ejb/pom.xml 2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,55 @@
+<?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.seam.examples</groupId>
+ <artifactId>seam-booking</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>seam-booking-ejb</artifactId>
+ <packaging>ejb</packaging>
+ <name>Seam Booking Example (EJB module)</name>
+
+ <build>
+ <finalName>${project.artifactId}</finalName>
+ </build>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>jsr250-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.ejb</groupId>
+ <artifactId>ejb-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.webbeans</groupId>
+ <artifactId>jsr299-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
Added: examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/HotelSearch.java
===================================================================
--- examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/HotelSearch.java (rev 0)
+++ examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/HotelSearch.java 2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,24 @@
+package org.jboss.seam.examples.booking.action;
+
+import java.util.List;
+import javax.ejb.Local;
+import org.jboss.seam.examples.booking.model.Hotel;
+
+public
+@Local
+interface HotelSearch
+{
+ public void find();
+
+ public void previousPage();
+
+ public void nextPage();
+
+ public List<Hotel> getHotels();
+
+ public boolean isNextPageAvailable();
+
+ public boolean isPreviousPageAvailable();
+
+ public void destroy();
+}
Added: examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/HotelSearchBean.java
===================================================================
--- examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/HotelSearchBean.java (rev 0)
+++ examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/HotelSearchBean.java 2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,90 @@
+package org.jboss.seam.examples.booking.action;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.annotation.Named;
+import javax.context.RequestScoped;
+import javax.context.SessionScoped;
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.inject.Current;
+import javax.inject.Produces;
+import javax.inject.manager.Manager;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import org.jboss.seam.examples.booking.model.Hotel;
+
+public
+@Named("hotelSearch")
+@Stateful
+@SessionScoped
+class HotelSearchBean implements HotelSearch
+{
+ @Current Manager manager;
+ @Current SearchCriteria criteria;
+
+ private @PersistenceContext EntityManager em;
+ private boolean nextPageAvailable = false;
+ private List<Hotel> hotels = new ArrayList<Hotel>();
+
+ public void find()
+ {
+ criteria.firstPage();
+ queryHotels(criteria);
+ }
+
+ public void nextPage()
+ {
+ criteria.nextPage();
+ queryHotels(criteria);
+ }
+
+ public void previousPage()
+ {
+ criteria.previousPage();
+ queryHotels(criteria);
+ }
+
+ public
+ @Produces
+ @Named
+ @RequestScoped
+ List<Hotel> getHotels()
+ {
+ return hotels;
+ }
+
+ public boolean isNextPageAvailable()
+ {
+ return nextPageAvailable;
+ }
+
+ public boolean isPreviousPageAvailable()
+ {
+ return criteria.getPage() > 0;
+ }
+
+ @Remove
+ public void destroy()
+ {
+ }
+
+ private void queryHotels(SearchCriteria criteria)
+ {
+ List<Hotel> results = em.createQuery(
+ "select h from Hotel h where lower(h.name) like :pattern or lower(h.city) like :pattern or lower(h.zip) like :pattern or lower(h.address) like :pattern").
+ setParameter("pattern", criteria.getSearchPattern()).setMaxResults(criteria.getPageSize() + 1).setFirstResult(criteria.getPage() * criteria.getPageSize()).
+ getResultList();
+
+ System.out.println("Found " + results.size() + " hotels");
+ nextPageAvailable = results.size() > criteria.getPageSize();
+ if (nextPageAvailable)
+ {
+ hotels = new ArrayList<Hotel>(results.subList(0, criteria.getPageSize()));
+ }
+ else
+ {
+ hotels = results;
+ }
+ }
+}
Added: examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/SearchCriteria.java
===================================================================
--- examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/SearchCriteria.java (rev 0)
+++ examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/action/SearchCriteria.java 2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,66 @@
+package org.jboss.seam.examples.booking.action;
+
+import java.io.Serializable;
+import javax.annotation.Named;
+import javax.context.SessionScoped;
+
+public
+@Named
+@SessionScoped
+class SearchCriteria implements Serializable
+{
+ private String searchString = "";
+ private int pageSize = 5;
+ private int page = 0;
+
+ public String getSearchPattern() {
+ return searchString == null ? "%" : '%' + searchString.toLowerCase().replace('*', '%') + '%';
+ }
+
+ public int getPage()
+ {
+ return page;
+ }
+
+ public void setPage(int page)
+ {
+ this.page = page;
+ }
+
+ public int getPageSize()
+ {
+ return pageSize;
+ }
+
+ public void setPageSize(int pageSize)
+ {
+ this.pageSize = pageSize;
+ }
+
+ public String getSearchString()
+ {
+ return searchString;
+ }
+
+ public void setSearchString(String searchString)
+ {
+ this.searchString = searchString;
+ }
+
+ public void nextPage()
+ {
+ page++;
+ }
+
+ public void previousPage()
+ {
+ if (page > 0) {
+ page--;
+ }
+ }
+
+ public void firstPage()
+ {
+ page = 0;
+ }
+}
Added: examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/Booking.java
===================================================================
--- examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/Booking.java (rev 0)
+++ examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/Booking.java 2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,227 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id$
+ */
+package org.jboss.seam.examples.booking.model;
+
+import static javax.persistence.TemporalType.DATE;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.text.DateFormat;
+import java.util.Date;
+
+import javax.persistence.Basic;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Transient;
+
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+import javax.validation.constraints.Size;
+
+/**
+ * <p><strong>Booking</strong> is the model/entity class that represents a hotel
+ * booking.</p>
+ *
+ * @author Gavin King
+ * @author Dan Allen
+ */
+public
+@Entity
+class Booking implements Serializable
+{
+ private Long id;
+ private User user;
+ private Hotel hotel;
+ private Date checkinDate;
+ private Date checkoutDate;
+ private String creditCard;
+ private String creditCardName;
+ private int creditCardExpiryMonth;
+ private int creditCardExpiryYear;
+ private boolean smoking;
+ private int beds;
+
+ public Booking()
+ {
+ }
+
+ public Booking(Hotel hotel, User user)
+ {
+ this.hotel = hotel;
+ this.user = user;
+ }
+
+ @Transient
+ public BigDecimal getTotal()
+ {
+ return hotel.getPrice().multiply(new BigDecimal(getNights()));
+ }
+
+ @Transient
+ public int getNights()
+ {
+ return (int) (checkoutDate.getTime() - checkinDate.getTime()) / 1000 / 60 / 60 / 24;
+ }
+
+ @Id
+ @GeneratedValue
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ @NotNull
+ @Basic
+ @Temporal(DATE)
+ public Date getCheckinDate()
+ {
+ return checkinDate;
+ }
+
+ public void setCheckinDate(Date datetime)
+ {
+ this.checkinDate = datetime;
+ }
+
+ @ManyToOne
+ @NotNull
+ public Hotel getHotel()
+ {
+ return hotel;
+ }
+
+ public void setHotel(Hotel hotel)
+ {
+ this.hotel = hotel;
+ }
+
+ @ManyToOne
+ @NotNull
+ public User getUser()
+ {
+ return user;
+ }
+
+ public void setUser(User user)
+ {
+ this.user = user;
+ }
+
+ @Basic
+ @Temporal(TemporalType.DATE)
+ @NotNull
+ public Date getCheckoutDate()
+ {
+ return checkoutDate;
+ }
+
+ public void setCheckoutDate(Date checkoutDate)
+ {
+ this.checkoutDate = checkoutDate;
+ }
+
+ @NotNull(message = "Credit card number is required")
+ @Size(min = 16, max = 16, message = "Credit card number must 16 digits long")
+ @Pattern(regexp = "^\\d*$", message = "Credit card number must be numeric")
+ public String getCreditCard()
+ {
+ return creditCard;
+ }
+
+ public void setCreditCard(String creditCard)
+ {
+ this.creditCard = creditCard;
+ }
+
+ @Transient
+ public String getDescription()
+ {
+ DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM);
+ return hotel == null ? null : hotel.getName() +
+ ", " + df.format(getCheckinDate()) +
+ " to " + df.format(getCheckoutDate());
+ }
+
+ public boolean isSmoking()
+ {
+ return smoking;
+ }
+
+ public void setSmoking(boolean smoking)
+ {
+ this.smoking = smoking;
+ }
+
+ public int getBeds()
+ {
+ return beds;
+ }
+
+ public void setBeds(int beds)
+ {
+ this.beds = beds;
+ }
+
+ @NotNull(message = "Credit card name is required")
+ @Size(min = 3, max = 70, message = "Credit card name is required")
+ public String getCreditCardName()
+ {
+ return creditCardName;
+ }
+
+ public void setCreditCardName(String creditCardName)
+ {
+ this.creditCardName = creditCardName;
+ }
+
+ public int getCreditCardExpiryMonth()
+ {
+ return creditCardExpiryMonth;
+ }
+
+ public void setCreditCardExpiryMonth(int creditCardExpiryMonth)
+ {
+ this.creditCardExpiryMonth = creditCardExpiryMonth;
+ }
+
+ public int getCreditCardExpiryYear()
+ {
+ return creditCardExpiryYear;
+ }
+
+ public void setCreditCardExpiryYear(int creditCardExpiryYear)
+ {
+ this.creditCardExpiryYear = creditCardExpiryYear;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Booking(" + user + "," + hotel + ")";
+ }
+}
Added: examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/Hotel.java
===================================================================
--- examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/Hotel.java (rev 0)
+++ examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/Hotel.java 2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,151 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id$
+ */
+package org.jboss.seam.examples.booking.model;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+
+/**
+ * <p><strong>Hotel</strong> is the model/entity class that represents a hotel.</p>
+ *
+ * @author Gavin King
+ * @author Dan Allen
+ */
+public
+@Entity
+class Hotel implements Serializable
+{
+ private Long id;
+ private String name;
+ private String address;
+ private String city;
+ private String state;
+ private String zip;
+ private String country;
+ private BigDecimal price;
+
+ @Id
+ @GeneratedValue
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ @Size(max = 50)
+ @NotNull
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ @Size(max = 100)
+ @NotNull
+ public String getAddress()
+ {
+ return address;
+ }
+
+ public void setAddress(String address)
+ {
+ this.address = address;
+ }
+
+ @Size(max = 40)
+ @NotNull
+ public String getCity()
+ {
+ return city;
+ }
+
+ public void setCity(String city)
+ {
+ this.city = city;
+ }
+
+ @Size(min = 4, max = 6)
+ @NotNull
+ public String getZip()
+ {
+ return zip;
+ }
+
+ public void setZip(String zip)
+ {
+ this.zip = zip;
+ }
+
+ @Size(min = 2, max = 10)
+ @NotNull
+ public String getState()
+ {
+ return state;
+ }
+
+ public void setState(String state)
+ {
+ this.state = state;
+ }
+
+ @Size(min = 2, max = 40)
+ @NotNull
+ public String getCountry()
+ {
+ return country;
+ }
+
+ public void setCountry(String country)
+ {
+ this.country = country;
+ }
+
+ @Column(precision = 6, scale = 2)
+ public BigDecimal getPrice()
+ {
+ return price;
+ }
+
+ public void setPrice(BigDecimal price)
+ {
+ this.price = price;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "Hotel(" + name + "," + address + "," + city + "," + zip + ")";
+ }
+}
Added: examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/User.java
===================================================================
--- examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/User.java (rev 0)
+++ examples/trunk/booking/seam-booking-ejb/src/main/java/org/jboss/seam/examples/booking/model/User.java 2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,100 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id$
+ */
+package org.jboss.seam.examples.booking.model;
+
+import java.io.Serializable;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+import javax.validation.constraints.Size;
+
+/**
+ * <p><strong>User</strong> is the model/entity class that represents a customer
+ * who may book a hotel.</p>
+ *
+ * @author Gavin King
+ * @author Dan Allen
+ */
+public
+@Entity
+@Table(name = "Customer")
+class User implements Serializable
+{
+ private String username;
+ private String password;
+ private String name;
+
+ public User(String name, String password, String username)
+ {
+ this.name = name;
+ this.password = password;
+ this.username = username;
+ }
+
+ public User()
+ {
+ }
+
+ @NotNull
+ @Size(max = 100)
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ @NotNull
+ @Size(min = 5, max = 15)
+ public String getPassword()
+ {
+ return password;
+ }
+
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
+
+ @Id
+ @Size(min = 4, max = 15)
+ @Pattern(regexp = "^\\w*$", message = "not a valid username")
+ public String getUsername()
+ {
+ return username;
+ }
+
+ public void setUsername(String username)
+ {
+ this.username = username;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "User(" + username + ")";
+ }
+}
Added: examples/trunk/booking/seam-booking-ejb/src/main/resources/META-INF/beans.xml
===================================================================
Added: examples/trunk/booking/seam-booking-ejb/src/main/resources/META-INF/persistence.xml
===================================================================
--- examples/trunk/booking/seam-booking-ejb/src/main/resources/META-INF/persistence.xml (rev 0)
+++ examples/trunk/booking/seam-booking-ejb/src/main/resources/META-INF/persistence.xml 2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+ version="1.0">
+ <persistence-unit name="booking">
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <jta-data-source>bookingDatasource</jta-data-source>
+ <properties>
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+ <property name="hibernate.show_sql" value="true"/>
+ <!-- These are the default for JBoss EJB 3, but not for Hibernate EntityManager -->
+ <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
+ <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
+ </properties>
+ </persistence-unit>
+</persistence>
Added: examples/trunk/booking/seam-booking-ejb/src/main/resources/import.sql
===================================================================
--- examples/trunk/booking/seam-booking-ejb/src/main/resources/import.sql (rev 0)
+++ examples/trunk/booking/seam-booking-ejb/src/main/resources/import.sql 2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,24 @@
+insert into Customer (username, password, name) values ('gavin', 'mexico', 'Gavin King')
+insert into Customer (username, password, name) values ('pete', 'edinburgh', 'Pete Muir')
+insert into Customer (username, password, name) values ('shane', 'brisbane', 'Shane Bryzak')
+insert into Customer (username, password, name) values ('dan', 'maryland', 'Dan Allen')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (1, 120, 'Marriott Courtyard', 'Tower Place, Buckhead', 'Atlanta', 'GA', '30305', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (2, 180, 'Doubletree', 'Tower Place, Buckhead', 'Atlanta', 'GA', '30305', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (3, 450, 'W Hotel', 'Union Square, Manhattan', 'NY', 'NY', '10011', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (4, 450, 'W Hotel', 'Lexington Ave, Manhattan', 'NY', 'NY', '10011', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (5, 250, 'Hotel Rouge', '1315 16th Street NW', 'Washington', 'DC', '20036', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (6, 300, '70 Park Avenue Hotel', '70 Park Avenue', 'NY', 'NY', '10011', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (8, 300, 'Conrad Miami', '1395 Brickell Ave', 'Miami', 'FL', '33131', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (9, 80, 'Sea Horse Inn', '2106 N Clairemont Ave', 'Eau Claire', 'WI', '54703', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (10, 90, 'Super 8 Eau Claire Campus Area', '1151 W Macarthur Ave', 'Eau Claire', 'WI', '54701', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (11, 160, 'Marriot Downtown', '55 Fourth Street', 'San Francisco', 'CA', '94103', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (12, 200, 'Hilton Diagonal Mar', 'Passeig del Taulat 262-264', 'Barcelona', 'Catalunya', '08019', 'Spain')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (13, 210, 'Hilton Tel Aviv', 'Independence Park', 'Tel Aviv', '', '63405', 'Israel')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (14, 240, 'InterContinental Tokyo Bay', 'Takeshiba Pier', 'Tokyo', '', '105', 'Japan')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (15, 130, 'Hotel Beaulac', ' Esplanade Léopold-Robert 2', 'Neuchatel', '', '2000', 'Switzerland')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (16, 140, 'Conrad Treasury Place', 'William & George Streets', 'Brisbane', 'QLD', '4001', 'Australia')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (17, 230, 'Ritz Carlton', '1228 Sherbrooke St', 'West Montreal', 'Quebec', 'H3G1H6', 'Canada')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (18, 460, 'Ritz Carlton', 'Peachtree Rd, Buckhead', 'Atlanta', 'GA', '30326', 'USA')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (19, 220, 'Swissotel', '68 Market Street', 'Sydney', 'NSW', '2000', 'Australia')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (20, 250, 'Meliá White House', 'Albany Street', 'Regents Park London', '', 'NW13UP', 'Great Britain')
+insert into Hotel (id, price, name, address, city, state, zip, country) values (21, 210, 'Hotel Allegro', '171 West Randolph Street', 'Chicago', 'IL', '60601', 'USA')
Added: examples/trunk/booking/seam-booking-war/pom.xml
===================================================================
--- examples/trunk/booking/seam-booking-war/pom.xml (rev 0)
+++ examples/trunk/booking/seam-booking-war/pom.xml 2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,55 @@
+<?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.seam.examples</groupId>
+ <artifactId>seam-booking</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>seam-booking-war</artifactId>
+ <packaging>war</packaging>
+ <name>Seam Booking Example (Web module)</name>
+
+ <build>
+ <defaultGoal>package</defaultGoal>
+ <finalName>${project.parent.artifactId}</finalName>
+ </build>
+
+ <dependencies>
+
+ <!--
+ <dependency>
+ <groupId>com.sun.facelets</groupId>
+ <artifactId>jsf-facelets</artifactId>
+ </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>javax.el</groupId>
+ <artifactId>el-ri</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+
+</project>
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/faces-config.xml (rev 0)
+++ examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/faces-config.xml 2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config 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"
+ version="2.0">
+
+ <application>
+ <!--
+ <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
+ -->
+ </application>
+
+ <navigation-rule>
+ <!-- navigation rules are required to reset request-scoped producer variables -->
+ <from-view-id>/main.xhtml</from-view-id>
+ <navigation-case>
+ <from-action>#{hotelSearch.find}</from-action>
+ <to-view-id>/main.xhtml</to-view-id>
+ <if>#{true}</if>
+ <redirect/>
+ </navigation-case>
+ <navigation-case>
+ <from-action>#{hotelSearch.nextPage}</from-action>
+ <to-view-id>/main.xhtml</to-view-id>
+ <if>#{true}</if>
+ <redirect/>
+ </navigation-case>
+ </navigation-rule>
+
+</faces-config>
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/layout/template.xhtml
===================================================================
--- examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/layout/template.xhtml (rev 0)
+++ examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/layout/template.xhtml 2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,41 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<f:view xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ contentType="text/html">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+ <title>JBoss Suites: Seam Framework</title>
+ <link rel="shortcut icon" href="#{request.contextPath}/favicon.ico"/>
+ <link href="#{request.contextPath}/css/screen.css" rel="stylesheet" type="text/css"/>
+ </head>
+ <body>
+ <div id="document">
+ <div id="header">
+ <div id="title"><h:graphicImage value="/img/hdr.title.gif" alt="JBoss Suites: seam framework demo"/></div>
+ <div id="status">
+ <h:link id="search" outcome="/main.xhtml" value="Search"/>
+ <ui:remove><!--
+ Welcome #{user.name}
+ | <h:link id="search" outcome="/main.xhtml" value="Search"/>
+ | <h:link id="settings" outcome="/password.xhtml" value="Settings"/>
+ | <s:link id="logout" action="#{identity.logout}" value="Logout"/>
+ --></ui:remove>
+ </div>
+ </div>
+ <div id="container">
+ <div id="sidebar">
+ <ui:insert name="sidebar"/>
+ </div>
+ <div id="content">
+ <ui:insert name="content"/>
+ </div>
+ </div>
+ <div id="footer">Created with Seam 3.0, Web Beans, EJB 3.0 and JSF 2.0</div>
+ </div>
+ </body>
+</html>
+</f:view>
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/web.xml
===================================================================
--- examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ examples/trunk/booking/seam-booking-war/src/main/webapp/WEB-INF/web.xml 2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app 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"
+ version="2.5">
+
+ <display-name>Seam Booking Example</display-name>
+
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>facelets.DEVELOPMENT</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.seam</url-pattern>
+ </servlet-mapping>
+
+ <session-config>
+ <session-timeout>10</session-timeout>
+ </session-config>
+
+</web-app>
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/css/screen.css
===================================================================
--- examples/trunk/booking/seam-booking-war/src/main/webapp/css/screen.css (rev 0)
+++ examples/trunk/booking/seam-booking-war/src/main/webapp/css/screen.css 2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,278 @@
+/* Setup defaults since variable in browsers
+----------------------------------------------- */
+body, div, span, dd, dt, dl, img, ul, ol, li, p, h1, h2, h3, h4, h5, form, hr, fieldset {
+ margin: 0;
+ padding: 0;
+}
+/* Element Defaults
+----------------------------------------------- */
+html {
+ height: 100%;
+ background-color: #DBD4C6;
+}
+img {
+ border: 0;
+}
+body {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: small;
+ line-height: 1.25em;
+ color: #362F2D;
+ position: relative;
+ width: 760px;
+ height: 100%;
+ margin-left: auto;
+ margin-right: auto;
+}
+.label {
+ font-weight: bold;
+ color: #5E5147;
+}
+input {
+ border: 1px solid #C3BBB6;
+ padding: 4px;
+ margin: 5px 0;
+ background: #fff url(../img/input.bg.gif) 0 0 repeat-x;
+}
+select {
+ border: 1px solid #C3BBB6;
+ padding: 4px;
+ margin: 5px 0;
+ background: #fff url(../img/input.bg.gif) 0 0 repeat-x;
+}
+ol, ul {
+ margin: 10px 0px 10px 6px;
+}
+li {
+ margin: 10px 12px;
+}
+fieldset {
+ border: 0;
+}
+/* Layout
+----------------------------------------------- */
+#document {
+ padding: 0 1px;
+ background: #fff url(../img/bg.gif) 0 0 repeat-y;
+ float: left;
+ border-bottom: 1px solid #C3BBB6;
+}
+#header {
+ float: left;
+ width: 758px;
+ height: 46px;
+ background: url(../img/hdr.bg.gif) 0 0 repeat-x;
+}
+#container {
+ float: left;
+ width: 758px;
+ background: url(../img/hdr.bar.jpg) 0 0 repeat-x;
+}
+#sidebar {
+ float: left;
+ width: 190px;
+ margin-top: 96px;
+ padding: 20px 10px 0 10px;
+ background: url(../img/sdb.bg.gif) 0 0 no-repeat;
+}
+#content {
+ float: left;
+ width: 548px;
+ margin-top: 75px;
+ padding-top: 5px;
+ background: #fff url(../img/cnt.bg.gif) 0 0 repeat-x;
+}
+#footer {
+ clear: both;
+ margin-top: 40px;
+ float: left;
+ padding: 20px;
+ border-top: 1px solid #C3BBB6;
+ background-color: #fff;
+ width: 718px;
+ text-align: right;
+}
+/* General
+----------------------------------------------- */
+input[type="submit"], input[type="button"] {
+ font-weight: bold;
+ color: #fff;
+ border: 1px solid #5D1414;
+ height: 26px;
+ background: #fff url(../img/btn.bg.gif) 0 0 repeat-x;
+ border-style: none;
+}
+.center {
+ text-align: center;
+}
+.entry {
+ clear: both;
+ padding-top: 10px;
+}
+.entry .label {
+ float: left;
+ padding-right: 5px;
+ font-weight: bold;
+ width: 150px;
+ text-align: right;
+}
+.entry .output {
+ float: right;
+ width: 360px;
+ padding-top: 10px;
+ text-align: left;
+}
+.entry .input {
+ float: right;
+ width: 360px;
+ text-align: left;
+}
+.entry .error {
+ float: right;
+ width: 360px;
+ text-align: left;
+}
+/* Sidebar
+----------------------------------------------- */
+.notes {
+ text-align: center;
+ font-size: small;
+}
+.subnotes {
+ margin-top: 1em;
+ font-size: small;
+}
+.errors {
+ font-size: small;
+ font-weight: bold;
+ text-align: center;
+ color: #600;
+}
+.errors div {
+ text-align: left;
+}
+.errors span {
+ text-align: left;
+}
+.errors input {
+ border: 1px solid #600;
+}
+.errors ul {
+ list-style: none;
+}
+.buttonBox {
+ text-align: center;
+ padding: 5px 0;
+ clear: both;
+}
+#sidebar p {
+ font-size: small;
+ color: #8B7869;
+ line-height: 150%;
+ padding-bottom: 10px;
+}
+#sidebar li {
+ font-size: small;
+ color: #8B7869;
+}
+#sidebar h1 {
+ line-height: normal;
+ font-weight: bold;
+ font-size: small;
+}
+/*
+#sidebar p:hover {
+ color: #362F2D;
+}
+*/
+/* Content
+----------------------------------------------- */
+#content .section {
+ float: left;
+ width: 518px;
+ padding: 15px 15px 0 15px;
+}
+#content .section h1 {
+ font-family: "Trebuchet MS", Arial, sans-serif;
+ line-height: normal;
+ font-weight: normal;
+ font-size: large;
+}
+#content .section p {
+ line-height: 150%;
+ padding: 10px 0;
+ font-size: small;
+}
+#content table {
+ width: 100%;
+ border: 1px solid #D2C9C4;
+ border-collapse: collapse;
+}
+#content table caption {
+ padding-bottom: 6px;
+ text-align: left;
+ font-weight: bold;
+}
+#content table thead th {
+ border-left: 1px solid #D2C9C4;
+ background: #fff url(../img/th.bg.gif) 0 100% repeat-x;
+ border-bottom: 1px solid #D2C9C4;
+ padding: 6px;
+ text-align: left;
+ font-size: small;
+}
+#content table tbody td {
+ border-left: 1px solid #E4DBD5;
+ padding: 4px;
+ border-bottom: 1px solid #D2C9C4;
+ font-size: small;
+}
+#content dt {
+ font-weight: bold;
+ float: left;
+ width: 33%;
+}
+#content dd {
+ padding-left: 10px;
+ float: left;
+ width: 66%;
+}
+#content table.radio {
+ border: 0px;
+}
+#content table.radio tbody tr td {
+ border: 0px;
+ border-left: 0px;
+ border-bottom: 0px;
+}
+/* Header
+----------------------------------------------- */
+#title {
+ float: left;
+ padding: 1px 0 6px 15px;
+}
+#status {
+ color: #C7B299;
+ float: right;
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-weight: bold;
+ font-size: x-small;
+ text-align: right;
+ padding-top: 14px;
+ padding-right: 15px;
+}
+#status a {
+ color: #C7B299;
+ text-decoration: none;
+}
+/* Homepage Modifications
+----------------------------------------------- */
+#pgHome #container {
+ background: url(../img/hdr.ad.jpg) 0 0 repeat-x;
+}
+#pgHome #sidebar {
+ margin-top: 207px;
+}
+#pgHome #content {
+ margin-top: 183px;
+}
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/favicon.ico
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/favicon.ico
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/home.xhtml
===================================================================
--- examples/trunk/booking/seam-booking-war/src/main/webapp/home.xhtml (rev 0)
+++ examples/trunk/booking/seam-booking-war/src/main/webapp/home.xhtml 2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,87 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
+ <title>JBoss Suites: Seam Framework</title>
+ <link rel="shortcut icon" href="#{request.contextPath}/favicon.ico"/>
+ <link href="#{request.contextPath}/css/screen.css" rel="stylesheet" type="text/css"/>
+ </head>
+ <body id="pgHome">
+ <f:view>
+ <div id="document">
+ <div id="header">
+ <div id="title"><h:graphicImage value="/img/hdr.title.gif" alt="JBoss Suites: seam framework demo"/></div>
+ </div>
+ <div id="container">
+ <div id="sidebar">
+ <h:link id="search" outcome="/main.xhtml" value="Search"/>
+ <ui:remove>
+ <h:form id="login">
+ <fieldset>
+ <div>
+ <h:outputLabel id="UsernameLabel" for="username">Login Name</h:outputLabel>
+ <h:inputText id="username" value="#{identity.username}" style="width: 175px;"/>
+ <div class="errors"><h:message id="UsernameMessage" for="username"/></div>
+ </div>
+ <div>
+ <h:outputLabel id="PasswordLabel" for="password">Password</h:outputLabel>
+ <h:inputSecret id="password" value="#{identity.password}" style="width: 175px;"/>
+ </div>
+ <div class="errors"><h:messages id="messages" globalOnly="true"/></div>
+ <div class="buttonBox"><h:commandButton id="login" action="#{identity.login}" value="Account Login"/></div>
+ <div class="notes"><!--<h:link id="register" outcome="/register.xhtml" value="Register New User"/>--></div>
+ <div class="subnotes">
+ Or use a demo account:
+ <ul>
+ <li>gavin/mexico</li>
+ <li>pete/edinburgh</li>
+ <li>shane/brisbane</li>
+ <li>dan/maryland</li>
+ </ul>
+ </div>
+ </fieldset>
+ </h:form>
+ </ui:remove>
+ </div>
+ <div id="content">
+ <div class="section">
+
+ <h1>About this example application</h1>
+
+ <p>
+ This sample application demonstrates how easy it is to develop stateful web
+ applications using JBoss Seam. Just register, login, and book a room to see
+ Seam in action. Throughout the application you'll see popup links like
+ the ones at the bottom of this page. Click them to see how the application
+ works under the hood.
+ </p>
+
+ <p>
+ Note: Please do NOT enter personal information or your credit card number in
+ this sample application.
+ </p>
+
+ <p>
+ <a href="#" onclick="window.open('exp/introExp.html','exp','width=752,height=500,scrollbars=yes');">
+ What is JBoss Seam?
+ </a>
+ </p>
+
+ <p>
+ <a href="#" onclick="window.open('exp/loginExp.html','exp','width=752,height=500,scrollbars=yes');">
+ What happens when I login?
+ </a>
+ </p>
+
+ </div>
+ </div>
+ </div>
+ <div id="footer">Created with Seam 3.0, Web Beans, EJB 3.0 and JSF 2.0</div>
+ </div>
+ </f:view>
+ </body>
+</html>
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/bg.gif
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/btn.bg.gif
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/btn.bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/cal-next.png
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/cal-next.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/cal-prev.png
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/cal-prev.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/cnt.bg.gif
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/cnt.bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/dtpick.gif
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/dtpick.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/hdr.ad.jpg
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/hdr.ad.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/hdr.bar.jpg
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/hdr.bar.jpg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/hdr.bg.gif
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/hdr.bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/hdr.title.gif
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/hdr.title.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/header_line.gif
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/header_line.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/input.bg.gif
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/input.bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/sdb.bg.gif
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/sdb.bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/spinner.gif
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/spinner.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/img/th.bg.gif
===================================================================
(Binary files differ)
Property changes on: examples/trunk/booking/seam-booking-war/src/main/webapp/img/th.bg.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/index.html
===================================================================
--- examples/trunk/booking/seam-booking-war/src/main/webapp/index.html (rev 0)
+++ examples/trunk/booking/seam-booking-war/src/main/webapp/index.html 2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1 @@
+<html><head><meta http-equiv="Refresh" content="0; URL=home.seam"/></head></html>
Added: examples/trunk/booking/seam-booking-war/src/main/webapp/main.xhtml
===================================================================
--- examples/trunk/booking/seam-booking-war/src/main/webapp/main.xhtml (rev 0)
+++ examples/trunk/booking/seam-booking-war/src/main/webapp/main.xhtml 2009-04-22 02:21:42 UTC (rev 10561)
@@ -0,0 +1,157 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<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"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ template="/WEB-INF/layout/template.xhtml">
+
+ <ui:define name="content">
+
+ <div class="section">
+
+ <span class="errors">
+ <h:messages id="messages" globalOnly="true"/>
+ </span>
+
+ <h1>Search Hotels</h1>
+
+ <h:form id="searchForm">
+ <fieldset>
+ <h:inputText id="searchString" value="#{searchCriteria.searchString}" style="width: 165px;">
+ <f:ajax event="keyup" listener="#{hotelSearch.find}" render="searchResults"/>
+ </h:inputText>
+ #{' '}
+ <h:commandButton id="findHotels" value="Find Hotels" action="#{hotelSearch.find}">
+ <ui:remove><f:ajax listener="#{hotelSearch.find}" render="searchResults"/></ui:remove>
+ </h:commandButton>
+ <ui:remove>
+ <!--
+ <a:status id="status">
+ <f:facet id="startStatus" name="start">
+ <h:graphicImage id="SpinnerGif" value="/img/spinner.gif"/>
+ </f:facet>
+ </a:status>
+ -->
+ </ui:remove>
+ <br/>
+ <h:outputLabel id="lblPageSize" for="pageSize" value="Maximum results:"/>
+ #{' '}
+ <h:selectOneMenu id="pageSize" value="#{searchCriteria.pageSize}">
+ <f:selectItem itemLabel="5" itemValue="5"/>
+ <f:selectItem itemLabel="10" itemValue="10"/>
+ <f:selectItem itemLabel="20" itemValue="20"/>
+ </h:selectOneMenu>
+ </fieldset>
+ </h:form>
+ </div>
+
+ <h:panelGroup id="searchResults">
+ <div class="section">
+ <h:outputText id="noHotelsMsg" value="No Hotels Found" rendered="#{empty hotels}"/>
+ <h:dataTable id="hotels" value="#{hotels}" var="_hotel" rendered="#{not empty hotels}">
+ <h:column id="nameCol">
+ <f:facet id="nameFct" name="header">Name</f:facet>
+ #{_hotel.name}
+ </h:column>
+ <h:column id="addressCol">
+ <f:facet id="addressFct" name="header">Address</f:facet>
+ #{_hotel.address}
+ </h:column>
+ <h:column id="locationCol">
+ <f:facet id="locationFct" name="header">Location</f:facet>
+ #{_hotel.city}, #{_hotel.state}, #{_hotel.country}
+ </h:column>
+ <h:column id="zipCol">
+ <f:facet id="zipFct" name="header">Zip</f:facet>
+ #{_hotel.zip}
+ </h:column>
+ <h:column id="actionCol">
+ <f:facet id="actionFct" name="header">Action</f:facet>
+ <ui:remove><!--<s:link id="viewHotel" value="View Hotel" action="#{hotelBooking.selectHotel(hot)}"/>--></ui:remove>
+ </h:column>
+ </h:dataTable>
+ <h:form id="paginationForm">
+ <h:commandButton id="previousResults" value="Previous page" action="#{hotelSearch.previousPage}" rendered="#{hotelSearch.previousPageAvailable}"/>
+ #{' '}
+ <h:commandButton id="moreResults" value="More results" action="#{hotelSearch.nextPage}" rendered="#{hotelSearch.nextPageAvailable}"/>
+ <ui:remove>
+ <!-- links in Mojarra are broken -->
+ <h:commandLink id="previousResults" value="More results" action="#{hotelSearch.previousPage}" rendered="#{hotelSearch.previousPageAvailable}">
+ <f:ajax listener="#{hotelSearch.previousPage}" render="searchResults"/>
+ </h:commandLink>
+ <h:commandLink id="moreResults" value="More results" action="#{hotelSearch.nextPage}" rendered="#{hotelSearch.nextPageAvailable}">
+ <f:ajax listener="#{hotelSearch.nextPage}" render="searchResults"/>
+ </h:commandLink>
+ </ui:remove>
+ </h:form>
+ </div>
+ </h:panelGroup>
+
+<ui:remove>
+<div class="section">
+ <h1>Current Hotel Bookings</h1>
+</div>
+<div class="section">
+ <h:form id="bookings">
+ <h:outputText id="NoBookingsFoundMessage" value="No Bookings Found" rendered="#{bookings.rowCount==0}"/>
+ <h:dataTable id="bookings" value="#{bookings}" var="book" rendered="#{bookings.rowCount>0}">
+ <h:column id="column1">
+ <f:facet id="NameFacet" name="header">Name</f:facet>
+ #{book.hotel.name}
+ </h:column>
+ <h:column id="column2">
+ <f:facet id="AddressFacet" name="header">Address</f:facet>
+ #{book.hotel.address}
+ </h:column>
+ <h:column id="column3">
+ <f:facet id="CityStateFacet" name="header">City, State</f:facet>
+ #{book.hotel.city}, #{book.hotel.state}
+ </h:column>
+ <h:column id="column4">
+ <f:facet id="CheckInDateFacet" name="header">Check in date</f:facet>
+ <h:outputText id="BookingCheckInDate" value="#{book.checkinDate}"/>
+ </h:column>
+ <h:column id="column5">
+ <f:facet id="CheckOutDateFacet" name="header">Check out date</f:facet>
+ <h:outputText id="BookingCheckOutDate" value="#{book.checkoutDate}"/>
+ </h:column>
+ <h:column id="column6">
+ <f:facet id="ConfNumberFacet" name="header">Confirmation number</f:facet>
+ #{book.id}
+ </h:column>
+ <h:column id="column7">
+ <f:facet id="ActionFacet" name="header">Action</f:facet>
+ <h:commandLink id="cancel" value="Cancel" action="#{bookingList.cancel}"/>
+ </h:column>
+ </h:dataTable>
+ </h:form>
+</div>
+</ui:remove>
+
+ </ui:define>
+
+ <ui:define name="sidebar">
+
+ <h1>State management in Seam</h1>
+ <p>
+ State in Seam is <em>contextual</em>. When you click "Find Hotels", the application
+ retrieves a list of hotels from the database and caches it in the session context. When you
+ navigate to one of the hotel records by clicking the "View Hotel" link, a <em>conversation</em>
+ begins. The conversation is attached to a particular tab, in a particular browser window. You can
+ navigate to multiple hotels using "open in new tab" or "open in new window" in your web browser.
+ Each window will execute in the context of a different conversation. The application keeps state
+ associated with your hotel booking in the conversation context, which ensures that the concurrent
+ conversations do not interfere with each other.
+ </p>
+
+ <p>
+ <a href="#" onclick="window.open('exp/mainExp.html','exp','width=752,height=500,scrollbars=yes');">
+ How does the search page work?
+ </a>
+ </p>
+
+ </ui:define>
+
+</ui:composition>
15 years, 10 months
Seam SVN: r10560 - examples/trunk/booking.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-04-21 22:18:08 -0400 (Tue, 21 Apr 2009)
New Revision: 10560
Removed:
examples/trunk/booking/src/
Log:
restructuring as EAR
15 years, 10 months
Seam SVN: r10559 - modules/trunk/international/src/main/java/org/jboss/seam/international.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-04-21 21:30:45 -0400 (Tue, 21 Apr 2009)
New Revision: 10559
Added:
modules/trunk/international/src/main/java/org/jboss/seam/international/MessagesProducer.java
modules/trunk/international/src/main/java/org/jboss/seam/international/TimeZonesProducer.java
Modified:
modules/trunk/international/src/main/java/org/jboss/seam/international/Messages.java
modules/trunk/international/src/main/java/org/jboss/seam/international/TimeZoneSelector.java
modules/trunk/international/src/main/java/org/jboss/seam/international/TimeZones.java
Log:
some porting done
Modified: modules/trunk/international/src/main/java/org/jboss/seam/international/Messages.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/Messages.java 2009-04-22 01:23:11 UTC (rev 10558)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/Messages.java 2009-04-22 01:30:45 UTC (rev 10559)
@@ -1,133 +1,29 @@
package org.jboss.seam.international;
-import static org.jboss.seam.ScopeType.EVENT;
-import static org.jboss.seam.annotations.Install.BUILT_IN;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.util.AbstractMap;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.MissingResourceException;
-import java.util.Set;
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
-import org.jboss.seam.Component;
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.Factory;
-import org.jboss.seam.annotations.Install;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.intercept.BypassInterceptors;
-import org.jboss.seam.contexts.Contexts;
-import org.jboss.seam.core.SeamResourceBundle;
+import javax.inject.BindingType;
/**
- * Factory for a Map that contains interpolated messages defined in the
- * Seam ResourceBundle.
- *
- * @see org.jboss.seam.core.SeamResourceBundle
- *
- * @author Gavin King
+ * Binding type for messages
+ *
+ * @author Shane Bryzak
*/
-(a)Scope(ScopeType.STATELESS)
-@BypassInterceptors
-@Name("org.jboss.seam.international.messagesFactory")
-@Install(precedence=BUILT_IN)
-public class Messages
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+@Inherited
+public @interface Messages
{
- //TODO: now we have ELResolver, it doesn't *have* to be a Map...
-
- protected Map createMap()
- {
- // AbstractMap uses the implementation of entrySet to perform all its
- // operations - for a resource bundle this is very inefficient for keys
- return new AbstractMap<String, String>()
- {
- private java.util.ResourceBundle bundle = SeamResourceBundle.getBundle();
-
- @Override
- public String get(Object key)
- {
- if (key instanceof String)
- {
- String resourceKey = (String) key;
- String resource=null;
- if (bundle!=null)
- {
- try
- {
- resource = bundle.getString(resourceKey);
- }
- catch (MissingResourceException mre)
- {
- //Just swallow
- }
- }
- return resource==null ? resourceKey : resource;
- }
- else
- {
- return null;
- }
- }
-
- @Override
- public Set<Map.Entry<String, String>> entrySet()
- {
- Enumeration<String> keys = bundle.getKeys();
- Map<String, String> map = new HashMap<String, String>();
- while ( keys.hasMoreElements() )
- {
- String key = keys.nextElement();
- map.put( key, get(key) );
- }
- return Collections.unmodifiableSet(map.entrySet());
- }
- @Override
- public boolean containsKey(Object key)
- {
- return get(key) != null;
- }
-
- @Override
- public Set<String> keySet()
- {
- Enumeration<String> keys = bundle.getKeys();
- return new HashSet<String>(Collections.list(keys));
- }
-
- @Override
- public int size()
- {
- return keySet().size();
- }
-
- };
- }
-
- /**
- * Create the Map and cache it in the EVENT scope. No need to cache
- * it in the SESSION scope, since it is inexpensive to create.
- *
- * @return a Map that interpolates messages in the Seam ResourceBundle
- */
- @Factory(value="org.jboss.seam.international.messages", autoCreate=true, scope=EVENT)
- public Map<String, String> getMessages()
- {
- return createMap();
- }
-
- /**
- * @return the message Map instance
- */
- public static Map<String, String> instance()
- {
- if ( !Contexts.isSessionContextActive() )
- {
- throw new IllegalStateException("no event context active");
- }
- return (Map<String, String>) Component.getInstance("org.jboss.seam.international.messages", true);
- }
}
Added: modules/trunk/international/src/main/java/org/jboss/seam/international/MessagesProducer.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/MessagesProducer.java (rev 0)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/MessagesProducer.java 2009-04-22 01:30:45 UTC (rev 10559)
@@ -0,0 +1,123 @@
+package org.jboss.seam.international;
+
+import java.util.AbstractMap;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.Set;
+
+import javax.context.RequestScoped;
+import javax.inject.Produces;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.core.SeamResourceBundle;
+
+/**
+ * Factory for a Map that contains interpolated messages defined in the
+ * Seam ResourceBundle.
+ *
+ * @see org.jboss.seam.core.SeamResourceBundle
+ *
+ * @author Gavin King
+ */
+public class MessagesProducer
+{
+ //TODO: now we have ELResolver, it doesn't *have* to be a Map...
+
+ protected Map createMap()
+ {
+ // AbstractMap uses the implementation of entrySet to perform all its
+ // operations - for a resource bundle this is very inefficient for keys
+ return new AbstractMap<String, String>()
+ {
+ private java.util.ResourceBundle bundle = SeamResourceBundle.getBundle();
+
+ @Override
+ public String get(Object key)
+ {
+ if (key instanceof String)
+ {
+ String resourceKey = (String) key;
+ String resource=null;
+ if (bundle!=null)
+ {
+ try
+ {
+ resource = bundle.getString(resourceKey);
+ }
+ catch (MissingResourceException mre)
+ {
+ //Just swallow
+ }
+ }
+ return resource==null ? resourceKey : resource;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ @Override
+ public Set<Map.Entry<String, String>> entrySet()
+ {
+ Enumeration<String> keys = bundle.getKeys();
+ Map<String, String> map = new HashMap<String, String>();
+ while ( keys.hasMoreElements() )
+ {
+ String key = keys.nextElement();
+ map.put( key, get(key) );
+ }
+ return Collections.unmodifiableSet(map.entrySet());
+ }
+
+ @Override
+ public boolean containsKey(Object key)
+ {
+ return get(key) != null;
+ }
+
+ @Override
+ public Set<String> keySet()
+ {
+ Enumeration<String> keys = bundle.getKeys();
+ return new HashSet<String>(Collections.list(keys));
+ }
+
+ @Override
+ public int size()
+ {
+ return keySet().size();
+ }
+
+ };
+ }
+
+ /**
+ * Create the Map and cache it in the EVENT scope. No need to cache
+ * it in the SESSION scope, since it is inexpensive to create.
+ *
+ * @return a Map that interpolates messages in the Seam ResourceBundle
+ */
+ @Produces @RequestScoped @Messages public Map<String, String> getMessages()
+ {
+ return createMap();
+ }
+
+ /**
+ * @return the message Map instance
+ */
+ public static Map<String, String> instance()
+ {
+ if ( !Contexts.isSessionContextActive() )
+ {
+ throw new IllegalStateException("no event context active");
+ }
+ return (Map<String, String>) Component.getInstance("org.jboss.seam.international.messages", true);
+ }
+}
Modified: modules/trunk/international/src/main/java/org/jboss/seam/international/TimeZoneSelector.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/TimeZoneSelector.java 2009-04-22 01:23:11 UTC (rev 10558)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/TimeZoneSelector.java 2009-04-22 01:30:45 UTC (rev 10559)
@@ -2,16 +2,10 @@
import static org.jboss.seam.annotations.Install.BUILT_IN;
+import javax.context.SessionScoped;
import javax.faces.event.ValueChangeEvent;
+import javax.inject.Initializer;
-import org.jboss.seam.Component;
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.Create;
-import org.jboss.seam.annotations.Install;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.intercept.BypassInterceptors;
-import org.jboss.seam.contexts.Contexts;
import org.jboss.seam.core.Events;
import org.jboss.seam.faces.Selector;
@@ -21,17 +15,14 @@
*
* @author Gavin King
*/
-(a)Scope(ScopeType.SESSION)
-@Name("org.jboss.seam.international.timeZoneSelector")
-@BypassInterceptors
-@Install(precedence=BUILT_IN, classDependencies="javax.faces.context.FacesContext")
+@SessionScoped
public class TimeZoneSelector extends Selector
{
private static final long serialVersionUID = -5013819375360015369L;
private String id;
- @Create
+ @Initializer
public void initTimeZone()
{
String timeZoneId = getCookieValueIfEnabled();
Modified: modules/trunk/international/src/main/java/org/jboss/seam/international/TimeZones.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/TimeZones.java 2009-04-22 01:23:11 UTC (rev 10558)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/TimeZones.java 2009-04-22 01:30:45 UTC (rev 10559)
@@ -1,71 +1,29 @@
-package org.jboss.seam.international;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import java.util.TimeZone;
-
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.Unwrap;
-import org.jboss.seam.annotations.Create;
-
-/**
- * <p>Seam component that provides a list of time zones, limited to time zones
- * with IDs in the form Continent/Place, excluding deprecated three-letter time
- * zone IDs. The time zones returned have a fixed offset from UTC, which takes
- * daylight savings time into account. For example, Europe/Amsterdam is UTC+1;
- * in winter this is GMT+1 and in summer GMT+2.</p>
- *
- * <p>The time zone objects returned are wrapped in an implementation of
- * TimeZone that provides a more friendly interface for accessing the time zone
- * information. In particular, this type provides a more bean-friend property
- * for the time zone id (id than ID) and provides a convenience property named
- * label that formats the time zone for display in the UI. This wrapper can be
- * disabled by setting the component property wrap to false.</p>
- *
- * @author Peter Hilton, Lunatech Research
- * @author Dan Allen
- */
-(a)Scope(ScopeType.APPLICATION)
-@Name("org.jboss.seam.international.timeZones")
-public class TimeZones
-{
- private static final String TIMEZONE_ID_PREFIXES =
- "^(Africa|America|Asia|Atlantic|Australia|Europe|Indian|Pacific)/.*";
-
- private boolean wrap = true;
-
- private List<TimeZone> timeZones = null;
-
- @Create
- public void init() {
- timeZones = new ArrayList<TimeZone>();
- final String[] timeZoneIds = TimeZone.getAvailableIDs();
- for (final String id : timeZoneIds) {
- if (id.matches(TIMEZONE_ID_PREFIXES)) {
- timeZones.add(wrap ? new TimeZoneWrapper(TimeZone.getTimeZone(id)) : TimeZone.getTimeZone(id));
- }
- }
- Collections.sort(timeZones, new Comparator<TimeZone>() {
- public int compare(final TimeZone a, final TimeZone b) {
- return a.getID().compareTo(b.getID());
- }
- });
- }
-
- @Unwrap
- public List<TimeZone> getTimeZones() {
- return timeZones;
- }
-
- public boolean isWrap() {
- return wrap;
- }
-
- public void setWrap(boolean wrap) {
- this.wrap = wrap;
- }
-}
+package org.jboss.seam.international;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.BindingType;
+
+/**
+ * Binding type for timezones
+ *
+ * @author Shane Bryzak
+ */
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+@Inherited
+public @interface Timezones
+{
+
+}
Added: modules/trunk/international/src/main/java/org/jboss/seam/international/TimeZonesProducer.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/TimeZonesProducer.java (rev 0)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/TimeZonesProducer.java 2009-04-22 01:30:45 UTC (rev 10559)
@@ -0,0 +1,66 @@
+package org.jboss.seam.international;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.TimeZone;
+
+import javax.context.ApplicationScoped;
+import javax.inject.Initializer;
+import javax.inject.Produces;
+
+/**
+ * <p>Seam component that provides a list of time zones, limited to time zones
+ * with IDs in the form Continent/Place, excluding deprecated three-letter time
+ * zone IDs. The time zones returned have a fixed offset from UTC, which takes
+ * daylight savings time into account. For example, Europe/Amsterdam is UTC+1;
+ * in winter this is GMT+1 and in summer GMT+2.</p>
+ *
+ * <p>The time zone objects returned are wrapped in an implementation of
+ * TimeZone that provides a more friendly interface for accessing the time zone
+ * information. In particular, this type provides a more bean-friend property
+ * for the time zone id (id than ID) and provides a convenience property named
+ * label that formats the time zone for display in the UI. This wrapper can be
+ * disabled by setting the component property wrap to false.</p>
+ *
+ * @author Peter Hilton, Lunatech Research
+ * @author Dan Allen
+ */
+public class TimeZonesProducer
+{
+ private static final String TIMEZONE_ID_PREFIXES =
+ "^(Africa|America|Asia|Atlantic|Australia|Europe|Indian|Pacific)/.*";
+
+ private boolean wrap = true;
+
+ private List<TimeZone> timeZones = null;
+
+ @Initializer
+ public void init() {
+ timeZones = new ArrayList<TimeZone>();
+ final String[] timeZoneIds = TimeZone.getAvailableIDs();
+ for (final String id : timeZoneIds) {
+ if (id.matches(TIMEZONE_ID_PREFIXES)) {
+ timeZones.add(wrap ? new TimeZoneWrapper(TimeZone.getTimeZone(id)) : TimeZone.getTimeZone(id));
+ }
+ }
+ Collections.sort(timeZones, new Comparator<TimeZone>() {
+ public int compare(final TimeZone a, final TimeZone b) {
+ return a.getID().compareTo(b.getID());
+ }
+ });
+ }
+
+ @Produces @ApplicationScoped @Timezones public List<TimeZone> getTimeZones() {
+ return timeZones;
+ }
+
+ public boolean isWrap() {
+ return wrap;
+ }
+
+ public void setWrap(boolean wrap) {
+ this.wrap = wrap;
+ }
+}
15 years, 10 months
Seam SVN: r10558 - in modules/trunk/international: src/main/java and 4 other directories.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-04-21 21:23:11 -0400 (Tue, 21 Apr 2009)
New Revision: 10558
Added:
modules/trunk/international/pom.xml
modules/trunk/international/src/main/java/org/
modules/trunk/international/src/main/java/org/jboss/
modules/trunk/international/src/main/java/org/jboss/seam/
modules/trunk/international/src/main/java/org/jboss/seam/international/
modules/trunk/international/src/main/java/org/jboss/seam/international/Locale.java
modules/trunk/international/src/main/java/org/jboss/seam/international/LocaleConfig.java
modules/trunk/international/src/main/java/org/jboss/seam/international/LocaleSelector.java
modules/trunk/international/src/main/java/org/jboss/seam/international/Messages.java
modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessage.java
modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessages.java
modules/trunk/international/src/main/java/org/jboss/seam/international/TimeZone.java
modules/trunk/international/src/main/java/org/jboss/seam/international/TimeZoneSelector.java
modules/trunk/international/src/main/java/org/jboss/seam/international/TimeZoneWrapper.java
modules/trunk/international/src/main/java/org/jboss/seam/international/TimeZones.java
Modified:
modules/trunk/international/
Log:
add international module source
Property changes on: modules/trunk/international
___________________________________________________________________
Name: svn:ignore
+ .classpath
.project
.settings
target
Added: modules/trunk/international/pom.xml
===================================================================
--- modules/trunk/international/pom.xml (rev 0)
+++ modules/trunk/international/pom.xml 2009-04-22 01:23:11 UTC (rev 10558)
@@ -0,0 +1,28 @@
+<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">
+ <parent>
+ <artifactId>seam-parent</artifactId>
+ <groupId>org.jboss.seam</groupId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>seam-international</artifactId>
+ <packaging>jar</packaging>
+ <version>3.0.0-SNAPSHOT</version>
+ <name>Seam Internationalisation</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.webbeans</groupId>
+ <artifactId>jsr299-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.webbeans</groupId>
+ <artifactId>webbeans-logging</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
Added: modules/trunk/international/src/main/java/org/jboss/seam/international/Locale.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/Locale.java (rev 0)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/Locale.java 2009-04-22 01:23:11 UTC (rev 10558)
@@ -0,0 +1,21 @@
+package org.jboss.seam.international;
+
+import javax.annotation.Named;
+import javax.inject.Produces;
+
+/**
+ * Manager component for the current locale that is
+ * aware of the selected locale
+ *
+ * @author Gavin King
+ */
+public class Locale extends org.jboss.seam.core.Locale
+{
+ @Produces public java.util.Locale getLocale()
+ {
+ return Contexts.isSessionContextActive() ?
+ LocaleSelector.instance().getLocale() :
+ super.getLocale();
+ }
+
+}
\ No newline at end of file
Added: modules/trunk/international/src/main/java/org/jboss/seam/international/LocaleConfig.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/LocaleConfig.java (rev 0)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/LocaleConfig.java 2009-04-22 01:23:11 UTC (rev 10558)
@@ -0,0 +1,133 @@
+package org.jboss.seam.international;
+
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import javax.context.ApplicationScoped;
+import javax.faces.FactoryFinder;
+import javax.faces.application.Application;
+import javax.faces.application.ApplicationFactory;
+import javax.inject.Initializer;
+
+import org.jboss.seam.util.Strings;
+
+/**
+ * Configures the JSF locale support from the Seam container.
+ *
+ * <p>
+ * This component merely passes on configuration settings to the JSF runtime, so
+ * you still have to option of configure the locale support in the JSF
+ * configuration file. However, if you enable this component, it will overwrite
+ * any settings from that file.
+ * </p>
+ *
+ * <code>
+ * <i18n:locale-config default-locale="en" supported-locales="en fr de"/>
+ * </code>
+ *
+ * @author Dan Allen
+ */
+@ApplicationScoped
+public class LocaleConfig
+{
+ private String defaultLocale;
+
+ private List<String> supportedLocales;
+
+ @Initializer
+ public void initLocaleConfig()
+ {
+ Application application = getApplication();
+ if (application == null)
+ {
+ return;
+ }
+
+ String defaultAsString = getDefaultLocale();
+ if (defaultAsString != null)
+ {
+ application.setDefaultLocale(getLocaleFromString(defaultAsString));
+ }
+
+ List<String> supportedAsStrings = getSupportedLocales();
+ int numSupported = supportedAsStrings != null ? supportedAsStrings.size() : 0;
+ if (numSupported > 0)
+ {
+ // use set to prevent duplicates, yet retain order just to be nice
+ Set<java.util.Locale> locales = new LinkedHashSet<java.util.Locale>(numSupported);
+ for (String supportedAsString : supportedAsStrings)
+ {
+ locales.add(getLocaleFromString(supportedAsString));
+ }
+ application.setSupportedLocales(locales);
+ }
+ }
+
+ public String getDefaultLocale()
+ {
+ return defaultLocale;
+ }
+
+ public void setDefaultLocale(String defaultLocale)
+ {
+ this.defaultLocale = defaultLocale;
+ }
+
+ public List<String> getSupportedLocales()
+ {
+ return supportedLocales;
+ }
+
+ public void setSupportedLocales(List<String> supportedLocales)
+ {
+ this.supportedLocales = supportedLocales;
+ }
+
+ public static LocaleConfig instance()
+ {
+ return (LocaleConfig) Component.getInstance(LocaleConfig.class, ScopeType.APPLICATION);
+ }
+
+ private java.util.Locale getLocaleFromString(String localeString)
+ {
+ if (localeString == null || localeString.length() < 2)
+ {
+ throw new IllegalArgumentException("Invalid locale string: " + localeString);
+ }
+
+ StringTokenizer tokens = new StringTokenizer(localeString, "-_");
+ String language = tokens.hasMoreTokens() ? tokens.nextToken() : null;
+ String country = tokens.hasMoreTokens() ? tokens.nextToken() : null;
+ String variant = tokens.hasMoreTokens() ? tokens.nextToken() : null;
+ if (!Strings.isEmpty(variant))
+ {
+ return new java.util.Locale(language, country, variant);
+ }
+ else if (!Strings.isEmpty(country))
+ {
+ return new java.util.Locale(language, country);
+ }
+ else
+ {
+ return new java.util.Locale(language);
+ }
+ }
+
+ private Application getApplication()
+ {
+ try
+ {
+ ApplicationFactory factory = (ApplicationFactory) FactoryFinder
+ .getFactory(FactoryFinder.APPLICATION_FACTORY);
+ return factory.getApplication();
+ }
+ catch (IllegalStateException e)
+ {
+ // just in case, for units and the like
+ // if we can't do it, it just wan't meant to be
+ return null;
+ }
+ }
+}
Added: modules/trunk/international/src/main/java/org/jboss/seam/international/LocaleSelector.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/LocaleSelector.java (rev 0)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/LocaleSelector.java 2009-04-22 01:23:11 UTC (rev 10558)
@@ -0,0 +1,217 @@
+package org.jboss.seam.international;
+
+import static org.jboss.seam.annotations.Install.BUILT_IN;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.StringTokenizer;
+
+import javax.faces.context.FacesContext;
+import javax.faces.event.ValueChangeEvent;
+import javax.faces.model.SelectItem;
+import javax.servlet.ServletRequest;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.core.Events;
+import org.jboss.seam.faces.Selector;
+import org.jboss.seam.util.Strings;
+import org.jboss.seam.web.ServletContexts;
+
+/**
+ * Selects the current user's locale
+ *
+ * @author Gavin King
+ */
+(a)Scope(ScopeType.SESSION)
+@Name("org.jboss.seam.international.localeSelector")
+@BypassInterceptors
+@Install(precedence=BUILT_IN, classDependencies="javax.faces.context.FacesContext")
+public class LocaleSelector extends Selector
+{
+ private static final long serialVersionUID = -6087667065688208261L;
+
+ private String language;
+ private String country;
+ private String variant;
+
+ @Create
+ public void initLocale()
+ {
+ String localeString = getCookieValueIfEnabled();
+ if (localeString!=null) setLocaleString(localeString);
+ }
+
+ @Override
+ protected String getCookieName()
+ {
+ return "org.jboss.seam.core.Locale";
+ }
+
+ /**
+ * Force the resource bundle to reload, using the current locale,
+ * and raise the org.jboss.seam.localeSelected event.
+ */
+ public void select()
+ {
+ FacesContext.getCurrentInstance().getViewRoot().setLocale( getLocale() );
+ //Contexts.removeFromAllContexts("org.jboss.seam.core.resourceBundle");
+ Contexts.removeFromAllContexts("org.jboss.seam.international.messages");
+
+ setCookieValueIfEnabled( getLocaleString() );
+
+ if ( Events.exists() )
+ {
+ Events.instance().raiseEvent( "org.jboss.seam.localeSelected", getLocaleString() );
+ }
+ }
+
+ public void select(ValueChangeEvent event)
+ {
+ setLocaleString( (String) event.getNewValue() );
+ select();
+ }
+
+ /**
+ * Set the language and force resource bundle reload, useful for quick action links:
+ * <tt><h:commandLink value="DE" action="#{localeSelector.selectLanguage('de')}"/>"/></tt>
+ */
+ public void selectLanguage(String language) {
+ setLanguage(language);
+ select();
+ }
+
+ public Locale calculateLocale(Locale jsfLocale)
+ {
+ if ( !Strings.isEmpty(variant) )
+ {
+ return new java.util.Locale(language, country, variant);
+ }
+ else if ( !Strings.isEmpty(country) )
+ {
+ return new java.util.Locale(language, country);
+ }
+ else if ( !Strings.isEmpty(language) )
+ {
+ return new java.util.Locale(language);
+ }
+ else
+ {
+ return jsfLocale;
+ }
+ }
+
+ public void setLocale(Locale locale)
+ {
+ language = Strings.nullIfEmpty( locale.getLanguage() );
+ country = Strings.nullIfEmpty( locale.getCountry() );
+ variant = Strings.nullIfEmpty( locale.getVariant() );
+ }
+
+ public String getLocaleString()
+ {
+ return getLocale().toString();
+ }
+
+ public void setLocaleString(String localeString)
+ {
+ StringTokenizer tokens = new StringTokenizer(localeString, "-_");
+ language = tokens.hasMoreTokens() ? tokens.nextToken() : null;
+ country = tokens.hasMoreTokens() ? tokens.nextToken() : null;
+ variant = tokens.hasMoreTokens() ? tokens.nextToken() : null;
+ }
+
+ public List<SelectItem> getSupportedLocales()
+ {
+ List<SelectItem> selectItems = new ArrayList<SelectItem>();
+ Iterator<Locale> locales = FacesContext.getCurrentInstance().getApplication().getSupportedLocales();
+ while ( locales.hasNext() )
+ {
+ Locale locale = locales.next();
+ if ( !Strings.isEmpty( locale.getLanguage() ) )
+ {
+ selectItems.add( new SelectItem( locale.toString(), locale.getDisplayName(locale) ) );
+ }
+ }
+ return selectItems;
+ }
+
+ /**
+ * Get the selected locale
+ */
+ public Locale getLocale()
+ {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ if (facesContext!=null)
+ {
+ //Note: this does a double dispatch back to LocaleSelector.calculateLocale()
+ return facesContext.getApplication().getViewHandler().calculateLocale(facesContext);
+ }
+
+ ServletContexts servletContexts = ServletContexts.getInstance();
+ if (servletContexts!=null)
+ {
+ ServletRequest request = servletContexts.getRequest();
+ if (request!=null)
+ {
+ return calculateLocale( request.getLocale() );
+ }
+ }
+
+ return calculateLocale( Locale.getDefault() );
+ }
+
+ public static LocaleSelector instance()
+ {
+ if ( !Contexts.isSessionContextActive() )
+ {
+ throw new IllegalStateException("No active session context");
+ }
+ return (LocaleSelector) Component.getInstance(LocaleSelector.class, ScopeType.SESSION);
+ }
+
+ public String getCountry()
+ {
+ if (country==null) return getLocale().getCountry();
+ return country;
+ }
+
+ public void setCountry(String country)
+ {
+ setDirty(this.country, country);
+ this.country = country;
+ }
+
+ public String getLanguage()
+ {
+ if (language==null) return getLocale().getLanguage();
+ return language;
+ }
+
+ public void setLanguage(String language)
+ {
+ setDirty(this.language, language);
+ this.language = language;
+ }
+
+ public String getVariant()
+ {
+ if (variant==null) return getLocale().getVariant();
+ return variant;
+ }
+
+ public void setVariant(String variant)
+ {
+ setDirty(this.variant, variant);
+ this.variant = variant;
+ }
+
+}
Added: modules/trunk/international/src/main/java/org/jboss/seam/international/Messages.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/Messages.java (rev 0)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/Messages.java 2009-04-22 01:23:11 UTC (rev 10558)
@@ -0,0 +1,133 @@
+package org.jboss.seam.international;
+
+import static org.jboss.seam.ScopeType.EVENT;
+import static org.jboss.seam.annotations.Install.BUILT_IN;
+
+import java.util.AbstractMap;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.Set;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Factory;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.core.SeamResourceBundle;
+
+/**
+ * Factory for a Map that contains interpolated messages defined in the
+ * Seam ResourceBundle.
+ *
+ * @see org.jboss.seam.core.SeamResourceBundle
+ *
+ * @author Gavin King
+ */
+(a)Scope(ScopeType.STATELESS)
+@BypassInterceptors
+@Name("org.jboss.seam.international.messagesFactory")
+@Install(precedence=BUILT_IN)
+public class Messages
+{
+ //TODO: now we have ELResolver, it doesn't *have* to be a Map...
+
+ protected Map createMap()
+ {
+ // AbstractMap uses the implementation of entrySet to perform all its
+ // operations - for a resource bundle this is very inefficient for keys
+ return new AbstractMap<String, String>()
+ {
+ private java.util.ResourceBundle bundle = SeamResourceBundle.getBundle();
+
+ @Override
+ public String get(Object key)
+ {
+ if (key instanceof String)
+ {
+ String resourceKey = (String) key;
+ String resource=null;
+ if (bundle!=null)
+ {
+ try
+ {
+ resource = bundle.getString(resourceKey);
+ }
+ catch (MissingResourceException mre)
+ {
+ //Just swallow
+ }
+ }
+ return resource==null ? resourceKey : resource;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ @Override
+ public Set<Map.Entry<String, String>> entrySet()
+ {
+ Enumeration<String> keys = bundle.getKeys();
+ Map<String, String> map = new HashMap<String, String>();
+ while ( keys.hasMoreElements() )
+ {
+ String key = keys.nextElement();
+ map.put( key, get(key) );
+ }
+ return Collections.unmodifiableSet(map.entrySet());
+ }
+
+ @Override
+ public boolean containsKey(Object key)
+ {
+ return get(key) != null;
+ }
+
+ @Override
+ public Set<String> keySet()
+ {
+ Enumeration<String> keys = bundle.getKeys();
+ return new HashSet<String>(Collections.list(keys));
+ }
+
+ @Override
+ public int size()
+ {
+ return keySet().size();
+ }
+
+ };
+ }
+
+ /**
+ * Create the Map and cache it in the EVENT scope. No need to cache
+ * it in the SESSION scope, since it is inexpensive to create.
+ *
+ * @return a Map that interpolates messages in the Seam ResourceBundle
+ */
+ @Factory(value="org.jboss.seam.international.messages", autoCreate=true, scope=EVENT)
+ public Map<String, String> getMessages()
+ {
+ return createMap();
+ }
+
+ /**
+ * @return the message Map instance
+ */
+ public static Map<String, String> instance()
+ {
+ if ( !Contexts.isSessionContextActive() )
+ {
+ throw new IllegalStateException("no event context active");
+ }
+ return (Map<String, String>) Component.getInstance("org.jboss.seam.international.messages", true);
+ }
+}
Added: modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessage.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessage.java (rev 0)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessage.java 2009-04-22 01:23:11 UTC (rev 10558)
@@ -0,0 +1,122 @@
+package org.jboss.seam.international;
+
+import java.io.Serializable;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.jboss.seam.core.Interpolator;
+import org.jboss.seam.core.SeamResourceBundle;
+import org.jboss.seam.util.Strings;
+
+/**
+ * A status message which can be created in the business layer and displayed
+ * in the view layer
+ *
+ * @author Pete Muir
+ *
+ */
+public class StatusMessage implements Serializable
+{
+
+ /**
+ * The severity of the status message
+ *
+ */
+ public enum Severity
+ {
+ INFO,
+ WARN,
+ ERROR,
+ FATAL;
+ }
+
+ private String summaryTemplate;
+ private String summary;
+ private String detailTemplate;
+ private String detail;
+ private Severity severity = Severity.INFO;
+
+ /**
+ * Create a status message, looking up the message in the resource bundle
+ * using the provided key. If the message is found, it is used, otherwise,
+ * the defaultMessageTemplate will be used.
+ *
+ */
+ public StatusMessage(Severity severity, String key, String detailKey, String defaultMessageTemplate, String defaultMessageDetailTemplate)
+ {
+ this.summaryTemplate = getBundleMessage(key, defaultMessageTemplate);
+ this.detailTemplate = getBundleMessage(detailKey, defaultMessageDetailTemplate);
+ if ( !Strings.isEmpty(summaryTemplate) )
+ {
+ this.severity = severity;
+ }
+ }
+
+ public boolean isEmpty()
+ {
+ return Strings.isEmpty(summary) && Strings.isEmpty(summaryTemplate);
+ }
+
+ public void interpolate(Object... params)
+ {
+ if (!Strings.isEmpty(summaryTemplate))
+ {
+ this.summary = Interpolator.instance().interpolate(summaryTemplate, params);
+ }
+ if (!Strings.isEmpty(detailTemplate))
+ {
+ this.detail = Interpolator.instance().interpolate(detailTemplate, params);
+ }
+ }
+
+ /**
+ * Get the message
+ *
+ */
+ public String getSummary()
+ {
+ return summary;
+ }
+
+ /**
+ * Get the message severity
+ */
+ public Severity getSeverity()
+ {
+ return severity;
+ }
+
+ public String getDetail()
+ {
+ return detail;
+ }
+
+ public static String getBundleMessage(String key, String defaultMessageTemplate)
+ {
+ String messageTemplate = defaultMessageTemplate;
+ if ( key!=null )
+ {
+ ResourceBundle resourceBundle = SeamResourceBundle.getBundle();
+ if ( resourceBundle!=null )
+ {
+ try
+ {
+ String bundleMessage = resourceBundle.getString(key);
+ if (bundleMessage!=null)
+ {
+ messageTemplate = bundleMessage;
+ }
+ }
+ catch (MissingResourceException mre) {} //swallow
+ }
+ }
+ return messageTemplate;
+ }
+
+ @Override
+ public String toString()
+ {
+ return "[" + severity + "] " + summary + " (" + detail +")";
+ }
+
+}
Added: modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessages.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessages.java (rev 0)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessages.java 2009-04-22 01:23:11 UTC (rev 10558)
@@ -0,0 +1,402 @@
+package org.jboss.seam.international;
+
+import static org.jboss.seam.international.StatusMessage.Severity.INFO;
+import static org.jboss.seam.international.StatusMessage.Severity.WARN;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.hibernate.validator.InvalidValue;
+import org.jboss.seam.Component;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.international.StatusMessage.Severity;
+
+/**
+ * Abstract base class for providing status messages. View layers should provide
+ * a concrete implementation.
+ *
+ * @author Pete Muir
+ *
+ */
+public abstract class StatusMessages implements Serializable
+{
+ private static final long serialVersionUID = -5395975397632138270L;
+
+ public static final String COMPONENT_NAME = "org.jboss.seam.international.statusMessages";
+
+ private List<StatusMessage> messages = new ArrayList<StatusMessage>();
+ private Map<String, List<StatusMessage>> keyedMessages = new HashMap<String, List<StatusMessage>>();
+
+ private transient List<Runnable> tasks;
+
+ protected List<StatusMessage> getMessages()
+ {
+ return messages;
+ }
+
+ protected Map<String, List<StatusMessage>> getKeyedMessages()
+ {
+ return keyedMessages;
+ }
+
+ /**
+ * Clear all status messages
+ */
+ public void clear()
+ {
+ messages.clear();
+ keyedMessages.clear();
+ }
+
+ public void clearKeyedMessages(String id)
+ {
+ keyedMessages.remove(id);
+ }
+
+ public void clearGlobalMessages()
+ {
+ messages.clear();
+ }
+
+ /**
+ * Add a status message, looking up the message in the resource bundle
+ * using the provided key. If the message is found, it is used, otherwise,
+ * the defaultMessageTemplate will be used.
+ *
+ * You can also specify the severity, and parameters to be interpolated
+ */
+ public void add(Severity severity, String key, String detailKey, String messageTemplate, String messageDetailTemplate, final Object... params)
+ {
+ final StatusMessage message = new StatusMessage(severity, key, detailKey, messageTemplate, messageDetailTemplate);
+ if (!message.isEmpty())
+ {
+ messages.add(message);
+ getTasks().add(
+ new Runnable()
+ {
+
+ public void run()
+ {
+ message.interpolate(params);
+ }
+
+ }
+ );
+ }
+ }
+
+ /**
+ * Add a status message, looking up the message in the resource bundle
+ * using the provided key. If the message is found, it is used, otherwise,
+ * the defaultMessageTemplate will be used.
+ *
+ * The message will be added to the widget specified by the ID. The algorithm
+ * used determine which widget the id refers to is determined by the view
+ * layer implementation in use.
+ *
+ * You can also specify the severity, and parameters to be interpolated
+ *
+ */
+ public void addToControl(String id, Severity severity, String key, String messageTemplate, final Object... params)
+ {
+ final StatusMessage message = new StatusMessage(severity, key, null, messageTemplate, null);
+ if (!message.isEmpty())
+ {
+ if (keyedMessages.containsKey(id))
+ {
+ keyedMessages.get(id).add(message);
+ }
+ else
+ {
+ List<StatusMessage> list = new ArrayList<StatusMessage>();
+ list.add(message);
+ keyedMessages.put(id, list);
+ }
+ getTasks().add(
+ new Runnable()
+ {
+
+ public void run()
+ {
+ message.interpolate(params);
+ }
+
+ }
+ );
+ }
+ }
+
+ /**
+ * Create a new status message, with the messageTemplate is as the message.
+ *
+ * A severity of INFO will be used, and you can specify paramters to be
+ * interpolated
+ */
+ public void add(String messageTemplate, Object... params)
+ {
+ add(INFO, messageTemplate, params);
+ }
+
+ /**
+ * Create a new status message, with the messageTemplate is as the message.
+ *
+ * You can also specify the severity, and parameters to be interpolated
+ *
+ */
+ public void add(Severity severity, String messageTemplate, Object... params)
+ {
+ add(severity, null, null, messageTemplate, null, params);
+ }
+
+ /**
+ * Create a new status message, with the messageTemplate is as the message.
+ *
+ * The message will be added to the widget specified by the ID. The algorithm
+ * used determine which widget the id refers to is determined by the view
+ * layer implementation in use.
+ *
+ * A severity of INFO will be used, and you can specify parameters to be
+ * interpolated
+ *
+ */
+ public void addToControl(String id, String messageTemplate, Object... params)
+ {
+ addToControl(id, INFO, null, messageTemplate, params);
+ }
+
+ /**
+ * Create a new status message, with the messageTemplate is as the message.
+ *
+ * The message will be added to the widget specified by the ID. The algorithm
+ * used determine which widget the id refers to is determined by the view
+ * layer implementation in use.
+ *
+ * You can also specify the severity, and parameters to be interpolated
+ *
+ */
+ public void addToControl(String id, Severity severity, String messageTemplate, Object... params)
+ {
+ addToControl(id, severity, null, messageTemplate, params);
+ }
+
+ /**
+ * Add a status message, looking up the message in the resource bundle
+ * using the provided key. If the message is found, it is used, otherwise,
+ * the defaultMessageTemplate will be used.
+ *
+ * A severity of INFO will be used, and you can specify parameters to be
+ * interpolated
+ */
+ public void addFromResourceBundle(String key, Object... params)
+ {
+ addFromResourceBundle(INFO, key, params);
+ }
+
+ /**
+ * Add a status message, looking up the message in the resource bundle
+ * using the provided key.
+ *
+ * You can also specify the severity, and parameters to be interpolated
+ *
+ */
+ public void addFromResourceBundle(Severity severity, String key, Object... params)
+ {
+ addFromResourceBundleOrDefault(severity, key, key, params);
+ }
+
+ /**
+ * Add a status message, looking up the message in the resource bundle
+ * using the provided key. If the message is found, it is used, otherwise,
+ * the defaultMessageTemplate will be used.
+ *
+ * A severity of INFO will be used, and you can specify parameters to be
+ * interpolated
+ *
+ */
+ public void addFromResourceBundleOrDefault(String key, String defaultMessageTemplate, Object... params)
+ {
+ addFromResourceBundleOrDefault(INFO, key, defaultMessageTemplate, params);
+ }
+
+ /**
+ * Add a status message, looking up the message in the resource bundle
+ * using the provided key. If the message is found, it is used, otherwise,
+ * the defaultMessageTemplate will be used.
+ *
+ * You can also specify the severity, and parameters to be interpolated
+ *
+ */
+ public void addFromResourceBundleOrDefault(Severity severity, String key, String defaultMessageTemplate, Object... params)
+ {
+ add(severity, key, null, defaultMessageTemplate, null, params);
+ }
+
+ /**
+ * Create a new status message, looking up the message in the resource bundle
+ * using the provided key.
+ *
+ * The message will be added to the widget specified by the ID. The algorithm
+ * used determine which widget the id refers to is determined by the view
+ * layer implementation in use.
+ *
+ * A severity of INFO will be used, and you can specify parameters to be
+ * interpolated
+ *
+ */
+ public void addToControlFromResourceBundle(String id, String key, Object... params)
+ {
+ addToControlFromResourceBundle(id, INFO, key, params);
+ }
+
+ /**
+ * Create a new status message, looking up the message in the resource bundle
+ * using the provided key.
+ *
+ * The message will be added to the widget specified by the ID. The algorithm
+ * used determine which widget the id refers to is determined by the view
+ * layer implementation in use.
+ *
+ * You can also specify the severity, and parameters to be interpolated
+ *
+ */
+ public void addToControlFromResourceBundle(String id, Severity severity, String key, Object... params)
+ {
+ addToControlFromResourceBundleOrDefault(id, severity, key, key, params);
+ }
+
+ /**
+ * Add a status message, looking up the message in the resource bundle
+ * using the provided key. If the message is found, it is used, otherwise,
+ * the defaultMessageTemplate will be used.
+ *
+ * The message will be added to the widget specified by the ID. The algorithm
+ * used determine which widget the id refers to is determined by the view
+ * layer implementation in use.
+ *
+ * A severity of INFO will be used, and you can specify parameters to be
+ * interpolated
+ *
+ */
+ public void addToControlFromResourceBundleOrDefault(String id, String key, String defaultMessageTemplate, Object... params)
+ {
+ addToControlFromResourceBundleOrDefault(id, INFO, key, defaultMessageTemplate, params);
+ }
+
+ /**
+ * Add a status message, looking up the message in the resource bundle
+ * using the provided key. If the message is found, it is used, otherwise,
+ * the defaultMessageTemplate will be used.
+ *
+ * The message will be added to the widget specified by the ID. The algorithm
+ * used determine which widget the id refers to is determined by the view
+ * layer implementation in use.
+ *
+ * You can also specify the severity, and parameters to be interpolated
+ *
+ */
+ public void addToControlFromResourceBundleOrDefault(String id, Severity severity, String key, String defaultMessageTemplate, Object... params)
+ {
+ addToControl(id, severity, key, defaultMessageTemplate, params);
+ }
+
+ /**
+ * Add an array of InvalidValues from Hibernate Validator. Each message will
+ * be added with a severity of WARN.
+ */
+ public void add(InvalidValue[] ivs)
+ {
+ for (InvalidValue iv: ivs)
+ {
+ add(iv);
+ }
+ }
+
+ /**
+ * Add an array of InvalidValues from Hibernate Validator. Each message will
+ * be added with a severity of WARN.
+ *
+ * The name of the property that was validated will be used as the widget ID
+ */
+ public void addToControls(InvalidValue[] ivs)
+ {
+ for (InvalidValue iv: ivs)
+ {
+ addToControl(iv);
+ }
+ }
+
+ /**
+ * Add an InvalidValue from Hibernate Validator. The message will
+ * be added with a severity of WARN.
+ */
+ public void add(InvalidValue iv)
+ {
+ add( WARN, iv.getMessage() );
+ }
+
+ /**
+ * Add an InvalidValue from Hibernate Validator. The message will
+ * be added with a severity of WARN.
+ *
+ * The name of the property that was validated will be used as the widget ID
+ */
+ public void addToControl(InvalidValue iv)
+ {
+ addToControl( iv.getPropertyName(), iv );
+ }
+
+ /**
+ * Add an InvalidValue from Hibernate Validator. The message will
+ * be added with a severity of WARN.
+ *
+ * You can also specify the id of the widget to add the message to
+ */
+ public void addToControl(String id, InvalidValue iv)
+ {
+ addToControl( id, WARN, iv.getMessage() );
+ }
+
+ private List<Runnable> getTasks()
+ {
+ if (tasks == null)
+ {
+ tasks = new ArrayList<Runnable>();
+ }
+ return tasks;
+ }
+
+ protected static void runTasks()
+ {
+ if ( Contexts.isConversationContextActive() )
+ {
+ StatusMessages statusMessages = instance();
+ if (statusMessages != null)
+ {
+ statusMessages.doRunTasks();
+ }
+ }
+ }
+
+ protected void doRunTasks()
+ {
+ if (tasks!=null)
+ {
+ for (Runnable task: tasks) task.run();
+ tasks.clear();
+ }
+ }
+
+ public static StatusMessages instance()
+ {
+ if ( !Contexts.isConversationContextActive() )
+ {
+ throw new IllegalStateException("No active conversation context");
+ }
+ return (StatusMessages) Component.getInstance(COMPONENT_NAME, ScopeType.CONVERSATION);
+ }
+
+}
Added: modules/trunk/international/src/main/java/org/jboss/seam/international/TimeZone.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/TimeZone.java (rev 0)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/TimeZone.java 2009-04-22 01:23:11 UTC (rev 10558)
@@ -0,0 +1,36 @@
+package org.jboss.seam.international;
+
+import static org.jboss.seam.annotations.Install.BUILT_IN;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Unwrap;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+
+/**
+ * Manager component for the current user's locale
+ *
+ * @author Gavin King
+ */
+(a)Scope(ScopeType.STATELESS)
+@Name("org.jboss.seam.international.timeZone")
+@BypassInterceptors
+@Install(precedence=BUILT_IN, dependencies="org.jboss.seam.international.timeZoneSelector")
+public class TimeZone
+{
+
+ @Unwrap
+ public java.util.TimeZone getTimeZone()
+ {
+ return TimeZoneSelector.instance().getTimeZone();
+ }
+
+ public static java.util.TimeZone instance()
+ {
+ return (java.util.TimeZone) Component.getInstance(TimeZone.class, ScopeType.STATELESS);
+ }
+
+}
Added: modules/trunk/international/src/main/java/org/jboss/seam/international/TimeZoneSelector.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/TimeZoneSelector.java (rev 0)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/TimeZoneSelector.java 2009-04-22 01:23:11 UTC (rev 10558)
@@ -0,0 +1,112 @@
+package org.jboss.seam.international;
+
+import static org.jboss.seam.annotations.Install.BUILT_IN;
+
+import javax.faces.event.ValueChangeEvent;
+
+import org.jboss.seam.Component;
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Create;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.core.Events;
+import org.jboss.seam.faces.Selector;
+
+/**
+ * Selects the current user's time zone, defaulting
+ * to the server time zone.
+ *
+ * @author Gavin King
+ */
+(a)Scope(ScopeType.SESSION)
+@Name("org.jboss.seam.international.timeZoneSelector")
+@BypassInterceptors
+@Install(precedence=BUILT_IN, classDependencies="javax.faces.context.FacesContext")
+public class TimeZoneSelector extends Selector
+{
+ private static final long serialVersionUID = -5013819375360015369L;
+
+ private String id;
+
+ @Create
+ public void initTimeZone()
+ {
+ String timeZoneId = getCookieValueIfEnabled();
+ if (timeZoneId!=null) setTimeZoneId(timeZoneId);
+ }
+
+ @Override
+ protected String getCookieName()
+ {
+ return "org.jboss.seam.core.TimeZone";
+ }
+
+ /**
+ * Force the resource bundle to reload, using the current locale,
+ * and raise the org.jboss.seam.timeZoneSelected event
+ */
+ public void select()
+ {
+ setCookieValueIfEnabled( getTimeZoneId() );
+
+ if ( Events.exists() )
+ {
+ Events.instance().raiseEvent( "org.jboss.seam.timeZoneSelected", getTimeZoneId() );
+ }
+ }
+
+ public void select(ValueChangeEvent event)
+ {
+ selectTimeZone( (String) event.getNewValue() );
+ }
+
+ public void selectTimeZone(String timeZoneId)
+ {
+ setTimeZoneId(timeZoneId);
+ select();
+ }
+
+ public void setTimeZone(java.util.TimeZone timeZone)
+ {
+ setTimeZoneId( timeZone.getID() );
+ }
+
+ public void setTimeZoneId(String id)
+ {
+ setDirty(this.id, id);
+ this.id = id;
+ }
+
+ public String getTimeZoneId()
+ {
+ return id;
+ }
+
+ /**
+ * Get the selected timezone
+ */
+ public java.util.TimeZone getTimeZone()
+ {
+ if (id==null)
+ {
+ return java.util.TimeZone.getDefault();
+ }
+ else
+ {
+ return java.util.TimeZone.getTimeZone( getTimeZoneId() );
+ }
+ }
+
+ public static TimeZoneSelector instance()
+ {
+ if ( !Contexts.isSessionContextActive() )
+ {
+ throw new IllegalStateException("No active session context");
+ }
+ return (TimeZoneSelector) Component.getInstance(TimeZoneSelector.class, ScopeType.SESSION);
+ }
+
+}
Added: modules/trunk/international/src/main/java/org/jboss/seam/international/TimeZoneWrapper.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/TimeZoneWrapper.java (rev 0)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/TimeZoneWrapper.java 2009-04-22 01:23:11 UTC (rev 10558)
@@ -0,0 +1,102 @@
+package org.jboss.seam.international;
+
+import java.util.Date;
+import java.util.TimeZone;
+
+/**
+ * A wrapper around a TimeZone that provides a more convenience interface to
+ * access the time zone information in the UI, in particular in the options of
+ * a select menu.
+ *
+ * @author Dan Allen
+ */
+public class TimeZoneWrapper extends TimeZone
+{
+ private static final int MILLISECONDS_PER_HOUR = 1000 * 60 * 60;
+
+ private TimeZone timeZone;
+
+ public TimeZoneWrapper(TimeZone tz) {
+ timeZone = tz;
+ setID(tz.getID());
+ }
+
+ @Override
+ public void setID(String id) {
+ super.setID(id);
+ timeZone = TimeZone.getTimeZone(id);
+ }
+
+ public String getId() {
+ return timeZone.getID();
+ }
+
+ public String getLabel() {
+ StringBuilder label = new StringBuilder(50);
+ label.append(getId().replace("_", " "));
+ label.append(" (UTC");
+ label.append(timeZone.getRawOffset() > 0 ? "+" : "-");
+ if (Math.abs(timeZone.getRawOffset()) < MILLISECONDS_PER_HOUR * 10) {
+ label.append("0");
+ }
+ label.append(Math.abs(timeZone.getRawOffset())/MILLISECONDS_PER_HOUR);
+ label.append(":00)");
+ return label.toString();
+ }
+
+ public TimeZone getTimeZone() {
+ return timeZone;
+ }
+
+ @Override
+ public int getOffset(int era, int year, int month, int day, int dayOfWeek, int millis) {
+ return timeZone.getOffset(era, year, month, day, dayOfWeek, millis);
+ }
+
+ @Override
+ public void setRawOffset(int offset) {
+ timeZone.setRawOffset(offset);
+ }
+
+ @Override
+ public int getRawOffset() {
+ return timeZone.getRawOffset();
+ }
+
+ @Override
+ public boolean useDaylightTime() {
+ return timeZone.useDaylightTime();
+ }
+
+ @Override
+ public boolean inDaylightTime(Date date) {
+ return timeZone.inDaylightTime(date);
+ }
+
+ @Override
+ public Object clone() {
+ return timeZone.clone();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final TimeZoneWrapper other = (TimeZoneWrapper) obj;
+ if (timeZone != other.timeZone && (timeZone == null || !timeZone.equals(other.timeZone))) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 7;
+ hash = 79 * hash + (timeZone != null ? timeZone.hashCode() : 0);
+ return hash;
+ }
+}
Added: modules/trunk/international/src/main/java/org/jboss/seam/international/TimeZones.java
===================================================================
--- modules/trunk/international/src/main/java/org/jboss/seam/international/TimeZones.java (rev 0)
+++ modules/trunk/international/src/main/java/org/jboss/seam/international/TimeZones.java 2009-04-22 01:23:11 UTC (rev 10558)
@@ -0,0 +1,71 @@
+package org.jboss.seam.international;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.TimeZone;
+
+import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.Unwrap;
+import org.jboss.seam.annotations.Create;
+
+/**
+ * <p>Seam component that provides a list of time zones, limited to time zones
+ * with IDs in the form Continent/Place, excluding deprecated three-letter time
+ * zone IDs. The time zones returned have a fixed offset from UTC, which takes
+ * daylight savings time into account. For example, Europe/Amsterdam is UTC+1;
+ * in winter this is GMT+1 and in summer GMT+2.</p>
+ *
+ * <p>The time zone objects returned are wrapped in an implementation of
+ * TimeZone that provides a more friendly interface for accessing the time zone
+ * information. In particular, this type provides a more bean-friend property
+ * for the time zone id (id than ID) and provides a convenience property named
+ * label that formats the time zone for display in the UI. This wrapper can be
+ * disabled by setting the component property wrap to false.</p>
+ *
+ * @author Peter Hilton, Lunatech Research
+ * @author Dan Allen
+ */
+(a)Scope(ScopeType.APPLICATION)
+@Name("org.jboss.seam.international.timeZones")
+public class TimeZones
+{
+ private static final String TIMEZONE_ID_PREFIXES =
+ "^(Africa|America|Asia|Atlantic|Australia|Europe|Indian|Pacific)/.*";
+
+ private boolean wrap = true;
+
+ private List<TimeZone> timeZones = null;
+
+ @Create
+ public void init() {
+ timeZones = new ArrayList<TimeZone>();
+ final String[] timeZoneIds = TimeZone.getAvailableIDs();
+ for (final String id : timeZoneIds) {
+ if (id.matches(TIMEZONE_ID_PREFIXES)) {
+ timeZones.add(wrap ? new TimeZoneWrapper(TimeZone.getTimeZone(id)) : TimeZone.getTimeZone(id));
+ }
+ }
+ Collections.sort(timeZones, new Comparator<TimeZone>() {
+ public int compare(final TimeZone a, final TimeZone b) {
+ return a.getID().compareTo(b.getID());
+ }
+ });
+ }
+
+ @Unwrap
+ public List<TimeZone> getTimeZones() {
+ return timeZones;
+ }
+
+ public boolean isWrap() {
+ return wrap;
+ }
+
+ public void setWrap(boolean wrap) {
+ this.wrap = wrap;
+ }
+}
15 years, 10 months
Seam SVN: r10557 - branches/community/Seam_2_1/src/main/org/jboss/seam/async.
by seam-commits@lists.jboss.org
Author: norman.richards(a)jboss.com
Date: 2009-04-21 21:21:49 -0400 (Tue, 21 Apr 2009)
New Revision: 10557
Modified:
branches/community/Seam_2_1/src/main/org/jboss/seam/async/ThreadPoolDispatcher.java
Log:
JBSEAM-4123
Modified: branches/community/Seam_2_1/src/main/org/jboss/seam/async/ThreadPoolDispatcher.java
===================================================================
--- branches/community/Seam_2_1/src/main/org/jboss/seam/async/ThreadPoolDispatcher.java 2009-04-22 01:16:58 UTC (rev 10556)
+++ branches/community/Seam_2_1/src/main/org/jboss/seam/async/ThreadPoolDispatcher.java 2009-04-22 01:21:49 UTC (rev 10557)
@@ -10,6 +10,7 @@
import org.jboss.seam.Component;
import org.jboss.seam.ScopeType;
+import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.Destroy;
import org.jboss.seam.annotations.Install;
import org.jboss.seam.annotations.Name;
@@ -30,7 +31,12 @@
{
private int threadPoolSize = 10;
- private ScheduledExecutorService executor = Executors.newScheduledThreadPool(threadPoolSize);
+ private ScheduledExecutorService executor;
+
+ @Create
+ public void startup() {
+ executor = Executors.newScheduledThreadPool(threadPoolSize);
+ }
public Future scheduleAsynchronousEvent(String type, Object... parameters)
{
15 years, 10 months
Seam SVN: r10556 - in modules/trunk/security: src/main/java/org/jboss/seam/security and 3 other directories.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-04-21 21:16:58 -0400 (Tue, 21 Apr 2009)
New Revision: 10556
Added:
modules/trunk/security/src/main/java/org/jboss/seam/security/events/CredentialsInitializedEvent.java
modules/trunk/security/src/main/java/org/jboss/seam/security/events/CredentialsUpdatedEvent.java
Removed:
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/package-info.java
Modified:
modules/trunk/security/
modules/trunk/security/src/main/java/org/jboss/seam/security/Credentials.java
modules/trunk/security/src/main/java/org/jboss/seam/security/FacesSecurityEvents.java
modules/trunk/security/src/main/java/org/jboss/seam/security/Identity.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/Admin.java
modules/trunk/security/src/main/java/org/jboss/seam/security/events/LoginFailedEvent.java
modules/trunk/security/src/main/java/org/jboss/seam/security/jaas/SeamLoginModule.java
Log:
port credentials, security events
Property changes on: modules/trunk/security
___________________________________________________________________
Name: svn:ignore
- target
.settings
+ .classpath
.project
.settings
target
Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/Credentials.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/Credentials.java 2009-04-21 23:49:06 UTC (rev 10555)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/Credentials.java 2009-04-22 01:16:58 UTC (rev 10556)
@@ -1,36 +1,36 @@
package org.jboss.seam.security;
-import static org.jboss.seam.ScopeType.SESSION;
-import static org.jboss.seam.annotations.Install.BUILT_IN;
-
import java.io.IOException;
import java.io.Serializable;
+import javax.annotation.Named;
+import javax.context.SessionScoped;
+import javax.inject.Current;
+import javax.inject.manager.Manager;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.NameCallback;
import javax.security.auth.callback.PasswordCallback;
import javax.security.auth.callback.UnsupportedCallbackException;
-import org.jboss.seam.annotations.Install;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.intercept.BypassInterceptors;
-import org.jboss.seam.core.Events;
-import org.jboss.seam.log.LogProvider;
-import org.jboss.seam.log.Logging;
+import org.jboss.seam.security.events.CredentialsInitializedEvent;
+import org.jboss.seam.security.events.CredentialsUpdatedEvent;
+import org.jboss.webbeans.log.LogProvider;
+import org.jboss.webbeans.log.Logging;
-@Name("org.jboss.seam.security.credentials")
-@Scope(SESSION)
-@Install(precedence = BUILT_IN)
-@BypassInterceptors
+@Named
+@SessionScoped
public class Credentials implements Serializable
{
+ private static final long serialVersionUID = -2271248957776488426L;
+
public static final String EVENT_INIT_CREDENTIALS = "org.jboss.seam.security.initCredentials";
public static final String EVENT_CREDENTIALS_UPDATED = "org.jboss.seam.security.credentialsUpdated";
private static final LogProvider log = Logging.getLogProvider(Credentials.class);
+ @Current Manager manager;
+
private String username;
private String password;
@@ -50,10 +50,10 @@
public String getUsername()
{
- if (!isInitialized() && Events.exists())
+ if (!isInitialized())
{
setInitialized(true);
- Events.instance().raiseEvent(EVENT_INIT_CREDENTIALS, this);
+ manager.fireEvent(new CredentialsInitializedEvent(this));
}
return username;
@@ -65,7 +65,7 @@
{
this.username = username;
invalid = false;
- if (Events.exists()) Events.instance().raiseEvent(EVENT_CREDENTIALS_UPDATED);
+ manager.fireEvent(new CredentialsUpdatedEvent());
}
}
@@ -80,7 +80,7 @@
{
this.password = password;
invalid = false;
- if (Events.exists()) Events.instance().raiseEvent(EVENT_CREDENTIALS_UPDATED);
+ manager.fireEvent(new CredentialsUpdatedEvent());
}
}
Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/FacesSecurityEvents.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/FacesSecurityEvents.java 2009-04-21 23:49:06 UTC (rev 10555)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/FacesSecurityEvents.java 2009-04-22 01:16:58 UTC (rev 10556)
@@ -1,18 +1,16 @@
package org.jboss.seam.security;
-import static org.jboss.seam.ScopeType.APPLICATION;
-import static org.jboss.seam.annotations.Install.BUILT_IN;
-
+import javax.context.ApplicationScoped;
+import javax.event.Observes;
import javax.security.auth.login.LoginException;
-import org.jboss.seam.annotations.Install;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Observer;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.Startup;
-import org.jboss.seam.annotations.intercept.BypassInterceptors;
import org.jboss.seam.international.StatusMessages;
import org.jboss.seam.international.StatusMessage.Severity;
+import org.jboss.seam.security.events.AlreadyLoggedInEvent;
+import org.jboss.seam.security.events.LoggedInEvent;
+import org.jboss.seam.security.events.LoginFailedEvent;
+import org.jboss.seam.security.events.NotLoggedInEvent;
+import org.jboss.seam.security.events.PostAuthenticateEvent;
/**
* Produces FacesMessages in response of certain security events, and helps to decouple the
@@ -20,28 +18,22 @@
*
* @author Shane Bryzak
*/
-@Name("org.jboss.seam.security.facesSecurityEvents")
-@Scope(APPLICATION)
-@Install(precedence = BUILT_IN, classDependencies = "javax.faces.context.FacesContext")
-@BypassInterceptors
-@Startup
+@ApplicationScoped
public class FacesSecurityEvents
{
- @Observer(Identity.EVENT_POST_AUTHENTICATE)
- public void postAuthenticate(Identity identity)
+ public void postAuthenticate(@Observes PostAuthenticateEvent event)
{
//org.jboss.security.saml.SSOManager.processManualLoginNotification(
//ServletContexts.instance().getRequest(), identity.getPrincipal().getName());
}
- @Observer(Identity.EVENT_LOGIN_FAILED)
- public void addLoginFailedMessage(LoginException ex)
+ public void addLoginFailedMessage(@Observes LoginFailedEvent event)
{
StatusMessages.instance().addFromResourceBundleOrDefault(
getLoginFailedMessageSeverity(),
getLoginFailedMessageKey(),
getLoginFailedMessage(),
- ex);
+ event.getLoginException());
}
public String getLoginFailedMessage()
@@ -59,8 +51,7 @@
return "org.jboss.seam.loginFailed";
}
- @Observer(Identity.EVENT_LOGIN_SUCCESSFUL)
- public void addLoginSuccessfulMessage()
+ public void addLoginSuccessfulMessage(@Observes LoggedInEvent event)
{
StatusMessages.instance().addFromResourceBundleOrDefault(
getLoginSuccessfulMessageSeverity(),
@@ -69,8 +60,7 @@
Identity.instance().getCredentials().getUsername());
}
- @Observer(Identity.EVENT_NOT_LOGGED_IN)
- public void addNotLoggedInMessage()
+ public void addNotLoggedInMessage(@Observes NotLoggedInEvent event)
{
StatusMessages.instance().addFromResourceBundleOrDefault(
Severity.WARN,
@@ -94,8 +84,7 @@
return "org.jboss.seam.loginSuccessful";
}
- @Observer(Identity.EVENT_ALREADY_LOGGED_IN)
- public void addAlreadyLoggedInMessage()
+ public void addAlreadyLoggedInMessage(@Observes AlreadyLoggedInEvent event)
{
StatusMessages.instance().addFromResourceBundleOrDefault (
Severity.WARN,
Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/Identity.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/Identity.java 2009-04-21 23:49:06 UTC (rev 10555)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/Identity.java 2009-04-22 01:16:58 UTC (rev 10556)
@@ -214,7 +214,7 @@
log.debug("Login failed for: " + credentials, ex);
}
- manager.fireEvent(new LoginFailedEvent());
+ manager.fireEvent(new LoginFailedEvent(ex));
}
return null;
Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/Admin.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/Admin.java 2009-04-21 23:49:06 UTC (rev 10555)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/Admin.java 2009-04-22 01:16:58 UTC (rev 10556)
@@ -1,4 +1,4 @@
-package org.jboss.seam.annotations.security;
+package org.jboss.seam.security.annotations;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
Deleted: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/package-info.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/package-info.java 2009-04-21 23:49:06 UTC (rev 10555)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/package-info.java 2009-04-22 01:16:58 UTC (rev 10556)
@@ -1,7 +0,0 @@
-/**
- * Annotations (well, one annotation) for use with Seam security.
- *
- * @see org.jboss.seam.security.Identity
- */
-package org.jboss.seam.annotations.security;
-
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/events/CredentialsInitializedEvent.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/events/CredentialsInitializedEvent.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/events/CredentialsInitializedEvent.java 2009-04-22 01:16:58 UTC (rev 10556)
@@ -0,0 +1,28 @@
+package org.jboss.seam.security.events;
+
+import org.jboss.seam.security.Credentials;
+
+/**
+ * This event is raised when credentials are initialized
+ *
+ * @author Shane Bryzak
+ */
+public class CredentialsInitializedEvent
+{
+ private Credentials credentials;
+
+ public CredentialsInitializedEvent(Credentials credentials)
+ {
+ this.credentials = credentials;
+ }
+
+ public Credentials getCredentials()
+ {
+ return credentials;
+ }
+
+ public void setCredentials(Credentials credentials)
+ {
+ this.credentials = credentials;
+ }
+}
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/events/CredentialsUpdatedEvent.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/events/CredentialsUpdatedEvent.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/events/CredentialsUpdatedEvent.java 2009-04-22 01:16:58 UTC (rev 10556)
@@ -0,0 +1,11 @@
+package org.jboss.seam.security.events;
+
+/**
+ * This event is raised when credentials are updated
+ *
+ * @author Shane Bryzak
+ */
+public class CredentialsUpdatedEvent
+{
+
+}
Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/events/LoginFailedEvent.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/events/LoginFailedEvent.java 2009-04-21 23:49:06 UTC (rev 10555)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/events/LoginFailedEvent.java 2009-04-22 01:16:58 UTC (rev 10556)
@@ -1,5 +1,7 @@
package org.jboss.seam.security.events;
+import javax.security.auth.login.LoginException;
+
/**
* This event is fired when an authentication attempt fails
*
@@ -7,5 +9,15 @@
*/
public class LoginFailedEvent
{
-
+ private LoginException loginException;
+
+ public LoginFailedEvent(LoginException loginException)
+ {
+ this.loginException = loginException;
+ }
+
+ public LoginException getLoginException()
+ {
+ return loginException;
+ }
}
Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/jaas/SeamLoginModule.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/jaas/SeamLoginModule.java 2009-04-21 23:49:06 UTC (rev 10555)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/jaas/SeamLoginModule.java 2009-04-22 01:16:58 UTC (rev 10556)
@@ -7,6 +7,7 @@
import java.util.Map;
import java.util.Set;
+import javax.inject.manager.Manager;
import javax.security.auth.Subject;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
@@ -15,9 +16,8 @@
import javax.security.auth.login.LoginException;
import javax.security.auth.spi.LoginModule;
-import org.jboss.seam.core.Expressions.MethodExpression;
-import org.jboss.seam.log.LogProvider;
-import org.jboss.seam.log.Logging;
+import org.jboss.webbeans.log.LogProvider;
+import org.jboss.webbeans.log.Logging;
import org.jboss.seam.security.Identity;
import org.jboss.seam.security.SimpleGroup;
import org.jboss.seam.security.SimplePrincipal;
15 years, 10 months
Seam SVN: r10555 - in modules/trunk/security: src/main/java/org/jboss/seam/security and 3 other directories.
by seam-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-04-21 19:49:06 -0400 (Tue, 21 Apr 2009)
New Revision: 10555
Added:
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/Admin.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/Delete.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/Insert.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/PermissionCheck.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/Read.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/Restrict.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/RoleCheck.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/TokenUsername.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/TokenValue.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/Update.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/PasswordSalt.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/RoleConditional.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/RoleGroups.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/RoleName.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/UserEnabled.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/UserFirstName.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/UserLastName.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/UserPassword.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/UserPrincipal.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/UserRoles.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/package-info.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/Identifier.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/Permission.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/PermissionAction.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/PermissionDiscriminator.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/PermissionRole.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/PermissionTarget.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/PermissionUser.java
modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/Permissions.java
Modified:
modules/trunk/security/pom.xml
modules/trunk/security/src/main/java/org/jboss/seam/security/AuthorizationException.java
modules/trunk/security/src/main/java/org/jboss/seam/security/Configuration.java
modules/trunk/security/src/main/java/org/jboss/seam/security/EntityPermissionChecker.java
Log:
added security annotations
Modified: modules/trunk/security/pom.xml
===================================================================
--- modules/trunk/security/pom.xml 2009-04-21 23:34:35 UTC (rev 10554)
+++ modules/trunk/security/pom.xml 2009-04-21 23:49:06 UTC (rev 10555)
@@ -22,7 +22,11 @@
<dependency>
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-logging</artifactId>
- </dependency>
+ </dependency>
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ </dependency>
</dependencies>
<build>
Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/AuthorizationException.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/AuthorizationException.java 2009-04-21 23:34:35 UTC (rev 10554)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/AuthorizationException.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -1,15 +1,14 @@
package org.jboss.seam.security;
-import javax.ejb.ApplicationException;
-
/**
* Thrown when an authenticated user has insufficient rights to carry out an action.
*
* @author Shane Bryzak
*/
-@ApplicationException(rollback=true)
public class AuthorizationException extends RuntimeException
{
+ private static final long serialVersionUID = -981091398588455903L;
+
public AuthorizationException(String message)
{
super(message);
Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/Configuration.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/Configuration.java 2009-04-21 23:34:35 UTC (rev 10554)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/Configuration.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -1,21 +1,12 @@
package org.jboss.seam.security;
-import static org.jboss.seam.ScopeType.APPLICATION;
-import static org.jboss.seam.annotations.Install.BUILT_IN;
-
import java.util.HashMap;
+import javax.context.ApplicationScoped;
+import javax.inject.Produces;
import javax.security.auth.login.AppConfigurationEntry;
import javax.security.auth.login.AppConfigurationEntry.LoginModuleControlFlag;
-import org.jboss.seam.Component;
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.Factory;
-import org.jboss.seam.annotations.Install;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.intercept.BypassInterceptors;
-import org.jboss.seam.contexts.Contexts;
import org.jboss.seam.security.jaas.SeamLoginModule;
/**
@@ -24,10 +15,6 @@
* @author Shane Bryzak
*
*/
-@Name("org.jboss.seam.security.configurationFactory")
-@BypassInterceptors
-(a)Scope(ScopeType.STATELESS)
-@Install(precedence = BUILT_IN)
public class Configuration
{
static final String DEFAULT_JAAS_CONFIG_NAME = "default";
@@ -58,18 +45,8 @@
);
}
- @Factory(value="org.jboss.seam.security.configuration", autoCreate=true, scope=APPLICATION)
- public javax.security.auth.login.Configuration getConfiguration()
+ @Produces @ApplicationScoped javax.security.auth.login.Configuration getConfiguration()
{
return createConfiguration();
}
-
- public static javax.security.auth.login.Configuration instance()
- {
- if ( !Contexts.isApplicationContextActive() )
- {
- throw new IllegalStateException("No active application scope");
- }
- return (javax.security.auth.login.Configuration) Component.getInstance("org.jboss.seam.security.configuration");
- }
}
Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/EntityPermissionChecker.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/EntityPermissionChecker.java 2009-04-21 23:34:35 UTC (rev 10554)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/EntityPermissionChecker.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -1,19 +1,10 @@
package org.jboss.seam.security;
-import static org.jboss.seam.ScopeType.APPLICATION;
-import static org.jboss.seam.annotations.Install.BUILT_IN;
-
import java.lang.reflect.Method;
+import javax.context.ApplicationScoped;
import javax.persistence.EntityManager;
-import org.jboss.seam.Component;
-import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.Install;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.Startup;
-import org.jboss.seam.annotations.intercept.BypassInterceptors;
import org.jboss.seam.annotations.security.Restrict;
import org.jboss.seam.contexts.Contexts;
import org.jboss.seam.persistence.PersistenceProvider;
@@ -24,11 +15,7 @@
*
* @author Shane Bryzak
*/
-@Name("org.jboss.seam.security.entityPermissionChecker")
-@Scope(APPLICATION)
-@Install(precedence = BUILT_IN)
-@BypassInterceptors
-@Startup
+@ApplicationScoped
public class EntityPermissionChecker
{
private String entityManagerName = "entityManager";
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/Admin.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/Admin.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/Admin.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,25 @@
+package org.jboss.seam.annotations.security;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Indicates that the action method requires the user to be a member of the 'admin' role to invoke.
+ *
+ * @author Shane Bryzak
+ */
+@Target({TYPE, METHOD})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+@RoleCheck
+public @interface Admin
+{
+
+}
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/Delete.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/Delete.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/Delete.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,24 @@
+package org.jboss.seam.security.annotations;
+
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ *
+ *
+ * @author Shane Bryzak
+ */
+@Target({METHOD, PARAMETER})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+@PermissionCheck
+public @interface Delete {
+ Class value() default void.class;
+}
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/Insert.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/Insert.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/Insert.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,24 @@
+package org.jboss.seam.security.annotations;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ *
+ *
+ * @author Shane Bryzak
+ */
+@Target({METHOD, PARAMETER})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+@PermissionCheck
+public @interface Insert {
+ Class value() default void.class;
+}
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/PermissionCheck.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/PermissionCheck.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/PermissionCheck.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,24 @@
+package org.jboss.seam.security.annotations;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Meta-annotation that designates an annotation as being a permission action,
+ * requiring a security check prior to invoking the annotated method or class
+ *
+ * @author Shane Bryzak
+ */
+@Target({ANNOTATION_TYPE})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface PermissionCheck
+{
+ String value() default "";
+}
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/Read.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/Read.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/Read.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,24 @@
+package org.jboss.seam.security.annotations;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ *
+ *
+ * @author Shane Bryzak
+ */
+@Target({METHOD, PARAMETER})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+@PermissionCheck
+public @interface Read {
+ Class value() default void.class;
+}
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/Restrict.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/Restrict.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/Restrict.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,34 @@
+package org.jboss.seam.security.annotations;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Used to restrict access to a Seam component, component method or entity.
+ *
+ * @see org.jboss.seam.security.Identity
+ *
+ * @author Shane Bryzak
+ */
+@Target({TYPE,METHOD})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface Restrict
+{
+ /**
+ * Restrictions may be expressed using any EL expression, and usually
+ * include the use of s:hasRole(...) or s:hasPermission(..., /..).
+ * If no EL expression is explicitly specified, Seam security defaults
+ * the permission to be checked.
+ *
+ * @return An EL expression that defines the restriction to be checked
+ */
+ String value() default "";
+}
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/RoleCheck.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/RoleCheck.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/RoleCheck.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,24 @@
+package org.jboss.seam.security.annotations;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Meta-annotation that designates an annotation as being a role,
+ * requiring a security check prior to invoking the annotated method or class
+ *
+ * @author Shane Bryzak
+ */
+@Target({ANNOTATION_TYPE})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface RoleCheck
+{
+
+}
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/TokenUsername.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/TokenUsername.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/TokenUsername.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,24 @@
+package org.jboss.seam.security.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Flags an entity field or method as representing the username for an authentication token
+ *
+ * @author Shane Bryzak
+ */
+@Target({METHOD,FIELD})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface TokenUsername
+{
+
+}
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/TokenValue.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/TokenValue.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/TokenValue.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,24 @@
+package org.jboss.seam.security.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Flags an entity field or method as representing the value for an authentication token
+ *
+ * @author Shane Bryzak
+ */
+@Target({METHOD,FIELD})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface TokenValue
+{
+
+}
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/Update.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/Update.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/Update.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,24 @@
+package org.jboss.seam.security.annotations;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ *
+ *
+ * @author Shane Bryzak
+ */
+@Target({METHOD, PARAMETER})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+@PermissionCheck
+public @interface Update {
+ Class value() default void.class;
+}
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/PasswordSalt.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/PasswordSalt.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/PasswordSalt.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,24 @@
+package org.jboss.seam.security.annotations.management;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * The salt value used to produce the password hash
+ *
+ * @author Shane Bryzak
+ */
+@Target({METHOD,FIELD})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface PasswordSalt
+{
+
+}
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/RoleConditional.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/RoleConditional.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/RoleConditional.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,24 @@
+package org.jboss.seam.security.annotations.management;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Flags an entity field or method as representing whether a role is conditional or not
+ *
+ * @author Shane Bryzak
+ */
+@Target({METHOD,FIELD})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface RoleConditional
+{
+
+}
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/RoleGroups.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/RoleGroups.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/RoleGroups.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,24 @@
+package org.jboss.seam.security.annotations.management;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Flags an entity field or method as representing the group memberships for a role
+ *
+ * @author Shane Bryzak
+ */
+@Target({METHOD,FIELD})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface RoleGroups
+{
+
+}
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/RoleName.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/RoleName.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/RoleName.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,24 @@
+package org.jboss.seam.security.annotations.management;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Flags an entity field or method as representing the name of a role
+ *
+ * @author Shane Bryzak
+ */
+@Target({METHOD,FIELD})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface RoleName
+{
+
+}
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/UserEnabled.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/UserEnabled.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/UserEnabled.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,24 @@
+package org.jboss.seam.security.annotations.management;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Flags an entity field or method as representing the enabled status of a user
+ *
+ * @author Shane Bryzak
+ */
+@Target({METHOD,FIELD})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface UserEnabled
+{
+
+}
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/UserFirstName.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/UserFirstName.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/UserFirstName.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,24 @@
+package org.jboss.seam.security.annotations.management;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Flags an entity field or method as representing the first name of a user
+ *
+ * @author Shane Bryzak
+ */
+@Target({METHOD,FIELD})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface UserFirstName
+{
+
+}
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/UserLastName.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/UserLastName.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/UserLastName.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,24 @@
+package org.jboss.seam.security.annotations.management;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Flags an entity field or method as representing the last name of a user
+ *
+ * @author Shane Bryzak
+ */
+@Target({METHOD,FIELD})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface UserLastName
+{
+
+}
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/UserPassword.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/UserPassword.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/UserPassword.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,32 @@
+package org.jboss.seam.security.annotations.management;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Flags an entity field or method as representing the password for a user
+ *
+ * @author Shane Bryzak
+ */
+@Target({METHOD,FIELD})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface UserPassword
+{
+ /**
+ * The hash algorithm, only used if there is no @PasswordSalt property specified
+ */
+ String hash() default "";
+
+ /**
+ * Number of iterations for generating the password hash
+ */
+ int iterations() default 1000;
+}
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/UserPrincipal.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/UserPrincipal.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/UserPrincipal.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,24 @@
+package org.jboss.seam.security.annotations.management;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Flags an entity field or method as representing the principal (username) for a user
+ *
+ * @author Shane Bryzak
+ */
+@Target({METHOD,FIELD})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface UserPrincipal
+{
+
+}
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/UserRoles.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/UserRoles.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/management/UserRoles.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,24 @@
+package org.jboss.seam.security.annotations.management;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Flags an entity field or method as representing the list of role memberships for a user
+ *
+ * @author Shane Bryzak
+ */
+@Target({METHOD,FIELD})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface UserRoles
+{
+
+}
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/package-info.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/package-info.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/package-info.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,7 @@
+/**
+ * Annotations (well, one annotation) for use with Seam security.
+ *
+ * @see org.jboss.seam.security.Identity
+ */
+package org.jboss.seam.annotations.security;
+
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/Identifier.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/Identifier.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/Identifier.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,27 @@
+package org.jboss.seam.security.annotations.permission;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import org.jboss.seam.security.permission.IdentifierStrategy;
+
+/**
+ * Configures the Identifier strategy to use for instance-based permissions. The specified class
+ * should implement the IdentifierStrategy interface.
+ *
+ * @author Shane Bryzak
+ */
+@Target({TYPE})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface Identifier
+{
+ Class<? extends IdentifierStrategy> value() default IdentifierStrategy.class;
+ String name() default "";
+}
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/Permission.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/Permission.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/Permission.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,25 @@
+package org.jboss.seam.security.annotations.permission;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Specifies an allowable permission action for the target class, and allows for an optional bit mask
+ * value for mapping the permission action to a persistent store
+ *
+ * @author Shane Bryzak
+ */
+@Target({TYPE})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface Permission
+{
+ String action();
+ long mask() default 0L;
+}
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/PermissionAction.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/PermissionAction.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/PermissionAction.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,25 @@
+package org.jboss.seam.security.annotations.permission;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Flags an entity field or method as representing the action component of a permission, e.g. "update",
+ * "delete".
+ *
+ * @author Shane Bryzak
+ */
+@Target({METHOD,FIELD})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface PermissionAction
+{
+
+}
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/PermissionDiscriminator.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/PermissionDiscriminator.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/PermissionDiscriminator.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,26 @@
+package org.jboss.seam.security.annotations.permission;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Flags an entity field or method as representing the discriminator column in a permission table
+ * that contains permissions for both roles and users.
+ *
+ * @author Shane Bryzak
+ */
+@Target({METHOD,FIELD})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface PermissionDiscriminator
+{
+ String userValue() default "user";
+ String roleValue() default "role";
+}
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/PermissionRole.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/PermissionRole.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/PermissionRole.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,24 @@
+package org.jboss.seam.security.annotations.permission;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Flags an entity field or method as representing the role that a permission is assigned to.
+ *
+ * @author Shane Bryzak
+ */
+@Target({METHOD,FIELD})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface PermissionRole
+{
+
+}
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/PermissionTarget.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/PermissionTarget.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/PermissionTarget.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,24 @@
+package org.jboss.seam.security.annotations.permission;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Flags an entity field or method as representing the target of a permission.
+ *
+ * @author Shane Bryzak
+ */
+@Target({METHOD,FIELD})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface PermissionTarget
+{
+
+}
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/PermissionUser.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/PermissionUser.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/PermissionUser.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,25 @@
+package org.jboss.seam.security.annotations.permission;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Flags an entity field or method as representing the principal (username) that a permission is
+ * assigned to.
+ *
+ * @author Shane Bryzak
+ */
+@Target({METHOD,FIELD})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface PermissionUser
+{
+
+}
Added: modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/Permissions.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/Permissions.java (rev 0)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/annotations/permission/Permissions.java 2009-04-21 23:49:06 UTC (rev 10555)
@@ -0,0 +1,23 @@
+package org.jboss.seam.security.annotations.permission;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Specifies a list of permission actions for a class
+ *
+ * @author Shane Bryzak
+ */
+@Target({TYPE})
+@Documented
+@Retention(RUNTIME)
+@Inherited
+public @interface Permissions
+{
+ Permission[] value() default {};
+}
15 years, 10 months