directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r986523 [2/6] - in /directory: apacheds/branches/apacheds-codec-merge/core-api/src/main/java/org/apache/directory/server/core/ apacheds/branches/apacheds-codec-merge/core-integ/src/test/java/org/apache/directory/server/core/operations/searc...
Date Tue, 17 Aug 2010 23:31:55 GMT
Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapTransformer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapTransformer.java?rev=986523&r1=986522&r2=986523&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapTransformer.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapTransformer.java Tue Aug 17 23:31:53 2010
@@ -33,9 +33,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.search.NotFilter;
 import org.apache.directory.shared.ldap.codec.search.OrFilter;
 import org.apache.directory.shared.ldap.codec.search.PresentFilter;
-import org.apache.directory.shared.ldap.codec.search.SearchRequestCodec;
 import org.apache.directory.shared.ldap.codec.search.SubstringFilter;
-import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.filter.AndNode;
 import org.apache.directory.shared.ldap.filter.ApproximateNode;
@@ -51,8 +49,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.filter.PresenceNode;
 import org.apache.directory.shared.ldap.filter.SimpleNode;
 import org.apache.directory.shared.ldap.filter.SubstringNode;
-import org.apache.directory.shared.ldap.message.AliasDerefMode;
-import org.apache.directory.shared.ldap.message.SearchRequestImpl;
 import org.apache.directory.shared.ldap.message.control.Control;
 import org.apache.directory.shared.ldap.message.internal.InternalMessage;
 import org.apache.directory.shared.ldap.schema.SchemaManager;
@@ -364,78 +360,6 @@ public class LdapTransformer
 
 
     /**
-     * Transform a SearchRequest message from a CodecMessage to a InternalMessage
-     * 
-     * @param searchRequest The message to transform
-     * @param messageId The message Id
-     * @return A Internal SearchRequestImpl
-     */
-    private static InternalMessage transformSearchRequest( SearchRequestCodec searchRequest, int messageId )
-    {
-        SearchRequestImpl internalMessage = new SearchRequestImpl( messageId );
-
-        // Codec : DN baseObject -> Internal : String baseDn
-        internalMessage.setBase( searchRequest.getBaseObject() );
-
-        // Codec : int scope -> Internal : ScopeEnum scope
-        internalMessage.setScope( searchRequest.getScope() );
-
-        // Codec : int derefAliases -> Internal : AliasDerefMode derefAliases
-        switch ( searchRequest.getDerefAliases() )
-        {
-            case LdapConstants.DEREF_ALWAYS:
-                internalMessage.setDerefAliases( AliasDerefMode.DEREF_ALWAYS );
-                break;
-
-            case LdapConstants.DEREF_FINDING_BASE_OBJ:
-                internalMessage.setDerefAliases( AliasDerefMode.DEREF_FINDING_BASE_OBJ );
-                break;
-
-            case LdapConstants.DEREF_IN_SEARCHING:
-                internalMessage.setDerefAliases( AliasDerefMode.DEREF_IN_SEARCHING );
-                break;
-
-            case LdapConstants.NEVER_DEREF_ALIASES:
-                internalMessage.setDerefAliases( AliasDerefMode.NEVER_DEREF_ALIASES );
-                break;
-        }
-
-        // Codec : int sizeLimit -> Internal : int sizeLimit
-        internalMessage.setSizeLimit( searchRequest.getSizeLimit() );
-
-        // Codec : int timeLimit -> Internal : int timeLimit
-        internalMessage.setTimeLimit( searchRequest.getTimeLimit() );
-
-        // Codec : boolean typesOnly -> Internal : boolean typesOnly
-        internalMessage.setTypesOnly( searchRequest.isTypesOnly() );
-
-        // Codec : Filter filter -> Internal : ExprNode filter
-        Filter codecFilter = searchRequest.getFilter();
-
-        internalMessage.setFilter( transformFilter( codecFilter ) );
-
-        // Codec : ArrayList attributes -> Internal : ArrayList attributes
-        if ( searchRequest.getAttributes() != null )
-        {
-            List<EntryAttribute> attributes = searchRequest.getAttributes();
-
-            if ( ( attributes != null ) && ( attributes.size() != 0 ) )
-            {
-                for ( EntryAttribute attribute : attributes )
-                {
-                    if ( attribute != null )
-                    {
-                        internalMessage.addAttribute( attribute.getId() );
-                    }
-                }
-            }
-        }
-
-        return internalMessage;
-    }
-
-
-    /**
      * Transform the Codec message to a internal message.
      * 
      * @param obj the object to transform
@@ -464,9 +388,6 @@ public class LdapTransformer
         switch ( messageType )
         {
             case SEARCH_REQUEST:
-                internalMessage = transformSearchRequest( ( SearchRequestCodec ) codecMessage, messageId );
-                break;
-
             case MODIFY_REQUEST:
             case MODIFYDN_REQUEST:
             case EXTENDED_REQUEST:

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/AttributeDescAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/AttributeDescAction.java?rev=986523&r1=986522&r2=986523&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/AttributeDescAction.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/AttributeDescAction.java Tue Aug 17 23:31:53 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.search.SearchRequestCodec;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchRequest;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -44,11 +44,13 @@ public class AttributeDescAction extends
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public AttributeDescAction()
     {
         super( "Store attribute description" );
     }
 
+
     /**
      * The initialization action
      */
