directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r427198 [2/2] - in /directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec: ./ abandon/ add/ bind/ compare/ del/ extended/ extended/operations/ modify/ modifyDn/ search/ search/controls/
Date Mon, 31 Jul 2006 18:44:07 GMT
Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchRequest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchRequest.java?rev=427198&r1=427197&r2=427198&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchRequest.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchRequest.java
Mon Jul 31 11:44:03 2006
@@ -17,12 +17,17 @@
 package org.apache.directory.shared.ldap.codec.search;
 
 
+import org.apache.directory.shared.asn1.Asn1Object;
+import org.apache.directory.shared.asn1.ber.IAsn1Container;
 import org.apache.directory.shared.asn1.ber.tlv.Length;
+import org.apache.directory.shared.asn1.ber.tlv.TLV;
 import org.apache.directory.shared.asn1.ber.tlv.UniversalTag;
 import org.apache.directory.shared.asn1.ber.tlv.Value;
+import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.asn1.codec.EncoderException;
 import org.apache.directory.shared.ldap.codec.LdapConstants;
 import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.util.LdapString;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -80,13 +85,16 @@
 
     /** The filter tree */
     private Filter filter;
-
+    
     /** The list of attributes to get */
     private Attributes attributes;
 
     /** The current filter. This is used while decoding a PDU */
     private transient Filter currentFilter;
 
+    /** A temporary storage for a terminal Filter */
+    private transient Filter terminalFilter;
+    
     /** The searchRequest length */
     private transient int searchRequestLength;
 
@@ -317,6 +325,62 @@
         return currentFilter;
     }
 
+    /**
+     * Get the comparison dilter
+     * 
+     * @return Returns the comparisonFilter.
+     */
+    public Filter getTerminalFilter()
+    {
+        return terminalFilter;
+    }
+
+    /**
+     * Set the terminal filter
+     * 
+     * @param terminalFilter the teminalFilter.
+     */
+    public void setTerminalFilter( Filter terminalFilter )
+    {
+        this.terminalFilter = terminalFilter;
+    }
+
+
+    /**
+     * Add a current filter. We have two cases :
+     * - there is no previous current filter : the filter
+     * is the top level filter
+     * - there is a previous current filter : the filter is added 
+     * to the currentFilter set, and the current filter is changed
+     * 
+     * In any case, the previous current filter will always be a
+     * ConnectorFilter when this method is called.
+     * 
+     * @param currentFilter
+     *            The currentFilter to set.
+     */
+    public void addCurrentFilter( Filter filter ) throws DecoderException
+    {
+        if ( currentFilter != null )
+        {
+            // Ok, we have a parent. The new Filter will be added to
+            // this parent, and will become the currentFilter if it's a connector.
+            ( ( ConnectorFilter ) currentFilter ).addFilter( filter );
+            filter.setParent( currentFilter );
+            
+            if ( filter instanceof ConnectorFilter )
+            {
+                currentFilter = filter;
+            }
+        }
+        else
+        {
+            // No parent. This Filter will become the root.
+            currentFilter = filter;
+            currentFilter.setParent( this );
+            this.filter = filter;
+        }
+    }
 
     /**
      * Set the current dilter
@@ -324,11 +388,88 @@
      * @param currentFilter
      *            The currentFilter to set.
      */
-    public void setCurrentFilter( Filter currentFilter )
+    public void setCurrentFilter( Filter filter ) throws DecoderException
     {
-        this.currentFilter = currentFilter;
+        currentFilter = filter;
     }
 
