directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r329616 - in /directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder: ./ add/ compare/ modify/ search/
Date Sun, 30 Oct 2005 19:57:16 GMT
Author: elecharny
Date: Sun Oct 30 11:57:07 2005
New Revision: 329616

URL: http://svn.apache.org/viewcvs?rev=329616&view=rev
Log:
Changed the rules that were using a byte[] to set attribute's values to bye[] or String depending
in their type.

Modified:
    directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/LdapDigesterFactory.java
    directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/add/AddAttributeValueRule.java
    directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/compare/CompareAVARule.java
    directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/modify/ModifyRequestAttributeValueRule.java
    directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/ApproxMatchRule.java
    directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/EqualityMatchRule.java
    directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/ExtensibleMatchRule.java
    directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/ExtensibleMatchValueRule.java
    directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/GreaterOrEqualRule.java
    directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/LessOrEqualRule.java

Modified: directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/LdapDigesterFactory.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/LdapDigesterFactory.java?rev=329616&r1=329615&r2=329616&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/LdapDigesterFactory.java
(original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/LdapDigesterFactory.java
Sun Oct 30 11:57:07 2005
@@ -17,6 +17,9 @@
 package org.apache.ldap.common.berlib.asn1.decoder ;
 
 
+import java.util.HashSet;
+import java.util.Set;
+
 import org.apache.asn1.ber.digester.BERDigester;
 import org.apache.asn1.ber.digester.TagTree;
 import org.apache.asn1.ber.digester.rules.Octets2StringRule;
@@ -138,6 +141,16 @@
         return singleton ;
     }
 
+    /**
+     * Creates and populates the BERDigester with rules to process all LDAPv3
+     * message types.
+     *
+     * @return a digester that can process all LDAPv3 PDU types
+     */
+    public BERDigester create() 
+    {
+        return create( new HashSet() );
+    }
 
     /**
      * Creates and populates the BERDigester with rules to process all LDAPv3
@@ -145,9 +158,9 @@
      *
      * @return a digester that can process all LDAPv3 PDU types
      */
-    public BERDigester create()
+    public BERDigester create( Set binaries )
     {
-        BERDigester digester = new BERDigester() ;
+        BERDigester digester = new BERDigester( binaries ) ;
 
         addMessageIdRules( digester ) ;
         addAbandonRequestRules( digester ) ;

Modified: directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/add/AddAttributeValueRule.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/add/AddAttributeValueRule.java?rev=329616&r1=329615&r2=329616&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/add/AddAttributeValueRule.java
(original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/add/AddAttributeValueRule.java
Sun Oct 30 11:57:07 2005
@@ -19,6 +19,7 @@
 
 import org.apache.asn1.ber.digester.rules.PrimitiveOctetStringRule;
 import org.apache.asn1.ber.primitives.UniversalTag;
+import org.apache.asn1new.util.StringUtils;
 import org.apache.ldap.common.message.LockableAttributeImpl;
 
 import javax.naming.directory.Attributes;
@@ -93,7 +94,14 @@
             attrs.put( attr );
         }
 
-        attr.add( octets ) ;
+        if ( getDigester().isBinary( id ) ) 
+        {
+            attr.add( octets ) ;
+        }
+        else
+        {
+            attr.add( StringUtils.toUtf8( octets ) );
+        }
 
         // clean up
         setConstructed( false ) ;

Modified: directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/compare/CompareAVARule.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/compare/CompareAVARule.java?rev=329616&r1=329615&r2=329616&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/compare/CompareAVARule.java
(original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/compare/CompareAVARule.java
Sun Oct 30 11:57:07 2005
@@ -76,7 +76,14 @@
         }
         else
         {
-            req.setAssertionValue( octets ) ;
+            if ( getDigester().isBinary( req.getAttributeId() ) ) 
+            {
+                req.setAssertionValue( octets ) ;
+            }
+            else
+            {
+                req.setAssertionValue( StringUtils.toUtf8( octets ) );
+            }
         }
     }
 }

Modified: directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/modify/ModifyRequestAttributeValueRule.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/modify/ModifyRequestAttributeValueRule.java?rev=329616&r1=329615&r2=329616&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/modify/ModifyRequestAttributeValueRule.java
(original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/modify/ModifyRequestAttributeValueRule.java
Sun Oct 30 11:57:07 2005
@@ -19,6 +19,7 @@
 
 import org.apache.asn1.ber.digester.rules.PrimitiveOctetStringRule;
 import org.apache.asn1.ber.primitives.UniversalTag;
+import org.apache.asn1new.util.StringUtils;
 
 import javax.naming.directory.ModificationItem;
 import java.nio.ByteBuffer;
@@ -80,7 +81,14 @@
         }
 
         // Add the attribute
-        mods.getAttribute().add( octets ) ;
+        if ( getDigester().isBinary( mods.getAttribute().getID() ) ) 
+        {
+            mods.getAttribute().add( octets ) ;
+        }
+        else
+        {
+            mods.getAttribute().add( StringUtils.toUtf8( octets ) ) ;
+        }
 
         // clean up
         setConstructed( false ) ;

