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 2018/11/19 03:45:29 UTC

[directory-ldap-api] branch master updated: o Added the Abandon, Add, Bind and Delete request factories o The LdapEncoder.encodeReverse method now support Control encoding o Added a method in the CodecFactory interface, to encode the value (no control implements it atm)

This is an automated email from the ASF dual-hosted git repository.

elecharny pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-ldap-api.git


The following commit(s) were added to refs/heads/master by this push:
     new d134a91  o Added the Abandon, Add, Bind and Delete request factories o The LdapEncoder.encodeReverse method now support Control encoding o Added a method in the CodecFactory interface, to encode the value (no control implements it atm)
d134a91 is described below

commit d134a9164c4ff29fa1e67f3f7fa43d7953fa20f2
Author: Emmanuel Lecharny <el...@apache.org>
AuthorDate: Mon Nov 19 04:45:26 2018 +0100

    o Added the Abandon, Add, Bind and Delete request factories
    o The LdapEncoder.encodeReverse method now support Control encoding
    o Added a method in the CodecFactory interface, to encode the value (no
    control implements it atm)
---
 .../directory/api/asn1/ber/tlv/BerValue.java       |  80 +-
 .../api/ldap/codec/api/ControlFactory.java         |  12 +-
 .../api/ldap/codec/api/LdapApiService.java         |  65 +-
 .../directory/api/ldap/codec/api/LdapEncoder.java  |  74 +-
 .../codec/controls/cascade/CascadeFactory.java     |  10 +
 .../controls/manageDsaIT/ManageDsaITFactory.java   |  10 +
 .../controls/proxiedauthz/ProxiedAuthzFactory.java |  10 +
 .../search/entryChange/EntryChangeFactory.java     |  10 +
 .../search/pagedSearch/PagedResultsFactory.java    |  10 +
 .../persistentSearch/PersistentSearchFactory.java  |  14 +-
 .../search/subentries/SubentriesFactory.java       |  18 +-
 .../codec/controls/sort/SortRequestFactory.java    |  10 +
 .../codec/controls/sort/SortResponseFactory.java   |  10 +
 .../ldap/codec/factory/AbandonRequestFactory.java  |  60 ++
 .../api/ldap/codec/factory/AddRequestFactory.java  | 175 +++++
 .../api/ldap/codec/factory/BindRequestFactory.java |   5 +-
 .../ldap/codec/factory/DeleteRequestFactory.java   |  67 ++
 .../ldap/codec/osgi/DefaultLdapCodecService.java   |  19 +-
 .../api/ldap/codec/abandon/AbandonRequestTest.java |  15 +-
 .../api/ldap/codec/add/AddRequestTest.java         | 859 +++++----------------
 .../extras/controls/ad_impl/AdDirSyncFactory.java  |  10 +
 .../controls/ad_impl/AdPolicyHintsFactory.java     |  10 +
 .../controls/ad_impl/AdShowDeletedFactory.java     |  10 +
 .../ChangeNotificationsFactory.java                |  10 +
 .../PermissiveModifyFactory.java                   |  10 +
 .../ppolicy_impl/PasswordPolicyFactory.java        |  16 +-
 .../syncrepl_impl/SyncDoneValueFactory.java        |  10 +
 .../syncrepl_impl/SyncRequestValueFactory.java     |  10 +
 .../syncrepl_impl/SyncStateValueFactory.java       |  10 +
 .../TransactionSpecificationFactory.java           |  10 +
 .../vlv_impl/VirtualListViewRequestFactory.java    |  10 +
 .../vlv_impl/VirtualListViewResponseFactory.java   |  10 +
 .../api/ldap/model/entry/DefaultEntry.java         |  34 +-
 .../directory/api/ldap/model/entry/Entry.java      | 206 ++---
 .../api/ldap/model/entry/ImmutableEntry.java       |  62 +-
 35 files changed, 1079 insertions(+), 882 deletions(-)

diff --git a/asn1/ber/src/main/java/org/apache/directory/api/asn1/ber/tlv/BerValue.java b/asn1/ber/src/main/java/org/apache/directory/api/asn1/ber/tlv/BerValue.java
index 814cd5e..6abf8dd 100644
--- a/asn1/ber/src/main/java/org/apache/directory/api/asn1/ber/tlv/BerValue.java
+++ b/asn1/ber/src/main/java/org/apache/directory/api/asn1/ber/tlv/BerValue.java
@@ -625,6 +625,25 @@ public class BerValue
 
 
     /**
+     * Encode a boolean value
+     *
+     * @param buffer The PDU in which the value will be put
+     * @param bool The boolean to be encoded
+     */
+    public static void encodeBoolean( Asn1Buffer buffer, boolean bool )
+    {
+        if ( bool )
+        {
+            buffer.put( ENCODED_TRUE );
+        }
+        else
+        {
+            buffer.put( ENCODED_FALSE );
+        }
+    }
+
+
+    /**
      * Encode an integer value
      *
      * @param buffer The PDU in which the value will be put
@@ -701,8 +720,7 @@ public class BerValue
     /**
      * Encode a Sequence
      *
-     * @param buffer The PDU in which the value will be put
-     * @param value The integer to be encoded
+     * @param buffer The PDU in which the Sequence will be put
      */
     public static void encodeSequence( Asn1Buffer buffer )
     {
@@ -714,7 +732,7 @@ public class BerValue
     /**
      * Encode a Sequence, with a specific length
      *
-     * @param buffer The PDU in which the value will be put
+     * @param buffer The PDU in which the Sequence will be put
      * @param start The Sequence length
      */
     public static void encodeSequence( Asn1Buffer buffer, int start )
@@ -727,7 +745,7 @@ public class BerValue
     /**
      * Encode a Sequence, with a specific tag
      *
-     * @param buffer The PDU in which the value will be put
+     * @param buffer The PDU in which the Sequence will be put
      * @param tag The tag to use
      */
     public static void encodeSequence( Asn1Buffer buffer, byte tag )
@@ -740,7 +758,7 @@ public class BerValue
     /**
      * Encode a Sequence, with a specific length and tag
      *
-     * @param buffer The PDU in which the value will be put
+     * @param buffer The PDU in which the Sequence will be put
      * @param tag The tag to use
      * @param start The position in the buffer this Sequence starts
      */
@@ -752,6 +770,58 @@ public class BerValue
 
 
     /**
+     * Encode a Set
+     *
+     * @param buffer The PDU in which the Set will be put
+     */
+    public static void encodeSet( Asn1Buffer buffer )
+    {
+        buffer.put( TLV.getBytes( buffer.getPos() ) );
+        buffer.put( UniversalTag.SET.getValue() );
+    }
+
+
+    /**
+     * Encode a Set, with a specific length
+     *
+     * @param buffer The PDU in which the Set will be put
+     * @param start The Set length
+     */
+    public static void encodeSet( Asn1Buffer buffer, int start )
+    {
+        buffer.put( TLV.getBytes( buffer.getPos() - start ) );
+        buffer.put( UniversalTag.SET.getValue() );
+    }
+
+
+    /**
+     * Encode a Set, with a specific tag
+     *
+     * @param buffer The PDU in which the value will be put
+     * @param tag The tag to use
+     */
+    public static void encodeSet( Asn1Buffer buffer, byte tag )
+    {
+        buffer.put( TLV.getBytes( buffer.getPos() ) );
+        buffer.put( tag );
+    }
+
+
+    /**
+     * Encode a Set, with a specific length and tag
+     *
+     * @param buffer The PDU in which the set will be put
+     * @param tag The tag to use
+     * @param start The position in the buffer this Set starts
+     */
+    public static void encodeSet( Asn1Buffer buffer, byte tag, int start )
+    {
+        buffer.put( TLV.getBytes( buffer.getPos() - start ) );
+        buffer.put( tag );
+    }
+
+
+    /**
      * Encode a String value
      *
      * @param buffer The PDU in which the value will be put
diff --git a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/ControlFactory.java b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/ControlFactory.java
index 8335f1c..ecce7f4 100644
--- a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/ControlFactory.java
+++ b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/ControlFactory.java
@@ -20,6 +20,7 @@
 package org.apache.directory.api.ldap.codec.api;
 
 
+import org.apache.directory.api.asn1.util.Asn1Buffer;
 import org.apache.directory.api.ldap.model.message.Control;
 
 
@@ -30,7 +31,7 @@ import org.apache.directory.api.ldap.model.message.Control;
  * those controls.
  *
  * @param <C> The Control to create
- * 
+ *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public interface ControlFactory<C extends Control>
@@ -58,4 +59,13 @@ public interface ControlFactory<C extends Control>
      * @return The decorator wrapping the Control.
      */
     CodecControl<C> newCodecControl( C control );
+
+
+    /**
+     * Encode the value part of the control.
+     *
+     * @param buffer The buffer into whicht o put the encoded value
+     * @param control The control to encode
+     */
+    void encodeValue( Asn1Buffer buffer, Control control );
 }
diff --git a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/LdapApiService.java b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/LdapApiService.java
index 095fabb..b0607ba 100644
--- a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/LdapApiService.java
+++ b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/LdapApiService.java
@@ -21,6 +21,7 @@ package org.apache.directory.api.ldap.codec.api;
 
 
 import java.util.Iterator;
+import java.util.Map;
 
 import org.apache.directory.api.asn1.DecoderException;
 import org.apache.directory.api.asn1.EncoderException;
@@ -54,7 +55,7 @@ public interface LdapApiService
 
     /**
      * Returns an Iterator over the OID Strings of registered controls.
-     * 
+     *
      * @return The registered control OID Strings
      */
     Iterator<String> registeredControls();
@@ -62,7 +63,7 @@ public interface LdapApiService
 
     /**
      * Checks if a control has been registered.
-     * 
+     *
      * @param oid The Control OID we are looking for
      * @return The OID of the control to check for registration
      */
@@ -71,7 +72,7 @@ public interface LdapApiService
 
     /**
      * Registers an {@link ControlFactory} with this service.
-     * 
+     *
      * @param factory The control factory
      * @return The registred control factory
      */
@@ -80,7 +81,7 @@ public interface LdapApiService
 
     /**
      * Unregisters an {@link ControlFactory} with this service.
-     * 
+     *
      * @param oid The oid of the control the factory is associated with.
      * @return The unregistred control factory
      */
@@ -125,12 +126,18 @@ public interface LdapApiService
     Control fromJndiControl( javax.naming.ldap.Control jndiControl ) throws DecoderException;
 
 
+    /**
+     * @return the controlFactories
+     */
+    Map<String, ControlFactory<? extends Control>> getControlFactories();
+
+
     // ------------------------------------------------------------------------
     // Extended Request Methods
     // ------------------------------------------------------------------------
 
     /**
-     * Returns an Iterator over the OID Strings of registered extended 
+     * Returns an Iterator over the OID Strings of registered extended
      * requests.
      *
      * @return The registered extended request OID Strings
@@ -139,9 +146,9 @@ public interface LdapApiService
 
 
     /**
-     * Registers an {@link ExtendedOperationFactory} for generating extended request 
+     * Registers an {@link ExtendedOperationFactory} for generating extended request
      * response pairs.
-     * 
+     *
      * @param factory The extended request factory
      * @return The displaced factory if one existed for the oid
      */
@@ -149,9 +156,9 @@ public interface LdapApiService
 
 
     /**
-     * Unregisters an {@link ExtendedOperationFactory} for generating extended 
+     * Unregisters an {@link ExtendedOperationFactory} for generating extended
      * request response pairs.
-     * 
+     *
      * @param oid The extended request oid
      * @return The displaced factory if one existed for the oid
      */
@@ -159,21 +166,21 @@ public interface LdapApiService
 
 
     /**
-     * Checks to see if an extended operation, either a standard request 
+     * Checks to see if an extended operation, either a standard request
      * response, pair or just an unsolicited response is registered.
      *
      * @param oid The object identifier for the extended operation
      * @return true if registered, false if not
      */
     boolean isExtendedOperationRegistered( String oid );
-    
-    
+
+
     // ------------------------------------------------------------------------
     // Intermediate Response Methods
     // ------------------------------------------------------------------------
-    
+
     /**
-     * Returns an Iterator over the OID Strings of registered intermediate 
+     * Returns an Iterator over the OID Strings of registered intermediate
      * responses.
      *
      * @return The registered Intermediate response OID Strings
@@ -183,7 +190,7 @@ public interface LdapApiService
 
     /**
      * Registers an {@link IntermediateResponseFactory} for generating intermediate response
-     * 
+     *
      * @param factory The intermediate response factory
      * @return The displaced factory if one existed for the oid
      */
@@ -191,9 +198,9 @@ public interface LdapApiService
 
 
     /**
-     * Unregisters an {@link IntermediateResponseFactory} for generating intermediate 
+     * Unregisters an {@link IntermediateResponseFactory} for generating intermediate
      * response
-     * 
+     *
      * @param oid The intermediate response oid
      * @return The displaced factory if one existed for the oid
      */
@@ -217,7 +224,7 @@ public interface LdapApiService
     /**
      * Creates a model ExtendedResponse from the JNDI ExtendedResponse.
      *
-     * @param jndiResponse The JNDI ExtendedResponse 
+     * @param jndiResponse The JNDI ExtendedResponse
      * @return The model ExtendedResponse
      * @throws DecoderException if the response value cannot be decoded.
      */
@@ -225,9 +232,9 @@ public interface LdapApiService
 
 
     /**
-     * Creates a JNDI {@link javax.naming.ldap.ExtendedResponse} from the model 
+     * Creates a JNDI {@link javax.naming.ldap.ExtendedResponse} from the model
      * {@link ExtendedResponse}.
-     * 
+     *
      * @param modelResponse The extended response to convert
      * @return A JNDI extended response
      * @throws EncoderException If the conversion failed
@@ -238,7 +245,7 @@ public interface LdapApiService
     /**
      * Creates a model ExtendedResponse from the JNDI ExtendedRequest.
      *
-     * @param jndiRequest The JNDI ExtendedRequest 
+     * @param jndiRequest The JNDI ExtendedRequest
      * @return The model ExtendedRequest
      * @throws DecoderException if the request value cannot be decoded.
      */
@@ -246,9 +253,9 @@ public interface LdapApiService
 
 
     /**
-     * Creates a JNDI {@link javax.naming.ldap.ExtendedRequest} from the model 
+     * Creates a JNDI {@link javax.naming.ldap.ExtendedRequest} from the model
      * {@link ExtendedRequest}.
-     * 
+     *
      * @param modelRequest The extended request to convert
      * @return A JNDI extended request
      * @throws EncoderException If the conversion failed
@@ -272,7 +279,7 @@ public interface LdapApiService
      * Registers a ProtocolCodecFactory with this LdapCodecService.
      *
      * @param factory The factory being registered.
-     * @return The previously set {@link ProtocolCodecFactory}, or null if 
+     * @return The previously set {@link ProtocolCodecFactory}, or null if
      * none had been set earlier.
      */
     ProtocolCodecFactory registerProtocolCodecFactory( ProtocolCodecFactory factory );
@@ -289,13 +296,13 @@ public interface LdapApiService
     /**
      * Create an instance of a ExtendedResponse, knowing its OID. Inject the payload
      * into it.
-     * 
+     *
      * @param responseName The extendedRespose OID
      * @param messageId The original message ID
      * @param serializedResponse The serialized response payload
      * @param <E> The extended response type
      * @return The extendedResponse instance
-     * 
+     *
      * @throws DecoderException If the payload is incorrect
      */
     <E extends ExtendedResponse> E newExtendedResponse( String responseName, int messageId, byte[] serializedResponse )
