weaver      2004/02/23 16:34:14

  Modified:    
components/persistence/src/java/org/apache/jetspeed/components/persistence/store/ojb/otm
                        OTMTransactionImpl.java OTMStoreImpl.java
  Log:
  clean up
  
  Revision  Changes    Path
  1.2       +34 -45    
jakarta-jetspeed-2/components/persistence/src/java/org/apache/jetspeed/components/persistence/store/ojb/otm/OTMTransactionImpl.java
  
  Index: OTMTransactionImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/persistence/src/java/org/apache/jetspeed/components/persistence/store/ojb/otm/OTMTransactionImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- OTMTransactionImpl.java   22 Feb 2004 22:40:00 -0000      1.1
  +++ OTMTransactionImpl.java   24 Feb 2004 00:34:14 -0000      1.2
  @@ -52,10 +52,8 @@
    * <http://www.apache.org/>.
    */
   package org.apache.jetspeed.components.persistence.store.ojb.otm;
  -
   import java.util.ArrayList;
   import java.util.List;
  -
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.apache.jetspeed.components.persistence.store.PersistenceStore;
  @@ -68,99 +66,91 @@
    * OTMTransactionImpl
    * </p>
    * 
  - * 
  - * @
  - * @author <a href="mailto:[EMAIL PROTECTED]">Scott T. Weaver</a>
  + *  @
  + * @author <a href="mailto:[EMAIL PROTECTED]">Scott T. Weaver </a>
    * @version $ $
  - *
  + *  
    */
   public class OTMTransactionImpl implements Transaction
   {
  -
       private org.apache.ojb.otm.core.Transaction OTMTx;
       private List eventListeners;
       private TransactionEventInvoker invoker;
       private OTMStoreImpl store;
  -    
       private static final Log log = LogFactory.getLog(OTMTransactionImpl.class);
  -
       public OTMTransactionImpl(org.apache.ojb.otm.core.Transaction OTMTx, 
PersistenceStore store)
       {
           if (OTMTx == null)
           {
               throw new IllegalArgumentException("The OTM Transaction cannot be 
null.");
           }
  -
           if (store == null)
           {
               throw new IllegalArgumentException("The PersistenceStore cannot be 
null.");
           }
  -
           this.OTMTx = OTMTx;
           eventListeners = new ArrayList();
           invoker = new TransactionEventInvoker(eventListeners, store);
       }
   
  -    /** 
  +    /**
        * <p>
        * begin
        * </p>
        * 
        * @see org.apache.jetspeed.components.persistence.store.Transaction#begin()
  -     * 
  +     *  
        */
       public void begin()
       {
  -        invoker.beforeBegin();
  -        OTMTx.begin();
  -        invoker.afterBegin();
  -
  +        if (!OTMTx.isInProgress())
  +        {
  +            invoker.beforeBegin();
  +            OTMTx.begin();
  +            invoker.afterBegin();
  +        }
       }
   
  -    /** 
  +    /**
        * <p>
        * commit
        * </p>
        * 
        * @see org.apache.jetspeed.components.persistence.store.Transaction#commit()
  -     * 
  +     *  
        */
       public void commit()
       {
  -     invoker.beforeCommit();
  -        OTMTx.commit();        
  -       // store.setTransaction(null);
  -      //  OTMTx = null;
  +        invoker.beforeCommit();
  +        OTMTx.commit();
  +        // store.setTransaction(null);
  +        //  OTMTx = null;
           invoker.afterCommit();
  -
       }
   
  -    /** 
  +    /**
        * <p>
        * rollback
        * </p>
        * 
        * @see org.apache.jetspeed.components.persistence.store.Transaction#rollback()
  -     * 
  +     *  
        */
       public void rollback()
       {
  -     
  -     if(OTMTx != null && OTMTx.isInProgress())
  -     {
  -                     invoker.beforeRollback();
  -                     OTMTx.rollback();
  -                     invoker.afterRollback();
  -     }        
  -     else
  -     {
  -             log.warn("OTM Transaction was NOT rolled back because no transaction 
was in progress");
  -     }
  -        
  -
  +        if (OTMTx != null && OTMTx.isInProgress())
  +        {
  +            invoker.beforeRollback();
  +            OTMTx.rollback();
  +            invoker.afterRollback();
  +        }
  +        else
  +        {
  +            log.warn("OTM Transaction was NOT rolled back because no transaction 
was in progress");
  +        }
       }
   
  -    /** 
  +    /**
        * <p>
        * isOpen
        * </p>
  @@ -173,7 +163,7 @@
           return OTMTx.isInProgress();
       }
   
  -    /** 
  +    /**
        * <p>
        * getWrappedTransaction
        * </p>
  @@ -186,7 +176,7 @@
           return OTMTx;
       }
   
  -    /** 
  +    /**
        * <p>
        * addEventListener
        * </p>
  @@ -199,17 +189,16 @@
           eventListeners.add(listener);
       }
   
  -    /** 
  +    /**
        * <p>
        * checkpoint
        * </p>
        * 
        * @see 
org.apache.jetspeed.components.persistence.store.Transaction#checkpoint()
  -     * 
  +     *  
        */
       public void checkpoint()
       {
           OTMTx.checkpoint();
       }
  -
   }
  
  
  
  1.2       +1 -6      
jakarta-jetspeed-2/components/persistence/src/java/org/apache/jetspeed/components/persistence/store/ojb/otm/OTMStoreImpl.java
  
  Index: OTMStoreImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/persistence/src/java/org/apache/jetspeed/components/persistence/store/ojb/otm/OTMStoreImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- OTMStoreImpl.java 22 Feb 2004 22:40:00 -0000      1.1
  +++ OTMStoreImpl.java 24 Feb 2004 00:34:14 -0000      1.2
  @@ -459,12 +459,7 @@
               }
           }
   
  -        //        if(OTMConn.getTransaction() != tx.getWrappedTransaction())
  -        //        {
  -        //           
  -        //           
  -        //           tx = new OTMTransactionImpl(OTMConn.getTransaction(), this);
  -        //        }
  +
   
           return tx;
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to