directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1499335 - in /directory/apacheds/trunk/mavibot-partition: ./ src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/
Date Wed, 03 Jul 2013 11:44:20 GMT
Author: kayyagari
Date: Wed Jul  3 11:44:20 2013
New Revision: 1499335

URL: http://svn.apache.org/r1499335
Log:
o replaced the mavibot comparator with serialized comparator
o updated the version number

Modified:
    directory/apacheds/trunk/mavibot-partition/pom.xml
    directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/DnSerializer.java
    directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotDnIndex.java
    directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotIndex.java
    directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotRdnIndex.java
    directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotTable.java

Modified: directory/apacheds/trunk/mavibot-partition/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mavibot-partition/pom.xml?rev=1499335&r1=1499334&r2=1499335&view=diff
==============================================================================
--- directory/apacheds/trunk/mavibot-partition/pom.xml (original)
+++ directory/apacheds/trunk/mavibot-partition/pom.xml Wed Jul  3 11:44:20 2013
@@ -21,7 +21,7 @@
   <parent>
     <groupId>org.apache.directory.server</groupId>
     <artifactId>apacheds-parent</artifactId>
-    <version>2.0.0-M14-SNAPSHOT</version>
+    <version>2.0.0-M15-SNAPSHOT</version>
   </parent>
   <artifactId>apacheds-mavibot-partition</artifactId>
   <name>ApacheDS Mavibot Partition</name>

Modified: directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/DnSerializer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/DnSerializer.java?rev=1499335&r1=1499334&r2=1499335&view=diff
==============================================================================
--- directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/DnSerializer.java
(original)
+++ directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/DnSerializer.java
Wed Jul  3 11:44:20 2013
@@ -60,16 +60,24 @@ public class DnSerializer extends Abstra
     private static Comparator<Dn> comp = new Comparator<Dn>()
     {
         @Override
-        public int compare( Dn dn0, Dn dn1 )
+        public int compare( Dn dn1, Dn dn2 )
         {
-            if ( dn0.equals( dn1 ) )
+            if ( dn1 == null )
             {
-                return 0;
+                if ( dn2 == null )
+                {
+                    return 0;
+                }
+
+                return -1;
             }
-            else
+
+            if ( dn2 == null )
             {
-                return -1;
+                return 1;
             }
+
+            return dn1.getNormName().compareTo( dn2.getNormName() );
         }
     };
 

Modified: directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotDnIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotDnIndex.java?rev=1499335&r1=1499334&r2=1499335&view=diff
==============================================================================
--- directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotDnIndex.java
(original)
+++ directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotDnIndex.java
Wed Jul  3 11:44:20 2013
@@ -70,8 +70,6 @@ public class MavibotDnIndex extends Mavi
         if ( this.wkDirPath == null )
         {
             NullPointerException e = new NullPointerException( "The index working directory
has not be set" );
-
-            e.printStackTrace();
             throw e;
         }
 

Modified: directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotIndex.java?rev=1499335&r1=1499334&r2=1499335&view=diff
==============================================================================
--- directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotIndex.java
(original)
+++ directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotIndex.java
Wed Jul  3 11:44:20 2013
@@ -32,6 +32,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.schema.AttributeType;
 import org.apache.directory.api.ldap.model.schema.MatchingRule;
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
+import org.apache.directory.api.ldap.model.schema.comparators.SerializableComparator;
 import org.apache.directory.server.core.partition.impl.btree.IndexCursorAdaptor;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.server.xdbm.AbstractIndex;
@@ -119,8 +120,6 @@ public class MavibotIndex<K, V> extends 
         if ( this.wkDirPath == null )
         {
             NullPointerException e = new NullPointerException( "The index working directory
has not be set" );
-
-            e.printStackTrace();
             throw e;
         }
 
@@ -155,6 +154,9 @@ public class MavibotIndex<K, V> extends 
             throw new IOException( I18n.err( I18n.ERR_574, attributeType.getName() ) );
         }
 
+        SerializableComparator<K> comp = new SerializableComparator<K>( mr.getOid()
);
+        comp.setSchemaManager( schemaManager );
+        
         /*
          * The forward key/value map stores attribute values to master table
          * primary keys.  A value for an attribute can occur several times in
@@ -165,11 +167,11 @@ public class MavibotIndex<K, V> extends 
 
         if ( !attributeType.getSyntax().isHumanReadable() )
         {
-            forwardKeySerializer = ( ElementSerializer<K> ) new ByteArraySerializer();
+            forwardKeySerializer = ( ElementSerializer<K> ) new ByteArraySerializer(
comp );
         }
         else
         {
-            forwardKeySerializer = ( ElementSerializer<K> ) new StringSerializer();
+            forwardKeySerializer = ( ElementSerializer<K> ) new StringSerializer( comp
);
         }
 
         String forwardTableName = attributeType.getOid() + FORWARD_BTREE;

Modified: directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotRdnIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotRdnIndex.java?rev=1499335&r1=1499334&r2=1499335&view=diff
==============================================================================
--- directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotRdnIndex.java
(original)
+++ directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotRdnIndex.java
Wed Jul  3 11:44:20 2013
@@ -72,8 +72,6 @@ public class MavibotRdnIndex extends Mav
         if ( this.wkDirPath == null )
         {
             NullPointerException e = new NullPointerException( "The index working directory
has not be set" );
-
-            e.printStackTrace();
             throw e;
         }
 

Modified: directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotTable.java?rev=1499335&r1=1499334&r2=1499335&view=diff
==============================================================================
--- directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotTable.java
(original)
+++ directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotTable.java
Wed Jul  3 11:44:20 2013
@@ -21,6 +21,7 @@ package org.apache.directory.server.core
 
 
 import java.io.IOException;
+import java.util.Comparator;
 
 import org.apache.directory.api.ldap.model.cursor.Cursor;
 import org.apache.directory.api.ldap.model.cursor.EmptyCursor;
@@ -28,6 +29,7 @@ import org.apache.directory.api.ldap.mod
 import org.apache.directory.api.ldap.model.cursor.Tuple;
 import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
+import org.apache.directory.api.ldap.model.schema.comparators.SerializableComparator;
 import org.apache.directory.server.core.avltree.ArrayMarshaller;
 import org.apache.directory.server.core.avltree.ArrayTree;
 import org.apache.directory.server.i18n.I18n;
@@ -76,6 +78,13 @@ public class MavibotTable<K, V> extends 
                 throw new RuntimeException( e );
             }
         }
+        else
+        {
+        	// it is important to set the serializers cause serializers will contain default

+        	// comparators when loaded from disk and we need schema aware comparators in certain
indices
+        	bt.setKeySerializer( keySerializer );
+        	bt.setValueSerializer( valueSerializer );
+        }
         
         this.allowsDuplicates = allowDuplicates;
         arrayMarshaller = new ArrayMarshaller<V>( valueComparator );



Mime
View raw message