@@ -304,7 +311,7 @@ public interface LdapApiService
 
     /**
      * Creates a new ExtendedRequest instance.
-     * 
+     *
      * @param oid the extended request's object identifier
      * @param value the encoded value of the extended request
      * @return The new extended request
@@ -315,13 +322,13 @@ public interface LdapApiService
     /**
      * Create an instance of a IntermediateResponse, knowing its OID. Inject the payload
      * into it.
-     * 
+     *
      * @param responseName The intermediateRespose OID
      * @param messageId The original message ID
      * @param serializedResponse The serialized response payload
      * @param <I> The intermediate response type
      * @return The intermediateResponse instance
-     * 
+     *
      * @throws DecoderException If the payload is incorrect
      */
     <I extends IntermediateResponse> I newIntermediateResponse( String responseName, int messageId, byte[] serializedResponse )
diff --git a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/LdapEncoder.java b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/LdapEncoder.java
index bb78301..1f125bd 100644
--- a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/LdapEncoder.java
+++ b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/api/LdapEncoder.java
@@ -23,6 +23,7 @@ package org.apache.directory.api.ldap.codec.api;
 import java.nio.BufferOverflowException;
 import java.nio.ByteBuffer;
 import java.util.Collection;
+import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.directory.api.asn1.EncoderException;
@@ -31,6 +32,8 @@ import org.apache.directory.api.asn1.ber.tlv.TLV;
 import org.apache.directory.api.asn1.ber.tlv.UniversalTag;
 import org.apache.directory.api.asn1.util.Asn1Buffer;
 import org.apache.directory.api.i18n.I18n;
+import org.apache.directory.api.ldap.codec.factory.AbandonRequestFactory;
+import org.apache.directory.api.ldap.codec.factory.AddRequestFactory;
 import org.apache.directory.api.ldap.codec.factory.BindRequestFactory;
 import org.apache.directory.api.ldap.model.message.Control;
 import org.apache.directory.api.ldap.model.message.Message;
@@ -128,34 +131,52 @@ public final class LdapEncoder
 
 
     /**
-     * Encode the controls
+     * Encode a control to a byte[]. The controls are encoded recursively, to start with the last
+     * control first.
+     * <br>
+     * A control is encoded as:
+     * <pre>
+     * 0x30 LL
+     *   0x04 LL abcd               control OID
+     *   [0x01 0x01 0x00/0xFF]      control criticality
+     *   [0x04 LL value]            control value
+     * </pre>
+     *
      *
      * @param buffer The buffer that will contain the encoded control
-     * @param codec The LdapApiService instance
-     * @param controls The control to encode
+     * @param control The control to encode
+     * @return The control encoded in a byte[]
+     * @throws EncoderException If the encoding failed
      */
-    private static void encodeControlsReverse( Asn1Buffer buffer, LdapApiService codec, Map<String, Control> controls )
+    private static void encodeControlsReverse( Asn1Buffer buffer, LdapApiService codec,
+        Map<String, Control> controls, Iterator<String> iterator ) throws EncoderException
     {
-        // Encode each control
-        /*for ( Control control : controls.values() )
+        if ( iterator.hasNext() )
         {
-            encodeControlReverse( buffer, control );
+            Control control = controls.get( iterator.next() );
 
-            // The OctetString tag if the value is not null
-            int controlValueLength = ( ( CodecControl<?> ) control ).computeLength();
+            encodeControlsReverse( buffer, codec, controls, iterator );
 
-            if ( controlValueLength > 0 )
-            {
-                buffer.put( UniversalTag.OCTET_STRING.getValue() );
-                buffer.put( TLV.getBytes( controlValueLength ) );
+            // Fetch the control's factory from the LdapApiService
+            ControlFactory<?> controlFactory = codec.getControlFactories().get( control.getOid() );
 
-                // And now, the value
-                ( ( org.apache.directory.api.ldap.codec.api.CodecControl<?> ) control ).encode( buffer );
+            int start = buffer.getPos();
+
+            // the value, if any
+            controlFactory.encodeValue( buffer, control );
+
+            // The criticality
+            if ( control.isCritical() )
+            {
+                BerValue.encodeBoolean( buffer, control.isCritical() );
             }
-        }
-        */
 
-        BerValue.encodeSequence( buffer, ( byte ) LdapCodecConstants.CONTROLS_TAG );
+            // The OID
+            BerValue.encodeOctetString( buffer, Strings.getBytesUtf8( control.getOid() ) );
+
+            // The Control Sequence
+            BerValue.encodeSequence( buffer, start );
+        }
     }
 
 
@@ -168,13 +189,22 @@ public final class LdapEncoder
      */
     private static void encodeProtocolOp( Asn1Buffer buffer, LdapApiService codec, Message message )
     {
-        switch ( message.getClass().getName() )
+        switch ( message.getClass().getSimpleName() )
         {
+            case "AbandonRequestImpl" :
+                AbandonRequestFactory.INSTANCE.encodeReverse( buffer, message );
+                return;
+
+            case "AddRequestImpl" :
+                AddRequestFactory.INSTANCE.encodeReverse( buffer, message );
+                return;
+
             case "BindRequestImpl" :
                 BindRequestFactory.INSTANCE.encodeReverse( buffer, message );
+                return;
 
-                default:
-                    // Nothing to do
+            default:
+                // Nothing to do
         }
     }
 
@@ -211,7 +241,7 @@ public final class LdapEncoder
 
         if ( ( controls != null ) && ( controls.size() > 0 ) )
         {
-            encodeControlsReverse( buffer, codec, message.getControls() );
+            encodeControlsReverse( buffer, codec, message.getControls(), message.getControls().keySet().iterator() );
         }
 
         // The protocolOp part
diff --git a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/cascade/CascadeFactory.java b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/cascade/CascadeFactory.java
index c89f4c7..f1cd4bf 100644
--- a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/cascade/CascadeFactory.java
+++ b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/cascade/CascadeFactory.java
@@ -20,9 +20,11 @@
 package org.apache.directory.api.ldap.codec.controls.cascade;
 
 
+import org.apache.directory.api.asn1.util.Asn1Buffer;
 import org.apache.directory.api.ldap.codec.api.CodecControl;
 import org.apache.directory.api.ldap.codec.api.ControlFactory;
 import org.apache.directory.api.ldap.codec.api.LdapApiService;
+import org.apache.directory.api.ldap.model.message.Control;
 import org.apache.directory.api.ldap.model.message.controls.Cascade;
 import org.apache.directory.api.ldap.model.message.controls.CascadeImpl;
 
@@ -78,4 +80,12 @@ public class CascadeFactory implements ControlFactory<Cascade>
     {
         return new CascadeDecorator( codec, control );
     }
