directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1663613 - in /directory/apacheds/trunk: mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/ xdbm-partition/src/main/java/org/apache/directory/server/xdbm/
Date Tue, 03 Mar 2015 10:27:27 GMT
Author: elecharny
Date: Tue Mar  3 10:27:26 2015
New Revision: 1663613

URL: http://svn.apache.org/r1663613
Log:
o Added a Table.toString() method
o Added some missing Javadoc

Modified:
    directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotCursor.java
    directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotTable.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractTable.java

Modified: directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotCursor.java?rev=1663613&r1=1663612&r2=1663613&view=diff
==============================================================================
--- directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotCursor.java
(original)
+++ directory/apacheds/trunk/mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotCursor.java
Tue Mar  3 10:27:26 2015
@@ -49,7 +49,7 @@ class MavibotCursor<K, V> extends Abstra
 
     /** The tuple which will be returned */
     private Tuple<K, V> returnedTuple = new Tuple<K, V>();
-    
+
     /** A flag set when there is a Tuple available */
     private boolean valueAvailable = false;
 
@@ -260,7 +260,7 @@ class MavibotCursor<K, V> extends Abstra
     public boolean first() throws LdapException, CursorException
     {
         beforeFirst();
-        
+
         return next();
     }
 

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=1663613&r1=1663612&r2=1663613&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
Tue Mar  3 10:27:26 2015
@@ -23,7 +23,6 @@ package org.apache.directory.server.core
 import java.io.IOException;
 
 import org.apache.directory.api.ldap.model.cursor.Cursor;
-import org.apache.directory.api.ldap.model.cursor.CursorException;
 import org.apache.directory.api.ldap.model.cursor.EmptyCursor;
 import org.apache.directory.api.ldap.model.cursor.SingletonCursor;
 import org.apache.directory.api.ldap.model.cursor.Tuple;
@@ -47,30 +46,57 @@ import org.slf4j.LoggerFactory;
 
 
 /**
- *
+ * A Mavibot Table. It extends the default Apache DS Table, when Mavibot is the
+ * underlying database.
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class MavibotTable<K, V> extends AbstractTable<K, V>
 {
-
+    /** the underlying B-tree */
     private BTree<K, V> bt;
 
+    /** The marshaller that will be used to read the values when we have more than one */
     private ArrayMarshaller<V> arrayMarshaller;
 
     /** A logger for this class */
     private static final Logger LOG = LoggerFactory.getLogger( MavibotTable.class );
 
+    /** The used recordManager */
     protected RecordManager recordMan;
 
 
+    /**
+     * Creates a new instance of MavibotTable.
+     *
+     * @param recordMan The associated RecordManager
+     * @param schemaManager The SchemaManager
+     * @param name The Table name
+     * @param keySerializer The Key serializer
+     * @param valueSerializer The Value serializer
+     * @param allowDuplicates If the table allows duplicate values
+     * @throws IOException If the instance creation failed
+     */
     public MavibotTable( RecordManager recordMan, SchemaManager schemaManager, String name,
         ElementSerializer<K> keySerializer, ElementSerializer<V> valueSerializer,
boolean allowDuplicates )
         throws IOException
     {
-        this( recordMan, schemaManager, name, keySerializer, valueSerializer, allowDuplicates,
AbstractBTreePartition.DEFAULT_CACHE_SIZE );
+        this( recordMan, schemaManager, name, keySerializer, valueSerializer, allowDuplicates,
+            AbstractBTreePartition.DEFAULT_CACHE_SIZE );
     }
 
 
+    /**
+     * Creates a new instance of MavibotTable.
+     *
+     * @param recordMan The associated RecordManager
+     * @param schemaManager The SchemaManager
+     * @param name The Table name
+     * @param keySerializer The Key serializer
+     * @param valueSerializer The Value serializer
+     * @param allowDuplicates If the table allows duplicate values
+     * @param cacheSize The cache size to use
+     * @throws IOException If the instance creation failed
+     */
     public MavibotTable( RecordManager recordMan, SchemaManager schemaManager, String name,
         ElementSerializer<K> keySerializer, ElementSerializer<V> valueSerializer,
boolean allowDuplicates, int cacheSize )
         throws IOException
@@ -183,6 +209,9 @@ public class MavibotTable<K, V> extends
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public boolean hasLessOrEqual( K key ) throws Exception
     {
@@ -340,9 +369,8 @@ public class MavibotTable<K, V> extends
                 throw new IllegalArgumentException( I18n.err( I18n.ERR_594 ) );
             }
 
-
             V existingVal = bt.insert( key, value );
-            
+
             if ( existingVal == null )
             {
                 count++;
@@ -539,7 +567,7 @@ public class MavibotTable<K, V> extends
                 ValueCursor<V> dupHolder = bt.getValues( key );
                 int size = dupHolder.size();
                 dupHolder.close();
-                
+
                 return size;
             }
             catch ( KeyNotFoundException knfe )
@@ -597,6 +625,9 @@ public class MavibotTable<K, V> extends
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public ArrayTree<V> getDupsContainer( byte[] serialized ) throws IOException
     {
         if ( serialized == null )
@@ -608,6 +639,9 @@ public class MavibotTable<K, V> extends
     }
 
 
+    /**
+     * @return the underlying B-tree
+     */
     protected BTree<K, V> getBTree()
     {
         return bt;
@@ -622,4 +656,17 @@ public class MavibotTable<K, V> extends
     public synchronized void sync() throws IOException
     {
     }
+
+
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append( "Mavibot table :\n" ).append( super.toString() );
+
+        return sb.toString();
+    }
 }

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractTable.java?rev=1663613&r1=1663612&r2=1663613&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractTable.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractTable.java
Tue Mar  3 10:27:26 2015
@@ -29,7 +29,7 @@ import org.apache.directory.server.i18n.
 
 
 /**
- * A Abstract Table implementation aggregating the methods comon with all the 
+ * A Abstract Table implementation aggregating the methods common with all the 
  * different Table implementation.
  *
  * @param <K> The key
@@ -123,4 +123,21 @@ public abstract class AbstractTable<K, V
     {
         return count;
     }
+
+
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append( "Name    : " ).append( name ).append( '\n' );
+        sb.append( "NbElems : " ).append( count ).append( '\n' );
+        sb.append( "Dups    : " ).append( allowsDuplicates ).append( '\n' );
+        sb.append( "Key     : " ).append( keyComparator.getClass().getName() ).append( '\n'
);
+        sb.append( "Value   : " ).append( valueComparator.getClass().getName() ).append(
'\n' );
+
+        return sb.toString();
+    }
 }



Mime
View raw message