You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ka...@apache.org on 2014/11/29 15:14:12 UTC

svn commit: r1642432 - in /directory/apacheds/trunk/core-shared: ./ src/main/java/org/apache/directory/server/core/shared/

Author: kayyagari
Date: Sat Nov 29 14:14:11 2014
New Revision: 1642432

URL: http://svn.apache.org/r1642432
Log:
store the sorted entries in JDBM BTree (DIRSERVER-2025)

Added:
    directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/NullStringSerializer.java
Modified:
    directory/apacheds/trunk/core-shared/pom.xml
    directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultCoreSession.java
    directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/SortedEntryComparator.java
    directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/SortedEntryCursor.java
    directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/SortedEntrySerializer.java

Modified: directory/apacheds/trunk/core-shared/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-shared/pom.xml?rev=1642432&r1=1642431&r2=1642432&view=diff
==============================================================================
--- directory/apacheds/trunk/core-shared/pom.xml (original)
+++ directory/apacheds/trunk/core-shared/pom.xml Sat Nov 29 14:14:11 2014
@@ -83,8 +83,8 @@
     </dependency>
 
     <dependency>
-       <groupId>org.apache.directory.mavibot</groupId>
-       <artifactId>mavibot</artifactId>
+       <groupId>org.apache.directory.jdbm</groupId>
+       <artifactId>apacheds-jdbm1</artifactId>
     </dependency>
   </dependencies>
 

Modified: directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultCoreSession.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultCoreSession.java?rev=1642432&r1=1642431&r2=1642432&view=diff
==============================================================================
--- directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultCoreSession.java (original)
+++ directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/DefaultCoreSession.java Sat Nov 29 14:14:11 2014
@@ -28,7 +28,8 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Set;
-import java.util.UUID;
+
+import jdbm.recman.BaseRecordManager;
 
 import org.apache.directory.api.ldap.extras.controls.syncrepl.syncInfoValue.SyncRequestValue;
 import org.apache.directory.api.ldap.model.constants.AuthenticationLevel;
@@ -71,13 +72,6 @@ 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.util.Strings;
-import org.apache.directory.mavibot.btree.BTree;
-import org.apache.directory.mavibot.btree.BTreeFactory;
-import org.apache.directory.mavibot.btree.PersistedBTreeConfiguration;
-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.serializer.StringSerializer;
 import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.core.api.CoreSession;
 import org.apache.directory.server.core.api.DirectoryService;
@@ -1305,7 +1299,7 @@ public class DefaultCoreSession implemen
      * @throws KeyNotFoundException 
      */
     private Cursor<Entry> sortResults( Cursor<Entry> unsortedEntries, SortRequest control, SchemaManager schemaManager )