+
+    /**
+     * 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
+     */
+    public void unstackFilters( IAsn1Container container ) throws DecoderException
+    {
+        LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
+        //LdapMessage ldapMessage = ldapMessageContainer.getLdapMessage();
+        //SearchRequest searchRequest = ldapMessage.getSearchRequest();
+
+        TLV tlv = ldapMessageContainer.getCurrentTLV();
+        TLV parent = tlv.getParent();
+        Filter filter = terminalFilter;
+
+        // The parent has been completed, so fold it
+        while ( ( parent != null ) && ( parent.getExpectedLength() == 0 ) )
+        {
+            Asn1Object filterParent = filter.getParent();
+            
+            // We have a special case with PresentFilter, which has not been 
+            // pushed on the stack, so we need to get its parent's parent
+            if ( filter instanceof PresentFilter )
+            {
+                filterParent = filterParent.getParent();
+            }
+
+            if ( filterParent instanceof Filter )
+            {
+                // The parent is a filter ; it will become the new currentFilter
+                // and we will loop again. 
+                currentFilter = (Filter)filterParent;
+                filter = currentFilter;
+                parent = parent.getParent();
+            }
+            else
+            {
+                // We can stop the recursion, we have reached the searchResult Object
+                break;
+            }
+            
+            /*
+            if ( filterParent instanceof Filter )
+            {
+                // The terminalfilter set has been completed
+                // we can get its parent and add the terminal to it
+                // but onlyu if it's not a connector filter
+                if ( ! (filter instanceof ConnectorFilter ) )
+                {
+                    addCurrentFilter( filter );
+                }
+                
+                // and update the current filter with the parent
+                Asn1Object parentFilter = currentFilter.getParent();
+                
+                if ( parentFilter instanceof Filter )
+                {
+                    searchRequest.setCurrentFilter( (Filter)parentFilter );
+                }
+                
+                parent = parent.getParent();
+                filter = currentFilter;
+            }
+            else
+            {
+                // We have reached the top level, we can stop
+                // the loop after having updated the currentFilter
+                //searchRequest.setCurrentFilter( filter );
+                break;
+            }
+            */
+        }
+    }
 
     /**
      * Compute the SearchRequest length SearchRequest : 0x63 L1 | +--> 0x04 L2

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchRequestGrammar.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchRequestGrammar.java?rev=427198&r1=427197&r2=427198&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchRequestGrammar.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchRequestGrammar.java
Mon Jul 31 11:44:03 2006
@@ -60,6 +60,9 @@
     /** The logger */
     private static final Logger log = LoggerFactory.getLogger( SearchRequestGrammar.class
);
 
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+
     /** The instance of grammar. SearchRequestGrammar is a singleton */
     private static IGrammar instance = new SearchRequestGrammar();
 
@@ -209,7 +212,7 @@
 
                     searchRequest.setScope( scope );
 