+
+
+    @Override
+    public void encodeValue( Asn1Buffer buffer, Control control )
+    {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/manageDsaIT/ManageDsaITFactory.java b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/manageDsaIT/ManageDsaITFactory.java
index 1427d00..dbe4a53 100644
--- a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/manageDsaIT/ManageDsaITFactory.java
+++ b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/manageDsaIT/ManageDsaITFactory.java
@@ -20,9 +20,11 @@
 package org.apache.directory.api.ldap.codec.controls.manageDsaIT;
 
 
+import org.apache.directory.api.asn1.util.Asn1Buffer;
 import org.apache.directory.api.ldap.codec.api.CodecControl;
 import org.apache.directory.api.ldap.codec.api.ControlFactory;
 import org.apache.directory.api.ldap.codec.api.LdapApiService;
+import org.apache.directory.api.ldap.model.message.Control;
 import org.apache.directory.api.ldap.model.message.controls.ManageDsaIT;
 import org.apache.directory.api.ldap.model.message.controls.ManageDsaITImpl;
 
@@ -78,4 +80,12 @@ public class ManageDsaITFactory implements ControlFactory<ManageDsaIT>
     {
         return new ManageDsaITDecorator( codec, control );
     }
+
+
+    @Override
+    public void encodeValue( Asn1Buffer buffer, Control control )
+    {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/proxiedauthz/ProxiedAuthzFactory.java b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/proxiedauthz/ProxiedAuthzFactory.java
index 2c4fc29..af72197 100644
--- a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/proxiedauthz/ProxiedAuthzFactory.java
+++ b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/proxiedauthz/ProxiedAuthzFactory.java
@@ -20,9 +20,11 @@
 package org.apache.directory.api.ldap.codec.controls.proxiedauthz;
 
 
+import org.apache.directory.api.asn1.util.Asn1Buffer;
 import org.apache.directory.api.ldap.codec.api.CodecControl;
 import org.apache.directory.api.ldap.codec.api.ControlFactory;
 import org.apache.directory.api.ldap.codec.api.LdapApiService;
+import org.apache.directory.api.ldap.model.message.Control;
 import org.apache.directory.api.ldap.model.message.controls.ProxiedAuthz;
 
 
@@ -77,4 +79,12 @@ public class ProxiedAuthzFactory implements ControlFactory<ProxiedAuthz>
     {
         return new ProxiedAuthzDecorator( codec, control );
     }
+
+
+    @Override
+    public void encodeValue( Asn1Buffer buffer, Control control )
+    {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/entryChange/EntryChangeFactory.java b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/entryChange/EntryChangeFactory.java
index c2ccc54..c039298 100644
--- a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/entryChange/EntryChangeFactory.java
+++ b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/entryChange/EntryChangeFactory.java
@@ -20,9 +20,11 @@
 package org.apache.directory.api.ldap.codec.controls.search.entryChange;
 
 
+import org.apache.directory.api.asn1.util.Asn1Buffer;
 import org.apache.directory.api.ldap.codec.api.CodecControl;
 import org.apache.directory.api.ldap.codec.api.ControlFactory;
 import org.apache.directory.api.ldap.codec.api.LdapApiService;
+import org.apache.directory.api.ldap.model.message.Control;
 import org.apache.directory.api.ldap.model.message.controls.EntryChange;
 
 
@@ -77,4 +79,12 @@ public class EntryChangeFactory implements ControlFactory<EntryChange>
     {
         return new EntryChangeDecorator( codec, control );
     }
+
+
+    @Override
+    public void encodeValue( Asn1Buffer buffer, Control control )
+    {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/pagedSearch/PagedResultsFactory.java b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/pagedSearch/PagedResultsFactory.java
index 4837847..ddd0b6f 100644
--- a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/pagedSearch/PagedResultsFactory.java
+++ b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/pagedSearch/PagedResultsFactory.java
@@ -20,9 +20,11 @@
 package org.apache.directory.api.ldap.codec.controls.search.pagedSearch;
 
 
+import org.apache.directory.api.asn1.util.Asn1Buffer;
 import org.apache.directory.api.ldap.codec.api.CodecControl;
 import org.apache.directory.api.ldap.codec.api.ControlFactory;
 import org.apache.directory.api.ldap.codec.api.LdapApiService;
+import org.apache.directory.api.ldap.model.message.Control;
 import org.apache.directory.api.ldap.model.message.controls.PagedResults;
 
 
@@ -77,4 +79,12 @@ public class PagedResultsFactory implements ControlFactory<PagedResults>
     {
         return new PagedResultsDecorator( codec, control );
     }
+
+
+    @Override
+    public void encodeValue( Asn1Buffer buffer, Control control )
+    {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/persistentSearch/PersistentSearchFactory.java b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/persistentSearch/PersistentSearchFactory.java
index 089104c..fe48ad6 100644
--- a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/persistentSearch/PersistentSearchFactory.java
+++ b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/persistentSearch/PersistentSearchFactory.java
@@ -20,14 +20,16 @@
 package org.apache.directory.api.ldap.codec.controls.search.persistentSearch;
 
 
+import org.apache.directory.api.asn1.util.Asn1Buffer;
 import org.apache.directory.api.ldap.codec.api.CodecControl;
 import org.apache.directory.api.ldap.codec.api.ControlFactory;
 import org.apache.directory.api.ldap.codec.api.LdapApiService;
+import org.apache.directory.api.ldap.model.message.Control;
 import org.apache.directory.api.ldap.model.message.controls.PersistentSearch;
 
 
 /**
- * A factory to create a PersistentSearch control 
+ * A factory to create a PersistentSearch control
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
@@ -39,7 +41,7 @@ public class PersistentSearchFactory implements ControlFactory<PersistentSearch>
 
     /**
      * Create a new PersistentSearchFactory instance
-     * 
+     *
      * @param codec The LdapApiService instance
      */
     public PersistentSearchFactory( LdapApiService codec )
@@ -76,4 +78,12 @@ public class PersistentSearchFactory implements ControlFactory<PersistentSearch>
     {
         return new PersistentSearchDecorator( codec, control );
     }
+
+
+    @Override
+    public void encodeValue( Asn1Buffer buffer, Control control )
+    {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/subentries/SubentriesFactory.java b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/subentries/SubentriesFactory.java
index 18dd584..2747634 100644
--- a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/subentries/SubentriesFactory.java
+++ b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/search/subentries/SubentriesFactory.java
@@ -20,14 +20,16 @@
 package org.apache.directory.api.ldap.codec.controls.search.subentries;
 
 
+import org.apache.directory.api.asn1.util.Asn1Buffer;
 import org.apache.directory.api.ldap.codec.api.CodecControl;
 import org.apache.directory.api.ldap.codec.api.ControlFactory;
 import org.apache.directory.api.ldap.codec.api.LdapApiService;
+import org.apache.directory.api.ldap.model.message.Control;
 import org.apache.directory.api.ldap.model.message.controls.Subentries;
 
 
 /**
- * A factory for creating {@link Subentries} Controls and their 
+ * A factory for creating {@link Subentries} Controls and their
  * {@link SubentriesDecorator} objects.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
@@ -51,7 +53,7 @@ public class SubentriesFactory implements ControlFactory<Subentries>
 
 
     /**
-     * 
+     *
      * {@inheritDoc}
      */
     @Override
@@ -62,7 +64,7 @@ public class SubentriesFactory implements ControlFactory<Subentries>
 
 
     /**
-     * 
+     *
      * {@inheritDoc}
      */
     @Override
@@ -73,7 +75,7 @@ public class SubentriesFactory implements ControlFactory<Subentries>
 
 
     /**
-     * 
+     *
      * {@inheritDoc}
      */
     @Override
@@ -81,4 +83,12 @@ public class SubentriesFactory implements ControlFactory<Subentries>
     {
         return new SubentriesDecorator( codec, control );
     }
+
+
+    @Override
+    public void encodeValue( Asn1Buffer buffer, Control control )
+    {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/sort/SortRequestFactory.java b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/sort/SortRequestFactory.java
index 980bbd3..4c21afe 100644
--- a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/sort/SortRequestFactory.java
+++ b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/sort/SortRequestFactory.java
@@ -20,9 +20,11 @@
 package org.apache.directory.api.ldap.codec.controls.sort;
 
 
+import org.apache.directory.api.asn1.util.Asn1Buffer;
 import org.apache.directory.api.ldap.codec.api.CodecControl;
 import org.apache.directory.api.ldap.codec.api.ControlFactory;
 import org.apache.directory.api.ldap.codec.api.LdapApiService;
+import org.apache.directory.api.ldap.model.message.Control;
 import org.apache.directory.api.ldap.model.message.controls.SortRequest;
 
 
@@ -77,4 +79,12 @@ public class SortRequestFactory implements ControlFactory<SortRequest>
     {
         return new SortRequestDecorator( codec, control );
     }
+
+
+    @Override
+    public void encodeValue( Asn1Buffer buffer, Control control )
+    {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/sort/SortResponseFactory.java b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/sort/SortResponseFactory.java
index fcd2c3c..8cc77ad 100644
--- a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/sort/SortResponseFactory.java
+++ b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/controls/sort/SortResponseFactory.java
@@ -20,9 +20,11 @@
 package org.apache.directory.api.ldap.codec.controls.sort;
 
 
+import org.apache.directory.api.asn1.util.Asn1Buffer;
 import org.apache.directory.api.ldap.codec.api.CodecControl;
 import org.apache.directory.api.ldap.codec.api.ControlFactory;
 import org.apache.directory.api.ldap.codec.api.LdapApiService;
+import org.apache.directory.api.ldap.model.message.Control;
 import org.apache.directory.api.ldap.model.message.controls.SortResponse;
 
 
@@ -77,4 +79,12 @@ public class SortResponseFactory implements ControlFactory<SortResponse>
     {
         return new SortResponseDecorator( codec, control );
     }
+
+
+    @Override
+    public void encodeValue( Asn1Buffer buffer, Control control )
+    {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/factory/AbandonRequestFactory.java b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/factory/AbandonRequestFactory.java
new file mode 100644
index 0000000..597eb78
--- /dev/null
+++ b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/factory/AbandonRequestFactory.java
@@ -0,0 +1,60 @@
+/*
+ *  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.api.ldap.codec.factory;
+
+import org.apache.directory.api.asn1.ber.tlv.BerValue;
+import org.apache.directory.api.asn1.util.Asn1Buffer;
+import org.apache.directory.api.ldap.codec.api.LdapCodecConstants;
+import org.apache.directory.api.ldap.model.message.AbandonRequest;
+import org.apache.directory.api.ldap.model.message.Message;
+
+/**
+ * The AbandonRequest factory.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public final class AbandonRequestFactory implements Messagefactory
+{
+    /** The static instance */
+    public static final AbandonRequestFactory INSTANCE = new AbandonRequestFactory();
+
+    private AbandonRequestFactory()
+    {
+        // Nothing to do
+    }
+
+    /**
+     * Encode the AbandonRequest message to a PDU.
+     * <br>
+     * AbandonRequest :
+     * <pre>
+     * 0x50 0x0(1..4) abandoned MessageId
+     * </pre>
+     *
+     * @param buffer The buffer where to put the PDU
+     * @param message the AbandonRequest to encode
+     */
+    @Override
+    public void encodeReverse( Asn1Buffer buffer, Message message )
+    {
+        BerValue.encodeInteger( buffer, LdapCodecConstants.ABANDON_REQUEST_TAG,
+            ( ( AbandonRequest ) message ).getAbandoned() );
+    }
+}
diff --git a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/factory/AddRequestFactory.java b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/factory/AddRequestFactory.java
new file mode 100644
index 0000000..fd1f9f6
--- /dev/null
+++ b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/factory/AddRequestFactory.java
@@ -0,0 +1,175 @@
+/*
+ *  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.api.ldap.codec.factory;
+
+import java.util.Iterator;
+
+import org.apache.directory.api.asn1.ber.tlv.BerValue;
+import org.apache.directory.api.asn1.util.Asn1Buffer;
+import org.apache.directory.api.ldap.codec.api.LdapCodecConstants;
+import org.apache.directory.api.ldap.model.entry.Attribute;
+import org.apache.directory.api.ldap.model.entry.Entry;
+import org.apache.directory.api.ldap.model.entry.Value;
+import org.apache.directory.api.ldap.model.message.AddRequest;
+import org.apache.directory.api.ldap.model.message.Message;
+import org.apache.directory.api.util.Strings;
+
+/**
+ * The AddRequest factory.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public final class AddRequestFactory implements Messagefactory
+{
+    /** The static instance */
+    public static final AddRequestFactory INSTANCE = new AddRequestFactory();
+
+    private AddRequestFactory()
+    {
+        // Nothing to do
+    }
+
+
+    /**
+     * Encode an entry's Attribute's values. It's done recursively, to have the
+     * last value encoded first in the reverse buffer.
+     * <br>
+     * The values are encoded this way :
+     * <pre>
+     * 0x31 LL attributeValues
+     *   0x04 LL attributeValue
+     *   ...
+     *   0x04 LL attributeValue
+     * </pre>
+     *
+     * @param buffer The buffer where to put the PDU
+     * @param iterator The iterator built on top of the values
+     */
+    private void encodeValueReverse( Asn1Buffer buffer, Iterator<Value> iterator )
+    {
+        if ( iterator.hasNext() )
+        {
+            Value value = iterator.next();
+
+            // Recursive call to have the latest values encoded first
+            encodeValueReverse( buffer, iterator );
+
+            // Encode the value
+            BerValue.encodeOctetString( buffer, value.getBytes() );
+        }
+    }
+
+
+    /**
+     * Encode the attributes, starting from the end. We iterate through the list
+     * of attributes, recursively. The last attribute will be encoded first, when
+     * the end of the list will be reached, which is what we went, as we encode from
+     * the end.
+     * <br>
+     * An attribute is encoded this way:
+     * <pre>
+     *     0x30 LL attribute
+     *       0x04 LL attributeType
+     *       0x31 LL attributeValues
+     *         0x04 LL attributeValue
+     *         ...
+     *         0x04 LL attributeValue
+     * </pre>
+     *
+     * @param buffer The buffer where to put the PDU
+     * @param iterator The iterator built on top of the attributes
+     */
+    private void encodeAttributeReverse( Asn1Buffer buffer, Iterator<Attribute> iterator )
+    {
+        if ( iterator.hasNext() )
+        {
+            Attribute attribute = iterator.next();
+
+            // Recursive call to have the latest attributes encoded first
+            encodeAttributeReverse( buffer, iterator );
+
+            // Remind the current position
+            int start = buffer.getPos();
+
+            // The attributes values
+            encodeValueReverse( buffer, attribute.iterator() );
+
+            // Then the values' SET
+            BerValue.encodeSet( buffer, start );
+
+            // The attribute type
+            BerValue.encodeOctetString( buffer, Strings.getBytesUtf8( attribute.getUpId() ) );
+
+            // The attribute sequence
+            BerValue.encodeSequence( buffer, start );
+        }
+    }
+
+    /**
+     * Encode the AddRequest message to a PDU.
+     * <br>
+     * AddRequest :
+     * <pre>
+     * 0x68 LL
+     *   0x04 LL entry
+     *   0x30 LL attributesList
+     *     0x30 LL attribute
+     *       0x04 LL attributeDescription
+     *       0x31 LL attributeValues
+     *         0x04 LL attributeValue
+     *         ...
+     *         0x04 LL attributeValue
+     *     ...
+     *     0x30 LL attribute
+     *       0x04 LL attributeDescription
+     *       0x31 LL attributeValue
+     *         0x04 LL attributeValue
+     *         ...
+     *         0x04 LL attributeValue
+     * </pre>
+     *
+     * @param buffer The buffer where to put the PDU
+     * @param message the AbandonRequest to encode
+     */
+    @Override
+    public void encodeReverse( Asn1Buffer buffer, Message message )
+    {
+        int start = buffer.getPos();
+        AddRequest addRequest = ( AddRequest ) message;
+
+        // The partial attribute list
+        Entry entry = addRequest.getEntry();
+
+        if ( entry.size() != 0 )
+        {
+            // Encode the attributes
+            encodeAttributeReverse( buffer, entry.iterator() );
+        }
+
+        // The attributes sequence
+        BerValue.encodeSequence( buffer, start );
+
+        // The entry DN
+        BerValue.encodeOctetString( buffer, Strings.getBytesUtf8( entry.getDn().getName() ) );
+
+        // The AddRequest Tag
+        BerValue.encodeSequence( buffer, LdapCodecConstants.ADD_REQUEST_TAG, start );
+    }
+}
diff --git a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/factory/BindRequestFactory.java b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/factory/BindRequestFactory.java
index de6763a..924573e 100644
--- a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/factory/BindRequestFactory.java
+++ b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/factory/BindRequestFactory.java
@@ -32,9 +32,9 @@ import org.apache.directory.api.util.Strings;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-
 public final class BindRequestFactory implements Messagefactory
 {
+    /** The static instance */
     public static final BindRequestFactory INSTANCE = new BindRequestFactory();
 
     private BindRequestFactory()
@@ -60,6 +60,7 @@ public final class BindRequestFactory implements Messagefactory
     @Override
     public void encodeReverse( Asn1Buffer buffer, Message message )
     {
+        int pos = buffer.getPos();
         BindRequest bindMessage = ( BindRequest ) message;
 
         // The authentication
@@ -102,6 +103,6 @@ public final class BindRequestFactory implements Messagefactory
         BerValue.encodeInteger( buffer, 3 );
 
         // The BindRequest Tag
-        BerValue.encodeSequence( buffer, LdapCodecConstants.BIND_REQUEST_TAG );
+        BerValue.encodeSequence( buffer, LdapCodecConstants.BIND_REQUEST_TAG, pos );
     }
 }
diff --git a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/factory/DeleteRequestFactory.java b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/factory/DeleteRequestFactory.java
new file mode 100644
index 0000000..2c6d98c
--- /dev/null
+++ b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/factory/DeleteRequestFactory.java
@@ -0,0 +1,67 @@
+/*
+ *  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.api.ldap.codec.factory;
+
+import org.apache.directory.api.asn1.ber.tlv.BerValue;
+import org.apache.directory.api.asn1.util.Asn1Buffer;
+import org.apache.directory.api.ldap.codec.api.LdapCodecConstants;
+import org.apache.directory.api.ldap.model.message.DeleteRequest;
+import org.apache.directory.api.ldap.model.message.Message;
+import org.apache.directory.api.util.Strings;
+
+/**
+ * The DeleteRequest factory.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public final class DeleteRequestFactory implements Messagefactory
+{
+    /** The static instance */
+    public static final DeleteRequestFactory INSTANCE = new DeleteRequestFactory();
+
+    private DeleteRequestFactory()
+    {
+        // Nothing to do
+    }
+
+    /**
+     * Encode the DeleteRequest message to a PDU.
+     * <br>
+     * DelRequest :
+     * <pre>
+     * 0x4A LL entry DN
+     * </pre>
+     *
+     * @param buffer The buffer where to put the PDU
+     * @param message the DeleteRequest to encode
+     */
+    @Override
+    public void encodeReverse( Asn1Buffer buffer, Message message )
+    {
+        int pos = buffer.getPos();
+
+        // The entry
+        BerValue.encodeOctetString( buffer, Strings.getBytesUtf8(
+            ( ( DeleteRequest ) message ).getName().getName() ) );
+
+        // The DelRequest Tag
+        BerValue.encodeSequence( buffer, LdapCodecConstants.DEL_REQUEST_TAG, pos );
+    }
+}
diff --git a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/osgi/DefaultLdapCodecService.java b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/osgi/DefaultLdapCodecService.java
index ec01fa4..794d50d 100644
--- a/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/osgi/DefaultLdapCodecService.java
+++ b/ldap/codec/core/src/main/java/org/apache/directory/api/ldap/codec/osgi/DefaultLdapCodecService.java
@@ -34,13 +34,13 @@ import org.apache.directory.api.asn1.EncoderException;
 import org.apache.directory.api.asn1.ber.Asn1Container;
 import org.apache.directory.api.i18n.I18n;
 import org.apache.directory.api.ldap.codec.BasicControlDecorator;
+import org.apache.directory.api.ldap.codec.api.AbstractMessageDecorator;
 import org.apache.directory.api.ldap.codec.api.CodecControl;
 import org.apache.directory.api.ldap.codec.api.ControlFactory;
 import org.apache.directory.api.ldap.codec.api.ExtendedOperationFactory;
 import org.apache.directory.api.ldap.codec.api.IntermediateResponseFactory;
 import org.apache.directory.api.ldap.codec.api.LdapApiService;
 import org.apache.directory.api.ldap.codec.api.LdapMessageContainer;
-import org.apache.directory.api.ldap.codec.api.AbstractMessageDecorator;
 import org.apache.directory.api.ldap.codec.controls.cascade.CascadeFactory;
 import org.apache.directory.api.ldap.codec.controls.manageDsaIT.ManageDsaITFactory;
 import org.apache.directory.api.ldap.codec.controls.proxiedauthz.ProxiedAuthzFactory;
@@ -126,7 +126,7 @@ public class DefaultLdapCodecService implements LdapApiService
 
         ControlFactory<EntryChange> entryChangeFactory = new EntryChangeFactory( this );
         controlFactories.put( entryChangeFactory.getOid(), entryChangeFactory );
-        
+
         if ( LOG.isInfoEnabled() )
         {
             LOG.info( I18n.msg( I18n.MSG_06000_REGISTERED_CONTROL_FACTORY, entryChangeFactory.getOid() ) );
@@ -134,7 +134,7 @@ public class DefaultLdapCodecService implements LdapApiService
 
         ControlFactory<ManageDsaIT> manageDsaItFactory = new ManageDsaITFactory( this );
         controlFactories.put( manageDsaItFactory.getOid(), manageDsaItFactory );
-        
+
         if ( LOG.isInfoEnabled() )
         {
             LOG.info( I18n.msg( I18n.MSG_06000_REGISTERED_CONTROL_FACTORY, manageDsaItFactory.getOid() ) );
@@ -142,7 +142,7 @@ public class DefaultLdapCodecService implements LdapApiService
 
         ControlFactory<ProxiedAuthz> proxiedAuthzFactory = new ProxiedAuthzFactory( this );
         controlFactories.put( proxiedAuthzFactory.getOid(), proxiedAuthzFactory );
-        
+
         if ( LOG.isInfoEnabled() )
         {
             LOG.info( I18n.msg( I18n.MSG_06000_REGISTERED_CONTROL_FACTORY, proxiedAuthzFactory.getOid() ) );
@@ -150,7 +150,7 @@ public class DefaultLdapCodecService implements LdapApiService
 
         ControlFactory<PagedResults> pageResultsFactory = new PagedResultsFactory( this );
         controlFactories.put( pageResultsFactory.getOid(), pageResultsFactory );
-        
+
         if ( LOG.isInfoEnabled() )
         {
             LOG.info( I18n.msg( I18n.MSG_06000_REGISTERED_CONTROL_FACTORY, pageResultsFactory.getOid() ) );
@@ -158,7 +158,7 @@ public class DefaultLdapCodecService implements LdapApiService
 
         ControlFactory<PersistentSearch> persistentSearchFactory = new PersistentSearchFactory( this );
         controlFactories.put( persistentSearchFactory.getOid(), persistentSearchFactory );
-        
+
         if ( LOG.isInfoEnabled() )
         {
             LOG.info( I18n.msg( I18n.MSG_06000_REGISTERED_CONTROL_FACTORY, persistentSearchFactory.getOid() ) );
@@ -166,7 +166,7 @@ public class DefaultLdapCodecService implements LdapApiService
 
         ControlFactory<Subentries> subentriesFactory = new SubentriesFactory( this );
         controlFactories.put( subentriesFactory.getOid(), subentriesFactory );
-        
+
         if ( LOG.isInfoEnabled() )
         {
             LOG.info( I18n.msg( I18n.MSG_06000_REGISTERED_CONTROL_FACTORY, subentriesFactory.getOid() ) );
@@ -174,7 +174,7 @@ public class DefaultLdapCodecService implements LdapApiService
 
         ControlFactory<SortRequest> sortRequestFactory = new SortRequestFactory( this );
         controlFactories.put( sortRequestFactory.getOid(), sortRequestFactory );
-        
+
         if ( LOG.isInfoEnabled() )
         {
             LOG.info( I18n.msg( I18n.MSG_06000_REGISTERED_CONTROL_FACTORY, sortRequestFactory.getOid() ) );
@@ -182,7 +182,7 @@ public class DefaultLdapCodecService implements LdapApiService
 
         ControlFactory<SortResponse> sortResponseFactory = new SortResponseFactory( this );
         controlFactories.put( sortResponseFactory.getOid(), sortResponseFactory );
-        
+
         if ( LOG.isInfoEnabled() )
         {
             LOG.info( I18n.msg( I18n.MSG_06000_REGISTERED_CONTROL_FACTORY, sortResponseFactory.getOid() ) );
@@ -705,6 +705,7 @@ public class DefaultLdapCodecService implements LdapApiService
     /**
      * @return the controlFactories
      */
+    @Override
     public Map<String, ControlFactory<? extends Control>> getControlFactories()
     {
         return controlFactories;
diff --git a/ldap/codec/core/src/test/java/org/apache/directory/api/ldap/codec/abandon/AbandonRequestTest.java b/ldap/codec/core/src/test/java/org/apache/directory/api/ldap/codec/abandon/AbandonRequestTest.java
index c5ebc82..c73680a 100644
--- a/ldap/codec/core/src/test/java/org/apache/directory/api/ldap/codec/abandon/AbandonRequestTest.java
+++ b/ldap/codec/core/src/test/java/org/apache/directory/api/ldap/codec/abandon/AbandonRequestTest.java
@@ -26,11 +26,13 @@ import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.nio.ByteBuffer;
+import java.util.Arrays;
 import java.util.Map;
 
 import org.apache.directory.api.asn1.DecoderException;
 import org.apache.directory.api.asn1.EncoderException;
 import org.apache.directory.api.asn1.ber.Asn1Decoder;
+import org.apache.directory.api.asn1.util.Asn1Buffer;
 import org.apache.directory.api.ldap.codec.api.AbstractMessageDecorator;
 import org.apache.directory.api.ldap.codec.api.CodecControl;
 import org.apache.directory.api.ldap.codec.api.LdapEncoder;
@@ -185,7 +187,7 @@ public class AbandonRequestTest extends AbstractCodecServiceTest
      * Test the decoding of a AbandonRequest with no controls
      */
     @Test
-    public void testDecodeAbandonRequestNoControlsHighMessageId()
+    public void testDecodeAbandonRequestNoControlsHighMessageId() throws EncoderException
     {
         Asn1Decoder ldapDecoder = new Asn1Decoder();
 
@@ -199,7 +201,6 @@ public class AbandonRequestTest extends AbstractCodecServiceTest
                                                             // AbandonRequest ::= [APPLICATION 16] MessageID
             } );
 
-        String decodedPdu = Strings.dumpBytes( stream.array() );
         stream.flip();
 
         // Allocate a LdapMessageContainer Container
@@ -235,15 +236,19 @@ public class AbandonRequestTest extends AbstractCodecServiceTest
             // Check the length
             assertEquals( 0x0A, bb.limit() );
 
-            String encodedPdu = Strings.dumpBytes( bb.array() );
-
-            assertEquals( encodedPdu, decodedPdu );
+            assertTrue( Arrays.equals( stream.array(), bb.array() ) );
         }
         catch ( EncoderException ee )
         {
             ee.printStackTrace();
             fail( ee.getMessage() );
         }
+
+        // Check the reverse encoding
+        Asn1Buffer buffer = new Asn1Buffer();
+        LdapEncoder.encodeMessageReverse( buffer, codec, internalAbandonRequest );
+
+        assertTrue( Arrays.equals( stream.array(), buffer.getBytes().array() ) );
     }
 
 
diff --git a/ldap/codec/core/src/test/java/org/apache/directory/api/ldap/codec/add/AddRequestTest.java b/ldap/codec/core/src/test/java/org/apache/directory/api/ldap/codec/add/AddRequestTest.java
index edfce4c..1a069af 100644
--- a/ldap/codec/core/src/test/java/org/apache/directory/api/ldap/codec/add/AddRequestTest.java
+++ b/ldap/codec/core/src/test/java/org/apache/directory/api/ldap/codec/add/AddRequestTest.java
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.nio.ByteBuffer;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
@@ -36,6 +37,7 @@ import org.apache.directory.api.asn1.DecoderException;
 import org.apache.directory.api.asn1.EncoderException;
 import org.apache.directory.api.asn1.ber.Asn1Container;
 import org.apache.directory.api.asn1.ber.Asn1Decoder;
+import org.apache.directory.api.asn1.util.Asn1Buffer;
 import org.apache.directory.api.ldap.codec.api.AbstractMessageDecorator;
 import org.apache.directory.api.ldap.codec.api.CodecControl;
 import org.apache.directory.api.ldap.codec.api.LdapEncoder;
@@ -47,6 +49,7 @@ import org.apache.directory.api.ldap.model.entry.Attribute;
 import org.apache.directory.api.ldap.model.entry.Entry;
 import org.apache.directory.api.ldap.model.entry.Value;
 import org.apache.directory.api.ldap.model.message.AddRequest;
+import org.apache.directory.api.ldap.model.message.AddRequestImpl;
 import org.apache.directory.api.ldap.model.message.AddResponseImpl;
 import org.apache.directory.api.ldap.model.message.Control;
 import org.apache.directory.api.ldap.model.message.Message;
@@ -70,9 +73,10 @@ public class AddRequestTest extends AbstractCodecServiceTest
 {
     /**
      * Test the decoding of a AddRequest
+     * @throws EncoderException
      */
     @Test
-    public void testDecodeAddRequestSuccess() throws NamingException
+    public void testDecodeAddRequestSuccess() throws NamingException, EncoderException
     {
         Asn1Decoder ldapDecoder = new Asn1Decoder();
 
@@ -80,103 +84,34 @@ public class AddRequestTest extends AbstractCodecServiceTest
 
         stream.put( new byte[]
             {
-                0x30,
-                0x57, // LDAPMessage ::= SEQUENCE {
-                0x02,
-                0x01,
-                0x01, // messageID MessageID
-                0x68,
-                0x52, // CHOICE { ..., addRequest AddRequest, ...
-                // AddRequest ::= [APPLICATION 8] SEQUENCE {
-                // entry LDAPDN,
-                0x04,
-                0x20,
-                'c',
-                'n',
-                '=',
-                't',
-                'e',
-                's',
-                't',
-                'M',
-                'o',
-                'd',
-                'i',
-                'f',
-                'y',
-                ',',
-                'o',
-                'u',
-                '=',
-                'u',
-                's',
-                'e',
-                'r',
-                's',
-                ',',
-                'o',
-                'u',
-                '=',
-                's',
-                'y',
-                's',
-                't',
-                'e',
-                'm',
-                // attributes AttributeList }
-                0x30,
-                0x2E, // AttributeList ::= SEQUENCE OF SEQUENCE {
-                0x30,
-                0x0c, // attribute 1
-                0x04,
-                0x01,
-                'l', // type AttributeDescription,
-                0x31,
-                0x07, // vals SET OF AttributeValue }
-                0x04,
-                0x05,
-                'P',
-                'a',
-                'r',
-                'i',
-                's',
-
-                0x30,
-                0x1E, // attribute 2
-                // type AttributeDescription,
-                0x04,
-                0x05,
-                'a',
-                't',
-                't',
-                'r',
-                's',
-                0x31,
-                0x15, // vals SET
-                // OF
-                // AttributeValue
-                // }
-                0x04,
-                0x05,
-                't',
-                'e',
-                's',
-                't',
-                '1',
-                0x04,
-                0x05,
-                't',
-                'e',
-                's',
-                't',
-                '2',
-                0x04,
-                0x05,
-                't',
-                'e',
-                's',
-                't',
-                '3', } );
+                0x30, 0x57,                 // LDAPMessage ::= SEQUENCE {
+                  0x02, 0x01, 0x01,         // messageID MessageID
+                  0x68, 0x52,               // CHOICE { ..., addRequest AddRequest, ...
+                                            // AddRequest ::= [APPLICATION 8] SEQUENCE {
+                                            // entry LDAPDN,
+                    0x04, 0x20,
+                      'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y',
+                      ',', 'o', 'u', '=', 'u', 's', 'e', 'r', 's', ',',
+                      'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
+                                            // attributes AttributeList }
+                    0x30, 0x2E,             // AttributeList ::= SEQUENCE OF SEQUENCE {
+                      0x30, 0x0c,           // attribute 1
+                        0x04, 0x01,         // type AttributeDescription,
+                          'l',
+                        0x31, 0x07,         // vals SET OF AttributeValue }
+                          0x04, 0x05,
+                            'P', 'a', 'r', 'i', 's',
+                      0x30, 0x1E,           // attribute 2
+                        0x04, 0x05,         // type AttributeDescription,
+                          'a', 't', 't', 'r', 's',
+                        0x31, 0x15,         // vals SET OF AttributeValue }
+                          0x04, 0x05,
+                            't', 'e', 's', 't', '1',
+                          0x04, 0x05,
+                            't', 'e', 's', 't', '2',
+                          0x04, 0x05,
+                            't', 'e', 's', 't', '3'
+            } );
 
         Strings.dumpBytes( stream.array() );
         stream.flip();
@@ -277,6 +212,16 @@ public class AddRequestTest extends AbstractCodecServiceTest
             ee.printStackTrace();
             fail( ee.getMessage() );
         }
+
+        Asn1Buffer buffer = new Asn1Buffer();
+
+        AddRequest request = new AddRequestImpl();
+        request.setEntry( addRequest.getEntry() );
+        request.setMessageId( addRequest.getMessageId() );
+
+        LdapEncoder.encodeMessageReverse( buffer, codec, request );
+
+        assertTrue( Arrays.equals( stream.array(), buffer.getBytes().array() ) );
     }
 
 
@@ -291,13 +236,11 @@ public class AddRequestTest extends AbstractCodecServiceTest
         ByteBuffer stream = ByteBuffer.allocate( 0x07 );
 
         stream.put( new byte[]
-            { 0x30, 0x05, // LDAPMessage ::= SEQUENCE {
-                0x02,
-                0x01,
-                0x01, // messageID MessageID
-                0x68,
-                0x00 // CHOICE { ..., addRequest AddRequest, ...
-        } );
+            {
+                0x30, 0x05,             // LDAPMessage ::= SEQUENCE {
+                  0x02, 0x01, 0x01,     // messageID MessageID
+                  0x68, 0x00            // CHOICE { ..., addRequest AddRequest, ...
+            } );
 
         stream.flip();
 
@@ -330,71 +273,31 @@ public class AddRequestTest extends AbstractCodecServiceTest
         ByteBuffer stream = ByteBuffer.allocate( 0x39 );
 
         stream.put( new byte[]
-            { 0x30,
-                0x37, // LDAPMessage ::= SEQUENCE {
-                0x02,
-                0x01,
-                0x01, // messageID MessageID
-                0x68,
-                0x26, // CHOICE { ..., addRequest AddRequest, ...
-                // AddRequest ::= [APPLICATION 8] SEQUENCE {
-                // entry LDAPDN,
-                0x04,
-                0x00,
-                // attributes AttributeList }
-                0x30,
-                0x2E, // AttributeList ::= SEQUENCE OF SEQUENCE {
-                0x30,
-                0x0c, // attribute 1
-                0x04,
-                0x01,
-                'l', // type AttributeDescription,
-                0x31,
-                0x07, // vals SET OF AttributeValue }
-                0x04,
-                0x05,
-                'P',
-                'a',
-                'r',
-                'i',
-                's',
-
-                0x30,
-                0x1E, // attribute 2
-                // type AttributeDescription,
-                0x04,
-                0x05,
-                'a',
-                't',
-                't',
-                'r',
-                's',
-                0x31,
-                0x15, // vals SET
-                // OF
-                // AttributeValue
-                // }
-                0x04,
-                0x05,
-                't',
-                'e',
-                's',
-                't',
-                '1',
-                0x04,
-                0x05,
-                't',
-                'e',
-                's',
-                't',
-                '2',
-                0x04,
-                0x05,
-                't',
-                'e',
-                's',
-                't',
-                '3', } );
+            {
+                0x30, 0x37,                     // LDAPMessage ::= SEQUENCE {
+                  0x02, 0x01, 0x01,             // messageID MessageID
+                  0x68, 0x26,                   // CHOICE { ..., addRequest AddRequest, ...
+                                                // AddRequest ::= [APPLICATION 8] SEQUENCE {
+                    0x04, 0x00,                 // entry LDAPDN,
+                                                // attributes AttributeList }
+                    0x30, 0x2E,                 // AttributeList ::= SEQUENCE OF SEQUENCE {
+                      0x30, 0x0c,               // attribute 1
+                        0x04, 0x01,
+                          'l',                  // type AttributeDescription,
+                        0x31, 0x07,             // vals SET OF AttributeValue }
+                          0x04, 0x05,
+                            'P', 'a', 'r', 'i', 's',
+                      0x30, 0x1E,               // attribute 2
+                        0x04, 0x05,             // type AttributeDescription,
+                          'a', 't', 't', 'r', 's',
+                        0x31, 0x15,             // vals SET OF AttributeValue }
+                          0x04, 0x05,
+                            't', 'e', 's', 't', '1',
+                          0x04, 0x05,
+                            't', 'e', 's', 't', '2',
+                          0x04, 0x05,
+                            't', 'e', 's', 't', '3'
+            } );
 
         stream.flip();
 
@@ -432,103 +335,33 @@ public class AddRequestTest extends AbstractCodecServiceTest
 
         stream.put( new byte[]
             {
-                0x30,
-                0x57, // LDAPMessage ::= SEQUENCE {
-                0x02,
-                0x01,
-                0x01, // messageID MessageID
-                0x68,
-                0x52, // CHOICE { ..., addRequest AddRequest, ...
-                // AddRequest ::= [APPLICATION 8] SEQUENCE {
-                // entry LDAPDN,
-                0x04,
-                0x20,
-                'c',
-                'n',
-                ':',
-                't',
-                'e',
-                's',
-                't',
-                'M',
-                'o',
-                'd',
-                'i',
-                'f',
-                'y',
-                ',',
-                'o',
-                'u',
-                '=',
-                'u',
-                's',
-                'e',
-                'r',
-                's',
-                ',',
-                'o',
-                'u',
-                '=',
-                's',
-                'y',
-                's',
-                't',
-                'e',
-                'm',
-                // attributes AttributeList }
-                0x30,
-                0x2E, // AttributeList ::= SEQUENCE OF SEQUENCE {
-                0x30,
-                0x0c, // attribute 1
-                0x04,
-                0x01,
-                'l', // type AttributeDescription,
-                0x31,
-                0x07, // vals SET OF AttributeValue }
-                0x04,
-                0x05,
-                'P',
-                'a',
-                'r',
-                'i',
-                's',
-
-                0x30,
-                0x1E, // attribute 2
-                // type AttributeDescription,
-                0x04,
-                0x05,
-                'a',
-                't',
-                't',
-                'r',
-                's',
-                0x31,
-                0x15, // vals SET
-                // OF
-                // AttributeValue
-                // }
-                0x04,
-                0x05,
-                't',
-                'e',
-                's',
-                't',
-                '1',
-                0x04,
-                0x05,
-                't',
-                'e',
-                's',
-                't',
-                '2',
-                0x04,
-                0x05,
-                't',
-                'e',
-                's',
-                't',
-                '3', } );
+                0x30, 0x57,                     // LDAPMessage ::= SEQUENCE {
+                  0x02, 0x01, 0x01,             // messageID MessageID
+                  0x68, 0x52,                   // CHOICE { ..., addRequest AddRequest, ...
+                                                // AddRequest ::= [APPLICATION 8] SEQUENCE {
+                    0x04, 0x20,                 // entry LDAPDN,
+                      'c', 'n', ':', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y',
+                      ',', 'o', 'u', '=', 'u', 's', 'e', 'r', 's', ',',
+                      'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
+                                                // attributes AttributeList }
+                    0x30, 0x2E,                 // AttributeList ::= SEQUENCE OF SEQUENCE {
+                      0x30, 0x0c,               // attribute 1
+                        0x04, 0x01,
+                         'l',                   // type AttributeDescription,
+                      0x31, 0x07,               // vals SET OF AttributeValue }
+                        0x04, 0x05,
+                          'P', 'a', 'r', 'i', 's',
+                    0x30, 0x1E,                 // attribute 2
+                      0x04, 0x05,               // type AttributeDescription,
+                        'a', 't', 't', 'r', 's',
+                      0x31, 0x15,               // vals SET OF AttributeValue }
+                        0x04, 0x05,
+                          't', 'e', 's', 't', '1',
+                        0x04, 0x05,
+                          't', 'e', 's', 't', '2',
+                        0x04, 0x05,
+                          't', 'e', 's', 't', '3'
+            } );
 
         stream.flip();
 
@@ -565,52 +398,17 @@ public class AddRequestTest extends AbstractCodecServiceTest
         ByteBuffer stream = ByteBuffer.allocate( 0x2B );
 
         stream.put( new byte[]
-            { 0x30,
-                0x29, // LDAPMessage ::= SEQUENCE {
-                0x02,
-                0x01,
-                0x01, // messageID MessageID
-                0x68,
-                0x24, // CHOICE { ..., addRequest AddRequest, ...
-                // AddRequest ::= [APPLICATION 8] SEQUENCE {
-                // entry LDAPDN,
-                0x04,
-                0x20,
-                'c',
-                'n',
-                '=',
-                't',
-                'e',
-                's',
-                't',
-                'M',
-                'o',
-                'd',
-                'i',
-                'f',
-                'y',
-                ',',
-                'o',
-                'u',
-                '=',
-                'u',
-                's',
-                'e',
-                'r',
-                's',
-                ',',
-                'o',
-                'u',
-                '=',
-                's',
-                'y',
-                's',
-                't',
-                'e',
-                'm',
-                // attributes AttributeList }
-                0x30,
-                0x00, // AttributeList ::= SEQUENCE OF SEQUENCE {
+            {
+                0x30, 0x29,                 // LDAPMessage ::= SEQUENCE {
+                  0x02, 0x01, 0x01,         // messageID MessageID
+                  0x68, 0x24,               // CHOICE { ..., addRequest AddRequest, ...
+                                            // AddRequest ::= [APPLICATION 8] SEQUENCE {
+                    0x04, 0x20,             // entry LDAPDN,
+                      'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y',
+                      ',', 'o', 'u', '=', 'u', 's', 'e', 'r', 's', ',',
+                      'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
+                                            // attributes AttributeList }
+                    0x30, 0x00              // AttributeList ::= SEQUENCE OF SEQUENCE {
             } );
 
         stream.flip();
@@ -644,54 +442,18 @@ public class AddRequestTest extends AbstractCodecServiceTest
         ByteBuffer stream = ByteBuffer.allocate( 0x2D );
 
         stream.put( new byte[]
-            { 0x30,
-                0x2B, // LDAPMessage ::= SEQUENCE {
-                0x02,
-                0x01,
-                0x01, // messageID MessageID
-                0x68,
-                0x26, // CHOICE { ..., addRequest AddRequest, ...
-                // AddRequest ::= [APPLICATION 8] SEQUENCE {
-                // entry LDAPDN,
-                0x04,
-                0x20,
-                'c',
-                'n',
-                '=',
-                't',
-                'e',
-                's',
-                't',
-                'M',
-                'o',
-                'd',
-                'i',
-                'f',
-                'y',
-                ',',
-                'o',
-                'u',
-                '=',
-                'u',
-                's',
-                'e',
-                'r',
-                's',
-                ',',
-                'o',
-                'u',
-                '=',
-                's',
-                'y',
-                's',
-                't',
-                'e',
-                'm',
-                // attributes AttributeList }
-                0x30,
-                0x02, // AttributeList ::= SEQUENCE OF SEQUENCE {
-                0x30,
-                0x00, // AttributeList ::= SEQUENCE OF SEQUENCE {
+            {
+                0x30, 0x2B,                 // LDAPMessage ::= SEQUENCE {
+                  0x02, 0x01, 0x01,         // messageID MessageID
+                  0x68, 0x26,               // CHOICE { ..., addRequest AddRequest, ...
+                                            // AddRequest ::= [APPLICATION 8] SEQUENCE {
+                    0x04, 0x20,             // entry LDAPDN,
+                      'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y',
+                      ',', 'o', 'u', '=', 'u', 's', 'e', 'r', 's', ',',
+                      'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
+                                            // attributes AttributeList }
+                    0x30, 0x02,             // AttributeList ::= SEQUENCE OF SEQUENCE {
+                      0x30, 0x00
             } );
 
         stream.flip();
@@ -725,56 +487,19 @@ public class AddRequestTest extends AbstractCodecServiceTest
         ByteBuffer stream = ByteBuffer.allocate( 0x2F );
 
         stream.put( new byte[]
-            { 0x30,
-                0x2D, // LDAPMessage ::= SEQUENCE {
-                0x02,
-                0x01,
-                0x01, // messageID MessageID
-                0x68,
-                0x28, // CHOICE { ..., addRequest AddRequest, ...
-                // AddRequest ::= [APPLICATION 8] SEQUENCE {
-                // entry LDAPDN,
-                0x04,
-                0x20,
-                'c',
-                'n',
-                '=',
-                't',
-                'e',
-                's',
-                't',
-                'M',
-                'o',
-                'd',
-                'i',
-                'f',
-                'y',
-                ',',
-                'o',
-                'u',
-                '=',
-                'u',
-                's',
-                'e',
-                'r',
-                's',
-                ',',
-                'o',
-                'u',
-                '=',
-                's',
-                'y',
-                's',
-                't',
-                'e',
-                'm',
-                // attributes AttributeList }
-                0x30,
-                0x04, // AttributeList ::= SEQUENCE OF SEQUENCE {
-                0x30,
-                0x02, // attribute 1
-                0x04,
-                0x00, // type AttributeDescription,
+            {
+                0x30, 0x2D,                 // LDAPMessage ::= SEQUENCE {
+                  0x02, 0x01, 0x01,         // messageID MessageID
+                  0x68, 0x28,               // CHOICE { ..., addRequest AddRequest, ...
+                                            // AddRequest ::= [APPLICATION 8] SEQUENCE {
+                    0x04, 0x20,             // entry LDAPDN,
+                      'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y',
+                      ',', 'o', 'u', '=', 'u', 's', 'e', 'r', 's', ',',
+                      'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
+                                            // attributes AttributeList }
+                    0x30, 0x04,             // AttributeList ::= SEQUENCE OF SEQUENCE {
+                      0x30, 0x02,           // attribute 1
+                        0x04, 0x00          // type AttributeDescription,
             } );
 
         stream.flip();
@@ -812,57 +537,20 @@ public class AddRequestTest extends AbstractCodecServiceTest
         ByteBuffer stream = ByteBuffer.allocate( 0x30 );
 
         stream.put( new byte[]
-            { 0x30,
-                0x2E, // LDAPMessage ::= SEQUENCE {
-                0x02,
-                0x01,
-                0x01, // messageID MessageID
-                0x68,
-                0x29, // CHOICE { ..., addRequest AddRequest, ...
-                // AddRequest ::= [APPLICATION 8] SEQUENCE {
-                // entry LDAPDN,
-                0x04,
-                0x20,
-                'c',
-                'n',
-                '=',
-                't',
-                'e',
-                's',
-                't',
-                'M',
-                'o',
-                'd',
-                'i',
-                'f',
-                'y',
-                ',',
-                'o',
-                'u',
-                '=',
-                'u',
-                's',
-                'e',
-                'r',
-                's',
-                ',',
-                'o',
-                'u',
-                '=',
-                's',
-                'y',
-                's',
-                't',
-                'e',
-                'm',
-                // attributes AttributeList }
-                0x30,
-                0x05, // AttributeList ::= SEQUENCE OF SEQUENCE {
-                0x30,
-                0x03, // attribute 1
-                0x04,
-                0x01,
-                'A', // type AttributeDescription,
+            {
+                0x30, 0x2E,                 // LDAPMessage ::= SEQUENCE {
+                  0x02, 0x01, 0x01,         // messageID MessageID
+                  0x68, 0x29,               // CHOICE { ..., addRequest AddRequest, ...
+                                            // AddRequest ::= [APPLICATION 8] SEQUENCE {
+                    0x04, 0x20,             // entry LDAPDN,
+                      'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y',
+                      ',', 'o', 'u', '=', 'u', 's', 'e', 'r', 's', ',',
+                      'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
+                                            // attributes AttributeList }
+                    0x30, 0x05,             // AttributeList ::= SEQUENCE OF SEQUENCE {
+                      0x30, 0x03,           // attribute 1
+                        0x04, 0x01,         // type AttributeDescription,
+                          'A'
             } );
 
         stream.flip();
@@ -896,59 +584,22 @@ public class AddRequestTest extends AbstractCodecServiceTest
         ByteBuffer stream = ByteBuffer.allocate( 0x32 );
 
         stream.put( new byte[]
-            { 0x30,
-                0x30, // LDAPMessage ::= SEQUENCE {
-                0x02,
-                0x01,
-                0x01, // messageID MessageID
-                0x68,
-                0x2B, // CHOICE { ..., addRequest AddRequest, ...
-                // AddRequest ::= [APPLICATION 8] SEQUENCE {
-                // entry LDAPDN,
-                0x04,
-                0x20,
-                'c',
-                'n',
-                '=',
-                't',
-                'e',
-                's',
-                't',
-                'M',
-                'o',
-                'd',
-                'i',
-                'f',
-                'y',
-                ',',
-                'o',
-                'u',
-                '=',
-                'u',
-                's',
-                'e',
-                'r',
-                's',
-                ',',
-                'o',
-                'u',
-                '=',
-                's',
-                'y',
-                's',
-                't',
-                'e',
-                'm',
-                // attributes AttributeList }
-                0x30,
-                0x07, // AttributeList ::= SEQUENCE OF SEQUENCE {
-                0x30,
-                0x05, // attribute 1
-                0x04,
-                0x01,
-                'A', // type AttributeDescription,
-                0x31,
-                0x00 } );
+            {
+                0x30, 0x30,                     // LDAPMessage ::= SEQUENCE {
+                  0x02, 0x01, 0x01,             // messageID MessageID
+                  0x68, 0x2B,                   // CHOICE { ..., addRequest AddRequest, ...
+                                                // AddRequest ::= [APPLICATION 8] SEQUENCE {
+                    0x04, 0x20,                 // entry LDAPDN,
+                      'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y',
+                      ',', 'o', 'u', '=', 'u', 's', 'e', 'r', 's', ',',
+                      'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
+                                                // attributes AttributeList }
+                    0x30, 0x07,                 // AttributeList ::= SEQUENCE OF SEQUENCE {
+                      0x30, 0x05,               // attribute 1
+                        0x04, 0x01,             // type AttributeDescription,
+                          'A',
+                        0x31, 0x00
+            } );
 
         stream.flip();
 
@@ -981,61 +632,23 @@ public class AddRequestTest extends AbstractCodecServiceTest
         ByteBuffer stream = ByteBuffer.allocate( 0x34 );
 
         stream.put( new byte[]
-            { 0x30,
-                0x32, // LDAPMessage ::= SEQUENCE {
-                0x02,
-                0x01,
-                0x01, // messageID MessageID
-                0x68,
-                0x2D, // CHOICE { ..., addRequest AddRequest, ...
-                // AddRequest ::= [APPLICATION 8] SEQUENCE {
-                // entry LDAPDN,
-                0x04,
-                0x20,
-                'c',
-                'n',
-                '=',
-                't',
-                'e',
-                's',
-                't',
-                'M',
-                'o',
-                'd',
-                'i',
-                'f',
-                'y',
-                ',',
-                'o',
-                'u',
-                '=',
-                'u',
-                's',
-                'e',
-                'r',
-                's',
-                ',',
-                'o',
-                'u',
-                '=',
-                's',
-                'y',
-                's',
-                't',
-                'e',
-                'm',
-                // attributes AttributeList }
-                0x30,
-                0x09, // AttributeList ::= SEQUENCE OF SEQUENCE {
-                0x30,
-                0x07, // attribute 1
-                0x04,
-                0x01,
-                'l', // type AttributeDescription,
-                0x31,
-                0x02,
-                0x04,
-                0x00 } );
+            {
+                0x30, 0x32,                     // LDAPMessage ::= SEQUENCE {
+                  0x02, 0x01, 0x01,             // messageID MessageID
+                  0x68, 0x2D,                   // CHOICE { ..., addRequest AddRequest, ...
+                                                // AddRequest ::= [APPLICATION 8] SEQUENCE {
+                    0x04, 0x20,                 // entry LDAPDN,
+                      'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y',
+                      ',', 'o', 'u', '=', 'u', 's', 'e', 'r', 's', ',',
+                      'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
+                                                // attributes AttributeList }
+                    0x30, 0x09,                 // AttributeList ::= SEQUENCE OF SEQUENCE {
+                      0x30, 0x07,               // attribute 1
+                        0x04, 0x01,
+                          'l',                  // type AttributeDescription,
+                        0x31, 0x02,
+                          0x04, 0x00
+            } );
 
         String decodedPdu = Strings.dumpBytes( stream.array() );
         stream.flip();
@@ -1106,90 +719,28 @@ public class AddRequestTest extends AbstractCodecServiceTest
 
         stream.put( new byte[]
             {
-                0x30,
-                0x4F, // LDAPMessage ::= SEQUENCE {
-                0x02,
-                0x01,
-                0x01, // messageID MessageID
-                0x68,
-                0x2D, // CHOICE { ..., addRequest AddRequest, ...
-                // AddRequest ::= [APPLICATION 8] SEQUENCE {
-                // entry LDAPDN,
-                0x04,
-                0x20,
-                'c',
-                'n',
-                '=',
-                't',
-                'e',
-                's',
-                't',
-                'M',
-                'o',
-                'd',
-                'i',
-                'f',
-                'y',
-                ',',
-                'o',
-                'u',
-                '=',
-                'u',
-                's',
-                'e',
-                'r',
-                's',
-                ',',
-                'o',
-                'u',
-                '=',
-                's',
-                'y',
-                's',
-                't',
-                'e',
-                'm',
-                // attributes AttributeList }
-                0x30,
-                0x09, // AttributeList ::= SEQUENCE OF SEQUENCE {
-                0x30,
-                0x07, // attribute 1
-                0x04,
-                0x01,
-                'l', // type AttributeDescription,
-                0x31,
-                0x02,
-                0x04,
-                0x00,
-                ( byte ) 0xA0,
-                0x1B, // A control
-                0x30,
-                0x19,
-                0x04,
-                0x17,
-                0x32,
-                0x2E,
-                0x31,
-                0x36,
-                0x2E,
-                0x38,
-                0x34,
-                0x30,
-                0x2E,
-                0x31,
-                0x2E,
-                0x31,
-                0x31,
-                0x33,
-                0x37,
-                0x33,
-                0x30,
-                0x2E,
-                0x33,
-                0x2E,
-                0x34,
-                0x2E,
-                0x32 } );
+                0x30, 0x4F, // LDAPMessage ::= SEQUENCE {
+                  0x02, 0x01, 0x01, // messageID MessageID
+                  0x68, 0x2D, // CHOICE { ..., addRequest AddRequest, ...
+                    // AddRequest ::= [APPLICATION 8] SEQUENCE {
+                    // entry LDAPDN,
+                    0x04, 0x20,
+                      'c', 'n', '=', 't', 'e', 's', 't', 'M', 'o', 'd', 'i', 'f', 'y',
+                      ',', 'o', 'u', '=', 'u', 's', 'e', 'r', 's', ',',
+                      'o', 'u', '=', 's', 'y', 's', 't', 'e', 'm',
+                    // attributes AttributeList }
+                    0x30, 0x09, // AttributeList ::= SEQUENCE OF SEQUENCE {
+                      0x30, 0x07, // attribute 1
+                        0x04, 0x01,
+                          'l', // type AttributeDescription,
+                      0x31, 0x02,
+                        0x04, 0x00,
+                    ( byte ) 0xA0, 0x1B, // A control
+                      0x30, 0x19,
+                        0x04, 0x17,
+                          '2', '.', '1', '6', '.', '8', '4', '0', '.', '1',  '.', '1', '1', '3', '7', '3', '0',
+                          '.', '3', '.', '4', '.', '2'
+            } );
 
         String decodedPdu = Strings.dumpBytes( stream.array() );
         stream.flip();
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdDirSyncFactory.java b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdDirSyncFactory.java
index 151388b..211abd0 100644
--- a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdDirSyncFactory.java
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdDirSyncFactory.java
@@ -20,10 +20,12 @@
 package org.apache.directory.api.ldap.extras.controls.ad_impl;
 
 
+import org.apache.directory.api.asn1.util.Asn1Buffer;
 import org.apache.directory.api.ldap.codec.api.CodecControl;
 import org.apache.directory.api.ldap.codec.api.ControlFactory;
 import org.apache.directory.api.ldap.codec.api.LdapApiService;
 import org.apache.directory.api.ldap.extras.controls.ad.AdDirSync;
+import org.apache.directory.api.ldap.model.message.Control;
 
 
 /**
@@ -77,4 +79,12 @@ public class AdDirSyncFactory implements ControlFactory<AdDirSync>
     {
         return new AdDirSyncDecorator( codec, control );
     }
+
+
+    @Override
+    public void encodeValue( Asn1Buffer buffer, Control control )
+    {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdPolicyHintsFactory.java b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdPolicyHintsFactory.java
index 574d5bc..bc7b9ea 100644
--- a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdPolicyHintsFactory.java
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdPolicyHintsFactory.java
@@ -20,10 +20,12 @@
 package org.apache.directory.api.ldap.extras.controls.ad_impl;
 
 
+import org.apache.directory.api.asn1.util.Asn1Buffer;
 import org.apache.directory.api.ldap.codec.api.CodecControl;
 import org.apache.directory.api.ldap.codec.api.ControlFactory;
 import org.apache.directory.api.ldap.codec.api.LdapApiService;
 import org.apache.directory.api.ldap.extras.controls.ad.AdPolicyHints;
+import org.apache.directory.api.ldap.model.message.Control;
 
 
 /**
@@ -75,4 +77,12 @@ public class AdPolicyHintsFactory implements ControlFactory<AdPolicyHints>
     {
         return new AdPolicyHintsDecorator( codec, control );
     }
+
+
+    @Override
+    public void encodeValue( Asn1Buffer buffer, Control control )
+    {
+        // TODO Auto-generated method stub
+
+    }
 }
\ No newline at end of file
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdShowDeletedFactory.java b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdShowDeletedFactory.java
index 2259e99..2a2efb0 100644
--- a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdShowDeletedFactory.java
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ad_impl/AdShowDeletedFactory.java
@@ -20,11 +20,13 @@
 package org.apache.directory.api.ldap.extras.controls.ad_impl;
 
 
+import org.apache.directory.api.asn1.util.Asn1Buffer;
 import org.apache.directory.api.ldap.codec.api.CodecControl;
 import org.apache.directory.api.ldap.codec.api.ControlFactory;
 import org.apache.directory.api.ldap.codec.api.LdapApiService;
 import org.apache.directory.api.ldap.extras.controls.ad.AdShowDeleted;
 import org.apache.directory.api.ldap.extras.controls.ad.AdShowDeletedImpl;
+import org.apache.directory.api.ldap.model.message.Control;
 
 
 /**
@@ -78,4 +80,12 @@ public class AdShowDeletedFactory implements ControlFactory<AdShowDeleted>
     {
         return new AdShowDeletedDecorator( codec, control );
     }
+
+
+    @Override
+    public void encodeValue( Asn1Buffer buffer, Control control )
+    {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/changeNotifications_impl/ChangeNotificationsFactory.java b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/changeNotifications_impl/ChangeNotificationsFactory.java
index 6aa82c3..ebf2a2d 100644
--- a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/changeNotifications_impl/ChangeNotificationsFactory.java
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/changeNotifications_impl/ChangeNotificationsFactory.java
@@ -20,11 +20,13 @@
 package org.apache.directory.api.ldap.extras.controls.changeNotifications_impl;
 
 
+import org.apache.directory.api.asn1.util.Asn1Buffer;
 import org.apache.directory.api.ldap.codec.api.CodecControl;
 import org.apache.directory.api.ldap.codec.api.ControlFactory;
 import org.apache.directory.api.ldap.codec.api.LdapApiService;
 import org.apache.directory.api.ldap.extras.controls.changeNotifications.ChangeNotifications;
 import org.apache.directory.api.ldap.extras.controls.changeNotifications.ChangeNotificationsImpl;
+import org.apache.directory.api.ldap.model.message.Control;
 
 
 /**
@@ -78,4 +80,12 @@ public class ChangeNotificationsFactory implements ControlFactory<ChangeNotifica
     {
         return new ChangeNotificationsDecorator( codec, control );
     }
+
+
+    @Override
+    public void encodeValue( Asn1Buffer buffer, Control control )
+    {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/permissiveModify_impl/PermissiveModifyFactory.java b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/permissiveModify_impl/PermissiveModifyFactory.java
index 3a28652..aa9196a 100644
--- a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/permissiveModify_impl/PermissiveModifyFactory.java
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/permissiveModify_impl/PermissiveModifyFactory.java
@@ -20,11 +20,13 @@
 package org.apache.directory.api.ldap.extras.controls.permissiveModify_impl;
 
 
+import org.apache.directory.api.asn1.util.Asn1Buffer;
 import org.apache.directory.api.ldap.codec.api.CodecControl;
 import org.apache.directory.api.ldap.codec.api.ControlFactory;
 import org.apache.directory.api.ldap.codec.api.LdapApiService;
 import org.apache.directory.api.ldap.extras.controls.permissiveModify.PermissiveModify;
 import org.apache.directory.api.ldap.extras.controls.permissiveModify.PermissiveModifyImpl;
+import org.apache.directory.api.ldap.model.message.Control;
 
 
 /**
@@ -78,4 +80,12 @@ public class PermissiveModifyFactory implements ControlFactory<PermissiveModify>
     {
         return new PermissiveModifyDecorator( codec, control );
     }
+
+
+    @Override
+    public void encodeValue( Asn1Buffer buffer, Control control )
+    {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/PasswordPolicyFactory.java b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/PasswordPolicyFactory.java
index 08e1ef0..6c72a7e 100644
--- a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/PasswordPolicyFactory.java
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/ppolicy_impl/PasswordPolicyFactory.java
@@ -20,10 +20,12 @@
 package org.apache.directory.api.ldap.extras.controls.ppolicy_impl;
 
 
+import org.apache.directory.api.asn1.util.Asn1Buffer;
 import org.apache.directory.api.ldap.codec.api.CodecControl;
 import org.apache.directory.api.ldap.codec.api.ControlFactory;
 import org.apache.directory.api.ldap.codec.api.LdapApiService;
 import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicy;
+import org.apache.directory.api.ldap.model.message.Control;
 
 
 /**
@@ -50,7 +52,7 @@ public class PasswordPolicyFactory implements ControlFactory<PasswordPolicy>
 
 
     /**
-     * 
+     *
      * {@inheritDoc}
      */
     @Override
@@ -61,7 +63,7 @@ public class PasswordPolicyFactory implements ControlFactory<PasswordPolicy>
 
 
     /**
-     * 
+     *
      * {@inheritDoc}
      */
     @Override
@@ -72,7 +74,7 @@ public class PasswordPolicyFactory implements ControlFactory<PasswordPolicy>
 
 
     /**
-     * 
+     *
      * {@inheritDoc}
      */
     @Override
@@ -80,4 +82,12 @@ public class PasswordPolicyFactory implements ControlFactory<PasswordPolicy>
     {
         return new PasswordPolicyDecorator( codec, control );
     }
+
+
+    @Override
+    public void encodeValue( Asn1Buffer buffer, Control control )
+    {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncDoneValueFactory.java b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncDoneValueFactory.java
index 6564b1f..ec4b5be 100644
--- a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncDoneValueFactory.java
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncDoneValueFactory.java
@@ -20,10 +20,12 @@
 package org.apache.directory.api.ldap.extras.controls.syncrepl_impl;
 
 
+import org.apache.directory.api.asn1.util.Asn1Buffer;
 import org.apache.directory.api.ldap.codec.api.CodecControl;
 import org.apache.directory.api.ldap.codec.api.ControlFactory;
 import org.apache.directory.api.ldap.codec.api.LdapApiService;
 import org.apache.directory.api.ldap.extras.controls.syncrepl.syncDone.SyncDoneValue;
+import org.apache.directory.api.ldap.model.message.Control;
 
 
 /**
@@ -77,4 +79,12 @@ public class SyncDoneValueFactory implements ControlFactory<SyncDoneValue>
     {
         return new SyncDoneValueDecorator( codec, control );
     }
+
+
+    @Override
+    public void encodeValue( Asn1Buffer buffer, Control control )
+    {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncRequestValueFactory.java b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncRequestValueFactory.java
index 36a609e..b51ad9f 100644
--- a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncRequestValueFactory.java
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncRequestValueFactory.java
@@ -20,10 +20,12 @@
 package org.apache.directory.api.ldap.extras.controls.syncrepl_impl;
 
 
+import org.apache.directory.api.asn1.util.Asn1Buffer;
 import org.apache.directory.api.ldap.codec.api.CodecControl;
 import org.apache.directory.api.ldap.codec.api.ControlFactory;
 import org.apache.directory.api.ldap.codec.api.LdapApiService;
 import org.apache.directory.api.ldap.extras.controls.syncrepl.syncRequest.SyncRequestValue;
+import org.apache.directory.api.ldap.model.message.Control;
 
 
 /**
@@ -77,4 +79,12 @@ public class SyncRequestValueFactory implements ControlFactory<SyncRequestValue>
     {
         return new SyncRequestValueDecorator( codec, control );
     }
+
+
+    @Override
+    public void encodeValue( Asn1Buffer buffer, Control control )
+    {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncStateValueFactory.java b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncStateValueFactory.java
index 7f0cb97..bf77d88 100644
--- a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncStateValueFactory.java
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/syncrepl_impl/SyncStateValueFactory.java
@@ -20,10 +20,12 @@
 package org.apache.directory.api.ldap.extras.controls.syncrepl_impl;
 
 
+import org.apache.directory.api.asn1.util.Asn1Buffer;
 import org.apache.directory.api.ldap.codec.api.CodecControl;
 import org.apache.directory.api.ldap.codec.api.ControlFactory;
 import org.apache.directory.api.ldap.codec.api.LdapApiService;
 import org.apache.directory.api.ldap.extras.controls.syncrepl.syncState.SyncStateValue;
+import org.apache.directory.api.ldap.model.message.Control;
 
 
 /**
@@ -77,4 +79,12 @@ public class SyncStateValueFactory implements ControlFactory<SyncStateValue>
     {
         return new SyncStateValueDecorator( codec, control );
     }
+
+
+    @Override
+    public void encodeValue( Asn1Buffer buffer, Control control )
+    {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/transaction_impl/TransactionSpecificationFactory.java b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/transaction_impl/TransactionSpecificationFactory.java
index 092d09c..acb8f51 100644
--- a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/transaction_impl/TransactionSpecificationFactory.java
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/transaction_impl/TransactionSpecificationFactory.java
@@ -20,11 +20,13 @@
 package org.apache.directory.api.ldap.extras.controls.transaction_impl;
 
 
+import org.apache.directory.api.asn1.util.Asn1Buffer;
 import org.apache.directory.api.ldap.codec.api.CodecControl;
 import org.apache.directory.api.ldap.codec.api.ControlFactory;
 import org.apache.directory.api.ldap.codec.api.LdapApiService;
 import org.apache.directory.api.ldap.extras.controls.transaction.TransactionSpecification;
 import org.apache.directory.api.ldap.extras.controls.transaction.TransactionSpecificationImpl;
+import org.apache.directory.api.ldap.model.message.Control;
 
 
 /**
@@ -77,4 +79,12 @@ public class TransactionSpecificationFactory implements ControlFactory<Transacti
     {
         return new TransactionSpecificationDecorator( codec, control );
     }
+
+
+    @Override
+    public void encodeValue( Asn1Buffer buffer, Control control )
+    {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/VirtualListViewRequestFactory.java b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/VirtualListViewRequestFactory.java
index b6ebec1..85fcf5c 100644
--- a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/VirtualListViewRequestFactory.java
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/VirtualListViewRequestFactory.java
@@ -21,10 +21,12 @@
 package org.apache.directory.api.ldap.extras.controls.vlv_impl;
 
 
+import org.apache.directory.api.asn1.util.Asn1Buffer;
 import org.apache.directory.api.ldap.codec.api.CodecControl;
 import org.apache.directory.api.ldap.codec.api.ControlFactory;
 import org.apache.directory.api.ldap.codec.api.LdapApiService;
 import org.apache.directory.api.ldap.extras.controls.vlv.VirtualListViewRequest;
+import org.apache.directory.api.ldap.model.message.Control;
 
 
 /**
@@ -76,4 +78,12 @@ public class VirtualListViewRequestFactory implements ControlFactory<VirtualList
     {
         return new VirtualListViewRequestDecorator( codec, control );
     }
+
+
+    @Override
+    public void encodeValue( Asn1Buffer buffer, Control control )
+    {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/VirtualListViewResponseFactory.java b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/VirtualListViewResponseFactory.java
index 6ec9a67..b8a5f46 100644
--- a/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/VirtualListViewResponseFactory.java
+++ b/ldap/extras/codec/src/main/java/org/apache/directory/api/ldap/extras/controls/vlv_impl/VirtualListViewResponseFactory.java
@@ -21,10 +21,12 @@
 package org.apache.directory.api.ldap.extras.controls.vlv_impl;
 
 
+import org.apache.directory.api.asn1.util.Asn1Buffer;
 import org.apache.directory.api.ldap.codec.api.CodecControl;
 import org.apache.directory.api.ldap.codec.api.ControlFactory;
 import org.apache.directory.api.ldap.codec.api.LdapApiService;
 import org.apache.directory.api.ldap.extras.controls.vlv.VirtualListViewResponse;
+import org.apache.directory.api.ldap.model.message.Control;
 
 
 /**
@@ -76,4 +78,12 @@ public class VirtualListViewResponseFactory implements ControlFactory<VirtualLis
     {
         return new VirtualListViewResponseDecorator( codec, control );
     }
+
+
+    @Override
+    public void encodeValue( Asn1Buffer buffer, Control control )
+    {
+        // TODO Auto-generated method stub
+
+    }
 }
diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java
index bc65886..3bc0e92 100644
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/DefaultEntry.java
@@ -268,7 +268,7 @@ public final class DefaultEntry implements Entry
             {
                 this.dn = new Dn( schemaManager, dn );
             }
-            
+
             initObjectClassAT();
         }
     }
@@ -333,7 +333,7 @@ public final class DefaultEntry implements Entry
                 {
                     LOG.warn( I18n.msg( I18n.MSG_13200_CANT_STORE_ATTRIBUTE, attribute.getId() ) );
                 }
-                
+
                 throw ne;
             }
         }
@@ -413,7 +413,7 @@ public final class DefaultEntry implements Entry
 
     /**
      * Get the trimmed and lower cased entry ID
-     * 
+     *
      * @param upId The ID
      * @return The retrieved ID
      */
@@ -435,7 +435,7 @@ public final class DefaultEntry implements Entry
 
     /**
      * Get the UpId if it is null.
-     * 
+     *
      * @param upId The ID
      * @param attributeType The AttributeType to retrieve
      * @return the retrieved ID
@@ -530,7 +530,7 @@ public final class DefaultEntry implements Entry
                 {
                     LOG.warn( I18n.msg( I18n.MSG_13201_DN_CANT_BE_NORMALIZED, dn ) );
                 }
-                
+
                 return dn;
             }
         }
@@ -556,7 +556,7 @@ public final class DefaultEntry implements Entry
      * default to the AttributeType name.
      *
      * Updates the AttributeMap.
-     * 
+     *
      * @param upId The user provided ID for the attribute to create
      * @param attributeType The AttributeType to use
      * @param values The values to add to this attribute
@@ -576,7 +576,7 @@ public final class DefaultEntry implements Entry
      * default to the AttributeType name.
      *
      * Updates the AttributeMap.
-     * 
+     *
      * @param upId The user provided ID for the attribute to create
      * @param attributeType The AttributeType to use
      * @param values The values to add to this attribute
@@ -596,7 +596,7 @@ public final class DefaultEntry implements Entry
      * default to the AttributeType name.
      *
      * Updates the AttributeMap.
-     * 
+     *
      * @param upId The user provided ID for the attribute to create
      * @param attributeType The AttributeType to use
      * @param values The values to add to this attribute
@@ -613,7 +613,7 @@ public final class DefaultEntry implements Entry
 
     /**
      * Returns the attributeType from an Attribute ID.
-     * 
+     *
      * @param upId The ID we are looking for
      * @return The found attributeType
      * @throws LdapException If the lookup failed
@@ -1088,10 +1088,10 @@ public final class DefaultEntry implements Entry
         {
             DefaultEntry clone = ( DefaultEntry ) super.clone();
             clone.attributes = new HashMap<>( attributes.size() );
-    
+
             // now clone all the attributes
             //clone.attributes.clear();
-    
+
             if ( schemaManager != null )
             {
                 for ( Attribute attribute : attributes.values() )
@@ -2096,7 +2096,7 @@ public final class DefaultEntry implements Entry
                     {
                         LOG.warn( I18n.msg( I18n.MSG_13203_MISSING_ATTRIBUTE_IN_ENTRY, attribute ) );
                     }
-                    
+
                     continue;
                 }
 
@@ -2136,7 +2136,7 @@ public final class DefaultEntry implements Entry
             {
                 LOG.info( I18n.err( I18n.ERR_13204_NULL_ATTRIBUTE_ID ) );
             }
-            
+
             return false;
         }
 
@@ -2220,7 +2220,7 @@ public final class DefaultEntry implements Entry
             {
                 LOG.info( I18n.err( I18n.ERR_13204_NULL_ATTRIBUTE_ID ) );
             }
-            
+
             return false;
         }
 
@@ -2303,7 +2303,7 @@ public final class DefaultEntry implements Entry
             {
                 LOG.info( I18n.err( I18n.ERR_13204_NULL_ATTRIBUTE_ID ) );
             }
-            
+
             return false;
         }
 
@@ -2411,7 +2411,7 @@ public final class DefaultEntry implements Entry
     @Override
     public Iterator<Attribute> iterator()
     {
-        return Collections.unmodifiableMap( attributes ).values().iterator();
+        return attributes.values().iterator();
     }
 
 
@@ -2443,7 +2443,7 @@ public final class DefaultEntry implements Entry
      *     <b>[attribute]*</b> : each attribute, if we have some
      *   </li>
      * </ul>
-     * 
+     *
      * {@inheritDoc}
      */
     @Override
diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Entry.java b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Entry.java
index 9eab62a..f470bc1 100644
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Entry.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/Entry.java
@@ -54,7 +54,7 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
 
     /**
      * Clone the current entry
-     * 
+     *
      * @return a full copy of this entry
      */
     Entry clone();
@@ -62,7 +62,7 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
 
     /**
      * Shallow Clone the current entry. We don't deep clone the attributes
-     * 
+     *
      * @return a shallow copy of this entry
      */
     Entry shallowClone();
@@ -78,9 +78,9 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
 
     /**
      * Tells if an entry as some specific ObjectClasses values
-     * 
+     *
      * @param objectClasses The ObjectClasses we want to check
-     * @return <code>true</code> if all the ObjectClasses value are present 
+     * @return <code>true</code> if all the ObjectClasses value are present
      * in the ObjectClass attribute
      */
     boolean hasObjectClass( String... objectClasses );
@@ -88,9 +88,9 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
 
     /**
      * Tells if an entry has some specific ObjectClasses Attributes
-     * 
+     *
      * @param objectClasses The ObjectClasses we want to check
-     * @return <code>true</code> if the ObjectClasses Attribute are present 
+     * @return <code>true</code> if the ObjectClasses Attribute are present
      * in the ObjectClass attribute
      */
     boolean hasObjectClass( Attribute... objectClasses );
@@ -99,10 +99,10 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
     /**
      * <p>
      * Returns the attribute with the specified alias. The return value
-     * is <code>null</code> if no match is found.  
+     * is <code>null</code> if no match is found.
      * </p>
-     * <p>An Attribute with an id different from the supplied alias may 
-     * be returned: for example a call with 'cn' may in some implementations 
+     * <p>An Attribute with an id different from the supplied alias may
+     * be returned: for example a call with 'cn' may in some implementations
      * return an Attribute whose getId() field returns 'commonName'.
      * </p>
      *
@@ -114,7 +114,7 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
 
     /**
      * Returns the attribute associated with an AttributeType
-     * 
+     *
      * @param attributeType the AttributeType we are looking for
      * @return the associated attribute
      */
@@ -167,15 +167,15 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
 
     /**
      * <p>
-     * Add an attribute (represented by its AttributeType and some binary values) into an 
+     * Add an attribute (represented by its AttributeType and some binary values) into an
      * entry.
      * </p>
-     * <p> 
-     * If we already have an attribute with the same values, the duplicated values 
+     * <p>
+     * If we already have an attribute with the same values, the duplicated values
      * are not added (duplicated values are not allowed)
      * </p>
      * <p>
-     * If the value cannot be added, or if the AttributeType is null or invalid, 
+     * If the value cannot be added, or if the AttributeType is null or invalid,
      * a LdapException is thrown.
      * </p>
      *
@@ -189,18 +189,18 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
 
     /**
      * <p>
-     * Add an attribute (represented by its AttributeType and some String values) into an 
+     * Add an attribute (represented by its AttributeType and some String values) into an
      * entry.
      * </p>
-     * <p> 
-     * If we already have an attribute with the same values, the duplicated values 
+     * <p>
+     * If we already have an attribute with the same values, the duplicated values
      * are not added (duplicated values are not allowed)
      * </p>
-     * <p> 
-     * If the value cannot be added, or if the AttributeType is null or invalid, 
+     * <p>
+     * If the value cannot be added, or if the AttributeType is null or invalid,
      * a LdapException is thrown.
      * </p>
-     * 
+     *
      * @param attributeType The attribute Type
      * @param values The list of binary values to inject. It can be empty
      * @return the modified entry
@@ -211,15 +211,15 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
 
     /**
      * <p>
-     * Add an attribute (represented by its AttributeType and some values) into an 
+     * Add an attribute (represented by its AttributeType and some values) into an
      * entry.
      * </p>
-     * <p> 
-     * If we already have an attribute with the same values, the duplicated values 
+     * <p>
+     * If we already have an attribute with the same values, the duplicated values
      * are not added (duplicated values are not allowed)
      * </p>
      * <p>
-     * If the value cannot be added, or if the AttributeType is null or invalid, 
+     * If the value cannot be added, or if the AttributeType is null or invalid,
      * a LdapException is thrown.
      * </p>
      *
@@ -233,15 +233,15 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
 
     /**
      * <p>
-     * Add an attribute (represented by its AttributeType and some binary values) into an 
+     * Add an attribute (represented by its AttributeType and some binary values) into an
      * entry. Set the User Provider ID at the same time
      * </p>
-     * <p> 
-     * If we already have an attribute with the same values, the duplicated values 
+     * <p>
+     * If we already have an attribute with the same values, the duplicated values
      * are not added (duplicated values are not allowed)
      * </p>
      * <p>
-     * If the value cannot be added, or if the AttributeType is null or invalid, 
+     * If the value cannot be added, or if the AttributeType is null or invalid,
      * a LdapException is thrown.
      * </p>
      *
@@ -256,15 +256,15 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
 
     /**
      * <p>
-     * Add an attribute (represented by its AttributeType and some String values) into an 
+     * Add an attribute (represented by its AttributeType and some String values) into an
      * entry. Set the User Provider ID at the same time
      * </p>
-     * <p> 
-     * If we already have an attribute with the same values, the duplicated values 
+     * <p>
+     * If we already have an attribute with the same values, the duplicated values
      * are not added (duplicated values are not allowed)
      * </p>
      * <p>
-     * If the value cannot be added, or if the AttributeType is null or invalid, 
+     * If the value cannot be added, or if the AttributeType is null or invalid,
      * a LdapException is thrown.
      * </p>
      *
@@ -279,15 +279,15 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
 
     /**
      * <p>
-     * Add an attribute (represented by its AttributeType and some values) into an 
+     * Add an attribute (represented by its AttributeType and some values) into an
      * entry. Set the User Provider ID at the same time
      * </p>
-     * <p> 
-     * If we already have an attribute with the same values, nothing is done 
+     * <p>
+     * If we already have an attribute with the same values, nothing is done
      * (duplicated values are not allowed)
      * </p>
      * <p>
-     * If the value cannot be added, or if the AttributeType is null or invalid, 
+     * If the value cannot be added, or if the AttributeType is null or invalid,
      * a LdapException is thrown.
      * </p>
      *
@@ -303,7 +303,7 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
     /**
      * Add some String values to the current Entry.
      *
-     * @param upId The user provided ID of the attribute we want to add 
+     * @param upId The user provided ID of the attribute we want to add
      * some values to
      * @param values The list of String values to add
      * @return the modified entry
@@ -315,7 +315,7 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
     /**
      * Add some binary values to the current Entry.
      *
-     * @param upId The user provided ID of the attribute we want to add 
+     * @param upId The user provided ID of the attribute we want to add
      * some values to
      * @param values The list of binary values to add
      * @return the modified entry
@@ -327,7 +327,7 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
     /**
      * Add some Values to the current Entry.
      *
-     * @param upId The user provided ID of the attribute we want to add 
+     * @param upId The user provided ID of the attribute we want to add
      * some values to
      * @param values The list of Values to add
      * @return the modified entry
@@ -338,11 +338,11 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
 
     /**
      * <p>
-     * Places attributes in the attribute collection. 
+     * Places attributes in the attribute collection.
      * </p>
-     * <p>If there is already an attribute with the same ID as any of the 
-     * new attributes, the old ones are removed from the collection and 
-     * are returned by this method. If there was no attribute with the 
+     * <p>If there is already an attribute with the same ID as any of the
+     * new attributes, the old ones are removed from the collection and
+     * are returned by this method. If there was no attribute with the
      * same ID the return value is <code>null</code>.
      *</p>
      *
@@ -355,12 +355,12 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
 
     /**
      * <p>
-     * Places a new attribute with the supplied AttributeType and binary values 
-     * into the attribute collection. 
+     * Places a new attribute with the supplied AttributeType and binary values
+     * into the attribute collection.
      * </p>
      * <p>
      * If there is already an attribute with the same AttributeType, the old
-     * one is removed from the collection and is returned by this method. 
+     * one is removed from the collection and is returned by this method.
      * </p>
      * <p>
      * This method provides a mechanism to put an attribute with a
@@ -377,12 +377,12 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
 
     /**
      * <p>
-     * Places a new attribute with the supplied AttributeType and String values 
-     * into the attribute collection. 
+     * Places a new attribute with the supplied AttributeType and String values
+     * into the attribute collection.
      * </p>
      * <p>
      * If there is already an attribute with the same AttributeType, the old
-     * one is removed from the collection and is returned by this method. 
+     * one is removed from the collection and is returned by this method.
      * </p>
      * <p>
      * This method provides a mechanism to put an attribute with a
@@ -399,12 +399,12 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
 
     /**
      * <p>
-     * Places a new attribute with the supplied AttributeType and some values 
-     * into the attribute collection. 
+     * Places a new attribute with the supplied AttributeType and some values
+     * into the attribute collection.
      * </p>
      * <p>
      * If there is already an attribute with the same AttributeType, the old
-     * one is removed from the collection and is returned by this method. 
+     * one is removed from the collection and is returned by this method.
      * </p>
      * <p>
      * This method provides a mechanism to put an attribute with a
@@ -421,15 +421,15 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
 
     /**
      * <p>
-     * Places a new attribute with the supplied AttributeType and some binary values 
-     * into the attribute collection. 
+     * Places a new attribute with the supplied AttributeType and some binary values
+     * into the attribute collection.
      * </p>
      * <p>
      * The given User provided ID will be used for this new AttributeEntry.
      * </p>
      * <p>
      * If there is already an attribute with the same AttributeType, the old
-     * one is removed from the collection and is returned by this method. 
+     * one is removed from the collection and is returned by this method.
      * </p>
      * <p>
      * This method provides a mechanism to put an attribute with a
@@ -447,15 +447,15 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
 
     /**
      * <p>
-     * Places a new attribute with the supplied AttributeType and some String values 
-     * into the attribute collection. 
+     * Places a new attribute with the supplied AttributeType and some String values
+     * into the attribute collection.
      * </p>
      * <p>
      * The given User provided ID will be used for this new AttributeEntry.
      * </p>
      * <p>
      * If there is already an attribute with the same AttributeType, the old
-     * one is removed from the collection and is returned by this method. 
+     * one is removed from the collection and is returned by this method.
      * </p>
      * <p>
      * This method provides a mechanism to put an attribute with a
@@ -473,15 +473,15 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
 
     /**
      * <p>
-     * Places a new attribute with the supplied AttributeType and some values 
-     * into the attribute collection. 
+     * Places a new attribute with the supplied AttributeType and some values
+     * into the attribute collection.
      * </p>
      * <p>
      * The given User provided ID will be used for this new AttributeEntry.
      * </p>
      * <p>
      * If there is already an attribute with the same AttributeType, the old
-     * one is removed from the collection and is returned by this method. 
+     * one is removed from the collection and is returned by this method.
      * </p>
      * <p>
      * This method provides a mechanism to put an attribute with a
@@ -499,10 +499,10 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
 
     /**
      * <p>
-     * Put an attribute (represented by its ID and some binary values) into an entry. 
+     * Put an attribute (represented by its ID and some binary values) into an entry.
      * </p>
-     * <p> 
-     * If the attribute already exists, the previous attribute will be 
+     * <p>
+     * If the attribute already exists, the previous attribute will be
      * replaced and returned.
      * </p>
      *
@@ -515,10 +515,10 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
 
     /**
      * <p>
-     * Put an attribute (represented by its ID and some String values) into an entry. 
+     * Put an attribute (represented by its ID and some String values) into an entry.
      * </p>
-     * <p> 
-     * If the attribute already exists, the previous attribute will be 
+     * <p>
+     * If the attribute already exists, the previous attribute will be
      * replaced and returned.
      * </p>
      *
@@ -531,10 +531,10 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
 
     /**
      * <p>
-     * Put an attribute (represented by its ID and some values) into an entry. 
+     * Put an attribute (represented by its ID and some values) into an entry.
      * </p>
-     * <p> 
-     * If the attribute already exists, the previous attribute will be 
+     * <p>
+     * If the attribute already exists, the previous attribute will be
      * replaced and returned.
      * </p>
      *
@@ -557,14 +557,14 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
      * will be removed too.
      * </p>
      * <p>
-     * If the attribute does not exist, nothing is done and the method returns 
+     * If the attribute does not exist, nothing is done and the method returns
      * <code>false</code>
-     * </p> 
+     * </p>
      *
-     * @param attributeType The attribute type  
+     * @param attributeType The attribute type
      * @param values the values to be removed
      * @return <code>true</code> if at least a value is removed, <code>false</code>
-     * if not all the values have been removed or if the attribute does not exist. 
+     * if not all the values have been removed or if the attribute does not exist.
      * @throws LdapException If the removal failed
      */
     boolean remove( AttributeType attributeType, byte[]... values ) throws LdapException;
@@ -582,14 +582,14 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
      * will be removed too.
      * </p>
      * <p>
-     * If the attribute does not exist, nothing is done and the method returns 
+     * If the attribute does not exist, nothing is done and the method returns
      * <code>false</code>
-     * </p> 
+     * </p>
      *
-     * @param attributeType The attribute type  
+     * @param attributeType The attribute type
      * @param values the values to be removed
      * @return <code>true</code> if at least a value is removed, <code>false</code>
-     * if not all the values have been removed or if the attribute does not exist. 
+     * if not all the values have been removed or if the attribute does not exist.
      * @throws LdapException If the removal failed
      */
     boolean remove( AttributeType attributeType, String... values ) throws LdapException;
@@ -607,14 +607,14 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
      * will be removed too.
      * </p>
      * <p>
-     * If the attribute does not exist, nothing is done and the method returns 
+     * If the attribute does not exist, nothing is done and the method returns
      * <code>false</code>
-     * </p> 
+     * </p>
      *
-     * @param attributeType The attribute type  
+     * @param attributeType The attribute type
      * @param values the values to be removed
      * @return <code>true</code> if at least a value is removed, <code>false</code>
-     * if not all the values have been removed or if the attribute does not exist. 
+     * if not all the values have been removed or if the attribute does not exist.
      * @throws LdapException If the removal failed
      */
     boolean remove( AttributeType attributeType, Value... values ) throws LdapException;
@@ -634,10 +634,10 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
 
     /**
      * <p>
-     * Removes the attribute with the specified AttributeTypes. 
+     * Removes the attribute with the specified AttributeTypes.
      * </p>
      * <p>
-     * The removed attribute are returned by this method. 
+     * The removed attribute are returned by this method.
      * </p>
      * <p>
      * If there is no attribute with the specified AttributeTypes,
@@ -661,14 +661,14 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
      * will be removed too.
      * </p>
      * <p>
-     * If the attribute does not exist, nothing is done and the method returns 
+     * If the attribute does not exist, nothing is done and the method returns
      * <code>false</code>
-     * </p> 
+     * </p>
      *
-     * @param upId The attribute ID  
+     * @param upId The attribute ID
      * @param values the attribute's values to be removed
      * @return <code>true</code> if at least a value is removed, <code>false</code>
-     * if not all the values have been removed or if the attribute does not exist. 
+     * if not all the values have been removed or if the attribute does not exist.
      * @throws LdapException If the removal failed
      */
     boolean remove( String upId, byte[]... values ) throws LdapException;
@@ -686,14 +686,14 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
      * will be removed too.
      * </p>
      * <p>
-     * If the attribute does not exist, nothing is done and the method returns 
+     * If the attribute does not exist, nothing is done and the method returns
      * <code>false</code>
-     * </p> 
+     * </p>
      *
-     * @param upId The attribute ID  
+     * @param upId The attribute ID
      * @param values the attribute's values to be removed
      * @return <code>true</code> if at least a value is removed, <code>false</code>
-     * if no values have been removed or if the attribute does not exist. 
+     * if no values have been removed or if the attribute does not exist.
      * @throws LdapException If the provided values are invalid
      */
     boolean remove( String upId, String... values ) throws LdapException;
@@ -711,14 +711,14 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
      * will be removed too.
      * </p>
      * <p>
-     * If the attribute does not exist, nothing is done and the method returns 
+     * If the attribute does not exist, nothing is done and the method returns
      * <code>false</code>
-     * </p> 
+     * </p>
      *
-     * @param upId The attribute ID  
+     * @param upId The attribute ID
      * @param values the attribute's values to be removed
      * @return <code>true</code> if at least a value is removed, <code>false</code>
-     * if not all the values have been removed or if the attribute does not exist. 
+     * if not all the values have been removed or if the attribute does not exist.
      * @throws LdapException if the attribute does not exists
      */
     boolean remove( String upId, Value... values ) throws LdapException;
@@ -726,10 +726,10 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
 
     /**
       * <p>
-      * Removes the attribute with the specified alias. 
+      * Removes the attribute with the specified alias.
       * </p>
       * <p>
-      * The removed attribute are returned by this method. 
+      * The removed attribute are returned by this method.
       * </p>
       * <p>
       * If there is no attribute with the specified alias,
@@ -796,7 +796,7 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
      * </p>
      *
      * @param attributes The Attributes to look for
-     * @return <code>true</code> if all the attributes are found within 
+     * @return <code>true</code> if all the attributes are found within
      * the entry, <code>false</code> if at least one of them is not present.
      */
     boolean contains( Attribute... attributes );
@@ -808,7 +808,7 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
      * @param upId The Attribute we are looking for.
      * @param values The searched values.
      * @return <code>true</code> if all the values are found within the attribute,
-     * false if at least one value is not present or if the ID is not valid. 
+     * false if at least one value is not present or if the ID is not valid.
      */
     boolean contains( String upId, byte[]... values );
 
@@ -819,7 +819,7 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
      * @param upId The Attribute we are looking for.
      * @param values The searched values.
      * @return <code>true</code> if all the values are found within the attribute,
-     * false if at least one value is not present or if the ID is not valid. 
+     * false if at least one value is not present or if the ID is not valid.
      */
     boolean contains( String upId, String... values );
 
@@ -830,7 +830,7 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
      * @param upId The Attribute we are looking for.
      * @param values The searched values.
      * @return <code>true</code> if all the values are found within the attribute,
-     * false if at least one value is not present or if the ID is not valid. 
+     * false if at least one value is not present or if the ID is not valid.
      */
     boolean contains( String upId, Value... values );
 
@@ -861,7 +861,7 @@ public interface Entry extends Cloneable, Iterable<Attribute>, Externalizable
 
     /**
      * A pretty-pinter for Entries
-     * 
+     *
      * @param tabs The tabs to add before any output
      * @return The pretty-printed entry
      */
diff --git a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/ImmutableEntry.java b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/ImmutableEntry.java
index 7ab2938..0331b20 100644
--- a/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/ImmutableEntry.java
+++ b/ldap/model/src/main/java/org/apache/directory/api/ldap/model/entry/ImmutableEntry.java
@@ -37,7 +37,7 @@ import org.apache.directory.api.util.exception.NotImplementedException;
 /**
  * A default implementation of a ServerEntry which should suite most
  * use cases.
- * 
+ *
  * This class is final, it should not be extended.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
@@ -55,10 +55,10 @@ public class ImmutableEntry implements Entry
     // Constructors
     //-------------------------------------------------------------------------
     /**
-     * Creates a new instance of DefaultEntry. 
+     * Creates a new instance of DefaultEntry.
      * <p>
      * This entry <b>must</b> be initialized before being used !
-     * 
+     *
      * @param entry The encapsulated entry
      */
     public ImmutableEntry( Entry entry )
@@ -73,6 +73,7 @@ public class ImmutableEntry implements Entry
     /**
      * {@inheritDoc}
      */
+    @Override
     public Entry add( AttributeType attributeType, byte[]... values ) throws LdapException
     {
         new Exception().printStackTrace();
@@ -105,6 +106,7 @@ public class ImmutableEntry implements Entry
     /**
      * {@inheritDoc}
      */
+    @Override
     public Entry add( String upId, AttributeType attributeType, byte[]... values ) throws LdapException
     {
         new Exception().printStackTrace();
@@ -148,6 +150,7 @@ public class ImmutableEntry implements Entry
     /**
      * {@inheritDoc}
      */
+    @Override
     public Entry add( String upId, byte[]... values ) throws LdapException
     {
         new Exception().printStackTrace();
@@ -232,6 +235,7 @@ public Entry add( String upId, Value... values ) throws LdapException
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean contains( AttributeType attributeType, byte[]... values )
     {
         return entry.contains( attributeType, values );
@@ -261,6 +265,7 @@ public Entry add( String upId, Value... values ) throws LdapException
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean contains( String upId, byte[]... values )
     {
         return entry.contains( upId, values );
@@ -320,6 +325,7 @@ public Entry add( String upId, Value... values ) throws LdapException
     /**
      * {@inheritDoc}
      */
+    @Override
     public Attribute put( String upId, byte[]... values )
     {
         new Exception().printStackTrace();
@@ -363,6 +369,7 @@ public Entry add( String upId, Value... values ) throws LdapException
     /**
      * {@inheritDoc}
      */
+    @Override
     public Attribute put( AttributeType attributeType, byte[]... values ) throws LdapException
     {
         new Exception().printStackTrace();
@@ -395,6 +402,7 @@ public Entry add( String upId, Value... values ) throws LdapException
     /**
      * {@inheritDoc}
      */
+    @Override
     public Attribute put( String upId, AttributeType attributeType, byte[]... values ) throws LdapException
     {
         new Exception().printStackTrace();
@@ -438,6 +446,7 @@ public Entry add( String upId, Value... values ) throws LdapException
     /**
      * {@inheritDoc}
      */
+    @Override
     public boolean remove( AttributeType attributeType, byte[]... values ) throws LdapException
     {
         new Exception().printStackTrace();
@@ -469,10 +478,10 @@ public Entry add( String upId, Value... values ) throws LdapException
 
     /**
      * <p>
-     * Removes the attribute with the specified AttributeTypes. 
+     * Removes the attribute with the specified AttributeTypes.
      * </p>
      * <p>
-     * The removed attribute are returned by this method. 
+     * The removed attribute are returned by this method.
      * </p>
      * <p>
      * If there is no attribute with the specified AttributeTypes,
@@ -512,15 +521,16 @@ public Entry add( String upId, Value... values ) throws LdapException
      * will be removed too.
      * </p>
      * <p>
-     * If the attribute does not exist, nothing is done and the method returns 
+     * If the attribute does not exist, nothing is done and the method returns
      * <code>false</code>
-     * </p> 
+     * </p>
      *
-     * @param upId The attribute ID  
+     * @param upId The attribute ID
      * @param values the values to be removed
      * @return <code>true</code> if at least a value is removed, <code>false</code>
-     * if not all the values have been removed or if the attribute does not exist. 
+     * if not all the values have been removed or if the attribute does not exist.
      */
+    @Override
     public boolean remove( String upId, byte[]... values ) throws LdapException
     {
         new Exception().printStackTrace();
@@ -540,14 +550,14 @@ public Entry add( String upId, Value... values ) throws LdapException
      * will be removed too.
      * </p>
      * <p>
-     * If the attribute does not exist, nothing is done and the method returns 
+     * If the attribute does not exist, nothing is done and the method returns
      * <code>false</code>
-     * </p> 
+     * </p>
      *
-     * @param upId The attribute ID  
+     * @param upId The attribute ID
      * @param values the attributes to be removed
      * @return <code>true</code> if at least a value is removed, <code>false</code>
-     * if not all the values have been removed or if the attribute does not exist. 
+     * if not all the values have been removed or if the attribute does not exist.
      */
     @Override
     public boolean remove( String upId, String... values ) throws LdapException
@@ -569,14 +579,14 @@ public Entry add( String upId, Value... values ) throws LdapException
      * will be removed too.
      * </p>
      * <p>
-     * If the attribute does not exist, nothing is done and the method returns 
+     * If the attribute does not exist, nothing is done and the method returns
      * <code>false</code>
-     * </p> 
+     * </p>
      *
-     * @param upId The attribute ID  
+     * @param upId The attribute ID
      * @param values the attributes to be removed
      * @return <code>true</code> if at least a value is removed, <code>false</code>
-     * if not all the values have been removed or if the attribute does not exist. 
+     * if not all the values have been removed or if the attribute does not exist.
      */
     @Override
     public boolean remove( String upId, Value... values ) throws LdapException
@@ -673,8 +683,8 @@ public Entry add( String upId, Value... values ) throws LdapException
      *     <b>[attribute]*</b> : each attribute, if we have some
      *   </li>
      * </ul>
-     * 
-     * {@inheritDoc} 
+     *
+     * {@inheritDoc}
      */
     @Override
     public void writeExternal( ObjectOutput out ) throws IOException
@@ -696,15 +706,15 @@ public Entry add( String upId, Value... values ) throws LdapException
 
     /**
      * Serialize an Entry.
-     * 
+     *
      * The structure is the following :
      * <b>[a byte]</b> : if the Dn is empty 0 will be written else 1
      * <b>[Rdn]</b> : The entry's Rdn.
-     * <b>[numberAttr]</b> : the bumber of attributes. Can be 0 
-     * <b>[attribute's oid]*</b> : The attribute's OID to get back 
+     * <b>[numberAttr]</b> : the bumber of attributes. Can be 0
+     * <b>[attribute's oid]*</b> : The attribute's OID to get back
      * the attributeType on deserialization
      * <b>[Attribute]*</b> The attribute
-     * 
+     *
      * @param out the buffer in which the data will be serialized
      * @throws IOException if the serialization failed
      */
@@ -716,8 +726,8 @@ public Entry add( String upId, Value... values ) throws LdapException
 
 
     /**
-     * Deserialize an entry. 
-     * 
+     * Deserialize an entry.
+     *
      * @param in The buffer containing the serialized serverEntry
      * @throws IOException if there was a problem when deserializing
      * @throws ClassNotFoundException if we can't deserialize an expected object
@@ -734,7 +744,7 @@ public Entry add( String upId, Value... values ) throws LdapException
      * before the comparison can be done.
      *
      * @see java.lang.Object#hashCode()
-     * @return the instance's hash code 
+     * @return the instance's hash code
      */
     @Override
     public int hashCode()