-        throws CursorException, LdapException, IOException, KeyNotFoundException
+        throws CursorException, LdapException, IOException
     {
         unsortedEntries.beforeFirst();
 
@@ -1330,36 +1324,24 @@ public class DefaultCoreSession implemen
         SortedEntryComparator comparator = new SortedEntryComparator( at, sk.getMatchingRuleId(), sk.isReverseOrder(),
             schemaManager );
 
-        SortedEntrySerializer keySerializer = new SortedEntrySerializer( comparator );
-
-        PersistedBTreeConfiguration<Entry, String> config = new PersistedBTreeConfiguration<Entry, String>();
-        config.setName( "replica" ); // see DIRSERVER-2007
-        config.setKeySerializer( keySerializer );
-        config.setValueSerializer( StringSerializer.INSTANCE );
-
-        BTree<Entry, String> btree = BTreeFactory.createPersistedBTree( config );
+        SortedEntrySerializer keySerializer = new SortedEntrySerializer();
+        SortedEntrySerializer.setSchemaManager( schemaManager );
         
-        File file = File.createTempFile( btree.getName(), ".sorted-data" );
-        RecordManager recMan = new RecordManager( file.getAbsolutePath() );
+        File file = File.createTempFile( "replica", ".sorted-data" );// see DIRSERVER-2007
+        BaseRecordManager recMan = new BaseRecordManager( file.getAbsolutePath() );
 
-        try
-        {
-            recMan.manage( btree );
-        }
-        catch ( BTreeAlreadyManagedException e )
-        {
-            throw new LdapException( e );
-        }
+        jdbm.btree.BTree<Entry, String> btree = new jdbm.btree.BTree<Entry, String>( recMan, comparator, keySerializer, NullStringSerializer.INSTANCE );
+        
 
-        btree.insert( first, null );
+        btree.insert( first, "", false );
 
         // at this stage the cursor will be _on_ the next element, so read it
-        btree.insert( unsortedEntries.get(), null );
+        btree.insert( unsortedEntries.get(), "", false );
 
         while ( unsortedEntries.next() )
         {
             Entry entry = unsortedEntries.get();
-            btree.insert( entry, null );
+            btree.insert( entry, "", false );
         }
 
         unsortedEntries.close();

Added: directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/NullStringSerializer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/NullStringSerializer.java?rev=1642432&view=auto
==============================================================================
--- directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/NullStringSerializer.java (added)
+++ directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/NullStringSerializer.java Sat Nov 29 14:14:11 2014
@@ -0,0 +1,55 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
+
+package org.apache.directory.server.core.shared;
+
+
+import java.io.IOException;
+
+import org.apache.directory.api.util.Strings;
+
+import jdbm.helper.Serializer;
+
+
+/**
+ * A JDBM Serializer that serializes null or empty strings and always deserializes them as empty string values.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class NullStringSerializer implements Serializer
+{
+
+    public static final NullStringSerializer INSTANCE = new NullStringSerializer();
+
+
+    @Override
+    public Object deserialize( byte[] data ) throws IOException
+    {
+        return "";
+    }
+
+
+    @Override
+    public byte[] serialize( Object nullStr ) throws IOException
+    {
+        return Strings.EMPTY_BYTES;
+    }
+
+}

Modified: directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/SortedEntryComparator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/SortedEntryComparator.java?rev=1642432&r1=1642431&r2=1642432&view=diff
==============================================================================
--- directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/SortedEntryComparator.java (original)
+++ directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/SortedEntryComparator.java Sat Nov 29 14:14:11 2014
@@ -20,6 +20,7 @@
 package org.apache.directory.server.core.shared;
 
 
+import java.io.Serializable;
 import java.util.Comparator;
 import java.util.TreeSet;
 
@@ -37,14 +38,14 @@ import org.apache.directory.api.ldap.mod
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-class SortedEntryComparator implements Comparator<Entry>
+class SortedEntryComparator implements Comparator<Entry>, Serializable
 {
 
     /** the attribute's type */
-    private AttributeType type;
+    private transient AttributeType type;
 
     /** comparator used for comparing the values of the given attribute type */
-    private Comparator comparator;
+    private transient LdapComparator comparator;
 
     /** flag to indicate if the attribute type is multivalued */
     private boolean multivalued;

Modified: directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/SortedEntryCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/SortedEntryCursor.java?rev=1642432&r1=1642431&r2=1642432&view=diff
==============================================================================
--- directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/SortedEntryCursor.java (original)
+++ directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/SortedEntryCursor.java Sat Nov 29 14:14:11 2014
@@ -25,16 +25,16 @@ import java.io.IOException;
 import java.util.List;
 import java.util.NoSuchElementException;
 
+import jdbm.RecordManager;
+import jdbm.btree.BTree;
+import jdbm.helper.Tuple;
+import jdbm.helper.TupleBrowser;
+
 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.cursor.InvalidCursorPositionException;
 import org.apache.directory.api.ldap.model.entry.Entry;
 import org.apache.directory.api.ldap.model.exception.LdapException;
-import org.apache.directory.mavibot.btree.BTree;
-import org.apache.directory.mavibot.btree.RecordManager;
-import org.apache.directory.mavibot.btree.Tuple;
-import org.apache.directory.mavibot.btree.TupleCursor;
-import org.apache.directory.mavibot.btree.exception.KeyNotFoundException;
 import org.apache.directory.server.core.api.filtering.EntryFilter;
 import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.api.interceptor.context.SearchOperationContext;
@@ -43,7 +43,10 @@ import org.slf4j.LoggerFactory;
 
 
 /**
- * TODO SortedEntryCursor.
+ * Cursor for sorted entries.
+ * 
+ * Note: This currently uses JDBM, but will be migrated to use Mavibot
+ *       when ready.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
@@ -52,26 +55,29 @@ public class SortedEntryCursor extends A
 
     private static final Logger LOG = LoggerFactory.getLogger( SortedEntryCursor.class );
     
-    private TupleCursor<Entry, String> wrapped;
+    private TupleBrowser browser;
 
-    private Tuple<Entry, String> tuple;
+    private final Tuple tuple = new Tuple();
 
     private RecordManager recMan;
 
     private File dataFile;
     
-    public SortedEntryCursor( BTree<Entry,String> btree, RecordManager recMan, File dataFile ) throws IOException, KeyNotFoundException
+    private BTree<Entry, String> btree;
+    
+    public SortedEntryCursor( BTree<Entry,String> btree, RecordManager recMan, File dataFile ) throws IOException
     {
         this.recMan = recMan;
         this.dataFile = dataFile;
-        wrapped = btree.browse();
+        this.btree = btree;
+        browser = btree.browse();
     }
 
 
     @Override
     public boolean available()
     {
-        return ( tuple != null );
+        return ( tuple.getKey() != null );
     }
 
 
@@ -94,8 +100,8 @@ public class SortedEntryCursor extends A
     {
         try
         {
-            tuple = null;
-            wrapped.beforeFirst();
+            clearValue();
+            browser = btree.browse();
         }
         catch ( IOException e )
         {
@@ -109,8 +115,8 @@ public class SortedEntryCursor extends A
     {
         try
         {
-            tuple = null;
-            wrapped.afterLast();
+            clearValue();
+            browser = btree.browse( null );
         }
         catch ( IOException e )
         {
@@ -123,32 +129,16 @@ public class SortedEntryCursor extends A
     @Override
     public boolean first() throws LdapException, CursorException
     {
-        try
-        {
-            wrapped.beforeFirst();
-            return next();
-        }
-        catch ( IOException e )
-        {
-            throw new CursorException( e );
-        }
-
+        beforeFirst();
+        return next();
     }
 
 
     @Override
     public boolean last() throws LdapException, CursorException
     {
-        try
-        {
-            wrapped.afterLast();
-            return previous();
-        }
-        catch ( IOException e )
-        {
-            throw new CursorException( e );
-        }
-
+        afterLast();
+        return previous();
     }
 
 
@@ -157,8 +147,16 @@ public class SortedEntryCursor extends A
     {
         try
         {
-            tuple = wrapped.prev();
-            return true;
+
+            if ( browser == null )
+            {
+                browser = btree.browse( null );
+            }
+            
+            if ( browser.getPrevious( tuple ) )
+            {
+                return true;
+            }
         }
         catch ( IOException e )
         {
@@ -170,7 +168,7 @@ public class SortedEntryCursor extends A
             // instead of doing a check like if(wrapped.hasPrev())
         }
 
-        tuple = null;
+        clearValue();
         return false;
     }
 
@@ -180,8 +178,15 @@ public class SortedEntryCursor extends A
     {
         try
         {
-            tuple = wrapped.next();
-            return true;
+            if ( browser == null )
+            {
+                browser = btree.browse();
+            }
+            
+            if ( browser.getNext( tuple ) )
+            {
+                return true;
+            }
         }
         catch ( IOException e )
         {
@@ -193,7 +198,7 @@ public class SortedEntryCursor extends A
             // instead of doing a check like if(wrapped.hasNext())
         }
 
-        tuple = null;
+        clearValue();
         return false;
     }
 
@@ -201,19 +206,18 @@ public class SortedEntryCursor extends A
     @Override
     public Entry get() throws CursorException
     {
-        if ( tuple == null )
+        if ( tuple.getKey() == null )
         {
             throw new InvalidCursorPositionException();
         }
 
-        return tuple.getKey();
+        return ( Entry ) tuple.getKey();
     }
 
 
     @Override
     public void close()
     {
-        wrapped.close();
         deleteFile();
         super.close();
     }
@@ -222,7 +226,6 @@ public class SortedEntryCursor extends A
     @Override
     public void close( Exception cause )
     {
-        wrapped.close();
         deleteFile();
         super.close( cause );
     }
@@ -248,6 +251,14 @@ public class SortedEntryCursor extends A
         return null;
     }
 
+    
+    private void clearValue()
+    {
+        tuple.setKey( null );
+        tuple.setValue( null );
+    }
+
+    
     private void deleteFile()
     {
         if( recMan == null )

Modified: directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/SortedEntrySerializer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/SortedEntrySerializer.java?rev=1642432&r1=1642431&r2=1642432&view=diff
==============================================================================
--- directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/SortedEntrySerializer.java (original)
+++ directory/apacheds/trunk/core-shared/src/main/java/org/apache/directory/server/core/shared/SortedEntrySerializer.java Sat Nov 29 14:14:11 2014
@@ -26,21 +26,17 @@ import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutput;
 import java.io.ObjectOutputStream;
-import java.nio.ByteBuffer;
-import java.util.Comparator;
+
+import jdbm.helper.Serializer;
 
 import org.apache.directory.api.ldap.model.entry.Attribute;
 import org.apache.directory.api.ldap.model.entry.DefaultAttribute;
 import org.apache.directory.api.ldap.model.entry.DefaultEntry;
 import org.apache.directory.api.ldap.model.entry.Entry;
 import org.apache.directory.api.ldap.model.exception.LdapException;
-import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
 import org.apache.directory.api.ldap.model.name.Dn;
-import org.apache.directory.api.ldap.model.name.Rdn;
 import org.apache.directory.api.ldap.model.schema.AttributeType;
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
-import org.apache.directory.mavibot.btree.serializer.AbstractElementSerializer;
-import org.apache.directory.mavibot.btree.serializer.BufferHandler;
 import org.apache.directory.server.i18n.I18n;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -54,9 +50,12 @@ import org.slf4j.LoggerFactory;
  * 
  * <b>This class must *not* be used anywhere else other than for storing sorted entries in server.</b>
  *  
+ *  Note: this was initially used by Mavibot tree, but changed to use in JDBM later.
+ *        This will again be ported to Mavibot as soon as it gets ready.
+ *        
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class SortedEntrySerializer extends AbstractElementSerializer<Entry>
+public class SortedEntrySerializer implements Serializer
 {
     /** The serialVersionUID */
     private static final long serialVersionUID = 1L;
@@ -72,27 +71,76 @@ public class SortedEntrySerializer exten
     /** The schemaManager reference */
     private static SchemaManager schemaManager;
 
-    private SortedEntryComparator comparator;
-
 
     /**
      * Creates a new instance of ServerEntrySerializer.
      * The schemaManager MUST be set explicitly set using the static {@link #setSchemaManager(SchemaManager)}
      */
-    public SortedEntrySerializer( SortedEntryComparator comparator )
+    public SortedEntrySerializer()
+    {
+    }
+
+
+    @Override
+    public byte[] serialize( Object obj ) throws IOException
     {
-        super( comparator );
-        this.comparator = comparator;
+        return serialize( ( Entry ) obj );
     }
 
 
+
     @Override
-    public Comparator<Entry> getComparator()
+    public Object deserialize( byte[] serialized ) throws IOException
     {
-        return comparator;
+        ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream( serialized ) );
+
+        try
+        {
+            Entry entry = new DefaultEntry( schemaManager );
+
+            Dn dn = new Dn( schemaManager );
+            dn.readExternal( in );
+            entry.setDn( dn );
+
+            // Read the number of attributes
+            int nbAttributes = in.readInt();
+
+            // Read the attributes
+            for ( int i = 0; i < nbAttributes; i++ )
+            {
+                // Read the attribute's OID
+                String oid = in.readUTF();
+
+                try
+                {
+                    AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( oid );
+
+                    // Create the attribute we will read
+                    Attribute attribute = new DefaultAttribute( attributeType );
+
+                    // Read the attribute
+                    attribute.readExternal( in );
+
+                    entry.add( attribute );
+                }
+                catch ( LdapException ne )
+                {
+                    // We weren't able to find the OID. The attribute will not be added
+                    throw new ClassNotFoundException( ne.getMessage(), ne );
+                }
+            }
+
+            return entry;
+        }
+        catch ( ClassNotFoundException cnfe )
+        {
+            LOG.error( I18n.err( I18n.ERR_134, cnfe.getLocalizedMessage() ) );
+            throw new IOException( cnfe.getLocalizedMessage() );
+        }
     }
 
 