-                    if ( log.isDebugEnabled() )
+                    if ( IS_DEBUG )
                     {
                         switch ( scope )
                         {
@@ -282,7 +285,7 @@
 
                     searchRequest.setDerefAliases( derefAliases );
 
-                    if ( log.isDebugEnabled() )
+                    if ( IS_DEBUG )
                     {
                         switch ( derefAliases )
                         {
@@ -350,7 +353,7 @@
 
                     searchRequest.setSizeLimit( sizeLimit );
 
-                    if ( log.isDebugEnabled() )
+                    if ( IS_DEBUG )
                     {
                         log.debug( "The sizeLimit value is set to {} objects", new Integer(
sizeLimit ) );
                     }
@@ -403,7 +406,7 @@
 
                     searchRequest.setTimeLimit( timeLimit );
 
-                    if ( log.isDebugEnabled() )
+                    if ( IS_DEBUG )
                     {
                         log.debug( "The timeLimit value is set to {} seconds", new Integer(
timeLimit ) );
                     }
@@ -461,7 +464,7 @@
                         throw new DecoderException( bde.getMessage() );
                     }
 
-                    if ( log.isDebugEnabled() )
+                    if ( IS_DEBUG )
                     {
                         log.debug( "The search will return {}", ( searchRequest.isTypesOnly()
? "only attributs type"
                             : "attributes types and values" ) );
@@ -682,7 +685,7 @@
                     // We can have a pop transition
                     ldapMessageContainer.grammarPopAllowed( true );
 
-                    if ( log.isDebugEnabled() )
+                    if ( IS_DEBUG )
                     {
                         log.debug( "Decoded Attribute Description : {}", attributeDescription.getString()
);
                     }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntry.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntry.java?rev=427198&r1=427197&r2=427198&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntry.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntry.java
Mon Jul 31 11:44:03 2006
@@ -42,13 +42,22 @@
 
 
 /**
- * A SearchResultEntry Message. Its syntax is : SearchResultEntry ::=
- * [APPLICATION 4] SEQUENCE { objectName LDAPDN, attributes PartialAttributeList }
- * PartialAttributeList ::= SEQUENCE OF SEQUENCE { type AttributeDescription,
- * vals SET OF AttributeValue } AttributeDescription ::= LDAPString
- * AttributeValue ::= OCTET STRING It contains an entry, with all its
- * attributes, and all the attributes values. If a search request is submited,
- * all the results are sent one by one, followed by a searchResultDone message.
+ * A SearchResultEntry Message. Its syntax is :
+ *   SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
+ *       objectName      LDAPDN,
+ *       attributes      PartialAttributeList }
+ * 
+ *   PartialAttributeList ::= SEQUENCE OF SEQUENCE {
+ *       type    AttributeDescription,
+ *       vals    SET OF AttributeValue }
+ * 
+ *   AttributeDescription ::= LDAPString
+ * 
+ *   AttributeValue ::= OCTET STRING
+ * 
+ * It contains an entry, with all its attributes, and all the attributes
+ * values. If a search request is submited, all the results are sent one
+ * by one, followed by a searchResultDone message.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
@@ -176,15 +185,44 @@
 
 
     /**
-     * Compute the SearchResultEntry length SearchResultEntry : 0x64 L1 | +-->
-     * 0x04 L2 objectName +--> 0x30 L3 (attributes) | +--> 0x30 L4-1 (partial
-     * attributes list) | | | +--> 0x04 L5-1 type | +--> 0x31 L6-1 (values) | | |
-     * +--> 0x04 L7-1-1 value | +--> ... | +--> 0x04 L7-1-n value | +--> 0x30
-     * L4-2 (partial attributes list) | | | +--> 0x04 L5-2 type | +--> 0x31 L6-2
-     * (values) | | | +--> 0x04 L7-2-1 value | +--> ... | +--> 0x04 L7-2-n value
|
-     * +--> ... | +--> 0x30 L4-m (partial attributes list) | +--> 0x04 L5-m type
-     * +--> 0x31 L6-m (values) | +--> 0x04 L7-m-1 value +--> ... +--> 0x04
-     * L7-m-n value
+     * Compute the SearchResultEntry length
+     * 
+     * SearchResultEntry :
+     * 
+     * 0x64 L1
+     *  |
+     *  +--> 0x04 L2 objectName
+     *  +--> 0x30 L3 (attributes)
+     *        |
+     *        +--> 0x30 L4-1 (partial attributes list)
+     *        |     |
+     *        |     +--> 0x04 L5-1 type
+     *        |     +--> 0x31 L6-1 (values)
+     *        |           |
+     *        |           +--> 0x04 L7-1-1 value
+     *        |           +--> ...
+     *        |           +--> 0x04 L7-1-n value
+     *        |
+     *        +--> 0x30 L4-2 (partial attributes list)
+     *        |     |
+     *        |     +--> 0x04 L5-2 type
+     *        |     +--> 0x31 L6-2 (values)
+     *        |           |
+     *        |           +--> 0x04 L7-2-1 value
+     *        |           +--> ...
+     *        |           +--> 0x04 L7-2-n value
+     *        |
+     *        +--> ...
+     *        |
+     *        +--> 0x30 L4-m (partial attributes list)
+     *              |
+     *              +--> 0x04 L5-m type
+     *              +--> 0x31 L6-m (values)
+     *                    |
+     *                    +--> 0x04 L7-m-1 value
+     *                    +--> ...
+     *                    +--> 0x04 L7-m-n value
+     * 
      */
     public int computeLength()
     {
@@ -284,14 +322,28 @@
 
 
     /**
-     * Encode the SearchResultEntry message to a PDU. SearchResultEntry : 0x64
-     * LL 0x04 LL objectName 0x30 LL attributes 0x30 LL partialAttributeList
-     * 0x04 LL type 0x31 LL vals 0x04 LL attributeValue ... 0x04 LL
-     * attributeValue ... 0x30 LL partialAttributeList 0x04 LL type 0x31 LL vals
-     * 0x04 LL attributeValue ... 0x04 LL attributeValue
+     * Encode the SearchResultEntry message to a PDU.
+     * 
+     * SearchResultEntry :
+     * 
+     * 0x64 LL
+     *   0x04 LL objectName
+     *   0x30 LL attributes
+     *     0x30 LL partialAttributeList
+     *       0x04 LL type
+     *       0x31 LL vals
+     *         0x04 LL attributeValue
+     *         ... 
+     *         0x04 LL attributeValue
+     *     ... 
+     *     0x30 LL partialAttributeList
+     *       0x04 LL type
+     *       0x31 LL vals
+     *         0x04 LL attributeValue
+     *         ... 
+     *         0x04 LL attributeValue 
      * 
-     * @param buffer
-     *            The buffer where to put the PDU
+     * @param buffer The buffer where to put the PDU
      * @return The PDU.
      */
     public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryGrammar.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryGrammar.java?rev=427198&r1=427197&r2=427198&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryGrammar.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryGrammar.java
Mon Jul 31 11:44:03 2006
@@ -58,6 +58,9 @@
     /** The logger */
     private static final Logger log = LoggerFactory.getLogger( SearchResultEntryGrammar.class
);
 
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+
     /** The instance of grammar. SearchResultEntryGrammar is a singleton */
     private static IGrammar instance = new SearchResultEntryGrammar();
 
@@ -155,7 +158,7 @@
                         searchResultEntry.setObjectName( objectName );
                     }
 
-                    if ( log.isDebugEnabled() )
+                    if ( IS_DEBUG )
                     {
                         log.debug( "Search Result Entry DN found : {}", searchResultEntry.getObjectName()
);
                     }
@@ -330,7 +333,7 @@
                         {
                             value = tlv.getValue().getData();
 
-                            if ( log.isDebugEnabled() )
+                            if ( IS_DEBUG )
                             {
                                 log.debug( "Attribute value {}", StringTools.dumpBytes( (
byte[] ) value ) );
                             }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SubstringFilterGrammar.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SubstringFilterGrammar.java?rev=427198&r1=427197&r2=427198&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SubstringFilterGrammar.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SubstringFilterGrammar.java
Mon Jul 31 11:44:03 2006
@@ -109,25 +109,8 @@
                     // We can allocate the SearchRequest
                     Filter substringFilter = new SubstringFilter();
 
-                    // Get the parent, if any
-                    Filter currentFilter = searchRequest.getCurrentFilter();
-
-                    if ( currentFilter != null )
-                    {
-                        // Ok, we have a parent. The new Filter will be added to
-                        // this parent, then.
-                        ( ( ConnectorFilter ) currentFilter ).addFilter( substringFilter
);
-                        substringFilter.setParent( currentFilter );
-                    }
-                    else
-                    {
-                        // No parent. This Filter will become the root.
-
-                        searchRequest.setFilter( substringFilter );
-                        substringFilter.setParent( searchRequest );
-                    }
-
-                    searchRequest.setCurrentFilter( substringFilter );
+                    searchRequest.addCurrentFilter( substringFilter );
+                    searchRequest.setTerminalFilter( substringFilter );
 
                     // As this is a new Constructed object, we have to init its
                     // length
@@ -162,7 +145,7 @@
                     TLV tlv = ldapMessageContainer.getCurrentTLV();
 
                     // Store the value.
-                    SubstringFilter substringFilter = ( SubstringFilter ) searchRequest.getCurrentFilter();
+                    SubstringFilter substringFilter = ( SubstringFilter ) searchRequest.getTerminalFilter();
 
                     if ( tlv.getLength().getLength() == 0 )
                     {
@@ -186,7 +169,7 @@
 
                         // We now have to get back to the nearest filter which
                         // is not terminal.
-                        unstackFilters( container );
+                        searchRequest.setTerminalFilter( substringFilter );
                     }
                 }
             } );
@@ -261,7 +244,7 @@
                     TLV tlv = ldapMessageContainer.getCurrentTLV();
 
                     // Store the value.
-                    SubstringFilter substringFilter = ( SubstringFilter ) searchRequest.getCurrentFilter();
+                    SubstringFilter substringFilter = ( SubstringFilter ) searchRequest.getTerminalFilter();
 
                     if ( tlv.getLength().getLength() == 0 )
                     {
@@ -283,7 +266,7 @@
 
                     // We now have to get back to the nearest filter which is
                     // not terminal.
-                    unstackFilters( container );
+                    searchRequest.unstackFilters( container );
 
                     // We can have a pop transition
                     container.grammarPopAllowed( true );
@@ -336,7 +319,7 @@
                     TLV tlv = ldapMessageContainer.getCurrentTLV();
 
                     // Store the value.
-                    SubstringFilter substringFilter = ( SubstringFilter ) searchRequest.getCurrentFilter();
+                    SubstringFilter substringFilter = ( SubstringFilter ) searchRequest.getTerminalFilter();
 
                     if ( tlv.getLength().getLength() == 0 )
                     {
@@ -357,7 +340,7 @@
 
                     // We now have to get back to the nearest filter which is
                     // not terminal.
-                    unstackFilters( container );
+                    searchRequest.unstackFilters( container );
 
                     // We can have a pop transition
                     container.grammarPopAllowed( true );
@@ -412,7 +395,7 @@
                     TLV tlv = ldapMessageContainer.getCurrentTLV();
 
                     // Store the value.
-                    SubstringFilter substringFilter = ( SubstringFilter ) searchRequest.getCurrentFilter();
+                    SubstringFilter substringFilter = ( SubstringFilter ) searchRequest.getTerminalFilter();
 
                     if ( tlv.getLength().getLength() == 0 )
                     {
@@ -434,12 +417,12 @@
 
                     // We now have to get back to the nearest filter which is
                     // not terminal.
-                    unstackFilters( container );
+                    searchRequest.unstackFilters( container );
+
                     // We can have a pop transition
                     container.grammarPopAllowed( true );
                 }
             } );
-
     }
 
 
@@ -454,51 +437,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 );
-        }
     }
 }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlGrammar.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlGrammar.java?rev=427198&r1=427197&r2=427198&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlGrammar.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlGrammar.java
