directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r452497 [1/9] - in /directory/trunks/shared/ldap/src: main/java/org/apache/directory/shared/ldap/codec/ main/java/org/apache/directory/shared/ldap/codec/abandon/ main/java/org/apache/directory/shared/ldap/codec/add/ main/java/org/apache/dir...
Date Tue, 03 Oct 2006 13:49:46 GMT
Author: elecharny
Date: Tue Oct  3 06:49:43 2006
New Revision: 452497

URL: http://svn.apache.org/viewvc?view=rev&rev=452497
Log:
Injected the modification done in 1.0 branch into the trunk

Modified:
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/AttributeValueAssertion.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/Control.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ControlDecoder.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapConstants.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessage.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapResponse.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapResult.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapStatesEnum.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ResponseCarryingException.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixDecoder.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixEncoder.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/abandon/AbandonRequest.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/add/AddRequest.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/add/AddResponse.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/BindRequest.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/BindResponse.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/SaslCredentials.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/SimpleAuthentication.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/compare/CompareRequest.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/compare/CompareResponse.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/del/DelRequest.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/del/DelResponse.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/ExtendedRequest.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/ExtendedResponse.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulAction.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnect.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnectContainer.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnectDecoder.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnectGrammar.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnectStatesEnum.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulShutdown.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulShutdownContainer.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulShutdownDecoder.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulShutdownGrammar.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulShutdownStatesEnum.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedure.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureCall.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureCallContainer.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureCallGrammar.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureCallStatesEnum.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureContainer.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureGrammar.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureStatesEnum.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequest.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modify/ModifyResponse.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modifyDn/ModifyDNRequest.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/modifyDn/ModifyDNResponse.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/AndFilter.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/AttributeValueAssertionFilter.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/ConnectorFilter.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/ExtensibleMatchFilter.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/Filter.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/NotFilter.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/OrFilter.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/PresentFilter.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchRequest.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultDone.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntry.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SearchResultReference.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/SubstringFilter.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/ChangeType.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControl.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlContainer.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlDecoder.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlGrammar.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlStatesEnum.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControl.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlContainer.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlDecoder.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlGrammar.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlStatesEnum.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControl.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlContainer.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlDecoder.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlGrammar.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlStatesEnum.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/unbind/UnBindRequest.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/util/LdapURL.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java
    directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/LdapDecoderTest.java
    directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestTest.java
    directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/ExtendedResponseTest.java
    directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnectTest.java
    directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/modify/ModifyRequestTest.java
    directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestMatchingRuleAssertionTest.java
    directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestSubstringTest.java
    directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchRequestTest.java
    directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/SearchResultEntryTest.java
    directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlTest.java
    directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlTest.java
    directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/codec/unbind/UnBindRequestTest.java

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/AttributeValueAssertion.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/AttributeValueAssertion.java?view=diff&rev=452497&r1=452496&r2=452497
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/AttributeValueAssertion.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/AttributeValueAssertion.java
Tue Oct  3 06:49:43 2006
@@ -20,13 +20,16 @@
 package org.apache.directory.shared.ldap.codec;
 
 
-import org.apache.directory.shared.ldap.codec.util.LdapString;
-
-
 /**
- * A class to store an attribute value assertion. Tha grammar is :
- * AttributeValueAssertion ::= SEQUENCE { attributeDesc AttributeDescription,
- * assertionValue AssertionValue } AttributeDescription ::= LDAPString
+ * A class to store an attribute value assertion. 
+ * The grammar is :
+ * 
+ * AttributeValueAssertion ::= SEQUENCE {
+ *           attributeDesc   AttributeDescription,
+ *           assertionValue  AssertionValue }
+ *
+ * AttributeDescription ::= LDAPString
+ * 
  * AssertionValue ::= OCTET STRING
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
@@ -37,7 +40,7 @@
     // ----------------------------------------------------------------------------
 
     /** The attribute description */
-    private LdapString attributeDesc;
+    private String attributeDesc;
 
     /** The assertion value */
     private Object assertionValue;
