directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1199859 - in /directory/apacheds/branches/apacheds-txns/ldif-partition/src: main/java/org/apache/directory/server/core/partition/ldif/ test/java/org/apache/directory/server/core/partition/ldif/
Date Wed, 09 Nov 2011 17:06:35 GMT
Author: saya
Date: Wed Nov  9 17:06:34 2011
New Revision: 1199859

URL: http://svn.apache.org/viewvc?rev=1199859&view=rev
Log:
used Ldif partition to use UUID instead of Long.

Modified:
    directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/AbstractLdifPartition.java
    directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
    directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java
    directory/apacheds/branches/apacheds-txns/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java

Modified: directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/AbstractLdifPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/AbstractLdifPartition.java?rev=1199859&r1=1199858&r2=1199859&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/AbstractLdifPartition.java
(original)
+++ directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/AbstractLdifPartition.java
Wed Nov  9 17:06:34 2011
@@ -50,16 +50,7 @@ public abstract class AbstractLdifPartit
         // @TODO : inject a correct ReplicaId
         defaultCSNFactory = new CsnFactory( 0 );
     }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public Long getDefaultId()
-    {
-        return 1L;
-    }
-
+    
     
     /**
      * {@inheritDoc}

Modified: directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java?rev=1199859&r1=1199858&r2=1199859&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
(original)
+++ directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
Wed Nov  9 17:06:34 2011
@@ -221,7 +221,7 @@ public class LdifPartition extends Abstr
     /**
      * {@inheritDoc}
      */
