You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2005/10/26 23:09:56 UTC

svn commit: r328733 - /directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/filter/ExtensibleNode.java

Author: elecharny
Date: Wed Oct 26 14:09:51 2005
New Revision: 328733

URL: http://svn.apache.org/viewcvs?rev=328733&view=rev
Log:
* Modified the nodes to handle utf-8 strings and byte[] values
* cleanup of the code

Modified:
    directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/filter/ExtensibleNode.java

Modified: directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/filter/ExtensibleNode.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/filter/ExtensibleNode.java?rev=328733&r1=328732&r2=328733&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/filter/ExtensibleNode.java (original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/filter/ExtensibleNode.java Wed Oct 26 14:09:51 2005
@@ -25,6 +25,8 @@
  */
 package org.apache.ldap.common.filter;
 
+import org.apache.asn1new.util.StringUtils;
+
 
 /**
  * Filter expression tree node for extensible assertions.
@@ -36,30 +38,30 @@
 public class ExtensibleNode extends LeafNode
 {
     /** The value of the attribute to match for */
-    private final String value;
+    private final byte[] value;
+    
     /** The matching rules id */
-    private final String m_matchingRuleId ;
+    private final String matchingRuleId ;
 
     /** The name of the dn attributes */
-    private boolean m_dnAttributes = false ;
+    private boolean dnAttributes = false ;
 
- 
     /**
      * Creates a new ExtensibleNode object.
      *
-     * @param a_attribute the attribute used for the extensible assertion
-     * @param a_value the value to match for
-     * @param a_matchingRuleId the OID of the matching rule
-     * @param a_dnAttributes the dn attributes
-     */
-    public ExtensibleNode( String a_attribute, String a_value,
-        String a_matchingRuleId, boolean a_dnAttributes )
-    {
-        super( a_attribute, EXTENSIBLE ) ;
-
-        this.value = a_value ;
-        m_matchingRuleId = a_matchingRuleId ;
-        this.m_dnAttributes = a_dnAttributes ;
+     * @param attribute the attribute used for the extensible assertion
+     * @param value the value to match for
+     * @param matchingRuleId the OID of the matching rule
+     * @param dnAttributes the dn attributes
+     */
+    public ExtensibleNode( String attribute, byte[] value,
+        String matchingRuleId, boolean dnAttributes )
+    {
+        super( attribute, EXTENSIBLE ) ;
+
+        this.value = value ;
+        this.matchingRuleId = matchingRuleId ;
+        this.dnAttributes = dnAttributes ;
     }
 
 
@@ -70,7 +72,7 @@
      */
     public boolean dnAttributes(  )
     {
-        return m_dnAttributes ;
+        return dnAttributes ;
     }
 
 
@@ -81,7 +83,7 @@
      */
     public String getMatchingRuleId(  )
     {
-        return m_matchingRuleId ;
+        return matchingRuleId ;
     }
 
 
@@ -90,40 +92,41 @@
      *
      * @return the value
      */
-    public final String getValue()
+    public final byte[] getValue()
     {
         return value ;
     }
 
-
     /**
      * @see org.apache.ldap.common.filter.ExprNode#printToBuffer(
      * java.lang.StringBuffer)
      */
-    public StringBuffer printToBuffer( StringBuffer a_buf )
+    public StringBuffer printToBuffer( StringBuffer buf )
     {
-        a_buf.append( '(' ).append( getAttribute() );
-        a_buf.append( "-" );
-        a_buf.append( this.m_dnAttributes );
-        a_buf.append( "-EXTENSIBLE-" );
-        a_buf.append( this.m_matchingRuleId );
-        a_buf.append( "-" );
-        a_buf.append( this.value );
-        a_buf.append( ')' );
+        buf.append( '(' ).append( getAttribute() );
+        buf.append( "-" );
+        buf.append( this.dnAttributes );
+        buf.append( "-EXTENSIBLE-" );
+        buf.append( this.matchingRuleId );
+        buf.append( "-" );
+        buf.append( StringUtils.toUtf8( this.value ) );
+        buf.append( "/" );
+        buf.append( StringUtils.dumpBytes( this.value ) );
+        buf.append( ')' );
 
         if ( ( null != getAnnotations() )
                 && getAnnotations().containsKey( "count" ) )
         {
-            a_buf.append( '[' );
-            a_buf.append( getAnnotations().get( "count" ).toString() );
-            a_buf.append( "] " );
+            buf.append( '[' );
+            buf.append( getAnnotations().get( "count" ).toString() );
+            buf.append( "] " );
         }
         else
         {
-            a_buf.append( ' ' );
+            buf.append( ' ' );
         }
         
-        return a_buf;
+        return buf;
     }
 
 
@@ -132,10 +135,10 @@
      */
     public String toString()
     {
-        StringBuffer l_buf = new StringBuffer() ;
-        printToBuffer( l_buf ) ;
+        StringBuffer buf = new StringBuffer() ;
+        printToBuffer( buf ) ;
 
-        return ( l_buf.toString() ) ;
+        return ( buf.toString() ) ;
     }
 
 
@@ -143,11 +146,11 @@
      * @see org.apache.ldap.common.filter.ExprNode#accept(
      * org.apache.ldap.common.filter.FilterVisitor)
      */
-    public void accept( FilterVisitor a_visitor )
+    public void accept( FilterVisitor visitor )
     {
-        if ( a_visitor.canVisit( this ) )
+        if ( visitor.canVisit( this ) )
         {
-            a_visitor.visit( this ) ;
+            visitor.visit( this ) ;
         }
     }
 }