@@ -60,8 +63,7 @@
     /**
      * Set the assertion value
      * 
-     * @param assertionValue
-     *            The assertionValue to set.
+     * @param assertionValue The assertionValue to set.
      */
     public void setAssertionValue( Object assertionValue )
     {
@@ -76,17 +78,16 @@
      */
     public String getAttributeDesc()
     {
-        return ( ( attributeDesc == null ) ? null : attributeDesc.getString() );
+        return attributeDesc;
     }
 
 
     /**
      * Set the attribute description
      * 
-     * @param attributeDesc
-     *            The attributeDesc to set.
+     * @param attributeDesc The attributeDesc to set.
      */
-    public void setAttributeDesc( LdapString attributeDesc )
+    public void setAttributeDesc( String attributeDesc )
     {
         this.attributeDesc = attributeDesc;
     }
@@ -95,8 +96,7 @@
     /**
      * Get a String representation of an AttributeValueAssertion
      * 
-     * @param tabs
-     *            The spacing to be put before the string
+     * @param tabs The spacing to be put before the string
      * @return An AttributeValueAssertion String
      */
     public String toString( String tabs )
@@ -116,8 +116,7 @@
      * Get a String representation of an AttributeValueAssertion, as of RFC
      * 2254.
      * 
-     * @param filterType
-     *            The filter type
+     * @param filterType The filter type
      * @return An AttributeValueAssertion String
      */
     public String toStringRFC2254( int filterType )

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/Control.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/Control.java?view=diff&rev=452497&r1=452496&r2=452497
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/Control.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/Control.java
Tue Oct  3 06:49:43 2006
@@ -24,11 +24,10 @@
 import java.nio.ByteBuffer;
 
 import org.apache.directory.shared.asn1.Asn1Object;
-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.EncoderException;
-import org.apache.directory.shared.ldap.codec.util.LdapString;
 import org.apache.directory.shared.ldap.util.StringTools;
 
 
@@ -43,7 +42,7 @@
     // ----------------------------------------------------------------------------
 
     /** The control type */
-    private LdapString controlType;
+    private String controlType;
 
     /** The criticality (default value is false) */
     private boolean criticality = false;
@@ -67,17 +66,16 @@
      */
     public String getControlType()
     {
-        return ( controlType == null ? "" : controlType.toString() );
+        return controlType == null ? "" : controlType;
     }
 
 
     /**
      * Set the control type
      * 
-     * @param controlType
-     *            An OID to store
+     * @param controlType The OID to be stored
      */
-    public void setControlType( LdapString controlType )
+    public void setControlType( String controlType )
     {
         this.controlType = controlType;
     }
@@ -108,8 +106,7 @@
     /**
      * Set the encoded control value
      * 
-     * @param encodedValue
-     *            The encoded control value to store
+     * @param encodedValue The encoded control value to store
      */
     public void setEncodedValue( byte[] encodedValue )
     {
@@ -136,8 +133,7 @@
     /**
      * Set the control value
      * 
-     * @param controlValue
-     *            The control value to store
+     * @param controlValue The control value to store
      */
     public void setControlValue( Object controlValue )
     {
@@ -159,8 +155,7 @@
     /**
      * Set the criticality
      * 
-     * @param criticality
-     *            The criticality value
+     * @param criticality The criticality value
      */
     public void setCriticality( boolean criticality )
     {
@@ -169,16 +164,25 @@
 
 
     /**
-     * Compute the Control length Control : 0x30 L1 | +--> 0x04 L2 controlType
-     * [+--> 0x01 0x01 criticality] [+--> 0x04 L3 controlValue] Control length =
-     * Length(0x30) + length(L1) + Length(0x04) + Length(L2) + L2 [+
-     * Length(0x01) + 1 + 1] [+ Length(0x04) + Length(L3) + L3]
+     * Compute the Control length 
+     * Control :
+     * 
+     * 0x30 L1
+     *  |
+     *  +--> 0x04 L2 controlType
+     * [+--> 0x01 0x01 criticality]
+     * [+--> 0x04 L3 controlValue] 
+     * 
+     * Control length = Length(0x30) + length(L1) 
+     *                  + Length(0x04) + Length(L2) + L2
+     *                  [+ Length(0x01) + 1 + 1]
+     *                  [+ Length(0x04) + Length(L3) + L3]
      */
     public int computeLength()
     {
         // The controlType
-        int controlTypeLengh = controlType.getNbBytes();
-        controlLength = 1 + Length.getNbBytes( controlTypeLengh ) + controlTypeLengh;
+        int controlTypeLengh = StringTools.getBytesUtf8( controlType ).length;
+        controlLength = 1 + TLV.getNbBytes( controlTypeLengh ) + controlTypeLengh;
 
         // The criticality, only if true
         if ( criticality )
@@ -193,17 +197,17 @@
             if ( controlValue instanceof byte[] )
             {
                 controlBytes = ( byte[] ) controlValue;
-                controlLength += 1 + Length.getNbBytes( controlBytes.length ) + controlBytes.length;
+                controlLength += 1 + TLV.getNbBytes( controlBytes.length ) + controlBytes.length;
             }
             else if ( controlValue instanceof String )
             {
                 controlBytes = StringTools.getBytesUtf8( ( String ) controlValue );
-                controlLength += 1 + Length.getNbBytes( controlBytes.length ) + controlBytes.length;
+                controlLength += 1 + TLV.getNbBytes( controlBytes.length ) + controlBytes.length;
             }
             else if ( controlValue instanceof Asn1Object )
             {
                 int length = ( ( Asn1Object ) controlValue ).computeLength();
-                controlLength += 1 + Length.getNbBytes( length ) + length;
+                controlLength += 1 + TLV.getNbBytes( length ) + length;
             }
             else
             {
@@ -212,19 +216,21 @@
             }
         }
 
-        return 1 + Length.getNbBytes( controlLength ) + controlLength;
+        return 1 + TLV.getNbBytes( controlLength ) + controlLength;
     }
 
 
     /**
-     * Generate the PDU which contains the Control. Control : 0x30 LL 0x04 LL
-     * type [0x01 0x01 criticality] [0x04 LL value]
+     * Generate the PDU which contains the Control. 
+     * Control : 
+     * 0x30 LL
+     *   0x04 LL type 
+     *   [0x01 0x01 criticality]
+     *   [0x04 LL value]
      * 
-     * @param buffer
-     *            The encoded PDU
+     * @param buffer The encoded PDU
      * @return A ByteBuffer that contaons the PDU
-     * @throws EncoderException
-     *             If anything goes wrong.
+     * @throws EncoderException If anything goes wrong.
      */
     public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
     {
@@ -234,7 +240,7 @@
             buffer.put( UniversalTag.SEQUENCE_TAG );
 
             // The length has been calculated by the computeLength method
-            buffer.put( Length.getBytes( controlLength ) );
+            buffer.put( TLV.getBytes( controlLength ) );
         }
         catch ( BufferOverflowException boe )
         {

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ControlDecoder.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ControlDecoder.java?view=diff&rev=452497&r1=452496&r2=452497
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ControlDecoder.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ControlDecoder.java
Tue Oct  3 06:49:43 2006
@@ -44,11 +44,9 @@
     /**
      * Decodes raw ASN.1 encoded bytes into an Asn1Object for the control.
      * 
-     * @param controlBytes
-     *            the encoded control bytes
+     * @param controlBytes the encoded control bytes
      * @return the decoded Asn1Object for the control
-     * @throws DecoderException
-     *             if anything goes wrong
+     * @throws DecoderException if anything goes wrong
      */
     Asn1Object decode( byte[] controlBytes ) throws DecoderException, NamingException;
 }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapConstants.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapConstants.java?view=diff&rev=452497&r1=452496&r2=452497
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapConstants.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapConstants.java
Tue Oct  3 06:49:43 2006
@@ -110,15 +110,15 @@
 
     public static final int EXTENDED_REQUEST_VALUE_TAG = 0x81;
 
-    public static final int SEARCH_MATCHING_RULE_TAG = 0x81;
+    public static final int MATCHING_RULE_ID_TAG = 0x81;
 
     public static final int SUBSTRINGS_FILTER_ANY_TAG = 0x81;
 
-    public static final int MATCHING_RULE_ASSERTION_TYPE_TAG = 0x82;
+    public static final int MATCHING_RULE_TYPE_TAG = 0x82;
 
     public static final int SUBSTRINGS_FILTER_FINAL_TAG = 0x82;
 
-    public static final int SEARCH_MATCH_VALUE_TAG = 0x83;
+    public static final int MATCH_VALUE_TAG = 0x83;
 
     public static final int DN_ATTRIBUTES_FILTER_TAG = 0x84;
 

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessage.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessage.java?view=diff&rev=452497&r1=452496&r2=452497
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessage.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessage.java
Tue Oct  3 06:49:43 2006
@@ -21,7 +21,7 @@
 
 
 import org.apache.directory.shared.asn1.Asn1Object;
-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.EncoderException;
@@ -104,8 +104,7 @@
     /**
      * Get the Control Object at a specific index
      * 
-     * @param i
-     *            The index of the Control Object to get
+     * @param i The index of the Control Object to get
      * @return The selected Control Object
      */
     public Control getControls( int i )
@@ -139,8 +138,7 @@
     /**
      * Add a control to the Controls array
      * 
-     * @param control
-     *            The Control to add
+     * @param control The Control to add
      */
     public void addControl( Control control )
     {
@@ -156,7 +154,7 @@
     /**
      * Init the controls array
      */
-    public void initControl()
+    public void initControls()
     {
         controls = new ArrayList();
     }
@@ -176,8 +174,7 @@
     /**
      * Set the message ID
      * 
-     * @param messageId
-     *            The message ID
+     * @param messageId The message ID
      */
     public void setMessageId( int messageId )
     {
@@ -505,8 +502,7 @@
     /**
      * Set the ProtocolOP
      * 
-     * @param protocolOp
-     *            The protocolOp to set.
+     * @param protocolOp The protocolOp to set.
      */
     public void setProtocolOP( Asn1Object protocolOp )
     {
@@ -515,11 +511,16 @@
 
 
     /**
-     * Compute the LdapMessage length LdapMessage : 0x30 L1 | +--> 0x02 0x0(1-4)
-     * [0..2^31-1] (MessageId) +--> protocolOp [+--> Controls] MessageId length =
-     * Length(0x02) + length(MessageId) + MessageId.length L1 =
-     * length(ProtocolOp) LdapMessage length = Length(0x30) + Length(L1) +
-     * MessageId length + L1
+     * Compute the LdapMessage length LdapMessage : 
+     * 0x30 L1 
+     *   | 
+     *   +--> 0x02 0x0(1-4) [0..2^31-1] (MessageId) 
+     *   +--> protocolOp 
+     *   [+--> Controls] 
+     *   
+     * MessageId length = Length(0x02) + length(MessageId) + MessageId.length 
+     * L1 = length(ProtocolOp) 
+     * LdapMessage length = Length(0x30) + Length(L1) + MessageId length + L1
      */
     public int computeLength()
     {
@@ -540,13 +541,13 @@
         {
             // Controls :
             // 0xA0 L3
-            // |
-            // +--> 0x30 L4
-            // +--> 0x30 L5
-            // +--> ...
-            // +--> 0x30 Li
-            // +--> ...
-            // +--> 0x30 Ln
+            //   |
+            //   +--> 0x30 L4
+            //   +--> 0x30 L5
+            //   +--> ...
+            //   +--> 0x30 Li
+            //   +--> ...
+            //   +--> 0x30 Ln
             //
             // L3 = Length(0x30) + Length(L5) + L5
             // + Length(0x30) + Length(L6) + L6
@@ -568,36 +569,42 @@
             }
 
             // Computes the controls length
-            controlsLength = controlsSequenceLength; // 1 +
-                                                        // Length.getNbBytes(
-                                                        // controlsSequenceLength
-                                                        // ) +
-                                                        // controlsSequenceLength;
+            controlsLength = controlsSequenceLength; // 1 + Length.getNbBytes(
+                                                     // controlsSequenceLength
+                                                     // ) + controlsSequenceLength;
 
             // Now, add the tag and the length of the controls length
-            ldapMessageLength += 1 + Length.getNbBytes( controlsSequenceLength ) + controlsSequenceLength;
+            ldapMessageLength += 1 + TLV.getNbBytes( controlsSequenceLength ) + controlsSequenceLength;
         }
 
         // finally, calculate the global message size :
         // length(Tag) + Length(length) + length
 
-        return 1 + ldapMessageLength + Length.getNbBytes( ldapMessageLength );
+        return 1 + ldapMessageLength + TLV.getNbBytes( ldapMessageLength );
     }
 
 
     /**
-     * Generate the PDU which contains the encoded object. The generation is
-     * done in two phases : - first, we compute the length of each part and the
-     * global PDU length - second, we produce the PDU. 0x30 L1 | +--> 0x02 L2
-     * MessageId (L2 = Length(MessageId) +--> ProtocolOp +--> Controls L1 =
-     * Length(0x02) + Length(L2) + L2 + Length(ProtocolOp) + Length(Controls)
+     * Generate the PDU which contains the encoded object. 
+     * 
+     * The generation is done in two phases : 
+     * - first, we compute the length of each part and the
+     * global PDU length 
+     * - second, we produce the PDU. 
+     * 
+     * 0x30 L1 
+     *   | 
+     *   +--> 0x02 L2 MessageId  
+     *   +--> ProtocolOp 
+     *   +--> Controls 
+     *   
+     * L2 = Length(MessageId)
+     * L1 = Length(0x02) + Length(L2) + L2 + Length(ProtocolOp) + Length(Controls)
      * LdapMessageLength = Length(0x30) + Length(L1) + L1
      * 
-     * @param buffer
-     *            The encoded PDU
+     * @param buffer The encoded PDU
      * @return A ByteBuffer that contaons the PDU
-     * @throws EncoderException
-     *             If anything goes wrong.
+     * @throws EncoderException If anything goes wrong.
      */
     public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
     {
@@ -610,7 +617,7 @@
             bb.put( UniversalTag.SEQUENCE_TAG );
 
             // The length has been calculated by the computeLength method
-            bb.put( Length.getBytes( ldapMessageLength ) );
+            bb.put( TLV.getBytes( ldapMessageLength ) );
         }
         catch ( BufferOverflowException boe )
         {
@@ -628,11 +635,7 @@
         {
             // Encode the controls
             bb.put( ( byte ) LdapConstants.CONTROLS_TAG );
-            bb.put( Length.getBytes( controlsLength ) );
-
-            // Encode the control's sequence
-            // bb.put( UniversalTag.SEQUENCE_TAG );
-            // bb.put( Length.getBytes( controlsSequenceLength ) );
+            bb.put( TLV.getBytes( controlsLength ) );
 
             // Encode each control
             Iterator controlIterator = controls.iterator();

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java?view=diff&rev=452497&r1=452496&r2=452497
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java
Tue Oct  3 06:49:43 2006
@@ -25,30 +25,6 @@
 
 import org.apache.directory.shared.asn1.ber.AbstractContainer;
 import org.apache.directory.shared.asn1.ber.IAsn1Container;
-import org.apache.directory.shared.asn1.ber.grammar.IGrammar;
-import org.apache.directory.shared.ldap.codec.abandon.AbandonRequestGrammar;
-import org.apache.directory.shared.ldap.codec.add.AddRequestGrammar;
-import org.apache.directory.shared.ldap.codec.add.AddResponseGrammar;
-import org.apache.directory.shared.ldap.codec.bind.BindRequestGrammar;
-import org.apache.directory.shared.ldap.codec.bind.BindResponseGrammar;
-import org.apache.directory.shared.ldap.codec.compare.CompareRequestGrammar;
-import org.apache.directory.shared.ldap.codec.compare.CompareResponseGrammar;
-import org.apache.directory.shared.ldap.codec.del.DelRequestGrammar;
-import org.apache.directory.shared.ldap.codec.del.DelResponseGrammar;
-import org.apache.directory.shared.ldap.codec.extended.ExtendedRequestGrammar;
-import org.apache.directory.shared.ldap.codec.extended.ExtendedResponseGrammar;
-import org.apache.directory.shared.ldap.codec.modify.ModifyRequestGrammar;
-import org.apache.directory.shared.ldap.codec.modify.ModifyResponseGrammar;
-import org.apache.directory.shared.ldap.codec.modifyDn.ModifyDNRequestGrammar;
-import org.apache.directory.shared.ldap.codec.modifyDn.ModifyDNResponseGrammar;
-import org.apache.directory.shared.ldap.codec.search.FilterGrammar;
-import org.apache.directory.shared.ldap.codec.search.MatchingRuleAssertionGrammar;
-import org.apache.directory.shared.ldap.codec.search.SearchRequestGrammar;
-import org.apache.directory.shared.ldap.codec.search.SearchResultDoneGrammar;
-import org.apache.directory.shared.ldap.codec.search.SearchResultEntryGrammar;
-import org.apache.directory.shared.ldap.codec.search.SearchResultReferenceGrammar;
-import org.apache.directory.shared.ldap.codec.search.SubstringFilterGrammar;
-import org.apache.directory.shared.ldap.codec.unbind.UnBindRequestGrammar;
 import org.apache.directory.shared.ldap.util.StringTools;
 
 
@@ -59,8 +35,7 @@
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class LdapMessageContainer extends AbstractContainer implements IAsn1Container //
extends
-                                                                                        //
AbstractLdapContainer
+public class LdapMessageContainer extends AbstractContainer implements IAsn1Container
 {
     // ~ Instance fields
     // ----------------------------------------------------------------------------
@@ -70,7 +45,12 @@
 
     /** A HashSet which contaons the binary attributes */
     private Set binaries;
-
+    
+    /** The message ID */
+    private int messageId;
+    
+    /** The current control */
+    private Control currentControl;
 
     // ~ Constructors
     // -------------------------------------------------------------------------------
@@ -89,45 +69,11 @@
      * Creates a new LdapMessageContainer object. We will store ten grammars,
      * it's enough ...
      */
-    public LdapMessageContainer(Set binaries)
+    public LdapMessageContainer( Set binaries )
     {
         super();
-        currentGrammar = 0;
-        grammars = new IGrammar[LdapStatesEnum.NB_GRAMMARS];
-        grammarStack = new IGrammar[10];
         stateStack = new int[10];
-        popAllowedStack = new boolean[10];
-        nbGrammars = 0;
-
-        grammars[LdapStatesEnum.LDAP_MESSAGE_GRAMMAR] = LdapMessageGrammar.getInstance();
-        grammars[LdapStatesEnum.LDAP_CONTROL_GRAMMAR] = LdapControlGrammar.getInstance();
-        grammars[LdapStatesEnum.BIND_REQUEST_GRAMMAR] = BindRequestGrammar.getInstance();
-        grammars[LdapStatesEnum.LDAP_RESULT_GRAMMAR] = LdapResultGrammar.getInstance();
-        grammars[LdapStatesEnum.BIND_RESPONSE_GRAMMAR] = BindResponseGrammar.getInstance();
-        grammars[LdapStatesEnum.UNBIND_REQUEST_GRAMMAR] = UnBindRequestGrammar.getInstance();
-        grammars[LdapStatesEnum.ABANDON_REQUEST_GRAMMAR] = AbandonRequestGrammar.getInstance();
-        grammars[LdapStatesEnum.ADD_RESPONSE_GRAMMAR] = AddResponseGrammar.getInstance();
-        grammars[LdapStatesEnum.COMPARE_RESPONSE_GRAMMAR] = CompareResponseGrammar.getInstance();
-        grammars[LdapStatesEnum.DEL_RESPONSE_GRAMMAR] = DelResponseGrammar.getInstance();
-        grammars[LdapStatesEnum.MODIFY_RESPONSE_GRAMMAR] = ModifyResponseGrammar.getInstance();
-        grammars[LdapStatesEnum.MODIFY_DN_RESPONSE_GRAMMAR] = ModifyDNResponseGrammar.getInstance();
-        grammars[LdapStatesEnum.SEARCH_RESULT_DONE_GRAMMAR] = SearchResultDoneGrammar.getInstance();
-        grammars[LdapStatesEnum.SEARCH_REQUEST_GRAMMAR] = SearchRequestGrammar.getInstance();
-        grammars[LdapStatesEnum.FILTER_GRAMMAR] = FilterGrammar.getInstance();
-        grammars[LdapStatesEnum.SEARCH_RESULT_ENTRY_GRAMMAR] = SearchResultEntryGrammar.getInstance();
-        grammars[LdapStatesEnum.MODIFY_REQUEST_GRAMMAR] = ModifyRequestGrammar.getInstance();
-        grammars[LdapStatesEnum.SEARCH_RESULT_REFERENCE_GRAMMAR] = SearchResultReferenceGrammar.getInstance();
-        grammars[LdapStatesEnum.ADD_REQUEST_GRAMMAR] = AddRequestGrammar.getInstance();
-        grammars[LdapStatesEnum.MODIFY_DN_REQUEST_GRAMMAR] = ModifyDNRequestGrammar.getInstance();
-        grammars[LdapStatesEnum.DEL_REQUEST_GRAMMAR] = DelRequestGrammar.getInstance();
-        grammars[LdapStatesEnum.COMPARE_REQUEST_GRAMMAR] = CompareRequestGrammar.getInstance();
-        grammars[LdapStatesEnum.EXTENDED_REQUEST_GRAMMAR] = ExtendedRequestGrammar.getInstance();
-        grammars[LdapStatesEnum.EXTENDED_RESPONSE_GRAMMAR] = ExtendedResponseGrammar.getInstance();
-        grammars[LdapStatesEnum.SUBSTRING_FILTER_GRAMMAR] = SubstringFilterGrammar.getInstance();
-        grammars[LdapStatesEnum.MATCHING_RULE_ASSERTION_GRAMMAR] = MatchingRuleAssertionGrammar.getInstance();
-
-        grammarStack[currentGrammar] = grammars[LdapStatesEnum.LDAP_MESSAGE_GRAMMAR];
-
+        grammar = LdapMessageGrammar.getInstance();
         states = LdapStatesEnum.getInstance();
 
         this.binaries = binaries;
@@ -141,7 +87,6 @@
      */
     public LdapMessage getLdapMessage()
     {
-
         return ldapMessage;
     }
 
@@ -150,8 +95,7 @@
      * Set a ldapMessage Object into the container. It will be completed by the
      * ldapDecoder .
      * 
-     * @param ldapMessage
-     *            The ldapMessage to set.
+     * @param ldapMessage The message to set.
      */
     public void setLdapMessage( LdapMessage ldapMessage )
     {
@@ -164,6 +108,8 @@
         super.clean();
 
         ldapMessage = null;
+        messageId = 0;
+        currentControl = null;
     }
 
 
@@ -173,5 +119,38 @@
     public boolean isBinary( String id )
     {
         return binaries.contains( StringTools.lowerCase( StringTools.trim( id ) ) );
+    }
+
+    /**
+     * @return The message ID
+     */
+    public int getMessageId()
+    {
+        return messageId;
+    }
+
+    /**
+     * Set the message ID
+     */
+    public void setMessageId( int messageId )
+    {
+        this.messageId = messageId;
+    }
+
+    /**
+     * @return the current control being created
+     */
+    public Control getCurrentControl()
+    {
+        return currentControl;
+    }
+
+    /**
+     * Store a newly created control
+     * @param currentControl The control to store
+     */
+    public void setCurrentControl( Control currentControl )
+    {
+        this.currentControl = currentControl;
     }
 }



Mime
View raw message