Seam SVN: r10312 - trunk/seam-gen.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-04-06 16:16:40 -0400 (Mon, 06 Apr 2009)
New Revision: 10312
Modified:
trunk/seam-gen/build.xml
Log:
add new menu item for each of new-action, new-form, new-conversation, and new-query
Modified: trunk/seam-gen/build.xml
===================================================================
--- trunk/seam-gen/build.xml 2009-04-06 16:14:09 UTC (rev 10311)
+++ trunk/seam-gen/build.xml 2009-04-06 20:16:40 UTC (rev 10312)
@@ -1255,11 +1255,11 @@
<echo message="If you use 'update', you will need to manually run the SQL statements appended to resources/import-dev.sql to add the default accounts."/>
</target>
- <target name="new-action" depends="new-action-ear,new-action-war"
+ <target name="new-action" depends="new-action-ear,new-action-war,insert-menu-item"
description="Create a new action"/>
- <target name="new-form" depends="new-form-ear,new-form-war"
+ <target name="new-form" depends="new-form-ear,new-form-war,insert-menu-item"
description="Create a new form action"/>
- <target name="new-conversation" depends="new-conversation-ear,new-conversation-war"
+ <target name="new-conversation" depends="new-conversation-ear,new-conversation-war,insert-menu-item"
description="Create a new conversation controller"/>
<target name="new-action-ear" depends="validate-project,action-input,setup-filters" unless="project.war">
@@ -1336,6 +1336,17 @@
<echo message="Type '${seam.cmd} restart' and go to http://localhost:8080/${project.name}/${page.name}.seam"/>
</target>
+ <target name="insert-menu-item">
+ <replace file="${project.home}/view/layout/menu.xhtml">
+ <replacetoken><![CDATA[<!-- @newMenuItem@ -->]]></replacetoken>
+ <replacevalue><![CDATA[<s:link view="/@pageName@.xhtml" value="@pageName@" propagation="none"/>
+ <!-- @newMenuItem@ -->]]></replacevalue>
+ </replace>
+ <replace file="${project.home}/view/layout/menu.xhtml">
+ <replacefilter token="@pageName@" value="${page.name}"/>
+ </replace>
+ </target>
+
<!-- FIXME: we ask the user for information that isn't needed for this target -->
<target name="new-test" depends="validate-project,action-input,setup-filters" description="Create a new test">
<echo message="Creating a new SeamTest subclass for the specified Seam component"/>
@@ -1357,6 +1368,7 @@
<filterset refid="filters"/>
</copy>
+ <antcall target="insert-menu-item"/>
<echo message="Type '${seam.cmd} restart' and go to http://localhost:8080/${project.name}/${page.name}.seam"/>
</target>
15 years, 7 months
Seam SVN: r10311 - in trunk/src/main/org/jboss/seam: intercept and 1 other directories.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-06 12:14:09 -0400 (Mon, 06 Apr 2009)
New Revision: 10311
Added:
trunk/src/main/org/jboss/seam/annotations/intercept/PostConstruct.java
Modified:
trunk/src/main/org/jboss/seam/intercept/Interceptor.java
trunk/src/main/org/jboss/seam/persistence/EntityManagerProxyInterceptor.java
trunk/src/main/org/jboss/seam/persistence/HibernateSessionProxyInterceptor.java
Log:
JBSEAM-3726
Added: trunk/src/main/org/jboss/seam/annotations/intercept/PostConstruct.java
===================================================================
--- trunk/src/main/org/jboss/seam/annotations/intercept/PostConstruct.java (rev 0)
+++ trunk/src/main/org/jboss/seam/annotations/intercept/PostConstruct.java 2009-04-06 16:14:09 UTC (rev 10311)
@@ -0,0 +1,19 @@
+package org.jboss.seam.annotations.intercept;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Synonym for {@link javax.ejb.PostConstruct}, for
+ * use in a pre Java EE 5 environment.
+ *
+ * @author Denis Forveille
+ */
+@Target(METHOD)
+@Retention(RUNTIME)
+@Documented
+public @interface PostConstruct {}
Property changes on: trunk/src/main/org/jboss/seam/annotations/intercept/PostConstruct.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/src/main/org/jboss/seam/intercept/Interceptor.java
===================================================================
--- trunk/src/main/org/jboss/seam/intercept/Interceptor.java 2009-04-06 12:13:57 UTC (rev 10310)
+++ trunk/src/main/org/jboss/seam/intercept/Interceptor.java 2009-04-06 16:14:09 UTC (rev 10311)
@@ -14,6 +14,7 @@
import org.jboss.seam.annotations.intercept.AroundInvoke;
import org.jboss.seam.annotations.intercept.InterceptorType;
import org.jboss.seam.annotations.intercept.PostActivate;
+import org.jboss.seam.annotations.intercept.PostConstruct;
import org.jboss.seam.annotations.intercept.PrePassivate;
import org.jboss.seam.util.Reflections;
@@ -131,7 +132,7 @@
{
aroundInvokeMethod = method;
}
- if ( method.isAnnotationPresent(POST_CONSTRUCT) )
+ if ( method.isAnnotationPresent(POST_CONSTRUCT) || method.isAnnotationPresent(PostConstruct.class))
{
postConstructMethod = method;
}
Modified: trunk/src/main/org/jboss/seam/persistence/EntityManagerProxyInterceptor.java
===================================================================
--- trunk/src/main/org/jboss/seam/persistence/EntityManagerProxyInterceptor.java 2009-04-06 12:13:57 UTC (rev 10310)
+++ trunk/src/main/org/jboss/seam/persistence/EntityManagerProxyInterceptor.java 2009-04-06 16:14:09 UTC (rev 10311)
@@ -3,13 +3,13 @@
import static org.jboss.seam.ComponentType.STATEFUL_SESSION_BEAN;
import static org.jboss.seam.ComponentType.STATELESS_SESSION_BEAN;
-import javax.annotation.PostConstruct;
-import javax.ejb.PostActivate;
import javax.persistence.EntityManager;
import org.jboss.seam.Component.BijectedAttribute;
import org.jboss.seam.annotations.intercept.AroundInvoke;
import org.jboss.seam.annotations.intercept.Interceptor;
+import org.jboss.seam.annotations.intercept.PostActivate;
+import org.jboss.seam.annotations.intercept.PostConstruct;
import org.jboss.seam.intercept.AbstractInterceptor;
import org.jboss.seam.intercept.InvocationContext;
Modified: trunk/src/main/org/jboss/seam/persistence/HibernateSessionProxyInterceptor.java
===================================================================
--- trunk/src/main/org/jboss/seam/persistence/HibernateSessionProxyInterceptor.java 2009-04-06 12:13:57 UTC (rev 10310)
+++ trunk/src/main/org/jboss/seam/persistence/HibernateSessionProxyInterceptor.java 2009-04-06 16:14:09 UTC (rev 10311)
@@ -3,13 +3,12 @@
import static org.jboss.seam.ComponentType.STATEFUL_SESSION_BEAN;
import static org.jboss.seam.ComponentType.STATELESS_SESSION_BEAN;
-import javax.annotation.PostConstruct;
-
import org.hibernate.Session;
import org.jboss.seam.Component.BijectedAttribute;
import org.jboss.seam.annotations.intercept.AroundInvoke;
import org.jboss.seam.annotations.intercept.Interceptor;
import org.jboss.seam.annotations.intercept.PostActivate;
+import org.jboss.seam.annotations.intercept.PostConstruct;
import org.jboss.seam.intercept.AbstractInterceptor;
import org.jboss.seam.intercept.InvocationContext;
import org.jboss.seam.util.Reflections;
15 years, 7 months
Seam SVN: r10310 - trunk/src/test/unit/org/jboss/seam/test/unit.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-06 08:13:57 -0400 (Mon, 06 Apr 2009)
New Revision: 10310
Modified:
trunk/src/test/unit/org/jboss/seam/test/unit/ContextTest.java
Log:
Fix test
Modified: trunk/src/test/unit/org/jboss/seam/test/unit/ContextTest.java
===================================================================
--- trunk/src/test/unit/org/jboss/seam/test/unit/ContextTest.java 2009-04-06 07:20:49 UTC (rev 10309)
+++ trunk/src/test/unit/org/jboss/seam/test/unit/ContextTest.java 2009-04-06 12:13:57 UTC (rev 10310)
@@ -118,7 +118,7 @@
assert ((MockHttpSession) externalContext.getSession(false))
.getAttributes().size() == 4;
assert ((MockServletContext) externalContext.getContext())
- .getAttributes().size() == 10;
+ .getAttributes().size() == 11;
FacesLifecycle.beginRequest(externalContext);
@@ -151,7 +151,7 @@
assert Contexts.getSessionContext().get("foo") == foo;
assert Contexts.getConversationContext().getNames().length == 2;
- assert Contexts.getApplicationContext().getNames().length == 10;
+ assert Contexts.getApplicationContext().getNames().length == 11;
assert Contexts.getSessionContext().getNames().length == 2;
assert seamVariableResolver.getValue(elContext, null, "zzz").equals(
@@ -186,7 +186,7 @@
assert ((MockHttpSession) externalContext.getSession(false))
.getAttributes().size() == 3; // foo, zzz, org.jboss.seam.core.conversationEntries
assert ((MockServletContext) externalContext.getContext())
- .getAttributes().size() == 10;
+ .getAttributes().size() == 11;
ServletLifecycle.endSession(((HttpServletRequest) externalContext
.getRequest()).getSession());
15 years, 7 months
Seam SVN: r10309 - in trunk/examples/wiki: src/etc/WEB-INF and 5 other directories.
by seam-commits@lists.jboss.org
Author: christian.bauer(a)jboss.com
Date: 2009-04-06 03:20:49 -0400 (Mon, 06 Apr 2009)
New Revision: 10309
Added:
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/listener/NestedSetFlushEventListener.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/listener/NestedSetLockTimeoutException.java
Removed:
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/listener/NestedSetMonitor.java
Modified:
trunk/examples/wiki/src/etc/META-INF/persistence-dev-war.xml
trunk/examples/wiki/src/etc/META-INF/persistence-prod-war.xml
trunk/examples/wiki/src/etc/META-INF/persistence-test-war.xml
trunk/examples/wiki/src/etc/WEB-INF/pages.xml
trunk/examples/wiki/src/etc/i18n/messages_en.properties
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/Pager.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/listener/NestedSetOperation.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/listener/NestedSetPostDeleteEventListener.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/listener/NestedSetPostInsertEventListener.java
trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/package.html
trunk/examples/wiki/view/includes/pager.xhtml
Log:
JBSEAM-4069, new approach to nested set locking
Modified: trunk/examples/wiki/src/etc/META-INF/persistence-dev-war.xml
===================================================================
--- trunk/examples/wiki/src/etc/META-INF/persistence-dev-war.xml 2009-04-06 04:49:46 UTC (rev 10308)
+++ trunk/examples/wiki/src/etc/META-INF/persistence-dev-war.xml 2009-04-06 07:20:49 UTC (rev 10309)
@@ -76,6 +76,8 @@
value="read-write, WikiFeedEntryCollection"/>
<!-- Nested Set handling through special Hibernate event listeners -->
+ <property name="hibernate.ejb.event.flush"
+ value="org.jboss.seam.wiki.core.nestedset.listener.NestedSetFlushEventListener"/>
<property name="hibernate.ejb.event.post-insert"
value="org.jboss.seam.wiki.core.nestedset.listener.NestedSetPostInsertEventListener"/>
<property name="hibernate.ejb.event.post-delete"
Modified: trunk/examples/wiki/src/etc/META-INF/persistence-prod-war.xml
===================================================================
--- trunk/examples/wiki/src/etc/META-INF/persistence-prod-war.xml 2009-04-06 04:49:46 UTC (rev 10308)
+++ trunk/examples/wiki/src/etc/META-INF/persistence-prod-war.xml 2009-04-06 07:20:49 UTC (rev 10309)
@@ -73,6 +73,8 @@
value="read-write, WikiFeedEntryCollection"/>
<!-- Nested Set handling through special Hibernate event listeners -->
+ <property name="hibernate.ejb.event.flush"
+ value="org.jboss.seam.wiki.core.nestedset.listener.NestedSetFlushEventListener"/>
<property name="hibernate.ejb.event.post-insert"
value="org.jboss.seam.wiki.core.nestedset.listener.NestedSetPostInsertEventListener"/>
<property name="hibernate.ejb.event.post-delete"
Modified: trunk/examples/wiki/src/etc/META-INF/persistence-test-war.xml
===================================================================
--- trunk/examples/wiki/src/etc/META-INF/persistence-test-war.xml 2009-04-06 04:49:46 UTC (rev 10308)
+++ trunk/examples/wiki/src/etc/META-INF/persistence-test-war.xml 2009-04-06 07:20:49 UTC (rev 10309)
@@ -48,6 +48,8 @@
<property name="hibernate.session_factory_name" value="SessionFactories/lacewikiSF"/>
<!-- Nested Set handling through special Hibernate event listeners -->
+ <property name="hibernate.ejb.event.flush"
+ value="org.jboss.seam.wiki.core.nestedset.listener.NestedSetFlushEventListener"/>
<property name="hibernate.ejb.event.post-insert"
value="org.jboss.seam.wiki.core.nestedset.listener.NestedSetPostInsertEventListener"/>
<property name="hibernate.ejb.event.post-delete"
Modified: trunk/examples/wiki/src/etc/WEB-INF/pages.xml
===================================================================
--- trunk/examples/wiki/src/etc/WEB-INF/pages.xml 2009-04-06 04:49:46 UTC (rev 10308)
+++ trunk/examples/wiki/src/etc/WEB-INF/pages.xml 2009-04-06 07:20:49 UTC (rev 10309)
@@ -335,6 +335,21 @@
</redirect>
</exception>
+ <exception class="org.jboss.seam.wiki.core.nestedset.listener.NestedSetLockTimeoutException">
+ <end-conversation/>
+ <redirect view-id="/wiki.xhtml">
+ <message severity="WARN">#{messages['lacewiki.msg.LockTimeoutError']}</message>
+ </redirect>
+ </exception>
+
+ <!-- This occurs on concurrent delete of comments -->
+ <exception class="javax.persistence.EntityNotFoundException">
+ <end-conversation/>
+ <redirect view-id="/wiki.xhtml">
+ <message severity="WARN">#{messages['lacewiki.msg.EntityNotFound']}</message>
+ </redirect>
+ </exception>
+
<exception class="org.jboss.seam.security.AuthorizationException">
<end-conversation/>
<redirect view-id="/message.xhtml">
Modified: trunk/examples/wiki/src/etc/i18n/messages_en.properties
===================================================================
--- trunk/examples/wiki/src/etc/i18n/messages_en.properties 2009-04-06 04:49:46 UTC (rev 10308)
+++ trunk/examples/wiki/src/etc/i18n/messages_en.properties 2009-04-06 07:20:49 UTC (rev 10309)
@@ -267,10 +267,6 @@
lacewiki.label.dirDisplay.ReadAccess=Read Access
lacewiki.label.dirDisplay.WriteAccess=Write Access
lacewiki.label.dirDisplay.DirectoryIsEmpty=This directory is empty.
-lacewiki.label.dirDisplay.PagerShowing=
-lacewiki.label.dirDisplay.PagerTo=to
-lacewiki.label.dirDisplay.PagerOf=of
-lacewiki.label.dirDisplay.PagerElements=
lacewiki.label.dirDisplay.ShowItems=Show items
lacewiki.label.dirDisplay.All=All
lacewiki.button.dirDisplay.Refresh=Re<u>f</u>resh
@@ -652,6 +648,9 @@
lacewiki.msg.Clipboard.DuplicatePasteName=The name '{0}' was already in use in this area, renamed item to '{1}'.
lacewiki.msg.Clipboard.DuplicatePasteNameFailure=The name '{0}' was already in use in this area and is too long to be renamed, skipping paste.
+# Pager
+lacewiki.label.pagerTo=to
+lacewiki.label.pagerOf=of
# Entity update/delete/persist
@@ -717,6 +716,8 @@
lacewiki.msg.TrashAreaNotFound=Could not find trash area with name {0} - your configuration is broken, please change it.
lacewiki.msg.HelpAreaNotFound=Could not find help area with name {0} - your configuration is broken, please change it.
lacewiki.msg.OptimisticLockError=Someone modified the same record while you were editing it. Your workspace has been closed.
+lacewiki.msg.LockTimeoutError=Your action conflicted with the action of another user, please try again in a few seconds.
+lacewiki.msg.EntityNotFound=The requested entity was not found.
lacewiki.msg.AccessDenied=Access Denied
lacewiki.msg.FatalError=Request failed, please check the application log or contact the administrator
lacewiki.msg.RequestError=Request failed, most likely because a request parameter was missing
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/Pager.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/Pager.java 2009-04-06 04:49:46 UTC (rev 10308)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/Pager.java 2009-04-06 07:20:49 UTC (rev 10309)
@@ -14,6 +14,7 @@
@AutoCreate
public class Pager implements Serializable {
+ private String pagerEventName = "Pager";
private Long numOfRecords = 0l;
private Integer page = 0;
private Long pageSize = 15l;
@@ -24,6 +25,15 @@
this.pageSize = pageSize;
}
+ public Pager(String pagerEventName) {
+ this.pagerEventName = pagerEventName;
+ }
+
+ public Pager(String pagerEventName, Long pageSize) {
+ this.pagerEventName = pagerEventName;
+ this.pageSize = pageSize;
+ }
+
public Long getNumOfRecords() {
return numOfRecords;
}
@@ -103,22 +113,22 @@
public void setFirstPage() {
setPage(getFirstPage());
- Events.instance().raiseEvent("Pager.pageChanged");
+ Events.instance().raiseEvent(pagerEventName + "pageChanged");
}
public void setPreviousPage() {
setPage(getPreviousPage());
- Events.instance().raiseEvent("Pager.pageChanged");
+ Events.instance().raiseEvent(pagerEventName + ".pageChanged");
}
public void setNextPage() {
setPage(getNextPage());
- Events.instance().raiseEvent("Pager.pageChanged");
+ Events.instance().raiseEvent(pagerEventName + ".pageChanged");
}
public void setLastPage() {
setPage(new Long(getLastPage()).intValue());
- Events.instance().raiseEvent("Pager.pageChanged");
+ Events.instance().raiseEvent(pagerEventName + ".pageChanged");
}
public String toString() {
Added: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/listener/NestedSetFlushEventListener.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/listener/NestedSetFlushEventListener.java (rev 0)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/listener/NestedSetFlushEventListener.java 2009-04-06 07:20:49 UTC (rev 10309)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.seam.wiki.core.nestedset.listener;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.hibernate.HibernateException;
+import org.hibernate.ejb.event.EJB3FlushEventListener;
+import org.hibernate.event.EventSource;
+
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * <p>
+ * TODO: This is really the issue why a nice nested set implementation with Hibernate and MySQL is impossible!
+ * </p>
+ * <p>
+ * Any nested set tree modification potentially updates all rows in a database table. This
+ * requires several <tt>UPDATE</tt> statements, and also <tt>INSERT</tt> and <tt>DELETE</tt>.
+ * Any concurrent insertion or deletion to the rows betwen <tt>UPDATE</tt> statements would be fatal and
+ * corrupt the tree information. Transactions that modify nested set data should be serialized.
+ * </p>
+ * <p>
+ * For example, without any additional locking we'd run into the following deadlock situation with MySQL. Consider
+ * the following threads and the required modifications when two nested set node are deleted concurrently:
+ * </p>
+ *
+ * <pre>
+ * Thread I Nested Set Nodes Thread II
+ * --- 1. DELETE ---> A
+ *
+ * B <--- 2. DELETE ---
+ *
+ * --- 2. UPDATE ---> B
+ * (Waits for lock)
+ * A <--- 3. UPDATE ---
+ * (Waits for lock)
+ *
+ * </pre>
+ *
+ * <p>
+ * This results in a MySQL deadlock detection exception and a rollback of the transaction in Thread II.
+ * The usual solution is to lock the whole table(s) to force serialized execution of threads that modify
+ * nested set tree state.
+ * </p>
+ * <p>
+ * However, because MySQL has an unusable locking system (locking a table commits the current transaction, you
+ * need to lock all tables you are going to use from that point on, etc.), and because portability is
+ * a concern of this nested set implementation, we work around the problem with an in-memory exclusive lock.
+ * </p>
+ * <p>
+ * The situation is further complicated by Hibernate's flushing/eventing behavior. There is no way how we can
+ * only lock for nested set updates, we need to lock on every execution of a flush. WARNING: This severely
+ * degrades performance of your application, as any automatic or manual flush of the Hibernate persistence context
+ * will be serialized application-wide! Luckily, we can only lock when deletions or insertions are queued so
+ * flushing with no modifications in the persistence context (e.g. before a query) is not affected.
+ * </p>
+ * <p>
+ * <b>NOTE:</b> This does NOT work if several applications modify the nested set tree on the same database tables!
+ * </p>
+ *
+ * @author Christian Bauer
+ */
+public class NestedSetFlushEventListener extends EJB3FlushEventListener {
+
+ private static final Log log = LogFactory.getLog(NestedSetFlushEventListener.class);
+
+ private static final int LOCK_TIMEOUT_SECONDS = 15;
+
+ private static final Lock lock = new ReentrantLock(true);
+
+ @Override
+ protected void performExecutions(EventSource eventSource) throws HibernateException {
+
+ if (eventSource.getActionQueue().areInsertionsOrDeletionsQueued()) {
+ try {
+ log.debug("######################### trying to obtain exclusive lock for " + LOCK_TIMEOUT_SECONDS +
+ " seconds before performing database modifications during flush");
+ if (lock.tryLock(LOCK_TIMEOUT_SECONDS, TimeUnit.SECONDS)) {
+ log.debug("successfully obtained lock, executing flush");
+ try {
+ super.performExecutions(eventSource);
+ } finally {
+ log.debug("releasing exclusive lock after flush execution");
+ lock.unlock();
+ }
+ } else {
+ throw new NestedSetLockTimeoutException("Could not aquire exclusive lock during database flush");
+ }
+ } catch (InterruptedException ex) {
+ throw new NestedSetLockTimeoutException("Current thread could not aquire lock, has been interrupted");
+ }
+ } else {
+ super.performExecutions(eventSource);
+ }
+
+ }
+
+}
\ No newline at end of file
Added: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/listener/NestedSetLockTimeoutException.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/listener/NestedSetLockTimeoutException.java (rev 0)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/listener/NestedSetLockTimeoutException.java 2009-04-06 07:20:49 UTC (rev 10309)
@@ -0,0 +1,23 @@
+package org.jboss.seam.wiki.core.nestedset.listener;
+
+/**
+ * @author Christian Bauer
+ */
+public class NestedSetLockTimeoutException extends RuntimeException {
+
+ public NestedSetLockTimeoutException() {
+ super();
+ }
+
+ public NestedSetLockTimeoutException(String s) {
+ super(s);
+ }
+
+ public NestedSetLockTimeoutException(String s, Throwable throwable) {
+ super(s, throwable);
+ }
+
+ public NestedSetLockTimeoutException(Throwable throwable) {
+ super(throwable);
+ }
+}
Deleted: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/listener/NestedSetMonitor.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/listener/NestedSetMonitor.java 2009-04-06 04:49:46 UTC (rev 10308)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/listener/NestedSetMonitor.java 2009-04-06 07:20:49 UTC (rev 10309)
@@ -1,49 +0,0 @@
-package org.jboss.seam.wiki.core.nestedset.listener;
-
-import org.hibernate.event.EventSource;
-
-import java.util.concurrent.locks.ReentrantLock;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.TimeUnit;
-
-/**
- * An alternative to table locking, we serialize nested set insert/updates in memory.
- *
- * <p>
- * Any nested set tree modification potentially updates all rows in a database table. This
- * requires several <tt>UPDATE</tt> statements, and also <tt>INSERT</tt> and <tt>DELETE</tt>.
- * Any concurrent commit to the rows betwen <tt>UPDATE</tt> statements would be fatal and
- * corrupt the tree information. The usual solution is to lock the whole table(s). Because
- * MySQL has a compleltey unusable locking system (locking a table commits the current transaction, you
- * need to lock all tables you are going to use from that point on, etc.), and because portability is
- * a concern of this Nested Set implementation, we work around the problem with an in-memory exclusive lock.
- * </p>
- * <p>
- * <b>NOTE:</b> This does NOT work if several applications modify the nested set
- * tree in the same tables!
- * </p>
- *
- * @author Christian Bauer
- */
-public class NestedSetMonitor {
-
- private static final int LOCK_TIMEOUT_SECONDS = 10;
-
- private static final Lock lock = new ReentrantLock(true);
-
- public static void executeOperation(NestedSetOperation operation, EventSource session) {
- try {
- if (lock.tryLock(LOCK_TIMEOUT_SECONDS, TimeUnit.SECONDS)) {
- try {
- operation.execute(session);
- } finally {
- lock.unlock();
- }
- } else {
- throw new RuntimeException("Could not aquire lock to update nested set tree");
- }
- } catch (InterruptedException ex) {
- throw new RuntimeException("Current thread could not aquire lock, has been interrupted");
- }
- }
-}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/listener/NestedSetOperation.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/listener/NestedSetOperation.java 2009-04-06 04:49:46 UTC (rev 10308)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/listener/NestedSetOperation.java 2009-04-06 07:20:49 UTC (rev 10309)
@@ -43,8 +43,6 @@
* for the deprecated <tt>Session#connection()</tt> method.
* </p>
*
- * TODO: We should lock the tables! Instead we are using the NestedSetMonitor as a workaround...
- *
* @author Christian Bauer
*/
public class NestedSetOperation {
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/listener/NestedSetPostDeleteEventListener.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/listener/NestedSetPostDeleteEventListener.java 2009-04-06 04:49:46 UTC (rev 10308)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/listener/NestedSetPostDeleteEventListener.java 2009-04-06 07:20:49 UTC (rev 10309)
@@ -26,10 +26,7 @@
if ( NestedSetNode.class.isAssignableFrom(event.getEntity().getClass())) {
log.debug("executing nested set delete operation, recalculating the tree");
- NestedSetMonitor.executeOperation(
- new DeleteNestedSetOperation( (NestedSetNode)event.getEntity() ),
- event.getSession()
- );
+ new DeleteNestedSetOperation( (NestedSetNode)event.getEntity() ).execute(event.getSession());
}
}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/listener/NestedSetPostInsertEventListener.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/listener/NestedSetPostInsertEventListener.java 2009-04-06 04:49:46 UTC (rev 10308)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/listener/NestedSetPostInsertEventListener.java 2009-04-06 07:20:49 UTC (rev 10309)
@@ -26,10 +26,7 @@
if ( NestedSetNode.class.isAssignableFrom(event.getEntity().getClass())) {
log.debug("executing nested set insert operation, recalculating the tree");
- NestedSetMonitor.executeOperation(
- new InsertNestedSetOperation((NestedSetNode)event.getEntity()),
- event.getSession()
- );
+ new InsertNestedSetOperation((NestedSetNode)event.getEntity()).execute(event.getSession());
}
}
Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/package.html
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/package.html 2009-04-06 04:49:46 UTC (rev 10308)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/package.html 2009-04-06 07:20:49 UTC (rev 10309)
@@ -59,7 +59,7 @@
<p>
<b>Manual Recursion</b>: Select all the children of node <tt>C</tt>, and if these nodes have children, recursively
query until the whole subtree is loaded. This can be implemented with a stored procedure in SQL or by
- recursively exeucting <tt>SELECT</tt> statements in the application language. This strategy does not scale.
+ recursively executing <tt>SELECT</tt> statements in the application language. This strategy does not scale.
</p>
</li>
<li>
@@ -201,7 +201,7 @@
</pre>
<p>
- This implementation is based on mix-in and delegates. The <tt>ITEM</tt> table of the <tt>Item</tt> class will
+ This implementation is based on mix-in and delegates. The <tt>ITEM</tt> table of the <tt>Item</tt> class
does not carry the left, right, and thread values. This job is delegated to an additional
<tt>ItemNestedSetDelegate</tt> class:
</p>
@@ -280,11 +280,12 @@
<persistence-unit ...>
...
<properties>
+ <property name="hibernate.ejb.event.flush"
+ value="nestedset.NestedSetFlushEventListener"/>
<property name="hibernate.ejb.event.post-insert"
value="nestedset.NestedSetPostInsertEventListener"/>
<property name="hibernate.ejb.event.post-delete"
value="nestedset.NestedSetPostDeleteEventListener"/>
-
</properties>
</persistence-unit>
</pre>
@@ -296,6 +297,12 @@
</p>
<p>
+ Note that concurrent nested set tree modifications need to be serialized. This implementation locks flush events
+ in-memory with a <tt>ReentrantLock</tt> and a timeout of 15 seconds. See <tt>NestedSetFlushEventListener.java</tt>
+ for more information.
+</p>
+
+<p>
To query for a subtree, use the <tt>NestedSetWrapper</tt> and <tt>NestedSetResultTransformer</tt>
convenience classes. An example, loading the whole subtree starting at <tt>startNode</tt> (which would
be an instance of <tt>Item</tt> you have already loaded):
Modified: trunk/examples/wiki/view/includes/pager.xhtml
===================================================================
--- trunk/examples/wiki/view/includes/pager.xhtml 2009-04-06 04:49:46 UTC (rev 10308)
+++ trunk/examples/wiki/view/includes/pager.xhtml 2009-04-06 07:20:49 UTC (rev 10309)
@@ -48,10 +48,10 @@
</s:fragment>
<s:fragment>
- <h:outputText value="#{messages['lacewiki.label.dirDisplay.PagerShowing']}
- #{pager.firstRecord} #{messages['lacewiki.label.dirDisplay.PagerTo']}
- #{pager.lastRecord} #{messages['lacewiki.label.dirDisplay.PagerOf']}
- #{pager.numOfRecords} #{messages['lacewiki.label.dirDisplay.PagerElements']}"/>
+ <h:outputText value="#{pager.firstRecord} #{messages['lacewiki.label.pagerTo']}
+ #{pager.lastRecord} #{messages['lacewiki.label.pagerOf']}
+ #{pager.numOfRecords}
+ #{pager.numOfRecords > 1 ? pagerPluralLabel : pagerSingularLabel}"/>
</s:fragment>
<s:fragment>
15 years, 7 months
Seam SVN: r10308 - trunk/seam-gen/build-scripts.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-04-06 00:49:46 -0400 (Mon, 06 Apr 2009)
New Revision: 10308
Modified:
trunk/seam-gen/build-scripts/build-war.xml
trunk/seam-gen/build-scripts/build.xml
Log:
JBSEAM-4082
Modified: trunk/seam-gen/build-scripts/build-war.xml
===================================================================
--- trunk/seam-gen/build-scripts/build-war.xml 2009-04-06 04:04:47 UTC (rev 10307)
+++ trunk/seam-gen/build-scripts/build-war.xml 2009-04-06 04:49:46 UTC (rev 10308)
@@ -207,6 +207,7 @@
<copy tofile="${war.dir}/WEB-INF/classes/components.properties"
file="${basedir}/resources/components-${profile}.properties">
<filterset refid="seam"/>
+ <filterset refid="profile"/>
</copy>
<copy tofile="${war.dir}/WEB-INF/classes/META-INF/persistence.xml"
Modified: trunk/seam-gen/build-scripts/build.xml
===================================================================
--- trunk/seam-gen/build-scripts/build.xml 2009-04-06 04:04:47 UTC (rev 10307)
+++ trunk/seam-gen/build-scripts/build.xml 2009-04-06 04:49:46 UTC (rev 10308)
@@ -205,6 +205,7 @@
<copy tofile="${war.dir}/WEB-INF/classes/components.properties"
file="${basedir}/resources/components-${profile}.properties">
<filterset refid="seam"/>
+ <filterset refid="profile"/>
</copy>
<copy todir="${war.dir}/WEB-INF">
<fileset dir="${basedir}/resources/WEB-INF">
15 years, 7 months
Seam SVN: r10307 - branches/community/Seam_2_0/seam-gen/build-scripts.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-04-06 00:04:47 -0400 (Mon, 06 Apr 2009)
New Revision: 10307
Modified:
branches/community/Seam_2_0/seam-gen/build-scripts/build-war.xml
branches/community/Seam_2_0/seam-gen/build-scripts/build.xml
Log:
JBSEAM-4082
Modified: branches/community/Seam_2_0/seam-gen/build-scripts/build-war.xml
===================================================================
--- branches/community/Seam_2_0/seam-gen/build-scripts/build-war.xml 2009-04-06 04:01:15 UTC (rev 10306)
+++ branches/community/Seam_2_0/seam-gen/build-scripts/build-war.xml 2009-04-06 04:04:47 UTC (rev 10307)
@@ -27,6 +27,9 @@
<property name="javac.debug" value="true" />
<property name="javac.deprecation" value="false" />
<property name="debug" value="false" />
+ <condition property="is.debug">
+ <istrue value="${debug}"/>
+ </condition>
<fileset id="lib" dir="${lib.dir}">
<include name="*.jar" />
@@ -182,6 +185,7 @@
<fileset dir="${lib.dir}">
<includesfile name="deployed-jars.list"/>
<exclude name="jboss-seam-gen.jar"/>
+ <exclude name="jboss-seam-debug.jar" unless="is.debug"/>
<include name="groovy-*.jar" if="groovy.present"/>
</fileset>
</copy>
Modified: branches/community/Seam_2_0/seam-gen/build-scripts/build.xml
===================================================================
--- branches/community/Seam_2_0/seam-gen/build-scripts/build.xml 2009-04-06 04:01:15 UTC (rev 10306)
+++ branches/community/Seam_2_0/seam-gen/build-scripts/build.xml 2009-04-06 04:04:47 UTC (rev 10307)
@@ -28,6 +28,9 @@
<property name="javac.debug" value="true" />
<property name="javac.deprecation" value="false" />
<property name="debug" value="false" />
+ <condition property="is.debug" value="true">
+ <istrue value="${debug}"/>
+ </condition>
<!--Properties for validating configuration files -->
<property name="validate.resources.dir" value="${basedir}/exploded-archives" />
@@ -124,6 +127,7 @@
<fileset dir="${lib.dir}">
<includesfile name="deployed-jars-war.list" />
<exclude name="jboss-seam-gen.jar" />
+ <exclude name="jboss-seam-debug.jar" unless="is.debug"/>
</fileset>
</copy>
<copy todir="${war.dir}/WEB-INF/classes">
15 years, 7 months
Seam SVN: r10306 - branches/community/Seam_2_0/seam-gen/build-scripts.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-04-06 00:01:15 -0400 (Mon, 06 Apr 2009)
New Revision: 10306
Modified:
branches/community/Seam_2_0/seam-gen/build-scripts/build-war.xml
branches/community/Seam_2_0/seam-gen/build-scripts/build.xml
Log:
whitespace
Modified: branches/community/Seam_2_0/seam-gen/build-scripts/build-war.xml
===================================================================
--- branches/community/Seam_2_0/seam-gen/build-scripts/build-war.xml 2009-04-06 03:57:42 UTC (rev 10305)
+++ branches/community/Seam_2_0/seam-gen/build-scripts/build-war.xml 2009-04-06 04:01:15 UTC (rev 10306)
@@ -328,15 +328,15 @@
<target name="test" depends="buildtest" description="Run the tests">
<taskdef resource="testngtasks" classpath="${testng.jar}" />
- <path id="test.path">
- <path path="${test.dir}" />
- <fileset dir="${lib.dir}/test">
- <include name="*.jar"/>
- </fileset>
- <path path="${bootstrap.dir}" />
- <path refid="build.classpath" />
- </path>
- <testng outputdir="${basedir}/test-report">
+ <path id="test.path">
+ <path path="${test.dir}" />
+ <fileset dir="${lib.dir}/test">
+ <include name="*.jar"/>
+ </fileset>
+ <path path="${bootstrap.dir}" />
+ <path refid="build.classpath" />
+ </path>
+ <testng outputdir="${basedir}/test-report">
<classpath refid="test.path" />
<xmlfileset dir="${test.dir}" includes="*Test.xml" />
</testng>
Modified: branches/community/Seam_2_0/seam-gen/build-scripts/build.xml
===================================================================
--- branches/community/Seam_2_0/seam-gen/build-scripts/build.xml 2009-04-06 03:57:42 UTC (rev 10305)
+++ branches/community/Seam_2_0/seam-gen/build-scripts/build.xml 2009-04-06 04:01:15 UTC (rev 10306)
@@ -28,13 +28,13 @@
<property name="javac.debug" value="true" />
<property name="javac.deprecation" value="false" />
<property name="debug" value="false" />
-
- <!--Properties for validating configuration files -->
- <property name="validate.resources.dir" value="${basedir}/exploded-archives" />
- <property name="schema.dir" value="${basedir}/exploded-archives/schemas" />
- <property name="src.schema.dir" value="${schema.dir}/org/jboss/seam"/>
- <property name="schema.version" value="@schemaVersion@" />
-
+
+ <!--Properties for validating configuration files -->
+ <property name="validate.resources.dir" value="${basedir}/exploded-archives" />
+ <property name="schema.dir" value="${basedir}/exploded-archives/schemas" />
+ <property name="src.schema.dir" value="${schema.dir}/org/jboss/seam"/>
+ <property name="schema.version" value="@schemaVersion@" />
+
<fileset id="lib" dir="${lib.dir}">
<include name="*.jar" />
</fileset>
@@ -142,9 +142,9 @@
<include name="*hibernate.cfg.xml" />
<include name="jbpm.cfg.xml" />
</fileset>
- <fileset dir="${lib.dir}">
- <include name="jboss-seam.jar" />
- </fileset>
+ <fileset dir="${lib.dir}">
+ <include name="jboss-seam.jar" />
+ </fileset>
</copy>
<copy todir="${ear.dir}/lib">
<fileset dir="${lib.dir}">
@@ -235,7 +235,7 @@
<delete dir="${ear.dir}"/>
<delete dir="${war.dir}"/>
<delete dir="${jar.dir}"/>
- <delete dir="${src.schema.dir}" failonerror="no"/>
+ <delete dir="${src.schema.dir}" failonerror="no"/>
<delete dir="${basedir}/test-report"/>
<delete dir="${basedir}/test-output"/>
<delete failonerror="no" includeemptydirs="true">
@@ -301,29 +301,29 @@
<target name="test" depends="buildtest" description="Run the tests">
<taskdef resource="testngtasks" classpath="${testng.jar}" />
- <path id="test.path">
- <path path="${test.dir}" />
- <fileset dir="${lib.dir}/test">
- <include name="*.jar"/>
- </fileset>
- <path path="${bootstrap.dir}" />
- <path refid="build.classpath" />
- </path>
+ <path id="test.path">
+ <path path="${test.dir}" />
+ <fileset dir="${lib.dir}/test">
+ <include name="*.jar"/>
+ </fileset>
+ <path path="${bootstrap.dir}" />
+ <path refid="build.classpath" />
+ </path>
<testng outputdir="${basedir}/test-report">
<classpath refid="test.path" />
<xmlfileset dir="${test.dir}" includes="*Test.xml" />
</testng>
</target>
-
- <target name="validateConfiguration" depends="war,ear,jar" description="Validate the xml configuration files">
- <mkdir dir="${schema.dir}"/>
- <unjar src="${lib.dir}/jboss-seam.jar" dest="${schema.dir}">
- <patternset>
- <include name="org/jboss/seam/*.xsd"/>
- <include name="org/jboss/seam/*.dtd"/>
- </patternset>
- </unjar>
- <ant antfile="validate.xml" target="validateConfiguration" />
- </target>
+
+ <target name="validateConfiguration" depends="war,ear,jar" description="Validate the xml configuration files">
+ <mkdir dir="${schema.dir}"/>
+ <unjar src="${lib.dir}/jboss-seam.jar" dest="${schema.dir}">
+ <patternset>
+ <include name="org/jboss/seam/*.xsd"/>
+ <include name="org/jboss/seam/*.dtd"/>
+ </patternset>
+ </unjar>
+ <ant antfile="validate.xml" target="validateConfiguration" />
+ </target>
</project>
15 years, 7 months
Seam SVN: r10305 - in trunk/seam-gen: resources and 1 other directories.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-04-05 23:57:42 -0400 (Sun, 05 Apr 2009)
New Revision: 10305
Modified:
trunk/seam-gen/build-scripts/build-war.xml
trunk/seam-gen/build-scripts/build.xml
trunk/seam-gen/resources/WEB-INF/web.xml
trunk/seam-gen/resources/components-dev.properties
trunk/seam-gen/resources/components-prod.properties
Log:
JBSEAM-4082
Modified: trunk/seam-gen/build-scripts/build-war.xml
===================================================================
--- trunk/seam-gen/build-scripts/build-war.xml 2009-04-06 03:50:29 UTC (rev 10304)
+++ trunk/seam-gen/build-scripts/build-war.xml 2009-04-06 03:57:42 UTC (rev 10305)
@@ -60,6 +60,9 @@
<mkdir dir="${classes.action.dir}" />
<mkdir dir="${dist.dir}" />
+ <condition property="is.debug" value="true">
+ <istrue value="${debug}"/>
+ </condition>
<property name="transactionManagerLookupClass" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
<property name="ejbJndiPattern" value="${project.name}/#{ejbName}/local"/>
<condition property="seamBootstrapsPu" value="false" else="true">
@@ -81,6 +84,9 @@
<filter token="seamEmfRef" value="${seamEmfRef}"/>
<filter token="puJndiName" value="${puJndiName}"/>
</filterset>
+ <filterset id="profile">
+ <filter token="debug" value="${debug}"/>
+ </filterset>
<!-- if a .groovy file is in model or action, set groovy.present -->
<available property="groovy.present" value="true" file="" searchparents="true">
@@ -108,13 +114,13 @@
<condition property="groovy.dynamic" value="true">
<and>
<isset property="groovy.present"/>
- <istrue value="${debug}"/>
+ <isset property="is.debug"/>
</and>
</condition>
<condition property="groovy.static" value="true">
<and>
<isset property="groovy.present"/>
- <isfalse value="${debug}"/>
+ <not><isset property="is.debug"/></not>
</and>
</condition>
</target>
@@ -215,6 +221,7 @@
<fileset dir="${basedir}/resources/WEB-INF">
<include name="*.*"/>
<include name="lib/*.*"/>
+ <exclude name="web.xml"/>
</fileset>
</copy>
@@ -222,6 +229,7 @@
<fileset dir="${lib.dir}">
<includesfile name="deployed-jars.list"/>
<exclude name="jboss-seam-gen.jar"/>
+ <exclude name="jboss-seam-debug.jar" unless="is.debug"/>
<exclude name="icefaces-ahs.jar" if="icefaces.present"/>
<include name="groovy-*.jar" if="groovy.present"/>
</fileset>
@@ -251,6 +259,11 @@
</fileset>
</copy>
+ <copy todir="${war.dir}/WEB-INF"
+ file="${basedir}/resources/WEB-INF/web.xml">
+ <filterset refid="profile"/>
+ </copy>
+
</target>
<target name="clear-profile-artifacts" depends="init"
Modified: trunk/seam-gen/build-scripts/build.xml
===================================================================
--- trunk/seam-gen/build-scripts/build.xml 2009-04-06 03:50:29 UTC (rev 10304)
+++ trunk/seam-gen/build-scripts/build.xml 2009-04-06 03:57:42 UTC (rev 10305)
@@ -60,6 +60,9 @@
<mkdir dir="${war.dir}"/>
<mkdir dir="${dist.dir}"/>
+ <condition property="is.debug" value="true">
+ <istrue value="${debug}"/>
+ </condition>
<property name="transactionManagerLookupClass" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
<property name="ejbJndiPattern" value="${project.name}/#{ejbName}/local"/>
<property name="seamBootstrapsPu" value="false"/>
@@ -77,6 +80,9 @@
<filter token="seamEmfRef" value="${seamEmfRef}"/>
<filter token="puJndiName" value="${puJndiName}"/>
</filterset>
+ <filterset id="profile">
+ <filter token="debug" value="${debug}"/>
+ </filterset>
<!-- if a .groovy file is in model or action, set groovy.present -->
<available property="groovy.present" value="true" file="" searchparents="true">
@@ -204,12 +210,14 @@
<fileset dir="${basedir}/resources/WEB-INF">
<include name="*.*"/>
<include name="lib/*.*"/>
+ <exclude name="web.xml"/>
</fileset>
</copy>
<copy todir="${war.dir}/WEB-INF/lib">
<fileset dir="${lib.dir}">
<includesfile name="deployed-jars-war.list"/>
<exclude name="jboss-seam-gen.jar"/>
+ <exclude name="jboss-seam-debug.jar" unless="is.debug"/>
</fileset>
</copy>
<copy todir="${war.dir}/WEB-INF/classes">
@@ -225,6 +233,10 @@
<include name="**/*.xcss" if="richfaces.present"/>
</fileset>
</copy>
+ <copy todir="${war.dir}/WEB-INF"
+ file="${basedir}/resources/WEB-INF/web.xml">
+ <filterset refid="profile"/>
+ </copy>
</target>
<target name="ear" description="Build the EAR structure in a staging directory">
Modified: trunk/seam-gen/resources/WEB-INF/web.xml
===================================================================
--- trunk/seam-gen/resources/WEB-INF/web.xml 2009-04-06 03:50:29 UTC (rev 10304)
+++ trunk/seam-gen/resources/WEB-INF/web.xml 2009-04-06 03:57:42 UTC (rev 10305)
@@ -65,7 +65,7 @@
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
- <param-value>true</param-value>
+ <param-value>@debug@</param-value>
</context-param>
<!-- JSF -->
Modified: trunk/seam-gen/resources/components-dev.properties
===================================================================
--- trunk/seam-gen/resources/components-dev.properties 2009-04-06 03:50:29 UTC (rev 10304)
+++ trunk/seam-gen/resources/components-dev.properties 2009-04-06 03:57:42 UTC (rev 10305)
@@ -1,6 +1,6 @@
# These properties are used to replace Ant-style tokens in the component descriptor (components.xml) at runtime.
jndiPattern=@ejbJndiPattern@
-debug=true
+debug=@debug@
seamBootstrapsPu=@seamBootstrapsPu@
seamEmfRef=@seamEmfRef@
puJndiName=@puJndiName@
Modified: trunk/seam-gen/resources/components-prod.properties
===================================================================
--- trunk/seam-gen/resources/components-prod.properties 2009-04-06 03:50:29 UTC (rev 10304)
+++ trunk/seam-gen/resources/components-prod.properties 2009-04-06 03:57:42 UTC (rev 10305)
@@ -1,6 +1,6 @@
# These properties are used to replace Ant-style tokens in the component descriptor (components.xml) at runtime.
jndiPattern=@ejbJndiPattern@
-debug=false
+debug=@debug@
seamBootstrapsPu=@seamBootstrapsPu@
seamEmfRef=@seamEmfRef@
puJndiName=@puJndiName@
15 years, 7 months
Seam SVN: r10304 - trunk/seam-gen/build-scripts.
by seam-commits@lists.jboss.org
Author: dan.j.allen
Date: 2009-04-05 23:50:29 -0400 (Sun, 05 Apr 2009)
New Revision: 10304
Modified:
trunk/seam-gen/build-scripts/build-war.xml
trunk/seam-gen/build-scripts/build.xml
Log:
condense some filesets when copying
use istrue condition rather than equals
formatting
Modified: trunk/seam-gen/build-scripts/build-war.xml
===================================================================
--- trunk/seam-gen/build-scripts/build-war.xml 2009-04-06 02:40:32 UTC (rev 10303)
+++ trunk/seam-gen/build-scripts/build-war.xml 2009-04-06 03:50:29 UTC (rev 10304)
@@ -66,10 +66,10 @@
<available file="${jboss.home}/lib/jboss-vfs.jar"/> <!-- JBoss AS >= 5.0 -->
</condition>
<condition property="seamEmfRef" value="#{entityManagerFactory}" else="#{null}">
- <equals arg1="${seamBootstrapsPu}" arg2="true"/>
+ <istrue value="${seamBootstrapsPu}"/>
</condition>
<condition property="puJndiName" value="#{null}" else="java:comp/env/${project.name}/pu">
- <equals arg1="${seamBootstrapsPu}" arg2="true"/>
+ <istrue value="${seamBootstrapsPu}"/>
</condition>
<filterset id="persistence">
@@ -194,14 +194,8 @@
<target name="war" depends="compile"
description="Build the WAR structure in a staging directory">
- <copy todir="${war.dir}/WEB-INF/classes">
- <fileset dir="${basedir}/resources">
- <include name="seam.properties" />
- <include name="*.drl" />
- </fileset>
- <fileset dir="${src.model.dir}">
- <include name="**/*.component.xml" />
- </fileset>
+ <copy todir="${war.dir}">
+ <fileset dir="${basedir}/view" />
</copy>
<copy tofile="${war.dir}/WEB-INF/classes/components.properties"
@@ -217,23 +211,10 @@
<copy tofile="${war.dir}/WEB-INF/classes/import.sql"
file="${basedir}/resources/import-${profile}.sql"/>
- <copy todir="${war.dir}">
- <fileset dir="${basedir}/view" />
- </copy>
-
<copy todir="${war.dir}/WEB-INF">
<fileset dir="${basedir}/resources/WEB-INF">
<include name="*.*"/>
- <include name="classes/**/*.*"/>
- <exclude name="classes/**/*.class"/>
- <exclude name="classes/**/*.groovy"/>
- </fileset>
- </copy>
-
- <copy todir="${war.dir}/WEB-INF">
- <fileset dir="${basedir}/resources/WEB-INF">
<include name="lib/*.*"/>
- <include name="classes/**/*.class"/>
</fileset>
</copy>
@@ -247,31 +228,27 @@
</copy>
<copy todir="${war.dir}/WEB-INF/classes">
- <fileset dir="${basedir}/resources">
- <include name="**/*.xcss" if="richfaces.present"/>
+ <fileset dir="${src.model.dir}">
+ <include name="**/*.component.xml" />
</fileset>
- <!-- move XCSS into classpath for now
- loading from web context only works in JBoss AS 4 -->
- <fileset dir="${basedir}/view">
- <include name="**/*.xcss" if="richfaces.present"/>
- </fileset>
- </copy>
-
- <copy todir="${war.dir}/WEB-INF/classes">
<fileset dir="${basedir}/resources">
<include name="messages*.properties"/>
- <include name="*.skin.properties" if="richfaces.present"/>
<include name="*_theme.properties"/>
- </fileset>
- </copy>
-
- <copy todir="${war.dir}/WEB-INF/classes">
- <fileset dir="${basedir}/resources">
+ <include name="seam.properties" />
+ <include name="*.drl" />
+ <include name="META-INF/*.drl" />
<include name="*jpdl.xml" />
<include name="*hibernate.cfg.xml" />
<include name="jbpm.cfg.xml" />
<include name="META-INF/orm.xml" />
+ <include name="*.skin.properties" if="richfaces.present"/>
+ <include name="**/*.xcss" if="richfaces.present"/>
</fileset>
+ <!-- move XCSS into classpath for now
+ loading from web context only works in JBoss AS 4 -->
+ <fileset dir="${basedir}/view">
+ <include name="**/*.xcss" if="richfaces.present"/>
+ </fileset>
</copy>
</target>
@@ -428,7 +405,7 @@
</target>
<target name="test" depends="buildtest" description="Run the tests">
- <condition property="incompatible.jdk">
+ <condition property="incompatible.jdk" value="true">
<and>
<equals arg1="${ant.java.version}" arg2="1.6"/>
<not><available classname="javax.xml.bind.JAXB"/></not>
Modified: trunk/seam-gen/build-scripts/build.xml
===================================================================
--- trunk/seam-gen/build-scripts/build.xml 2009-04-06 02:40:32 UTC (rev 10303)
+++ trunk/seam-gen/build-scripts/build.xml 2009-04-06 03:50:29 UTC (rev 10304)
@@ -168,13 +168,14 @@
<target name="jar" depends="compile,copyclasses"
description="Build the JAR structure in a staging directory">
<copy todir="${jar.dir}">
+ <fileset dir="${src.model.dir}">
+ <include name="**/*.component.xml" />
+ </fileset>
<fileset dir="${basedir}/resources">
<include name="seam.properties"/>
<include name="*.drl"/>
+ <include name="META-INF/*.drl"/>
</fileset>
- <fileset dir="${src.model.dir}">
- <include name="**/*.component.xml" />
- </fileset>
</copy>
<copy todir="${jar.dir}/META-INF">
<fileset dir="${basedir}/resources/META-INF">
@@ -202,14 +203,7 @@
<copy todir="${war.dir}/WEB-INF">
<fileset dir="${basedir}/resources/WEB-INF">
<include name="*.*"/>
- <include name="classes/**/*.*"/>
- <exclude name="classes/**/*.class"/>
- </fileset>
- </copy>
- <copy todir="${war.dir}/WEB-INF">
- <fileset dir="${basedir}/resources/WEB-INF">
<include name="lib/*.*"/>
- <include name="classes/**/*.class"/>
</fileset>
</copy>
<copy todir="${war.dir}/WEB-INF/lib">
@@ -220,6 +214,9 @@
</copy>
<copy todir="${war.dir}/WEB-INF/classes">
<fileset dir="${basedir}/resources">
+ <include name="messages*.properties"/>
+ <include name="*.skin.properties" if="richfaces.present"/>
+ <include name="*_theme.properties"/>
<include name="**/*.xcss" if="richfaces.present"/>
</fileset>
<!-- move XCSS into classpath for now
@@ -228,13 +225,6 @@
<include name="**/*.xcss" if="richfaces.present"/>
</fileset>
</copy>
- <copy todir="${war.dir}/WEB-INF/classes">
- <fileset dir="${basedir}/resources">
- <include name="messages*.properties"/>
- <include name="*.skin.properties" if="richfaces.present"/>
- <include name="*_theme.properties"/>
- </fileset>
- </copy>
</target>
<target name="ear" description="Build the EAR structure in a staging directory">
@@ -299,17 +289,17 @@
<copy todir="${ear.deploy.dir}">
<fileset dir="${ear.dir}">
- <include name="**/*"/>
- <exclude name="${project.name}_jar/**"/>
- <exclude name="${project.name}_war/**"/>
- </fileset>
+ <include name="**/*"/>
+ <exclude name="${project.name}_jar/**"/>
+ <exclude name="${project.name}_war/**"/>
+ </fileset>
</copy>
- <copy todir="${jar.deploy.dir}">
- <fileset dir="${jar.dir}"/>
- </copy>
- <copy todir="${war.deploy.dir}">
- <fileset dir="${war.dir}"/>
- </copy>
+ <copy todir="${jar.deploy.dir}">
+ <fileset dir="${jar.dir}"/>
+ </copy>
+ <copy todir="${war.deploy.dir}">
+ <fileset dir="${war.dir}"/>
+ </copy>
</target>
<target name="unexplode" description="Undeploy the exploded archive">
@@ -435,7 +425,7 @@
</target>
<target name="test" depends="buildtest" description="Run the tests">
- <condition property="incompatible.jdk">
+ <condition property="incompatible.jdk" value="true">
<and>
<equals arg1="${ant.java.version}" arg2="1.6"/>
<not><available classname="javax.xml.bind.JAXB"/></not>
15 years, 7 months
Seam SVN: r10303 - in trunk: ui/src/main/config/component and 2 other directories.
by seam-commits@lists.jboss.org
Author: smendenh(a)redhat.com
Date: 2009-04-05 22:40:32 -0400 (Sun, 05 Apr 2009)
New Revision: 10303
Modified:
trunk/doc/Seam_Reference_Guide/en-US/Controls.xml
trunk/ui/src/main/config/component/decorate.xml
trunk/ui/src/main/java/org/jboss/seam/ui/component/UIDecorate.java
trunk/ui/src/main/java/org/jboss/seam/ui/renderkit/DecorateRendererBase.java
Log:
Added enclose and element attributes in response to https://jira.jboss.org/jira/browse/JBSEAM-3339
Modified: trunk/doc/Seam_Reference_Guide/en-US/Controls.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Controls.xml 2009-04-06 01:36:22 UTC (rev 10302)
+++ trunk/doc/Seam_Reference_Guide/en-US/Controls.xml 2009-04-06 02:40:32 UTC (rev 10303)
@@ -634,6 +634,21 @@
to use to decorate the component
</para>
</listitem>
+ <listitem>
+ <para>
+ <literal>enclose</literal> — if true, the template
+ used to decorate the input field is enclosed by the
+ element specified with the "element" attribute. By
+ default this is a div element.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <literal>element</literal> — the element to enclose
+ the template used to decorate the input field. By default,
+ the template is enclosed with a div element.
+ </para>
+ </listitem>
</itemizedlist>
<para>
<literal>#{invalid}</literal> and <literal>#{required}</literal>
Modified: trunk/ui/src/main/config/component/decorate.xml
===================================================================
--- trunk/ui/src/main/config/component/decorate.xml 2009-04-06 01:36:22 UTC (rev 10302)
+++ trunk/ui/src/main/config/component/decorate.xml 2009-04-06 02:40:32 UTC (rev 10303)
@@ -41,6 +41,24 @@
<description>XHTML template to use to decorate the input field</description>
</property>
+ <property el="false">
+ <name>enclose</name>
+ <classname>boolean</classname>
+ <description>if true, the template used to decorate the input field is
+ enclosed by the element specified with the "element"
+ attribute. By default this is a div element.
+ </description>
+ <defaultvalue>true</defaultvalue>
+ </property>
+
+ <property el="false">
+ <name>element</name>
+ <classname>java.lang.String</classname>
+ <description>the element to enclose the template used to decorate the input field.
+ By default, the template is enclosed with a div element.</description>
+ <defaultvalue>"div"</defaultvalue>
+ </property>
+
</component>
</components>
Modified: trunk/ui/src/main/java/org/jboss/seam/ui/component/UIDecorate.java
===================================================================
--- trunk/ui/src/main/java/org/jboss/seam/ui/component/UIDecorate.java 2009-04-06 01:36:22 UTC (rev 10302)
+++ trunk/ui/src/main/java/org/jboss/seam/ui/component/UIDecorate.java 2009-04-06 02:40:32 UTC (rev 10303)
@@ -73,6 +73,13 @@
public abstract void setStyle(String style);
+ public abstract boolean isEnclose();
+
+ public abstract void setEnclose(boolean enclose);
+
+ public abstract String getElement();
+
+ public abstract void setElement(String element);
public UIComponent getDecoration(String name)
{
Modified: trunk/ui/src/main/java/org/jboss/seam/ui/renderkit/DecorateRendererBase.java
===================================================================
--- trunk/ui/src/main/java/org/jboss/seam/ui/renderkit/DecorateRendererBase.java 2009-04-06 01:36:22 UTC (rev 10302)
+++ trunk/ui/src/main/java/org/jboss/seam/ui/renderkit/DecorateRendererBase.java 2009-04-06 02:40:32 UTC (rev 10303)
@@ -75,16 +75,19 @@
boolean hasMessage = decorate.hasMessage();
- writer.startElement("div", decorate);
- if (decorate.getStyleClass() != null)
+ if (decorate.isEnclose())
{
- writer.writeAttribute(HTML.CLASS_ATTR, decorate.getStyleClass(), HTML.CLASS_ATTR);
+ writer.startElement(decorate.getElement(), decorate);
+ if (decorate.getStyleClass() != null)
+ {
+ writer.writeAttribute(HTML.CLASS_ATTR, decorate.getStyleClass(), HTML.CLASS_ATTR);
+ }
+ if (decorate.getStyle() != null)
+ {
+ writer.writeAttribute(HTML.STYLE_ATTR, decorate.getStyle(), HTML.STYLE_ATTR);
+ }
+ writer.writeAttribute("id", decorate.getClientId(context), "id");
}
- if (decorate.getStyle() != null)
- {
- writer.writeAttribute(HTML.STYLE_ATTR, decorate.getStyle(), HTML.STYLE_ATTR);
- }
- writer.writeAttribute("id", decorate.getClientId(context), "id");
UIComponent aroundDecoration = decorate.getDecoration("aroundField");
UIComponent aroundInvalidDecoration = decorate.getDecoration("aroundInvalidField");
@@ -118,7 +121,10 @@
aroundInvalidDecoration.setParent(decorate);
aroundInvalidDecoration.encodeEnd(context);
}
- context.getResponseWriter().endElement("div");
+ if (decorate.isEnclose())
+ {
+ context.getResponseWriter().endElement(decorate.getElement());
+ }
restoreOriginalValues(storeOriginals, Contexts.getEventContext());
}
15 years, 7 months