@@ -56,7 +58,7 @@ public class AttributeDescAction extends
     {
         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
 
-        SearchRequestCodec searchRequest = ldapMessageContainer.getSearchRequest();
+        InternalSearchRequest searchRequest = ldapMessageContainer.getSearchRequest();
 
         TLV tlv = ldapMessageContainer.getCurrentTLV();
         String attributeDescription = null;
@@ -64,11 +66,11 @@ public class AttributeDescAction extends
         if ( tlv.getLength() != 0 )
         {
             attributeDescription = StringTools.utf8ToString( tlv.getValue().getData() );
-            
+
             // If the attributeDescription is empty, we won't add it
-            if ( !StringTools.isEmpty( attributeDescription.trim() ) ) 
+            if ( !StringTools.isEmpty( attributeDescription.trim() ) )
             {
-                searchRequest.addAttribute( attributeDescription );
+                searchRequest.addAttributes( attributeDescription );
             }
         }
 

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAndFilterAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAndFilterAction.java?rev=986523&r1=986522&r2=986523&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAndFilterAction.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAndFilterAction.java Tue Aug 17 23:31:53 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.AndFilter;
 import org.apache.directory.shared.ldap.codec.search.Filter;
-import org.apache.directory.shared.ldap.codec.search.SearchRequestCodec;
+import org.apache.directory.shared.ldap.message.SearchRequestImpl;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchRequest;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -46,18 +47,20 @@ public class InitAndFilterAction extends
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public InitAndFilterAction()
     {
         super( "Initialize AND filter" );
     }
 
+
     /**
      * The initialization action
      */
     public void action( IAsn1Container container ) throws DecoderException
     {
         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
-        
+
         TLV tlv = ldapMessageContainer.getCurrentTLV();
 
         if ( tlv.getLength() == 0 )
@@ -67,14 +70,14 @@ public class InitAndFilterAction extends
             throw new DecoderException( msg );
         }
 
-        SearchRequestCodec searchRequest = ldapMessageContainer.getSearchRequest();
+        InternalSearchRequest searchRequest = ldapMessageContainer.getSearchRequest();
 
         // We can allocate the SearchRequest
         Filter andFilter = new AndFilter( ldapMessageContainer.getTlvId() );
 
         // Set the filter
-        searchRequest.addCurrentFilter( andFilter );
-        
+        ( ( SearchRequestImpl ) searchRequest ).addCurrentFilter( andFilter );
+
         if ( IS_DEBUG )
         {
             log.debug( "Initialize AND filter" );

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitApproxMatchFilterAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitApproxMatchFilterAction.java?rev=986523&r1=986522&r2=986523&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitApproxMatchFilterAction.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitApproxMatchFilterAction.java Tue Aug 17 23:31:53 2010
@@ -27,7 +27,8 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.search.AttributeValueAssertionFilter;
 import org.apache.directory.shared.ldap.codec.search.Filter;
-import org.apache.directory.shared.ldap.codec.search.SearchRequestCodec;
+import org.apache.directory.shared.ldap.message.SearchRequestImpl;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchRequest;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -45,27 +46,28 @@ public class InitApproxMatchFilterAction
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public InitApproxMatchFilterAction()
     {
         super( "Init Approx Match filter Value" );
     }
 
+
     public void action( IAsn1Container container ) throws DecoderException
     {
         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
-        SearchRequestCodec searchRequest = ldapMessageContainer.getSearchRequest();
+        InternalSearchRequest searchRequest = ldapMessageContainer.getSearchRequest();
 
         // We can allocate the Attribute Value Assertion
-        Filter filter = new AttributeValueAssertionFilter( 
-            ldapMessageContainer.getTlvId(),
+        Filter filter = new AttributeValueAssertionFilter( ldapMessageContainer.getTlvId(),
             LdapConstants.APPROX_MATCH_FILTER );
 
-        searchRequest.addCurrentFilter( filter );
-        
+        ( ( SearchRequestImpl ) searchRequest ).addCurrentFilter( filter );
+
         // Store the filter structure that still has to be
-        // fullfiled
-        searchRequest.setTerminalFilter( filter );
-        
+        // fulfilled
+        ( ( SearchRequestImpl ) searchRequest ).setTerminalFilter( filter );
+
         if ( IS_DEBUG )
         {
             log.debug( "Initialize Approx Match filter" );

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAssertionValueFilterAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAssertionValueFilterAction.java?rev=986523&r1=986522&r2=986523&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAssertionValueFilterAction.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAssertionValueFilterAction.java Tue Aug 17 23:31:53 2010
@@ -27,10 +27,11 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.ldap.codec.AttributeValueAssertion;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.search.AttributeValueAssertionFilter;
-import org.apache.directory.shared.ldap.codec.search.SearchRequestCodec;
 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.SearchRequestImpl;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchRequest;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -49,18 +50,20 @@ public class InitAssertionValueFilterAct
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public InitAssertionValueFilterAction()
     {
         super( "Initialize Assertion Value filter" );
     }
 
+
     /**
      * The initialization action
      */
     public void action( IAsn1Container container ) throws DecoderException
     {
         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
-        SearchRequestCodec searchRequest = ldapMessageContainer.getSearchRequest();
+        InternalSearchRequest searchRequest = ldapMessageContainer.getSearchRequest();
 
         TLV tlv = ldapMessageContainer.getCurrentTLV();
 
@@ -76,7 +79,7 @@ public class InitAssertionValueFilterAct
             assertionValue = new BinaryValue( StringTools.EMPTY_BYTES );
         }
 
-        AttributeValueAssertionFilter terminalFilter = ( AttributeValueAssertionFilter ) searchRequest
+        AttributeValueAssertionFilter terminalFilter = ( AttributeValueAssertionFilter ) ( ( SearchRequestImpl ) searchRequest )
             .getTerminalFilter();
         AttributeValueAssertion assertion = terminalFilter.getAssertion();
 
@@ -90,7 +93,7 @@ public class InitAssertionValueFilterAct
             {
                 assertionValue = new BinaryValue( StringTools.EMPTY_BYTES );
             }
-            
+
             assertion.setAssertionValue( assertionValue );
         }
         else
@@ -103,13 +106,13 @@ public class InitAssertionValueFilterAct
             {
                 assertionValue = new StringValue( "" );
             }
-            
-            assertion.setAssertionValue(assertionValue );
+
+            assertion.setAssertionValue( assertionValue );
         }
 
         // 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/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAttributeDescFilterAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAttributeDescFilterAction.java?rev=986523&r1=986522&r2=986523&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAttributeDescFilterAction.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAttributeDescFilterAction.java Tue Aug 17 23:31:53 2010
@@ -28,7 +28,8 @@ import org.apache.directory.shared.i18n.
 import org.apache.directory.shared.ldap.codec.AttributeValueAssertion;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.search.AttributeValueAssertionFilter;
-import org.apache.directory.shared.ldap.codec.search.SearchRequestCodec;
+import org.apache.directory.shared.ldap.message.SearchRequestImpl;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchRequest;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -47,18 +48,20 @@ public class InitAttributeDescFilterActi
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public InitAttributeDescFilterAction()
     {
         super( "Initialize AttributeDesc filter" );
     }
 
+
     /**
      * The initialization action
      */
     public void action( IAsn1Container container ) throws DecoderException
     {
         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
-        SearchRequestCodec searchRequest = ldapMessageContainer.getSearchRequest();
+        InternalSearchRequest searchRequest = ldapMessageContainer.getSearchRequest();
 
         TLV tlv = ldapMessageContainer.getCurrentTLV();
 
@@ -75,11 +78,11 @@ public class InitAttributeDescFilterActi
             String type = StringTools.utf8ToString( tlv.getValue().getData() );
             assertion.setAttributeDesc( type );
 
-            AttributeValueAssertionFilter terminalFilter = ( AttributeValueAssertionFilter ) searchRequest
+            AttributeValueAssertionFilter terminalFilter = ( AttributeValueAssertionFilter ) ( ( SearchRequestImpl ) searchRequest )
                 .getTerminalFilter();
             terminalFilter.setAssertion( assertion );
         }
-        
+
         if ( IS_DEBUG )
         {
             log.debug( "Initialize AttributeDesc filter" );

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitEqualityMatchFilterAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitEqualityMatchFilterAction.java?rev=986523&r1=986522&r2=986523&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitEqualityMatchFilterAction.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitEqualityMatchFilterAction.java Tue Aug 17 23:31:53 2010
@@ -27,7 +27,8 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.search.AttributeValueAssertionFilter;
 import org.apache.directory.shared.ldap.codec.search.Filter;
-import org.apache.directory.shared.ldap.codec.search.SearchRequestCodec;
+import org.apache.directory.shared.ldap.message.SearchRequestImpl;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchRequest;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -45,30 +46,31 @@ public class InitEqualityMatchFilterActi
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public InitEqualityMatchFilterAction()
     {
         super( "Initialize Equality Match filter" );
     }
 
+
     /**
      * The initialization action
      */
     public void action( IAsn1Container container ) throws DecoderException
     {
         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
-        SearchRequestCodec searchRequest = ldapMessageContainer.getSearchRequest();
+        InternalSearchRequest searchRequest = ldapMessageContainer.getSearchRequest();
 
         // We can allocate the Attribute Value Assertion
-        Filter filter = new AttributeValueAssertionFilter( 
-            ldapMessageContainer.getTlvId(),
+        Filter filter = new AttributeValueAssertionFilter( ldapMessageContainer.getTlvId(),
             LdapConstants.EQUALITY_MATCH_FILTER );
 
-        searchRequest.addCurrentFilter( filter );
-        
+        ( ( SearchRequestImpl ) searchRequest ).addCurrentFilter( filter );
+
         // Store the filter structure that still has to be
-        // fullfiled
-        searchRequest.setTerminalFilter( filter );
-        
+        // fulfilled
+        ( ( SearchRequestImpl ) searchRequest ).setTerminalFilter( filter );
+
         if ( IS_DEBUG )
         {
             log.debug( "Initialize Equality Match filter" );

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitExtensibleMatchFilterAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitExtensibleMatchFilterAction.java?rev=986523&r1=986522&r2=986523&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitExtensibleMatchFilterAction.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitExtensibleMatchFilterAction.java Tue Aug 17 23:31:53 2010
@@ -26,7 +26,8 @@ import org.apache.directory.shared.asn1.
 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.Filter;
-import org.apache.directory.shared.ldap.codec.search.SearchRequestCodec;
+import org.apache.directory.shared.ldap.message.SearchRequestImpl;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchRequest;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -44,22 +45,24 @@ public class InitExtensibleMatchFilterAc
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public InitExtensibleMatchFilterAction()
     {
         super( "Init Extensible Match filter Value" );
     }
 
+
     public void action( IAsn1Container container ) throws DecoderException
     {
         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
-        SearchRequestCodec searchRequest = ldapMessageContainer.getSearchRequest();
+        InternalSearchRequest searchRequest = ldapMessageContainer.getSearchRequest();
 
         // We can allocate the ExtensibleMatch Filter
         Filter extensibleMatchFilter = new ExtensibleMatchFilter( ldapMessageContainer.getTlvId() );
 
-        searchRequest.addCurrentFilter( extensibleMatchFilter );
-        searchRequest.setTerminalFilter( extensibleMatchFilter );
-        
+        ( ( SearchRequestImpl ) searchRequest ).addCurrentFilter( extensibleMatchFilter );
+        ( ( SearchRequestImpl ) searchRequest ).setTerminalFilter( extensibleMatchFilter );
+
         if ( IS_DEBUG )
         {
             log.debug( "Initialize Extensible Match filter" );

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitGreaterOrEqualFilterAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitGreaterOrEqualFilterAction.java?rev=986523&r1=986522&r2=986523&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitGreaterOrEqualFilterAction.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitGreaterOrEqualFilterAction.java Tue Aug 17 23:31:53 2010
@@ -27,7 +27,8 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.search.AttributeValueAssertionFilter;
 import org.apache.directory.shared.ldap.codec.search.Filter;
-import org.apache.directory.shared.ldap.codec.search.SearchRequestCodec;
+import org.apache.directory.shared.ldap.message.SearchRequestImpl;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchRequest;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -45,30 +46,31 @@ public class InitGreaterOrEqualFilterAct
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public InitGreaterOrEqualFilterAction()
     {
         super( "Initialize Greater Or Equal filter" );
     }
 
+
     /**
      * The initialization action
      */
     public void action( IAsn1Container container ) throws DecoderException
     {
         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
-        SearchRequestCodec searchRequest = ldapMessageContainer.getSearchRequest();
+        InternalSearchRequest searchRequest = ldapMessageContainer.getSearchRequest();
 
         // We can allocate the Attribute Value Assertion
-        Filter filter = new AttributeValueAssertionFilter( 
-            ldapMessageContainer.getTlvId(),
+        Filter filter = new AttributeValueAssertionFilter( ldapMessageContainer.getTlvId(),
             LdapConstants.GREATER_OR_EQUAL_FILTER );
 
-        searchRequest.addCurrentFilter( filter );
-        
+        ( ( SearchRequestImpl ) searchRequest ).addCurrentFilter( filter );
+
         // Store the filter structure that still has to be
         // fullfiled
-        searchRequest.setTerminalFilter( filter );
-        
+        ( ( SearchRequestImpl ) searchRequest ).setTerminalFilter( filter );
+
         if ( IS_DEBUG )
         {
             log.debug( "Initialize Greater Or Equal filter" );

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitLessOrEqualFilterAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitLessOrEqualFilterAction.java?rev=986523&r1=986522&r2=986523&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitLessOrEqualFilterAction.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitLessOrEqualFilterAction.java Tue Aug 17 23:31:53 2010
@@ -27,7 +27,8 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.search.AttributeValueAssertionFilter;
 import org.apache.directory.shared.ldap.codec.search.Filter;
-import org.apache.directory.shared.ldap.codec.search.SearchRequestCodec;
+import org.apache.directory.shared.ldap.message.SearchRequestImpl;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchRequest;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -45,30 +46,31 @@ public class InitLessOrEqualFilterAction
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public InitLessOrEqualFilterAction()
     {
         super( "Initialize Less Or Equal filter" );
     }
 
+
     /**
      * The initialization action
      */
     public void action( IAsn1Container container ) throws DecoderException
     {
         LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
-        SearchRequestCodec searchRequest = ldapMessageContainer.getSearchRequest();
+        InternalSearchRequest searchRequest = ldapMessageContainer.getSearchRequest();
 
         // We can allocate the Attribute Value Assertion
-        Filter filter = new AttributeValueAssertionFilter( 
-            ldapMessageContainer.getTlvId(),
+        Filter filter = new AttributeValueAssertionFilter( ldapMessageContainer.getTlvId(),
             LdapConstants.LESS_OR_EQUAL_FILTER );
 
-        searchRequest.addCurrentFilter( filter );
-        
+        ( ( SearchRequestImpl ) searchRequest ).addCurrentFilter( filter );
+
         // Store the filter structure that still has to be
         // fullfiled
-        searchRequest.setTerminalFilter( filter );
-        
+        ( ( SearchRequestImpl ) searchRequest ).setTerminalFilter( filter );
+
         if ( IS_DEBUG )
         {
             log.debug( "Initialize Less Or Equal filter" );

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitNotFilterAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitNotFilterAction.java?rev=986523&r1=986522&r2=986523&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitNotFilterAction.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitNotFilterAction.java Tue Aug 17 23:31:53 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.NotFilter;
-import org.apache.directory.shared.ldap.codec.search.SearchRequestCodec;
+import org.apache.directory.shared.ldap.message.SearchRequestImpl;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchRequest;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -46,11 +47,13 @@ public class InitNotFilterAction extends
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public InitNotFilterAction()
     {
         super( "Initialize NOT filter" );
     }
 
+
     /**
      * The initialization action
      */
@@ -67,14 +70,14 @@ public class InitNotFilterAction extends
             throw new DecoderException( msg );
         }
 
-        SearchRequestCodec searchRequest = ldapMessageContainer.getSearchRequest();
+        InternalSearchRequest searchRequest = ldapMessageContainer.getSearchRequest();
 
         // We can allocate the SearchRequest
         Filter notFilter = new NotFilter( ldapMessageContainer.getTlvId() );
 
         // Set the filter
-        searchRequest.addCurrentFilter( notFilter );
-        
+        ( ( SearchRequestImpl ) searchRequest ).addCurrentFilter( notFilter );
+
         if ( IS_DEBUG )
         {
             log.debug( "Initialize NOT filter" );

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitOrFilterAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitOrFilterAction.java?rev=986523&r1=986522&r2=986523&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitOrFilterAction.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitOrFilterAction.java Tue Aug 17 23:31:53 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.SearchRequestImpl;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchRequest;
 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();
+        InternalSearchRequest 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/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitPresentFilterAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitPresentFilterAction.java?rev=986523&r1=986522&r2=986523&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitPresentFilterAction.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitPresentFilterAction.java Tue Aug 17 23:31:53 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.SearchRequestImpl;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchRequest;
 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();
+        InternalSearchRequest 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/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitSubstringsFilterAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitSubstringsFilterAction.java?rev=986523&r1=986522&r2=986523&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitSubstringsFilterAction.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitSubstringsFilterAction.java Tue Aug 17 23:31:53 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.SearchRequestImpl;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchRequest;
 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();
+        InternalSearchRequest 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/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreAnyAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreAnyAction.java?rev=986523&r1=986522&r2=986523&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreAnyAction.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreAnyAction.java Tue Aug 17 23:31:53 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.SearchRequestImpl;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchRequest;
 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();
+        InternalSearchRequest 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/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreFinalAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreFinalAction.java?rev=986523&r1=986522&r2=986523&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreFinalAction.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreFinalAction.java Tue Aug 17 23:31:53 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.SearchRequestImpl;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchRequest;
 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();
+        InternalSearchRequest 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/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreMatchValueAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreMatchValueAction.java?rev=986523&r1=986522&r2=986523&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreMatchValueAction.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreMatchValueAction.java Tue Aug 17 23:31:53 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.SearchRequestImpl;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchRequest;
 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();
+        InternalSearchRequest 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/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreTypeMatchingRuleAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreTypeMatchingRuleAction.java?rev=986523&r1=986522&r2=986523&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreTypeMatchingRuleAction.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreTypeMatchingRuleAction.java Tue Aug 17 23:31:53 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.SearchRequestImpl;
+import org.apache.directory.shared.ldap.message.internal.InternalSearchRequest;
 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();
+        InternalSearchRequest 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/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/Filter.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/Filter.java?rev=986523&r1=986522&r2=986523&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/Filter.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/Filter.java Tue Aug 17 23:31:53 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/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/PresentFilter.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/PresentFilter.java?rev=986523&r1=986522&r2=986523&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/PresentFilter.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/PresentFilter.java Tue Aug 17 23:31:53 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/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapProtocolEncoder.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapProtocolEncoder.java?rev=986523&r1=986522&r2=986523&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapProtocolEncoder.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapProtocolEncoder.java Tue Aug 17 23:31:53 2010
@@ -34,8 +34,6 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.util.Asn1StringUtils;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.codec.LdapConstants;
-import org.apache.directory.shared.ldap.codec.LdapMessageCodec;
-import org.apache.directory.shared.ldap.codec.LdapTransformer;
 import org.apache.directory.shared.ldap.codec.MessageEncoderException;
 import org.apache.directory.shared.ldap.codec.controls.CodecControl;
 import org.apache.directory.shared.ldap.entry.BinaryValue;
@@ -43,29 +41,9 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.message.control.Control;
-import org.apache.directory.shared.ldap.message.internal.AddResponse;
-import org.apache.directory.shared.ldap.message.internal.BindResponse;
-import org.apache.directory.shared.ldap.message.internal.CompareResponse;
-import org.apache.directory.shared.ldap.message.internal.DeleteResponse;
-import org.apache.directory.shared.ldap.message.internal.ExtendedResponse;
-import org.apache.directory.shared.ldap.message.internal.IntermediateResponse;
-import org.apache.directory.shared.ldap.message.internal.InternalAbandonRequest;
-import org.apache.directory.shared.ldap.message.internal.InternalAddRequest;
-import org.apache.directory.shared.ldap.message.internal.InternalBindRequest;
-import org.apache.directory.shared.ldap.message.internal.InternalCompareRequest;
-import org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest;
-import org.apache.directory.shared.ldap.message.internal.InternalExtendedRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalMessage;
-import org.apache.directory.shared.ldap.message.internal.InternalModifyDnRequest;
-import org.apache.directory.shared.ldap.message.internal.InternalModifyRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalReferral;
-import org.apache.directory.shared.ldap.message.internal.InternalUnbindRequest;
 import org.apache.directory.shared.ldap.message.internal.LdapResult;
-import org.apache.directory.shared.ldap.message.internal.ModifyDnResponse;
-import org.apache.directory.shared.ldap.message.internal.ModifyResponse;
-import org.apache.directory.shared.ldap.message.internal.SearchResultDone;
-import org.apache.directory.shared.ldap.message.internal.SearchResultEntry;
-import org.apache.directory.shared.ldap.message.internal.SearchResultReference;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.apache.mina.core.buffer.IoBuffer;
@@ -127,66 +105,48 @@ public class LdapProtocolEncoder extends
         int length = computeMessageLength( message );
         ByteBuffer buffer = ByteBuffer.allocate( length );
 
-        if ( ( message instanceof BindResponse ) || ( message instanceof DeleteResponse )
-            || ( message instanceof AddResponse ) || ( message instanceof CompareResponse )
-            || ( message instanceof ExtendedResponse ) || ( message instanceof ModifyResponse )
-            || ( message instanceof ModifyDnResponse ) || ( message instanceof IntermediateResponse )
-            || ( message instanceof SearchResultDone ) || ( message instanceof SearchResultEntry )
-            || ( message instanceof SearchResultReference ) || ( message instanceof InternalAbandonRequest )
-            || ( message instanceof InternalDeleteRequest ) || ( message instanceof InternalUnbindRequest )
-            || ( message instanceof InternalBindRequest ) || ( message instanceof InternalAddRequest )
-            || ( message instanceof InternalCompareRequest ) || ( message instanceof InternalExtendedRequest )
-            || ( message instanceof InternalModifyDnRequest ) || ( message instanceof InternalModifyRequest ) )
+        try
         {
             try
             {
-                try
-                {
-                    // The LdapMessage Sequence
-                    buffer.put( UniversalTag.SEQUENCE_TAG );
+                // The LdapMessage Sequence
+                buffer.put( UniversalTag.SEQUENCE_TAG );
 
-                    // The length has been calculated by the computeLength method
-                    buffer.put( TLV.getBytes( message.getMessageLength() ) );
-                }
-                catch ( BufferOverflowException boe )
-                {
-                    throw new EncoderException( I18n.err( I18n.ERR_04005 ) );
-                }
-
-                // The message Id
-                Value.encode( buffer, message.getMessageId() );
+                // The length has been calculated by the computeLength method
+                buffer.put( TLV.getBytes( message.getMessageLength() ) );
+            }
+            catch ( BufferOverflowException boe )
+            {
+                throw new EncoderException( I18n.err( I18n.ERR_04005 ) );
+            }
 
-                // Add the protocolOp part
-                encodeProtocolOp( buffer, message );
+            // The message Id
+            Value.encode( buffer, message.getMessageId() );
 
-                // Do the same thing for Controls, if any.
-                Map<String, Control> controls = message.getControls();
+            // Add the protocolOp part
+            encodeProtocolOp( buffer, message );
 
-                if ( ( controls != null ) && ( controls.size() > 0 ) )
-                {
-                    // Encode the controls
-                    buffer.put( ( byte ) LdapConstants.CONTROLS_TAG );
-                    buffer.put( TLV.getBytes( message.getControlsLength() ) );
+            // Do the same thing for Controls, if any.
+            Map<String, Control> controls = message.getControls();
 
-                    // Encode each control
-                    for ( Control control : controls.values() )
-                    {
-                        ( ( CodecControl ) control ).encode( buffer );
-                    }
-                }
-            }
-            catch ( EncoderException ee )
+            if ( ( controls != null ) && ( controls.size() > 0 ) )
             {
-                MessageEncoderException exception = new MessageEncoderException( message.getMessageId(), ee
-                    .getMessage() );
+                // Encode the controls
+                buffer.put( ( byte ) LdapConstants.CONTROLS_TAG );
+                buffer.put( TLV.getBytes( message.getControlsLength() ) );
 
-                throw exception;
+                // Encode each control
+                for ( Control control : controls.values() )
+                {
+                    ( ( CodecControl ) control ).encode( buffer );
+                }
             }
         }
-        else
+        catch ( EncoderException ee )
         {
-            LdapMessageCodec ldapRequest = ( LdapMessageCodec ) LdapTransformer.transform( message );
-            buffer = ldapRequest.encode();
+            MessageEncoderException exception = new MessageEncoderException( message.getMessageId(), ee.getMessage() );
+
+            throw exception;
         }
 
         buffer.flip();
@@ -684,7 +644,6 @@ public class LdapProtocolEncoder extends
         else
         {
             byte[] value = StringTools.getBytesUtf8( compareRequest.getAssertionValue().getString() );
-            int assertionValueLength = value.length;
             avaLength += 1 + TLV.getNbBytes( value.length ) + value.length;
             compareRequest.setAttrValBytes( value );
         }
@@ -1116,6 +1075,80 @@ public class LdapProtocolEncoder extends
 
 
     /**
+     * Compute the SearchRequest length
+     * 
+     * SearchRequest :
+     * <pre>
+     * 0x63 L1
+     *  |
+     *  +--> 0x04 L2 baseObject
+     *  +--> 0x0A 0x01 scope
+     *  +--> 0x0A 0x01 derefAliases
+     *  +--> 0x02 0x0(1..4) sizeLimit
+     *  +--> 0x02 0x0(1..4) timeLimit
+     *  +--> 0x01 0x01 typesOnly
+     *  +--> filter.computeLength()
+     *  +--> 0x30 L3 (Attribute description list)
+     *        |
+     *        +--> 0x04 L4-1 Attribute description 
+     *        +--> 0x04 L4-2 Attribute description 
+     *        +--> ... 
+     *        +--> 0x04 L4-i Attribute description 
+     *        +--> ... 
+     *        +--> 0x04 L4-n Attribute description 
+     *        </pre>
+     */
+    private int computeSearchRequestLength( SearchRequestImpl searchRequest )
+    {
+        int searchRequestLength = 0;
+
+        // The baseObject
+        searchRequestLength += 1 + TLV.getNbBytes( DN.getNbBytes( searchRequest.getBase() ) )
+            + DN.getNbBytes( searchRequest.getBase() );
+
+        // The scope
+        searchRequestLength += 1 + 1 + 1;
+
+        // The derefAliases
+        searchRequestLength += 1 + 1 + 1;
+
+        // The sizeLimit
+        searchRequestLength += 1 + 1 + Value.getNbBytes( searchRequest.getSizeLimit() );
+
+        // The timeLimit
+        searchRequestLength += 1 + 1 + Value.getNbBytes( searchRequest.getTimeLimit() );
+
+        // The typesOnly
+        searchRequestLength += 1 + 1 + 1;
+
+        // The filter
+        searchRequestLength += searchRequest.getCurrentFilter().computeLength();
+
+        // The attributes description list
+        int attributeDescriptionListLength = 0;
+
+        if ( ( searchRequest.getAttributes() != null ) && ( searchRequest.getAttributes().size() != 0 ) )
+        {
+            // Compute the attributes length
+            for ( String attribute : searchRequest.getAttributes() )
+            {
+                // add the attribute length to the attributes length
+                int idLength = StringTools.getBytesUtf8( attribute ).length;
+                attributeDescriptionListLength += 1 + TLV.getNbBytes( idLength ) + idLength;
+            }
+        }
+
+        searchRequest.setAttributeDescriptionListLength( attributeDescriptionListLength );
+
+        searchRequestLength += 1 + TLV.getNbBytes( attributeDescriptionListLength ) + attributeDescriptionListLength;
+
+        searchRequest.setSearchRequestLength( searchRequestLength );
+        // Return the result.
+        return 1 + TLV.getNbBytes( searchRequestLength ) + searchRequestLength;
+    }
+
+
+    /**
      * Compute the SearchResultDone length 
      * 
      * SearchResultDone : 
@@ -2083,6 +2116,77 @@ public class LdapProtocolEncoder extends
 
 
     /**
+     * Encode the SearchRequest message to a PDU.
+     * 
+     * SearchRequest :
+     * <pre>
+     * 0x63 LL
+     *   0x04 LL baseObject
+     *   0x0A 01 scope
+     *   0x0A 01 derefAliases
+     *   0x02 0N sizeLimit
+     *   0x02 0N timeLimit
+     *   0x01 0x01 typesOnly
+     *   filter.encode()
+     *   0x30 LL attributeDescriptionList
+     *     0x04 LL attributeDescription
+     *     ... 
+     *     0x04 LL attributeDescription
+     * </pre>
+     * @param buffer The buffer where to put the PDU
+     * @return The PDU.
+     */
+    private void encodeSearchRequest( ByteBuffer buffer, SearchRequestImpl searchRequest ) throws EncoderException
+    {
+        try
+        {
+            // The SearchRequest Tag
+            buffer.put( LdapConstants.SEARCH_REQUEST_TAG );
+            buffer.put( TLV.getBytes( searchRequest.getSearchRequestLength() ) );
+
+            // The baseObject
+            Value.encode( buffer, DN.getBytes( searchRequest.getBase() ) );
+
+            // The scope
+            Value.encodeEnumerated( buffer, searchRequest.getScope().getScope() );
+
+            // The derefAliases
+            Value.encodeEnumerated( buffer, searchRequest.getDerefAliases().getValue() );
+
+            // The sizeLimit
+            Value.encode( buffer, searchRequest.getSizeLimit() );
+
+            // The timeLimit
+            Value.encode( buffer, searchRequest.getTimeLimit() );
+
+            // The typesOnly
+            Value.encode( buffer, searchRequest.getTypesOnly() );
+
+            // The filter
+            searchRequest.getCurrentFilter().encode( buffer );
+
+            // The attributeDescriptionList
+            buffer.put( UniversalTag.SEQUENCE_TAG );
+            buffer.put( TLV.getBytes( searchRequest.getAttributeDescriptionListLength() ) );
+
+            if ( ( searchRequest.getAttributes() != null ) && ( searchRequest.getAttributes().size() != 0 ) )
+            {
+                // encode each attribute
+                for ( String attribute : searchRequest.getAttributes() )
+                {
+                    Value.encode( buffer, attribute );
+                }
+            }
+        }
+        catch ( BufferOverflowException boe )
+        {
+            throw new EncoderException( I18n.err( I18n.ERR_04005 ) );
+        }
+
+    }
+
+
+    /**
      * Encode the SearchResultDone message to a PDU.
      * 
      * @param buffer The buffer where to put the PDU
@@ -2230,7 +2334,7 @@ public class LdapProtocolEncoder extends
      * @param buffer The buffer where to put the PDU
      * @return The PDU.
      */
-    protected void encodeSearchResultReference( ByteBuffer buffer, SearchResultReferenceImpl searchResultReference )
+    private void encodeSearchResultReference( ByteBuffer buffer, SearchResultReferenceImpl searchResultReference )
         throws EncoderException
     {
         try
@@ -2314,6 +2418,9 @@ public class LdapProtocolEncoder extends
             case MODIFYDN_RESPONSE:
                 return computeModifyDnResponseLength( ( ModifyDnResponseImpl ) message );
 
+            case SEARCH_REQUEST:
+                return computeSearchRequestLength( ( SearchRequestImpl ) message );
+
             case SEARCH_RESULT_DONE:
                 return computeSearchResultDoneLength( ( SearchResultDoneImpl ) message );
 
@@ -2400,6 +2507,10 @@ public class LdapProtocolEncoder extends
                 encodeModifyDnResponse( bb, ( ModifyDnResponseImpl ) message );
                 break;
 
+            case SEARCH_REQUEST:
+                encodeSearchRequest( bb, ( SearchRequestImpl ) message );
+                break;
+
             case SEARCH_RESULT_DONE:
                 encodeSearchResultDone( bb, ( SearchResultDoneImpl ) message );
                 break;



Mime
View raw message