-    public void delete( Long id ) throws LdapException
+    public void delete( UUID id ) throws LdapException
     {
         Entry entry = lookup( id );
 
@@ -253,7 +253,7 @@ public class LdifPartition extends Abstr
      */
     public void modify( ModifyOperationContext modifyContext ) throws LdapException
     {
-        Long id = getEntryId( modifyContext.getDn() );
+        UUID id = getEntryId( modifyContext.getDn() );
 
         try
         {
@@ -291,7 +291,7 @@ public class LdifPartition extends Abstr
     public void move( MoveOperationContext moveContext ) throws LdapException
     {
         Dn oldDn = moveContext.getDn();
-        Long id = getEntryId( oldDn );
+        UUID id = getEntryId( oldDn );
 
         super.move( moveContext );
 
@@ -308,7 +308,7 @@ public class LdifPartition extends Abstr
     public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws
LdapException
     {
         Dn oldDn = moveAndRenameContext.getDn();
-        Long id = getEntryId( oldDn );
+        UUID id = getEntryId( oldDn );
 
         super.moveAndRename( moveAndRenameContext );
 
@@ -326,7 +326,7 @@ public class LdifPartition extends Abstr
     public void rename( RenameOperationContext renameContext ) throws LdapException
     {
         Dn oldDn = renameContext.getDn();
-        Long id = getEntryId( oldDn );
+        UUID id = getEntryId( oldDn );
 
         // Create the new entry
         super.rename( renameContext );
@@ -351,7 +351,7 @@ public class LdifPartition extends Abstr
      * @param deleteOldEntry a flag to tell whether to delete the old entry files
      * @throws Exception
      */
-    private void entryMoved( Dn oldEntryDn, Entry modifiedEntry, Long entryIdOld ) throws
LdapException
+    private void entryMoved( Dn oldEntryDn, Entry modifiedEntry, UUID entryIdOld ) throws
LdapException
     {
         // First, add the new entry
         addEntry( modifiedEntry );
@@ -359,14 +359,14 @@ public class LdifPartition extends Abstr
         // Then, if there are some children, move then to the new place
         try
         {
-            IndexCursor<Long, Entry, Long> cursor = getSubLevelIndex().forwardCursor(
entryIdOld );
+            IndexCursor<UUID> cursor = getSubLevelIndex().forwardCursor( entryIdOld
);
 
             while ( cursor.next() )
             {
-                IndexEntry<Long, Long> entry = cursor.get();
+                IndexEntry<UUID> entry = cursor.get();
 
                 // except the parent entry add the rest of entries
-                if ( entry.getId() != entryIdOld )
+                if ( entry.getId().compareTo( entryIdOld ) != 0 )
                 {
                     addEntry( lookup( entry.getId() ) );
                 }
@@ -506,7 +506,7 @@ public class LdifPartition extends Abstr
         if ( !dir.exists() && create )
         {
             // We have to create the entry if it does not have a parent
-            if ( !dir.mkdir() )
+            if ( !dir.mkdirs() )
             {
                 throw new LdapException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY,
dir ) );
             }

Modified: directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java?rev=1199859&r1=1199858&r2=1199859&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java
(original)
+++ directory/apacheds/branches/apacheds-txns/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartition.java
Wed Nov  9 17:06:34 2011
@@ -259,7 +259,7 @@ public class SingleFileLdifPartition ext
 
 
     @Override
-    public void delete( Long id ) throws LdapException
+    public void delete( UUID id ) throws LdapException
     {
         synchronized ( lock )
         {
@@ -289,21 +289,21 @@ public class SingleFileLdifPartition ext
             {
                 ldifFile.setLength( 0 ); // wipe the file clean
 
-                Long suffixId = getEntryId( suffixDn );
+                UUID suffixId = getEntryId( suffixDn );
 
                 if( suffixId == null )
                 {
                     return;
                 }
                 
-                IndexCursor<Long, Entry, Long> cursor = getOneLevelIndex().forwardCursor(
suffixId );
+                IndexCursor<UUID> cursor = getOneLevelIndex().forwardCursor( suffixId
);
 
 
                 appendLdif( lookup( suffixId ) );
 
                 while ( cursor.next() )
                 {
-                    Long childId = cursor.get().getId();
+                    UUID childId = cursor.get().getId();
 
                     Entry entry = lookup( childId );
 
@@ -334,15 +334,15 @@ public class SingleFileLdifPartition ext
      * @param cursorMap the open cursor map
      * @throws Exception
      */
-    private void appendRecursive( Long entryId, Map<Long, IndexCursor<Long, Entry,
Long>> cursorMap ) throws Exception
+    private void appendRecursive( UUID entryId, Map<UUID, IndexCursor<UUID>>
cursorMap ) throws Exception
     {
         synchronized ( lock )
         {
 
-            IndexCursor<Long, Entry, Long> cursor = null;
+            IndexCursor<UUID> cursor = null;
             if ( cursorMap == null )
             {
-                cursorMap = new HashMap<Long, IndexCursor<Long, Entry, Long>>();
+                cursorMap = new HashMap<UUID, IndexCursor<UUID>>();
             }
 
             cursor = cursorMap.get( entryId );
@@ -363,10 +363,10 @@ public class SingleFileLdifPartition ext
             {
                 do
                 {
-                    IndexEntry<Long, Long> idxEntry = cursor.get();
+                    IndexEntry<UUID> idxEntry = cursor.get();
                     Entry entry = lookup( idxEntry.getId() );
 
-                    Long childId = getEntryId( entry.getDn() );
+                    UUID childId = getEntryId( entry.getDn() );
 
                     appendLdif( entry );
 

Modified: directory/apacheds/branches/apacheds-txns/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java?rev=1199859&r1=1199858&r2=1199859&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java
(original)
+++ directory/apacheds/branches/apacheds-txns/ldif-partition/src/test/java/org/apache/directory/server/core/partition/ldif/SingleFileLdifPartitionTest.java
Wed Nov  9 17:06:34 2011
@@ -276,7 +276,7 @@ public class SingleFileLdifPartitionTest
 
         partition.add( addCtx );
 
-        Long id = partition.getEntryId( contextEntry.getDn() );
+        UUID id = partition.getEntryId( contextEntry.getDn() );
         assertNotNull( id );
         assertEquals( contextEntry, partition.lookup( id ) );
 
@@ -837,7 +837,7 @@ public class SingleFileLdifPartitionTest
         partition.add( addCtx );
 
         // search works fine
-        Long id = partition.getEntryId( contextEntry.getDn() );
+        UUID id = partition.getEntryId( contextEntry.getDn() );
         assertNotNull( id );
         assertEquals( contextEntry, partition.lookup( id ) );
 



Mime
View raw message