directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1227501 - in /directory/apacheds/branches/apacheds-txns: core-api/src/main/java/org/apache/directory/server/core/api/txn/ core-api/src/main/java/org/apache/directory/server/core/api/txn/logedit/ core-shared/src/main/java/org/apache/directo...
Date Thu, 05 Jan 2012 06:31:47 GMT
Author: elecharny
Date: Thu Jan  5 06:31:46 2012
New Revision: 1227501

URL: http://svn.apache.org/viewvc?rev=1227501&view=rev
Log:
o Added some missing Javadoc
o Some reformating accordingly to the code style we use
o Added some class headers
o Used for (T t : ts) instead of iterators
o Removed the useless AbstractDataChange
o Added some toString() methods

Modified:
    directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/TxnLogManager.java
    directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/logedit/EntryModification.java
    directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/logedit/IndexModification.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/MasterTableWrapper.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/DataChangeContainer.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/EntryAddDelete.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/EntryChange.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/EntryReplace.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/IndexChange.java

Modified: directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/TxnLogManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/TxnLogManager.java?rev=1227501&r1=1227500&r2=1227501&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/TxnLogManager.java
(original)
+++ directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/TxnLogManager.java
Thu Jan  5 06:31:46 2012
@@ -19,22 +19,22 @@
  */
 package org.apache.directory.server.core.api.txn;
 
+
+import java.io.IOException;
+import java.util.Comparator;
+import java.util.UUID;
+
+import org.apache.directory.server.core.api.log.UserLogRecord;
 import org.apache.directory.server.core.api.partition.index.Index;
-import org.apache.directory.server.core.api.partition.index.IndexCursor;
 import org.apache.directory.server.core.api.partition.index.IndexComparator;
+import org.apache.directory.server.core.api.partition.index.IndexCursor;
 import org.apache.directory.server.core.api.partition.index.IndexEntry;
 import org.apache.directory.server.core.api.partition.index.MasterTable;
 import org.apache.directory.server.core.api.txn.logedit.LogEdit;
-
-import org.apache.directory.server.core.api.log.UserLogRecord;
 import org.apache.directory.shared.ldap.model.entry.Entry;
-import org.apache.directory.shared.ldap.model.name.Dn;
-
 import org.apache.directory.shared.ldap.model.message.SearchScope;
+import org.apache.directory.shared.ldap.model.name.Dn;
 
-import java.io.IOException;
-import java.util.Comparator;
-import java.util.UUID;
 
 /**
  * 
@@ -50,8 +50,8 @@ public interface TxnLogManager
      * @throws IOException 
      */
     void log( LogEdit logEdit, boolean sync ) throws Exception;
-    
-    
+
+
     /**
      * Logs the given log record for the txn associated with the current thread
      *
@@ -60,20 +60,21 @@ public interface TxnLogManager
      * @throws Exception 
      */
     void log( UserLogRecord logRecord, boolean sync ) throws Exception;
-    
+
+
     /**
      * Provide a transactionally consistent view on the entry identified
      * by the partitionDn+entryID by applying the necessary updates from the txn log
      * to the entry. 
      *
      * @param partitionDN dn of the partition the entry lives in
-     * @param entryID id of the entry
      * @param entry current version of the entry the txn has
      * @return
      */
     Entry mergeUpdates(Dn partitionDN, UUID entryID,  Entry entry );
     
 
+
     /**
      * Checks all the updates done on the given index for the given key and returns 
      * the latest version of the coressponding id
@@ -84,9 +85,10 @@ public interface TxnLogManager
      * @param valueComp value comparator
      * @return id corresponding to the key
      */
-    UUID mergeForwardLookup(Dn partitionDN, String attributeOid,  Object key, UUID curId,
Comparator<Object> valueComparator );
-    
-    
+    UUID mergeForwardLookup( Dn partitionDN, String attributeOid, Object key, UUID curId,
+        Comparator<Object> valueComparator );
+
+
     /**
      * Checks all the updates done on the given index for the given id and returns 
      * the latest version of the corressponding value
@@ -96,9 +98,9 @@ public interface TxnLogManager
      * @param id key to do the lookup on 
      * @return value corresponding to the id
      */