Mon Jul 31 11:44:03 2006
@@ -46,6 +46,9 @@
     /** The logger */
     private static final Logger log = LoggerFactory.getLogger( EntryChangeControlGrammar.class
);
 
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+
     /** The instance of grammar. EntryChangeControlGrammar is a singleton */
     private static IGrammar instance = new EntryChangeControlGrammar();
 
@@ -128,7 +131,7 @@
                         case ChangeType.MODIFY_VALUE:
                             ChangeType changeType = ChangeType.getChangeType( change );
 
-                            if ( log.isDebugEnabled() )
+                            if ( IS_DEBUG )
                             {
                                 log.debug( "changeType = " + changeType );
                             }
@@ -212,7 +215,7 @@
                         throw new DecoderException( "failed to decode the previous DN" );
                     }
 
-                    if ( log.isDebugEnabled() )
+                    if ( IS_DEBUG )
                     {
                         log.debug( "previousDN = " + previousDn );
                     }
@@ -277,7 +280,7 @@
                 {
                     int changeNumber = IntegerDecoder.parse( value );
 
-                    if ( log.isDebugEnabled() )
+                    if ( IS_DEBUG )
                     {
                         log.debug( "changeNumber = " + changeNumber );
                     }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControl.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControl.java?rev=427198&r1=427197&r2=427198&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControl.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControl.java
Mon Jul 31 11:44:03 2006
@@ -1,3 +1,19 @@
+/*
+ *   Copyright 2006 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
 package org.apache.directory.shared.ldap.codec.search.controls;
 
 

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlGrammar.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlGrammar.java?rev=427198&r1=427197&r2=427198&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlGrammar.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlGrammar.java
Mon Jul 31 11:44:03 2006
@@ -45,6 +45,9 @@
     /** The logger */
     private static final Logger log = LoggerFactory.getLogger( PSearchControlGrammar.class
);
 
+    /** Speedup for logs */
+    private static final boolean IS_DEBUG = log.isDebugEnabled();
+
     /** The instance of grammar. PSearchControlGrammar is a singleton */
     private static IGrammar instance = new PSearchControlGrammar();
 
@@ -91,7 +94,7 @@
                     {
                         int changeTypes = IntegerDecoder.parse( value );
 
-                        if ( log.isDebugEnabled() )
+                        if ( IS_DEBUG )
                         {
                             log.debug( "changeTypes = " + changeTypes );
                         }
@@ -123,7 +126,7 @@
                     {
                         boolean changesOnly = BooleanDecoder.parse( value );
 
-                        if ( log.isDebugEnabled() )
+                        if ( IS_DEBUG )
                         {
                             log.debug( "changesOnly = " + changesOnly );
                         }
@@ -155,7 +158,7 @@
                     {
                         boolean returnECs = BooleanDecoder.parse( value );
 
-                        if ( log.isDebugEnabled() )
+                        if ( IS_DEBUG )
                         {
                             log.debug( "returnECs = " + returnECs );
                         }



Mime
View raw message