Modified: directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/ApproxMatchRule.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/ApproxMatchRule.java?rev=329616&r1=329615&r2=329616&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/ApproxMatchRule.java
(original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/ApproxMatchRule.java
Sun Oct 30 11:57:07 2005
@@ -40,7 +40,6 @@
 {
     private boolean isEnabled = true ;
     private String name = null ;
-    private byte[] value = null ;
 
 
     public void tag( int id, boolean isPrimitive, TypeClass typeClass )
@@ -133,22 +132,16 @@
             buf.get( octets );
         }
 
-        if ( name == null && value == null )
+        if ( name == null )
         {
             name = StringUtils.toUtf8( octets );
         }
-        else if ( ( name != null)  && ( value == null ) )
+        else 
         {
             SimpleNode node = new SimpleNode( name, octets, SimpleNode.APPROXIMATE );
             getDigester().push( node ) ;
 
             name = null ;
-            value = null ;
-        }
-        else
-        {
-            throw new IllegalStateException( "name = " + name
-                    + " and value = " + value );
         }
     }
 }

Modified: directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/EqualityMatchRule.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/EqualityMatchRule.java?rev=329616&r1=329615&r2=329616&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/EqualityMatchRule.java
(original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/EqualityMatchRule.java
Sun Oct 30 11:57:07 2005
@@ -42,9 +42,6 @@
 
     private String name = null;
 
-    private byte[] value = null;
-
-
     public void tag( int id, boolean isPrimitive, TypeClass typeClass )
     {
         // check to see we are within limits - have the right number of tags
@@ -142,21 +139,16 @@
             buf.get( octets );
         }
 
-        if ( name == null && value == null )
+        if ( name == null )
         {
             name = StringUtils.toUtf8( octets ) ;
         }
-        else if ( name != null && value == null )
+        else 
         {
             SimpleNode node = new SimpleNode( name, octets, SimpleNode.EQUALITY );
             getDigester().push( node ) ;
 
             name = null ;
-            value = null ;
-        }
-        else
-        {
-            throw new IllegalStateException( "name = " + name + " and value = " + value );
         }
     }
 }

Modified: directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/ExtensibleMatchRule.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/ExtensibleMatchRule.java?rev=329616&r1=329615&r2=329616&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/ExtensibleMatchRule.java
(original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/ExtensibleMatchRule.java
Sun Oct 30 11:57:07 2005
@@ -43,7 +43,7 @@
     private String type = null;
     
     /** required matchingValue property */
-    private byte[] value = null;
+    private String value = null;
     
     /** dnAttributes property that defaults to FALSE */
     private boolean dnAttributes = false;
@@ -155,7 +155,7 @@
     }
 
 
-    public void setValue( byte[] value )
+    public void setValue( String value )
     {
         this.value = value;
     }

Modified: directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/ExtensibleMatchValueRule.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/ExtensibleMatchValueRule.java?rev=329616&r1=329615&r2=329616&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/ExtensibleMatchValueRule.java
(original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/ExtensibleMatchValueRule.java
Sun Oct 30 11:57:07 2005
@@ -18,6 +18,7 @@
 
 
 import org.apache.asn1.ber.digester.rules.PrimitiveOctetStringRule;
+import org.apache.asn1new.util.StringUtils;
 import org.apache.ldap.common.berlib.asn1.LdapTag;
 
 import java.nio.ByteBuffer;
@@ -66,6 +67,6 @@
         }
 
         ExtensibleMatchRule rule = ( ExtensibleMatchRule ) getDigester().peek();
-        rule.setValue( octets );
+        rule.setValue( StringUtils.toUtf8( octets ) );
     }
 }

Modified: directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/GreaterOrEqualRule.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/GreaterOrEqualRule.java?rev=329616&r1=329615&r2=329616&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/GreaterOrEqualRule.java
(original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/GreaterOrEqualRule.java
Sun Oct 30 11:57:07 2005
@@ -39,7 +39,6 @@
 {
     private boolean isEnabled = true ;
     private String name = null ;
-    private byte[] value = null ;
 
 
     public void tag( int id, boolean isPrimitive, TypeClass typeClass )
@@ -112,22 +111,16 @@
             buf.get( octets );
         }
 
-        if ( name == null && value == null )
+        if ( name == null )
         {
             name = StringUtils.toUtf8( octets );
         }
-        else if ( name != null && value == null )
+        else
         {
             SimpleNode node = new SimpleNode( name, octets, SimpleNode.GREATEREQ );
             getDigester().push( node ) ;
 
             name = null ;
-            value = null ;
-        }
-        else
-        {
-            throw new IllegalStateException( "name = " + name
-                    + " and value = " + value );
         }
     }
 }

Modified: directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/LessOrEqualRule.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/LessOrEqualRule.java?rev=329616&r1=329615&r2=329616&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/LessOrEqualRule.java
(original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/search/LessOrEqualRule.java
Sun Oct 30 11:57:07 2005
@@ -39,7 +39,6 @@
 {
     private boolean isEnabled = true ;
     private String name = null ;
-    private byte[] value = null ;
 
 
     public void tag( int id, boolean isPrimitive, TypeClass typeClass )
@@ -112,22 +111,16 @@
             buf.get( octets );
         }
 
-        if ( name == null && value == null )
+        if ( name == null )
         {
             name = StringUtils.toUtf8( octets );
         }
-        else if ( name != null && value == null )
+        else
         {
             SimpleNode node = new SimpleNode( name, octets, SimpleNode.LESSEQ );
             getDigester().push( node ) ;
 
             name = null ;
-            value = null ;
-        }
-        else
-        {
-            throw new IllegalStateException( "name = " + name
-                    + " and value = " + value );
         }
     }
 }



Mime
View raw message