directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r987606 [13/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/codec/actions/InitOrFilterAction.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitOrFilterAction.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitOrFilterAction.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitOrFilterAction.java Fri Aug 20 19:23:27 2010
@@ -28,7 +28,8 @@ import org.apache.directory.shared.i18n.
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.search.Filter;
 import org.apache.directory.shared.ldap.codec.search.OrFilter;
-import org.apache.directory.shared.ldap.codec.search.SearchRequestCodec;
+import org.apache.directory.shared.ldap.message.SearchRequest;
+import org.apache.directory.shared.ldap.message.SearchRequestImpl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -46,11 +47,13 @@ public class InitOrFilterAction extends 
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public InitOrFilterAction()
     {
         super( "Initialize OR filter" );
     }
 
+
     /**
      * The initialization action
      */
@@ -67,14 +70,14 @@ public class InitOrFilterAction extends 
             throw new DecoderException( msg );
         }
 
-        SearchRequestCodec searchRequest = ldapMessageContainer.getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getSearchRequest();
 
         // We can allocate the SearchRequest
         Filter orFilter = new OrFilter( ldapMessageContainer.getTlvId() );
 
         // Set the filter
-        searchRequest.addCurrentFilter( orFilter );
-        
+        ( ( SearchRequestImpl ) searchRequest ).addCurrentFilter( orFilter );
+
         if ( IS_DEBUG )
         {
             log.debug( "Initialize OR filter" );

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitPresentFilterAction.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitPresentFilterAction.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitPresentFilterAction.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitPresentFilterAction.java Fri Aug 20 19:23:27 2010
@@ -26,7 +26,8 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.search.PresentFilter;
-import org.apache.directory.shared.ldap.codec.search.SearchRequestCodec;
+import org.apache.directory.shared.ldap.message.SearchRequest;
+import org.apache.directory.shared.ldap.message.SearchRequestImpl;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -45,15 +46,17 @@ public class InitPresentFilterAction ext
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public InitPresentFilterAction()
     {
         super( "Init present filter Value" );
     }
 
+
     public void action( IAsn1Container container ) throws DecoderException
     {
         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
-        SearchRequestCodec searchRequest = ldapMessageContainer.getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getSearchRequest();
 
         TLV tlv = ldapMessageContainer.getCurrentTLV();
 
@@ -61,8 +64,8 @@ public class InitPresentFilterAction ext
         PresentFilter presentFilter = new PresentFilter( ldapMessageContainer.getTlvId() );
 
         // add the filter to the request filter
-        searchRequest.addCurrentFilter( presentFilter );
-        searchRequest.setTerminalFilter( presentFilter );
+        ( ( SearchRequestImpl ) searchRequest ).addCurrentFilter( presentFilter );
+        ( ( SearchRequestImpl ) searchRequest ).setTerminalFilter( presentFilter );
 
         String value = StringTools.utf8ToString( tlv.getValue().getData() );
 
@@ -79,8 +82,8 @@ public class InitPresentFilterAction ext
 
         // We now have to get back to the nearest filter which is
         // not terminal.
-        searchRequest.unstackFilters( container );
-        
+        ( ( SearchRequestImpl ) searchRequest ).unstackFilters( container );
+
         if ( IS_DEBUG )
         {
             log.debug( "Initialize Present filter" );

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitReferralsAction.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitReferralsAction.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitReferralsAction.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitReferralsAction.java Fri Aug 20 19:23:27 2010
@@ -26,8 +26,10 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
-import org.apache.directory.shared.ldap.codec.LdapResponseCodec;
-import org.apache.directory.shared.ldap.codec.LdapResultCodec;
+import org.apache.directory.shared.ldap.message.LdapResult;
+import org.apache.directory.shared.ldap.message.Referral;
+import org.apache.directory.shared.ldap.message.ReferralImpl;
+import org.apache.directory.shared.ldap.message.ResultResponse;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -45,38 +47,41 @@ public class InitReferralsAction extends
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public InitReferralsAction()
     {
         super( "Init the referrals list" );
     }
 
+
     /**
      * The initialization action
      */
     public void action( IAsn1Container container ) throws DecoderException
     {
         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
-        LdapResponseCodec response = ldapMessageContainer.getLdapResponse();
-        LdapResultCodec ldapResult = response.getLdapResult();
-        
+
         TLV tlv = ldapMessageContainer.getCurrentTLV();
 
         // If we hae a Referrals sequence, then it should not be empty
-        // sasl credentials
         if ( tlv.getLength() == 0 )
         {
             String msg = I18n.err( I18n.ERR_04011 );
             log.error( msg );
-         
+
             // This will generate a PROTOCOL_ERROR
             throw new DecoderException( msg );
         }
 
-        if ( IS_DEBUG)
+        ResultResponse response = ( ResultResponse ) ldapMessageContainer.getMessage();
+        LdapResult ldapResult = response.getLdapResult();
+
+        Referral referral = new ReferralImpl();
+        ldapResult.setReferral( referral );
+
+        if ( IS_DEBUG )
         {
             log.debug( "Initialising a referrals list" );
         }
-        
-        ldapResult.initReferrals();
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitSubstringsFilterAction.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitSubstringsFilterAction.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitSubstringsFilterAction.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitSubstringsFilterAction.java Fri Aug 20 19:23:27 2010
@@ -27,8 +27,9 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.search.Filter;
-import org.apache.directory.shared.ldap.codec.search.SearchRequestCodec;
 import org.apache.directory.shared.ldap.codec.search.SubstringFilter;
+import org.apache.directory.shared.ldap.message.SearchRequest;
+import org.apache.directory.shared.ldap.message.SearchRequestImpl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -46,18 +47,20 @@ public class InitSubstringsFilterAction 
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public InitSubstringsFilterAction()
     {
         super( "Initialize Substrings filter" );
     }
 
+
     /**
      * The initialization action
      */
     public void action( IAsn1Container container ) throws DecoderException
     {
         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
-        SearchRequestCodec searchRequest = ldapMessageContainer.getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getSearchRequest();
 
         TLV tlv = ldapMessageContainer.getCurrentTLV();
 
@@ -73,15 +76,9 @@ public class InitSubstringsFilterAction 
         // We can allocate the SearchRequest
         Filter substringFilter = new SubstringFilter( ldapMessageContainer.getTlvId() );
 
-        searchRequest.addCurrentFilter( substringFilter );
-        searchRequest.setTerminalFilter( substringFilter );
-
-        // As this is a new Constructed object, we have to init its
-        // length
+        ( ( SearchRequestImpl ) searchRequest ).addCurrentFilter( substringFilter );
+        ( ( SearchRequestImpl ) searchRequest ).setTerminalFilter( substringFilter );
 
-        substringFilter.setExpectedLength( expectedLength );
-        substringFilter.setCurrentLength( 0 );
-        
         if ( IS_DEBUG )
         {
             log.debug( "Initialize Substrings filter" );

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/MatchedDNAction.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/MatchedDNAction.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/MatchedDNAction.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/MatchedDNAction.java Fri Aug 20 19:23:27 2010
@@ -26,10 +26,10 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
-import org.apache.directory.shared.ldap.codec.LdapResponseCodec;
-import org.apache.directory.shared.ldap.codec.LdapResultCodec;
 import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
+import org.apache.directory.shared.ldap.message.LdapResult;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.message.ResultResponse;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
@@ -49,72 +49,80 @@ public class MatchedDNAction extends Gra
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public MatchedDNAction()
     {
         super( "Store matched DN" );
     }
 
+
     /**
      * The initialization action
      */
     public void action( IAsn1Container container ) throws DecoderException
     {
         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
-        LdapResponseCodec response = ldapMessageContainer.getLdapResponse();
-        LdapResultCodec ldapResult = response.getLdapResult();
 
         // Get the Value and store it in the BindResponse
         TLV tlv = ldapMessageContainer.getCurrentTLV();
+        DN matchedDN = null;
+        ResultCodeEnum resultCode = null;
+
+        ResultResponse response = ( ResultResponse ) ldapMessageContainer.getMessage();
+        LdapResult ldapResult = response.getLdapResult();
+        resultCode = ldapResult.getResultCode();
 
         // We have to handle the special case of a 0 length matched
         // DN
         if ( tlv.getLength() == 0 )
         {
-            ldapResult.setMatchedDN( DN.EMPTY_DN );
+            matchedDN = DN.EMPTY_DN;
         }
         else
         {
             // A not null matchedDN is valid for resultCodes
             // NoSuchObject, AliasProblem, InvalidDNSyntax and
             // AliasDreferencingProblem.
-            ResultCodeEnum resultCode = ldapResult.getResultCode();
 
             switch ( resultCode )
             {
-                case NO_SUCH_OBJECT :
-                case ALIAS_PROBLEM :
-                case INVALID_DN_SYNTAX :
-                case ALIAS_DEREFERENCING_PROBLEM :
+                case NO_SUCH_OBJECT:
+                case ALIAS_PROBLEM:
+                case INVALID_DN_SYNTAX:
+                case ALIAS_DEREFERENCING_PROBLEM:
                     byte[] dnBytes = tlv.getValue().getData();
                     String dnStr = StringTools.utf8ToString( dnBytes );
-                    
+
                     try
                     {
-                        ldapResult.setMatchedDN( new DN( dnStr ) );
+                        matchedDN = new DN( dnStr );
                     }
                     catch ( LdapInvalidDnException ine )
                     {
                         // This is for the client side. We will never decode LdapResult on the server
-                        String msg = I18n.err( I18n.ERR_04013, dnStr, StringTools.dumpBytes( dnBytes ), ine.getLocalizedMessage() );
+                        String msg = I18n.err( I18n.ERR_04013, dnStr, StringTools.dumpBytes( dnBytes ), ine
+                            .getLocalizedMessage() );
                         log.error( msg );
-                    
+
                         throw new DecoderException( I18n.err( I18n.ERR_04014, ine.getLocalizedMessage() ) );
                     }
-                    
+
                     break;
-                    
-                default :
-                    log.warn( "The matched DN should not be set when the result code is one of NoSuchObject," + 
-                        " AliasProblem, InvalidDNSyntax or AliasDreferencingProblem" );
 
-                    ldapResult.setMatchedDN( DN.EMPTY_DN );
+                default:
+                    log.warn( "The matched DN should not be set when the result code is one of NoSuchObject,"
+                        + " AliasProblem, InvalidDNSyntax or AliasDreferencingProblem" );
+
+                    matchedDN = DN.EMPTY_DN;
                     break;
             }
         }
 
         if ( IS_DEBUG )
         {
-            log.debug( "The matchedDN is " + ldapResult.getMatchedDN() );
+            log.debug( "The matchedDN is " + matchedDN );
         }
+
+        ldapResult.setMatchedDn( matchedDN );
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ModifyAttributeValueAction.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ModifyAttributeValueAction.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ModifyAttributeValueAction.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ModifyAttributeValueAction.java Fri Aug 20 19:23:27 2010
@@ -24,7 +24,8 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
-import org.apache.directory.shared.ldap.codec.modify.ModifyRequestCodec;
+import org.apache.directory.shared.ldap.message.ModifyRequest;
+import org.apache.directory.shared.ldap.message.ModifyRequestImpl;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -43,18 +44,20 @@ public class ModifyAttributeValueAction 
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public ModifyAttributeValueAction()
     {
         super( "Stores AttributeValue" );
     }
 
+
     /**
      * The initialization action
      */
     public void action( IAsn1Container container )
     {
         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
-        ModifyRequestCodec modifyRequest = ldapMessageContainer.getModifyRequest();
+        ModifyRequest modifyRequest = ldapMessageContainer.getModifyRequest();
 
         TLV tlv = ldapMessageContainer.getCurrentTLV();
 
@@ -63,19 +66,20 @@ public class ModifyAttributeValueAction 
 
         if ( tlv.getLength() == 0 )
         {
-            modifyRequest.addAttributeValue( "" );
+            ( ( ModifyRequestImpl ) modifyRequest ).addAttributeValue( "" );
         }
         else
         {
             value = tlv.getValue().getData();
 
-            if ( ldapMessageContainer.isBinary( modifyRequest.getCurrentAttributeType() ) )
+            if ( ldapMessageContainer.isBinary( ( ( ModifyRequestImpl ) modifyRequest ).getCurrentAttributeType() ) )
             {
-                modifyRequest.addAttributeValue( value );
+                ( ( ModifyRequestImpl ) modifyRequest ).addAttributeValue( value );
             }
             else
             {
-                modifyRequest.addAttributeValue( StringTools.utf8ToString( ( byte[] ) value ) );
+                ( ( ModifyRequestImpl ) modifyRequest )
+                    .addAttributeValue( StringTools.utf8ToString( ( byte[] ) value ) );
             }
         }
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ReferralAction.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ReferralAction.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ReferralAction.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ReferralAction.java Fri Aug 20 19:23:27 2010
@@ -26,10 +26,12 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
-import org.apache.directory.shared.ldap.codec.LdapResponseCodec;
-import org.apache.directory.shared.ldap.codec.LdapResultCodec;
 import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException;
+import org.apache.directory.shared.ldap.message.LdapResult;
+import org.apache.directory.shared.ldap.message.Message;
+import org.apache.directory.shared.ldap.message.Referral;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.message.ResultResponse;
 import org.apache.directory.shared.ldap.util.LdapURL;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
@@ -49,25 +51,29 @@ public class ReferralAction extends Gram
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public ReferralAction()
     {
         super( "Add a referral" );
     }
 
+
     /**
      * The initialization action
      */
     public void action( IAsn1Container container ) throws DecoderException
     {
         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
-        LdapResponseCodec response = ldapMessageContainer.getLdapResponse();
-        LdapResultCodec ldapResult = response.getLdapResult();
 
         TLV tlv = ldapMessageContainer.getCurrentTLV();
 
+        Message response = ldapMessageContainer.getMessage();
+        LdapResult ldapResult = ( ( ResultResponse ) response ).getLdapResult();
+        Referral referral = ldapResult.getReferral();
+
         if ( tlv.getLength() == 0 )
         {
-            ldapResult.addReferral( LdapURL.EMPTY_URL );
+            referral.addLdapUrl( "" );
         }
         else
         {
@@ -75,7 +81,7 @@ public class ReferralAction extends Gram
             {
                 try
                 {
-                    ldapResult.addReferral( new LdapURL( tlv.getValue().getData() ) );
+                    referral.addLdapUrl( new LdapURL( tlv.getValue().getData() ).toString() );
                 }
                 catch ( LdapURLEncodingException luee )
                 {
@@ -87,19 +93,16 @@ public class ReferralAction extends Gram
             else
             {
                 log.warn( "The Referral error message is not allowed when havind an error code no equals to REFERRAL" );
-                ldapResult.addReferral( LdapURL.EMPTY_URL );
+                referral.addLdapUrl( LdapURL.EMPTY_URL.toString() );
             }
         }
 
-        // We can have an END transition
-        ldapMessageContainer.grammarEndAllowed( true );
-
         if ( IS_DEBUG )
         {
             StringBuffer sb = new StringBuffer();
             boolean isFirst = true;
 
-            for ( LdapURL url:ldapResult.getReferrals() )
+            for ( String url : ldapResult.getReferral().getLdapUrls() )
             {
                 if ( isFirst )
                 {
@@ -115,5 +118,8 @@ public class ReferralAction extends Gram
 
             log.debug( "The referral error message is set to " + sb.toString() );
         }
+
+        // We can have an END transition
+        ldapMessageContainer.grammarEndAllowed( true );
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResponseAction.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResponseAction.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResponseAction.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResponseAction.java Fri Aug 20 19:23:27 2010
@@ -25,7 +25,7 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
-import org.apache.directory.shared.ldap.codec.extended.ExtendedResponseCodec;
+import org.apache.directory.shared.ldap.message.ExtendedResponse;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -44,11 +44,13 @@ public class ResponseAction extends Gram
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public ResponseAction()
     {
         super( "Store response" );
     }
 
+
     /**
      * The initialization action
      */
@@ -58,7 +60,7 @@ public class ResponseAction extends Gram
         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
 
         // We can allocate the ExtendedResponse Object
-        ExtendedResponseCodec extendedResponse = ldapMessageContainer.getExtendedResponse();
+        ExtendedResponse extendedResponse = ldapMessageContainer.getExtendedResponse();
 
         // Get the Value and store it in the ExtendedResponse
         TLV tlv = ldapMessageContainer.getCurrentTLV();
@@ -67,11 +69,11 @@ public class ResponseAction extends Gram
         // OID
         if ( tlv.getLength() == 0 )
         {
-            extendedResponse.setResponse( StringTools.EMPTY_BYTES );
+            extendedResponse.setResponseValue( StringTools.EMPTY_BYTES );
         }
         else
         {
-            extendedResponse.setResponse( tlv.getValue().getData() );
+            extendedResponse.setResponseValue( tlv.getValue().getData() );
         }
 
         // We can have an END transition
@@ -79,7 +81,7 @@ public class ResponseAction extends Gram
 
         if ( IS_DEBUG )
         {
-            log.debug( "Extended value : {}", extendedResponse.getResponse() );
+            log.debug( "Extended value : {}", extendedResponse.getResponseValue() );
         }
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResponseNameAction.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResponseNameAction.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResponseNameAction.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResponseNameAction.java Fri Aug 20 19:23:27 2010
@@ -27,7 +27,7 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.primitives.OID;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
-import org.apache.directory.shared.ldap.codec.extended.ExtendedResponseCodec;
+import org.apache.directory.shared.ldap.message.ExtendedResponse;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -46,11 +46,13 @@ public class ResponseNameAction extends 
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public ResponseNameAction()
     {
         super( "Store response name" );
     }
 
+
     /**
      * The initialization action
      */
@@ -59,7 +61,7 @@ public class ResponseNameAction extends 
         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
 
         // We can allocate the ExtendedResponse Object
-        ExtendedResponseCodec extendedResponse = ldapMessageContainer.getExtendedResponse();
+        ExtendedResponse extendedResponse = ldapMessageContainer.getExtendedResponse();
 
         // Get the Value and store it in the ExtendedResponse
         TLV tlv = ldapMessageContainer.getCurrentTLV();
@@ -74,8 +76,8 @@ public class ResponseNameAction extends 
         }
         else
         {
-            extendedResponse
-                .setResponseName( new OID( StringTools.asciiBytesToString( tlv.getValue().getData() ) ) );
+            extendedResponse.setResponseName( new OID( StringTools.asciiBytesToString( tlv.getValue().getData() ) )
+                .toString() );
         }
 
         // We can have an END transition

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResultCodeAction.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResultCodeAction.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResultCodeAction.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResultCodeAction.java Fri Aug 20 19:23:27 2010
@@ -29,9 +29,9 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.util.IntegerDecoderException;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
-import org.apache.directory.shared.ldap.codec.LdapResponseCodec;
-import org.apache.directory.shared.ldap.codec.LdapResultCodec;
+import org.apache.directory.shared.ldap.message.LdapResult;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.message.ResultResponse;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -50,22 +50,19 @@ public class ResultCodeAction extends Gr
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public ResultCodeAction()
     {
         super( "Store resultCode" );
     }
 
+
     /**
      * The initialization action
      */
     public void action( IAsn1Container container ) throws DecoderException
     {
         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
-        LdapResponseCodec response = ldapMessageContainer.getLdapResponse();
-        LdapResultCodec ldapResult = new LdapResultCodec();
-        response.setLdapResult( ldapResult );
-
-        // We don't have to allocate a LdapResult first.
 
         // The current TLV should be a integer
         // We get it and store it in MessageId
@@ -76,7 +73,8 @@ public class ResultCodeAction extends Gr
 
         try
         {
-            resultCode = ResultCodeEnum.getResultCode( IntegerDecoder.parse( value, 0, ResultCodeEnum.UNKNOWN.getResultCode() ) );
+            resultCode = ResultCodeEnum.getResultCode( IntegerDecoder.parse( value, 0, ResultCodeEnum.UNKNOWN
+                .getResultCode() ) );
         }
         catch ( IntegerDecoderException ide )
         {
@@ -129,12 +127,11 @@ public class ResultCodeAction extends Gr
             case CANNOT_CANCEL:
             case TOO_LATE:
             case NO_SUCH_OPERATION:
-                ldapResult.setResultCode( resultCode );
                 break;
 
             default:
                 log.warn( "The resultCode " + resultCode + " is unknown." );
-                ldapResult.setResultCode( ResultCodeEnum.OTHER );
+                resultCode = ResultCodeEnum.OTHER;
                 break;
         }
 
@@ -142,5 +139,9 @@ public class ResultCodeAction extends Gr
         {
             log.debug( "The result code is set to " + resultCode );
         }
+
+        ResultResponse response = ( ResultResponse ) ldapMessageContainer.getMessage();
+        LdapResult ldapResult = response.getLdapResult();
+        ldapResult.setResultCode( resultCode );
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/SearchResultAttributeValueAction.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/SearchResultAttributeValueAction.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/SearchResultAttributeValueAction.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/SearchResultAttributeValueAction.java Fri Aug 20 19:23:27 2010
@@ -24,7 +24,7 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
-import org.apache.directory.shared.ldap.codec.search.SearchResultEntryCodec;
+import org.apache.directory.shared.ldap.message.SearchResultEntry;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -43,18 +43,20 @@ public class SearchResultAttributeValueA
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public SearchResultAttributeValueAction()
     {
         super( "Stores AttributeValue" );
     }
 
+
     /**
      * The initialization action
      */
     public void action( IAsn1Container container )
     {
         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
-        SearchResultEntryCodec searchResultEntry = ldapMessageContainer.getSearchResultEntry();
+        SearchResultEntry searchResultEntry = ldapMessageContainer.getSearchResultEntry();
 
         TLV tlv = ldapMessageContainer.getCurrentTLV();
 
@@ -69,7 +71,7 @@ public class SearchResultAttributeValueA
         }
         else
         {
-            if ( ldapMessageContainer.isBinary( searchResultEntry.getCurrentAttributeValueType() ) )
+            if ( ldapMessageContainer.isBinary( searchResultEntry.getCurrentAttribute().getId() ) )
             {
                 value = tlv.getValue().getData();
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ServerSASLCredsAction.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ServerSASLCredsAction.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ServerSASLCredsAction.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ServerSASLCredsAction.java Fri Aug 20 19:23:27 2010
@@ -25,7 +25,7 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
-import org.apache.directory.shared.ldap.codec.bind.BindResponseCodec;
+import org.apache.directory.shared.ldap.message.BindResponse;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -44,11 +44,13 @@ public class ServerSASLCredsAction exten
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public ServerSASLCredsAction()
     {
         super( "Store server sasl credentials value" );
     }
 
+
     /**
      * The initialization action
      */
@@ -56,28 +58,31 @@ public class ServerSASLCredsAction exten
     {
         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
 
-        BindResponseCodec bindResponseMessage = ldapMessageContainer.getBindResponse();
-
         // Get the Value and store it in the BindRequest
         TLV tlv = ldapMessageContainer.getCurrentTLV();
 
         // We have to handle the special case of a 0 length server
         // sasl credentials
+        byte[] serverSaslCreds = null;
+
         if ( tlv.getLength() == 0 )
         {
-            bindResponseMessage.setServerSaslCreds( StringTools.EMPTY_BYTES );
+            serverSaslCreds = StringTools.EMPTY_BYTES;
         }
         else
         {
-            bindResponseMessage.setServerSaslCreds( tlv.getValue().getData() );
+            serverSaslCreds = tlv.getValue().getData();
         }
 
+        BindResponse response = ( BindResponse ) ldapMessageContainer.getMessage();
+        response.setServerSaslCreds( serverSaslCreds );
+
         // We can have an END transition
         ldapMessageContainer.grammarEndAllowed( true );
 
         if ( IS_DEBUG )
         {
-            log.debug( "The SASL credentials value is : {}", StringTools.dumpBytes( bindResponseMessage.getServerSaslCreds() ) );
+            log.debug( "The SASL credentials value is : {}", StringTools.dumpBytes( serverSaslCreds ) );
         }
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreAnyAction.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreAnyAction.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreAnyAction.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreAnyAction.java Fri Aug 20 19:23:27 2010
@@ -26,8 +26,9 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
-import org.apache.directory.shared.ldap.codec.search.SearchRequestCodec;
 import org.apache.directory.shared.ldap.codec.search.SubstringFilter;
+import org.apache.directory.shared.ldap.message.SearchRequest;
+import org.apache.directory.shared.ldap.message.SearchRequestImpl;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -46,23 +47,26 @@ public class StoreAnyAction extends Gram
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public StoreAnyAction()
     {
         super( "Store a any value" );
     }
 
+
     /**
      * The initialization action
      */
     public void action( IAsn1Container container ) throws DecoderException
     {
         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
-        SearchRequestCodec searchRequest = ldapMessageContainer.getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getSearchRequest();
 
         TLV tlv = ldapMessageContainer.getCurrentTLV();
 
         // Store the value.
-        SubstringFilter substringFilter = ( SubstringFilter ) searchRequest.getTerminalFilter();
+        SubstringFilter substringFilter = ( SubstringFilter ) ( ( SearchRequestImpl ) searchRequest )
+            .getTerminalFilter();
 
         if ( tlv.getLength() == 0 )
         {
@@ -76,7 +80,7 @@ public class StoreAnyAction extends Gram
 
         // We now have to get back to the nearest filter which is
         // not terminal.
-        searchRequest.unstackFilters( container );
+        ( ( SearchRequestImpl ) searchRequest ).unstackFilters( container );
 
         if ( IS_DEBUG )
         {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreFinalAction.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreFinalAction.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreFinalAction.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreFinalAction.java Fri Aug 20 19:23:27 2010
@@ -26,8 +26,9 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
-import org.apache.directory.shared.ldap.codec.search.SearchRequestCodec;
 import org.apache.directory.shared.ldap.codec.search.SubstringFilter;
+import org.apache.directory.shared.ldap.message.SearchRequest;
+import org.apache.directory.shared.ldap.message.SearchRequestImpl;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -46,23 +47,26 @@ public class StoreFinalAction extends Gr
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public StoreFinalAction()
     {
         super( "Store a final value" );
     }
 
+
     /**
      * The initialization action
      */
     public void action( IAsn1Container container ) throws DecoderException
     {
         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
-        SearchRequestCodec searchRequest = ldapMessageContainer.getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getSearchRequest();
 
         TLV tlv = ldapMessageContainer.getCurrentTLV();
 
         // Store the value.
-        SubstringFilter substringFilter = ( SubstringFilter ) searchRequest.getTerminalFilter();
+        SubstringFilter substringFilter = ( SubstringFilter ) ( ( SearchRequestImpl ) searchRequest )
+            .getTerminalFilter();
 
         if ( tlv.getLength() == 0 )
         {
@@ -76,7 +80,7 @@ public class StoreFinalAction extends Gr
 
         // We now have to get back to the nearest filter which is
         // not terminal.
-        searchRequest.unstackFilters( container );
+        ( ( SearchRequestImpl ) searchRequest ).unstackFilters( container );
 
         if ( IS_DEBUG )
         {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreMatchValueAction.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreMatchValueAction.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreMatchValueAction.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreMatchValueAction.java Fri Aug 20 19:23:27 2010
@@ -26,8 +26,9 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.search.ExtensibleMatchFilter;
-import org.apache.directory.shared.ldap.codec.search.SearchRequestCodec;
 import org.apache.directory.shared.ldap.entry.BinaryValue;
+import org.apache.directory.shared.ldap.message.SearchRequest;
+import org.apache.directory.shared.ldap.message.SearchRequestImpl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -45,30 +46,32 @@ public class StoreMatchValueAction exten
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public StoreMatchValueAction()
     {
         super( "Store match Value" );
     }
 
+
     /**
      * The initialization action
      */
     public void action( IAsn1Container container ) throws DecoderException
     {
         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
-        SearchRequestCodec searchRequest = ldapMessageContainer.getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getSearchRequest();
 
         TLV tlv = ldapMessageContainer.getCurrentTLV();
 
         // Store the value.
-        ExtensibleMatchFilter extensibleMatchFilter = ( ExtensibleMatchFilter ) searchRequest
+        ExtensibleMatchFilter extensibleMatchFilter = ( ExtensibleMatchFilter ) ( ( SearchRequestImpl ) searchRequest )
             .getTerminalFilter();
-        
+
         byte[] value = tlv.getValue().getData();
         extensibleMatchFilter.setMatchValue( new BinaryValue( value ) );
 
         // unstack the filters if needed
-        searchRequest.unstackFilters( container );
+        ( ( SearchRequestImpl ) searchRequest ).unstackFilters( container );
 
         if ( IS_DEBUG )
         {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreReferenceAction.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreReferenceAction.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreReferenceAction.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreReferenceAction.java Fri Aug 20 19:23:27 2010
@@ -26,8 +26,10 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
-import org.apache.directory.shared.ldap.codec.search.SearchResultReferenceCodec;
 import org.apache.directory.shared.ldap.codec.util.LdapURLEncodingException;
+import org.apache.directory.shared.ldap.message.Referral;
+import org.apache.directory.shared.ldap.message.ReferralImpl;
+import org.apache.directory.shared.ldap.message.SearchResultReference;
 import org.apache.directory.shared.ldap.util.LdapURL;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
@@ -47,11 +49,13 @@ public class StoreReferenceAction extend
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public StoreReferenceAction()
     {
         super( "Store a reference" );
     }
 
+
     /**
      * The initialization action
      */
@@ -60,30 +64,39 @@ public class StoreReferenceAction extend
 
         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
 
-        SearchResultReferenceCodec searchResultReference = ldapMessageContainer.getSearchResultReference();
+        SearchResultReference searchResultReference = ldapMessageContainer.getSearchResultReference();
 
         // Get the Value and store it in the BindRequest
         TLV tlv = ldapMessageContainer.getCurrentTLV();
 
-        // We have to handle the special case of a 0 length server
-        // sasl credentials
+        // Get the referral, or create it if not existing
+        Referral referral = searchResultReference.getReferral();
+
+        if ( referral == null )
+        {
+            referral = new ReferralImpl();
+            searchResultReference.setReferral( referral );
+        }
+
+        // We have to handle the special case of a 0 length list of referrals
         LdapURL url = LdapURL.EMPTY_URL;
 
         if ( tlv.getLength() == 0 )
         {
-            searchResultReference.addSearchResultReference( url );
+            referral.addLdapUrl( "" );
         }
         else
         {
+            String urlStr = StringTools.utf8ToString( tlv.getValue().getData() );
+
             try
             {
-                url = new LdapURL( tlv.getValue().getData() );
-                searchResultReference.addSearchResultReference( url );
+                url = new LdapURL( urlStr );
+                referral.addLdapUrl( urlStr );
             }
             catch ( LdapURLEncodingException luee )
             {
-                String badUrl = StringTools.utf8ToString( tlv.getValue().getData() );
-                log.error( I18n.err( I18n.ERR_04021, badUrl, luee.getMessage() ) );
+                log.error( I18n.err( I18n.ERR_04021, urlStr, luee.getMessage() ) );
                 throw new DecoderException( I18n.err( I18n.ERR_04016, luee.getMessage() ) );
             }
         }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreTypeMatchingRuleAction.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreTypeMatchingRuleAction.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreTypeMatchingRuleAction.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreTypeMatchingRuleAction.java Fri Aug 20 19:23:27 2010
@@ -27,7 +27,8 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.search.ExtensibleMatchFilter;
-import org.apache.directory.shared.ldap.codec.search.SearchRequestCodec;
+import org.apache.directory.shared.ldap.message.SearchRequest;
+import org.apache.directory.shared.ldap.message.SearchRequestImpl;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -46,18 +47,20 @@ public class StoreTypeMatchingRuleAction
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public StoreTypeMatchingRuleAction()
     {
         super( "Store matching type Value" );
     }
 
+
     /**
      * The initialization action
      */
     public void action( IAsn1Container container ) throws DecoderException
     {
         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
-        SearchRequestCodec searchRequest = ldapMessageContainer.getSearchRequest();
+        SearchRequest searchRequest = ldapMessageContainer.getSearchRequest();
 
         TLV tlv = ldapMessageContainer.getCurrentTLV();
 
@@ -70,7 +73,7 @@ public class StoreTypeMatchingRuleAction
         else
         {
             // Store the value.
-            ExtensibleMatchFilter extensibleMatchFilter = ( ExtensibleMatchFilter ) searchRequest
+            ExtensibleMatchFilter extensibleMatchFilter = ( ExtensibleMatchFilter ) ( ( SearchRequestImpl ) searchRequest )
                 .getTerminalFilter();
 
             String type = StringTools.utf8ToString( tlv.getValue().getData() );

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ValueAction.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ValueAction.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ValueAction.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ValueAction.java Fri Aug 20 19:23:27 2010
@@ -24,7 +24,7 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.ber.grammar.GrammarAction;
 import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
-import org.apache.directory.shared.ldap.codec.add.AddRequestCodec;
+import org.apache.directory.shared.ldap.message.AddRequest;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -57,7 +57,7 @@ public class ValueAction extends Grammar
     {
 
         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
-        AddRequestCodec addRequest = ldapMessageContainer.getAddRequest();
+        AddRequest addRequest = ldapMessageContainer.getAddRequest();
 
         TLV tlv = ldapMessageContainer.getCurrentTLV();
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/Filter.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/Filter.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/Filter.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/Filter.java Fri Aug 20 19:23:27 2010
@@ -20,7 +20,9 @@
 package org.apache.directory.shared.ldap.codec.search;
 
 
-import org.apache.directory.shared.asn1.AbstractAsn1Object;
+import java.nio.ByteBuffer;
+
+import org.apache.directory.shared.asn1.codec.EncoderException;
 
 
 /**
@@ -30,14 +32,24 @@ import org.apache.directory.shared.asn1.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public abstract class Filter extends AbstractAsn1Object
+public abstract class Filter
 {
+    /** The identifier of the associated TLV */
+    int tlvId;
+
+    /** The parent TLV id */
+    protected int parentTlvId;
+
+    /** The parent Filter */
+    protected Filter parent;
+
+
     /**
      * The constructor.
      */
     public Filter( int tlvId )
     {
-        super( tlvId );
+        this.tlvId = tlvId;
     }
 
 
@@ -46,6 +58,59 @@ public abstract class Filter extends Abs
      */
     public Filter()
     {
-        super();
     }
+
+
+    /**
+     * Get the parent
+     * 
+     * @return Returns the parent.
+     */
+    public Filter getParent()
+    {
+        return parent;
+    }
+
+
+    /**
+     * Get the parent
+     * 
+     * @return Returns the parent.
+     */
+    public int getParentTlvId()
+    {
+        return parentTlvId;
+    }
+
+
+    /**
+     * Set the parent
+     * 
+     * @param parent The parent to set.
+     */
+    public void setParent( Filter parent, int parentTlvId )
+    {
+        this.parent = parent;
+        this.parentTlvId = parentTlvId;
+    }
+
+
+    public int getTlvId()
+    {
+        return tlvId;
+    }
+
+
+    /**
+     * Compute the Filter length 
+     */
+    public abstract int computeLength();
+
+
+    /**
+     * Encode the Filter message to a PDU. 
+     * @param buffer The buffer where to put the PDU
+     * @return The PDU.
+     */
+    public abstract ByteBuffer encode( ByteBuffer buffer ) throws EncoderException;
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/PresentFilter.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/PresentFilter.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/PresentFilter.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/PresentFilter.java Fri Aug 20 19:23:27 2010
@@ -42,9 +42,9 @@ public class PresentFilter extends Filte
 
     /** The attribute description. */
     private String attributeDescription;
-    
+
     /** Temporary storage for attribute description bytes */
-    private byte[] attributeDescriptionBytes; 
+    private byte[] attributeDescriptionBytes;
 
 
     // ~ Constructors
@@ -57,8 +57,8 @@ public class PresentFilter extends Filte
     {
         super( tlvId );
     }
-    
-    
+
+
     /**
      * The constructor.
      */
@@ -134,8 +134,6 @@ public class PresentFilter extends Filte
             throw new EncoderException( I18n.err( I18n.ERR_04005 ) );
         }
 
-        super.encode( buffer );
-
         return buffer;
     }
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbandonListener.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbandonListener.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbandonListener.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbandonListener.java Fri Aug 20 19:23:27 2010
@@ -19,7 +19,6 @@
  */
 package org.apache.directory.shared.ldap.message;
 
-import org.apache.directory.shared.ldap.message.internal.InternalAbandonableRequest;
 
 
 /**
@@ -35,5 +34,5 @@ public interface AbandonListener
      * @param req
      *            the request which is abandoned.
      */
-    void requestAbandoned( InternalAbandonableRequest req );
+    void requestAbandoned( AbandonableRequest req );
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbandonRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbandonRequestImpl.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbandonRequestImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbandonRequestImpl.java Fri Aug 20 19:23:27 2010
@@ -19,9 +19,8 @@
  */
 package org.apache.directory.shared.ldap.message;
 
+
 import org.apache.directory.shared.i18n.I18n;
-import org.apache.directory.shared.ldap.message.internal.InternalAbandonRequest;
-import org.apache.directory.shared.ldap.message.internal.InternalAbstractRequest;
 
 
 /**
@@ -29,7 +28,7 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class AbandonRequestImpl extends InternalAbstractRequest implements InternalAbandonRequest
+public class AbandonRequestImpl extends AbstractRequest implements AbandonRequest
 {
     static final long serialVersionUID = -4688193359792740969L;
 
@@ -39,11 +38,19 @@ public class AbandonRequestImpl extends 
 
     /**
      * Creates an AbandonRequest implementation for an outstanding request.
+     */
+    public AbandonRequestImpl()
+    {
+        super( -1, TYPE, false );
+    }
+
+
+    /**
+     * Creates an AbandonRequest implementation for an outstanding request.
      * 
-     * @param id
-     *            the sequence identifier of the AbandonRequest message.
+     * @param id the sequence identifier of the AbandonRequest message.
      */
-    public AbandonRequestImpl(final int id)
+    public AbandonRequestImpl( final int id )
     {
         super( id, TYPE, false );
     }
@@ -88,18 +95,18 @@ public class AbandonRequestImpl extends 
             return true;
         }
 
-        if ( ( obj == null ) || !( obj instanceof InternalAbandonRequest ) )
+        if ( ( obj == null ) || !( obj instanceof AbandonRequest ) )
         {
             return false;
         }
-        
+
         if ( !super.equals( obj ) )
         {
             return false;
         }
 
-        InternalAbandonRequest req = ( InternalAbandonRequest ) obj;
-        
+        AbandonRequest req = ( AbandonRequest ) obj;
+
         if ( req.getAbandoned() != abandonId )
         {
             return false;
@@ -108,7 +115,7 @@ public class AbandonRequestImpl extends 
         return true;
     }
 
-    
+
     /**
      * @see Object#hashCode()
      * @return the instance's hash code 
@@ -116,13 +123,13 @@ public class AbandonRequestImpl extends 
     public int hashCode()
     {
         int hash = 37;
-        hash = hash*17 + abandonId;
-        hash = hash*17 + super.hashCode();
-        
+        hash = hash * 17 + abandonId;
+        hash = hash * 17 + super.hashCode();
+
         return hash;
     }
 
-    
+
     /**
      * RFC 2251 [Section 4.11]: Abandon, Bind, Unbind, and StartTLS operations
      * cannot be abandoned.
@@ -131,4 +138,23 @@ public class AbandonRequestImpl extends 
     {
         throw new UnsupportedOperationException( I18n.err( I18n.ERR_04185 ) );
     }
+
+
+    /**
+     * Return a String representing an AbandonRequest
+     * 
+     * @return A String representing the AbandonRequest
+     */
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append( "    Abandon Request :\n" );
+        sb.append( "        Message Id : " ).append( abandonId );
+
+        // The controls
+        sb.append( super.toString() );
+
+        return sb.toString();
+    }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractAbandonableRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractAbandonableRequest.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractAbandonableRequest.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AbstractAbandonableRequest.java Fri Aug 20 19:23:27 2010
@@ -24,8 +24,6 @@ import java.util.Observable;
 import java.util.Observer;
 
 import org.apache.directory.shared.ldap.codec.MessageTypeEnum;
-import org.apache.directory.shared.ldap.message.internal.InternalAbandonableRequest;
-import org.apache.directory.shared.ldap.message.internal.InternalAbstractRequest;
 
 
 /**
@@ -34,7 +32,7 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class AbstractAbandonableRequest extends InternalAbstractRequest implements InternalAbandonableRequest
+public class AbstractAbandonableRequest extends AbstractRequest implements AbandonableRequest
 {
     static final long serialVersionUID = -4511116249089399040L;
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddRequestImpl.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddRequestImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddRequestImpl.java Fri Aug 20 19:23:27 2010
@@ -20,13 +20,14 @@
 package org.apache.directory.shared.ldap.message;
 
 
+import java.util.List;
 
 import org.apache.directory.shared.ldap.codec.MessageTypeEnum;
 import org.apache.directory.shared.ldap.entry.DefaultEntry;
+import org.apache.directory.shared.ldap.entry.DefaultEntryAttribute;
 import org.apache.directory.shared.ldap.entry.Entry;
-import org.apache.directory.shared.ldap.message.internal.InternalAddRequest;
-import org.apache.directory.shared.ldap.message.internal.InternalAddResponse;
-import org.apache.directory.shared.ldap.message.internal.InternalResultResponse;
+import org.apache.directory.shared.ldap.entry.EntryAttribute;
+import org.apache.directory.shared.ldap.exception.LdapException;
 import org.apache.directory.shared.ldap.name.DN;
 
 
@@ -35,14 +36,29 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class AddRequestImpl extends AbstractAbandonableRequest implements InternalAddRequest
+public class AddRequestImpl extends AbstractAbandonableRequest implements AddRequest
 {
     static final long serialVersionUID = 7534132448349520346L;
 
     /** A MultiMap of the new entry's attributes and their values */
     private Entry entry;
 
-    private InternalAddResponse response;
+    private AddResponse response;
+
+    /** The current attribute being decoded */
+    private EntryAttribute currentAttribute;
+
+    /** The add request length */
+    private int addRequestLength;
+
+    /** The Entry length */
+    private int entryLength;
+
+    /** The list of all attributes length */
+    private List<Integer> attributesLength;
+
+    /** The list of all vals length */
+    private List<Integer> valuesLength;
 
 
     // ------------------------------------------------------------------------
@@ -51,11 +67,20 @@ public class AddRequestImpl extends Abst
 
     /**
      * Creates an AddRequest implementation to create a new entry.
+     */
+    public AddRequestImpl()
+    {
+        super( -1, TYPE );
+        entry = new DefaultEntry();
+    }
+
+
+    /**
+     * Creates an AddRequest implementation to create a new entry.
      * 
-     * @param id
-     *            the sequence identifier of the AddRequest message.
+     * @param id the sequence identifier of the AddRequest message.
      */
-    public AddRequestImpl(final int id)
+    public AddRequestImpl( final int id )
     {
         super( id, TYPE );
         entry = new DefaultEntry();
@@ -110,6 +135,68 @@ public class AddRequestImpl extends Abst
     }
 
 
+    /**
+     * Create a new attributeValue
+     * 
+     * @param type The attribute's name (called 'type' in the grammar)
+     */
+    public void addAttributeType( String type ) throws LdapException
+    {
+        // do not create a new attribute if we have seen this attributeType before
+        if ( entry.get( type ) != null )
+        {
+            currentAttribute = entry.get( type );
+            return;
+        }
+
+        // fix this to use AttributeImpl(type.getString().toLowerCase())
+        currentAttribute = new DefaultEntryAttribute( type );
+        entry.put( currentAttribute );
+    }
+
+
+    /**
+     * @return Returns the currentAttribute type.
+     */
+    public String getCurrentAttributeType()
+    {
+        return currentAttribute.getId();
+    }
+
+
+    /**
+     * Add a new value to the current attribute
+     * 
+     * @param value The value to add
+     */
+    public void addAttributeValue( String value )
+    {
+        currentAttribute.add( value );
+    }
+
+
+    /**
+     * Add a new value to the current attribute
+     * 
+     * @param value The value to add
+     */
+    public void addAttributeValue( org.apache.directory.shared.ldap.entry.Value<?> value )
+    {
+        currentAttribute.add( value );
+    }
+
+
+    /**
+     * Add a new value to the current attribute
+     * 
+     * @param value The value to add
+     */
+    public void addAttributeValue( byte[] value )
+    {
+        currentAttribute.add( value );
+    }
+
+
     // ------------------------------------------------------------------------
     // SingleReplyRequest Interface Method Implementations
     // ------------------------------------------------------------------------
@@ -131,7 +218,7 @@ public class AddRequestImpl extends Abst
      * 
      * @return the result containing response for this request
      */
-    public InternalResultResponse getResultResponse()
+    public ResultResponse getResultResponse()
     {
         if ( response == null )
         {
@@ -143,6 +230,82 @@ public class AddRequestImpl extends Abst
 
 
     /**
+     * Stores the encoded length for the AddRequest
+     * @param addRequestLength The encoded length
+     */
+    /* No qualifier*/void setAddRequestLength( int addRequestLength )
+    {
+        this.addRequestLength = addRequestLength;
+    }
+
+
+    /**
+     * @return The encoded AddRequest's length
+     */
+    /* No qualifier */int getAddRequestLength()
+    {
+        return addRequestLength;
+    }
+
+
+    /**
+     * Stores the encoded length for the Entry
+     * @param entryLength The encoded length
+     */
+    /* No qualifier*/void setEntryLength( int entryLength )
+    {
+        this.entryLength = entryLength;
+    }
+
+
+    /**
+     * @return The encoded Entry's length
+     */
+    /* No qualifier */int getEntryLength()
+    {
+        return entryLength;
+    }
+
+
+    /**
+     * Stores the encoded length for the attributes
+     * @param atributesLength The encoded length
+     */
+    /* No qualifier*/void setAttributesLength( List<Integer> attributesLength )
+    {
+        this.attributesLength = attributesLength;
+    }
+
+
+    /**
+     * @return The encoded values length
+     */
+    /* No qualifier */List<Integer> getAttributesLength()
+    {
+        return attributesLength;
+    }
+
+
+    /**
+     * Stores the encoded length for the values
+     * @param valuesLength The encoded length
+     */
+    /* No qualifier*/void setValuesLength( List<Integer> valuesLength )
+    {
+        this.valuesLength = valuesLength;
+    }
+
+
+    /**
+     * @return The encoded values length
+     */
+    /* No qualifier */List<Integer> getValuesLength()
+    {
+        return valuesLength;
+    }
+
+
+    /**
      * Checks to see if an object is equivalent to this AddRequest. First
      * there's a quick test to see if the obj is the same object as this one -
      * if so true is returned. Next if the super method fails false is returned.
@@ -151,8 +314,7 @@ public class AddRequestImpl extends Abst
      * not the same false is returned otherwise 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 AddRequest, false otherwise
      */
     public boolean equals( Object obj )
@@ -162,9 +324,9 @@ public class AddRequestImpl extends Abst
         {
             return true;
         }
-        
+
         // Check the object class. If null, it will exit.
-        if ( !( obj instanceof InternalAddRequest ) )
+        if ( !( obj instanceof AddRequest ) )
         {
             return false;
         }
@@ -174,7 +336,7 @@ public class AddRequestImpl extends Abst
             return false;
         }
 
-        InternalAddRequest req = ( InternalAddRequest ) obj;
+        AddRequest req = ( AddRequest ) obj;
 
         // Check the entry
         if ( entry == null )
@@ -187,6 +349,7 @@ public class AddRequestImpl extends Abst
         }
     }
 
+
     /**
      * @see Object#hashCode()
      * @return the instance's hash code 
@@ -194,13 +357,14 @@ public class AddRequestImpl extends Abst
     public int hashCode()
     {
         int hash = 37;
-        hash = hash*17 + ( entry == null ? 0 : entry.hashCode() );
-        hash = hash*17 + ( response == null ? 0 : response.hashCode() );
-        hash = hash*17 + super.hashCode();
-        
+        hash = hash * 17 + ( entry == null ? 0 : entry.hashCode() );
+        hash = hash * 17 + ( response == null ? 0 : response.hashCode() );
+        hash = hash * 17 + super.hashCode();
+
         return hash;
     }
 
+
     /**
      * @see Object#toString()
      */
@@ -209,7 +373,7 @@ public class AddRequestImpl extends Abst
         StringBuilder sb = new StringBuilder();
 
         sb.append( "    Add Request :\n" );
-        
+
         if ( entry == null )
         {
             sb.append( "            No entry\n" );

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddResponseImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddResponseImpl.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddResponseImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddResponseImpl.java Fri Aug 20 19:23:27 2010
@@ -19,17 +19,17 @@
  */
 package org.apache.directory.shared.ldap.message;
 
-import org.apache.directory.shared.ldap.message.internal.InternalAbstractResultResponse;
-import org.apache.directory.shared.ldap.message.internal.InternalAddResponse;
-
 
 /**
  * AddResponse implementation.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class AddResponseImpl extends InternalAbstractResultResponse implements InternalAddResponse
+public class AddResponseImpl extends AbstractResultResponse implements AddResponse
 {
+    /** The encoded addResponse length */
+    private int addResponseLength;
+
     // ------------------------------------------------------------------------
     // Constructors
     // ------------------------------------------------------------------------
@@ -38,26 +38,52 @@ public class AddResponseImpl extends Int
 
 
     /**
-     * Creates a Lockable AddResponse as a reply to an AddRequest.
+     * Creates an AddResponse as a reply to an AddRequest.
+     */
+    public AddResponseImpl()
+    {
+        super( -1, TYPE );
+    }
+
+
+    /**
+     * Creates an AddResponse as a reply to an AddRequest.
      * 
-     * @param id
-     *            the session unique message id
+     * @param id the session unique message id
      */
-    public AddResponseImpl(final int id)
+    public AddResponseImpl( final int id )
     {
         super( id, TYPE );
     }
 
 
     /**
+     * Stores the encoded length for the AddResponse
+     * @param addResponseLength The encoded length
+     */
+    /* No qualifier*/void setAddResponseLength( int addResponseLength )
+    {
+        this.addResponseLength = addResponseLength;
+    }
+
+
+    /**
+     * @return The encoded AddResponse's length
+     */
+    /* No qualifier */int getAddResponseLength()
+    {
+        return addResponseLength;
+    }
+
+
+    /**
      * Get a String representation of an AddResponse
      * 
      * @return An AddResponse String
      */
     public String toString()
     {
-
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
 
         sb.append( "    Add Response\n" );
         sb.append( super.toString() );

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindRequestImpl.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindRequestImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindRequestImpl.java Fri Aug 20 19:23:27 2010
@@ -24,9 +24,6 @@ import java.util.Arrays;
 
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.codec.MessageTypeEnum;
-import org.apache.directory.shared.ldap.message.internal.InternalBindRequest;
-import org.apache.directory.shared.ldap.message.internal.InternalBindResponse;
-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;
 
@@ -37,7 +34,7 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org"> Apache Directory Project</a>
  */
-public class BindRequestImpl extends AbstractAbandonableRequest implements InternalBindRequest
+public class BindRequestImpl extends AbstractAbandonableRequest implements BindRequest
 {
     static final long serialVersionUID = 7945504184130380071L;
 
@@ -49,7 +46,7 @@ public class BindRequestImpl extends Abs
 
     /** The passwords, keys or tickets used to verify user identity */
     private byte[] credentials;
-    
+
     /** A storage for credentials hashCode */
     private int hCredentials;
 
@@ -63,7 +60,16 @@ public class BindRequestImpl extends Abs
     private boolean isVersion3 = true;
 
     /** The associated response */
-    public InternalBindResponse response;
+    public BindResponse response;
+
+    /** The bind request length */
+    private int bindRequestLength;
+
+    /** The SASL Mechanism length */
+    private int saslMechanismLength;
+
+    /** The SASL credentials length */
+    private int saslCredentialsLength;
 
 
     // ------------------------------------------------------------------------
@@ -82,6 +88,16 @@ public class BindRequestImpl extends Abs
     }
 
 
+    /**
+     * Creates an BindRequest implementation to bind to an LDAP server.
+     */
+    public BindRequestImpl()
+    {
+        super( -1, TYPE );
+        hCredentials = 0;
+    }
+
+
     // -----------------------------------------------------------------------
     // BindRequest Interface Method Implementations
     // -----------------------------------------------------------------------
@@ -136,32 +152,37 @@ public class BindRequestImpl extends Abs
 
 
     /**
-     * Sets the simple credentials associated with a simple authentication
-     * attempt ignored if this request uses SASL authentication mechanisms.
-     * 
-     * @param credentials
-     *            the credentials if authentication is simple, null otherwise
+     * {@inheritDoc}
+     */
+    public void setCredentials( String credentials )
+    {
+        setCredentials( StringTools.getBytesUtf8( credentials ) );
+    }
+
+
+    /**
+     * {@inheritDoc}
      */
     public void setCredentials( byte[] credentials )
     {
         if ( credentials != null )
         {
-            this.credentials = new byte[ credentials.length ];
+            this.credentials = new byte[credentials.length];
             System.arraycopy( credentials, 0, this.credentials, 0, credentials.length );
-        } 
-        else 
+        }
+        else
         {
             this.credentials = null;
         }
-        
+
         // Compute the hashcode
         if ( credentials != null )
         {
             hCredentials = 0;
-            
-            for ( byte b:credentials )
+
+            for ( byte b : credentials )
             {
-                hCredentials = hCredentials*31 + b;
+                hCredentials = hCredentials * 31 + b;
             }
         }
         else
@@ -299,7 +320,7 @@ public class BindRequestImpl extends Abs
      * 
      * @return the result containing response for this request
      */
-    public InternalResultResponse getResultResponse()
+    public ResultResponse getResultResponse()
     {
         if ( response == null )
         {
@@ -308,7 +329,6 @@ public class BindRequestImpl extends Abs
 
         return response;
     }
-    
 
 
     /**
@@ -331,17 +351,17 @@ public class BindRequestImpl extends Abs
             return true;
         }
 
-        if ( ( obj == null ) || !( obj instanceof InternalBindRequest ) )
+        if ( ( obj == null ) || !( obj instanceof BindRequest ) )
         {
             return false;
         }
-        
+
         if ( !super.equals( obj ) )
         {
             return false;
         }
 
-        InternalBindRequest req = ( InternalBindRequest ) obj;
+        BindRequest req = ( BindRequest ) obj;
 
         if ( req.isSimple() != isSimple() )
         {
@@ -355,7 +375,7 @@ public class BindRequestImpl extends Abs
 
         DN dn1 = req.getName();
         DN dn2 = getName();
-        
+
         if ( dn1 == null )
         {
             if ( dn2 != null )
@@ -373,9 +393,9 @@ public class BindRequestImpl extends Abs
             {
                 return false;
             }
-                
+
         }
-        
+
         if ( !Arrays.equals( req.getCredentials(), getCredentials() ) )
         {
             return false;
@@ -383,8 +403,8 @@ public class BindRequestImpl extends Abs
 
         return true;
     }
-    
-    
+
+
     /**
      * @see Object#hashCode()
      * @return the instance's hash code 
@@ -392,18 +412,75 @@ public class BindRequestImpl extends Abs
     public int hashCode()
     {
         int hash = 37;
-        hash = hash*17 + ( credentials == null ? 0 : hCredentials );
-        hash = hash*17 + ( isSimple ? 0 : 1 );
-        hash = hash*17 + ( isVersion3 ? 0 : 1 );
-        hash = hash*17 + ( mechanism == null ? 0 : mechanism.hashCode() );
-        hash = hash*17 + ( name == null ? 0 : name.hashCode() );
-        hash = hash*17 + ( response == null ? 0 : response.hashCode() );
-        hash = hash*17 + super.hashCode();
-        
+        hash = hash * 17 + ( credentials == null ? 0 : hCredentials );
+        hash = hash * 17 + ( isSimple ? 0 : 1 );
+        hash = hash * 17 + ( isVersion3 ? 0 : 1 );
+        hash = hash * 17 + ( mechanism == null ? 0 : mechanism.hashCode() );
+        hash = hash * 17 + ( name == null ? 0 : name.hashCode() );
+        hash = hash * 17 + ( response == null ? 0 : response.hashCode() );
+        hash = hash * 17 + super.hashCode();
+
         return hash;
     }
 
-    
+
+    /**
+     * Stores the encoded length for the BindRequest
+     * @param bindRequestLength The encoded length
+     */
+    /* No qualifier*/void setBindRequestLength( int bindRequestLength )
+    {
+        this.bindRequestLength = bindRequestLength;
+    }
+
+
+    /**
+     * @return The encoded BindRequest's length
+     */
+    /* No qualifier */int getBindRequestLength()
+    {
+        return bindRequestLength;
+    }
+
+
+    /**
+     * Stores the encoded length for the SaslCredentials
+     * @param saslCredentialsLength The encoded length
+     */
+    /* No qualifier*/void setSaslCredentialsLength( int saslCredentialsLength )
+    {
+        this.saslCredentialsLength = saslCredentialsLength;
+    }
+
+
+    /**
+     * @return The encoded SaslCredentials's length
+     */
+    /* No qualifier */int getSaslCredentialsLength()
+    {
+        return saslCredentialsLength;
+    }
+
+
+    /**
+     * Stores the encoded length for the Mechanism
+     * @param saslMechanismLength The encoded length
+     */
+    /* No qualifier*/void setSaslMechanismLength( int saslMechanismLength )
+    {
+        this.saslMechanismLength = saslMechanismLength;
+    }
+
+
+    /**
+     * @return The encoded SaslMechanism's length
+     */
+    /* No qualifier */int getSaslMechanismLength()
+    {
+        return saslMechanismLength;
+    }
+
+
     /**
      * Get a String representation of a BindRequest
      * 
@@ -432,22 +509,22 @@ public class BindRequestImpl extends Abs
             {
                 sb.append( "        Sasl credentials\n" );
                 sb.append( "            Mechanism :'" ).append( mechanism ).append( "'\n" );
-                
+
                 if ( credentials == null )
                 {
                     sb.append( "            Credentials : null" );
                 }
                 else
                 {
-                    sb.append( "            Credentials : '" ).
-                        append( StringTools.utf8ToString( credentials ) ).
-                        append( '/' ).
-                        append( StringTools.dumpBytes( credentials ) ).
-                        append( "'\n" );
+                    sb.append( "            Credentials : '" ).append( StringTools.utf8ToString( credentials ) )
+                        .append( '/' ).append( StringTools.dumpBytes( credentials ) ).append( "'\n" );
                 }
             }
         }
 
+        // The controls if any
+        sb.append( super.toString() );
+
         return sb.toString();
     }
 }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindResponseImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindResponseImpl.java?rev=987606&r1=987605&r2=987606&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindResponseImpl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindResponseImpl.java Fri Aug 20 19:23:27 2010
@@ -22,8 +22,6 @@ 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.InternalBindResponse;
 import org.apache.directory.shared.ldap.util.StringTools;
 
 
@@ -32,23 +30,33 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org"> Apache Directory Project</a>
  */
-public class BindResponseImpl extends InternalAbstractResultResponse implements InternalBindResponse
+public class BindResponseImpl extends AbstractResultResponse implements BindResponse
 {
     static final long serialVersionUID = -5146809476518669755L;
 
     /** optional property holding SASL authentication response parameters */
     private byte[] serverSaslCreds;
 
+    /** The encoded bindResponse length */
+    private int bindResponseLength;
+
 
     // ------------------------------------------------------------------------
     // Constructors
     // ------------------------------------------------------------------------
+    /**
+     * Creates a BindResponse as a reply to an BindRequest.
+     */
+    public BindResponseImpl()
+    {
+        super( -1, TYPE );
+    }
+
 
     /**
-     * Creates a Lockable AddResponse as a reply to an AddRequest.
+     * Creates a BindResponse as a reply to an BindRequest.
      * 
-     * @param id
-     *            the session unique message id
+     * @param id the session unique message id
      */
     public BindResponseImpl( final int id )
     {
@@ -135,7 +143,7 @@ public class BindResponseImpl extends In
             return true;
         }
 
-        if ( ( obj == null ) || !( obj instanceof InternalBindResponse ) )
+        if ( ( obj == null ) || !( obj instanceof BindResponse ) )
         {
             return false;
         }
@@ -145,7 +153,7 @@ public class BindResponseImpl extends In
             return false;
         }
 
-        InternalBindResponse response = ( InternalBindResponse ) obj;
+        BindResponse response = ( BindResponse ) obj;
         byte[] creds = response.getServerSaslCreds();
 
         if ( serverSaslCreds == null )
@@ -165,13 +173,33 @@ public class BindResponseImpl extends In
 
 
     /**
+     * Stores the encoded length for the BindResponse
+     * @param bindResponseLength The encoded length
+     */
+    /* No qualifier*/void setBindResponseLength( int bindResponseLength )
+    {
+        this.bindResponseLength = bindResponseLength;
+    }
+
+
+    /**
+     * @return The encoded BindResponse's length
+     */
+    /* No qualifier */int getBindResponseLength()
+    {
+        return bindResponseLength;
+    }
+
+
+    /**
      * Get a String representation of a BindResponse
      * 
      * @return A BindResponse String
      */
     public String toString()
     {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
+
         sb.append( "    BindResponse\n" );
         sb.append( super.toString() );
 
@@ -183,5 +211,4 @@ public class BindResponseImpl extends In
 
         return sb.toString();
     }
-
 }



Mime
View raw message