You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2013/09/30 08:34:30 UTC
svn commit: r1527459 - in /directory/apacheds/trunk:
core-annotations/src/main/java/org/apache/directory/server/core/factory/
mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/
mavibot-partition/src/test/java...
Author: elecharny
Date: Mon Sep 30 06:34:29 2013
New Revision: 1527459
URL: http://svn.apache.org/r1527459
Log:
o Using the managed Mavibot BTree
Modified:
directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/MavibotPartitionFactory.java
directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/KeyTupleArrayCursor.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/MavibotMasterTable.java
directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.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
directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/ValueTreeCursor.java
directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotIndexTest.java
directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotMasterTableTest.java
directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotRdnIndexTest.java
directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotStoreTest.java
Modified: directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/MavibotPartitionFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/MavibotPartitionFactory.java?rev=1527459&r1=1527458&r2=1527459&view=diff
==============================================================================
--- directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/MavibotPartitionFactory.java (original)
+++ directory/apacheds/trunk/core-annotations/src/main/java/org/apache/directory/server/core/factory/MavibotPartitionFactory.java Mon Sep 30 06:34:29 2013
@@ -25,7 +25,7 @@ import java.util.Set;
import org.apache.directory.api.ldap.model.entry.Entry;
import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.api.ldap.model.schema.SchemaManager;
-import org.apache.directory.mavibot.btree.RecordManager;
+import org.apache.directory.mavibot.btree.managed.RecordManager;
import org.apache.directory.server.core.api.DnFactory;
import org.apache.directory.server.core.api.partition.Partition;
import org.apache.directory.server.core.partition.impl.btree.mavibot.MavibotIndex;
Modified: directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/KeyTupleArrayCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/KeyTupleArrayCursor.java?rev=1527459&r1=1527458&r2=1527459&view=diff
==============================================================================
--- directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/KeyTupleArrayCursor.java (original)
+++ directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/KeyTupleArrayCursor.java Mon Sep 30 06:34:29 2013
@@ -27,8 +27,8 @@ import org.apache.directory.api.ldap.mod
import org.apache.directory.api.ldap.model.cursor.InvalidCursorPositionException;
import org.apache.directory.api.ldap.model.cursor.Tuple;
import org.apache.directory.api.ldap.model.exception.LdapException;
+import org.apache.directory.mavibot.btree.managed.BTree;
import org.apache.directory.server.i18n.I18n;
-import org.apache.directory.mavibot.btree.BTree;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -48,7 +48,7 @@ public class KeyTupleArrayCursor<K, V> e
/** Speedup for logs */
private static final boolean IS_DEBUG = LOG_CURSOR.isDebugEnabled();
- private final org.apache.directory.mavibot.btree.Cursor<V,V> wrapped;
+ private final org.apache.directory.mavibot.btree.Cursor<V, V> wrapped;
private final K key;
private Tuple<K, V> returnedTuple = new Tuple<K, V>();
@@ -61,19 +61,19 @@ public class KeyTupleArrayCursor<K, V> e
* @param arrayTree the ArrayTree to build a Tuple returning Cursor over
* @param key the constant key for which values are returned
*/
- public KeyTupleArrayCursor( BTree<V,V> arrayTree, K key )
+ public KeyTupleArrayCursor( BTree<V, V> arrayTree, K key )
{
this.key = key;
-
+
try
{
this.wrapped = arrayTree.browse();
}
- catch( IOException e )
+ catch ( IOException e )
{
throw new RuntimeException( e );
}
-
+
if ( IS_DEBUG )
{
LOG_CURSOR.debug( "Creating KeyTupleArrayCursor {}", this );
@@ -182,25 +182,25 @@ public class KeyTupleArrayCursor<K, V> e
public boolean previous() throws LdapException, CursorException
{
checkNotClosed( "previous()" );
-
+
try
{
- if ( wrapped.hasPrev() )
- {
- org.apache.directory.mavibot.btree.Tuple<V, V> t = wrapped.prev();
- returnedTuple.setKey( key );
- returnedTuple.setValue( t.getKey() );
- return valueAvailable = true;
- }
- else
- {
- clearValue();
- return false;
- }
+ if ( wrapped.hasPrev() )
+ {
+ org.apache.directory.mavibot.btree.Tuple<V, V> t = wrapped.prev();
+ returnedTuple.setKey( key );
+ returnedTuple.setValue( t.getKey() );
+ return valueAvailable = true;
+ }
+ else
+ {
+ clearValue();
+ return false;
+ }
}
- catch( IOException e )
+ catch ( IOException e )
{
- throw new CursorException( e );
+ throw new CursorException( e );
}
}
@@ -213,22 +213,22 @@ public class KeyTupleArrayCursor<K, V> e
checkNotClosed( "next()" );
try
{
- if ( wrapped.hasNext() )
- {
- org.apache.directory.mavibot.btree.Tuple<V, V> t = wrapped.next();
- returnedTuple.setKey( key );
- returnedTuple.setValue( t.getKey() );
- return valueAvailable = true;
- }
- else
- {
- clearValue();
- return false;
- }
+ if ( wrapped.hasNext() )
+ {
+ org.apache.directory.mavibot.btree.Tuple<V, V> t = wrapped.next();
+ returnedTuple.setKey( key );
+ returnedTuple.setValue( t.getKey() );
+ return valueAvailable = true;
+ }
+ else
+ {
+ clearValue();
+ return false;
+ }
}
- catch( IOException e )
+ catch ( IOException e )
{
- throw new CursorException( e );
+ throw new CursorException( e );
}
}
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=1527459&r1=1527458&r2=1527459&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 Mon Sep 30 06:34:29 2013
@@ -30,9 +30,8 @@ import org.apache.directory.api.ldap.mod
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.UuidComparator;
-import org.apache.directory.server.i18n.I18n;
-import org.apache.directory.mavibot.btree.RecordManager;
import org.apache.directory.mavibot.btree.serializer.StringSerializer;
+import org.apache.directory.server.i18n.I18n;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -107,10 +106,12 @@ public class MavibotDnIndex extends Mavi
DnSerializer dnSerializer = new DnSerializer();
String forwardTableName = attributeType.getOid() + FORWARD_BTREE;
- forward = new MavibotTable<Dn, String>( recordMan, schemaManager, forwardTableName, dnSerializer, new StringSerializer(), false );
+ forward = new MavibotTable<Dn, String>( recordMan, schemaManager, forwardTableName, dnSerializer,
+ new StringSerializer(), false );
String reverseTableName = attributeType.getOid() + REVERSE_BTREE;
- reverse = new MavibotTable<String, Dn>( recordMan, schemaManager, reverseTableName, new StringSerializer(), dnSerializer, !attributeType.isSingleValued() );
+ reverse = new MavibotTable<String, Dn>( recordMan, schemaManager, reverseTableName, new StringSerializer(),
+ dnSerializer, !attributeType.isSingleValued() );
String path = new File( this.wkDirPath, attributeType.getOid() ).getAbsolutePath();
// finally write a text file in the format <OID>-<attribute-name>.txt
@@ -119,5 +120,5 @@ public class MavibotDnIndex extends Mavi
fw.write( attributeType.toString() );
fw.close();
}
-
+
}
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=1527459&r1=1527458&r2=1527459&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 Mon Sep 30 06:34:29 2013
@@ -35,7 +35,7 @@ import org.apache.directory.api.ldap.mod
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.mavibot.btree.RecordManager;
+import org.apache.directory.mavibot.btree.managed.RecordManager;
import org.apache.directory.mavibot.btree.serializer.ByteArraySerializer;
import org.apache.directory.mavibot.btree.serializer.ElementSerializer;
import org.apache.directory.mavibot.btree.serializer.StringSerializer;
@@ -109,7 +109,7 @@ public class MavibotIndex<K, V> extends
public void init( SchemaManager schemaManager, AttributeType attributeType ) throws IOException
{
LOG.debug( "Initializing an Index for attribute '{}'", attributeType.getName() );
-
+
// check if the RecordManager reference is null, if yes, then throw an IllegalStateException
if ( recordMan == null )
{
@@ -214,7 +214,7 @@ public class MavibotIndex<K, V> extends
fw.close();
}
-
+
/**
* Sets the RecordManager
*
@@ -224,8 +224,8 @@ public class MavibotIndex<K, V> extends
{
this.recordMan = rm;
}
-
-
+
+
// ------------------------------------------------------------------------
// C O N F I G U R A T I O N M E T H O D S
// ------------------------------------------------------------------------
Modified: directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotMasterTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotMasterTable.java?rev=1527459&r1=1527458&r2=1527459&view=diff
==============================================================================
--- directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotMasterTable.java (original)
+++ directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotMasterTable.java Mon Sep 30 06:34:29 2013
@@ -25,9 +25,10 @@ import java.util.UUID;
import org.apache.directory.api.ldap.model.entry.Entry;
import org.apache.directory.api.ldap.model.schema.SchemaManager;
-import org.apache.directory.server.xdbm.MasterTable;
-import org.apache.directory.mavibot.btree.RecordManager;
+import org.apache.directory.mavibot.btree.managed.RecordManager;
import org.apache.directory.mavibot.btree.serializer.StringSerializer;
+import org.apache.directory.server.xdbm.MasterTable;
+
/**
* TODO MavibotMasterTable.
Modified: directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java?rev=1527459&r1=1527458&r2=1527459&view=diff
==============================================================================
--- directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java (original)
+++ directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotPartition.java Mon Sep 30 06:34:29 2013
@@ -35,7 +35,7 @@ import org.apache.directory.api.ldap.mod
import org.apache.directory.api.ldap.model.entry.Value;
import org.apache.directory.api.ldap.model.schema.AttributeType;
import org.apache.directory.api.ldap.model.schema.SchemaManager;
-import org.apache.directory.mavibot.btree.RecordManager;
+import org.apache.directory.mavibot.btree.managed.RecordManager;
import org.apache.directory.server.constants.ApacheSchemaConstants;
import org.apache.directory.server.core.api.DnFactory;
import org.apache.directory.server.core.api.partition.Partition;
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=1527459&r1=1527458&r2=1527459&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 Mon Sep 30 06:34:29 2013
@@ -30,11 +30,10 @@ 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.mavibot.btree.serializer.StringSerializer;
import org.apache.directory.server.constants.ApacheSchemaConstants;
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.server.xdbm.ParentIdAndRdn;
-import org.apache.directory.mavibot.btree.RecordManager;
-import org.apache.directory.mavibot.btree.serializer.StringSerializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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=1527459&r1=1527458&r2=1527459&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 Mon Sep 30 06:34:29 2013
@@ -28,11 +28,11 @@ 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.mavibot.btree.BTree;
-import org.apache.directory.mavibot.btree.DuplicateKeyVal;
-import org.apache.directory.mavibot.btree.RecordManager;
import org.apache.directory.mavibot.btree.exception.BTreeAlreadyManagedException;
import org.apache.directory.mavibot.btree.exception.KeyNotFoundException;
+import org.apache.directory.mavibot.btree.managed.BTree;
+import org.apache.directory.mavibot.btree.managed.DuplicateKeyVal;
+import org.apache.directory.mavibot.btree.managed.RecordManager;
import org.apache.directory.mavibot.btree.serializer.ElementSerializer;
import org.apache.directory.server.core.avltree.ArrayMarshaller;
import org.apache.directory.server.core.avltree.ArrayTree;
@@ -215,7 +215,7 @@ public class MavibotTable<K, V> extends
}
DuplicateKeyVal<V> dupHolder = bt.getValues( key );
- if( dupHolder.isSingleValue() )
+ if ( dupHolder.isSingleValue() )
{
int equal = bt.getValueSerializer().compare( val, dupHolder.getSingleValue() );
return ( equal == 0 );
@@ -223,9 +223,9 @@ public class MavibotTable<K, V> extends
else
{
BTree<V, V> dups = dupHolder.getSubTree();
-
+
cursor = dups.browseFrom( val );
-
+
return cursor.hasNext();
}
}
@@ -263,11 +263,11 @@ public class MavibotTable<K, V> extends
DuplicateKeyVal<V> dupHolder = bt.getValues( key );
- if( dupHolder.isSingleValue() )
+ if ( dupHolder.isSingleValue() )
{
return true;
}
-
+
BTree<V, V> dups = dupHolder.getSubTree();
org.apache.directory.mavibot.btree.Cursor<V, V> cursor = null;
@@ -443,11 +443,11 @@ public class MavibotTable<K, V> extends
else
{
DuplicateKeyVal<V> dupHolder = bt.getValues( key );
- if( dupHolder.isSingleValue() )
+ if ( dupHolder.isSingleValue() )
{
- return new SingletonCursor<Tuple<K,V>>( new Tuple<K, V>( key, dupHolder.getSingleValue() ) );
+ return new SingletonCursor<Tuple<K, V>>( new Tuple<K, V>( key, dupHolder.getSingleValue() ) );
}
-
+
BTree<V, V> dups = dupHolder.getSubTree();
return new KeyTupleArrayCursor<K, V>( dups, key );
@@ -483,7 +483,7 @@ public class MavibotTable<K, V> extends
else
{
DuplicateKeyVal<V> dupHolder = bt.getValues( key );
- if( dupHolder.isSingleValue() )
+ if ( dupHolder.isSingleValue() )
{
return new SingletonCursor<V>( dupHolder.getSingleValue() );
}
@@ -517,11 +517,11 @@ public class MavibotTable<K, V> extends
if ( bt.isAllowDuplicates() )
{
DuplicateKeyVal<V> dupHolder = bt.getValues( key );
- if( dupHolder.isSingleValue() )
+ if ( dupHolder.isSingleValue() )
{
return 1;
}
-
+
BTree<V, V> values = dupHolder.getSubTree();
return values.getNbElems();
Modified: directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/ValueTreeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/ValueTreeCursor.java?rev=1527459&r1=1527458&r2=1527459&view=diff
==============================================================================
--- directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/ValueTreeCursor.java (original)
+++ directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/ValueTreeCursor.java Mon Sep 30 06:34:29 2013
@@ -20,13 +20,15 @@
package org.apache.directory.server.core.partition.impl.btree.mavibot;
+
import java.io.IOException;
import org.apache.directory.api.ldap.model.cursor.AbstractCursor;
import org.apache.directory.api.ldap.model.cursor.CursorException;
import org.apache.directory.api.ldap.model.exception.LdapException;
+import org.apache.directory.mavibot.btree.managed.BTree;
import org.apache.directory.server.i18n.I18n;
-import org.apache.directory.mavibot.btree.BTree;
+
/**
* TODO ValueTreeCursor.
@@ -37,109 +39,120 @@ public class ValueTreeCursor<V> extends
{
private org.apache.directory.mavibot.btree.Cursor<V, V> wrapped;
-
+
private V available;
// marker to detect the availability (cause Mavibot supports null values also)
private V NOT_AVAILABLE = ( V ) new Object();
-
- public ValueTreeCursor( BTree<V,V> dupsTree )
+
+
+ public ValueTreeCursor( BTree<V, V> dupsTree )
{
try
{
this.wrapped = dupsTree.browse();
}
- catch( IOException e )
+ catch ( IOException e )
{
throw new RuntimeException( e );
}
}
-
+
+
@Override
public boolean available()
{
return ( available != NOT_AVAILABLE );
}
+
@Override
public void before( V element ) throws LdapException, CursorException
{
throw new UnsupportedOperationException( I18n.err( I18n.ERR_446 ) );
}
+
@Override
public void after( V element ) throws LdapException, CursorException
{
- throw new UnsupportedOperationException( I18n.err( I18n.ERR_446 ) );
+ throw new UnsupportedOperationException( I18n.err( I18n.ERR_446 ) );
}
+
@Override
public void beforeFirst() throws LdapException, CursorException
{
}
+
@Override
public void afterLast() throws LdapException, CursorException
{
- throw new UnsupportedOperationException( I18n.err( I18n.ERR_446 ) );
+ throw new UnsupportedOperationException( I18n.err( I18n.ERR_446 ) );
}
+
@Override
public boolean first() throws LdapException, CursorException
{
throw new UnsupportedOperationException( I18n.err( I18n.ERR_446 ) );
}
+
@Override
public boolean last() throws LdapException, CursorException
{
throw new UnsupportedOperationException( I18n.err( I18n.ERR_446 ) );
}
+
@Override
public boolean previous() throws LdapException, CursorException
{
- try
- {
- if( wrapped.hasPrev() )
- {
- available = wrapped.prev().getKey();
- return true;
- }
- else
- {
- available = NOT_AVAILABLE;
- return false;
- }
- }
- catch( IOException e )
+ try
+ {
+ if ( wrapped.hasPrev() )
+ {
+ available = wrapped.prev().getKey();
+ return true;
+ }
+ else
+ {
+ available = NOT_AVAILABLE;
+ return false;
+ }
+ }
+ catch ( IOException e )
{
- throw new CursorException( e );
+ throw new CursorException( e );
}
}
+
@Override
public boolean next() throws LdapException, CursorException
{
- try
- {
- if( wrapped.hasNext() )
- {
- available = wrapped.next().getKey();
- return true;
- }
- else
- {
- available = NOT_AVAILABLE;
- return false;
- }
- }
- catch( IOException e )
+ try
{
- throw new CursorException( e );
+ if ( wrapped.hasNext() )
+ {
+ available = wrapped.next().getKey();
+ return true;
+ }
+ else
+ {
+ available = NOT_AVAILABLE;
+ return false;
+ }
+ }
+ catch ( IOException e )
+ {
+ throw new CursorException( e );
}
}
+
@Override
public V get() throws CursorException
{
Modified: directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotIndexTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotIndexTest.java?rev=1527459&r1=1527458&r2=1527459&view=diff
==============================================================================
--- directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotIndexTest.java (original)
+++ directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotIndexTest.java Mon Sep 30 06:34:29 2013
@@ -41,9 +41,9 @@ import org.apache.directory.api.ldap.sch
import org.apache.directory.api.ldap.schemamanager.impl.DefaultSchemaManager;
import org.apache.directory.api.util.Strings;
import org.apache.directory.api.util.exception.Exceptions;
+import org.apache.directory.mavibot.btree.managed.RecordManager;
import org.apache.directory.server.xdbm.Index;
import org.apache.directory.server.xdbm.IndexEntry;
-import org.apache.directory.mavibot.btree.RecordManager;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -67,7 +67,8 @@ public class MavibotIndexTest
@Rule
public TemporaryFolder tempFolder = new TemporaryFolder();
-
+
+
@BeforeClass
public static void init() throws Exception
{
@@ -110,7 +111,7 @@ public class MavibotIndexTest
destroyIndex();
recordMan.close();
-
+
if ( ( dbFileDir != null ) && dbFileDir.exists() )
{
FileUtils.deleteDirectory( dbFileDir );
@@ -147,7 +148,7 @@ public class MavibotIndexTest
{
mavibotIdx = new MavibotIndex<String, Entry>( attributeType.getName(), false );
}
-
+
mavibotIdx.setRecordManager( recordMan );
mavibotIdx.init( schemaManager, attributeType );
this.idx = mavibotIdx;
@@ -528,10 +529,12 @@ public class MavibotIndexTest
@Test
public void testSingleValuedAttribute() throws Exception
{
- MavibotIndex<Object, Object> MavibotIndex = new MavibotIndex<Object, Object>( SchemaConstants.CREATORS_NAME_AT, false );
+ MavibotIndex<Object, Object> MavibotIndex = new MavibotIndex<Object, Object>( SchemaConstants.CREATORS_NAME_AT,
+ false );
MavibotIndex.setWkDirPath( dbFileDir.toURI() );
MavibotIndex.setRecordManager( recordMan );
- MavibotIndex.init( schemaManager, schemaManager.lookupAttributeTypeRegistry( SchemaConstants.CREATORS_NAME_AT ) );
+ MavibotIndex
+ .init( schemaManager, schemaManager.lookupAttributeTypeRegistry( SchemaConstants.CREATORS_NAME_AT ) );
MavibotIndex.close();
}
}
Modified: directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotMasterTableTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotMasterTableTest.java?rev=1527459&r1=1527458&r2=1527459&view=diff
==============================================================================
--- directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotMasterTableTest.java (original)
+++ directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotMasterTableTest.java Mon Sep 30 06:34:29 2013
@@ -33,7 +33,7 @@ import org.apache.directory.api.ldap.sch
import org.apache.directory.api.ldap.schemamanager.impl.DefaultSchemaManager;
import org.apache.directory.api.util.Strings;
import org.apache.directory.api.util.exception.Exceptions;
-import org.apache.directory.mavibot.btree.RecordManager;
+import org.apache.directory.mavibot.btree.managed.RecordManager;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -54,14 +54,15 @@ public class MavibotMasterTableTest
private static final Logger LOG = LoggerFactory.getLogger( MavibotMasterTableTest.class );
private MavibotMasterTable table;
-
+
private static SchemaManager schemaManager = null;
private RecordManager recordMan;
@Rule
public TemporaryFolder tmpDir = new TemporaryFolder();
-
+
+
@BeforeClass
public static void loadSchema() throws Exception
{
@@ -87,7 +88,7 @@ public class MavibotMasterTableTest
{
fail( "Schema load failed : " + Exceptions.printErrors( schemaManager.getErrors() ) );
}
-
+
MavibotEntrySerializer.setSchemaManager( schemaManager );
}
@@ -98,7 +99,7 @@ public class MavibotMasterTableTest
destroyTable();
recordMan = new RecordManager( tmpDir.getRoot().getAbsolutePath() );
-
+
table = new MavibotMasterTable( recordMan, schemaManager, "master" );
LOG.debug( "Created new table and populated it with data" );
}
@@ -107,11 +108,11 @@ public class MavibotMasterTableTest
@After
public void destroyTable() throws Exception
{
- if( table == null )
+ if ( table == null )
{
return;
}
-
+
table.close();
}
Modified: directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotRdnIndexTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotRdnIndexTest.java?rev=1527459&r1=1527458&r2=1527459&view=diff
==============================================================================
--- directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotRdnIndexTest.java (original)
+++ directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotRdnIndexTest.java Mon Sep 30 06:34:29 2013
@@ -39,11 +39,11 @@ import org.apache.directory.api.ldap.sch
import org.apache.directory.api.ldap.schemamanager.impl.DefaultSchemaManager;
import org.apache.directory.api.util.Strings;
import org.apache.directory.api.util.exception.Exceptions;
+import org.apache.directory.mavibot.btree.managed.RecordManager;
import org.apache.directory.server.constants.ApacheSchemaConstants;
import org.apache.directory.server.xdbm.Index;
import org.apache.directory.server.xdbm.IndexEntry;
import org.apache.directory.server.xdbm.ParentIdAndRdn;
-import org.apache.directory.mavibot.btree.RecordManager;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -60,14 +60,15 @@ import org.junit.rules.TemporaryFolder;
public class MavibotRdnIndexTest
{
private Index<ParentIdAndRdn, Entry, String> idx;
-
+
private static SchemaManager schemaManager;
private RecordManager recordMan;
@Rule
public TemporaryFolder tmpDir = new TemporaryFolder();
-
+
+
@BeforeClass
public static void init() throws Exception
{
@@ -323,7 +324,6 @@ public class MavibotRdnIndexTest
assertEquals( "cn=key2", e3.getKey().getRdns()[0].getName() );
assertEquals( Strings.getUUID( 2 ), e3.getKey().getParentId() );
-
// test before(Tuple<>)
cursor.before( e3 );
// e3
@@ -339,9 +339,8 @@ public class MavibotRdnIndexTest
assertEquals( Strings.getUUID( 4 ), cursor.get().getId() );
assertFalse( cursor.next() );
-
+
cursor.close();
}
-
}
Modified: directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotStoreTest.java?rev=1527459&r1=1527458&r2=1527459&view=diff
==============================================================================
--- directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotStoreTest.java (original)
+++ directory/apacheds/trunk/mavibot-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotStoreTest.java Mon Sep 30 06:34:29 2013
@@ -53,7 +53,7 @@ import org.apache.directory.api.ldap.sch
import org.apache.directory.api.ldap.schemamanager.impl.DefaultSchemaManager;
import org.apache.directory.api.util.Strings;
import org.apache.directory.api.util.exception.Exceptions;
-import org.apache.directory.mavibot.btree.RecordManager;
+import org.apache.directory.mavibot.btree.managed.RecordManager;
import org.apache.directory.server.constants.ApacheSchemaConstants;
import org.apache.directory.server.core.api.CacheService;
import org.apache.directory.server.core.api.CoreSession;