directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1208388 - /directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifMasterTable.java
Date Wed, 30 Nov 2011 11:27:52 GMT
Author: saya
Date: Wed Nov 30 11:27:51 2011
New Revision: 1208388

URL: http://svn.apache.org/viewvc?rev=1208388&view=rev
Log:
Master table for the multi file ldif partition. Forgot to check in the previous round.

Added:
    directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifMasterTable.java

Added: directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifMasterTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifMasterTable.java?rev=1208388&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifMasterTable.java
(added)
+++ directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifMasterTable.java
Wed Nov 30 11:27:51 2011
@@ -0,0 +1,81 @@
+
+package org.apache.directory.server.core.partition.ldif;
+
+import java.util.Comparator;
+import java.util.UUID;
+
+import org.apache.directory.server.core.api.partition.index.UUIDComparator;
+import org.apache.directory.server.xdbm.impl.avl.AvlMasterTable;
+import org.apache.directory.shared.ldap.model.entry.Entry;
+
+public class LdifMasterTable extends AvlMasterTable
+{
+    /** partition of the table */
+    private LdifPartition partition;
+
+    
+    public LdifMasterTable( LdifPartition partition )
+    {
+        super( partition.getId(), UUIDComparator.INSTANCE, null, false );
+        this.partition = partition;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void put( UUID key, Entry entry ) throws Exception
+    {
+        if ( key == null )
+        {
+            return;
+        }
+        
+        Entry existingEntry = get( key );
+        
+        if ( existingEntry != null )
+        {
+            // Remove existing entry
+            partition.deleteEntry( existingEntry);
+        }
+        
+        // Write the new entry
+        partition.writeEntry( entry );
+        
+        super.put( key, entry );
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void remove( UUID key ) throws Exception
+    {
+        if ( key == null )
+        {
+            return;
+        }
+       
+        Entry existingEntry = get( key );
+        
+        if ( existingEntry != null )
+        {
+            // Remove existing entry
+            partition.deleteEntry( existingEntry);
+        }
+        
+        super.remove( key );
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void remove( UUID key, Entry entry ) throws Exception
+    {
+        // Remove existing entry
+        partition.deleteEntry( entry);
+        
+        super.remove( key, entry );
+    }
+}



Mime
View raw message