Weld SVN: r6490 - in archetypes/branches/prototype: generated-archetype and 1 other directory.
by weld-commits@lists.jboss.org
Author: dan.j.allen
Date: 2010-06-18 21:16:43 -0400 (Fri, 18 Jun 2010)
New Revision: 6490
Added:
archetypes/branches/prototype/generated-archetype/
archetypes/branches/prototype/generated-archetype/pom.xml
Modified:
archetypes/branches/prototype/build.sh
Log:
remove parent from generated pom
add placeholder which is needed for tagging
Modified: archetypes/branches/prototype/build.sh
===================================================================
--- archetypes/branches/prototype/build.sh 2010-06-19 00:46:07 UTC (rev 6489)
+++ archetypes/branches/prototype/build.sh 2010-06-19 01:16:43 UTC (rev 6490)
@@ -1,26 +1,34 @@
#!/bin/sh
ARCHETYPE_DIR=target/generated-sources/archetype
-ARCHETYPE_RESOURCES_DIR=$ARCHETYPE_DIR/src/main/resources/archetype-resources
echo Generating archetype from project into $ARCHETYPE_DIR...
+rm -Rf generated-archetype/src
mvn clean archetype:create-from-project -Darchetype.properties=archetype.properties
-echo Cleaning generated archetype project...
-mvn -f $ARCHETYPE_DIR/pom.xml clean
+echo Relocating generated archetype project...
+mv $ARCHETYPE_DIR/src generated-archetype/
+mv -f $ARCHETYPE_DIR/pom.xml generated-archetype/
+ARCHETYPE_DIR=generated-archetype
+ARCHETYPE_RESOURCES_DIR=$ARCHETYPE_DIR/src/main/resources/archetype-resources
+#mvn -f $ARCHETYPE_DIR/pom.xml clean
+echo Patching generated archetype...
rm -f $ARCHETYPE_RESOURCES_DIR/`basename $0`
# could also use col -b
sed -i 's;
;;' $ARCHETYPE_RESOURCES_DIR/pom.xml
+sed -i '/<parent>/,/^$/d' $ARCHETYPE_RESOURCES_DIR/pom.xml
sed -i 's;
;;' $ARCHETYPE_RESOURCES_DIR/readme.txt
sed -i 's;<name>weld-basic-javaee6-webapp</name>;<name>Weld Basic Java EE 6 Webapp</name>;' $ARCHETYPE_DIR/pom.xml
sed -i 's;<name>weld-basic-javaee6-webapp-src</name>;<name>${name}</name>;' $ARCHETYPE_RESOURCES_DIR/pom.xml
if [ ! -z $1 ] && [ "$1" = "install" ]; then
+ echo Installing archetype...
shift
mvn -f $ARCHETYPE_DIR/pom.xml install
fi
if [ ! -z $1 ] && [ "$1" = "generate" ]; then
+ echo Generating project from archetype...
cd target
mvn archetype:generate -B -DarchetypeCatalog=local \
-DarchetypeArtifactId=weld-basic-javaee6-webapp -DarchetypeGroupId=org.jboss.weld.archetypes -DarchetypeVersion=1.0.0-SNAPSHOT \
Property changes on: archetypes/branches/prototype/generated-archetype
___________________________________________________________________
Name: svn:ignore
+ target
src
Added: archetypes/branches/prototype/generated-archetype/pom.xml
===================================================================
--- archetypes/branches/prototype/generated-archetype/pom.xml (rev 0)
+++ archetypes/branches/prototype/generated-archetype/pom.xml 2010-06-19 01:16:43 UTC (rev 6490)
@@ -0,0 +1,44 @@
+<?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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.jboss.weld.archetypes</groupId>
+ <artifactId>weld-basic-javaee6-webapp</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>maven-archetype</packaging>
+
+ <name>Weld Basic Java EE 6 Webapp</name>
+
+ <build>
+ <extensions>
+ <extension>
+ <groupId>org.apache.maven.archetype</groupId>
+ <artifactId>archetype-packaging</artifactId>
+ <version>2.0-alpha-5</version>
+ </extension>
+ </extensions>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-archetype-plugin</artifactId>
+ <version>2.0-alpha-5</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <distributionManagement>
+ <repository>
+ <id>oss.sonatype.org/jboss-staging</id>
+ <name>Sonatype Nexus Maven Repository</name>
+ <url>http://oss.sonatype.org/service/local/staging/deploy/maven2</url>
+ </repository>
+ <snapshotRepository>
+ <id>oss.sonatype.org/jboss-snapshots</id>
+ <name>Sonatype Nexus Snapshot Repository</name>
+ <url>http://oss.sonatype.org/content/repositories/jboss-snapshots</url>
+ </snapshotRepository>
+ </distributionManagement>
+</project>
14 years, 7 months
Weld SVN: r6489 - in archetypes/branches/prototype: src/main and 12 other directories.
by weld-commits@lists.jboss.org
Author: dan.j.allen
Date: 2010-06-18 20:46:07 -0400 (Fri, 18 Jun 2010)
New Revision: 6489
Added:
archetypes/branches/prototype/archetype.properties
archetypes/branches/prototype/src/main/java/com/mycompany/JaxRsConfig.java
archetypes/branches/prototype/src/main/java/com/mycompany/Member.java
archetypes/branches/prototype/src/main/java/com/mycompany/MemberListProducer.java
archetypes/branches/prototype/src/main/java/com/mycompany/MemberRegistration.java
archetypes/branches/prototype/src/main/java/com/mycompany/MemberRepository.java
archetypes/branches/prototype/src/main/java/com/mycompany/MemberRepositoryProducer.java
archetypes/branches/prototype/src/main/java/com/mycompany/MemberResource.java
archetypes/branches/prototype/src/main/java/com/mycompany/Member_.java
archetypes/branches/prototype/src/main/resources-jbossas/
archetypes/branches/prototype/src/main/resources-jbossas/default-ds.xml
archetypes/branches/prototype/src/test/java/com/mycompany/MemberRegistrationTest.java
archetypes/branches/prototype/src/test/resources-glassfish-embedded/
archetypes/branches/prototype/src/test/resources-glassfish-embedded/sun-resources.xml
archetypes/branches/prototype/src/test/resources-glassfish-embedded/test-persistence.xml
archetypes/branches/prototype/src/test/resources-jbossas/
archetypes/branches/prototype/src/test/resources-jbossas/jndi.properties
archetypes/branches/prototype/src/test/resources-jbossas/test-persistence.xml
archetypes/branches/prototype/src/test/resources/arquillian.xml
Removed:
archetypes/branches/prototype/src/main/java/com/mycompany/HelloWorld.java
archetypes/branches/prototype/src/main/java/com/mycompany/Widget.java
archetypes/branches/prototype/src/main/java/com/mycompany/WidgetListProducer.java
archetypes/branches/prototype/src/main/java/com/mycompany/WidgetRepository.java
archetypes/branches/prototype/src/main/java/com/mycompany/WidgetRepositoryProducer.java
archetypes/branches/prototype/src/test/java/com/mycompany/HelloWorldTest.java
Modified:
archetypes/branches/prototype/build.sh
archetypes/branches/prototype/pom.xml
archetypes/branches/prototype/readme.txt
archetypes/branches/prototype/src/main/resources/META-INF/persistence.xml
archetypes/branches/prototype/src/main/resources/import.sql
archetypes/branches/prototype/src/main/webapp/WEB-INF/
archetypes/branches/prototype/src/main/webapp/home.xhtml
archetypes/branches/prototype/src/main/webapp/resources/css/screen.css
Log:
major refactoring of project
switch from Widget to Member
add Arquillian configuration
Added: archetypes/branches/prototype/archetype.properties
===================================================================
--- archetypes/branches/prototype/archetype.properties (rev 0)
+++ archetypes/branches/prototype/archetype.properties 2010-06-19 00:46:07 UTC (rev 6489)
@@ -0,0 +1,9 @@
+archetype.keepParent=false
+archetype.groupId=org.jboss.weld.archetypes
+archetype.artifactId=weld-basic-javaee6-webapp
+archetype.version=1.0.0-SNAPSHOT
+archetype.package=com.acme.webapp
+archetype.languages=java
+# value of <artifactId> is converted to ${artifactId} expression in filtered files
+archetype.filteredExtensions=java,txt
+name=Java EE 6 project
Modified: archetypes/branches/prototype/build.sh
===================================================================
--- archetypes/branches/prototype/build.sh 2010-06-18 18:09:16 UTC (rev 6488)
+++ archetypes/branches/prototype/build.sh 2010-06-19 00:46:07 UTC (rev 6489)
@@ -1,6 +1,28 @@
#!/bin/sh
-mvn clean archetype:create-from-project
-mvn -f target/generated-sources/archetype/pom.xml install
+ARCHETYPE_DIR=target/generated-sources/archetype
+ARCHETYPE_RESOURCES_DIR=$ARCHETYPE_DIR/src/main/resources/archetype-resources
+echo Generating archetype from project into $ARCHETYPE_DIR...
+mvn clean archetype:create-from-project -Darchetype.properties=archetype.properties
+echo Cleaning generated archetype project...
+mvn -f $ARCHETYPE_DIR/pom.xml clean
+rm -f $ARCHETYPE_RESOURCES_DIR/`basename $0`
+# could also use col -b
+sed -i 's;
+;;' $ARCHETYPE_RESOURCES_DIR/pom.xml
+sed -i 's;
+;;' $ARCHETYPE_RESOURCES_DIR/readme.txt
+sed -i 's;<name>weld-basic-javaee6-webapp</name>;<name>Weld Basic Java EE 6 Webapp</name>;' $ARCHETYPE_DIR/pom.xml
+sed -i 's;<name>weld-basic-javaee6-webapp-src</name>;<name>${name}</name>;' $ARCHETYPE_RESOURCES_DIR/pom.xml
+if [ ! -z $1 ] && [ "$1" = "install" ]; then
+ shift
+ mvn -f $ARCHETYPE_DIR/pom.xml install
+fi
+if [ ! -z $1 ] && [ "$1" = "generate" ]; then
+ cd target
+ mvn archetype:generate -B -DarchetypeCatalog=local \
+ -DarchetypeArtifactId=weld-basic-javaee6-webapp -DarchetypeGroupId=org.jboss.weld.archetypes -DarchetypeVersion=1.0.0-SNAPSHOT \
+ -DartifactId=generated-project -DgroupId=com.acme -Dversion=1.0.0-SNAPSHOT -Dname="Java EE 6 Webapp"
+fi
Modified: archetypes/branches/prototype/pom.xml
===================================================================
--- archetypes/branches/prototype/pom.xml 2010-06-18 18:09:16 UTC (rev 6488)
+++ archetypes/branches/prototype/pom.xml 2010-06-19 00:46:07 UTC (rev 6489)
@@ -2,16 +2,25 @@
<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.weld</groupId>
+ <artifactId>weld-parent</artifactId>
+ <version>11</version>
+ </parent>
+
<groupId>org.jboss.weld.archetypes</groupId>
- <artifactId>javaee6</artifactId>
+ <artifactId>weld-basic-javaee6-webapp-src</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
- <name>Java EE 6.0 Archetype</name>
- <version>1.0.0-SNAPSHOT</version>
+ <name>weld-basic-javaee6-webapp-src</name>
+ <description>A basic Java EE 6 webapp project generated from the weld-basic-javaee6-webapp archetype</description>
+
<properties>
<!--
- Explicitly declaring the source encoding eliminates the following message: [WARNING] Using platform encoding
- (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
+ Explicitly declaring the source encoding eliminates the following message:
+ [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
-->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!--
@@ -25,12 +34,16 @@
-->
<jboss.home>${env.JBOSS_HOME}</jboss.home>
<jboss.domain>default</jboss.domain>
+ <arquillian.version>1.0.0-SNAPSHOT</arquillian.version>
+ <embedded-glassfish.version>3.0.1-b19</embedded-glassfish.version>
+ <jboss-javaee6-spec.version>1.0.0.Beta5</jboss-javaee6-spec.version>
+ <jboss-as-client.version>6.0.0.20100429-M3</jboss-as-client.version>
</properties>
<repositories>
- <!-- Optional Repository. -->
- <!-- Soon all required dependencies will be pushed to maven central. -->
- <!-- In the mean time, we need to point this archetype to the JBoss Maven Repository -->
+ <!-- The JBoss public Nexus repository is a composite repository of several major repositories -->
+ <!-- see http://community.jboss.org/wiki/MavenGettingStarted-Users -->
+ <!-- The goal is to get everything you would need into the central, but it's not there yet -->
<repository>
<id>jboss-public-repository</id>
<name>JBoss Repository</name>
@@ -45,24 +58,40 @@
</snapshots>
</repository>
</repositories>
+
<pluginRepositories>
- <!-- GlassFish repository required for embedded-glassfish plugin -->
<pluginRepository>
- <id>glassfish</id>
- <name>GlassFish Maven 2 Repository</name>
- <url>http://download.java.net/maven/glassfish</url>
+ <id>jboss-public-repository</id>
+ <name>JBoss Repository</name>
+ <url>https://repository.jboss.org/nexus/content/groups/public</url>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ <updatePolicy>daily</updatePolicy>
+ </snapshots>
</pluginRepository>
</pluginRepositories>
+
<dependencies>
+
<dependency>
- <groupId>org.jboss.spec</groupId>
- <artifactId>jboss-javaee-6.0</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-jpamodelgen</artifactId>
+ <version>1.0.0.Final</version>
<scope>provided</scope>
- <type>pom</type>
+ <exclusions>
+ <exclusion>
+ <groupId>org.hibernate.javax.persistence</groupId>
+ <artifactId>hibernate-jpa-2.0-api</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
- <!-- Bean Validation Implementation -->
- <!-- Provides portable constraints such as @NotEmpty, @Email and @Url -->
+
+ <!-- JSR-303 (Bean Validation) Implementation -->
+ <!-- Provides portable constraints such as @Email -->
<!-- Hibernate Validator is the only JSR-303 implementation at the moment, so we can assume it's provided -->
<dependency>
<groupId>org.hibernate</groupId>
@@ -71,64 +100,160 @@
<scope>provided</scope>
</dependency>
- <!-- Optional, but highly recommended. -->
<dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <version>5.11</version>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
<scope>test</scope>
- <classifier>jdk15</classifier>
</dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-junit</artifactId>
+ <version>${arquillian.version}</version>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
- <description>Java EE 6.0 Archetype</description>
+
<build>
- <finalName>${artifactId}</finalName>
+ <finalName>${project.artifactId}</finalName>
<plugins>
<!-- Compiler plugin enforces Java 1.6 compatibility -->
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
+ <!-- Please note you have to compile twice after changing an @Entity class -->
+ <generatedSourcesDirectory>src/main/java</generatedSourcesDirectory>
</configuration>
</plugin>
+ </plugins>
+ </build>
- <!-- Eclipse plugin can force download of source and JavaDoc jars -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-eclipse-plugin</artifactId>
- <configuration>
- <downloadSources>true</downloadSources>
- <downloadJavadocs>true</downloadJavadocs>
- </configuration>
- </plugin>
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.spec</groupId>
+ <artifactId>jboss-javaee-6.0</artifactId>
+ <version>${jboss-javaee6-spec.version}</version>
+ <type>pom</type>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ <!-- Configure the JBoss AS Maven deploy plugin -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jboss-maven-plugin</artifactId>
+ <version>1.4.1-SNAPSHOT</version>
+ <configuration>
+ <jbossHome>${jboss.home}</jbossHome>
+ <serverName>${jboss.domain}</serverName>
+ <fileNames>
+ <fileName>src/main/resources-jbossas/default-ds.xml</fileName>
+ <fileName>${project.build.directory}/${project.build.finalName}.war</fileName>
+ </fileNames>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
- <!-- Configure the JBoss AS Maven deploy plugin -->
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>jboss-maven-plugin</artifactId>
- <configuration>
- <jbossHome>${jboss.home}</jbossHome>
- <serverName>${jboss.domain}</serverName>
- <fileNames>
- <fileName>${project.build.directory}/${build.finalName}.war</fileName>
- </fileNames>
- </configuration>
- </plugin>
- <!-- Configure the Embedded GlassFish Maven plugin -->
- <plugin>
- <groupId>org.glassfish</groupId>
- <artifactId>maven-embedded-glassfish-plugin</artifactId>
- <version>3.0</version>
- <configuration>
- <app>${expr_start}project.build.directory${expr_end}/${expr_start}build.finalName${expr_end}.war</app>
- <port>7070</port>
- <containerType>web</containerType>
- <instanceRoot>${expr_start}project.build.directory${expr_end}/gfembed${expr_start}maven.build.timestamp${expr_end}</instanceRoot>
- <autoDelete>true</autoDelete>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ <profile>
+ <id>glassfish-embedded-30</id>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-glassfish-embedded-30</artifactId>
+ <version>${arquillian.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.extras</groupId>
+ <artifactId>glassfish-embedded-all</artifactId>
+ <version>3.0.1-b19</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ </testResource>
+ <testResource>
+ <directory>src/test/resources-glassfish-embedded</directory>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <!-- don't use version 2.5 as it creates seperate test suites per class -->
+ <version>2.4.3</version>
+ <configuration>
+ <systemProperties>
+ <!-- fix an annoyance -->
+ <property>
+ <name>derby.stream.error.file</name>
+ <value>target/derby.log</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>jbossas-remote-60</id>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-jbossas-remote-60</artifactId>
+ <version>${arquillian.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.spec</groupId>
+ <artifactId>jboss-javaee-6.0</artifactId>
+ <version>${jboss-javaee6-spec.version}</version>
+ <type>pom</type>
+ <scope>provided</scope>
+ </dependency>
+ <!-- need for org.jnp.interfaces.NamingContextFactory -->
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-client</artifactId>
+ <version>${jboss-as-client.version}</version>
+ <type>pom</type>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ </testResource>
+ <testResource>
+ <directory>src/test/resources-jbossas</directory>
+ </testResource>
+ </testResources>
+ </build>
+ </profile>
+ </profiles>
</project>
Modified: archetypes/branches/prototype/readme.txt
===================================================================
--- archetypes/branches/prototype/readme.txt 2010-06-18 18:09:16 UTC (rev 6488)
+++ archetypes/branches/prototype/readme.txt 2010-06-19 00:46:07 UTC (rev 6489)
@@ -1,7 +1,7 @@
- myproject
+ weld-basic-javaee6-webapp-src
- Source archetype: weld-jsf-jee
+ Source archetype: weld-basic-javaee6-webapp
What is it?
===========
@@ -19,22 +19,20 @@
All you need to run this project is Java 5.0 (Java SDK 1.5) or greator and
Maven 2.0.10 or greater. This application is setup to be run on a Java EE 6
- certified application server. It has been tested with GlassFish V3 and JBoss
- AS 6.0.
+ application server. We've tested it on GlassFish 3 and JBoss AS 6.0.
- If you want to deploy the application to a standalone Servlet Container, then
- you will need to set one up. Alternatively, you can use a Maven command to run
- the application in place on an embedded version of GlassFish V3.
-
- Please note that Maven 2 project needs to use the JBoss Maven repository
+ Please note that Maven 2 project needs to use the JBoss Nexus Maven repository
because there are certain Java EE API JARs that are not yet publised to the
Maven Central Repository (see https://jira.jboss.org/jira/browse/WELD-222)
+ The testing framework used by the project, Arquillian, is also only available
+ in the JBoss repository.
Deploying the application
=========================
To deploy the application to JBoss AS (standalone), first make sure that the
JBOSS_HOME environment variable points to a JBoss AS 6.0 installation.
+
Alternatively, you can set the location of JBoss AS using the following
profile defintion in the .m2/settings.xml file in your home directory:
@@ -51,38 +49,42 @@
<activeByDefault>true</activeByDefault>
</activation>
<properties>
- <jboss.home>/path/to/jboss-as-6.0.0.M1</jboss.home>
+ <jboss.home>/path/to/jboss-as-6.0.0.M3</jboss.home>
</properties>
</profile>
</profiles>
</settings>
- You can now deploy to JBoss AS by executing the following command:
+ Once you've set either the JBOSS_HOME environment variable or the jboss.home
+ Maven property, you can deploy to JBoss AS by executing the following command:
mvn package jboss:hard-deploy
- Start JBoss AS. The application will be running at the following URL:
+ This will deploy two artifacts, target/weld-basic-javaee6-webapp-src.war and
+ default-ds.xml. The latter installs a data source named jdbc/__default.
- http://localhost:8080/myproject
+ You can also set jboss.home on the commandline:
- If you want to deploy to GlassFish V3 (standalone), you first need to change
- the name of the DataSource used by the persistence unit! Open this file:
+ mvn package jboss:hard-deploy -Djboss.home=/path/to/jboss-as-6.0.0.M3
- src/main/resources/META-INF/persistence.xml
+ Start JBoss AS. The application will be running at the following URL:
- Change the value of <jta-data-source> to the following:
+ http://localhost:8080/weld-basic-javaee6-webapp-src/home.jsf
- <jta-data-source>jdbc/__default</jta-data-source>
+ Note: If you are using JBoss AS 6.0.0.M3, you may encounter the exception
+ described in https://jira.jboss.org/browse/WELD-448 if you attempt to access
+ to root context path (i.e., /).
+
+ To undeploy from JBoss AS, run this command:
- This configuration uses the built-in default Derby DataSource in GlassFish.
- Optionally, you can use an alternative DataSource of your choice.
-
- Now, execute the command:
+ mvn jboss:hard-undeploy
+ If you want to deploy to GlassFish, first produce the archive to deploy:
+
mvn package
- There are several ways to deploy the archive to GlassFish V3. The recommended
+ There are several ways to deploy the archive to GlassFish. The recommended
approach is to open the project in NetBeans 6.8, right-click on the project
and select "Run" from the context menu. That starts JavaDB, GlassFish and
deploys the application.
@@ -93,10 +95,10 @@
asadmin start-database
asadmin start-domain domain1
- Now you can either deploy the target/myproject.war through the web-based
+ Now you can either deploy the target/weld-basic-javaee6-webapp-src.war through the web-based
GlassFish admininstration console, or you can again use asadmin:
- asadmin /path/to/project/target/myproject.war
+ asadmin /path/to/project/target/weld-basic-javaee6-webapp-src.war
Unfortunately, the embedded GlassFish V3 application server does not bootstrap
the persistence unit(s), so you won't be able to leverage the Maven plugin to
@@ -125,12 +127,23 @@
Once in the IDE, you can execute the Maven commands through the IDE controls
to run the application on an embedded Servlet Container.
+ Downloading the sources and Javadocs
+ ====================================
+
+ If you want to be able to debug into the source code or look at the Javadocs
+ of any library in the project, you can run either of the following two
+ commands to pull them into your local repository. The IDE should then detect
+ them.
+
+ mvn dependency:sources
+ mvn dependency:resolve -Dclassifier=javadoc
+
Resources
=========
Weld archetypes:
- Quickstart: http://seamframework.org/Documentation/WeldQuickstartForMavenUsers
- - Issue tracker: https://jira.jboss.org/jira/browse/WELDX
+ - Issue tracker: https://jira.jboss.org/jira/browse/WELDRAD
- Source code: http://anonsvn.jboss.org/repos/weld/archetypes
- Forums: http://seamframework.org/Community/WeldUsers
JSR-299 overview: http://seamframework.org/Weld
Deleted: archetypes/branches/prototype/src/main/java/com/mycompany/HelloWorld.java
===================================================================
--- archetypes/branches/prototype/src/main/java/com/mycompany/HelloWorld.java 2010-06-18 18:09:16 UTC (rev 6488)
+++ archetypes/branches/prototype/src/main/java/com/mycompany/HelloWorld.java 2010-06-19 00:46:07 UTC (rev 6489)
@@ -1,74 +0,0 @@
-package com.mycompany;
-
-import javax.annotation.PostConstruct;
-import javax.enterprise.inject.Model;
-import javax.validation.constraints.Digits;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
-
-import org.hibernate.validator.constraints.Email;
-import org.hibernate.validator.constraints.NotEmpty;
-
-public @Model class HelloWorld
-{
- private final String text = "Hello World!";
-
- private String letters;
-
- private String numbers;
-
- private String email;
-
- public HelloWorld() {}
-
- @PostConstruct
- public void initialize()
- {
- System.out.println(this.getClass().getSimpleName() + " was constructed");
- }
-
- public String getText()
- {
- return text;
- }
-
- @NotNull
- @NotEmpty
- @Pattern(regexp = "[A-Za-z]*", message = "must contain only letters")
- public String getLetters()
- {
- return letters;
- }
-
- public void setLetters(String letters)
- {
- this.letters = letters;
- }
-
- @NotNull
- @NotEmpty
- @Digits(fraction = 0, integer = 2)
- public String getNumbers()
- {
- return numbers;
- }
-
- public void setNumbers(String numbers)
- {
- this.numbers = numbers;
- }
-
- @NotNull
- @NotEmpty
- @Email
- public String getEmail()
- {
- return email;
- }
-
- public void setEmail(String email)
- {
- this.email = email;
- }
-
-}
Added: archetypes/branches/prototype/src/main/java/com/mycompany/JaxRsConfig.java
===================================================================
--- archetypes/branches/prototype/src/main/java/com/mycompany/JaxRsConfig.java (rev 0)
+++ archetypes/branches/prototype/src/main/java/com/mycompany/JaxRsConfig.java 2010-06-19 00:46:07 UTC (rev 6489)
@@ -0,0 +1,7 @@
+package com.mycompany;
+
+import javax.ws.rs.ApplicationPath;
+import javax.ws.rs.core.Application;
+
+@ApplicationPath("rest")
+public class JaxRsConfig extends Application {}
Copied: archetypes/branches/prototype/src/main/java/com/mycompany/Member.java (from rev 6481, archetypes/branches/prototype/src/main/java/com/mycompany/Widget.java)
===================================================================
--- archetypes/branches/prototype/src/main/java/com/mycompany/Member.java (rev 0)
+++ archetypes/branches/prototype/src/main/java/com/mycompany/Member.java 2010-06-19 00:46:07 UTC (rev 6489)
@@ -0,0 +1,83 @@
+package com.mycompany;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.UniqueConstraint;
+import javax.validation.constraints.Digits;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+import javax.validation.constraints.Size;
+import javax.xml.bind.annotation.XmlRootElement;
+import org.hibernate.validator.constraints.Email;
+import org.hibernate.validator.constraints.NotEmpty;
+
+@Entity
+@XmlRootElement
+@Table(uniqueConstraints = @UniqueConstraint(columnNames = "email"))
+public class Member implements Serializable
+{
+ private Long id;
+ private String name;
+ private String email;
+ private String phoneNumber;
+
+ @Id
+ @GeneratedValue
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ @NotNull
+ @Size(min = 1, max = 25)
+ @Pattern(regexp = "[A-Za-z ]*", message = "must contain only letters and spaces")
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ @NotNull
+ @NotEmpty
+ @Email
+ public String getEmail()
+ {
+ return email;
+ }
+
+ public void setEmail(String email)
+ {
+ this.email = email;
+ }
+
+ @NotNull
+ @Size(min = 10, max = 12)
+ @Digits(fraction = 0, integer = 12)
+ @Column(name = "phone_number")
+ public String getPhoneNumber()
+ {
+ return phoneNumber;
+ }
+
+ public void setPhoneNumber(String phoneNumber)
+ {
+ this.phoneNumber = phoneNumber;
+ }
+
+ /** Default value included to remove warning. Remove or modify at will. */
+ private static final long serialVersionUID = 1L;
+}
\ No newline at end of file
Copied: archetypes/branches/prototype/src/main/java/com/mycompany/MemberListProducer.java (from rev 6481, archetypes/branches/prototype/src/main/java/com/mycompany/WidgetListProducer.java)
===================================================================
--- archetypes/branches/prototype/src/main/java/com/mycompany/MemberListProducer.java (rev 0)
+++ archetypes/branches/prototype/src/main/java/com/mycompany/MemberListProducer.java 2010-06-19 00:46:07 UTC (rev 6489)
@@ -0,0 +1,47 @@
+package com.mycompany;
+
+import java.util.List;
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Observes;
+import javax.enterprise.event.Reception;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.persistence.EntityManager;
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Root;
+
+@RequestScoped
+public class MemberListProducer
+{
+ @Inject
+ @MemberRepository
+ private EntityManager em;
+
+ private List<Member> members;
+
+ @Produces
+ @Named
+ public List<Member> getMembers()
+ {
+ return members;
+ }
+
+ public void onMemberListChanged(@Observes(notifyObserver = Reception.IF_EXISTS) final Member member)
+ {
+ fetch();
+ }
+
+ @PostConstruct
+ public void fetch()
+ {
+ CriteriaBuilder cb = em.getCriteriaBuilder();
+ CriteriaQuery<Member> criteria = cb.createQuery(Member.class);
+ Root<Member> widget = criteria.from(Member.class);
+ criteria.select(widget).orderBy(cb.asc(widget.get(Member_.name)));
+ members = em.createQuery(criteria).getResultList();
+ }
+}
Added: archetypes/branches/prototype/src/main/java/com/mycompany/MemberRegistration.java
===================================================================
--- archetypes/branches/prototype/src/main/java/com/mycompany/MemberRegistration.java (rev 0)
+++ archetypes/branches/prototype/src/main/java/com/mycompany/MemberRegistration.java 2010-06-19 00:46:07 UTC (rev 6489)
@@ -0,0 +1,50 @@
+package com.mycompany;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Model;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.persistence.EntityManager;
+import javax.transaction.UserTransaction;
+
+//@Stateful // enable when JBoss AS M4 is out
+@Model
+public class MemberRegistration
+{
+ @Inject
+ @MemberRepository
+ private EntityManager em;
+
+ @Inject
+ private UserTransaction utx;
+
+ private Member newMember;
+
+ @Produces
+ @Named
+ public Member getNewMember()
+ {
+ return newMember;
+ }
+ @Inject
+ private Event<Member> memberEventSrc;
+
+ public void register() throws Exception
+ {
+ System.out.println("Registering " + newMember.getName());
+ utx.begin();
+ em.joinTransaction();
+ em.persist(newMember);
+ utx.commit();
+ memberEventSrc.fire(newMember);
+ initNewMember();
+ }
+
+ @PostConstruct
+ public void initNewMember()
+ {
+ newMember = new Member();
+ }
+}
Copied: archetypes/branches/prototype/src/main/java/com/mycompany/MemberRepository.java (from rev 6481, archetypes/branches/prototype/src/main/java/com/mycompany/WidgetRepository.java)
===================================================================
--- archetypes/branches/prototype/src/main/java/com/mycompany/MemberRepository.java (rev 0)
+++ archetypes/branches/prototype/src/main/java/com/mycompany/MemberRepository.java 2010-06-19 00:46:07 UTC (rev 6489)
@@ -0,0 +1,16 @@
+package com.mycompany;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * A qualifier used to differentiate between multiple data repositories
+ */
+@Qualifier
+(a)Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+(a)Retention(RetentionPolicy.RUNTIME)
+public @interface MemberRepository {}
Copied: archetypes/branches/prototype/src/main/java/com/mycompany/MemberRepositoryProducer.java (from rev 6481, archetypes/branches/prototype/src/main/java/com/mycompany/WidgetRepositoryProducer.java)
===================================================================
--- archetypes/branches/prototype/src/main/java/com/mycompany/MemberRepositoryProducer.java (rev 0)
+++ archetypes/branches/prototype/src/main/java/com/mycompany/MemberRepositoryProducer.java 2010-06-19 00:46:07 UTC (rev 6489)
@@ -0,0 +1,13 @@
+package com.mycompany;
+
+import javax.enterprise.inject.Produces;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+public class MemberRepositoryProducer
+{
+ @Produces
+ @MemberRepository
+ @PersistenceContext
+ private EntityManager em;
+}
Added: archetypes/branches/prototype/src/main/java/com/mycompany/MemberResource.java
===================================================================
--- archetypes/branches/prototype/src/main/java/com/mycompany/MemberResource.java (rev 0)
+++ archetypes/branches/prototype/src/main/java/com/mycompany/MemberResource.java 2010-06-19 00:46:07 UTC (rev 6489)
@@ -0,0 +1,30 @@
+package com.mycompany;
+
+import java.util.List;
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+
+@Path("/members")
+@RequestScoped
+public class MemberResource
+{
+ @Inject @MemberRepository
+ private EntityManager em;
+
+ @GET
+ public List<Member> getMembers()
+ {
+ return em.createQuery("select m from Member m order by m.name").getResultList();
+ }
+
+ @GET
+ @Path("/{id:[1-9][0-9]*}")
+ public Member getMember(@PathParam("id") long id)
+ {
+ return em.find(Member.class, id);
+ }
+}
Added: archetypes/branches/prototype/src/main/java/com/mycompany/Member_.java
===================================================================
--- archetypes/branches/prototype/src/main/java/com/mycompany/Member_.java (rev 0)
+++ archetypes/branches/prototype/src/main/java/com/mycompany/Member_.java 2010-06-19 00:46:07 UTC (rev 6489)
@@ -0,0 +1,15 @@
+package com.mycompany;
+
+import javax.persistence.metamodel.SingularAttribute;
+import javax.persistence.metamodel.StaticMetamodel;
+
+(a)StaticMetamodel(Member.class)
+public abstract class Member_ {
+
+ public static volatile SingularAttribute<Member, Long> id;
+ public static volatile SingularAttribute<Member, String> phoneNumber;
+ public static volatile SingularAttribute<Member, String> email;
+ public static volatile SingularAttribute<Member, String> name;
+
+}
+
Deleted: archetypes/branches/prototype/src/main/java/com/mycompany/Widget.java
===================================================================
--- archetypes/branches/prototype/src/main/java/com/mycompany/Widget.java 2010-06-18 18:09:16 UTC (rev 6488)
+++ archetypes/branches/prototype/src/main/java/com/mycompany/Widget.java 2010-06-19 00:46:07 UTC (rev 6489)
@@ -1,64 +0,0 @@
-package com.mycompany;
-
-import java.io.Serializable;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-
-@Entity
-public class Widget implements Serializable
-{
- private Long id;
- private String partNumber;
- private String name;
- private String description;
-
- @Id
- @GeneratedValue
- public Long getId()
- {
- return id;
- }
-
- public void setId(Long id)
- {
- this.id = id;
- }
-
- // demonstrates a column name override
- @Column(name = "partno")
- public String getPartNumber()
- {
- return partNumber;
- }
-
- public void setPartNumber(String partNumber)
- {
- this.partNumber = partNumber;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public String getDescription()
- {
- return description;
- }
-
- public void setDescription(String description)
- {
- this.description = description;
- }
-
- /** Default value included to remove warning. Remove or modify at will. */
- private static final long serialVersionUID = 1L;
-}
\ No newline at end of file
Deleted: archetypes/branches/prototype/src/main/java/com/mycompany/WidgetListProducer.java
===================================================================
--- archetypes/branches/prototype/src/main/java/com/mycompany/WidgetListProducer.java 2010-06-18 18:09:16 UTC (rev 6488)
+++ archetypes/branches/prototype/src/main/java/com/mycompany/WidgetListProducer.java 2010-06-19 00:46:07 UTC (rev 6489)
@@ -1,22 +0,0 @@
-package com.mycompany;
-
-import java.util.List;
-
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.inject.Produces;
-import javax.inject.Inject;
-import javax.inject.Named;
-import javax.persistence.EntityManager;
-
-public class WidgetListProducer
-{
- @Inject @WidgetRepository EntityManager widgetRepository;
-
- @Produces
- @Named
- @RequestScoped
- @SuppressWarnings("unchecked")
- List<Widget> getWidgets() {
- return widgetRepository.createQuery("select w from Widget w order by w.name").getResultList();
- }
-}
Deleted: archetypes/branches/prototype/src/main/java/com/mycompany/WidgetRepository.java
===================================================================
--- archetypes/branches/prototype/src/main/java/com/mycompany/WidgetRepository.java 2010-06-18 18:09:16 UTC (rev 6488)
+++ archetypes/branches/prototype/src/main/java/com/mycompany/WidgetRepository.java 2010-06-19 00:46:07 UTC (rev 6489)
@@ -1,13 +0,0 @@
-package com.mycompany;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-@Qualifier
-(a)Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
-(a)Retention(RetentionPolicy.RUNTIME)
-public @interface WidgetRepository {}
Deleted: archetypes/branches/prototype/src/main/java/com/mycompany/WidgetRepositoryProducer.java
===================================================================
--- archetypes/branches/prototype/src/main/java/com/mycompany/WidgetRepositoryProducer.java 2010-06-18 18:09:16 UTC (rev 6488)
+++ archetypes/branches/prototype/src/main/java/com/mycompany/WidgetRepositoryProducer.java 2010-06-19 00:46:07 UTC (rev 6489)
@@ -1,19 +0,0 @@
-package com.mycompany;
-
-import javax.enterprise.inject.Produces;
-import javax.enterprise.inject.Disposes;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-
-public class WidgetRepositoryProducer
-{
- // NOTE cannot use producer field because Weld attempts to close EntityManager
- // https://jira.jboss.org/jira/browse/WELD-341
- @PersistenceContext EntityManager em;
-
- public @Produces @WidgetRepository EntityManager retrieveEntityManager() {
- return em;
- }
-
- public void disposeEntityManager(@Disposes @WidgetRepository EntityManager em) {}
-}
Modified: archetypes/branches/prototype/src/main/resources/META-INF/persistence.xml
===================================================================
--- archetypes/branches/prototype/src/main/resources/META-INF/persistence.xml 2010-06-18 18:09:16 UTC (rev 6488)
+++ archetypes/branches/prototype/src/main/resources/META-INF/persistence.xml 2010-06-19 00:46:07 UTC (rev 6489)
@@ -1,34 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
-<persistence version="1.0"
+<persistence version="2.0"
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">
- <persistence-unit name="widgets">
+ http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
+ <persistence-unit name="primary">
<!-- You can force a non-default JPA provider using one of these declarations -->
<!--
- <provider>org.hibernate.ejb.HibernatePersistence</provider>
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
-->
- <!-- Use this data source name for JBoss AS -->
- <jta-data-source>java:/DefaultDS</jta-data-source>
- <!-- Use this data source name for Glassfish -->
- <!--
+ <!-- jdbc/__default is the default data source in GlassFish -->
+ <!-- The same data source is added to JBoss AS by deploying the project file default-ds.xml -->
<jta-data-source>jdbc/__default</jta-data-source>
- -->
<properties>
<!-- Properties for Hibernate (default provider for JBoss AS) -->
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="false"/>
- <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
<!-- Properties for EclipseLink (default provider for GlassFish) -->
<property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
<property name="eclipselink.logging.level" value="FINE"/>
-
</properties>
</persistence-unit>
</persistence>
Modified: archetypes/branches/prototype/src/main/resources/import.sql
===================================================================
--- archetypes/branches/prototype/src/main/resources/import.sql 2010-06-18 18:09:16 UTC (rev 6488)
+++ archetypes/branches/prototype/src/main/resources/import.sql 2010-06-19 00:46:07 UTC (rev 6489)
@@ -1 +1 @@
-insert into Widget (id, partno, name, description) values (1, 'AAA001', 'Portable Hole', 'A hole for when you need to disappear fast.')
+insert into Member (name, email, phone_number) values ('John Smith', 'john(a)mailinator.com', '2125551212')
Added: archetypes/branches/prototype/src/main/resources-jbossas/default-ds.xml
===================================================================
--- archetypes/branches/prototype/src/main/resources-jbossas/default-ds.xml (rev 0)
+++ archetypes/branches/prototype/src/main/resources-jbossas/default-ds.xml 2010-06-19 00:46:07 UTC (rev 6489)
@@ -0,0 +1,15 @@
+<?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>jdbc/__default</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>
+ <min-pool-size>5</min-pool-size>
+ <max-pool-size>20</max-pool-size>
+ </local-tx-datasource>
+</datasources>
Property changes on: archetypes/branches/prototype/src/main/webapp/WEB-INF
___________________________________________________________________
Name: svn:ignore
+ sun-web.xml
Modified: archetypes/branches/prototype/src/main/webapp/home.xhtml
===================================================================
--- archetypes/branches/prototype/src/main/webapp/home.xhtml 2010-06-18 18:09:16 UTC (rev 6488)
+++ archetypes/branches/prototype/src/main/webapp/home.xhtml 2010-06-19 00:46:07 UTC (rev 6489)
@@ -5,63 +5,64 @@
xmlns:h="http://java.sun.com/jsf/html"
template="/WEB-INF/templates/default.xhtml">
<ui:define name="content">
- <h1>Hello World!</h1>
- <p>Your CDI bean <code>HelloWorld</code> says <span style="color: blue;">#{helloWorld.text}</span> using the Unified EL.</p>
+ <h1>Welcome to Java EE 6!</h1>
- <h:form id="bv">
- <h2>Bean Validation examples</h2>
+ <p>You have successfully deployed a Java EE 6 web application.</p>
+
+ <h:form id="reg">
+ <h2>Register (Bean Validation example)</h2>
<p>Enforces annotation-based constraints defined on the model class.</p>
<table>
<tr>
<th style="text-align: right;">
- <h:outputLabel for="letters" value="Letters:"/>
+ <h:outputLabel for="name" value="Name:"/>
</th>
<td>
- <h:inputText id="letters" value="#{helloWorld.letters}"/>
- <h:message for="letters" errorClass="invalid"/>
+ <h:inputText id="name" value="#{newMember.name}"/>
+ <h:message for="name" errorClass="invalid"/>
</td>
</tr>
<tr>
<th style="text-align: right;">
- <h:outputLabel for="numbers" value="Numbers:"/>
+ <h:outputLabel for="email" value="Email:"/>
</th>
<td>
- <h:inputText id="numbers" value="#{helloWorld.numbers}"/>
- <h:message for="numbers" errorClass="invalid"/>
+ <h:inputText id="email" value="#{newMember.email}"/>
+ <h:message for="email" errorClass="invalid"/>
</td>
</tr>
<tr>
<th style="text-align: right;">
- <h:outputLabel for="email" value="Email:"/>
+ <h:outputLabel for="phoneNumber" value="Phone #:"/>
</th>
<td>
- <h:inputText id="email" value="#{helloWorld.email}"/>
- <h:message for="email" errorClass="invalid"/>
+ <h:inputText id="phoneNumber" value="#{newMember.phoneNumber}"/>
+ <h:message for="phoneNumber" errorClass="invalid"/>
</td>
</tr>
</table>
<p>
- <h:commandButton id="check" action="check" value="Check values"/>
- <h:outputText value=" All clear!" rendered="#{facesContext.postback and empty facesContext.messageList}" style="color: green;"/>
+ <h:commandButton id="register" action="#{memberRegistration.register}" value="Register"/>
+ <h:outputText value=" Registered!" rendered="#{facesContext.postback and empty facesContext.messageList}" style="color: green;"/>
</p>
</h:form>
- <h2>Widgets</h2>
- <h:dataTable var="_widget" value="#{widgets}">
+ <h2>Members</h2>
+ <h:dataTable var="_member" value="#{members}">
<h:column>
<f:facet name="header">Id</f:facet>
- #{_widget.id}
+ #{_member.id}
</h:column>
<h:column>
- <f:facet name="header">Part Number</f:facet>
- #{_widget.partNumber}
+ <f:facet name="header">Name</f:facet>
+ #{_member.name}
</h:column>
<h:column>
- <f:facet name="header">Name</f:facet>
- #{_widget.name}
+ <f:facet name="header">Email</f:facet>
+ #{_member.email}
</h:column>
<h:column>
- <f:facet name="header">Description</f:facet>
- #{_widget.description}
+ <f:facet name="header">Phone #</f:facet>
+ #{_member.phoneNumber}
</h:column>
</h:dataTable>
</ui:define>
Modified: archetypes/branches/prototype/src/main/webapp/resources/css/screen.css
===================================================================
--- archetypes/branches/prototype/src/main/webapp/resources/css/screen.css 2010-06-18 18:09:16 UTC (rev 6488)
+++ archetypes/branches/prototype/src/main/webapp/resources/css/screen.css 2010-06-19 00:46:07 UTC (rev 6489)
@@ -29,6 +29,7 @@
text-align: center;
color: #666666;
font-size: 0.85em;
+ padding: 3em 0 0 0;
}
code {
font-size: 1.1em;
@@ -36,4 +37,4 @@
span.invalid {
padding-left: 3px;
color: red;
-}
\ No newline at end of file
+}
Deleted: archetypes/branches/prototype/src/test/java/com/mycompany/HelloWorldTest.java
===================================================================
--- archetypes/branches/prototype/src/test/java/com/mycompany/HelloWorldTest.java 2010-06-18 18:09:16 UTC (rev 6488)
+++ archetypes/branches/prototype/src/test/java/com/mycompany/HelloWorldTest.java 2010-06-19 00:46:07 UTC (rev 6489)
@@ -1,12 +0,0 @@
-package com.mycompany;
-
-import org.testng.annotations.Test;
-
-public class HelloWorldTest
-{
- @Test
- public void testGetText() {
- HelloWorld fixture = new HelloWorld();
- assert "Hello World!".equals(fixture.getText());
- }
-}
Added: archetypes/branches/prototype/src/test/java/com/mycompany/MemberRegistrationTest.java
===================================================================
--- archetypes/branches/prototype/src/test/java/com/mycompany/MemberRegistrationTest.java (rev 0)
+++ archetypes/branches/prototype/src/test/java/com/mycompany/MemberRegistrationTest.java 2010-06-19 00:46:07 UTC (rev 6489)
@@ -0,0 +1,38 @@
+package com.mycompany;
+
+import static org.junit.Assert.*;
+import javax.inject.Inject;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class MemberRegistrationTest
+{
+ @Deployment
+ public static Archive<?> createTestArchive() {
+ return ShrinkWrap.create("test.war", WebArchive.class)
+ .addClasses(Member.class, MemberRegistration.class, MemberRepository.class, MemberRepositoryProducer.class)
+ .addWebResource("test-persistence.xml", "classes/META-INF/persistence.xml")
+ .addWebResource(new ByteArrayAsset(new byte[0]), "beans.xml");
+ }
+
+ @Inject MemberRegistration memberRegistration;
+
+ @Test
+ public void testRegister() throws Exception
+ {
+ Member newMember = memberRegistration.getNewMember();
+ newMember.setName("Jane Doe");
+ newMember.setEmail("jane(a)mailinator.com");
+ newMember.setPhoneNumber("2125551234");
+ memberRegistration.register();
+ assertNotNull(newMember.getId());
+ System.out.println(newMember.getName() + " was persisted with id " + newMember.getId());
+ }
+}
Added: archetypes/branches/prototype/src/test/resources/arquillian.xml
===================================================================
--- archetypes/branches/prototype/src/test/resources/arquillian.xml (rev 0)
+++ archetypes/branches/prototype/src/test/resources/arquillian.xml 2010-06-19 00:46:07 UTC (rev 6489)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<arquillian xmlns="http://jboss.com/arquillian"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:jbasmanaged="urn:arq:org.jboss.arquillian.jbossas.local60"
+ xmlns:gfembed="urn:arq:org.jboss.arquillian.glassfish.embedded30"
+ xmlns:gfremote="urn:arq:org.jboss.arquillian.container.glassfish.remote30">
+
+ <!-- Uncomment to have test archives exported to the file system for inspection -->
+ <!--
+ <engine>
+ <deploymentExportPath>/tmp/</deploymentExportPath>
+ </engine>
+ -->
+
+ <jbasmanaged:container>
+ <jbasmanaged:jbossHome>/home/dallen/opt/jboss-as-tests</jbasmanaged:jbossHome>
+ </jbasmanaged:container>
+
+ <gfembed:container>
+ <gfembed:bindHttpPort>7070</gfembed:bindHttpPort>
+ <gfembed:sunResourcesXml>src/test/resources-glassfish-embedded/sun-resources.xml</gfembed:sunResourcesXml>
+ </gfembed:container>
+
+ <gfremote:container>
+ <gfremote:remoteServerHttpPort>7070</gfremote:remoteServerHttpPort>
+ </gfremote:container>
+
+</arquillian>
Added: archetypes/branches/prototype/src/test/resources-glassfish-embedded/sun-resources.xml
===================================================================
--- archetypes/branches/prototype/src/test/resources-glassfish-embedded/sun-resources.xml (rev 0)
+++ archetypes/branches/prototype/src/test/resources-glassfish-embedded/sun-resources.xml 2010-06-19 00:46:07 UTC (rev 6489)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE resources PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Resource Definitions //EN"
+ "http://www.sun.com/software/appserver/dtds/sun-resources_1_4.dtd">
+<resources>
+ <jdbc-resource pool-name="ArquillianEmbeddedDerbyPool"
+ jndi-name="jdbc/arquillian"/>
+ <jdbc-connection-pool name="ArquillianEmbeddedDerbyPool"
+ res-type="javax.sql.DataSource"
+ datasource-classname="org.apache.derby.jdbc.EmbeddedDataSource"
+ is-isolation-level-guaranteed="false">
+ <property name="databaseName" value="target/databases/derby"/>
+ <property name="createDatabase" value="create"/>
+ </jdbc-connection-pool>
+</resources>
Added: archetypes/branches/prototype/src/test/resources-glassfish-embedded/test-persistence.xml
===================================================================
--- archetypes/branches/prototype/src/test/resources-glassfish-embedded/test-persistence.xml (rev 0)
+++ archetypes/branches/prototype/src/test/resources-glassfish-embedded/test-persistence.xml 2010-06-19 00:46:07 UTC (rev 6489)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence version="2.0"
+ 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_2_0.xsd">
+ <persistence-unit name="primary">
+ <jta-data-source>jdbc/arquillian</jta-data-source>
+ <properties>
+ <!-- Properties for EclipseLink (default provider for GlassFish) -->
+ <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
+ <property name="eclipselink.logging.level" value="FINE"/>
+ </properties>
+ </persistence-unit>
+</persistence>
Added: archetypes/branches/prototype/src/test/resources-jbossas/jndi.properties
===================================================================
--- archetypes/branches/prototype/src/test/resources-jbossas/jndi.properties (rev 0)
+++ archetypes/branches/prototype/src/test/resources-jbossas/jndi.properties 2010-06-19 00:46:07 UTC (rev 6489)
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
+java.naming.provider.url=jnp://localhost:1099
Added: archetypes/branches/prototype/src/test/resources-jbossas/test-persistence.xml
===================================================================
--- archetypes/branches/prototype/src/test/resources-jbossas/test-persistence.xml (rev 0)
+++ archetypes/branches/prototype/src/test/resources-jbossas/test-persistence.xml 2010-06-19 00:46:07 UTC (rev 6489)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence version="2.0"
+ 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_2_0.xsd">
+ <persistence-unit name="primary">
+ <jta-data-source>java:/DefaultDS</jta-data-source>
+ <properties>
+ <!-- Properties for Hibernate (default provider for JBoss AS) -->
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+ <property name="hibernate.show_sql" value="true"/>
+ <property name="hibernate.format_sql" value="false"/>
+ </properties>
+ </persistence-unit>
+</persistence>
14 years, 7 months
Weld SVN: r6488 - archetypes/trunk/jsf/jee/src/main/resources/archetype-resources.
by weld-commits@lists.jboss.org
Author: sboscarine
Date: 2010-06-18 14:09:16 -0400 (Fri, 18 Jun 2010)
New Revision: 6488
Modified:
archetypes/trunk/jsf/jee/src/main/resources/archetype-resources/pom.xml
Log:
updated spec POM
Modified: archetypes/trunk/jsf/jee/src/main/resources/archetype-resources/pom.xml
===================================================================
--- archetypes/trunk/jsf/jee/src/main/resources/archetype-resources/pom.xml 2010-06-18 16:10:41 UTC (rev 6487)
+++ archetypes/trunk/jsf/jee/src/main/resources/archetype-resources/pom.xml 2010-06-18 18:09:16 UTC (rev 6488)
@@ -1,10 +1,10 @@
+
## Custom Velocity declaration to allow us to escape Maven variable placeholders
## Prevents archetype warnings about unrecognized variables
-#set( $expr_start = '${' )
+#set($expr_start = '${' )
#set( $expr_end = '}' )
<?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">
+<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>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
@@ -13,32 +13,26 @@
<version>${version}</version>
<properties>
- <!--
- Explicitly declaring the source encoding eliminates the following message: [WARNING] Using platform encoding
- (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
- -->
+ <!-- Explicitly declaring the source encoding eliminates the following message: -->
+ <!-- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <!--
- Timestamp format for the maven.build.timestamp property; you can reference property in pom.xml or filtered
- resources (must enable third-party plugin if using Maven < 2.1)
- -->
+ <!--Timestamp format for the maven.build.timestamp property; -->
+ <!--you can reference property in pom.xml or filtered resources (must enable third-party plugin if using Maven < 2.1)-->
<maven.build.timestamp.format>yyyyMMdd'T'HHmmss</maven.build.timestamp.format>
- <!--
- To set the jboss.home environment variable the Maven way, set the jboss.home property in an active profile in
- the Maven 2 settings.xml file
- -->
+ <!-- To set the jboss.home environment variable the Maven way, set the jboss.home property in an active profile in the Maven 2 settings.xml file -->
<jboss.home>${expr_start}env.JBOSS_HOME${expr_end}</jboss.home>
<jboss.domain>default</jboss.domain>
</properties>
<repositories>
- <!-- Optional Repository. -->
- <!-- Soon all required dependencies will be pushed to maven central. -->
- <!-- In the mean time, we need to point this archetype to the JBoss Maven Repository -->
+ <!-- Optional Repository. -->
+ <!-- Soon all required dependencies will be pushed to maven central. -->
+ <!-- In the mean time, we need to point this archetype to the JBoss Maven Repository -->
<repository>
<id>jboss-public-repository</id>
<name>JBoss Repository</name>
<url>https://repository.jboss.org/nexus/content/groups/public</url>
+ <!-- These optional flags are designed to speed up your builds by reducing remote server calls. -->
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
@@ -58,15 +52,18 @@
</pluginRepository>
</pluginRepositories>
<dependencies>
+ <!-- Java EE Specification POM -->
+ <!-- This one dependency imports all APIs available for a Java EE 6.0 application. -->
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.Beta5</version>
<scope>provided</scope>
<type>pom</type>
</dependency>
+
<!-- Bean Validation Implementation -->
- <!-- Provides portable constraints such as @NotEmpty, @Email and @Url -->
+ <!-- This is an optional jar that provides portable constraints such as @NotEmpty, @Email and @Url -->
<!-- Hibernate Validator is the only JSR-303 implementation at the moment, so we can assume it's provided -->
<dependency>
<groupId>org.hibernate</groupId>
@@ -74,7 +71,6 @@
<version>4.0.0.GA</version>
<scope>provided</scope>
</dependency>
-
<!-- Optional, but highly recommended. -->
<dependency>
<groupId>org.testng</groupId>
@@ -97,7 +93,7 @@
</configuration>
</plugin>
- <!-- Eclipse plugin can force download of source and JavaDoc jars -->
+ <!-- Optional eclipse plugin can force download of source and JavaDoc jars -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
@@ -107,7 +103,8 @@
</configuration>
</plugin>
- <!-- Configure the JBoss AS Maven deploy plugin -->
+ <!-- Optional JBoss deployer plugin will deploy your war to a local JBoss AS container if you've declared $JBOSS_HOME in your OS. -->
+ <!-- To use, declare $JBOSS_HOME and run 'mvn package jboss:hard-deploy' -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jboss-maven-plugin</artifactId>
14 years, 7 months
Weld SVN: r6487 - in examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode: session and 1 other directory.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-18 12:10:41 -0400 (Fri, 18 Jun 2010)
New Revision: 6487
Added:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentLogger.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentPrinter.java
Removed:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/EEProducers.java
Modified:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeFragment.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/DatabasePopulater.java
Log:
add events and timer
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeFragment.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeFragment.java 2010-06-18 13:27:09 UTC (rev 6486)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeFragment.java 2010-06-18 16:10:41 UTC (rev 6487)
@@ -184,4 +184,10 @@
{
this.user = user;
}
+
+ @Override
+ public String toString()
+ {
+ return "At " + getFriendlyDate() + " by " + getUser();
+ }
}
\ No newline at end of file
Added: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentLogger.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentLogger.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentLogger.java 2010-06-18 16:10:41 UTC (rev 6487)
@@ -0,0 +1,45 @@
+package org.jboss.weld.examples.pastecode.session;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.ejb.Lock;
+import javax.ejb.LockType;
+import javax.ejb.Singleton;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+
+import org.jboss.weld.examples.pastecode.model.CodeFragment;
+
+@ApplicationScoped
+//@Singleton
+public class CodeFragmentLogger
+{
+
+ private final List<CodeFragment> log;
+
+ public CodeFragmentLogger()
+ {
+ this.log = new ArrayList<CodeFragment>();
+ }
+
+ //(a)Lock(LockType.READ)
+ public List<CodeFragment> getLog()
+ {
+ return Collections.unmodifiableList(log);
+ }
+
+ //(a)Lock(LockType.WRITE)
+ public void clearLog()
+ {
+ this.log.clear();
+ }
+
+ //(a)Lock(LockType.WRITE)
+ public void addEntry(@Observes CodeFragment codeFragment)
+ {
+ this.log.add(codeFragment);
+ }
+
+}
Property changes on: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentLogger.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java 2010-06-18 13:27:09 UTC (rev 6486)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java 2010-06-18 16:10:41 UTC (rev 6487)
@@ -29,6 +29,7 @@
import java.util.logging.Logger;
import javax.ejb.Stateful;
+import javax.enterprise.event.Event;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
import javax.inject.Named;
@@ -55,6 +56,9 @@
@Inject
private Logger log;
+
+ @Inject
+ private Event<CodeFragment> event;
@PersistenceContext
private EntityManager entityManager;
@@ -83,7 +87,7 @@
String hashValue = hashComputer.getHashValue(code);
code.setHash(hashValue);
entityManager.persist(code);
- log.info("Added private pastecode: " + hashValue);
+ event.fire(code);
return hashValue;
}
catch (NoSuchAlgorithmException e)
@@ -96,9 +100,9 @@
else
{
entityManager.persist(code);
+ event.fire(code);
// Make sure we have the latest version (with the generated id!)
entityManager.refresh(code);
- log.info("Added pastecode: " + code.getId());
return new Integer(code.getId()).toString();
}
}
Added: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentPrinter.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentPrinter.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentPrinter.java 2010-06-18 16:10:41 UTC (rev 6487)
@@ -0,0 +1,52 @@
+package org.jboss.weld.examples.pastecode.session;
+
+import java.util.logging.Logger;
+
+import javax.annotation.Resource;
+import javax.ejb.Stateless;
+import javax.ejb.Timeout;
+import javax.ejb.TimerService;
+import javax.inject.Inject;
+
+import org.jboss.weld.examples.pastecode.model.CodeFragment;
+
+@Stateless
+public class CodeFragmentPrinter
+{
+
+ private static final int ONE_MINUTE = 60 * 1000;
+
+ @Resource
+ private TimerService timerService;
+
+ @Inject
+ private CodeFragmentLogger logger;
+
+ @Inject
+ private Logger log;
+
+ public void startTimer()
+ {
+ timerService.createTimer(ONE_MINUTE, ONE_MINUTE, null);
+ }
+
+ @Timeout
+ public void print()
+ {
+ if (logger.getLog().size() > 0)
+ {
+ log.info("These code fragments pasted in the last minute: ");
+ for (CodeFragment fragment : logger.getLog())
+ {
+ log.info(fragment.toString());
+ }
+ log.info("-----------------------------------------------------");
+ logger.clearLog();
+ }
+ else
+ {
+ log.info("No fragments pasted in the last minute");
+ }
+ }
+
+}
Property changes on: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentPrinter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/DatabasePopulater.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/DatabasePopulater.java 2010-06-18 13:27:09 UTC (rev 6486)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/DatabasePopulater.java 2010-06-18 16:10:41 UTC (rev 6487)
@@ -57,6 +57,9 @@
@Inject
private CodeFragmentManager codeFragmentManager;
+ @Inject
+ private CodeFragmentPrinter codeFragmentPrinter;
+
private boolean populated;
// TODO @PostConstruct
@@ -67,6 +70,9 @@
return;
}
+ // Start the timer for the logger :-)
+ codeFragmentPrinter.startTimer();
+
try
{
String fileContent = readFileData(DATA_FILE_NAME);
@@ -92,7 +98,7 @@
}
catch (Exception e)
{
- log.log(Level.WARNING, "Unable to read all records from " + DATA_FILE_NAME + " file");
+ log.log(Level.WARNING, "Unable to read all records from " + DATA_FILE_NAME + " file", e);
}
log.info("Successfully imported data!");
Deleted: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/EEProducers.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/EEProducers.java 2010-06-18 13:27:09 UTC (rev 6486)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/EEProducers.java 2010-06-18 16:10:41 UTC (rev 6487)
@@ -1,15 +0,0 @@
-package org.jboss.weld.examples.pastecode.session;
-
-import javax.enterprise.inject.Produces;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-
-public class EEProducers
-{
-
- @SuppressWarnings("unused")
- @PersistenceContext(unitName = "pastecodeDatabase")
- @Produces
- private EntityManager em;
-
-}
14 years, 7 months
Weld SVN: r6486 - in examples/trunk/jsf/pastecode/src/main: webapp/WEB-INF and 1 other directory.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-18 09:27:09 -0400 (Fri, 18 Jun 2010)
New Revision: 6486
Modified:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/jsf/LanguageConverter.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/jsf/TruncatingConverter.java
examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/faces-config.xml
Log:
use jsf 2 :-)
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/jsf/LanguageConverter.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/jsf/LanguageConverter.java 2010-06-18 13:26:25 UTC (rev 6485)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/jsf/LanguageConverter.java 2010-06-18 13:27:09 UTC (rev 6486)
@@ -1,9 +1,11 @@
package org.jboss.weld.examples.pastecode.jsf;
import javax.faces.convert.EnumConverter;
+import javax.faces.convert.FacesConverter;
import org.jboss.weld.examples.pastecode.model.Language;
+(a)FacesConverter(forClass=Language.class)
public class LanguageConverter extends EnumConverter
{
public LanguageConverter()
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/jsf/TruncatingConverter.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/jsf/TruncatingConverter.java 2010-06-18 13:26:25 UTC (rev 6485)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/jsf/TruncatingConverter.java 2010-06-18 13:27:09 UTC (rev 6486)
@@ -3,7 +3,9 @@
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
+import javax.faces.convert.FacesConverter;
+@FacesConverter("truncatingConverter")
public class TruncatingConverter implements Converter
{
Modified: examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/faces-config.xml 2010-06-18 13:26:25 UTC (rev 6485)
+++ examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/faces-config.xml 2010-06-18 13:27:09 UTC (rev 6486)
@@ -21,15 +21,5 @@
<to-view-id>/history.xhtml?page=#{history.page}</to-view-id>
</navigation-case>
</navigation-rule>
-
- <converter>
- <converter-for-class>org.jboss.weld.examples.pastecode.model.Language</converter-for-class>
- <converter-class>org.jboss.weld.examples.pastecode.jsf.LanguageConverter</converter-class>
- </converter>
-
- <converter>
- <converter-id>truncatingConverter</converter-id>
- <converter-class>org.jboss.weld.examples.pastecode.jsf.TruncatingConverter</converter-class>
- </converter>
</faces-config>
14 years, 7 months
Weld SVN: r6485 - in examples/trunk/jsf/pastecode/src/main: webapp and 1 other directory.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-18 09:26:25 -0400 (Fri, 18 Jun 2010)
New Revision: 6485
Modified:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/History.java
examples/trunk/jsf/pastecode/src/main/webapp/history.xhtml
Log:
rename method
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/History.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/History.java 2010-06-18 13:24:29 UTC (rev 6484)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/History.java 2010-06-18 13:26:25 UTC (rev 6485)
@@ -78,7 +78,7 @@
}
// Do the search, called as a "page action"
- public String search()
+ public String load()
{
this.paginator = new Paginator();
this.codes = null;
Modified: examples/trunk/jsf/pastecode/src/main/webapp/history.xhtml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/history.xhtml 2010-06-18 13:24:29 UTC (rev 6484)
+++ examples/trunk/jsf/pastecode/src/main/webapp/history.xhtml 2010-06-18 13:26:25 UTC (rev 6485)
@@ -9,7 +9,7 @@
<ui:define name="viewMetadata">
<f:metadata>
<f:viewParam name="page" value="#{history.page}" />
- <f:event type="preRenderView" listener="#{history.search}" />
+ <f:event type="preRenderView" listener="#{history.load}" />
</f:metadata>
</ui:define>
14 years, 7 months
Weld SVN: r6484 - examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-18 09:24:29 -0400 (Fri, 18 Jun 2010)
New Revision: 6484
Modified:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/FloodingDecorator.java
Log:
fix search
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java 2010-06-18 11:35:05 UTC (rev 6483)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java 2010-06-18 13:24:29 UTC (rev 6484)
@@ -28,7 +28,7 @@
import java.util.List;
import java.util.logging.Logger;
-import javax.ejb.Stateless;
+import javax.ejb.Stateful;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
import javax.inject.Named;
@@ -43,7 +43,7 @@
import org.jboss.weld.examples.pastecode.model.CodeFragment;
import org.jboss.weld.examples.pastecode.model.CodeFragment_;
-@Stateless
+@Stateful
public class CodeFragmentManagerImpl implements CodeFragmentManager
{
@@ -194,7 +194,7 @@
}
if (!isEmpty(codeFragment.getText()))
{
- predicates.add( builder.like(root.get(CodeFragment_.text), codeFragment.getText().toLowerCase()) );
+ predicates.add( builder.like(root.get(CodeFragment_.text), "%" + codeFragment.getText().toLowerCase().trim() + "%") );
}
if (codeFragment.getDatetime() != null)
{
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/FloodingDecorator.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/FloodingDecorator.java 2010-06-18 11:35:05 UTC (rev 6483)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/FloodingDecorator.java 2010-06-18 13:24:29 UTC (rev 6484)
@@ -21,6 +21,8 @@
*/
package org.jboss.weld.examples.pastecode.session;
+import java.io.Serializable;
+
import javax.decorator.Decorator;
import javax.decorator.Delegate;
import javax.inject.Inject;
@@ -28,8 +30,11 @@
import org.jboss.weld.examples.pastecode.model.CodeFragment;
@Decorator
-public abstract class FloodingDecorator implements CodeFragmentManager
+public abstract class FloodingDecorator implements CodeFragmentManager, Serializable
{
+
+ private static final long serialVersionUID = -4615837206290420112L;
+
@Inject @Delegate
private CodeFragmentManager codeFragmentManager;
14 years, 7 months