Weld SVN: r6563 - in archetypes: trunk and 1 other directory.
by weld-commits@lists.jboss.org
Author: dan.j.allen
Date: 2010-06-20 01:37:15 -0400 (Sun, 20 Jun 2010)
New Revision: 6563
Added:
archetypes/trunk/javaee6-webapp-src/
Removed:
archetypes/branches/prototype/
Log:
move prototype to trunk
Copied: archetypes/trunk/javaee6-webapp-src (from rev 6559, archetypes/branches/prototype)
14 years, 4 months
Weld SVN: r6562 - archetypes.
by weld-commits@lists.jboss.org
Author: dan.j.allen
Date: 2010-06-20 01:35:54 -0400 (Sun, 20 Jun 2010)
New Revision: 6562
Added:
archetypes/trunk/
Log:
add trunk again
14 years, 4 months
Weld SVN: r6561 - in archetypes: branches and 1 other directory.
by weld-commits@lists.jboss.org
Author: dan.j.allen
Date: 2010-06-20 01:35:35 -0400 (Sun, 20 Jun 2010)
New Revision: 6561
Added:
archetypes/branches/Branch_1_0_0_BETA/
Removed:
archetypes/trunk/
Log:
migrate trunk to branch
Copied: archetypes/branches/Branch_1_0_0_BETA (from rev 6559, archetypes/trunk)
14 years, 4 months
Weld SVN: r6560 - archetypes/tags.
by weld-commits@lists.jboss.org
Author: dan.j.allen
Date: 2010-06-20 01:27:19 -0400 (Sun, 20 Jun 2010)
New Revision: 6560
Added:
archetypes/tags/1.0.0-BETA/
Removed:
archetypes/tags/weld-archetype-parent-1.0.0-BETA/
Log:
rename
Copied: archetypes/tags/1.0.0-BETA (from rev 6559, archetypes/tags/weld-archetype-parent-1.0.0-BETA)
14 years, 4 months
Weld SVN: r6559 - archetypes/branches/prototype.
by weld-commits@lists.jboss.org
Author: dan.j.allen
Date: 2010-06-20 01:11:53 -0400 (Sun, 20 Jun 2010)
New Revision: 6559
Modified:
archetypes/branches/prototype/build.sh
archetypes/branches/prototype/pom.xml
archetypes/branches/prototype/readme.txt
Log:
cleanups
Modified: archetypes/branches/prototype/build.sh
===================================================================
--- archetypes/branches/prototype/build.sh 2010-06-19 18:05:06 UTC (rev 6558)
+++ archetypes/branches/prototype/build.sh 2010-06-20 05:11:53 UTC (rev 6559)
@@ -6,17 +6,15 @@
echo Generating archetype from project into $ARCHETYPE_BUILD_DIR...
rm -Rf $ARCHETYPE_DIR/target
-svn rm --force $ARCHETYPE_DIR/src
+svn rm --force $ARCHETYPE_DIR/*
rm -Rf target/generated-*
mvn archetype:create-from-project -Darchetype.properties=archetype.properties
echo Relocating generated archetype project to $ARCHETYPE_DIR...
rsync -az --exclude `basename $0` --exclude archetype-pom.xml $ARCHETYPE_BUILD_DIR/src $ARCHETYPE_DIR/
-svn revert -R $ARCHETYPE_DIR/src
+svn revert -R $ARCHETYPE_DIR
cp -f archetype-pom.xml $ARCHETYPE_DIR/pom.xml
mvn -f $ARCHETYPE_DIR/pom.xml clean
echo Patching generated archetype...
-#rm -f $ARCHETYPE_RESOURCES_DIR/`basename $0`
-#rm -f $ARCHETYPE_RESOURCES_DIR/archetype-pom.xml
# could also use col -b
sed -i 's;
;;' $ARCHETYPE_RESOURCES_DIR/pom.xml
Modified: archetypes/branches/prototype/pom.xml
===================================================================
--- archetypes/branches/prototype/pom.xml 2010-06-19 18:05:06 UTC (rev 6558)
+++ archetypes/branches/prototype/pom.xml 2010-06-20 05:11:53 UTC (rev 6559)
@@ -4,12 +4,12 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.weld.archetypes</groupId>
- <artifactId>weld-basic-javaee6-webapp-src</artifactId>
+ <artifactId>jboss-javaee6-webapp-src</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
- <name>weld-basic-javaee6-webapp-src</name>
- <description>A basic Java EE 6 webapp project generated from the weld-basic-javaee6-webapp archetype</description>
+ <name>jboss-javaee6-webapp-src</name>
+ <description>A basic Java EE 6 webapp project generated from the jboss-javaee6-webapp archetype</description>
<properties>
<!--
@@ -29,9 +29,7 @@
<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>
@@ -233,7 +231,7 @@
<dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-client</artifactId>
- <version>${jboss-as-client.version}</version>
+ <version>6.0.0.20100429-M3</version>
<type>pom</type>
<scope>test</scope>
</dependency>
Modified: archetypes/branches/prototype/readme.txt
===================================================================
--- archetypes/branches/prototype/readme.txt 2010-06-19 18:05:06 UTC (rev 6558)
+++ archetypes/branches/prototype/readme.txt 2010-06-20 05:11:53 UTC (rev 6559)
@@ -1,7 +1,7 @@
- weld-basic-javaee6-webapp-src
+ jboss-javaee6-webapp-src
- Source archetype: weld-basic-javaee6-webapp
+ Source archetype: jboss-javaee6-webapp
What is it?
===========
@@ -61,7 +61,7 @@
mvn package jboss:hard-deploy
- This will deploy two artifacts, target/weld-basic-javaee6-webapp-src.war and
+ This will deploy two artifacts, target/jboss-javaee6-webapp-src.war and
default-ds.xml. The latter installs a data source named jdbc/__default.
You can also set jboss.home on the commandline:
@@ -70,7 +70,7 @@
Start JBoss AS. The application will be running at the following URL:
- http://localhost:8080/weld-basic-javaee6-webapp-src/home.jsf
+ http://localhost:8080/jboss-javaee6-webapp-src/home.jsf
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
@@ -95,15 +95,11 @@
asadmin start-database
asadmin start-domain domain1
- Now you can either deploy the target/weld-basic-javaee6-webapp-src.war through the web-based
+ Now you can either deploy the target/jboss-javaee6-webapp-src.war through the web-based
GlassFish admininstration console, or you can again use asadmin:
- asadmin /path/to/project/target/weld-basic-javaee6-webapp-src.war
+ asadmin /path/to/project/target/jboss-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
- run the application in place (like you can in a jee-minimal project).
-
Importing the project into an IDE
=================================
@@ -125,7 +121,7 @@
your project directory. m2eclipse should take it from there.
Once in the IDE, you can execute the Maven commands through the IDE controls
- to run the application on an embedded Servlet Container.
+ to deploy the application to a container.
Downloading the sources and Javadocs
====================================
14 years, 4 months
Weld SVN: r6558 - in examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode: model and 2 other directories.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-19 14:05:06 -0400 (Sat, 19 Jun 2010)
New Revision: 6558
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/java/org/jboss/weld/examples/pastecode/model/CodeFragment.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/servlets/DownloadServlet.java
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/CodeFragmentManager.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/CodeFragmentPrinterImpl.java
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/HashComputer.java
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/LanguageManager.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/LogManager.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Paginator.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PasteWindow.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PopulateDatabase.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PostTracker.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Theme.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/ThemeManager.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/TimerStartup.java
Log:
javadoc
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-19 17:49:48 UTC (rev 6557)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/jsf/LanguageConverter.java 2010-06-19 18:05:06 UTC (rev 6558)
@@ -5,6 +5,12 @@
import org.jboss.weld.examples.pastecode.model.Language;
+/**
+ * JSF converter responsible for converting the {@link Language} enum to and from Strings
+ *
+ * @author Pete Muir
+ *
+ */
@FacesConverter(forClass=Language.class)
public class LanguageConverter extends EnumConverter
{
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-19 17:49:48 UTC (rev 6557)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/jsf/TruncatingConverter.java 2010-06-19 18:05:06 UTC (rev 6558)
@@ -5,6 +5,12 @@
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;
+/**
+ * JSF converter responsible for truncating output strings to {@value #TRIMMED_TEXT_LEN} length.
+ *
+ * @author Pete Muir
+ *
+ */
@FacesConverter("truncatingConverter")
public class TruncatingConverter implements Converter
{
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-19 17:49:48 UTC (rev 6557)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeFragment.java 2010-06-19 18:05:06 UTC (rev 6558)
@@ -40,6 +40,9 @@
/**
* The entity class for the pasted code "fragment". This is the main entity
* class in the application.
+ *
+ * @author Martin Gencur
+ * @author Pete Muir
*/
@Entity
public class CodeFragment
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/servlets/DownloadServlet.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/servlets/DownloadServlet.java 2010-06-19 17:49:48 UTC (rev 6557)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/servlets/DownloadServlet.java 2010-06-19 18:05:06 UTC (rev 6558)
@@ -36,6 +36,12 @@
import org.jboss.weld.examples.pastecode.model.CodeFragment;
import org.jboss.weld.examples.pastecode.session.CodeFragmentManager;
+/**
+ * Servlet that offers the code fragment for download as a file
+ *
+ * @author Martin Gencur
+ *
+ */
@WebServlet("/download")
public class DownloadServlet extends HttpServlet
{
Modified: 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 2010-06-19 17:49:48 UTC (rev 6557)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentLogger.java 2010-06-19 18:05:06 UTC (rev 6558)
@@ -12,11 +12,19 @@
import org.jboss.weld.examples.pastecode.model.CodeFragment;
+/**
+ * Holds a log of code fragments added by all users
+ *
+ * Threadsafe.
+ *
+ * @author Pete Muir
+ *
+ */
@ApplicationScoped
@Singleton
public class CodeFragmentLogger
{
-
+
private final List<CodeFragment> log;
public CodeFragmentLogger()
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManager.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManager.java 2010-06-19 17:49:48 UTC (rev 6557)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManager.java 2010-06-19 18:05:06 UTC (rev 6558)
@@ -27,14 +27,40 @@
import org.jboss.weld.examples.pastecode.model.CodeFragment;
+/**
+ * Retrieval and addition of code fragments
+ *
+ * @author Pete Muir
+ * @author Martin Gencur
+ *
+ */
@Local
public interface CodeFragmentManager
{
+ /**
+ * The number of code fragments to return in our recentCodeFragments query
+ */
+ public static final int MAX_RECENT_FRAGMENTS = 7;
+
+ /**
+ * Add the code fragment, computing a hash for it's id if it is private,
+ * otherwise, using a sequential id
+ *
+ */
public String addCodeFragment(CodeFragment code, boolean privateFragment);
+ /**
+ * Retrieve a code fragment, using it's id
+ */
public CodeFragment getCodeFragment(String id);
+ /**
+ * Get the {@value #MAX_RECENT_FRAGMENTS} most recent fragments
+ */
public List<CodeFragment> getRecentCodeFragments();
+ /**
+ * Find code fragments by example. Supports paging.
+ */
public List<CodeFragment> searchCodeFragments(CodeFragment code, int page, Paginator info);
}
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-19 17:49:48 UTC (rev 6557)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java 2010-06-19 18:05:06 UTC (rev 6558)
@@ -43,13 +43,17 @@
import org.jboss.weld.examples.pastecode.model.CodeFragment;
import org.jboss.weld.examples.pastecode.model.CodeFragment_;
+/**
+ * Implementation of {@link CodeFragmentManager}
+ *
+ * @author Pete Muir
+ * @author Martin Gencur
+ *
+ */
@Stateful
public class CodeFragmentManagerImpl implements CodeFragmentManager
{
- // The number of code fragments to return in our recentCodeFragments query
- private static int MAX_RECENT_FRAGMENTS = 7;
-
// The number of code fragments to display per page
private static int PAGE_SIZE = 2;
@@ -174,7 +178,7 @@
public List<CodeFragment> searchCodeFragments(CodeFragment codeFragment, int page, Paginator paginator)
{
-
+ // Create a criteria, which we then populate using our prototype code fragment
CriteriaBuilder builder = entityManager.getCriteriaBuilder();
CriteriaQuery<CodeFragment> criteria = builder.createQuery(CodeFragment.class);
@@ -182,6 +186,7 @@
List<Predicate> predicates = new ArrayList<Predicate>();
+ // Only search public code fragements
predicates.add(builder.isNull(root.get(CodeFragment_.hash)));
if (!isEmpty(codeFragment.getUser()))
@@ -207,6 +212,8 @@
int totalRecords = q.getResultList().size();
+
+ // Compute the page
q.setFirstResult(page * PAGE_SIZE);
q.setMaxResults(PAGE_SIZE);
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentPrinterImpl.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentPrinterImpl.java 2010-06-19 17:49:48 UTC (rev 6557)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentPrinterImpl.java 2010-06-19 18:05:06 UTC (rev 6558)
@@ -26,9 +26,6 @@
@Inject
private Logger log;
- /* (non-Javadoc)
- * @see org.jboss.weld.examples.pastecode.session.CodeFragmentPrinter#startTimer()
- */
public void startTimer()
{
timerService.createTimer(ONE_MINUTE, ONE_MINUTE, null);
@@ -37,6 +34,7 @@
@Timeout
public void print()
{
+ // Print the code fragments retrieved in the last minute to the log
if (logger.getLog().size() > 0)
{
log.info("These code fragments pasted in the last minute: ");
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-19 17:49:48 UTC (rev 6557)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/FloodingDecorator.java 2010-06-19 18:05:06 UTC (rev 6558)
@@ -29,6 +29,12 @@
import org.jboss.weld.examples.pastecode.model.CodeFragment;
+/**
+ * Prohibit posting more than 2 fragments a minute
+ *
+ * @author Pete Muir
+ *
+ */
@Decorator
public abstract class FloodingDecorator implements CodeFragmentManager, Serializable
{
@@ -43,6 +49,7 @@
public String addCodeFragment(CodeFragment code, boolean privateFragment)
{
+ // Check if we are allowed to post
if (postTracker.isNewPostAllowed())
{
postTracker.addPost();
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/HashComputer.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/HashComputer.java 2010-06-19 17:49:48 UTC (rev 6557)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/HashComputer.java 2010-06-19 18:05:06 UTC (rev 6558)
@@ -28,6 +28,13 @@
import org.jboss.weld.examples.pastecode.model.CodeFragment;
+/**
+ * Compute the hash for a {@link CodeFragment}
+ *
+ * @author Martin Gencur
+ * @author Pete Muir
+ *
+ */
@Stateless
public class HashComputer
{
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-19 17:49:48 UTC (rev 6557)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/History.java 2010-06-19 18:05:06 UTC (rev 6558)
@@ -24,7 +24,6 @@
import java.io.Serializable;
import java.util.List;
-import javax.ejb.Stateful;
import javax.enterprise.context.SessionScoped;
import javax.inject.Inject;
import javax.inject.Named;
@@ -32,12 +31,13 @@
import org.jboss.weld.examples.pastecode.model.CodeFragment;
/**
- * Session Bean implementation class HistoryBean
+ * The view controller for the history screen
+ *
+ * @author Martin Gencur
+ * @author Pete Muir
*/
-
@SessionScoped
@Named("history")
-@Stateful
public class History implements Serializable
{
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/LanguageManager.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/LanguageManager.java 2010-06-19 17:49:48 UTC (rev 6557)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/LanguageManager.java 2010-06-19 18:05:06 UTC (rev 6558)
@@ -26,6 +26,12 @@
import org.jboss.weld.examples.pastecode.model.Language;
+/**
+ * Produces an array of supported languages
+ *
+ * @author Pete Muir
+ *
+ */
public class LanguageManager
{
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/LogManager.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/LogManager.java 2010-06-19 17:49:48 UTC (rev 6557)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/LogManager.java 2010-06-19 18:05:06 UTC (rev 6558)
@@ -5,9 +5,16 @@
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.InjectionPoint;
+/**
+ * Support for injecting a JDK logger. Uses the class name of the injecting
+ * class as the category.
+ *
+ * @author Pete Muir
+ *
+ */
public class LogManager
{
-
+
@Produces
public Logger getLogger(InjectionPoint ip)
{
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Paginator.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Paginator.java 2010-06-19 17:49:48 UTC (rev 6557)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Paginator.java 2010-06-19 18:05:06 UTC (rev 6558)
@@ -24,6 +24,12 @@
import java.util.ArrayList;
import java.util.List;
+/**
+ * Pagination support class
+ *
+ * @author Martin Gencur
+ *
+ */
public class Paginator
{
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PasteWindow.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PasteWindow.java 2010-06-19 17:49:48 UTC (rev 6557)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PasteWindow.java 2010-06-19 18:05:06 UTC (rev 6558)
@@ -29,8 +29,12 @@
import org.jboss.weld.examples.pastecode.model.CodeFragment;
/**
- * PasteWindow holds the code fragment and other selections when a code fragment is viewed and entered
- *
+ * PasteWindow holds the code fragment and other selections when a code fragment
+ * is viewed and entered
+ *
+ * @author Pete Muir
+ * @author Martin Gencur
+ *
*/
@Named
@RequestScoped
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PopulateDatabase.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PopulateDatabase.java 2010-06-19 17:49:48 UTC (rev 6557)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PopulateDatabase.java 2010-06-19 18:05:06 UTC (rev 6558)
@@ -45,7 +45,8 @@
* Populate the database with data.sql. Needed because import.sql doesn't
* support multi-line inserts
*
- * @author pmuir
+ * @author Pete Muir
+ * @author Martin Gencur
*
*/
@Startup
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PostTracker.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PostTracker.java 2010-06-19 17:49:48 UTC (rev 6557)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PostTracker.java 2010-06-19 18:05:06 UTC (rev 6558)
@@ -6,6 +6,12 @@
import javax.ejb.Stateful;
import javax.enterprise.context.SessionScoped;
+/**
+ * Tracks the post made by the current user
+ *
+ * @author Pete Muir
+ *
+ */
@SessionScoped
@Stateful // Adds passivation capabilities....
public class PostTracker
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Theme.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Theme.java 2010-06-19 17:49:48 UTC (rev 6557)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Theme.java 2010-06-19 18:05:06 UTC (rev 6558)
@@ -1,5 +1,11 @@
package org.jboss.weld.examples.pastecode.session;
+/**
+ * Closed set of the visual themes available for displaying code fragments
+ *
+ * @author Pete Muir
+ *
+ */
public enum Theme
{
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/ThemeManager.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/ThemeManager.java 2010-06-19 17:49:48 UTC (rev 6557)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/ThemeManager.java 2010-06-19 18:05:06 UTC (rev 6558)
@@ -29,6 +29,12 @@
import javax.enterprise.inject.Produces;
import javax.inject.Named;
+/**
+ * Exposes {@link Theme} as a list
+ *
+ * @author Pete Muir
+ *
+ */
@ApplicationScoped
public class ThemeManager
{
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/TimerStartup.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/TimerStartup.java 2010-06-19 17:49:48 UTC (rev 6557)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/TimerStartup.java 2010-06-19 18:05:06 UTC (rev 6558)
@@ -5,6 +5,11 @@
import javax.ejb.Startup;
import javax.inject.Inject;
+/**
+ * Responsible for starting the timer for printing recently added code fragments
+ * @author Pete Muir
+ *
+ */
@Startup @Singleton
public class TimerStartup
{
14 years, 4 months
Weld SVN: r6557 - 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-19 13:49:48 -0400 (Sat, 19 Jun 2010)
New Revision: 6557
Modified:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java
Log:
minor
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-19 17:40:49 UTC (rev 6556)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java 2010-06-19 17:49:48 UTC (rev 6557)
@@ -26,7 +26,6 @@
import java.util.Calendar;
import java.util.Date;
import java.util.List;
-import java.util.logging.Logger;
import javax.ejb.Stateful;
import javax.enterprise.event.Event;
@@ -54,9 +53,6 @@
// The number of code fragments to display per page
private static int PAGE_SIZE = 2;
- @Inject
- private Logger log;
-
@Inject
private Event<CodeFragment> event;
14 years, 4 months
Weld SVN: r6556 - 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-19 13:40:49 -0400 (Sat, 19 Jun 2010)
New Revision: 6556
Modified:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentLogger.java
Log:
Add declarative concurrency
Modified: 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 2010-06-19 17:36:41 UTC (rev 6555)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentLogger.java 2010-06-19 17:40:49 UTC (rev 6556)
@@ -4,13 +4,16 @@
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
+@Singleton
public class CodeFragmentLogger
{
@@ -21,19 +24,19 @@
this.log = new ArrayList<CodeFragment>();
}
- //(a)Lock(LockType.READ)
+ @Lock(LockType.READ)
public List<CodeFragment> getLog()
{
return Collections.unmodifiableList(log);
}
- //(a)Lock(LockType.WRITE)
+ @Lock(LockType.WRITE)
public void clearLog()
{
this.log.clear();
}
- //(a)Lock(LockType.WRITE)
+ @Lock(LockType.WRITE)
public void addEntry(@Observes CodeFragment codeFragment)
{
this.log.add(codeFragment);
14 years, 4 months
Weld SVN: r6555 - 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-19 13:36:41 -0400 (Sat, 19 Jun 2010)
New Revision: 6555
Added:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentPrinterImpl.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PopulateDatabase.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/TimerStartup.java
Removed:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/DatabasePopulater.java
Modified:
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
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PostTracker.java
examples/trunk/jsf/pastecode/src/main/webapp/home.xhtml
Log:
Use @Startup @Singleton :-)
Modified: 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 2010-06-19 07:21:35 UTC (rev 6554)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentLogger.java 2010-06-19 17:36:41 UTC (rev 6555)
@@ -4,9 +4,6 @@
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;
Modified: 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 2010-06-19 07:21:35 UTC (rev 6554)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentPrinter.java 2010-06-19 17:36:41 UTC (rev 6555)
@@ -1,52 +1,11 @@
package org.jboss.weld.examples.pastecode.session;
-import java.util.logging.Logger;
+import javax.ejb.Local;
-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
+@Local
+public interface 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");
- }
- }
-}
+ public void startTimer();
+
+}
\ No newline at end of file
Copied: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentPrinterImpl.java (from rev 6487, 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/CodeFragmentPrinterImpl.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentPrinterImpl.java 2010-06-19 17:36:41 UTC (rev 6555)
@@ -0,0 +1,56 @@
+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;
+
+//TODO Needs a JBoss EJB3 fix to make this a no-interface view
+@Stateless
+public class CodeFragmentPrinterImpl implements CodeFragmentPrinter
+{
+
+ private static final int ONE_MINUTE = 60 * 1000;
+
+ @Resource
+ private TimerService timerService;
+
+ @Inject
+ private CodeFragmentLogger logger;
+
+ @Inject
+ private Logger log;
+
+ /* (non-Javadoc)
+ * @see org.jboss.weld.examples.pastecode.session.CodeFragmentPrinter#startTimer()
+ */
+ 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");
+ }
+ }
+
+}
Deleted: 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-19 07:21:35 UTC (rev 6554)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/DatabasePopulater.java 2010-06-19 17:36:41 UTC (rev 6555)
@@ -1,128 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, 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.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.weld.examples.pastecode.session;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.text.SimpleDateFormat;
-import java.util.StringTokenizer;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.jboss.weld.examples.pastecode.model.CodeFragment;
-import org.jboss.weld.examples.pastecode.model.Language;
-
-/**
- * This bean only populates database with preformatted data. This is due to need
- * for Hypersonic database which doesn't allow multi-line inserts. Hypersonic
- * database is embedded in JBoss AS and so there is no need to configure any
- * external database to run this example.
- *
- */
-@ApplicationScoped
-@Named("database")
-// TODO @Singleton @Startup
-public class DatabasePopulater
-{
-
- @Inject Logger log;
-
- private static final String DATA_FILE_NAME = "data.sql";
-
- @Inject
- private CodeFragmentManager codeFragmentManager;
-
- @Inject
- private CodeFragmentPrinter codeFragmentPrinter;
-
- private boolean populated;
-
- // TODO @PostConstruct
- public synchronized void populate()
- {
- if (populated)
- {
- return;
- }
-
- // Start the timer for the logger :-)
- codeFragmentPrinter.startTimer();
-
- try
- {
- String fileContent = readFileData(DATA_FILE_NAME);
- StringTokenizer st = new StringTokenizer(fileContent, "'");
- SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-
- while (st.countTokens() > 1)
- {
- CodeFragment c = new CodeFragment();
- st.nextToken();
- c.setDatetime(formatter.parse(st.nextToken()));
- st.nextToken();
- c.setLanguage(Language.valueOf(st.nextToken()));
- st.nextToken();
- st.nextToken();
- st.nextToken();
- c.setUser(st.nextToken());
- st.nextToken();
- c.setText(st.nextToken());
-
- codeFragmentManager.addCodeFragment(c, false);
- }
- }
- catch (Exception e)
- {
- log.log(Level.WARNING, "Unable to read all records from " + DATA_FILE_NAME + " file", e);
- }
-
- log.info("Successfully imported data!");
- populated = true;
- }
-
- public boolean isPopulated()
- {
- return populated;
- }
-
- private String readFileData(String fileName) throws IOException
- {
- InputStream is = this.getClass().getClassLoader().getResourceAsStream(fileName);
- BufferedReader br = new BufferedReader(new InputStreamReader(is));
-
- String line;
- StringBuilder sb = new StringBuilder();
-
- while ((line = br.readLine()) != null)
- {
- sb.append(line).append("\n");
- }
-
- return sb.toString();
- }
-}
Copied: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PopulateDatabase.java (from rev 6487, 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/PopulateDatabase.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PopulateDatabase.java 2010-06-19 17:36:41 UTC (rev 6555)
@@ -0,0 +1,120 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.weld.examples.pastecode.session;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.text.SimpleDateFormat;
+import java.util.StringTokenizer;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.Singleton;
+import javax.ejb.Startup;
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.transaction.UserTransaction;
+
+import org.jboss.weld.examples.pastecode.model.CodeFragment;
+import org.jboss.weld.examples.pastecode.model.Language;
+
+/**
+ * Populate the database with data.sql. Needed because import.sql doesn't
+ * support multi-line inserts
+ *
+ * @author pmuir
+ *
+ */
+@Startup
+@Singleton
+public class PopulateDatabase
+{
+
+ private static final String DATA_FILE_NAME = "data.sql";
+
+ @Inject
+ private Logger log;
+
+ @PersistenceContext
+ private EntityManager entityManager;
+
+ @Inject
+ private UserTransaction utx;
+
+ @PostConstruct
+ public void startup()
+ {
+
+ try
+ {
+ String fileContent = readFileData(DATA_FILE_NAME);
+ StringTokenizer st = new StringTokenizer(fileContent, "'");
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+ while (st.countTokens() > 1)
+ {
+ CodeFragment c = new CodeFragment();
+ st.nextToken();
+ c.setDatetime(formatter.parse(st.nextToken()));
+ st.nextToken();
+ c.setLanguage(Language.valueOf(st.nextToken()));
+ st.nextToken();
+ st.nextToken();
+ st.nextToken();
+ c.setUser(st.nextToken());
+ st.nextToken();
+ c.setText(st.nextToken());
+
+ // Manual TX control, commit each record independently
+ utx.begin();
+ entityManager.persist(c);
+ utx.commit();
+ }
+ }
+ catch (Exception e)
+ {
+ log.log(Level.WARNING, "Unable to read all records from " + DATA_FILE_NAME + " file", e);
+ }
+
+ log.info("Successfully imported data!");
+ }
+
+ private static String readFileData(String fileName) throws IOException
+ {
+ InputStream is = PopulateDatabase.class.getClassLoader().getResourceAsStream(fileName);
+ BufferedReader br = new BufferedReader(new InputStreamReader(is));
+
+ String line;
+ StringBuilder sb = new StringBuilder();
+
+ while ((line = br.readLine()) != null)
+ {
+ sb.append(line).append("\n");
+ }
+
+ return sb.toString();
+ }
+}
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PostTracker.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PostTracker.java 2010-06-19 07:21:35 UTC (rev 6554)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PostTracker.java 2010-06-19 17:36:41 UTC (rev 6555)
@@ -5,17 +5,14 @@
import javax.ejb.Stateful;
import javax.enterprise.context.SessionScoped;
-import javax.inject.Inject;
@SessionScoped
-@Stateful // Add passivation capabilities....
+@Stateful // Adds passivation capabilities....
public class PostTracker
{
private LinkedList<Date> posts;
- @Inject DatabasePopulater databasePopulater;
-
public PostTracker()
{
this.posts = new LinkedList<Date>();
@@ -28,13 +25,15 @@
public boolean isNewPostAllowed()
{
- // if we are populating the database, skip
- if (!databasePopulater.isPopulated())
+ if (posts.size() > 2)
{
+ long diff = new Date().getTime() - posts.get(2).getTime();
+ return diff > 20 * 1000;
+ }
+ else
+ {
return true;
}
- long diff = new Date().getTime() - posts.get(2).getTime();
- return diff > 20 * 1000;
}
}
Added: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/TimerStartup.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/TimerStartup.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/TimerStartup.java 2010-06-19 17:36:41 UTC (rev 6555)
@@ -0,0 +1,21 @@
+package org.jboss.weld.examples.pastecode.session;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.Singleton;
+import javax.ejb.Startup;
+import javax.inject.Inject;
+
+@Startup @Singleton
+public class TimerStartup
+{
+
+ @Inject
+ private CodeFragmentPrinter codeFragmentPrinter;
+
+ @PostConstruct
+ public void startup()
+ {
+ codeFragmentPrinter.startTimer();
+ }
+
+}
Property changes on: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/TimerStartup.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: examples/trunk/jsf/pastecode/src/main/webapp/home.xhtml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/home.xhtml 2010-06-19 07:21:35 UTC (rev 6554)
+++ examples/trunk/jsf/pastecode/src/main/webapp/home.xhtml 2010-06-19 17:36:41 UTC (rev 6555)
@@ -5,51 +5,46 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:s="http://jboss.com/products/seam/taglib">
- <ui:composition template="template.xhtml">
- <ui:define name="viewMetadata">
- <f:metadata>
- <f:event type="preRenderView" listener="#{database.populate}"/>
- </f:metadata>
- </ui:define>
+ <ui:composition template="template.xhtml">
- <ui:define name="mainarea">
+ <ui:define name="mainarea">
- <div class="contentHeader">Post a new PasteCode <h:messages style="color: red" /></div>
+ <div class="contentHeader">Post a new PasteCode <h:messages style="color: red" /></div>
- <h:inputTextarea id="text" styleClass="pastecode" value="#{pasteWindow.codeFragment.text}"/>
+ <h:inputTextarea id="text" styleClass="pastecode" value="#{pasteWindow.codeFragment.text}"/>
- <div class="formRow">
- <h:outputLabel for="language" value="Syntax highlighting"/>
- <h:selectOneMenu id="language" value="#{pasteWindow.codeFragment.language}">
- <f:selectItems value="#{languages}" var="language" itemLabel="#{language.name}" itemValue="#{language}" />
- </h:selectOneMenu>
- </div>
+ <div class="formRow">
+ <h:outputLabel for="language" value="Syntax highlighting"/>
+ <h:selectOneMenu id="language" value="#{pasteWindow.codeFragment.language}">
+ <f:selectItems value="#{languages}" var="language" itemLabel="#{language.name}" itemValue="#{language}" />
+ </h:selectOneMenu>
+ </div>
- <div class="formRow">
- <h:outputLabel for="exposure" value="Exposure"/>
- <h:selectOneMenu id="exposure" value="#{pasteWindow.privateFragment}">
- <f:selectItem itemValue="#{true}" itemLabel="Private"/>
- <f:selectItem itemValue="#{false}" itemLabel="Public"/>
- </h:selectOneMenu>
- </div>
+ <div class="formRow">
+ <h:outputLabel for="exposure" value="Exposure"/>
+ <h:selectOneMenu id="exposure" value="#{pasteWindow.privateFragment}">
+ <f:selectItem itemValue="#{true}" itemLabel="Private"/>
+ <f:selectItem itemValue="#{false}" itemLabel="Public"/>
+ </h:selectOneMenu>
+ </div>
- <div class="formRow">
- <h:outputLabel for="user" value="Name / title"/>
- <h:inputText id="user" maxlength="30" size="30" value="#{pasteWindow.codeFragment.user}"/>
- </div>
+ <div class="formRow">
+ <h:outputLabel for="user" value="Name / title"/>
+ <h:inputText id="user" maxlength="30" size="30" value="#{pasteWindow.codeFragment.user}"/>
+ </div>
- <div class="formButtons">
- <h:commandButton action="#{pasteWindow.send}" id="send" image="img/submit.png"/>
- </div>
+ <div class="formButtons">
+ <h:commandButton action="#{pasteWindow.send}" id="send" image="img/submit.png"/>
+ </div>
- <br style="clear:both"/>
+ <br style="clear:both"/>
- </ui:define>
+ </ui:define>
- <ui:define name="rightmenu">
- <ui:include src="rightMenuDefault.xhtml"/>
- </ui:define>
+ <ui:define name="rightmenu">
+ <ui:include src="rightMenuDefault.xhtml"/>
+ </ui:define>
- </ui:composition>
+ </ui:composition>
</html>
14 years, 4 months