[seam-commits] Seam SVN: r13887 - in modules/faces/trunk/impl: src/main/java/org/jboss/seam/faces/event and 1 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Sat Oct 16 01:40:40 EDT 2010


Author: swd847
Date: 2010-10-16 01:40:40 -0400 (Sat, 16 Oct 2010)
New Revision: 13887

Modified:
   modules/faces/trunk/impl/pom.xml
   modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/DelegatingPhaseListener.java
   modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/transaction/TransactionPhaseListener.java
Log:
make seam persistence optional


Modified: modules/faces/trunk/impl/pom.xml
===================================================================
--- modules/faces/trunk/impl/pom.xml	2010-10-16 02:59:34 UTC (rev 13886)
+++ modules/faces/trunk/impl/pom.xml	2010-10-16 05:40:40 UTC (rev 13887)
@@ -33,7 +33,8 @@
       <dependency>
          <artifactId>seam-persistence-api</artifactId>
          <groupId>org.jboss.seam.persistence</groupId>
-         <scope>compile</scope>
+         <scope>provided</scope>
+         <optional>true</optional>
       </dependency>
       <dependency>
          <groupId>org.jboss.spec.javax.interceptor</groupId>

Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/DelegatingPhaseListener.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/DelegatingPhaseListener.java	2010-10-16 02:59:34 UTC (rev 13886)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/DelegatingPhaseListener.java	2010-10-16 05:40:40 UTC (rev 13887)
@@ -29,6 +29,7 @@
 
 import org.jboss.seam.faces.context.FlashScopedContext;
 import org.jboss.seam.faces.transaction.TransactionPhaseListener;
+import org.jboss.weld.extensions.reflection.Reflections;
 
 /**
  * Provide CDI injection to PhaseListener artifacts by delegating through this
@@ -80,7 +81,17 @@
    @SuppressWarnings("unchecked")
    private List<PhaseListener> getPhaseListeners()
    {
-      return getListeners(FlashScopedContext.class, PhaseEventBridge.class, TransactionPhaseListener.class);
+      try
+      {
+         // if seam persistence is not on the CP then don't add the phase
+         // listener
+         Reflections.classForName("org.jboss.seam.persistence.transaction.SeamTransaction", getClass().getClassLoader());
+         return getListeners(FlashScopedContext.class, PhaseEventBridge.class, TransactionPhaseListener.class);
+      }
+      catch (ClassNotFoundException e)
+      {
+         return getListeners(FlashScopedContext.class, PhaseEventBridge.class);
+      }
    }
 
 }

Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/transaction/TransactionPhaseListener.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/transaction/TransactionPhaseListener.java	2010-10-16 02:59:34 UTC (rev 13886)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/transaction/TransactionPhaseListener.java	2010-10-16 05:40:40 UTC (rev 13887)
@@ -36,8 +36,8 @@
 import org.jboss.seam.persistence.transaction.SeamTransaction;
 
 /**
- * Phase listener that is resposible for seam managed transactions. It is also
- * resposible for setting the correct flush mode on the persistence context
+ * Phase listener that is responsible for seam managed transactions. It is also
+ * responsible for setting the correct flush mode on the persistence context
  * during the render response phase
  * 
  * @author Stuart Douglas
@@ -169,7 +169,7 @@
 
    private boolean seamManagedTransactionStatus(PhaseId phase)
    {
-      SeamManagedTransaction an = dataStore.getData(SeamManagedTransaction.class);
+      SeamManagedTransaction an = dataStore.getDataForCurrentViewId(SeamManagedTransaction.class);
       SeamManagedTransactionType config;
       if (an == null)
       {



More information about the seam-commits mailing list