directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r421732 - /directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/MatchingRuleAssertionGrammar.java
Date Thu, 13 Jul 2006 23:32:42 GMT
Author: elecharny
Date: Thu Jul 13 16:32:41 2006
New Revision: 421732

URL: http://svn.apache.org/viewvc?rev=421732&view=rev
Log:
- renamed compareFilterAction to terminalFilterAction
- call addCurrentFilter instead of setCurrentFilter
- call unstackFilters into the MatchingRuleAssertion
- moved unstackFilters to SearchRequest class

Modified:
    directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/MatchingRuleAssertionGrammar.java

Modified: directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/MatchingRuleAssertionGrammar.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/MatchingRuleAssertionGrammar.java?rev=421732&r1=421731&r2=421732&view=diff
==============================================================================
--- directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/MatchingRuleAssertionGrammar.java
(original)
+++ directory/branches/shared/optimization/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/MatchingRuleAssertionGrammar.java
Thu Jul 13 16:32:41 2006
@@ -116,11 +116,8 @@
                         extensibleMatchFilter.setParent( searchRequest );
                     }
 
-                    searchRequest.setCurrentFilter( extensibleMatchFilter );
-
-                    // We now have to get back to the nearest filter which is
-                    // not terminal.
-                    unstackFilters( container );
+                    searchRequest.addCurrentFilter( extensibleMatchFilter );
+                    searchRequest.setTerminalFilter( extensibleMatchFilter );
                 }
             } );
 
@@ -151,7 +148,7 @@
 
                     // Store the value.
                     ExtensibleMatchFilter extensibleMatchFilter = ( ExtensibleMatchFilter
) searchRequest
-                        .getCurrentFilter();
+                        .getTerminalFilter();
 
                     if ( tlv.getLength().getLength() == 0 )
                     {
@@ -219,7 +216,7 @@
                     {
                         // Store the value.
                         ExtensibleMatchFilter extensibleMatchFilter = ( ExtensibleMatchFilter
) searchRequest
-                            .getCurrentFilter();
+                            .getTerminalFilter();
 
                         try
                         {
@@ -266,7 +263,7 @@
             LdapStatesEnum.MATCHING_RULE_ASSERTION_DN_ATTRIBUTES_TAG, new GrammarAction(
                 "Store matching match value Value" )
             {
-                public void action( IAsn1Container container )
+                public void action( IAsn1Container container ) throws DecoderException
                 {
                     LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer )
container;
                     LdapMessage ldapMessage = ldapMessageContainer.getLdapMessage();
@@ -276,9 +273,12 @@
 
                     // Store the value.
                     ExtensibleMatchFilter extensibleMatchFilter = ( ExtensibleMatchFilter
) searchRequest
-                        .getCurrentFilter();
+                        .getTerminalFilter();
                     extensibleMatchFilter.setMatchValue( StringTools.utf8ToString( tlv.getValue().getData()
) );
 
+                    // unstack the filters if needed
+                    searchRequest.unstackFilters( container );
+                    
                     // We can have a pop transition
                     ldapMessageContainer.grammarPopAllowed( true );
                 }
@@ -310,7 +310,7 @@
 
                     // Store the value.
                     ExtensibleMatchFilter extensibleMatchFilter = ( ExtensibleMatchFilter
) searchRequest
-                        .getCurrentFilter();
+                        .getTerminalFilter();
 
                     // We get the value. If it's a 0, it's a FALSE. If it's
                     // a FF, it's a TRUE. Any other value should be an error,
@@ -336,6 +336,9 @@
                     {
                         log.debug( "DN Attributes : {}", new Boolean( extensibleMatchFilter.isDnAttributes()
) );
                     }
+                    
+                    // unstack the filters if needed
+                    searchRequest.unstackFilters( ldapMessageContainer );
 
                     // We can have a pop transition
                     ldapMessageContainer.grammarPopAllowed( true );
@@ -355,51 +358,5 @@
     public static IGrammar getInstance()
     {
         return instance;
-    }
-
-
-    /**
-     * This method is used to clear the filter's stack for terminated elements.
-     * An element is considered as terminated either if : - it's a final element
-     * (ie an element which cannot contains a Filter) - its current length
-     * equals its expected length.
-     * 
-     * @param container
-     *            The container being decoded
-     */
-    private void unstackFilters( IAsn1Container container )
-    {
-        LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
-        LdapMessage ldapMessage = ldapMessageContainer.getLdapMessage();
-        SearchRequest searchRequest = ldapMessage.getSearchRequest();
-
-        TLV tlv = ldapMessageContainer.getCurrentTLV();
-
-        // Get the parent, if any
-        Filter currentFilter = searchRequest.getCurrentFilter();
-
-        // We know have to check if the parent has been completed
-        if ( tlv.getParent().getExpectedLength() == 0 )
-        {
-            TLV parent = tlv.getParent();
-
-            // The parent has been completed, we have to switch it
-            while ( ( parent != null ) && ( parent.getExpectedLength() == 0 ) )
-            {
-                parent = parent.getParent();
-
-                if ( ( currentFilter != null ) && ( currentFilter.getParent() instanceof
Filter ) )
-                {
-                    currentFilter = ( Filter ) currentFilter.getParent();
-                }
-                else
-                {
-                    currentFilter = null;
-                    break;
-                }
-            }
-
-            searchRequest.setCurrentFilter( currentFilter );
-        }
     }
 }



Mime
View raw message