[webbeans-commits] Webbeans SVN: r3502 - in ri/trunk: spi/src/main/java/org/jboss/webbeans/transaction/spi and 1 other directory.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Sat Aug 15 05:40:57 EDT 2009


Author: dallen6
Date: 2009-08-15 05:40:56 -0400 (Sat, 15 Aug 2009)
New Revision: 3502

Added:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/event/Status.java
Modified:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionSynchronizedRunnable.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverMethodImpl.java
   ri/trunk/spi/src/main/java/org/jboss/webbeans/transaction/spi/TransactionServices.java
Log:
Removed the Status enumeration from the TransactionServices SPI

Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/Status.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/Status.java	                        (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/Status.java	2009-08-15 09:40:56 UTC (rev 3502)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.webbeans.event;
+
+/**
+ * An enumeration of the possible outcomes for a transaction.  This is used
+ * to keep track of whether an observer wants to see all events regardless of
+ * the outcome of the transaction or only those transactions which succeed or
+ * fail.
+ * 
+ * @author David Allen
+ *
+ */
+public enum Status
+{
+   ALL, SUCCESS, FAILURE
+}


Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/Status.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionSynchronizedRunnable.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionSynchronizedRunnable.java	2009-08-14 21:37:35 UTC (rev 3501)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionSynchronizedRunnable.java	2009-08-15 09:40:56 UTC (rev 3502)
@@ -20,8 +20,6 @@
 
 import javax.transaction.Synchronization;
 
-import org.jboss.webbeans.transaction.spi.TransactionServices;
-
 /**
  * A JTA transaction sychronization which wraps a Runnable.
  * 
@@ -30,21 +28,21 @@
  */
 public class TransactionSynchronizedRunnable implements Synchronization
 {
-   private final TransactionServices.Status desiredStatus;
+   private final Status desiredStatus;
    private final Runnable task;
    private final boolean before;
 
    public TransactionSynchronizedRunnable(Runnable task, boolean before)
    {
-      this(task, TransactionServices.Status.ALL, before);
+      this(task, Status.ALL, before);
    }
 
-   public TransactionSynchronizedRunnable(Runnable task, TransactionServices.Status desiredStatus)
+   public TransactionSynchronizedRunnable(Runnable task, Status desiredStatus)
    {
       this(task, desiredStatus, false); // Status is only applicable after the transaction
    }
 
-   private TransactionSynchronizedRunnable(Runnable task, TransactionServices.Status desiredStatus, boolean before)
+   private TransactionSynchronizedRunnable(Runnable task, Status desiredStatus, boolean before)
    {
       this.task = task;
       this.desiredStatus = desiredStatus;
@@ -58,7 +56,7 @@
    */
    public void afterCompletion(int status)
    {
-      if ((desiredStatus == TransactionServices.Status.SUCCESS && status == STATUS_COMMITTED) || (desiredStatus == TransactionServices.Status.FAILURE && status != STATUS_COMMITTED) || (desiredStatus == TransactionServices.Status.ALL))
+      if ((desiredStatus == Status.SUCCESS && status == STATUS_COMMITTED) || (desiredStatus == Status.FAILURE && status != STATUS_COMMITTED) || (desiredStatus == Status.ALL))
       {
          task.run();
       }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverMethodImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverMethodImpl.java	2009-08-14 21:37:35 UTC (rev 3501)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverMethodImpl.java	2009-08-15 09:40:56 UTC (rev 3502)
@@ -74,21 +74,21 @@
       DeferredEventNotification<T> deferredEvent = new DeferredEventNotification<T>(event, this);;
 
       Synchronization synchronization = null;
-      if (transactionPhase.equals(transactionPhase.BEFORE_COMPLETION))
+      if (transactionPhase.equals(TransactionPhase.BEFORE_COMPLETION))
       {
          synchronization = new TransactionSynchronizedRunnable(deferredEvent, true);
       }
-      else if (transactionPhase.equals(transactionPhase.AFTER_COMPLETION))
+      else if (transactionPhase.equals(TransactionPhase.AFTER_COMPLETION))
       {
          synchronization = new TransactionSynchronizedRunnable(deferredEvent, false);
       }
-      else if (transactionPhase.equals(transactionPhase.AFTER_SUCCESS))
+      else if (transactionPhase.equals(TransactionPhase.AFTER_SUCCESS))
       {
-         synchronization = new TransactionSynchronizedRunnable(deferredEvent, TransactionServices.Status.SUCCESS);
+         synchronization = new TransactionSynchronizedRunnable(deferredEvent, Status.SUCCESS);
       }
-      else if (transactionPhase.equals(transactionPhase.AFTER_FAILURE))
+      else if (transactionPhase.equals(TransactionPhase.AFTER_FAILURE))
       {
-         synchronization = new TransactionSynchronizedRunnable(deferredEvent, TransactionServices.Status.FAILURE);
+         synchronization = new TransactionSynchronizedRunnable(deferredEvent, Status.FAILURE);
       }
       manager.getServices().get(TransactionServices.class).registerSynchronization(synchronization);
    }

Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/transaction/spi/TransactionServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/transaction/spi/TransactionServices.java	2009-08-14 21:37:35 UTC (rev 3501)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/transaction/spi/TransactionServices.java	2009-08-15 09:40:56 UTC (rev 3502)
@@ -24,15 +24,6 @@
 public interface TransactionServices extends Service
 {
    /**
-    * Possible status conditions for a transaction. This can be used by SPI
-    * providers to keep track for which status an observer is used.
-    */
-   public static enum Status
-   {
-      ALL, SUCCESS, FAILURE
-   }
-
-   /**
     * Registers a synchronization object with the currently executing
     * transaction.
     * 




More information about the weld-commits mailing list