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 2012/01/24 17:15:29 UTC
svn commit: r1235326 [2/28] - in /directory/apacheds/trunk:
jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/
jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/
jdbm-partition...
Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/IndexValueSerializer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/IndexValueSerializer.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/IndexValueSerializer.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/IndexValueSerializer.java Tue Jan 24 16:15:05 2012
@@ -19,6 +19,7 @@
*/
package org.apache.directory.server.core.partition.impl.btree.jdbm;
+
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
@@ -30,13 +31,14 @@ import org.slf4j.LoggerFactory;
import jdbm.btree.BTree;
import jdbm.helper.Serializer;
+
/**
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
public class IndexValueSerializer implements Serializer
{
private static final long serialVersionUID = 1L;
-
+
/** the flag for a Long value*/
private static byte LONG_VALUE = 0;
@@ -49,11 +51,13 @@ public class IndexValueSerializer implem
/** the logger for this class */
private static final Logger LOG = LoggerFactory.getLogger( IndexValueSerializer.class );
+
public Object deserialize( byte[] serialized ) throws IOException
{
return null;
}
+
/**
* Serialize the object. It can be a long, a BTree or an AvlTree
*
@@ -66,21 +70,21 @@ public class IndexValueSerializer implem
if ( obj instanceof ArrayTree )
{
LOG.debug( "Serializing an AvlTree" );
- return serialize( (ArrayTree<?>)obj );
+ return serialize( ( ArrayTree<?> ) obj );
}
else if ( obj instanceof BTree )
{
LOG.debug( "Serializing a BTree" );
- return serialize( (BTree)obj );
+ return serialize( ( BTree ) obj );
}
else
{
LOG.debug( "Serializing a long [{}]", obj );
- return serialize( (Long)obj );
+ return serialize( ( Long ) obj );
}
}
-
+
/**
* Serialize a Long value
*/
@@ -91,10 +95,10 @@ public class IndexValueSerializer implem
// First, write the type
out.write( LONG_VALUE );
-
+
// Now, flush the Long
out.writeLong( value );
-
+
// And return the result
out.flush();
@@ -107,7 +111,7 @@ public class IndexValueSerializer implem
return baos.toByteArray();
}
-
+
/**
* Serialize a BTree value
*/
@@ -118,12 +122,12 @@ public class IndexValueSerializer implem
// First, write the type
out.write( BTREE_VALUE );
-
+
// Marshal the BTree here.
// TODO : add the code
out.flush();
-
+
if ( LOG.isDebugEnabled() )
{
LOG.debug( ">------------------------------------------------" );
@@ -133,7 +137,7 @@ public class IndexValueSerializer implem
return baos.toByteArray();
}
-
+
/**
* Serialize a AvlTree value
*/
@@ -144,7 +148,7 @@ public class IndexValueSerializer implem
// First, write the type
out.write( AVL_TREE_VALUE );
-
+
// Marshal the AvlTree here.
// TODO : add the code
Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java Tue Jan 24 16:15:05 2012
@@ -61,7 +61,7 @@ public class JdbmIndex<K, O> extends Abs
* default duplicate limit before duplicate keys switch to using a btree for values
*/
public static final int DEFAULT_DUPLICATE_LIMIT = 512;
-
+
/** the key used for the forward btree name */
public static final String FORWARD_BTREE = "_forward";
@@ -154,7 +154,7 @@ public class JdbmIndex<K, O> extends Abs
public void init( SchemaManager schemaManager, AttributeType attributeType ) throws IOException
{
LOG.debug( "Initializing an Index for attribute '{}'", attributeType.getName() );
-
+
keyCache = new SynchronizedLRUMap( cacheSize );
this.attributeType = attributeType;
@@ -166,7 +166,7 @@ public class JdbmIndex<K, O> extends Abs
if ( this.wkDirPath == null )
{
NullPointerException e = new NullPointerException( "The index working directory has not be set" );
-
+
e.printStackTrace();
throw e;
}
@@ -193,7 +193,7 @@ public class JdbmIndex<K, O> extends Abs
// write the AttributeType description
fw.write( attributeType.toString() );
fw.close();
-
+
initialized = true;
}
@@ -242,7 +242,8 @@ public class JdbmIndex<K, O> extends Abs
}
else
{
- reverse = new JdbmTable<Long, K>( schemaManager, attributeType.getOid() + REVERSE_BTREE, numDupLimit, recMan,
+ reverse = new JdbmTable<Long, K>( schemaManager, attributeType.getOid() + REVERSE_BTREE, numDupLimit,
+ recMan,
LongComparator.INSTANCE, comp, LongSerializer.INSTANCE, null );
}
}
@@ -383,7 +384,7 @@ public class JdbmIndex<K, O> extends Abs
public synchronized void drop( K attrVal, Long id ) throws Exception
{
K normalizedValue = getNormalized( attrVal );
-
+
// The pair to be removed must exists
if ( forward.has( normalizedValue, id ) )
{
@@ -433,7 +434,7 @@ public class JdbmIndex<K, O> extends Abs
@SuppressWarnings("unchecked")
public IndexCursor<K, O, Long> reverseCursor( Long id ) throws Exception
{
- return new IndexCursorAdaptor<K, O, Long>( (Cursor) reverse.cursor( id ), false );
+ return new IndexCursorAdaptor<K, O, Long>( ( Cursor ) reverse.cursor( id ), false );
}
@@ -643,8 +644,8 @@ public class JdbmIndex<K, O> extends Abs
{
return reverse.isDupsEnabled();
}
-
-
+
+
/**
* @see Object#toString()
*/
Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java Tue Jan 24 16:15:05 2012
@@ -36,75 +36,72 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class JdbmMasterTable<E> extends JdbmTable<Long,E> implements MasterTable<Long, E>
+public class JdbmMasterTable<E> extends JdbmTable<Long, E> implements MasterTable<Long, E>
{
private static final StringComparator STRCOMP = new StringComparator();
-
private static final SerializableComparator<Long> LONG_COMPARATOR =
- new SerializableComparator<Long>( "1.3.6.1.4.1.18060.0.4.1.1.2" )
- {
- private static final long serialVersionUID = 4048791282048841016L;
+ new SerializableComparator<Long>( "1.3.6.1.4.1.18060.0.4.1.1.2" )
+ {
+ private static final long serialVersionUID = 4048791282048841016L;
- public int compare( Long o1, Long o2 )
- {
- if ( o1 == null )
- {
- throw new IllegalArgumentException( I18n.err( I18n.ERR_525 ) );
- }
- else if ( o2 == null )
+ public int compare( Long o1, Long o2 )
{
- throw new IllegalArgumentException( I18n.err( I18n.ERR_526 ) );
- }
+ if ( o1 == null )
+ {
+ throw new IllegalArgumentException( I18n.err( I18n.ERR_525 ) );
+ }
+ else if ( o2 == null )
+ {
+ throw new IllegalArgumentException( I18n.err( I18n.ERR_526 ) );
+ }
- if ( o1 == ( long ) o2 )
- {
- return 0;
- }
-
- if ( o1 == ( long ) o2 )
- {
- return 0;
- }
-
- if ( o1 >= 0 )
- {
- if ( o2 >= 0 )
+ if ( o1 == ( long ) o2 )
{
- return ( o1 > ( long ) o2 ) ? 1 : -1;
+ return 0;
+ }
+
+ if ( o1 == ( long ) o2 )
+ {
+ return 0;
+ }
+
+ if ( o1 >= 0 )
+ {
+ if ( o2 >= 0 )
+ {
+ return ( o1 > ( long ) o2 ) ? 1 : -1;
+ }
+ else
+ {
+ return -1;
+ }
+ }
+ else if ( o2 >= 0 )
+ {
+ return 1;
}
else
{
- return -1;
+ return ( o1 < ( long ) o2 ) ? -1 : 1;
}
}
- else if ( o2 >= 0 )
- {
- return 1;
- }
- else
- {
- return ( o1 < ( long ) o2 ) ? -1 : 1;
- }
- }
- };
-
+ };
private static final SerializableComparator<String> STRING_COMPARATOR =
- new SerializableComparator<String>( "1.3.6.1.4.1.18060.0.4.1.1.3" )
- {
- private static final long serialVersionUID = 3258689922792961845L;
-
-
- public int compare( String o1, String o2 )
+ new SerializableComparator<String>( "1.3.6.1.4.1.18060.0.4.1.1.3" )
{
- return STRCOMP.compare( o1, o2 );
- }
- };
+ private static final long serialVersionUID = 3258689922792961845L;
- protected final JdbmTable<String,String> adminTbl;
+ public int compare( String o1, String o2 )
+ {
+ return STRCOMP.compare( o1, o2 );
+ }
+ };
+
+ protected final JdbmTable<String, String> adminTbl;
/**
@@ -116,24 +113,26 @@ public class JdbmMasterTable<E> extends
*/
public JdbmMasterTable( RecordManager recMan, SchemaManager schemaManager ) throws Exception
{
- super( schemaManager, DBF, recMan, LONG_COMPARATOR, LongSerializer.INSTANCE, new EntrySerializer( schemaManager ) );
- adminTbl = new JdbmTable<String,String>( schemaManager, "admin", recMan, STRING_COMPARATOR, null, null );
+ super( schemaManager, DBF, recMan, LONG_COMPARATOR, LongSerializer.INSTANCE,
+ new EntrySerializer( schemaManager ) );
+ adminTbl = new JdbmTable<String, String>( schemaManager, "admin", recMan, STRING_COMPARATOR, null, null );
String seqValue = adminTbl.get( SEQPROP_KEY );
if ( null == seqValue )
{
adminTbl.put( SEQPROP_KEY, "0" );
}
-
+
LONG_COMPARATOR.setSchemaManager( schemaManager );
STRING_COMPARATOR.setSchemaManager( schemaManager );
}
- protected JdbmMasterTable( RecordManager recMan, SchemaManager schemaManager, String dbName, Serializer serializer ) throws Exception
+ protected JdbmMasterTable( RecordManager recMan, SchemaManager schemaManager, String dbName, Serializer serializer )
+ throws Exception
{
super( schemaManager, DBF, recMan, LONG_COMPARATOR, LongSerializer.INSTANCE, serializer );
- adminTbl = new JdbmTable<String,String>( schemaManager, dbName, recMan, STRING_COMPARATOR, null, null );
+ adminTbl = new JdbmTable<String, String>( schemaManager, dbName, recMan, STRING_COMPARATOR, null, null );
String seqValue = adminTbl.get( SEQPROP_KEY );
if ( null == seqValue )
Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java Tue Jan 24 16:15:05 2012
@@ -65,10 +65,10 @@ public class JdbmPartition extends Abstr
private static final Logger LOG = LoggerFactory.getLogger( JdbmPartition.class );
private static final String JDBM_DB_FILE_EXTN = ".db";
-
+
private static final FilenameFilter DB_FILTER = new FilenameFilter()
{
-
+
public boolean accept( File dir, String name )
{
// really important to filter master.db and master.lg files
@@ -79,6 +79,7 @@ public class JdbmPartition extends Abstr
/** the JDBM record manager used by this database */
private RecordManager recMan;
+
/**
* Creates a store based on JDBM B+Trees.
*/
@@ -112,27 +113,27 @@ public class JdbmPartition extends Abstr
{
optimizer = new DefaultOptimizer<Entry, Long>( this );
}
-
+
EvaluatorBuilder<Long> evaluatorBuilder = new EvaluatorBuilder<Long>( this, schemaManager );
CursorBuilder<Long> cursorBuilder = new CursorBuilder<Long>( this, evaluatorBuilder );
-
+
searchEngine = new DefaultSearchEngine<Long>( this, cursorBuilder, evaluatorBuilder, optimizer );
// Create the underlying directories (only if needed)
File partitionDir = new File( getPartitionPath() );
if ( !partitionDir.exists() && !partitionDir.mkdirs() )
{
- throw new IOException(I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, partitionDir ));
+ throw new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, partitionDir ) );
}
-
+
// Initialize the indexes
super.doInit();
-
+
// First, check if the file storing the data exists
String path = partitionDir.getPath() + File.separator + "master";
BaseRecordManager baseRecordManager = new BaseRecordManager( path );
baseRecordManager.disableTransactions();
-
+
if ( cacheSize < 0 )
{
cacheSize = DEFAULT_CACHE_SIZE;
@@ -142,38 +143,38 @@ public class JdbmPartition extends Abstr
{
LOG.debug( "Using the custom configured cache size of {} for {} partition", cacheSize, id );
}
-
+
// Now, create the entry cache for this partition
recMan = new SnapshotRecordManager( baseRecordManager, cacheSize );
-
+
// Create the master table (the table containing all the entries)
master = new JdbmMasterTable<Entry>( recMan, schemaManager );
-
+
// get all index db files first
File[] allIndexDbFiles = partitionDir.listFiles( DB_FILTER );
-
+
// get the names of the db files also
List<String> indexDbFileNameList = Arrays.asList( partitionDir.list( DB_FILTER ) );
-
+
// then add all index objects to a list
List<String> allIndices = new ArrayList<String>();
-
- for( Index<?, Entry, Long> index : systemIndices.values() )
+
+ for ( Index<?, Entry, Long> index : systemIndices.values() )
{
allIndices.add( index.getAttribute().getOid() );
}
-
+
// this loop is used for two purposes
// one for collecting all user indices
// two for finding a new index to be built
// just to avoid another iteration for determining which is the new index
- for( Index<?, Entry, Long> index : userIndices.values() )
+ for ( Index<?, Entry, Long> index : userIndices.values() )
{
allIndices.add( index.getAttributeId() );
-
+
// take the part after removing .db from the
String name = index.getAttributeId() + JDBM_DB_FILE_EXTN;
-
+
// if the name doesn't exist in the list of index DB files
// this is a new index and we need to build it
if ( !indexDbFileNameList.contains( name ) )
@@ -181,15 +182,15 @@ public class JdbmPartition extends Abstr
buildUserIndex( index );
}
}
-
+
deleteUnusedIndexFiles( allIndices, allIndexDbFiles );
-
+
// We are done !
initialized = true;
}
}
-
+
/**
* {@inheritDoc}}
*/
@@ -226,7 +227,7 @@ public class JdbmPartition extends Abstr
{
idx.sync();
}
-
+
// Sync all user defined userIndices
for ( Index<?, Entry, Long> idx : userIndices.values() )
{
@@ -236,8 +237,8 @@ public class JdbmPartition extends Abstr
( ( JdbmMasterTable<Entry> ) master ).sync();
recMan.commit();
}
-
-
+
+
/**
* builds a user defined index on a attribute by browsing all the entries present in master db
*
@@ -249,35 +250,37 @@ public class JdbmPartition extends Abstr
AttributeType atType = userIdx.getAttribute();
LOG.info( "building the index for attribute type {}", atType );
-
- Cursor<Tuple<Long,Entry>> cursor = master.cursor();
+
+ Cursor<Tuple<Long, Entry>> cursor = master.cursor();
cursor.beforeFirst();
-
+
String attributeOid = userIdx.getAttribute().getOid();
-
+
while ( cursor.next() )
{
- Tuple<Long,Entry> tuple = cursor.get();
-
+ Tuple<Long, Entry> tuple = cursor.get();
+
Long id = tuple.getKey();
Entry entry = tuple.getValue();
-
+
Attribute entryAttr = entry.get( atType );
-
+
if ( entryAttr != null )
{
for ( Value<?> value : entryAttr )
{
userIdx.add( value.getValue(), id );
}
-
+
// Adds only those attributes that are indexed
presenceIdx.add( attributeOid, id );
}
}
-
+
cursor.close();
}
+
+
/**
* removes any unused/removed attribute index files present under the partition's
* working directory
@@ -289,13 +292,13 @@ public class JdbmPartition extends Abstr
String name = file.getName();
// take the part after removing .db from the
name = name.substring( 0, name.lastIndexOf( JDBM_DB_FILE_EXTN ) );
-
+
// remove the file if not found in the list of names of indices
- if( !allIndices.contains( name ) )
+ if ( !allIndices.contains( name ) )
{
boolean deleted = file.delete();
-
- if( deleted )
+
+ if ( deleted )
{
LOG.info( "Deleted unused index file {}", file.getAbsolutePath() );
@@ -303,15 +306,15 @@ public class JdbmPartition extends Abstr
{
String atName = schemaManager.lookupAttributeTypeRegistry( name ).getName();
File txtFile = new File( file.getParent(), name + "-" + atName + ".txt" );
-
+
deleted = txtFile.delete();
-
- if( !deleted )
+
+ if ( !deleted )
{
LOG.info( "couldn't delete the index name helper file {}", txtFile );
}
}
- catch( Exception e )
+ catch ( Exception e )
{
LOG.warn( "couldn't find the attribute's name with oid {}", name );
LOG.warn( "", e );
@@ -324,15 +327,15 @@ public class JdbmPartition extends Abstr
}
}
}
-
-
+
+
/**
* {@inheritDoc}
*/
protected Index<?, Entry, Long> convertAndInit( Index<?, Entry, Long> index ) throws Exception
{
JdbmIndex<?, Entry> jdbmIndex;
-
+
if ( index.getAttributeId().equals( ApacheSchemaConstants.APACHE_RDN_AT_OID ) )
{
jdbmIndex = new JdbmRdnIndex();
@@ -344,7 +347,7 @@ public class JdbmPartition extends Abstr
else if ( index instanceof JdbmIndex<?, ?> )
{
jdbmIndex = ( JdbmIndex<?, Entry> ) index;
-
+
if ( jdbmIndex.getWkDirPath() == null )
{
jdbmIndex.setWkDirPath( partitionPath );
@@ -377,7 +380,7 @@ public class JdbmPartition extends Abstr
{
return;
}
-
+
try
{
super.doDestroy();
Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java Tue Jan 24 16:15:05 2012
@@ -70,7 +70,7 @@ public class JdbmRdnIndex<E> extends Jdb
public void init( SchemaManager schemaManager, AttributeType attributeType ) throws IOException
{
LOG.debug( "Initializing an Index for attribute '{}'", attributeType.getName() );
-
+
//System.out.println( "IDX Initializing RDNindex for AT " + attributeType.getOid() + ", wkDirPath : " + wkDirPath + ", base dir : " + this.wkDirPath );
keyCache = new SynchronizedLRUMap( cacheSize );
@@ -80,17 +80,17 @@ public class JdbmRdnIndex<E> extends Jdb
{
setAttributeId( attributeType.getName() );
}
-
+
if ( this.wkDirPath == null )
{
NullPointerException e = new NullPointerException( "The index working directory has not be set" );
-
+
e.printStackTrace();
throw e;
}
-
+
String path = new File( this.wkDirPath, attributeType.getOid() ).getAbsolutePath();
-
+
//System.out.println( "IDX Created index " + path );
BaseRecordManager base = new BaseRecordManager( path );
base.disableTransactions();
@@ -112,7 +112,7 @@ public class JdbmRdnIndex<E> extends Jdb
// write the AttributeType description
fw.write( attributeType.toString() );
fw.close();
-
+
initialized = true;
}
Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java Tue Jan 24 16:15:05 2012
@@ -53,7 +53,7 @@ import org.slf4j.LoggerFactory;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class JdbmTable<K,V> extends AbstractTable<K,V>
+public class JdbmTable<K, V> extends AbstractTable<K, V>
{
/** A logger for this class */
private static final Logger LOG = LoggerFactory.getLogger( JdbmTable.class.getSimpleName() );
@@ -63,7 +63,7 @@ public class JdbmTable<K,V> extends Abst
/** the JDBM record manager for the file this table is managed in */
private final RecordManager recMan;
-
+
/** whether or not this table allows for duplicates */
private final boolean allowsDuplicates;
@@ -85,11 +85,11 @@ public class JdbmTable<K,V> extends Abst
/** A marshaller used to serialize/deserialize values stored in the Table */
Marshaller<ArrayTree<V>> marshaller;
+
// ------------------------------------------------------------------------
// C O N S T R U C T O R
// ------------------------------------------------------------------------
-
/**
* Creates a Jdbm BTree based tuple Table abstraction that enables
* duplicates.
@@ -125,7 +125,7 @@ public class JdbmTable<K,V> extends Abst
if ( valueSerializer != null )
{
marshaller = new ArrayMarshaller<V>( valueComparator,
- new MarshallerSerializerBridge<V>( valueSerializer ) );
+ new MarshallerSerializerBridge<V>( valueSerializer ) );
}
else
{
@@ -155,10 +155,11 @@ public class JdbmTable<K,V> extends Abst
recId = recMan.insert( 0 );
recMan.setNamedObject( name + SZSUFFIX, recId );
}
- else // Load existing BTree
+ else
+ // Load existing BTree
{
- bt= new BTree<K, V>().load( recMan, recId );
- ((SerializableComparator<K>)bt.getComparator()).setSchemaManager( schemaManager );
+ bt = new BTree<K, V>().load( recMan, recId );
+ ( ( SerializableComparator<K> ) bt.getComparator() ).setSchemaManager( schemaManager );
recId = recMan.getNamedObject( name + SZSUFFIX );
count = ( Integer ) recMan.fetch( recId );
}
@@ -180,11 +181,11 @@ public class JdbmTable<K,V> extends Abst
* @throws IOException if the table's file cannot be created
*/
public JdbmTable( SchemaManager schemaManager, String name, RecordManager manager, Comparator<K> keyComparator,
- Serializer keySerializer, Serializer valueSerializer )
+ Serializer keySerializer, Serializer valueSerializer )
throws IOException
{
super( schemaManager, name, keyComparator, null );
-
+
this.duplicateBtrees = null;
this.numDupLimit = Integer.MAX_VALUE;
this.recMan = manager;
@@ -199,7 +200,7 @@ public class JdbmTable<K,V> extends Abst
if ( recId != 0 )
{
bt = new BTree<K, V>().load( recMan, recId );
- ((SerializableComparator<K>)bt.getComparator()).setSchemaManager( schemaManager );
+ ( ( SerializableComparator<K> ) bt.getComparator() ).setSchemaManager( schemaManager );
bt.setValueSerializer( valueSerializer );
recId = recMan.getNamedObject( name + SZSUFFIX );
count = ( Integer ) recMan.fetch( recId );
@@ -239,7 +240,7 @@ public class JdbmTable<K,V> extends Abst
return allowsDuplicates;
}
-
+
// ------------------------------------------------------------------------
// Count Overloads
// ------------------------------------------------------------------------
@@ -251,8 +252,8 @@ public class JdbmTable<K,V> extends Abst
// take a best guess
return count;
}
-
-
+
+
/**
* @see Table#lessThanCount(Object)
*/
@@ -273,7 +274,7 @@ public class JdbmTable<K,V> extends Abst
return 0;
}
- if ( ! allowsDuplicates )
+ if ( !allowsDuplicates )
{
if ( null == bt.find( key ) )
{
@@ -286,7 +287,7 @@ public class JdbmTable<K,V> extends Abst
}
DupsContainer<V> values = getDupsContainer( ( byte[] ) bt.find( key ) );
-
+
if ( values.isArrayTree() )
{
return values.getArrayTree().size();
@@ -295,12 +296,11 @@ public class JdbmTable<K,V> extends Abst
return getBTree( values.getBTreeRedirect() ).size();
}
-
+
// ------------------------------------------------------------------------
// get/has/put/remove Methods and Overloads
// ------------------------------------------------------------------------
-
@SuppressWarnings("unchecked")
public V get( K key ) throws Exception
{
@@ -309,12 +309,11 @@ public class JdbmTable<K,V> extends Abst
return null;
}
- if ( ! allowsDuplicates )
+ if ( !allowsDuplicates )
{
return ( V ) bt.find( key );
}
-
DupsContainer<V> values = getDupsContainer( ( byte[] ) bt.find( key ) );
if ( values.isArrayTree() )
{
@@ -324,7 +323,7 @@ public class JdbmTable<K,V> extends Abst
{
return null;
}
-
+
return set.getFirst();
}
@@ -332,15 +331,15 @@ public class JdbmTable<K,V> extends Abst
BTree tree = getBTree( values.getBTreeRedirect() );
jdbm.helper.Tuple tuple = new jdbm.helper.Tuple();
- TupleBrowser<K,V> browser = tree.browse();
+ TupleBrowser<K, V> browser = tree.browse();
browser.getNext( tuple );
this.closeBrowser( browser );
//noinspection unchecked
-
+
return ( V ) tuple.getKey();
}
-
+
/**
* @see Table#hasGreaterOrEqual(Object,Object)
*/
@@ -351,13 +350,13 @@ public class JdbmTable<K,V> extends Abst
return false;
}
- if ( ! allowsDuplicates )
+ if ( !allowsDuplicates )
{
throw new UnsupportedOperationException( I18n.err( I18n.ERR_593 ) );
}
DupsContainer<V> values = getDupsContainer( ( byte[] ) bt.find( key ) );
-
+
if ( values.isArrayTree() )
{
ArrayTree<V> set = values.getArrayTree();
@@ -367,7 +366,7 @@ public class JdbmTable<K,V> extends Abst
// last option is to try a btree with BTreeRedirects
BTree<K, V> tree = getBTree( values.getBTreeRedirect() );
-
+
return tree.size() != 0 && btreeHas( tree, val, true );
}
@@ -382,13 +381,13 @@ public class JdbmTable<K,V> extends Abst
return false;
}
- if ( ! allowsDuplicates )
+ if ( !allowsDuplicates )
{
throw new UnsupportedOperationException( I18n.err( I18n.ERR_593 ) );
}
DupsContainer<V> values = getDupsContainer( ( byte[] ) bt.find( key ) );
-
+
if ( values.isArrayTree() )
{
ArrayTree<V> set = values.getArrayTree();
@@ -398,7 +397,7 @@ public class JdbmTable<K,V> extends Abst
// last option is to try a btree with BTreeRedirects
BTree<K, V> tree = getBTree( values.getBTreeRedirect() );
-
+
return tree.size() != 0 && btreeHas( tree, val, false );
}
@@ -467,13 +466,13 @@ public class JdbmTable<K,V> extends Abst
* be the previous tuple if it exists.
*/
TupleBrowser browser = bt.browse( tuple.getKey() );
-
+
if ( browser.getPrevious( tuple ) )
{
this.closeBrowser( browser );
return true;
}
-
+
this.closeBrowser( browser );
}
@@ -493,29 +492,29 @@ public class JdbmTable<K,V> extends Abst
return false;
}
- if ( ! allowsDuplicates )
+ if ( !allowsDuplicates )
{
V stored = ( V ) bt.find( key );
return null != stored && stored.equals( value );
}
-
+
DupsContainer<V> values = getDupsContainer( ( byte[] ) bt.find( key ) );
-
+
if ( values.isArrayTree() )
{
return values.getArrayTree().find( value ) != null;
}
-
+
return getBTree( values.getBTreeRedirect() ).find( value ) != null;
}
-
+
/**
* @see Table#has(java.lang.Object)
*/
public boolean has( K key ) throws IOException
{
- return key != null && bt.find(key) != null;
+ return key != null && bt.find( key ) != null;
}
@@ -537,44 +536,44 @@ public class JdbmTable<K,V> extends Abst
{
throw new IllegalArgumentException( I18n.err( I18n.ERR_594 ) );
}
-
+
V replaced;
-
- if ( ! allowsDuplicates )
+
+ if ( !allowsDuplicates )
{
replaced = ( V ) bt.insert( key, value, true );
-
+
if ( null == replaced )
{
count++;
}
-
+
if ( LOG.isDebugEnabled() )
{
LOG.debug( "<--- Add ONE {} = {}", name, key );
}
-
+
return;
}
-
+
DupsContainer<V> values = getDupsContainer( ( byte[] ) bt.find( key ) );
-
+
if ( values.isArrayTree() )
{
ArrayTree<V> set = values.getArrayTree();
replaced = set.insert( value );
-
+
if ( replaced != null )// if the value already present returns the same value
{
return;
}
-
+
if ( set.size() > numDupLimit )
{
BTree tree = convertToBTree( set );
BTreeRedirect redirect = new BTreeRedirect( tree.getRecordId() );
- bt.insert( key, (V)BTreeRedirectMarshaller.INSTANCE.serialize( redirect ), true );
-
+ bt.insert( key, ( V ) BTreeRedirectMarshaller.INSTANCE.serialize( redirect ), true );
+
if ( LOG.isDebugEnabled() )
{
LOG.debug( "<--- Add new BTREE {} = {}", name, key );
@@ -582,26 +581,26 @@ public class JdbmTable<K,V> extends Abst
}
else
{
- bt.insert( key, (V)marshaller.serialize( set ), true );
-
+ bt.insert( key, ( V ) marshaller.serialize( set ), true );
+
if ( LOG.isDebugEnabled() )
{
LOG.debug( "<--- Add AVL {} = {}", name, key );
}
}
-
+
count++;
return;
}
-
+
BTree tree = getBTree( values.getBTreeRedirect() );
replaced = ( V ) tree.insert( value, StringConstants.EMPTY_BYTES, true );
-
+
if ( replaced == null )
{
count++;
}
-
+
if ( LOG.isDebugEnabled() )
{
LOG.debug( "<--- Add BTREE {} = {}", name, key );
@@ -613,7 +612,7 @@ public class JdbmTable<K,V> extends Abst
throw e;
}
}
-
+
/**
* @see org.apache.directory.server.xdbm.Table#remove(java.lang.Object,
@@ -628,44 +627,44 @@ public class JdbmTable<K,V> extends Abst
{
LOG.debug( "---> Remove " + name + " = " + key + ", " + value );
}
-
+
if ( key == null )
{
if ( LOG.isDebugEnabled() )
{
LOG.debug( "<--- Remove NULL key " + name );
}
-
+
return;
}
-
- if ( ! allowsDuplicates )
+
+ if ( !allowsDuplicates )
{
V oldValue = ( V ) bt.find( key );
-
+
// Remove the value only if it is the same as value.
if ( ( oldValue != null ) && oldValue.equals( value ) )
{
bt.remove( key );
count--;
-
+
if ( LOG.isDebugEnabled() )
{
LOG.debug( "<--- Remove ONE " + name + " = " + key + ", " + value );
}
-
+
return;
}
-
+
return;
}
-
+
DupsContainer<V> values = getDupsContainer( ( byte[] ) bt.find( key ) );
-
+
if ( values.isArrayTree() )
{
ArrayTree<V> set = values.getArrayTree();
-
+
// If removal succeeds then remove if set is empty else replace it
if ( set.remove( value ) != null )
{
@@ -675,25 +674,25 @@ public class JdbmTable<K,V> extends Abst
}
else
{
- bt.insert( key, (V)marshaller.serialize( set ), true );
+ bt.insert( key, ( V ) marshaller.serialize( set ), true );
}
-
+
count--;
if ( LOG.isDebugEnabled() )
{
LOG.debug( "<--- Remove AVL " + name + " = " + key + ", " + value );
}
-
+
return;
}
-
+
return;
}
-
+
// if the number of duplicates falls below the numDupLimit value
BTree tree = getBTree( values.getBTreeRedirect() );
-
+
if ( tree.find( value ) != null && tree.remove( value ) != null )
{
/*
@@ -703,17 +702,17 @@ public class JdbmTable<K,V> extends Abst
if ( tree.size() <= numDupLimit )
{
ArrayTree<V> avlTree = convertToArrayTree( tree );
- bt.insert( key, (V)marshaller.serialize( avlTree ), true );
+ bt.insert( key, ( V ) marshaller.serialize( avlTree ), true );
recMan.delete( tree.getRecordId() );
}
-
+
count--;
-
+
if ( LOG.isDebugEnabled() )
{
LOG.debug( "<--- Remove BTREE " + name + " = " + key + ", " + value );
}
-
+
return;
}
}
@@ -735,43 +734,43 @@ public class JdbmTable<K,V> extends Abst
{
LOG.debug( "---> Remove {} = {}", name, key );
}
-
+
if ( key == null )
{
return;
}
-
+
Object returned = bt.remove( key );
-
+
if ( null == returned )
{
if ( LOG.isDebugEnabled() )
{
LOG.debug( "<--- Remove AVL {} = {} (not found)", name, key );
}
-
+
return;
}
-
- if ( ! allowsDuplicates )
+
+ if ( !allowsDuplicates )
{
this.count--;
-
+
if ( LOG.isDebugEnabled() )
{
LOG.debug( "<--- Remove ONE {} = {}", name, key );
}
-
+
return;
}
-
+
byte[] serialized = ( byte[] ) returned;
-
+
if ( BTreeRedirectMarshaller.isRedirect( serialized ) )
{
BTree tree = getBTree( BTreeRedirectMarshaller.INSTANCE.deserialize( serialized ) );
this.count -= tree.size();
-
+
if ( LOG.isDebugEnabled() )
{
LOG.debug( "<--- Remove BTree {} = {}", name, key );
@@ -779,76 +778,77 @@ public class JdbmTable<K,V> extends Abst
recMan.delete( tree.getRecordId() );
duplicateBtrees.remove( tree.getRecordId() );
-
+
return;
}
else
{
ArrayTree<V> set = marshaller.deserialize( serialized );
this.count -= set.size();
-
+
if ( LOG.isDebugEnabled() )
{
LOG.debug( "<--- Remove AVL {} = {}", name, key );
}
-
+
return;
}
}
catch ( Exception e )
{
LOG.error( I18n.err( I18n.ERR_133, key, name ), e );
-
+
if ( e instanceof IOException )
{
- throw (IOException)e;
+ throw ( IOException ) e;
}
}
}
- public Cursor<org.apache.directory.shared.ldap.model.cursor.Tuple<K,V>> cursor() throws Exception
+ public Cursor<org.apache.directory.shared.ldap.model.cursor.Tuple<K, V>> cursor() throws Exception
{
if ( allowsDuplicates )
{
- return new DupsCursor<K,V>( this );
+ return new DupsCursor<K, V>( this );
}
- return new NoDupsCursor<K,V>( this );
+ return new NoDupsCursor<K, V>( this );
}
@SuppressWarnings("unchecked")
- public Cursor<org.apache.directory.shared.ldap.model.cursor.Tuple<K,V>> cursor( K key ) throws Exception
+ public Cursor<org.apache.directory.shared.ldap.model.cursor.Tuple<K, V>> cursor( K key ) throws Exception
{
if ( key == null )
{
- return new EmptyCursor<org.apache.directory.shared.ldap.model.cursor.Tuple<K,V>>();
+ return new EmptyCursor<org.apache.directory.shared.ldap.model.cursor.Tuple<K, V>>();
}
V raw = bt.find( key );
if ( null == raw )
{
- return new EmptyCursor<org.apache.directory.shared.ldap.model.cursor.Tuple<K,V>>();
+ return new EmptyCursor<org.apache.directory.shared.ldap.model.cursor.Tuple<K, V>>();
}
- if ( ! allowsDuplicates )
+ if ( !allowsDuplicates )
{
- return new SingletonCursor<org.apache.directory.shared.ldap.model.cursor.Tuple<K,V>>( new org.apache.directory.shared.ldap.model.cursor.Tuple<K,V>( key, ( V ) raw ) );
+ return new SingletonCursor<org.apache.directory.shared.ldap.model.cursor.Tuple<K, V>>(
+ new org.apache.directory.shared.ldap.model.cursor.Tuple<K, V>( key, ( V ) raw ) );
}
byte[] serialized = ( byte[] ) raw;
-
+
if ( BTreeRedirectMarshaller.isRedirect( serialized ) )
{
BTree tree = getBTree( BTreeRedirectMarshaller.INSTANCE.deserialize( serialized ) );
- return new KeyTupleBTreeCursor<K,V>( tree, key, valueComparator );
+ return new KeyTupleBTreeCursor<K, V>( tree, key, valueComparator );
}
ArrayTree<V> set = marshaller.deserialize( serialized );
-
- return new KeyTupleArrayCursor<K,V>( set, key );
+
+ return new KeyTupleArrayCursor<K, V>( set, key );
}
@@ -867,13 +867,13 @@ public class JdbmTable<K,V> extends Abst
return new EmptyCursor<V>();
}
- if ( ! allowsDuplicates )
+ if ( !allowsDuplicates )
{
return new SingletonCursor<V>( ( V ) raw );
}
byte[] serialized = ( byte[] ) raw;
-
+
if ( BTreeRedirectMarshaller.isRedirect( serialized ) )
{
BTree tree = getBTree( BTreeRedirectMarshaller.INSTANCE.deserialize( serialized ) );
@@ -888,7 +888,6 @@ public class JdbmTable<K,V> extends Abst
// Maintenance Operations
// ------------------------------------------------------------------------
-
/**
* @see Table#close()
*/
@@ -909,17 +908,16 @@ public class JdbmTable<K,V> extends Abst
recMan.update( recId, count );
}
-
+
public Marshaller<ArrayTree<V>> getMarshaller()
{
return marshaller;
}
-
+
// ------------------------------------------------------------------------
// Private/Package Utility Methods
// ------------------------------------------------------------------------
-
/**
* Added to check that we actually switch from one data structure to the
@@ -932,22 +930,22 @@ public class JdbmTable<K,V> extends Abst
throw new IllegalArgumentException( "key is null" );
}
- if ( ! allowsDuplicates )
+ if ( !allowsDuplicates )
{
return false;
- }
+ }
DupsContainer<V> values = getDupsContainer( ( byte[] ) bt.find( key ) );
-
+
if ( values.isBTreeRedirect() )
{
return true;
}
-
+
return false;
}
-
+
DupsContainer<V> getDupsContainer( byte[] serialized ) throws IOException
{
if ( serialized == null )
@@ -981,11 +979,11 @@ public class JdbmTable<K,V> extends Abst
{
return duplicateBtrees.get( redirect.getRecId() );
}
-
+
BTree<K, V> tree = new BTree<K, V>().load( recMan, redirect.getRecId() );
- ((SerializableComparator<K>)tree.getComparator()).setSchemaManager( schemaManager );
+ ( ( SerializableComparator<K> ) tree.getComparator() ).setSchemaManager( schemaManager );
duplicateBtrees.put( redirect.getRecId(), tree );
-
+
return tree;
}
@@ -994,13 +992,13 @@ public class JdbmTable<K,V> extends Abst
private boolean btreeHas( BTree tree, V key, boolean isGreaterThan ) throws IOException
{
jdbm.helper.Tuple tuple = new jdbm.helper.Tuple();
-
+
TupleBrowser browser = tree.browse( key );
-
+
try
{
if ( isGreaterThan )
- {
+ {
return browser.getNext( tuple );
}
else
@@ -1017,14 +1015,14 @@ public class JdbmTable<K,V> extends Abst
* should work every time.
*/
browser.getNext( tuple );
-
+
/*
* Since the browser is positioned now on the Tuple with the
* smallest key we just need to check if it equals this key
* which is the only chance for returning true.
*/
V firstKey = ( V ) tuple.getKey();
-
+
return valueComparator.compare( key, firstKey ) == 0;
}
}
@@ -1042,17 +1040,17 @@ public class JdbmTable<K,V> extends Abst
ArrayTree<V> avlTree = new ArrayTree<V>( valueComparator );
TupleBrowser browser = bTree.browse();
jdbm.helper.Tuple tuple = new jdbm.helper.Tuple();
-
+
while ( browser.getNext( tuple ) )
{
avlTree.insert( ( V ) tuple.getKey() );
}
this.closeBrowser( browser );
-
+
return avlTree;
}
-
+
private BTree<V, K> convertToBTree( ArrayTree<V> arrayTree ) throws Exception
{
@@ -1069,16 +1067,17 @@ public class JdbmTable<K,V> extends Abst
Cursor<V> keys = new ArrayTreeCursor<V>( arrayTree );
keys.beforeFirst();
-
+
while ( keys.next() )
{
- bTree.insert( keys.get(), (K) StringConstants.EMPTY_BYTES, true );
+ bTree.insert( keys.get(), ( K ) StringConstants.EMPTY_BYTES, true );
}
-
+
return bTree;
}
-
- private void closeBrowser(TupleBrowser<K,V> browser)
+
+
+ private void closeBrowser( TupleBrowser<K, V> browser )
{
if ( browser != null )
{
Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java Tue Jan 24 16:15:05 2012
@@ -105,7 +105,7 @@ public class KeyBTreeCursor<E> extends A
{
// just continue
}
- else
+ else
{
/*
* If we just have values greater than the element argument
@@ -158,7 +158,7 @@ public class KeyBTreeCursor<E> extends A
public boolean previous() throws Exception
{
checkNotClosed( "previous()" );
-
+
if ( browser == null )
{
browser = btree.browse( null );
@@ -179,7 +179,7 @@ public class KeyBTreeCursor<E> extends A
public boolean next() throws Exception
{
checkNotClosed( "next()" );
-
+
if ( browser == null )
{
browser = btree.browse();
@@ -192,7 +192,7 @@ public class KeyBTreeCursor<E> extends A
else
{
clearValue();
-
+
return false;
}
}
@@ -202,7 +202,7 @@ public class KeyBTreeCursor<E> extends A
public E get() throws Exception
{
checkNotClosed( "get()" );
-
+
if ( valueAvailable )
{
return ( E ) tuple.getKey();
@@ -210,7 +210,8 @@ public class KeyBTreeCursor<E> extends A
throw new InvalidCursorPositionException();
}
-
+
+
/**
* {@inheritDoc}
*/
@@ -231,9 +232,9 @@ public class KeyBTreeCursor<E> extends A
super.close( cause );
this.closeBrowser( browser );
}
-
-
- private void closeBrowser(TupleBrowser browser)
+
+
+ private void closeBrowser( TupleBrowser browser )
{
if ( browser != null )
{
Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleArrayCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleArrayCursor.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleArrayCursor.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleArrayCursor.java Tue Jan 24 16:15:05 2012
@@ -34,12 +34,12 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class KeyTupleArrayCursor<K,V> extends AbstractTupleCursor<K,V>
+public class KeyTupleArrayCursor<K, V> extends AbstractTupleCursor<K, V>
{
private final ArrayTreeCursor<V> wrapped;
private final K key;
- private Tuple<K,V> returnedTuple = new Tuple<K,V>();
+ private Tuple<K, V> returnedTuple = new Tuple<K, V>();
private boolean valueAvailable;
@@ -85,7 +85,7 @@ public class KeyTupleArrayCursor<K,V> ex
public void beforeValue( K key, V value ) throws Exception
{
checkNotClosed( "beforeValue()" );
- if ( key != null && ! key.equals( this.key ) )
+ if ( key != null && !key.equals( this.key ) )
{
throw new UnsupportedOperationException( I18n.err( I18n.ERR_446 ) );
}
@@ -98,7 +98,7 @@ public class KeyTupleArrayCursor<K,V> ex
public void afterValue( K key, V value ) throws Exception
{
checkNotClosed( "afterValue()" );
- if ( key != null && ! key.equals( this.key ) )
+ if ( key != null && !key.equals( this.key ) )
{
throw new UnsupportedOperationException( I18n.err( I18n.ERR_446 ) );
}
@@ -116,7 +116,7 @@ public class KeyTupleArrayCursor<K,V> ex
* @param element the valueTuple who's value is used to position this Cursor
* @throws Exception if there are failures to position the Cursor
*/
- public void before( Tuple<K,V> element ) throws Exception
+ public void before( Tuple<K, V> element ) throws Exception
{
checkNotClosed( "before()" );
wrapped.before( element.getValue() );
@@ -124,7 +124,7 @@ public class KeyTupleArrayCursor<K,V> ex
}
- public void after( Tuple<K,V> element ) throws Exception
+ public void after( Tuple<K, V> element ) throws Exception
{
checkNotClosed( "after()" );
wrapped.after( element.getValue() );
@@ -196,7 +196,7 @@ public class KeyTupleArrayCursor<K,V> ex
}
- public Tuple<K,V> get() throws Exception
+ public Tuple<K, V> get() throws Exception
{
checkNotClosed( "get()" );
if ( valueAvailable )
Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java Tue Jan 24 16:15:05 2012
@@ -37,15 +37,15 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class KeyTupleBTreeCursor<K,V> extends AbstractTupleCursor<K,V>
+public class KeyTupleBTreeCursor<K, V> extends AbstractTupleCursor<K, V>
{
private final Comparator<V> comparator;
private final BTree btree;
private final K key;
- private jdbm.helper.Tuple<K,V> valueTuple = new jdbm.helper.Tuple<K,V>();
- private Tuple<K,V> returnedTuple = new Tuple<K,V>();
- private TupleBrowser<K,V> browser;
+ private jdbm.helper.Tuple<K, V> valueTuple = new jdbm.helper.Tuple<K, V>();
+ private Tuple<K, V> returnedTuple = new Tuple<K, V>();
+ private TupleBrowser<K, V> browser;
private boolean valueAvailable;
@@ -104,7 +104,7 @@ public class KeyTupleBTreeCursor<K,V> ex
public void beforeValue( K key, V value ) throws Exception
{
checkNotClosed( "beforeValue()" );
- if ( key != null && ! key.equals( this.key ) )
+ if ( key != null && !key.equals( this.key ) )
{
throw new UnsupportedOperationException( I18n.err( I18n.ERR_446 ) );
}
@@ -120,7 +120,7 @@ public class KeyTupleBTreeCursor<K,V> ex
@SuppressWarnings("unchecked")
public void afterValue( K key, V value ) throws Exception
{
- if ( key != null && ! key.equals( this.key ) )
+ if ( key != null && !key.equals( this.key ) )
{
throw new UnsupportedOperationException( I18n.err( I18n.ERR_446 ) );
}
@@ -158,7 +158,7 @@ public class KeyTupleBTreeCursor<K,V> ex
}
clearValue();
-
+
return;
}
}
@@ -175,7 +175,7 @@ public class KeyTupleBTreeCursor<K,V> ex
* @param element the valueTuple who's value is used to position this Cursor
* @throws Exception if there are failures to position the Cursor
*/
- public void before( Tuple<K,V> element ) throws Exception
+ public void before( Tuple<K, V> element ) throws Exception
{
checkNotClosed( "before()" );
this.closeBrowser( browser );
@@ -187,7 +187,7 @@ public class KeyTupleBTreeCursor<K,V> ex
/**
* {@inheritDoc}
*/
- public void after( Tuple<K,V> element ) throws Exception
+ public void after( Tuple<K, V> element ) throws Exception
{
afterValue( key, element.getValue() );
}
@@ -222,7 +222,7 @@ public class KeyTupleBTreeCursor<K,V> ex
public boolean first() throws Exception
{
beforeFirst();
-
+
return next();
}
@@ -233,7 +233,7 @@ public class KeyTupleBTreeCursor<K,V> ex
public boolean last() throws Exception
{
afterLast();
-
+
return previous();
}
@@ -245,24 +245,24 @@ public class KeyTupleBTreeCursor<K,V> ex
public boolean previous() throws Exception
{
checkNotClosed( "previous()" );
-
+
if ( browser.getPrevious( valueTuple ) )
{
// work around to fix direction change problem with jdbm browser
if ( ( returnedTuple.getValue() != null ) &&
( comparator.compare( ( V ) valueTuple.getKey(), returnedTuple.getValue() ) == 0 ) )
{
- browser.getPrevious( valueTuple ) ;
+ browser.getPrevious( valueTuple );
}
returnedTuple.setKey( key );
returnedTuple.setValue( ( V ) valueTuple.getKey() );
-
+
return valueAvailable = true;
}
else
{
clearValue();
-
+
return false;
}
}
@@ -275,25 +275,25 @@ public class KeyTupleBTreeCursor<K,V> ex
public boolean next() throws Exception
{
checkNotClosed( "next()" );
-
+
if ( browser.getNext( valueTuple ) )
{
// work around to fix direction change problem with jdbm browser
if ( returnedTuple.getValue() != null &&
- comparator.compare( ( V ) valueTuple.getKey(), returnedTuple.getValue() ) == 0 )
+ comparator.compare( ( V ) valueTuple.getKey(), returnedTuple.getValue() ) == 0 )
{
- browser.getNext( valueTuple ) ;
+ browser.getNext( valueTuple );
}
-
+
returnedTuple.setKey( key );
returnedTuple.setValue( ( V ) valueTuple.getKey() );
-
+
return valueAvailable = true;
}
else
{
clearValue();
-
+
return false;
}
}
@@ -302,10 +302,10 @@ public class KeyTupleBTreeCursor<K,V> ex
/**
* {@inheritDoc}
*/
- public Tuple<K,V> get() throws Exception
+ public Tuple<K, V> get() throws Exception
{
checkNotClosed( "get()" );
-
+
if ( valueAvailable )
{
return returnedTuple;
@@ -313,7 +313,8 @@ public class KeyTupleBTreeCursor<K,V> ex
throw new InvalidCursorPositionException();
}
-
+
+
/**
* {@inheritDoc}
*/
@@ -335,8 +336,8 @@ public class KeyTupleBTreeCursor<K,V> ex
this.closeBrowser( browser );
}
-
- private void closeBrowser(TupleBrowser browser)
+
+ private void closeBrowser( TupleBrowser browser )
{
if ( browser != null )
{
Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/LongSerializer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/LongSerializer.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/LongSerializer.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/LongSerializer.java Tue Jan 24 16:15:05 2012
@@ -57,7 +57,7 @@ public class LongSerializer implements S
public Object deserialize( byte[] bites ) throws IOException
{
long id;
- id = bites[0] + ( ( bites[0] < 0 ) ? 256 : 0 );
+ id = bites[0] + ( ( bites[0] < 0 ) ? 256 : 0 );
id <<= 8;
id += bites[1] + ( ( bites[1] < 0 ) ? 256 : 0 );
id <<= 8;
Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/MarshallerSerializerBridge.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/MarshallerSerializerBridge.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/MarshallerSerializerBridge.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/MarshallerSerializerBridge.java Tue Jan 24 16:15:05 2012
@@ -64,7 +64,8 @@ public class MarshallerSerializerBridge<
/**
* @see Marshaller#deserialize(byte[])
*/
- @SuppressWarnings({"unchecked"})
+ @SuppressWarnings(
+ { "unchecked" })
public E deserialize( byte[] bytes ) throws IOException
{
return ( E ) serializer.deserialize( bytes );
Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java Tue Jan 24 16:15:05 2012
@@ -37,12 +37,12 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-class NoDupsCursor<K,V> extends AbstractTupleCursor<K,V>
+class NoDupsCursor<K, V> extends AbstractTupleCursor<K, V>
{
- private final JdbmTable<K,V> table;
+ private final JdbmTable<K, V> table;
private jdbm.helper.Tuple jdbmTuple = new jdbm.helper.Tuple();
- private Tuple<K,V> returnedTuple = new Tuple<K,V>();
+ private Tuple<K, V> returnedTuple = new Tuple<K, V>();
private TupleBrowser browser;
private boolean valueAvailable;
@@ -53,7 +53,7 @@ class NoDupsCursor<K,V> extends Abstract
* @param table the JDBM Table to build a Cursor over
* @throws IOException of there are problems accessing the BTree
*/
- public NoDupsCursor( JdbmTable<K,V> table ) throws IOException
+ public NoDupsCursor( JdbmTable<K, V> table ) throws IOException
{
this.table = table;
}
@@ -134,13 +134,13 @@ class NoDupsCursor<K,V> extends Abstract
* @param element the tuple who's key is used to position this Cursor
* @throws IOException if there are failures to position the Cursor
*/
- public void before( Tuple<K,V> element ) throws Exception
+ public void before( Tuple<K, V> element ) throws Exception
{
beforeKey( element.getKey() );
}
- public void after( Tuple<K,V> element ) throws Exception
+ public void after( Tuple<K, V> element ) throws Exception
{
afterKey( element.getKey() );
}
@@ -189,8 +189,8 @@ class NoDupsCursor<K,V> extends Abstract
if ( browser.getPrevious( jdbmTuple ) )
{
- if( returnedTuple.getKey() != null && table.getKeyComparator().compare(
- ( K) jdbmTuple.getKey(), ( K) returnedTuple.getKey() ) == 0 )
+ if ( returnedTuple.getKey() != null && table.getKeyComparator().compare(
+ ( K ) jdbmTuple.getKey(), ( K ) returnedTuple.getKey() ) == 0 )
{
browser.getPrevious( jdbmTuple );
}
@@ -218,12 +218,12 @@ class NoDupsCursor<K,V> extends Abstract
if ( browser.getNext( jdbmTuple ) )
{
- if( returnedTuple.getKey() != null && table.getKeyComparator().compare(
- ( K) jdbmTuple.getKey(), ( K) returnedTuple.getKey() ) == 0 )
+ if ( returnedTuple.getKey() != null && table.getKeyComparator().compare(
+ ( K ) jdbmTuple.getKey(), ( K ) returnedTuple.getKey() ) == 0 )
{
browser.getNext( jdbmTuple );
}
-
+
returnedTuple.setKey( ( K ) jdbmTuple.getKey() );
returnedTuple.setValue( ( V ) jdbmTuple.getValue() );
return valueAvailable = true;
@@ -236,7 +236,7 @@ class NoDupsCursor<K,V> extends Abstract
}
- public Tuple<K,V> get() throws Exception
+ public Tuple<K, V> get() throws Exception
{
checkNotClosed( "get()" );
if ( valueAvailable )
@@ -246,7 +246,8 @@ class NoDupsCursor<K,V> extends Abstract
throw new InvalidCursorPositionException();
}
-
+
+
/**
* {@inheritDoc}
*/
@@ -267,8 +268,9 @@ class NoDupsCursor<K,V> extends Abstract
super.close( cause );
this.closeBrowser( browser );
}
-
- private void closeBrowser(TupleBrowser browser)
+
+
+ private void closeBrowser( TupleBrowser browser )
{
if ( browser != null )
{
Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/StringSerializer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/StringSerializer.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/StringSerializer.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/StringSerializer.java Tue Jan 24 16:15:05 2012
@@ -49,15 +49,15 @@ public class StringSerializer implements
for ( int ii = 0, jj = 0; ii < strchars.length; ii++, jj = ii << 1 )
{
int ch = bites[jj] << 8 & 0x0000FF00;
- ch |= bites[jj+1] & 0x000000FF;
+ ch |= bites[jj + 1] & 0x000000FF;
strchars[ii] = ( char ) ch;
}
return new String( strchars );
}
-
private static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
-
+
+
/* (non-Javadoc)
* @see jdbm.helper.Serializer#serialize(java.lang.Object)
*/
@@ -67,15 +67,15 @@ public class StringSerializer implements
{
return EMPTY_BYTE_ARRAY;
}
-
+
char[] strchars = ( ( String ) str ).toCharArray();
- byte[] bites = new byte[strchars.length<<1];
+ byte[] bites = new byte[strchars.length << 1];
for ( int ii = 0, jj = 0; ii < strchars.length; ii++, jj = ii << 1 )
{
bites[jj] = ( byte ) ( strchars[ii] >> 8 & 0x00FF );
- bites[jj+1] = ( byte ) ( strchars[ii] & 0x00FF );
+ bites[jj + 1] = ( byte ) ( strchars[ii] & 0x00FF );
}
-
+
return bites;
}
}
Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeRedirectMarshallerTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeRedirectMarshallerTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeRedirectMarshallerTest.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeRedirectMarshallerTest.java Tue Jan 24 16:15:05 2012
@@ -86,7 +86,7 @@ public class BTreeRedirectMarshallerTest
byte[] bites = createBites();
for ( int ii = 1; ii < BTreeRedirectMarshaller.SIZE; ii++ )
{
- bites[ii] = ( byte ) 0xFF;
+ bites[ii] = ( byte ) 0xFF;
}
assertEquals( -1, marshaller.deserialize( bites ).getRecId() );
@@ -112,7 +112,7 @@ public class BTreeRedirectMarshallerTest
for ( int ii = 2; ii < BTreeRedirectMarshaller.SIZE; ii++ )
{
- bites[ii] = ( byte ) 0xFF;
+ bites[ii] = ( byte ) 0xFF;
}
assertEquals( Long.MAX_VALUE, marshaller.deserialize( bites ).getRecId() );
@@ -149,7 +149,6 @@ public class BTreeRedirectMarshallerTest
{
}
-
try
{
marshaller.deserialize( "bogus".getBytes() );
Modified: directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursorTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursorTest.java?rev=1235326&r1=1235325&r2=1235326&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursorTest.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursorTest.java Tue Jan 24 16:15:05 2012
@@ -60,7 +60,7 @@ public class DupsContainerCursorTest
private static final Logger LOG = LoggerFactory.getLogger( NoDupsCursorTest.class.getSimpleName() );
private static final String TEST_OUTPUT_PATH = "test.output.path";
- JdbmTable<String,String> table;
+ JdbmTable<String, String> table;
File dbFile;
private static SchemaManager schemaManager;
RecordManager recman;
@@ -89,16 +89,16 @@ public class DupsContainerCursorTest
if ( !loaded )
{
- fail( "Schema load failed : " + Exceptions.printErrors(schemaManager.getErrors()) );
+ fail( "Schema load failed : " + Exceptions.printErrors( schemaManager.getErrors() ) );
}
}
-
+
@Before
public void createTable() throws Exception
{
File tmpDir = null;
-
+
if ( System.getProperty( TEST_OUTPUT_PATH, null ) != null )
{
tmpDir = new File( System.getProperty( TEST_OUTPUT_PATH ) );
@@ -108,11 +108,12 @@ public class DupsContainerCursorTest
dbFile = File.createTempFile( getClass().getSimpleName(), "db", tmpDir );
dbFile.deleteOnExit();
recman = new BaseRecordManager( dbFile.getAbsolutePath() );
-
- SerializableComparator<String> comparator = new SerializableComparator<String>( SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
+
+ SerializableComparator<String> comparator = new SerializableComparator<String>(
+ SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
comparator.setSchemaManager( schemaManager );
- table = new JdbmTable<String,String>( schemaManager, "test", SIZE, recman,
- comparator, comparator, null, new DefaultSerializer() );
+ table = new JdbmTable<String, String>( schemaManager, "test", SIZE, recman,
+ comparator, comparator, null, new DefaultSerializer() );
LOG.debug( "Created new table and populated it with data" );
}
@@ -132,7 +133,7 @@ public class DupsContainerCursorTest
}
- @Test( expected=IllegalStateException.class )
+ @Test(expected = IllegalStateException.class)
public void testUsingNoDuplicates() throws Exception
{
recman = new BaseRecordManager( dbFile.getAbsolutePath() );
@@ -141,33 +142,34 @@ public class DupsContainerCursorTest
//SerializableComparator.setRegistry(
// new MockComparatorRegistry(
// new OidRegistry() ) );
- SerializableComparator<String> comparator = new SerializableComparator<String>( SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
+ SerializableComparator<String> comparator = new SerializableComparator<String>(
+ SchemaConstants.INTEGER_ORDERING_MATCH_MR_OID );
comparator.setSchemaManager( schemaManager );
- table = new JdbmTable<String,String>( schemaManager, "test", recman, comparator, null, null );
+ table = new JdbmTable<String, String>( schemaManager, "test", recman, comparator, null, null );
- Cursor<Tuple<String,DupsContainer<String>>> cursor =
- new DupsContainerCursor<String,String>( table );
+ Cursor<Tuple<String, DupsContainer<String>>> cursor =
+ new DupsContainerCursor<String, String>( table );
assertNotNull( cursor );
}
- @Test( expected=InvalidCursorPositionException.class )
+ @Test(expected = InvalidCursorPositionException.class)
public void testEmptyTable() throws Exception
{
- Cursor<Tuple<String,DupsContainer<String>>> cursor =
- new DupsContainerCursor<String,String>( table );
+ Cursor<Tuple<String, DupsContainer<String>>> cursor =
+ new DupsContainerCursor<String, String>( table );
assertNotNull( cursor );
assertFalse( cursor.available() );
assertFalse( cursor.isClosed() );
- cursor = new DupsContainerCursor<String,String>( table );
+ cursor = new DupsContainerCursor<String, String>( table );
assertFalse( cursor.previous() );
- cursor = new DupsContainerCursor<String,String>( table );
+ cursor = new DupsContainerCursor<String, String>( table );
assertFalse( cursor.next() );
- cursor.after( new Tuple<String,DupsContainer<String>>( "7", null ) );
+ cursor.after( new Tuple<String, DupsContainer<String>>( "7", null ) );
cursor.get();
}
@@ -176,11 +178,11 @@ public class DupsContainerCursorTest
public void testOnTableWithSingleEntry() throws Exception
{
table.put( "1", "1" );
- Cursor<Tuple<String,DupsContainer<String>>> cursor =
- new DupsContainerCursor<String,String>( table );
+ Cursor<Tuple<String, DupsContainer<String>>> cursor =
+ new DupsContainerCursor<String, String>( table );
assertTrue( cursor.first() );
- Tuple<String,DupsContainer<String>> tuple = cursor.get();
+ Tuple<String, DupsContainer<String>> tuple = cursor.get();
assertEquals( "1", tuple.getKey() );
assertEquals( "1", tuple.getValue().getArrayTree().getFirst() );
@@ -193,23 +195,23 @@ public class DupsContainerCursorTest
@Test
public void testOnTableWithMultipleEntries() throws Exception
{
- for( int i=1; i < 10; i++ )
+ for ( int i = 1; i < 10; i++ )
{
String istr = Integer.toString( i );
table.put( istr, istr );
}
- Cursor<Tuple<String,DupsContainer<String>>> cursor =
- new DupsContainerCursor<String,String>( table );
+ Cursor<Tuple<String, DupsContainer<String>>> cursor =
+ new DupsContainerCursor<String, String>( table );
- cursor.after( new Tuple<String,DupsContainer<String>>( "2", null ) );
+ cursor.after( new Tuple<String, DupsContainer<String>>( "2", null ) );
assertTrue( cursor.next() );
- Tuple<String,DupsContainer<String>> tuple = cursor.get();
+ Tuple<String, DupsContainer<String>> tuple = cursor.get();
assertEquals( "3", tuple.getKey() );
assertEquals( "3", tuple.getValue().getArrayTree().getFirst() );
- cursor.before( new Tuple<String,DupsContainer<String>>( "7", null ) );
+ cursor.before( new Tuple<String, DupsContainer<String>>( "7", null ) );
cursor.next();
tuple = cursor.get();
assertEquals( "7", tuple.getKey() );
@@ -218,10 +220,10 @@ public class DupsContainerCursorTest
cursor.last();
cursor.next();
assertFalse( cursor.available() );
- /* tuple = cursor.get();
- assertTrue( tuple.getKey().equals( 9 ) );
- assertEquals( 9, ( int ) tuple.getValue().getAvlTree().getFirst().getKey() ); */
-
+ /* tuple = cursor.get();
+ assertTrue( tuple.getKey().equals( 9 ) );
+ assertEquals( 9, ( int ) tuple.getValue().getAvlTree().getFirst().getKey() ); */
+
cursor.beforeFirst();
cursor.next();
tuple = cursor.get();
@@ -236,8 +238,8 @@ public class DupsContainerCursorTest
// just to clear the jdbmTuple value so that line 127 inside after(tuple) method
// can be executed as part of the below after(tuple) call
- cursor.before(new Tuple<String,DupsContainer<String>>( "1", null ) );
- cursor.after( new Tuple<String,DupsContainer<String>>( "0", null ) ); // this positions on tuple with key 1
+ cursor.before( new Tuple<String, DupsContainer<String>>( "1", null ) );
+ cursor.after( new Tuple<String, DupsContainer<String>>( "0", null ) ); // this positions on tuple with key 1
cursor.next(); // this moves onto tuple with key 2
tuple = cursor.get();