-    Object mergeReversLookup(Dn partitionDN, String attributeOid,  UUID id, Object curValue
);
-    
-    
+    Object mergeReversLookup( Dn partitionDN, String attributeOid, UUID id, Object curValue
);
+
+
     /**
      * Checks all the updates on the given index entry and returns whether the it exists
or not
      *
@@ -108,9 +110,9 @@ public interface TxnLogManager
      * @param currentlyExists true if the index entry currently exists in the underlying
partition
      * @return true if the given index entry exists
      */
-    boolean mergeExistence(Dn partitionDN, String attributeOid,  IndexEntry<?> indexEntry,
boolean currentlyExists );
+    boolean mergeExistence( Dn partitionDN, String attributeOid, IndexEntry<?> indexEntry,
boolean currentlyExists );
+
 
-    
     /**
      * Returns a cursor which provides a transactionally consistent view of the wrapped cursor.
      *
@@ -124,8 +126,10 @@ public interface TxnLogManager
      * @return a cursor which provides a transactionally consistent view of the wrapped cursor

      * @throws Exception
      */
-    IndexCursor<?> wrap( Dn partitionDn, IndexCursor<Object> wrappedCursor, IndexComparator<Object>
comparator, String attributeOid, boolean forwardIndex, Object onlyValueKey, UUID onlyIDKey
) throws Exception;
-    
+    IndexCursor<?> wrap( Dn partitionDn, IndexCursor<Object> wrappedCursor, IndexComparator<Object>
comparator,
+        String attributeOid, boolean forwardIndex, Object onlyValueKey, UUID onlyIDKey )
throws Exception;
+
+
     /**
      * Returns an index which a provides a transactionally consistent view over the given
index
      *
@@ -135,8 +139,8 @@ public interface TxnLogManager
      * @throws Exception
      */
     Index<?> wrap( Dn partitionDn, Index<?> wrappedIndex ) throws Exception;
-    
-    
+
+
     /**
      * Returns a transactionally consistent view of the master table
      *
@@ -147,7 +151,7 @@ public interface TxnLogManager
      */
     MasterTable wrap( Dn partitionDn, MasterTable wrappedTable ) throws Exception;
 
-    
+
     /**
      * Adds a dn and a scope on which the current txn depens
      *
@@ -155,8 +159,8 @@ public interface TxnLogManager
      * @param scope scope of the dependency
      */
     void addRead( Dn baseDn, SearchScope scope );
-    
-    
+
+
     /**
      * Adds a dn and a scope which the current txn affected through
      * a modification

Modified: directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/logedit/EntryModification.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/logedit/EntryModification.java?rev=1227501&r1=1227500&r2=1227501&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/logedit/EntryModification.java
(original)
+++ directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/logedit/EntryModification.java
Thu Jan  5 06:31:46 2012
@@ -19,12 +19,29 @@
  */
 package org.apache.directory.server.core.api.txn.logedit;
 
+
 import java.util.UUID;
 
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.shared.ldap.model.entry.Entry;
 
+
+/**
+ * An interface to expose the applyModification method for all the Entry Change instances.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
 public interface EntryModification extends DataChange
 {
+    /**
+     * Apply the modification to the ChangeEntry
+     * 
+     * @param partition The partition in which the entry is stored
+     * @param curEntry The current entry which will be modified
+     * @param entrId The entry UUID
+     * @param changeLsn The LSN 
+     * @param recovery If we are in recovery mode
+     * @return The modified entry
+     */
     Entry applyModification( Partition partition, Entry curEntry, UUID entrId, long changeLsn,
boolean recovery );
 }

Modified: directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/logedit/IndexModification.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/logedit/IndexModification.java?rev=1227501&r1=1227500&r2=1227501&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/logedit/IndexModification.java
(original)
+++ directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/logedit/IndexModification.java
Thu Jan  5 06:31:46 2012
@@ -19,9 +19,22 @@
  */
 package org.apache.directory.server.core.api.txn.logedit;
 
