directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r987606 [14/25] - in /directory/shared/trunk: ./ all/ asn1-codec/ asn1-codec/src/main/java/org/apache/directory/shared/asn1/codec/ asn1/ asn1/src/main/java/org/apache/directory/shared/asn1/ber/grammar/ asn1/src/main/java/org/apache/director...
Date Fri, 20 Aug 2010 19:23:37 GMT
Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareRequestImpl.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareRequestImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareRequestImpl.java Fri Aug 20 19:23:27 2010
@@ -24,9 +24,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.entry.BinaryValue;
 import org.apache.directory.shared.ldap.entry.StringValue;
 import org.apache.directory.shared.ldap.entry.Value;
-import org.apache.directory.shared.ldap.message.internal.InternalCompareRequest;
-import org.apache.directory.shared.ldap.message.internal.InternalCompareResponse;
-import org.apache.directory.shared.ldap.message.internal.InternalResultResponse;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.util.StringTools;
 
@@ -36,7 +33,7 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class CompareRequestImpl extends AbstractAbandonableRequest implements InternalCompareRequest
+public class CompareRequestImpl extends AbstractAbandonableRequest implements CompareRequest
 {
     static final long serialVersionUID = 1699731530016468977L;
 
@@ -46,22 +43,45 @@ public class CompareRequestImpl extends 
     /** The id of the attribute used in the comparison */
     private String attrId;
 
+    /** The bytes of the attribute id used in the comparison */
+    private byte[] attrIdBytes;
+
     /** The value of the attribute used in the comparison */
     private Value<?> attrVal;
 
-    private InternalCompareResponse response;
+    /** The bytes of the attribute value used in the comparison */
+    private byte[] attrValBytes;
+
+    /** The associated response */
+    private CompareResponse response;
+
+    /** The compare request length */
+    private int compareRequestLength;
+
+    /** The attribute value assertion length */
+    private int avaLength;
 
 
     // ------------------------------------------------------------------------
     // Constructors
     // ------------------------------------------------------------------------
+    /**
+     * Creates an CompareRequest implementation to compare a named entry with an
+     * attribute value assertion pair.
+     * 
+     * @param id the sequence identifier of the CompareRequest message.
+     */
+    public CompareRequestImpl()
+    {
+        super( -1, TYPE );
+    }
+
 
     /**
      * Creates an CompareRequest implementation to compare a named entry with an
      * attribute value assertion pair.
      * 
-     * @param id
-     *            the sequence identifier of the CompareRequest message.
+     * @param id the sequence identifier of the CompareRequest message.
      */
     public CompareRequestImpl( final int id )
     {
@@ -89,8 +109,7 @@ public class CompareRequestImpl extends 
      * Sets the distinguished name of the entry to be compared using the
      * attribute value assertion.
      * 
-     * @param name
-     *            the DN of the compared entry.
+     * @param name the DN of the compared entry.
      */
     public void setName( DN name )
     {
@@ -112,8 +131,7 @@ public class CompareRequestImpl extends 
     /**
      * Sets the attribute value to use in the comparison.
      * 
-     * @param attrVal
-     *            the attribute value used in comparison.
+     * @param attrVal the attribute value used in comparison.
      */
     public void setAssertionValue( String attrVal )
     {
@@ -124,8 +142,7 @@ public class CompareRequestImpl extends 
     /**
      * Sets the attribute value to use in the comparison.
      * 
-     * @param attrVal
-     *            the attribute value used in comparison.
+     * @param attrVal the attribute value used in comparison.
      */
     public void setAssertionValue( byte[] attrVal )
     {
@@ -154,8 +171,7 @@ public class CompareRequestImpl extends 
     /**
      * Sets the attribute id used in the comparison.
      * 
-     * @param attrId
-     *            the attribute id used in comparison.
+     * @param attrId the attribute id used in comparison.
      */
     public void setAttributeId( String attrId )
     {
@@ -163,6 +179,50 @@ public class CompareRequestImpl extends 
     }
 
 
+    /**
+     * Gets the attribute id bytes use in making the comparison.
+     * 
+     * @return the attribute id bytes used in comparison.
+     */
+    /*No qualifier*/byte[] getAttrIdBytes()
+    {
+        return attrIdBytes;
+    }
+
+
+    /**
+     * Sets the attribute id bytes used in the comparison.
+     * 
+     * @param attrIdBytes the attribute id bytes used in comparison.
+     */
+    /*No qualifier*/void setAttrIdBytes( byte[] attrIdBytes )
+    {
+        this.attrIdBytes = attrIdBytes;
+    }
+
+
+    /**
+     * Gets the attribute value bytes use in making the comparison.
+     * 
+     * @return the attribute value bytes used in comparison.
+     */
+    /*No qualifier*/byte[] getAttrValBytes()
+    {
+        return attrValBytes;
+    }
+
+
+    /**
+     * Sets the attribute value bytes used in the comparison.
+     * 
+     * @param attrValBytes the attribute value bytes used in comparison.
+     */
+    /*No qualifier*/void setAttrValBytes( byte[] attrValBytes )
+    {
+        this.attrValBytes = attrValBytes;
+    }
+
+
     // ------------------------------------------------------------------------
     // SingleReplyRequest Interface Method Implementations
     // ------------------------------------------------------------------------
@@ -184,7 +244,7 @@ public class CompareRequestImpl extends 
      * 
      * @return the result containing response for this request
      */
-    public InternalResultResponse getResultResponse()
+    public ResultResponse getResultResponse()
     {
         if ( response == null )
         {
@@ -196,6 +256,44 @@ public class CompareRequestImpl extends 
 
 
     /**
+     * Stores the encoded length for the CompareRequest
+     * @param compareRequestLength The encoded length
+     */
+    /* No qualifier*/void setCompareRequestLength( int compareRequestLength )
+    {
+        this.compareRequestLength = compareRequestLength;
+    }
+
+
+    /**
+     * @return The encoded CompareRequest length
+     */
+    /* No qualifier */int getCompareRequestLength()
+    {
+        return compareRequestLength;
+    }
+
+
+    /**
+     * Stores the encoded length for the ava
+     * @param avaLength The encoded length
+     */
+    /* No qualifier*/void setAvaLength( int avaLength )
+    {
+        this.avaLength = avaLength;
+    }
+
+
+    /**
+     * @return The encoded ava length
+     */
+    /* No qualifier */int getAvaLength()
+    {
+        return avaLength;
+    }
+
+
+    /**
      * {@inheritDoc}
      */
     @Override
@@ -243,7 +341,7 @@ public class CompareRequestImpl extends 
             return false;
         }
 
-        InternalCompareRequest req = ( InternalCompareRequest ) obj;
+        CompareRequest req = ( CompareRequest ) obj;
         DN reqName = req.getName();
 
         if ( ( name != null ) && ( reqName == null ) )
@@ -323,6 +421,9 @@ public class CompareRequestImpl extends 
                 .append( "'\n" );
         }
 
+        // The controls
+        sb.append( super.toString() );
+
         return sb.toString();
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareResponseImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareResponseImpl.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareResponseImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareResponseImpl.java Fri Aug 20 19:23:27 2010
@@ -19,17 +19,16 @@
  */
 package org.apache.directory.shared.ldap.message;
 
-import org.apache.directory.shared.ldap.message.internal.InternalAbstractResultResponse;
-import org.apache.directory.shared.ldap.message.internal.InternalCompareResponse;
-
 
 /**
  * CompareResponse implementation.
  * 
  * @author <a href="mailto:dev@directory.apache.org"> Apache Directory Project</a>
  */
-public class CompareResponseImpl extends InternalAbstractResultResponse implements InternalCompareResponse
+public class CompareResponseImpl extends AbstractResultResponse implements CompareResponse
 {
+    /** The encoded compareResponse length */
+    private int compareResponseLength;
 
     // ------------------------------------------------------------------------
     // Constructors
@@ -39,13 +38,66 @@ public class CompareResponseImpl extends
 
 
     /**
-     * Creates a Lockable CompareResponse as a reply to an CompareRequest.
+     * Creates a CompareResponse as a reply to an CompareRequest.
+     */
+    public CompareResponseImpl()
+    {
+        super( -1, TYPE );
+    }
+
+
+    /**
+     * Creates a CompareResponse as a reply to an CompareRequest.
      * 
-     * @param id
-     *            the session unique message id
+     * @param id the session unique message id
      */
-    public CompareResponseImpl(final int id)
+    public CompareResponseImpl( final int id )
     {
         super( id, TYPE );
     }
+
+
+    /**
+     * Stores the encoded length for the CompareResponse
+     * @param compareResponseLength The encoded length
+     */
+    /* No qualifier*/void setCompareResponseLength( int compareResponseLength )
+    {
+        this.compareResponseLength = compareResponseLength;
+    }
+
+
+    /**
+     * @return The encoded CompareResponse's length
+     */
+    /* No qualifier*/int getCompareResponseLength()
+    {
+        return compareResponseLength;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isTrue()
+    {
+        return ldapResult.getResultCode() == ResultCodeEnum.COMPARE_TRUE;
+    }
+
+
+    /**
+     * Get a String representation of an CompareResponse
+     * 
+     * @return An CompareResponse String
+     */
+    public String toString()
+    {
+
+        StringBuilder sb = new StringBuilder();
+
+        sb.append( "    Compare Response\n" );
+        sb.append( super.toString() );
+
+        return sb.toString();
+    }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteRequestImpl.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteRequestImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteRequestImpl.java Fri Aug 20 19:23:27 2010
@@ -21,9 +21,6 @@ package org.apache.directory.shared.ldap
 
 
 import org.apache.directory.shared.ldap.codec.MessageTypeEnum;
-import org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest;
-import org.apache.directory.shared.ldap.message.internal.InternalDeleteResponse;
-import org.apache.directory.shared.ldap.message.internal.InternalResultResponse;
 import org.apache.directory.shared.ldap.name.DN;
 
 
@@ -32,14 +29,15 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class DeleteRequestImpl extends AbstractAbandonableRequest implements InternalDeleteRequest
+public class DeleteRequestImpl extends AbstractAbandonableRequest implements DeleteRequest
 {
     static final long serialVersionUID = 3187847454305567542L;
 
     /** The distinguished name of the entry to delete */
     private DN name;
 
-    private InternalDeleteResponse response;
+    /** The deleteResponse associated with this request */
+    private DeleteResponse response;
 
 
     // ------------------------------------------------------------------------
@@ -47,11 +45,20 @@ public class DeleteRequestImpl extends A
     // ------------------------------------------------------------------------
 
     /**
-     * Creates a Lockable DeleteRequest implementing object used to delete a
+     * Creates a DeleteRequest implementing object used to delete a
+     * leaf entry from the DIT.
+     */
+    public DeleteRequestImpl()
+    {
+        super( -1, TYPE );
+    }
+
+
+    /**
+     * Creates a DeleteRequest implementing object used to delete a
      * leaf entry from the DIT.
      * 
-     * @param id
-     *            the sequential message identifier
+     * @param id the sequential message identifier
      */
     public DeleteRequestImpl( final int id )
     {
@@ -79,8 +86,7 @@ public class DeleteRequestImpl extends A
      * Sets the distinguished name of the leaf entry to be deleted by this
      * request.
      * 
-     * @param name
-     *            the DN of the leaf entry to delete.
+     * @param name the DN of the leaf entry to delete.
      */
     public void setName( DN name )
     {
@@ -109,7 +115,7 @@ public class DeleteRequestImpl extends A
      * 
      * @return the result containing response for this request
      */
-    public InternalResultResponse getResultResponse()
+    public ResultResponse getResultResponse()
     {
         if ( response == null )
         {
@@ -127,10 +133,12 @@ public class DeleteRequestImpl extends A
     public int hashCode()
     {
         int hash = 37;
+
         if ( name != null )
         {
             hash = hash * 17 + name.hashCode();
         }
+
         hash = hash * 17 + super.hashCode();
 
         return hash;
@@ -144,8 +152,7 @@ public class DeleteRequestImpl extends A
      * Then the name of the entry is compared - if not the same false is
      * returned. Finally the method exists returning true.
      * 
-     * @param obj
-     *            the object to test for equality to this
+     * @param obj the object to test for equality to this
      * @return true if the obj is equal to this DeleteRequest, false otherwise
      */
     public boolean equals( Object obj )
@@ -160,7 +167,7 @@ public class DeleteRequestImpl extends A
             return false;
         }
 
-        InternalDeleteRequest req = ( InternalDeleteRequest ) obj;
+        DeleteRequest req = ( DeleteRequest ) obj;
 
         if ( name != null && req.getName() == null )
         {
@@ -189,10 +196,11 @@ public class DeleteRequestImpl extends A
     public String toString()
     {
 
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
 
         sb.append( "    Del request\n" );
         sb.append( "        Entry : '" ).append( name.toString() ).append( "'\n" );
+        sb.append( super.toString() );
 
         return sb.toString();
     }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteResponseImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteResponseImpl.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteResponseImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteResponseImpl.java Fri Aug 20 19:23:27 2010
@@ -19,17 +19,16 @@
  */
 package org.apache.directory.shared.ldap.message;
 
-import org.apache.directory.shared.ldap.message.internal.InternalAbstractResultResponse;
-import org.apache.directory.shared.ldap.message.internal.InternalDeleteResponse;
-
 
 /**
  * DeleteResponse implementation
  * 
  * @author <a href="mailto:dev@directory.apache.org"> Apache Directory Project</a>
  */
-public class DeleteResponseImpl extends InternalAbstractResultResponse implements InternalDeleteResponse
+public class DeleteResponseImpl extends AbstractResultResponse implements DeleteResponse
 {
+    /** The encoded deleteResponse length */
+    private int deleteResponseLength;
 
     // ------------------------------------------------------------------------
     // Constructors
@@ -40,12 +39,55 @@ public class DeleteResponseImpl extends 
 
     /**
      * Creates a DeleteResponse as a reply to an DeleteRequest.
+     */
+    public DeleteResponseImpl()
+    {
+        super( -1, TYPE );
+    }
+
+
+    /**
+     * Creates a DeleteResponse as a reply to an DeleteRequest.
      * 
-     * @param id
-     *            the session unique message id
+     * @param id the session unique message id
      */
-    public DeleteResponseImpl(final int id)
+    public DeleteResponseImpl( final int id )
     {
         super( id, TYPE );
     }
+
+
+    /**
+     * Stores the encoded length for the DeleteResponse
+     * @param deleteResponseLength The encoded length
+     */
+    /* No qualifier*/void setDeleteResponseLength( int deleteResponseLength )
+    {
+        this.deleteResponseLength = deleteResponseLength;
+    }
+
+
+    /**
+     * @return The encoded DeleteResponse's length
+     */
+    /* No qualifier*/int getDeleteResponseLength()
+    {
+        return deleteResponseLength;
+    }
+
+
+    /**
+     * Get a String representation of a DelResponse
+     * 
+     * @return A DelResponse String
+     */
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append( "    Compare Response\n" );
+        sb.append( super.toString() );
+
+        return sb.toString();
+    }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ExtendedRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ExtendedRequestImpl.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ExtendedRequestImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ExtendedRequestImpl.java Fri Aug 20 19:23:27 2010
@@ -26,9 +26,6 @@ import javax.naming.NamingException;
 import javax.naming.ldap.ExtendedResponse;
 
 import org.apache.directory.shared.ldap.codec.MessageTypeEnum;
-import org.apache.directory.shared.ldap.message.internal.InternalAbstractRequest;
-import org.apache.directory.shared.ldap.message.internal.InternalExtendedRequest;
-import org.apache.directory.shared.ldap.message.internal.InternalResultResponse;
 import org.apache.directory.shared.ldap.util.StringTools;
 
 
@@ -37,17 +34,24 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class ExtendedRequestImpl extends InternalAbstractRequest implements InternalExtendedRequest
+public class ExtendedRequestImpl extends AbstractRequest implements ExtendedRequest
 {
     static final long serialVersionUID = 7916990159044177480L;
 
     /** Extended request's Object Identifier or <b>requestName</b> */
     private String oid;
 
-    /** Extended request's payload or <b>requestValue</b> */
-    protected byte[] payload;
+    /** Extended request's value */
+    protected byte[] requestValue;
 
-    protected InternalResultResponse response;
+    /** The associated response */
+    protected ResultResponse response;
+
+    /** The extended request length */
+    private int extendedRequestLength;
+
+    /** The OID length */
+    private byte[] requestNameBytes;
 
 
     // -----------------------------------------------------------------------
@@ -55,41 +59,37 @@ public class ExtendedRequestImpl extends
     // -----------------------------------------------------------------------
 
     /**
-     * Creates a Lockable ExtendedRequest implementing object used to perform
+     * Creates an ExtendedRequest implementing object used to perform
      * extended protocol operation on the server.
-     * 
-     * @param id
-     *            the sequential message identifier
      */
-    public ExtendedRequestImpl( final int id )
+    public ExtendedRequestImpl()
     {
-        super( id, TYPE, true );
+        super( -1, TYPE, true );
     }
 
 
-    // -----------------------------------------------------------------------
-    // ExtendedRequest Interface Method Implementations
-    // -----------------------------------------------------------------------
-
     /**
-     * Gets the Object Idendifier corresponding to the extended request type.
-     * This is the <b>requestName</b> portion of the ext. req. PDU.
+     * Creates an ExtendedRequest implementing object used to perform
+     * extended protocol operation on the server.
      * 
-     * @return the dotted-decimal representation as a String of the OID
+     * @param id the sequential message identifier
      */
-    public String getOid()
+    public ExtendedRequestImpl( final int id )
     {
-        return oid;
+        super( id, TYPE, true );
     }
 
 
+    // -----------------------------------------------------------------------
+    // ExtendedRequest Interface Method Implementations
+    // -----------------------------------------------------------------------
+
     /**
-     * Sets the Object Idendifier corresponding to the extended request type.
+     * Sets the Object Identifier corresponding to the extended request type.
      * 
-     * @param oid
-     *            the dotted-decimal representation as a String of the OID
+     * @param oid the dotted-decimal representation as a String of the OID
      */
-    public void setOid( String oid )
+    public void setRequestName( String oid )
     {
         this.oid = oid;
     }
@@ -102,15 +102,15 @@ public class ExtendedRequestImpl extends
      * 
      * @return byte array of data
      */
-    public byte[] getPayload()
+    public byte[] getRequestValue()
     {
-        if ( payload == null )
+        if ( requestValue == null )
         {
             return null;
         }
 
-        final byte[] copy = new byte[payload.length];
-        System.arraycopy( payload, 0, copy, 0, payload.length );
+        final byte[] copy = new byte[requestValue.length];
+        System.arraycopy( requestValue, 0, copy, 0, requestValue.length );
         return copy;
     }
 
@@ -118,19 +118,18 @@ public class ExtendedRequestImpl extends
     /**
      * Sets the extended request's <b>requestValue</b> portion of the PDU.
      * 
-     * @param payload
-     *            byte array of data encapsulating ext. req. parameters
+     * @param payload byte array of data encapsulating ext. req. parameters
      */
-    public void setPayload( byte[] payload )
+    public void setRequestValue( byte[] payload )
     {
         if ( payload != null )
         {
-            this.payload = new byte[payload.length];
-            System.arraycopy( payload, 0, this.payload, 0, payload.length );
+            this.requestValue = new byte[payload.length];
+            System.arraycopy( payload, 0, this.requestValue, 0, payload.length );
         }
         else
         {
-            this.payload = null;
+            this.requestValue = null;
         }
     }
 
@@ -156,7 +155,7 @@ public class ExtendedRequestImpl extends
      * 
      * @return the result containing response for this request
      */
-    public InternalResultResponse getResultResponse()
+    public ResultResponse getResultResponse()
     {
         if ( response == null )
         {
@@ -178,9 +177,9 @@ public class ExtendedRequestImpl extends
         {
             hash = hash * 17 + oid.hashCode();
         }
-        if ( payload != null )
+        if ( requestValue != null )
         {
-            hash = hash * 17 + Arrays.hashCode( payload );
+            hash = hash * 17 + Arrays.hashCode( requestValue );
         }
         hash = hash * 17 + super.hashCode();
 
@@ -191,8 +190,7 @@ public class ExtendedRequestImpl extends
     /**
      * Checks to see if an object equals this ExtendedRequest.
      * 
-     * @param obj
-     *            the object to be checked for equality
+     * @param obj the object to be checked for equality
      * @return true if the obj equals this ExtendedRequest, false otherwise
      */
     public boolean equals( Object obj )
@@ -207,39 +205,40 @@ public class ExtendedRequestImpl extends
             return false;
         }
 
-        if ( !( obj instanceof InternalExtendedRequest ) )
+        if ( !( obj instanceof ExtendedRequest ) )
         {
             return false;
         }
 
-        InternalExtendedRequest req = ( InternalExtendedRequest ) obj;
+        ExtendedRequest req = ( ExtendedRequest ) obj;
 
-        if ( ( oid != null ) && ( req.getOid() == null ) )
+        if ( ( oid != null ) && ( req.getRequestName() == null ) )
         {
             return false;
         }
 
-        if ( ( oid == null ) && ( req.getOid() != null ) )
+        if ( ( oid == null ) && ( req.getRequestName() != null ) )
         {
             return false;
         }
 
-        if ( ( oid != null ) && ( req.getOid() != null ) && !oid.equals( req.getOid() ) )
+        if ( ( oid != null ) && ( req.getRequestName() != null ) && !oid.equals( req.getRequestName() ) )
         {
             return false;
         }
 
-        if ( ( payload != null ) && ( req.getPayload() == null ) )
+        if ( ( requestValue != null ) && ( req.getRequestValue() == null ) )
         {
             return false;
         }
 
-        if ( ( payload == null ) && ( req.getPayload() != null ) )
+        if ( ( requestValue == null ) && ( req.getRequestValue() != null ) )
         {
             return false;
         }
 
-        if ( ( payload != null ) && ( req.getPayload() != null ) && !Arrays.equals( payload, req.getPayload() ) )
+        if ( ( requestValue != null ) && ( req.getRequestValue() != null )
+            && !Arrays.equals( requestValue, req.getRequestValue() ) )
         {
             return false;
         }
@@ -249,42 +248,87 @@ public class ExtendedRequestImpl extends
 
 
     /**
-     * Get a String representation of an Extended Request
+     * Gets the Object Idendifier corresponding to the extended request type.
+     * This is the <b>requestName</b> portion of the ext. req. PDU.
      * 
-     * @return an Extended Request String
+     * @return the dotted-decimal representation as a String of the OID
      */
-    public String toString()
+    public String getRequestName()
     {
-        StringBuffer sb = new StringBuffer();
+        return oid;
+    }
 
-        sb.append( "    Extended request\n" );
-        sb.append( "        Request name : '" ).append( oid ).append( "'\n" );
 
-        if ( oid != null )
-        {
-            sb.append( "        Request value : '" ).append( StringTools.utf8ToString( payload ) ).append( '/' )
-                .append( StringTools.dumpBytes( payload ) ).append( "'\n" );
-        }
+    public ExtendedResponse createExtendedResponse( String id, byte[] berValue, int offset, int length )
+        throws NamingException
+    {
+        return null;
+    }
 
-        return sb.toString();
+
+    /**
+     * Stores the encoded length for the ExtendedRequest
+     * 
+     * @param extendedRequestLength The encoded length
+     */
+    /* No qualifier*/void setExtendedRequestLength( int extendedRequestLength )
+    {
+        this.extendedRequestLength = extendedRequestLength;
     }
 
 
-    public String getID()
+    /**
+     * @return The encoded ExtendedRequest's length
+     */
+    /* No qualifier*/int getExtendedRequestLength()
     {
-        return getOid();
+        return extendedRequestLength;
     }
 
 
-    public byte[] getEncodedValue()
+    /**
+     * Gets the requestName bytes.
+     * 
+     * @return the requestName bytes of the extended request type.
+     */
+    /* No qualifier*/byte[] getRequestNameBytes()
     {
-        return getPayload();
+        return requestNameBytes;
     }
 
 
-    public ExtendedResponse createExtendedResponse( String id, byte[] berValue, int offset, int length )
-        throws NamingException
+    /**
+     * Sets the requestName bytes.
+     * 
+     * @param requestNameBytes the OID bytes of the extended request type.
+     */
+    /* No qualifier*/void setRequestNameBytes( byte[] requestNameBytes )
     {
-        return null;
+        this.requestNameBytes = requestNameBytes;
+    }
+
+
+    /**
+     * Get a String representation of an Extended Request
+     * 
+     * @return an Extended Request String
+     */
+    public String toString()
+    {
+        StringBuffer sb = new StringBuffer();
+
+        sb.append( "    Extended request\n" );
+        sb.append( "        Request name : '" ).append( oid ).append( "'\n" );
+
+        if ( oid != null )
+        {
+            sb.append( "        Request value : '" ).append( StringTools.utf8ToString( requestValue ) ).append( '/' )
+                .append( StringTools.dumpBytes( requestValue ) ).append( "'\n" );
+        }
+
+        // The controls
+        sb.append( super.toString() );
+
+        return sb.toString();
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ExtendedResponseImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ExtendedResponseImpl.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ExtendedResponseImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ExtendedResponseImpl.java Fri Aug 20 19:23:27 2010
@@ -22,24 +22,29 @@ package org.apache.directory.shared.ldap
 
 import java.util.Arrays;
 
-import org.apache.directory.shared.ldap.message.internal.InternalAbstractResultResponse;
-import org.apache.directory.shared.ldap.message.internal.InternalExtendedResponse;
+import org.apache.directory.shared.ldap.util.StringTools;
 
 
 /**
- * Lockable ExtendedResponse implementation
+ * ExtendedResponse implementation
  * 
  * @author <a href="mailto:dev@directory.apache.org"> Apache Directory Project</a>
  */
-public class ExtendedResponseImpl extends InternalAbstractResultResponse implements InternalExtendedResponse
+public class ExtendedResponseImpl extends AbstractResultResponse implements ExtendedResponse
 {
     static final long serialVersionUID = -6646752766410531060L;
 
     /** Object identifier for the extended response */
-    protected String oid;
+    protected String responseName;
 
-    /** Values encoded in the extended response payload */
-    protected byte[] value;
+    /** The response name as a byte[] */
+    private byte[] responseNameBytes;
+
+    /** Value encoded in the extended response payload */
+    protected byte[] responseValue;
+
+    /** The encoded extendedResponse length */
+    private int extendedResponseLength;
 
 
     // ------------------------------------------------------------------------
@@ -47,94 +52,94 @@ public class ExtendedResponseImpl extend
     // ------------------------------------------------------------------------
 
     /**
-     * Creates a Lockable ExtendedResponse as a reply to an ExtendedRequest.
+     * Creates an ExtendedResponse as a reply to an ExtendedRequest.
      * 
-     * @param id
-     *            the session unique message id
+     * @param responseName the ExtendedResponse's name
      */
-    public ExtendedResponseImpl( final int id, String oid )
+    public ExtendedResponseImpl( String responseName )
     {
-        super( id, TYPE );
-        this.oid = oid;
+        super( -1, TYPE );
+        this.responseName = responseName;
     }
 
 
-    public ExtendedResponseImpl( int id )
+    /**
+     * Creates an ExtendedResponse as a reply to an ExtendedRequest.
+     * 
+     * @param id the session unique message id
+     * @param responseName the ExtendedResponse's name
+     */
+    public ExtendedResponseImpl( final int id, String responseName )
     {
         super( id, TYPE );
+        this.responseName = responseName;
     }
 
 
-    // ------------------------------------------------------------------------
-    // ExtendedResponse Interface Method Implementations
-    // ------------------------------------------------------------------------
-
     /**
-     * Gets the reponse OID specific encoded response values.
+     * Creates an ExtendedResponse as a reply to an ExtendedRequest.
      * 
-     * @return the response specific encoded response values.
+     * @param id the session unique message id
      */
-    public byte[] getResponse()
+    public ExtendedResponseImpl( int id )
     {
-        if ( value == null )
-        {
-            return null;
-        }
-
-        final byte[] copy = new byte[value.length];
-        System.arraycopy( value, 0, copy, 0, value.length );
-        return copy;
+        super( id, TYPE );
     }
 
 
+    // ------------------------------------------------------------------------
+    // ExtendedResponse Interface Method Implementations
+    // ------------------------------------------------------------------------
     /**
-     * Sets the response OID specific encoded response values.
+     * Sets the response OID specific encoded response value.
      * 
-     * @param value
-     *            the response specific encoded response values.
+     * @param responseValue the response specific encoded response values.
      */
-    public void setResponse( byte[] value )
+    public void setResponseValue( byte[] responseValue )
     {
-        if ( value != null )
+        if ( responseValue != null )
         {
-            this.value = new byte[value.length];
-            System.arraycopy( value, 0, this.value, 0, value.length );
+            this.responseValue = new byte[responseValue.length];
+            System.arraycopy( responseValue, 0, this.responseValue, 0, responseValue.length );
         }
         else
         {
-            this.value = null;
+            this.responseValue = null;
         }
     }
 
 
-    public void setOid( String oid )
+    /**
+     * Sets the OID uniquely identifying this extended response (a.k.a. its
+     * name).
+     * 
+     * @param responseName the OID of the extended response type.
+     */
+    public void setResponseName( String responseName )
     {
-        this.oid = oid;
+        this.responseName = responseName;
     }
 
 
     /**
-     * Gets the OID uniquely identifying this extended response (a.k.a. its
-     * name).
+     * Gets the responseName bytes.
      * 
-     * @return the OID of the extended response type.
+     * @return the responseName bytes of the extended response type.
      */
-    public String getResponseName()
+    /* No qualifier*/byte[] getResponseNameBytes()
     {
-        return oid;
+        return responseNameBytes;
     }
 
 
     /**
-     * Sets the OID uniquely identifying this extended response (a.k.a. its
-     * name).
+     * Sets the OID bytes.
      * 
-     * @param oid
-     *            the OID of the extended response type.
+     * @param oidBytes the OID bytes of the extended response type.
      */
-    public void setResponseName( String oid )
+    /* No qualifier*/void setResponseNameBytes( byte[] responseNameBytes )
     {
-        this.oid = oid;
+        this.responseNameBytes = responseNameBytes;
     }
 
 
@@ -145,14 +150,17 @@ public class ExtendedResponseImpl extend
     public int hashCode()
     {
         int hash = 37;
-        if ( oid != null )
+
+        if ( responseName != null )
         {
-            hash = hash * 17 + oid.hashCode();
+            hash = hash * 17 + responseName.hashCode();
         }
-        if ( value != null )
+
+        if ( responseValue != null )
         {
-            hash = hash * 17 + Arrays.hashCode( value );
+            hash = hash * 17 + Arrays.hashCode( responseValue );
         }
+
         hash = hash * 17 + super.hashCode();
 
         return hash;
@@ -178,39 +186,41 @@ public class ExtendedResponseImpl extend
             return false;
         }
 
-        if ( !( obj instanceof InternalExtendedResponse ) )
+        if ( !( obj instanceof ExtendedResponse ) )
         {
             return false;
         }
 
-        InternalExtendedResponse resp = ( InternalExtendedResponse ) obj;
+        ExtendedResponse resp = ( ExtendedResponse ) obj;
 
-        if ( oid != null && resp.getResponseName() == null )
+        if ( ( responseName != null ) && ( resp.getResponseName() == null ) )
         {
             return false;
         }
 
-        if ( oid == null && resp.getResponseName() != null )
+        if ( ( responseName == null ) && ( resp.getResponseName() != null ) )
         {
             return false;
         }
 
-        if ( oid != null && resp.getResponseName() != null && !oid.equals( resp.getResponseName() ) )
+        if ( ( responseName != null ) && ( resp.getResponseName() != null )
+            && !responseName.equals( resp.getResponseName() ) )
         {
             return false;
         }
 
-        if ( value != null && resp.getResponse() == null )
+        if ( ( responseValue != null ) && ( resp.getResponseValue() == null ) )
         {
             return false;
         }
 
-        if ( value == null && resp.getResponse() != null )
+        if ( ( responseValue == null ) && ( resp.getResponseValue() != null ) )
         {
             return false;
         }
 
-        if ( value != null && resp.getResponse() != null && !Arrays.equals( value, resp.getResponse() ) )
+        if ( ( responseValue != null ) && ( resp.getResponseValue() != null )
+            && !Arrays.equals( responseValue, resp.getResponseValue() ) )
         {
             return false;
         }
@@ -219,14 +229,99 @@ public class ExtendedResponseImpl extend
     }
 
 
+    /**
+     * Gets the OID uniquely identifying this extended response (a.k.a. its
+     * name).
+     * 
+     * @return the responseName of the extended response
+     */
+    public String getResponseName()
+    {
+        return ( ( responseName == null ) ? "" : responseName.toString() );
+    }
+
+
+    /**
+     * Gets the response OID specific encoded response values.
+     * 
+     * @return the response specific encoded response value
+     */
+    public byte[] getResponseValue()
+    {
+        if ( responseValue == null )
+        {
+            return null;
+        }
+
+        final byte[] copy = new byte[responseValue.length];
+        System.arraycopy( responseValue, 0, copy, 0, responseValue.length );
+        return copy;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * @deprecated Use the {@link #getResponseValue()} method
+     */
+    public byte[] getEncodedValue()
+    {
+        return getResponseValue();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * @deprecated Use the {@link #getResponseName()} method
+     */
     public String getID()
     {
         return getResponseName();
     }
 
 
-    public byte[] getEncodedValue()
+    /**
+     * Stores the encoded length for the ExtendedResponse
+     * 
+     * @param extendedResponseLength The encoded length
+     */
+    /* No qualifier*/void setExtendedResponseLength( int extendedResponseLength )
+    {
+        this.extendedResponseLength = extendedResponseLength;
+    }
+
+
+    /**
+     * @return The encoded ExtendedResponse's length
+     */
+    /* No qualifier*/int getExtendedResponseLength()
     {
-        return getResponse();
+        return extendedResponseLength;
+    }
+
+
+    /**
+     * Get a String representation of an ExtendedResponse
+     * 
+     * @return An ExtendedResponse String
+     */
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append( "    Extended Response\n" );
+
+        if ( responseName != null )
+        {
+            sb.append( "        ResponseName :'" ).append( responseName ).append( "'\n" );
+        }
+
+        if ( responseValue != null )
+        {
+            sb.append( "        ResponseValue :'" ).append( StringTools.dumpBytes( responseValue ) ).append( "'\n" );
+        }
+
+        sb.append( super.toString() );
+
+        return sb.toString();
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/IntermediateResponseImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/IntermediateResponseImpl.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/IntermediateResponseImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/IntermediateResponseImpl.java Fri Aug 20 19:23:27 2010
@@ -22,8 +22,7 @@ package org.apache.directory.shared.ldap
 
 import java.util.Arrays;
 
-import org.apache.directory.shared.ldap.message.internal.InternalAbstractResultResponse;
-import org.apache.directory.shared.ldap.message.internal.InternalIntermediateResponse;
+import org.apache.directory.shared.ldap.util.StringTools;
 
 
 /**
@@ -31,15 +30,21 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org"> Apache Directory Project</a>
  */
-public class IntermediateResponseImpl extends InternalAbstractResultResponse implements InternalIntermediateResponse
+public class IntermediateResponseImpl extends AbstractResultResponse implements IntermediateResponse
 {
     static final long serialVersionUID = -6646752766410531060L;
 
     /** ResponseName for the intermediate response */
-    protected String oid;
+    protected String responseName;
+
+    /** The response name as a byte[] */
+    private byte[] responseNameBytes;
 
     /** Response Value for the intermediate response */
-    protected byte[] value;
+    protected byte[] responseValue;
+
+    /** The encoded intermediateResponse length */
+    private int intermediateResponseLength;
 
 
     // ------------------------------------------------------------------------
@@ -62,13 +67,13 @@ public class IntermediateResponseImpl ex
      */
     public byte[] getResponseValue()
     {
-        if ( value == null )
+        if ( responseValue == null )
         {
             return null;
         }
 
-        final byte[] copy = new byte[value.length];
-        System.arraycopy( value, 0, copy, 0, value.length );
+        final byte[] copy = new byte[responseValue.length];
+        System.arraycopy( responseValue, 0, copy, 0, responseValue.length );
         return copy;
     }
 
@@ -82,37 +87,59 @@ public class IntermediateResponseImpl ex
     {
         if ( value != null )
         {
-            this.value = new byte[value.length];
-            System.arraycopy( value, 0, this.value, 0, value.length );
+            this.responseValue = new byte[value.length];
+            System.arraycopy( value, 0, this.responseValue, 0, value.length );
         }
         else
         {
-            this.value = null;
+            this.responseValue = null;
         }
     }
 
 
     /**
-     * Gets the OID uniquely identifying this Intemediate response (a.k.a. its
+     * Gets the OID uniquely identifying this Intermediate response (a.k.a. its
      * name).
      * 
-     * @return the OID of the Intemediate response type.
+     * @return the OID of the Intermediate response type.
      */
     public String getResponseName()
     {
-        return oid;
+        return ( ( responseName == null ) ? "" : responseName );
+    }
+
+
+    /**
+     * Gets the ResponseName bytes
+     * 
+     * @return the ResponseName bytes of the Intermediate response type.
+     */
+    /* No qualifier */byte[] getResponseNameBytes()
+    {
+        return responseNameBytes;
     }
 
 
     /**
-     * Sets the OID uniquely identifying this Intemediate response (a.k.a. its
+     * Sets the OID uniquely identifying this Intermediate response (a.k.a. its
      * name).
      * 
-     * @param oid the OID of the Intemediate response type.
+     * @param oid the OID of the Intermediate response type.
      */
     public void setResponseName( String oid )
     {
-        this.oid = oid;
+        this.responseName = oid;
+    }
+
+
+    /**
+     * Sets the ResponseName bytes
+     * 
+     * @param oid the ResponseName bytes of the Intermediate response type.
+     */
+    /* No qualifier */void setResponseNameBytes( byte[] responseNameBytes )
+    {
+        this.responseNameBytes = responseNameBytes;
     }
 
 
@@ -123,13 +150,13 @@ public class IntermediateResponseImpl ex
     public int hashCode()
     {
         int hash = 37;
-        if ( oid != null )
+        if ( responseName != null )
         {
-            hash = hash * 17 + oid.hashCode();
+            hash = hash * 17 + responseName.hashCode();
         }
-        if ( value != null )
+        if ( responseValue != null )
         {
-            hash = hash * 17 + Arrays.hashCode( value );
+            hash = hash * 17 + Arrays.hashCode( responseValue );
         }
         hash = hash * 17 + super.hashCode();
 
@@ -155,44 +182,94 @@ public class IntermediateResponseImpl ex
             return false;
         }
 
-        if ( !( obj instanceof InternalIntermediateResponse ) )
+        if ( !( obj instanceof IntermediateResponse ) )
         {
             return false;
         }
 
-        InternalIntermediateResponse resp = ( InternalIntermediateResponse ) obj;
+        IntermediateResponse resp = ( IntermediateResponse ) obj;
 
-        if ( ( oid != null ) && ( resp.getResponseName() == null ) )
+        if ( ( responseName != null ) && ( resp.getResponseName() == null ) )
         {
             return false;
         }
 
-        if ( ( oid == null ) && ( resp.getResponseName() != null ) )
+        if ( ( responseName == null ) && ( resp.getResponseName() != null ) )
         {
             return false;
         }
 
-        if ( ( oid != null ) && ( resp.getResponseName() != null ) && !oid.equals( resp.getResponseName() ) )
+        if ( ( responseName != null ) && ( resp.getResponseName() != null )
+            && !responseName.equals( resp.getResponseName() ) )
         {
             return false;
         }
 
-        if ( ( value != null ) && ( resp.getResponseValue() == null ) )
+        if ( ( responseValue != null ) && ( resp.getResponseValue() == null ) )
         {
             return false;
         }
 
-        if ( ( value == null ) && ( resp.getResponseValue() != null ) )
+        if ( ( responseValue == null ) && ( resp.getResponseValue() != null ) )
         {
             return false;
         }
 
-        if ( ( value != null ) && ( resp.getResponseValue() != null )
-            && !Arrays.equals( value, resp.getResponseValue() ) )
+        if ( ( responseValue != null ) && ( resp.getResponseValue() != null )
+            && !Arrays.equals( responseValue, resp.getResponseValue() ) )
         {
             return false;
         }
 
         return true;
     }
+
+
+    /**
+     * Stores the encoded length for the IntermediateResponse
+     * 
+     * @param intermediateResponseLength The encoded length
+     */
+    /* No qualifier*/void setIntermediateResponseLength( int intermediateResponseLength )
+    {
+        this.intermediateResponseLength = intermediateResponseLength;
+    }
+
+
+    /**
+     * @return The encoded IntermediateResponse's length
+     */
+    /* No qualifier*/int getIntermediateResponseLength()
+    {
+        return intermediateResponseLength;
+    }
+
+
+    /**
+     * Get a String representation of an IntermediateResponse
+     * 
+     * @return An IntermediateResponse String
+     */
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append( "    Intermediate Response\n" );
+
+        if ( responseName != null )
+        {
+            sb.append( "        Response name :'" ).append( responseName ).append( "'\n" );
+        }
+
+        if ( responseValue != null )
+        {
+            sb.append( "        ResponseValue :'" );
+            sb.append( StringTools.dumpBytes( responseValue ) );
+            sb.append( "'\n" );
+        }
+
+        sb.append( super.toString() );
+
+        return sb.toString();
+    }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapResultImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapResultImpl.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapResultImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapResultImpl.java Fri Aug 20 19:23:27 2010
@@ -21,8 +21,6 @@
 package org.apache.directory.shared.ldap.message;
 
 
-import org.apache.directory.shared.ldap.message.internal.InternalLdapResult;
-import org.apache.directory.shared.ldap.message.internal.InternalReferral;
 import org.apache.directory.shared.ldap.name.DN;
 
 
@@ -31,19 +29,25 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class LdapResultImpl implements InternalLdapResult
+public class LdapResultImpl implements LdapResult
 {
     static final long serialVersionUID = -1446626887394613213L;
 
     /** Lowest matched entry Dn - defaults to empty string */
     private DN matchedDn;
 
+    /** Temporary storage of the byte[] representing the matchedDN */
+    private byte[] matchedDNBytes;
+
     /** Referral associated with this LdapResult if the errorCode is REFERRAL */
-    private InternalReferral referral;
+    private Referral referral;
 
     /** Decriptive error message - defaults to empty string */
     private String errorMessage;
 
+    /** Temporary storage for message bytes */
+    private byte[] errorMessageBytes;
+
     /** Resultant operation error code - defaults to SUCCESS */
     private ResultCodeEnum resultCode = ResultCodeEnum.SUCCESS;
 
@@ -51,7 +55,6 @@ public class LdapResultImpl implements I
     // ------------------------------------------------------------------------
     // LdapResult Interface Method Implementations
     // ------------------------------------------------------------------------
-
     /**
      * Gets the descriptive error message associated with the error code. May be
      * null for SUCCESS, COMPARETRUE, COMPAREFALSE and REFERRAL operations.
@@ -65,6 +68,15 @@ public class LdapResultImpl implements I
 
 
     /**
+     * @return The encoded Error message
+     */
+    /*No qualifier*/byte[] getErrorMessageBytes()
+    {
+        return errorMessageBytes;
+    }
+
+
+    /**
      * Sets the descriptive error message associated with the error code. May be
      * null for SUCCESS, COMPARETRUE, and COMPAREFALSE operations.
      * 
@@ -78,6 +90,16 @@ public class LdapResultImpl implements I
 
 
     /**
+     * Set the encoded message's bytes
+     * @param errorMessageBytes The encoded bytes
+     */
+    /*No qualifier*/void setErrorMessageBytes( byte[] errorMessageBytes )
+    {
+        this.errorMessageBytes = errorMessageBytes;
+    }
+
+
+    /**
      * Gets the lowest entry in the directory that was matched. For result codes
      * of noSuchObject, aliasProblem, invalidDNSyntax and
      * aliasDereferencingProblem, the matchedDN field is set to the name of the
@@ -97,11 +119,19 @@ public class LdapResultImpl implements I
 
 
     /**
+     * @return the encoded MatchedDN
+     */
+    /*No qualifier*/byte[] getMatchedDnBytes()
+    {
+        return matchedDNBytes;
+    }
+
+
+    /**
      * Sets the lowest entry in the directory that was matched.
      * 
      * @see #getMatchedDn()
-     * @param matchedDn
-     *            the Dn of the lowest matched entry.
+     * @param matchedDn the Dn of the lowest matched entry.
      */
     public void setMatchedDn( DN matchedDn )
     {
@@ -110,6 +140,17 @@ public class LdapResultImpl implements I
 
 
     /**
+     * Sets the encoded value for MatchedDn
+     * 
+     * @param matchedDNBytes The encoded MatchedDN
+     */
+    /*No qualifier*/void setMatchedDnBytes( byte[] matchedDNBytes )
+    {
+        this.matchedDNBytes = matchedDNBytes;
+    }
+
+
+    /**
      * Gets the result code enumeration associated with the response.
      * Corresponds to the <b> resultCode </b> field within the LDAPResult ASN.1
      * structure.
@@ -142,7 +183,7 @@ public class LdapResultImpl implements I
      * 
      * @return the referral on REFERRAL errors, null on all others.
      */
-    public InternalReferral getReferral()
+    public Referral getReferral()
     {
         return referral;
     }
@@ -169,7 +210,7 @@ public class LdapResultImpl implements I
      * @param referral
      *            optional referral on REFERRAL errors.
      */
-    public void setReferral( InternalReferral referral )
+    public void setReferral( Referral referral )
     {
         this.referral = referral;
     }
@@ -213,13 +254,13 @@ public class LdapResultImpl implements I
         }
 
         // return false if object does not implement interface
-        if ( !( obj instanceof InternalLdapResult ) )
+        if ( !( obj instanceof LdapResult ) )
         {
             return false;
         }
 
         // compare all the like elements of the two LdapResult objects
-        InternalLdapResult result = ( InternalLdapResult ) obj;
+        LdapResult result = ( LdapResult ) obj;
 
         if ( referral == null && result.getReferral() != null )
         {
@@ -283,8 +324,7 @@ public class LdapResultImpl implements I
      */
     public String toString()
     {
-
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
 
         sb.append( "        Ldap Result\n" );
         sb.append( "            Result code : (" ).append( resultCode ).append( ')' );

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ManyReplyRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ManyReplyRequest.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ManyReplyRequest.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ManyReplyRequest.java Fri Aug 20 19:23:27 2010
@@ -20,7 +20,6 @@
 package org.apache.directory.shared.ldap.message;
 
 import org.apache.directory.shared.ldap.codec.MessageTypeEnum;
-import org.apache.directory.shared.ldap.message.internal.InternalResultResponseRequest;
 
 
 /**
@@ -29,7 +28,7 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org"> Apache Directory Project</a>
  */
-public interface ManyReplyRequest extends InternalResultResponseRequest
+public interface ManyReplyRequest extends ResultResponseRequest
 {
     /**
      * Gets the various types of messages that can be generated by this kind of

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/MessageDecoder.java Fri Aug 20 19:23:27 2010
@@ -20,20 +20,19 @@
 package org.apache.directory.shared.ldap.message;
 
 
+import java.io.InputStream;
+import java.util.Hashtable;
+
 import org.apache.directory.shared.asn1.Asn1Object;
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.asn1.codec.stateful.DecoderCallback;
-import org.apache.directory.shared.asn1.codec.stateful.DecoderMonitor;
 import org.apache.directory.shared.asn1.codec.stateful.StatefulDecoder;
-import org.apache.directory.shared.ldap.codec.ResponseCarryingException;
 import org.apache.directory.shared.ldap.codec.LdapTransformer;
+import org.apache.directory.shared.ldap.codec.ResponseCarryingException;
 import org.apache.directory.shared.ldap.message.spi.BinaryAttributeDetector;
 import org.apache.directory.shared.ldap.message.spi.Provider;
 import org.apache.directory.shared.ldap.message.spi.ProviderDecoder;
 
-import java.io.InputStream;
-import java.util.Hashtable;
-
 
 /**
  * Decodes a BER encoded LDAPv3 message envelope from an input stream
@@ -64,8 +63,8 @@ public final class MessageDecoder implem
     {
         this( binaryAttributeDetector, Integer.MAX_VALUE );
     }
-    
-    
+
+
     /**
      * Creates a MessageDecoder using default properties for enabling a BER
      * library provider.
@@ -78,7 +77,7 @@ public final class MessageDecoder implem
     {
         // We need to get the encoder class name
         Hashtable<Object, Object> providerEnv = Provider.getEnvironment();
-        
+
         this.provider = Provider.getProvider( providerEnv );
         this.decoder = this.provider.getDecoder( binaryAttributeDetector, maxPDUSize );
         this.decoder.setCallback( new DecoderCallback()
@@ -102,13 +101,10 @@ public final class MessageDecoder implem
      * Reads and decodes a BER encoded LDAPv3 ASN.1 message envelope structure
      * from an input stream to build a fully populated Message object instance.
      * 
-     * @param lock
-     *            lock object used to exclusively read from the input stream
-     * @param in
-     *            the input stream to read PDU data from.
+     * @param lock lock object used to exclusively read from the input stream
+     * @param in the input stream to read PDU data from.
      * @return the populated Message representing the PDU envelope.
-     * @throws MessageException
-     *             if there is a problem decoding.
+     * @throws MessageException if there is a problem decoding.
      */
     public Object decode( final Object lock, final InputStream in ) throws MessageException
     {
@@ -119,7 +115,7 @@ public final class MessageDecoder implem
             if ( lock == null )
             {
                 // Complain here somehow first then do the following w/o synch!
-    
+
                 // Call provider decoder to demarshall PDU into berlib specific form
                 providerEnvelope = decoder.decode( lock, in );
             }
@@ -147,10 +143,8 @@ public final class MessageDecoder implem
      * Decodes a chunk of stream data returning any resultant decoded PDU via a
      * callback.
      * 
-     * @param chunk
-     *            the chunk to decode
-     * @throws MessageException
-     *             if there are failures while decoding the chunk
+     * @param chunk the chunk to decode
+     * @throws MessageException if there are failures while decoding the chunk
      */
     public void decode( Object chunk ) throws MessageException
     {
@@ -161,11 +155,11 @@ public final class MessageDecoder implem
         catch ( DecoderException e )
         {
             // transform the DecoderException message to a MessageException
-            if ( e instanceof ResponseCarryingException ) 
+            if ( e instanceof ResponseCarryingException )
             {
                 ResponseCarryingMessageException rcme = new ResponseCarryingMessageException( e.getMessage() );
-                rcme.setResponse( ((ResponseCarryingException)e).getResponse() );
-                
+                rcme.setResponse( ( ( ResponseCarryingException ) e ).getResponse() );
+
                 throw rcme;
             }
             else
@@ -180,8 +174,7 @@ public final class MessageDecoder implem
     /**
      * Sets the callback used to deliver completly decoded PDU's.
      * 
-     * @param cb
-     *            the callback to use for decoded PDU delivery
+     * @param cb the callback to use for decoded PDU delivery
      */
     public void setCallback( DecoderCallback cb )
     {
@@ -190,18 +183,17 @@ public final class MessageDecoder implem
 
 
     /**
-     * Sets the monitor for this MessageDecoder which receives callbacks for
-     * noteworthy events during decoding.
-     * 
-     * @param monitor
-     *            the monitor to receive notifications via callback events
+     * {@inheritDoc}
      */
-    public void setDecoderMonitor( DecoderMonitor monitor )
+    public DecoderCallback getCallback()
     {
-        decoder.setDecoderMonitor( monitor );
+        return cb;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public Provider getProvider()
     {
         return this.provider;

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyDnRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyDnRequestImpl.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyDnRequestImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyDnRequestImpl.java Fri Aug 20 19:23:27 2010
@@ -21,19 +21,16 @@ package org.apache.directory.shared.ldap
 
 
 import org.apache.directory.shared.ldap.codec.MessageTypeEnum;
-import org.apache.directory.shared.ldap.message.internal.InternalModifyDnRequest;
-import org.apache.directory.shared.ldap.message.internal.InternalModifyDnResponse;
-import org.apache.directory.shared.ldap.message.internal.InternalResultResponse;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.name.RDN;
 
 
 /**
- * Lockable ModifyDNRequest implementation.
+ * ModifyDNRequest implementation.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class ModifyDnRequestImpl extends AbstractAbandonableRequest implements InternalModifyDnRequest
+public class ModifyDnRequestImpl extends AbstractAbandonableRequest implements ModifyDnRequest
 {
     static final long serialVersionUID = 1233507339633051696L;
 
@@ -49,19 +46,31 @@ public class ModifyDnRequestImpl extends
     /** PDU's <b>deleteOldRdn</b> flag */
     private boolean deleteOldRdn = false;
 
-    private InternalModifyDnResponse response;
+    /** The associated response */
+    private ModifyDnResponse response;
+
+    /** The modify DN request length */
+    private int modifyDnRequestLength;
 
 
     // -----------------------------------------------------------------------
     // Constructors
     // -----------------------------------------------------------------------
+    /**
+     * Creates a ModifyDnRequest implementing object used to perform a
+     * dn change on an entry potentially resulting in an entry move.
+     */
+    public ModifyDnRequestImpl()
+    {
+        super( -1, TYPE );
+    }
+
 
     /**
      * Creates a Lockable ModifyDnRequest implementing object used to perform a
      * dn change on an entry potentially resulting in an entry move.
      * 
-     * @param id
-     *            the seq id of this message
+     * @param id the sequence id of this message
      */
     public ModifyDnRequestImpl( final int id )
     {
@@ -76,7 +85,7 @@ public class ModifyDnRequestImpl extends
     /**
      * Gets the flag which determines if the old Rdn attribute is to be removed
      * from the entry when the new Rdn is used in its stead. This property
-     * corresponds to the <b>deleteoldrdn
+     * corresponds to the <b>deleteoldrdn</b>
      * </p>
      * PDU field.
      * 
@@ -91,12 +100,11 @@ public class ModifyDnRequestImpl extends
     /**
      * Sets the flag which determines if the old Rdn attribute is to be removed
      * from the entry when the new Rdn is used in its stead. This property
-     * corresponds to the <b>deleteoldrdn
+     * corresponds to the <b>deleteoldrdn</b>
      * </p>
      * PDU field.
      * 
-     * @param deleteOldRdn
-     *            true if the old rdn is to be deleted, false if it is not
+     * @param deleteOldRdn true if the old rdn is to be deleted, false if it is not
      */
     public void setDeleteOldRdn( boolean deleteOldRdn )
     {
@@ -159,8 +167,7 @@ public class ModifyDnRequestImpl extends
      * Sets the new relative distinguished name for the entry which represents
      * the PDU's <b>newrdn</b> field.
      * 
-     * @param newRdn
-     *            the relative dn with one component
+     * @param newRdn the relative dn with one component
      */
     public void setNewRdn( RDN newRdn )
     {
@@ -189,8 +196,7 @@ public class ModifyDnRequestImpl extends
      * rather than a move operation. Setting this property to a non-null value
      * toggles the move flag obtained via the <code>isMove</code> method.
      * 
-     * @param newSuperior
-     *            the dn of the superior entry the candidate entry for DN
+     * @param newSuperior the dn of the superior entry the candidate entry for DN
      *            modification is moved under.
      */
     public void setNewSuperior( DN newSuperior )
@@ -220,7 +226,7 @@ public class ModifyDnRequestImpl extends
      * 
      * @return the result containing response for this request
      */
-    public InternalResultResponse getResultResponse()
+    public ResultResponse getResultResponse()
     {
         if ( response == null )
         {
@@ -232,6 +238,25 @@ public class ModifyDnRequestImpl extends
 
 
     /**
+     * @return The encoded ModifyDnRequest's length
+     */
+    /* No Qualifier*/void setModifyDnRequestLength( int modifyDnRequestLength )
+    {
+        this.modifyDnRequestLength = modifyDnRequestLength;
+    }
+
+
+    /**
+     * Stores the encoded length for the ModifyDnRequest
+     * @param modifyDnRequestLength The encoded length
+     */
+    /* No Qualifier*/int getModifyDnResponseLength()
+    {
+        return modifyDnRequestLength;
+    }
+
+
+    /**
      * {@inheritDoc}
      */
     @Override
@@ -262,8 +287,7 @@ public class ModifyDnRequestImpl extends
      * Checks to see of an object equals this ModifyDnRequest stub. The equality
      * presumes all ModifyDnRequest specific properties are the same.
      * 
-     * @param obj
-     *            the object to compare with this stub
+     * @param obj the object to compare with this stub
      * @return true if the obj is equal to this stub, false otherwise
      */
     public boolean equals( Object obj )
@@ -278,7 +302,7 @@ public class ModifyDnRequestImpl extends
             return false;
         }
 
-        InternalModifyDnRequest req = ( InternalModifyDnRequest ) obj;
+        ModifyDnRequest req = ( ModifyDnRequest ) obj;
 
         if ( name != null && req.getName() == null )
         {
@@ -357,6 +381,9 @@ public class ModifyDnRequestImpl extends
             sb.append( "        New superior : '" ).append( newSuperior.toString() ).append( "'\n" );
         }
 
+        // The controls
+        sb.append( super.toString() );
+
         return sb.toString();
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyDnResponseImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyDnResponseImpl.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyDnResponseImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyDnResponseImpl.java Fri Aug 20 19:23:27 2010
@@ -19,17 +19,16 @@
  */
 package org.apache.directory.shared.ldap.message;
 
-import org.apache.directory.shared.ldap.message.internal.InternalAbstractResultResponse;
-import org.apache.directory.shared.ldap.message.internal.InternalModifyDnResponse;
-
 
 /**
- * Lockable ModifyDnResponse implementation
+ * ModifyDnResponse implementation
  * 
  * @author <a href="mailto:dev@directory.apache.org"> Apache Directory Project</a>
  */
-public class ModifyDnResponseImpl extends InternalAbstractResultResponse implements InternalModifyDnResponse
+public class ModifyDnResponseImpl extends AbstractResultResponse implements ModifyDnResponse
 {
+    /** The encoded modifyDnResponse length */
+    private int modifyDnResponseLength;
 
     // ------------------------------------------------------------------------
     // Constructors
@@ -39,13 +38,57 @@ public class ModifyDnResponseImpl extend
 
 
     /**
-     * Creates a Lockable ModifyDnResponse as a reply to an ModifyDnRequest.
+     * Creates a ModifyDnResponse as a reply to an ModifyDnRequest.
+     */
+    public ModifyDnResponseImpl()
+    {
+        super( -1, TYPE );
+    }
+
+
+    /**
+     * Creates a ModifyDnResponse as a reply to an ModifyDnRequest.
      * 
-     * @param id
-     *            the sequence if of this response
+     * @param id the sequence if of this response
      */
-    public ModifyDnResponseImpl(final int id)
+    public ModifyDnResponseImpl( final int id )
     {
         super( id, TYPE );
     }
+
+
+    /**
+     * @return The encoded ModifyDnResponse's length
+     */
+    /* No Qualifier*/void setModifyDnResponseLength( int modifyDnResponseLength )
+    {
+        this.modifyDnResponseLength = modifyDnResponseLength;
+    }
+
+
+    /**
+     * Stores the encoded length for the ModifyDnResponse
+     * @param modifyDnResponseLength The encoded length
+     */
+    /* No Qualifier*/int getModifyDnResponseLength()
+    {
+        return modifyDnResponseLength;
+    }
+
+
+    /**
+     * Get a String representation of a ModifyDNResponse
+     * 
+     * @return A ModifyDNResponse String
+     */
+    public String toString()
+    {
+
+        StringBuilder sb = new StringBuilder();
+
+        sb.append( "    Modify DN Response\n" );
+        sb.append( super.toString() );
+
+        return sb.toString();
+    }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequestImpl.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequestImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyRequestImpl.java Fri Aug 20 19:23:27 2010
@@ -24,15 +24,17 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.List;
 
 import org.apache.directory.shared.ldap.codec.MessageTypeEnum;
+import org.apache.directory.shared.ldap.entry.DefaultEntryAttribute;
 import org.apache.directory.shared.ldap.entry.DefaultModification;
+import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
-import org.apache.directory.shared.ldap.message.internal.InternalModifyRequest;
-import org.apache.directory.shared.ldap.message.internal.InternalModifyResponse;
-import org.apache.directory.shared.ldap.message.internal.InternalResultResponse;
+import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.name.DN;
+import org.apache.directory.shared.ldap.util.StringTools;
 
 
 /**
@@ -40,7 +42,7 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class ModifyRequestImpl extends AbstractAbandonableRequest implements InternalModifyRequest
+public class ModifyRequestImpl extends AbstractAbandonableRequest implements ModifyRequest
 {
     static final long serialVersionUID = -505803669028990304L;
 
@@ -50,7 +52,29 @@ public class ModifyRequestImpl extends A
     /** Sequence of modifications or PDU's <b>modification</b> seqence field */
     private List<Modification> mods = new ArrayList<Modification>();
 
-    private InternalModifyResponse response;
+    /** The associated response */
+    private ModifyResponse response;
+
+    /** The current attribute being decoded */
+    private EntryAttribute currentAttribute;
+
+    /** A local storage for the operation */
+    private ModificationOperation currentOperation;
+
+    /** The modify request length */
+    private int modifyRequestLength;
+
+    /** The changes length */
+    private int changesLength;
+
+    /** The list of all change lengths */
+    private List<Integer> changeLength = new LinkedList<Integer>();
+
+    /** The list of all the modification lengths */
+    private List<Integer> modificationLength = new LinkedList<Integer>();
+
+    /** The list of all the value lengths */
+    private List<Integer> valuesLength = new LinkedList<Integer>();
 
 
     // ------------------------------------------------------------------------
@@ -58,11 +82,20 @@ public class ModifyRequestImpl extends A
     // ------------------------------------------------------------------------
 
     /**
-     * Creates a Lockable ModifyRequest implementing object used to modify the
+     * Creates a ModifyRequest implementing object used to modify the
+     * attributes of an entry.
+     */
+    public ModifyRequestImpl()
+    {
+        super( -1, TYPE );
+    }
+
+
+    /**
+     * Creates a ModifyRequest implementing object used to modify the
      * attributes of an entry.
      * 
-     * @param id
-     *            the sequential message identifier
+     * @param id the sequential message identifier
      */
     public ModifyRequestImpl( final int id )
     {
@@ -79,7 +112,7 @@ public class ModifyRequestImpl extends A
      * 
      * @return an immutable Collection of Modification instances.
      */
-    public Collection<Modification> getModificationItems()
+    public Collection<Modification> getModifications()
     {
         return Collections.unmodifiableCollection( mods );
     }
@@ -101,8 +134,7 @@ public class ModifyRequestImpl extends A
      * Sets the distinguished name of the entry to be modified by this request.
      * This property represents the PDU's <b>object</b> field.
      * 
-     * @param name
-     *            the DN of the modified entry.
+     * @param name the DN of the modified entry.
      */
     public void setName( DN name )
     {
@@ -122,6 +154,161 @@ public class ModifyRequestImpl extends A
     }
 
 
+    private void addModification( ModificationOperation modOp, String attributeName, byte[]... attributeValue )
+    {
+        EntryAttribute attr = new DefaultEntryAttribute( attributeName, attributeValue );
+        addModification( attr, modOp );
+    }
+
+
+    private void addModification( ModificationOperation modOp, String attributeName, String... attributeValue )
+    {
+        EntryAttribute attr = new DefaultEntryAttribute( attributeName, attributeValue );
+        addModification( attr, modOp );
+    }
+
+
+    public void addModification( EntryAttribute attr, ModificationOperation modOp )
+    {
+        mods.add( new DefaultModification( modOp, attr ) );
+    }
+
+
+    /**
+     *
+     * marks a given attribute for addition in the target entry with the
+     * given values.
+     *
+     * @param attributeName name of the attribute to be added
+     * @param attributeValue values of the attribute
+     */
+    public void add( String attributeName, String... attributeValue )
+    {
+        addModification( ModificationOperation.ADD_ATTRIBUTE, attributeName, attributeValue );
+    }
+
+
+    /**
+     * @see #add(String, String...)
+     */
+    public void add( String attributeName, byte[]... attributeValue )
+    {
+        addModification( ModificationOperation.ADD_ATTRIBUTE, attributeName, attributeValue );
+    }
+
+
+    /**
+     *
+     * marks a given attribute for addition in the target entry.
+     *
+     * @param attr the attribute to be added
+     */
+    public void add( EntryAttribute attr )
+    {
+        addModification( attr, ModificationOperation.ADD_ATTRIBUTE );
+    }
+
+
+    /**
+     * @see #replace(String, String...)
+     */
+    public void replace( String attributeName )
+    {
+        addModification( ModificationOperation.REPLACE_ATTRIBUTE, attributeName, StringTools.EMPTY_STRINGS );
+    }
+
+
+    /**
+     *
+     * marks a given attribute for replacement with the given
+     * values in the target entry.
+     *
+     * @param attributeName name of the attribute to be added
+     * @param attributeValue values of the attribute
+     */
+    public void replace( String attributeName, String... attributeValue )
+    {
+        addModification( ModificationOperation.REPLACE_ATTRIBUTE, attributeName, attributeValue );
+    }
+
+
+    /**
+     * @see #replace(String, String...)
+     */
+    public void replace( String attributeName, byte[]... attributeValue )
+    {
+        addModification( ModificationOperation.REPLACE_ATTRIBUTE, attributeName, attributeValue );
+    }
+
+
+    /**
+     *
+     * marks a given attribute for replacement in the target entry.
+     *
+     * @param attr the attribute to be added
+     */
+    public void replace( EntryAttribute attr )
+    {
+        addModification( attr, ModificationOperation.REPLACE_ATTRIBUTE );
+    }
+
+
+    /**
+     * Store the current operation
+     * 
+     * @param currentOperation The currentOperation to set.
+     */
+    public void setCurrentOperation( int currentOperation )
+    {
+        this.currentOperation = ModificationOperation.getOperation( currentOperation );
+    }
+
+
+    /**
+     * Add a new attributeTypeAndValue
+     * 
+     * @param type The attribute's name
+     */
+    public void addAttributeTypeAndValues( String type )
+    {
+        currentAttribute = new DefaultEntryAttribute( type );
+
+        Modification modification = new DefaultModification( currentOperation, currentAttribute );
+        mods.add( modification );
+    }
+
+
+    /**
+     * Return the current attribute's type
+     */
+    public String getCurrentAttributeType()
+    {
+        return currentAttribute.getId();
+    }
+
+
+    /**
+     * Add a new value to the current attribute
+     * 
+     * @param value The value to add
+     */
+    public void addAttributeValue( byte[] value )
+    {
+        currentAttribute.add( value );
+    }
+
+
+    /**
+     * Add a new value to the current attribute
+     * 
+     * @param value The value to add
+     */
+    public void addAttributeValue( String value )
+    {
+        currentAttribute.add( value );
+    }
+
+
     /**
      * Removes a Modification to the set of modifications composing this
      * modify request.
@@ -134,6 +321,39 @@ public class ModifyRequestImpl extends A
     }
 
 
+    /**
+     * marks a given attribute for removal with the given
+     * values from the target entry.
+     *
+     * @param attributeName name of the attribute to be added
+     * @param attributeValue values of the attribute
+     */
+    public void remove( String attributeName, String... attributeValue )
+    {
+        addModification( ModificationOperation.REMOVE_ATTRIBUTE, attributeName, attributeValue );
+    }
+
+
+    /**
+     * @see #remove(String, String...)
+     */
+    public void remove( String attributeName, byte[]... attributeValue )
+    {
+        addModification( ModificationOperation.REMOVE_ATTRIBUTE, attributeName, attributeValue );
+    }
+
+
+    /**
+     * marks a given attribute for removal from the target entry.
+     *
+     * @param attr the attribute to be added
+     */
+    public void remove( EntryAttribute attr )
+    {
+        addModification( attr, ModificationOperation.REMOVE_ATTRIBUTE );
+    }
+
+
     // ------------------------------------------------------------------------
     // SingleReplyRequest Interface Method Implementations
     // ------------------------------------------------------------------------
@@ -155,7 +375,7 @@ public class ModifyRequestImpl extends A
      * 
      * @return the result containing response for this request
      */
-    public InternalResultResponse getResultResponse()
+    public ResultResponse getResultResponse()
     {
         if ( response == null )
         {
@@ -167,6 +387,101 @@ public class ModifyRequestImpl extends A
 
 
     /**
+     * @return The encoded ModifyRequest's length
+     */
+    /* No Qualifier*/void setModifyRequestLength( int modifyRequestLength )
+    {
+        this.modifyRequestLength = modifyRequestLength;
+    }
+
+
+    /**
+     * Stores the encoded length for the ModifyRequest
+     * @param modifyRequestLength The encoded length
+     */
+    /* No Qualifier*/int getModifyRequestLength()
+    {
+        return modifyRequestLength;
+    }
+
+
+    /**
+     * @return The encoded Changes length
+     */
+    /* No Qualifier*/void setChangesLength( int changesLength )
+    {
+        this.changesLength = changesLength;
+    }
+
+
+    /**
+     * Stores the encoded length for the Changes
+     * @param changesLength The encoded length
+     */
+    /* No Qualifier*/int getChangesLength()
+    {
+        return changesLength;
+    }
+
+
+    /**
+     * @return The list of encoded Change length
+     */
+    /* No Qualifier*/void setChangeLength( List<Integer> changeLength )
+    {
+        this.changeLength = changeLength;
+    }
+
+
+    /**
+     * Stores the list of encoded change length
+     * @param changeLength The list of encoded Change length
+     */
+    /* No Qualifier*/List<Integer> getChangeLength()
+    {
+        return changeLength;
+    }
+
+
+    /**
+     * @return The list of encoded Modification length
+     */
+    /* No Qualifier*/void setModificationLength( List<Integer> modificationLength )
+    {
+        this.modificationLength = modificationLength;
+    }
+
+
+    /**
+     * Stores the list of encoded modification length
+     * @param modificationLength The list of encoded Modification length
+     */
+    /* No Qualifier*/List<Integer> getModificationLength()
+    {
+        return modificationLength;
+    }
+
+
+    /**
+     * @return The list of encoded Values length
+     */
+    /* No Qualifier*/void setValuesLength( List<Integer> valuesLength )
+    {
+        this.valuesLength = valuesLength;
+    }
+
+
+    /**
+     * Stores the list of encoded Values length
+     * @param valuesLength The list of encoded Values length
+     */
+    /* No Qualifier*/List<Integer> getValuesLength()
+    {
+        return valuesLength;
+    }
+
+
+    /**
      * {@inheritDoc}
      */
     @Override
@@ -208,7 +523,7 @@ public class ModifyRequestImpl extends A
             return false;
         }
 
-        InternalModifyRequest req = ( InternalModifyRequest ) obj;
+        ModifyRequest req = ( ModifyRequest ) obj;
 
         if ( name != null && req.getName() == null )
         {
@@ -225,12 +540,12 @@ public class ModifyRequestImpl extends A
             return false;
         }
 
-        if ( req.getModificationItems().size() != mods.size() )
+        if ( req.getModifications().size() != mods.size() )
         {
             return false;
         }
 
-        Iterator<Modification> list = req.getModificationItems().iterator();
+        Iterator<Modification> list = req.getModifications().iterator();
 
         for ( int i = 0; i < mods.size(); i++ )
         {
@@ -299,6 +614,9 @@ public class ModifyRequestImpl extends A
             }
         }
 
+        // The controls
+        sb.append( super.toString() );
+
         return sb.toString();
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyResponseImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyResponseImpl.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyResponseImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/ModifyResponseImpl.java Fri Aug 20 19:23:27 2010
@@ -19,16 +19,15 @@
  */
 package org.apache.directory.shared.ldap.message;
 
-import org.apache.directory.shared.ldap.message.internal.InternalAbstractResultResponse;
-import org.apache.directory.shared.ldap.message.internal.InternalModifyResponse;
-
 
 /**
- * Lockable ModifyResponse implementation
+ * ModifyResponse implementation
  * 
  */
-public class ModifyResponseImpl extends InternalAbstractResultResponse implements InternalModifyResponse
+public class ModifyResponseImpl extends AbstractResultResponse implements ModifyResponse
 {
+    /** The encoded modifyResponse length */
+    private int modifyResponseLength;
 
     // ------------------------------------------------------------------------
     // Constructors
@@ -38,13 +37,57 @@ public class ModifyResponseImpl extends 
 
 
     /**
-     * Creates a Lockable ModifyResponse as a reply to an ModifyRequest.
+     * Creates a ModifyResponse as a reply to an ModifyRequest.
+     */
+    public ModifyResponseImpl()
+    {
+        super( -1, TYPE );
+    }
+
+
+    /**
+     * Creates a ModifyResponse as a reply to an ModifyRequest.
      * 
-     * @param id
-     *            the sequence id for this response
+     * @param id the sequence id for this response
      */
-    public ModifyResponseImpl(final int id)
+    public ModifyResponseImpl( final int id )
     {
         super( id, TYPE );
     }
+
+
+    /**
+     * Stores the encoded length for the ModifyResponse
+     * @param modifyResponseLength The encoded length
+     */
+    /*No qualifier*/void setModifyResponseLength( int modifyResponseLength )
+    {
+        this.modifyResponseLength = modifyResponseLength;
+    }
+
+
+    /**
+     * @return The encoded ModifyResponse's length
+     */
+    /*No qualifier*/int getModifyResponseLength()
+    {
+        return modifyResponseLength;
+    }
+
+
+    /**
+     * Get a String representation of a ModifyResponse
+     * 
+     * @return A ModifyResponse String
+     */
+    public String toString()
+    {
+
+        StringBuilder sb = new StringBuilder();
+
+        sb.append( "    Modify Response\n" );
+        sb.append( super.toString() );
+
+        return sb.toString();
+    }
 }



Mime
View raw message