+
     /**
      * <p>
      * 
@@ -171,175 +219,9 @@ public class SortedEntrySerializer exten
     }
 
 
-    /**
-     *  Deserialize a Entry.
-     *  
-     *  @param bytes the byte array containing the serialized entry
-     *  @return An instance of a Entry object 
-     *  @throws IOException if we can't deserialize the Entry
-     */
-    public Entry deserialize( ByteBuffer buffer ) throws IOException
-    {
-        // read the length
-        int len = buffer.limit();
-
-        ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream( buffer.array(), buffer.position(), len ) );
-
-        try
-        {
-            Entry entry = new DefaultEntry( schemaManager );
-
-            // Read the Dn
-            Dn dn = new Dn( schemaManager );
-            dn.readExternal( in );
-            entry.setDn( dn );
-
-            // Read the number of attributes
-            int nbAttributes = in.readInt();
-
-            // Read the attributes
-            for ( int i = 0; i < nbAttributes; i++ )
-            {
-                // Read the attribute's OID
-                String oid = in.readUTF();
-
-                try
-                {
-                    AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( oid );
-
-                    // Create the attribute we will read
-                    Attribute attribute = new DefaultAttribute( attributeType );
-
-                    // Read the attribute
-                    attribute.readExternal( in );
-
-                    entry.add( attribute );
-                }
-                catch ( LdapException ne )
-                {
-                    // We weren't able to find the OID. The attribute will not be added
-                    throw new ClassNotFoundException( ne.getMessage(), ne );
-                }
-            }
-
-            buffer.position( buffer.position() + len ); // previous position + length
-
-            return entry;
-        }
-        catch ( ClassNotFoundException cnfe )
-        {
-            LOG.error( I18n.err( I18n.ERR_134, cnfe.getLocalizedMessage() ) );
-            throw new IOException( cnfe.getLocalizedMessage() );
-        }
-    }
-
-
-    @Override
-    public Entry deserialize( BufferHandler bufferHandler ) throws IOException
-    {
-        return deserialize( ByteBuffer.wrap( bufferHandler.getBuffer() ) );
-    }
-
-
     public static void setSchemaManager( SchemaManager schemaManager )
     {
         SortedEntrySerializer.schemaManager = schemaManager;
     }
 
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Entry fromBytes( byte[] buffer ) throws IOException
-    {
-        return fromBytes( buffer, 0 );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Entry fromBytes( byte[] buffer, int pos ) throws IOException
-    {
-        // read the length
-        int len = buffer.length - pos;
-
-        ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream( buffer, pos, len ) );
-
-        try
-        {
-            Entry entry = new DefaultEntry( schemaManager );
-
-            // Read the Dn, if any
-            byte hasDn = in.readByte();
-
-            if ( hasDn == 1 )
-            {
-                Rdn rdn = new Rdn( schemaManager );
-                rdn.readExternal( in );
-
-                try
-                {
-                    entry.setDn( new Dn( schemaManager, rdn ) );
-                }
-                catch ( LdapInvalidDnException lide )
-                {
-                    IOException ioe = new IOException( lide.getMessage() );
-                    ioe.initCause( lide );
-                    throw ioe;
-                }
-            }
-            else
-            {
-                entry.setDn( Dn.EMPTY_DN );
-            }
-
-            // Read the number of attributes
-            int nbAttributes = in.readInt();
-
-            // Read the attributes
-            for ( int i = 0; i < nbAttributes; i++ )
-            {
-                // Read the attribute's OID
-                String oid = in.readUTF();
-
-                try
-                {
-                    AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( oid );
-
-                    // Create the attribute we will read
-                    Attribute attribute = new DefaultAttribute( attributeType );
-
-                    // Read the attribute
-                    attribute.readExternal( in );
-
-                    entry.add( attribute );
-                }
-                catch ( LdapException ne )
-                {
-                    // We weren't able to find the OID. The attribute will not be added
-                    throw new ClassNotFoundException( ne.getMessage(), ne );
-                }
-            }
-
-            return entry;
-        }
-        catch ( ClassNotFoundException cnfe )
-        {
-            LOG.error( I18n.err( I18n.ERR_134, cnfe.getLocalizedMessage() ) );
-            throw new IOException( cnfe.getLocalizedMessage() );
-        }
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public Class<?> getType()
-    {
-        return Entry.class;
-    }
 }