+
 import org.apache.directory.server.core.api.partition.Partition;
 
+
+/**
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
 public interface IndexModification extends DataChange
 {
+    /**
+     * Apply the modification to the index for a given partition. 
+     * 
+     * @param partition The partition for which we must update the index
+     * @param recovery Tells if we will update the forward and reverse index
+     * @throws Exception If the operation failed
+     */
     void applyModification( Partition partition, boolean recovery ) throws Exception;
 }

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/MasterTableWrapper.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/MasterTableWrapper.java?rev=1227501&r1=1227500&r2=1227501&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/MasterTableWrapper.java
(original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/MasterTableWrapper.java
Thu Jan  5 06:31:46 2012
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.server.core.shared.txn;
 
+
 import java.util.Comparator;
 import java.util.UUID;
 
@@ -26,10 +27,10 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.txn.TxnLogManager;
 import org.apache.directory.shared.ldap.model.cursor.Cursor;
 import org.apache.directory.shared.ldap.model.cursor.Tuple;
-
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.name.Dn;
 
+
 /**
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
@@ -38,22 +39,22 @@ public class MasterTableWrapper implemen
 {
     /** Wrapped master table */
     private MasterTable wrappedTable;
-    
+
     /** partition the table belongs to */
     private Dn partitionDn;
-    
+
     /** Txn log manager */
     private TxnLogManager logManager;
-    
-    
+
+
     public MasterTableWrapper( TxnManagerFactory txnManagerFactory, Dn partitionDn, MasterTable
wrappedTable )
     {
         this.partitionDn = partitionDn;
         this.wrappedTable = wrappedTable;
         logManager = txnManagerFactory.txnLogManagerInstance();
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -70,8 +71,8 @@ public class MasterTableWrapper implemen
     {
         wrappedTable.resetCounter();
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -95,7 +96,7 @@ public class MasterTableWrapper implemen
      */
     public String getName()
     {
-       return wrappedTable.getName(); 
+        return wrappedTable.getName();
     }
 
 
@@ -123,7 +124,7 @@ public class MasterTableWrapper implemen
     public boolean has( UUID key, Entry value ) throws Exception
     {
         Entry stored = get( key );
-        
+
         return ( ( stored != null ) && stored.equals( value ) );
     }
 
@@ -173,10 +174,10 @@ public class MasterTableWrapper implemen
         {
             return null;
         }
-        
+
         Entry originalEntry = wrappedTable.get( key );
         Entry entry = logManager.mergeUpdates( partitionDn, key, originalEntry );
-        
+
         return entry;
     }
 
@@ -186,7 +187,7 @@ public class MasterTableWrapper implemen
      */
     public void put( UUID key, Entry value ) throws Exception
     {
-        wrappedTable.put( key, value ); 
+        wrappedTable.put( key, value );
     }
 
 
@@ -195,7 +196,7 @@ public class MasterTableWrapper implemen
      */
     public void remove( UUID key ) throws Exception
     {
-        wrappedTable.remove( key ); 
+        wrappedTable.remove( key );
     }
 
 
@@ -215,7 +216,7 @@ public class MasterTableWrapper implemen
     {
         return wrappedTable.cursor();
     }
-    
+
 
     /**
      * {@inheritDoc}
@@ -251,7 +252,7 @@ public class MasterTableWrapper implemen
     {
         return wrappedTable.count( key );
     }
-    
+
 
     /**
      * {@inheritDoc}

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/DataChangeContainer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/DataChangeContainer.java?rev=1227501&r1=1227500&r2=1227501&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/DataChangeContainer.java
(original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/DataChangeContainer.java
Thu Jan  5 06:31:46 2012
@@ -41,8 +41,9 @@ import org.apache.directory.shared.ldap.
 
 
 /**
- * A container for index and entry changes. If any entry change is contained, then they are
for a single entry.All changes 
- * contained for an entry belong to a single version and can be atomically applied to the
entry in question.
+ * A container for index and entry changes. If any entry change is contained, then they are

+ * for a single entry. All changes contained for an entry belong to a single version and

+ * can be atomically applied to the entry in question.
  *  
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
@@ -143,7 +144,7 @@ public class DataChangeContainer extends
         boolean entryExisted = false;
         Entry originalEntry = null;
 
-        // TODO find the partition from the dn if changeContainer doesnt have it.
+        // TODO find the partition from the dn if changeContainer doesn't have it.
 
         if ( entryID != null )
         {
@@ -157,22 +158,17 @@ public class DataChangeContainer extends
             }
         }
 
-        Iterator<DataChange> dit = changes.iterator();
-        DataChange nextChange;
-
-        while ( dit.hasNext() )
+        for ( DataChange change : changes )
         {
-            nextChange = dit.next();
-
-            if ( ( nextChange instanceof EntryModification ) )
+            if ( ( change instanceof EntryModification ) )
             {
-                EntryModification entryModification = ( EntryModification ) nextChange;
+                EntryModification entryModification = ( EntryModification ) change;
 
                 curEntry = entryModification.applyModification( partition, curEntry, entryID,
changeLsn, false );
             }
             else
             {
-                IndexModification indexModification = ( IndexModification ) nextChange;
+                IndexModification indexModification = ( IndexModification ) change;
                 indexModification.applyModification( partition, false );
             }
         }
@@ -194,7 +190,8 @@ public class DataChangeContainer extends
 
 
     /**
-     * Applies the updates made by this log edit to the entry identified by the entryID and
partition dn. 
+     * Applies the updates made by this log edit to the entry identified by the entryID 
+     * and partition dn. 
      *
      * @param entryPartitionDn dn of the partition of the entry
      * @param id id of the entry
@@ -230,16 +227,12 @@ public class DataChangeContainer extends
         if ( applyChanges )
         {
             long changeLsn = getLogAnchor().getLogLSN();
-            Iterator<DataChange> dit = changes.iterator();
-            DataChange nextChange;
 
-            while ( dit.hasNext() )
+            for ( DataChange change : changes )
             {
-                nextChange = dit.next();
-
-                if ( nextChange instanceof EntryModification )
+                if ( change instanceof EntryModification )
                 {
-                    EntryModification entryModification = ( EntryModification ) nextChange;
+                    EntryModification entryModification = ( EntryModification ) change;
 
                     if ( needToCloneOnChange )
                     {

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/EntryAddDelete.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/EntryAddDelete.java?rev=1227501&r1=1227500&r2=1227501&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/EntryAddDelete.java
(original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/EntryAddDelete.java
Thu Jan  5 06:31:46 2012
@@ -26,17 +26,17 @@ import java.io.ObjectOutput;
 import java.util.UUID;
 
 import org.apache.directory.server.core.api.partition.Partition;
-import org.apache.directory.server.core.api.txn.logedit.AbstractDataChange;
 import org.apache.directory.server.core.api.txn.logedit.EntryModification;
 import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.model.entry.Entry;
 
 
 /**
+ * A Change class for entry addition or deletion
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class EntryAddDelete extends AbstractDataChange implements EntryModification
+public class EntryAddDelete implements EntryModification
 {
     /** Added or deleted entry */
     private Entry entry;
@@ -76,7 +76,7 @@ public class EntryAddDelete extends Abst
      */
     public Entry applyModification( Partition partition, Entry curEntry, UUID entryId, long
changeLsn, boolean recovery )
     {
-        if ( type == EntryAddDelete.Type.ADD )
+        if ( type == Type.ADD )
         {
             if ( curEntry != null )
             {
@@ -139,11 +139,14 @@ public class EntryAddDelete extends Abst
     }
 
 
+    /**
+     * @see Object#toString()
+     */
     public String toString()
     {
         StringBuilder sb = new StringBuilder();
 
-        sb.append( "EntryAddDelete change : " );
+        sb.append( "EntryAddDelete : " );
         sb.append( type );
 
         if ( type == Type.ADD )

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/EntryChange.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/EntryChange.java?rev=1227501&r1=1227500&r2=1227501&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/EntryChange.java
(original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/EntryChange.java
Thu Jan  5 06:31:46 2012
@@ -19,66 +19,71 @@
  */
 package org.apache.directory.server.core.shared.txn.logedit;
 
+
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.util.UUID;
 
 import org.apache.directory.server.core.api.partition.Partition;
-import org.apache.directory.server.core.api.txn.logedit.AbstractDataChange;
 import org.apache.directory.server.core.api.txn.logedit.EntryModification;
 import org.apache.directory.shared.ldap.model.entry.AttributeUtils;
+import org.apache.directory.shared.ldap.model.entry.DefaultModification;
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.entry.Modification;
-import org.apache.directory.shared.ldap.model.entry.DefaultModification;
 import org.apache.directory.shared.ldap.model.exception.LdapException;
 
+
 /**
+ * A Change class for entry modification.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class EntryChange extends AbstractDataChange implements EntryModification
+public class EntryChange implements EntryModification
 {
     /** redo change */
     private Modification redoChange;
-    
+
     /** undo change */
     private Modification undoChange;
-    
+
+
     //For externalizable
     public EntryChange()
     {
     }
-    
+
+
     public EntryChange( Modification redo, Modification undo )
     {
         redoChange = redo;
         undoChange = undo;
     }
-    
-    
+
+
     public Modification getRedoChange()
     {
         return redoChange;
     }
-    
-    
+
+
     public Modification getUndoChange()
     {
         return undoChange;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
     public Entry applyModification( Partition partition, Entry curEntry, UUID entryId, long
changeLsn, boolean recovery )
     {
         if ( curEntry == null )
-        {   
-            if( recovery == false )
+        {
+            if ( recovery == false )
             {
-                throw new IllegalStateException( "Entry with id:" + entryId + " not found
while applying changes to it" + this );
+                throw new IllegalStateException( "Entry with id:" + entryId + " not found
while applying changes to it"
+                    + this );
             }
             else
             {
@@ -86,9 +91,8 @@ public class EntryChange extends Abstrac
                 return null;
             }
         }
-            
+
         // TODO in reovery mode, check the version of the entry. 
-        
         try
         {
             AttributeUtils.applyModification( curEntry, redoChange );
@@ -97,22 +101,23 @@ public class EntryChange extends Abstrac
         {
             // Shouldnt happen as this change is already verified
             e.printStackTrace();
-            throw new IllegalStateException( "Application of redo change failed:" + entryId
+ "curEntry:" + curEntry + "change:" + redoChange, e );
+            throw new IllegalStateException( "Application of redo change failed:" + entryId
+ "curEntry:" + curEntry
+                + "change:" + redoChange, e );
         }
-        
+
         return curEntry;
     }
-    
-    
+
+
     @Override
     public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException
     {
         redoChange = new DefaultModification();
         redoChange.readExternal( in );
-        
+
         undoChange = new DefaultModification();
         undoChange.readExternal( in );
-        
+
     }
 
 
@@ -122,4 +127,19 @@ public class EntryChange extends Abstrac
         redoChange.writeExternal( out );
         undoChange.writeExternal( out );
     }
+
+
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append( "EntryChange : \n" );
+        sb.append( "redo " ).append( redoChange );
+        sb.append( "undo " ).append( redoChange );
+
+        return sb.toString();
+    }
 }

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/EntryReplace.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/EntryReplace.java?rev=1227501&r1=1227500&r2=1227501&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/EntryReplace.java
(original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/EntryReplace.java
Thu Jan  5 06:31:46 2012
@@ -19,50 +19,58 @@
  */
 package org.apache.directory.server.core.shared.txn.logedit;
 
+
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.util.UUID;
 
 import org.apache.directory.server.core.api.partition.Partition;
-import org.apache.directory.server.core.api.txn.logedit.AbstractDataChange;
 import org.apache.directory.server.core.api.txn.logedit.EntryModification;
 import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
 import org.apache.directory.shared.ldap.model.entry.Entry;
 
-public class EntryReplace extends AbstractDataChange implements EntryModification
+
+/**
+ * A Change class for entry modification
+ *  
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class EntryReplace implements EntryModification
 {
     /** New Entry */
     private Entry newEntry;
-    
+
     /** Old enty */
     private Entry oldEntry;
-    
+
+
     // For externalizable
     public EntryReplace()
     {
-        
+
     }
-    
+
+
     public EntryReplace( Entry newEntry, Entry oldEntry )
     {
         this.newEntry = newEntry;
         this.oldEntry = oldEntry;
     }
-    
-    
+
+
     public Entry getNewEntry()
     {
         return newEntry;
     }
-    
-    
+
+
     public Entry getOldEntry()
     {
         return oldEntry;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -73,34 +81,50 @@ public class EntryReplace extends Abstra
         {
             if ( recovery == false )
             {
-                throw new IllegalStateException(" Trying to replace a non existing entry:"
+ entryId + " entry:" + newEntry);
+                throw new IllegalStateException( " Trying to replace a non existing entry:"
+ entryId + " entry:"
+                    + newEntry );
             }
             else
             {
                 return null;
             }
         }
-        
+
         // TODO check the version of the entry and see which entry is more recent
         return newEntry;
     }
-    
-    
+
+
     @Override
     public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException
     {
-     newEntry = new DefaultEntry();
-     newEntry.readExternal( in );
-     
-     oldEntry = new DefaultEntry();
-     oldEntry.readExternal( in );
+        newEntry = new DefaultEntry();
+        newEntry.readExternal( in );
+
+        oldEntry = new DefaultEntry();
+        oldEntry.readExternal( in );
     }
 
 
     @Override
     public void writeExternal( ObjectOutput out ) throws IOException
     {
-       newEntry.writeExternal( out );
-       oldEntry.writeExternal( out );
+        newEntry.writeExternal( out );
+        oldEntry.writeExternal( out );
+    }
+
+
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append( "EntryReplace : \n" );
+        sb.append( "   new " ).append( newEntry );
+        sb.append( "   old " ).append( oldEntry );
+
+        return sb.toString();
     }
 }

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/IndexChange.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/IndexChange.java?rev=1227501&r1=1227500&r2=1227501&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/IndexChange.java
(original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/IndexChange.java
Thu Jan  5 06:31:46 2012
@@ -27,15 +27,15 @@ import java.util.UUID;
 
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.api.partition.index.Index;
-import org.apache.directory.server.core.api.txn.logedit.AbstractDataChange;
 import org.apache.directory.server.core.api.txn.logedit.IndexModification;
 
 
 /**
+ * A Change class for index modification
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class IndexChange extends AbstractDataChange implements IndexModification
+public class IndexChange implements IndexModification
 {
     /** Index this change is done on */
     private transient Index<?> index;
@@ -117,7 +117,8 @@ public class IndexChange extends Abstrac
 
         if ( type == Type.ADD )
         {
-            // During recovery, idex might have already been added. But it should not hurt
to readd the index entry.
+            // During recovery, index might have already been added.
+            // But it should not hurt to read the index entry.
             index.add( key, id );
         }
         else
@@ -135,7 +136,7 @@ public class IndexChange extends Abstrac
 
                 if ( forwardExists != reverseExists )
                 {
-                    // We assume readding the same entry to an index wont hurt
+                    // We assume reading the same entry to an index wont hurt
                     index.add( key, id );
 
                     index.drop( key, id );
@@ -151,7 +152,6 @@ public class IndexChange extends Abstrac
 
 
     @Override
-    @SuppressWarnings("unchecked")
     public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException
     {
         oid = in.readUTF();
@@ -177,6 +177,9 @@ public class IndexChange extends Abstrac
     }
 
 
+    /**
+     * @see Object#toString()
+     */
     public String toString()
     {
         StringBuilder sb = new StringBuilder();



Mime
View raw message