directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r327988 - in /directory/shared/ldap/branches/shared-ldap-utf8: apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/add/ apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/compare/ apache-provider/src/java/or...
Date Mon, 24 Oct 2005 07:53:09 GMT
Author: elecharny
Date: Mon Oct 24 00:51:33 2005
New Revision: 327988

URL: http://svn.apache.org/viewcvs?rev=327988&view=rev
Log:
First drop of modification in the utf8 branche

Modified:
    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/add/AddRequestAttributesRule.java
    directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/add/AddRequestEntryDnRule.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/compare/CompareEntryRule.java
    directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/encoder/EncoderUtils.java
    directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/encoder/add/AddRequestEncoder.java
    directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/add/AddRequestTest.java
    directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/search/SearchResponseEntryTest.java
    directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/add/AddRequestEncoderTest.java
    directory/shared/ldap/branches/shared-ldap-utf8/apache2-provider/src/java/main/org/apache/asn1new/ldap/TwixTransformer.java
    directory/shared/ldap/branches/shared-ldap-utf8/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/AddRequest.java
    directory/shared/ldap/branches/shared-ldap-utf8/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/SearchResultEntry.java
    directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/message/AddRequest.java
    directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/message/AddRequestImpl.java
    directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/message/CompareRequest.java
    directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/message/SearchResponseEntryImpl.java
    directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/util/AttributeUtils.java
    directory/shared/ldap/branches/shared-ldap-utf8/common/src/test/org/apache/ldap/common/message/AddRequestImplTest.java
    directory/shared/ldap/branches/shared-ldap-utf8/common/src/test/org/apache/ldap/common/message/CompareRequestImplTest.java
    directory/shared/ldap/branches/shared-ldap-utf8/snacc-provider/src/java/org/apache/ldap/common/berlib/snacc/AddRequestTransform.java

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=327988&r1=327987&r2=327988&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 Mon Oct 24 00:51:33 2005
@@ -71,6 +71,7 @@
         Attributes attrs = ( Attributes ) getDigester().peek( 1 ) ;
 
         byte[] octets = null ;
+        
         if ( buf.limit() == buf.capacity() && buf.hasArray() )
         {
             // use the backing store
@@ -92,7 +93,7 @@
             attrs.put( attr );
         }
 
-        attr.add( new String( octets ) ) ;
+        attr.add( octets ) ;
 
         // clean up
         setConstructed( false ) ;

Modified: directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/add/AddRequestAttributesRule.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/AddRequestAttributesRule.java?rev=327988&r1=327987&r2=327988&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/add/AddRequestAttributesRule.java (original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/add/AddRequestAttributesRule.java Mon Oct 24 00:51:33 2005
@@ -75,7 +75,7 @@
 
         AddRequestImpl req = ( AddRequestImpl ) getDigester().peek() ;
         LockableAttributesImpl attrs = new LockableAttributesImpl( req ) ;
-        req.setEntry( attrs ) ;
+        req.setAttributes( attrs ) ;
         getDigester().push( attrs ) ;
     }
 

Modified: directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/add/AddRequestEntryDnRule.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/AddRequestEntryDnRule.java?rev=327988&r1=327987&r2=327988&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/add/AddRequestEntryDnRule.java (original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/add/AddRequestEntryDnRule.java Mon Oct 24 00:51:33 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.AddRequest;
 
 import java.nio.ByteBuffer;
@@ -75,6 +76,6 @@
             buf.get( octets ) ;
         }
 
-        req.setName( new String( octets ) ) ;
+        req.setEntry( StringUtils.toUtf8( octets ) ) ;
     }
 }

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=327988&r1=327987&r2=327988&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 Mon Oct 24 00:51:33 2005
@@ -18,6 +18,7 @@
 
 
 import org.apache.asn1.ber.digester.rules.PrimitiveOctetStringRule;
+import org.apache.asn1new.util.StringUtils;
 import org.apache.ldap.common.message.CompareRequest;
 
 import java.nio.ByteBuffer;
@@ -56,6 +57,7 @@
         CompareRequest req = ( CompareRequest ) getDigester().peek() ;
 
         byte[] octets = null ;
+        
         if ( buf.limit() == buf.capacity() && buf.hasArray() )
         {
             // use the backing store
@@ -70,11 +72,11 @@
 
         if ( req.getAttributeId() == null )
         {
-            req.setAttributeId( new String( octets ) ) ;
+            req.setAttributeId( StringUtils.toUtf8( octets ) ) ;
         }
         else
         {
-            req.setAssertionValue( new String( octets ) ) ;
+            req.setAssertionValue( octets ) ;
         }
     }
 }

Modified: directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/compare/CompareEntryRule.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/CompareEntryRule.java?rev=327988&r1=327987&r2=327988&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/compare/CompareEntryRule.java (original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/decoder/compare/CompareEntryRule.java Mon Oct 24 00:51:33 2005
@@ -18,6 +18,7 @@
 
 
 import org.apache.asn1.ber.digester.rules.PrimitiveOctetStringRule;
+import org.apache.asn1new.util.StringUtils;
 import org.apache.ldap.common.message.CompareRequest;
 
 import java.nio.ByteBuffer;
@@ -56,6 +57,7 @@
         CompareRequest req = ( CompareRequest ) getDigester().peek() ;
 
         byte[] name = null ;
+
         if ( buf.limit() == buf.capacity() && buf.hasArray() )
         {
             // use the backing store
@@ -68,6 +70,6 @@
             buf.get( name ) ;
         }
 
-        req.setName( new String( name ) ) ;
+        req.setName( StringUtils.toUtf8( name ) ) ;
     }
 }

Modified: directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/encoder/EncoderUtils.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/encoder/EncoderUtils.java?rev=327988&r1=327987&r2=327988&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/encoder/EncoderUtils.java (original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/encoder/EncoderUtils.java Mon Oct 24 00:51:33 2005
@@ -23,6 +23,7 @@
 import org.apache.asn1.ber.TupleNode;
 import org.apache.asn1.ber.primitives.PrimitiveUtils;
 import org.apache.asn1.ber.primitives.UniversalTag;
+import org.apache.asn1new.util.StringUtils;
 
 import java.nio.ByteBuffer;
 
@@ -60,7 +61,7 @@
     {
         Tuple t = new Tuple();
         t.setTag( tag, true );
-        ByteBuffer chunk = ByteBuffer.wrap( octets.getBytes() );
+        ByteBuffer chunk = ByteBuffer.wrap( StringUtils.getBytesUtf8( octets ) );
         t.setLength( chunk.remaining() );
         t.setLastValueChunk( chunk );
         return new DefaultMutableTupleNode( t );

Modified: directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/encoder/add/AddRequestEncoder.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/encoder/add/AddRequestEncoder.java?rev=327988&r1=327987&r2=327988&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/encoder/add/AddRequestEncoder.java (original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/java/org/apache/ldap/common/berlib/asn1/encoder/add/AddRequestEncoder.java Mon Oct 24 00:51:33 2005
@@ -64,7 +64,7 @@
 
         // Add the LDAPDN entry name to the addReq node
         child = ( DefaultMutableTupleNode )
-                EncoderUtils.encode( request.getName() );
+                EncoderUtils.encode( request.getEntry() );
         addReq.addLast( child );
         child.setParent( addReq );
 
@@ -72,7 +72,7 @@
         // to the AttributesEncoder which is also used by the SearchRequest
         // for generating the PartialAttributesList with the same ASN.1 syntax
         child = ( DefaultMutableTupleNode )
-                AttributesEncoder.INSTANCE.encode( request.getEntry() );
+                AttributesEncoder.INSTANCE.encode( request.getAttributes() );
         addReq.addLast( child );
         child.setParent( addReq );
 

Modified: directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/add/AddRequestTest.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/add/AddRequestTest.java?rev=327988&r1=327987&r2=327988&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/add/AddRequestTest.java (original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/add/AddRequestTest.java Mon Oct 24 00:51:33 2005
@@ -17,12 +17,15 @@
 package org.apache.ldap.common.berlib.asn1.decoder.add ;
 
 
+import javax.naming.NamingEnumeration;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+
+import junit.framework.Assert;
+
+import org.apache.asn1new.util.StringUtils;
 import org.apache.ldap.common.berlib.asn1.decoder.testutils.RuleTestCase;
 import org.apache.ldap.common.message.AddRequest;
-import org.apache.ldap.common.message.AddRequestImpl;
-import org.apache.ldap.common.message.LockableAttributesImpl;
-import org.apache.ldap.common.message.LockableAttributeImpl;
-
 
 /**
  * Tests the capability to end to end decode a AddRequest.
@@ -40,19 +43,41 @@
     {
         byte[] pdu = {0x30, 0x4E, 0x02, 0x01, 0x21, 0x68, 0x49, 0x04, 0x11, 0x64, 0x63, 0x3D, 0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2C, 0x64, 0x63, 0x3D, 0x63, 0x6F, 0x6D, 0x30, 0x34, 0x30, 0x1E, 0x04, 0x0B, 0x6F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x43, 0x6C, 0x61, 0x73, 0x73, 0x31, 0x0F, 0x04, 0x03, 0x74, 0x6F, 0x70, 0x04, 0x08, 0x64, 0x63, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x30, 0x12, 0x04, 0x02, 0x64, 0x63, 0x31, 0x0C, 0x04, 0x0A, 0x64, 0x63, 0x3D, 0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65};
 
-        AddRequestImpl expected = new AddRequestImpl( 33 ) ;
-        expected.setName( "dc=example,dc=com" ) ;
-        LockableAttributesImpl attrs = new LockableAttributesImpl( expected ) ;
-        LockableAttributeImpl objectClass = new LockableAttributeImpl( attrs, "objectClass" );
-        attrs.put( objectClass );
-        objectClass.add( "top" ) ;
-        objectClass.add( "dcObject" ) ;
-        attrs.put( "dc", "dc=example" ) ;
-        expected.setEntry( attrs ) ;
-
         AddRequest decoded = ( AddRequest ) decode( pdu ) ;
-        assertEquals( expected, decoded ) ;
-    }
-
+        
+        Attributes attrs = decoded.getAttributes();
 
+        assertEquals( 2, attrs.size() );
+        
+        NamingEnumeration attrsIter = attrs.getAll();
+        
+        while ( attrsIter.hasMoreElements() )
+        {
+            Attribute attr = (Attribute)attrsIter.nextElement();
+            
+            if ( attr.getID().equals( "objectClass" ) )
+            {
+                assertEquals( 2, attr.size() );
+                
+                if ( StringUtils.toUtf8( (byte[])attr.get(0) ).equals( "top" ) )
+                    {
+                    assertEquals( "dcObject", StringUtils.toUtf8( (byte[])attr.get(1) ) );
+                    }
+                else
+                {
+                    assertEquals( "dcObject", StringUtils.toUtf8( (byte[])attr.get(0) ) );
+                    assertEquals("top", StringUtils.toUtf8( (byte[])attr.get(0) ) );
+                }
+            }
+            else if ( attr.getID().equals( "dc" ) ) 
+            {
+                assertEquals( 1, attr.size() );
+                assertEquals( "dc=example", StringUtils.toUtf8( (byte[])attr.get() ) );
+            }
+            else
+            {
+                Assert.fail();
+            }
+        }
+    }
 }

Modified: directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/search/SearchResponseEntryTest.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/search/SearchResponseEntryTest.java?rev=327988&r1=327987&r2=327988&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/search/SearchResponseEntryTest.java (original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/decoder/search/SearchResponseEntryTest.java Mon Oct 24 00:51:33 2005
@@ -17,11 +17,15 @@
 package org.apache.ldap.common.berlib.asn1.decoder.search ;
 
 
+import javax.naming.NamingEnumeration;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+
+import junit.framework.Assert;
+
+import org.apache.asn1new.util.StringUtils;
 import org.apache.ldap.common.berlib.asn1.decoder.testutils.RuleTestCase;
-import org.apache.ldap.common.message.LockableAttributesImpl;
 import org.apache.ldap.common.message.SearchResponseEntry;
-import org.apache.ldap.common.message.SearchResponseEntryImpl;
-import org.apache.ldap.common.message.LockableAttributeImpl;
 
 
 /**
@@ -38,16 +42,41 @@
         byte[] pdu = new byte[] {0x30, 0x4E, 0x02, 0x01, 0x21, 0x64, 0x49, 0x04, 0x11, 0x64, 0x63, 0x3D, 0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2C, 0x64, 0x63, 0x3D, 0x63, 0x6F, 0x6D, 0x30, 0x34, 0x30, 0x1E, 0x04, 0x0B, 0x6F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x43, 0x6C, 0x61, 0x73, 0x73, 0x31, 0x0F, 0x04, 0x03, 0x74, 0x6F, 0x70, 0x04, 0x08, 0x64, 0x63, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x30, 0x12, 0x04, 0x02, 0x64, 0x63, 0x31, 0x0C, 0x04, 0x0A, 0x64, 0x63, 0x3D, 0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65};
         SearchResponseEntry decoded = ( SearchResponseEntry ) decode( pdu );
 
-        SearchResponseEntryImpl expected = new SearchResponseEntryImpl( 33 ) ;
-        expected.setObjectName( "dc=example,dc=com" ) ;
-        LockableAttributesImpl attrs = new LockableAttributesImpl( expected ) ;
-        LockableAttributeImpl objectClass = new LockableAttributeImpl( attrs, "objectClass" );
-        attrs.put( objectClass );
-        objectClass.add( "top" ) ;
-        objectClass.add( "dcObject" ) ;
-        attrs.put( "dc", "dc=example" ) ;
-        expected.setAttributes( attrs ); ;
-
-        assertEquals( expected, decoded ) ;
+        assertEquals( "dc=example,dc=com", decoded.getObjectName() );
+        
+        Attributes attrs = decoded.getAttributes();
+        
+        assertEquals( 2, attrs.size() );
+        
+        NamingEnumeration attrsIter = attrs.getAll();
+        
+        while ( attrsIter.hasMoreElements() )
+        {
+            Attribute attr = (Attribute)attrsIter.nextElement();
+            
+            if ( attr.getID().equals( "objectClass" ) )
+            {
+                assertEquals( 2, attr.size() );
+                
+                if ( StringUtils.toUtf8( (byte[])attr.get(0) ).equals( "top" ) )
+                    {
+                    assertEquals( "dcObject", StringUtils.toUtf8( (byte[])attr.get(1) ) );
+                    }
+                else
+                {
+                    assertEquals( "dcObject", StringUtils.toUtf8( (byte[])attr.get(0) ) );
+                    assertEquals("top", StringUtils.toUtf8( (byte[])attr.get(0) ) );
+                }
+            }
+            else if ( attr.getID().equals( "dc" ) ) 
+            {
+                assertEquals( 1, attr.size() );
+                assertEquals( "dc=example", StringUtils.toUtf8( (byte[])attr.get() ) );
+            }
+            else
+            {
+                Assert.fail();
+            }
+        }
     }
 }

Modified: directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/add/AddRequestEncoderTest.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/add/AddRequestEncoderTest.java?rev=327988&r1=327987&r2=327988&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/add/AddRequestEncoderTest.java (original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/apache-provider/src/test/org/apache/ldap/common/berlib/asn1/encoder/add/AddRequestEncoderTest.java Mon Oct 24 00:51:33 2005
@@ -37,14 +37,14 @@
     public void testEncode() throws NamingException
     {
         AddRequestImpl request = new AddRequestImpl( 33 );
-        request.setName( "dc=apache,dc=org" );
+        request.setEntry( "dc=apache,dc=org" );
         LockableAttributesImpl attrs = new LockableAttributesImpl( request );
         LockableAttributeImpl objectClass = new LockableAttributeImpl( "objectClass" );
         objectClass.add( "top" );
         objectClass.add( "dcObject" );
         attrs.put( objectClass );
         attrs.put( "dc", "example.com" );
-        request.setEntry( attrs );
+        request.setAttributes( attrs );
 
         byte[] expected = new byte[] {0x30, 0x4E, 0x02, 0x01, 0x21, 0x68, 0x49, 0x04, 0x10, 0x64, 0x63, 0x3D, 0x61, 0x70, 0x61, 0x63, 0x68, 0x65, 0x2C, 0x64, 0x63, 0x3D, 0x6F, 0x72, 0x67, 0x30, 0x35, 0x30, 0x1E, 0x04, 0x0B, 0x6F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x43, 0x6C, 0x61, 0x73, 0x73, 0x31, 0x0F, 0x04, 0x08, 0x64, 0x63, 0x4F, 0x62, 0x6A, 0x65, 0x63, 0x74, 0x04, 0x03, 0x74, 0x6F, 0x70, 0x30, 0x13, 0x04, 0x02, 0x64, 0x63, 0x31, 0x0D, 0x04, 0x0B, 0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2E, 0x63, 0x6F, 0x6D};
 

Modified: directory/shared/ldap/branches/shared-ldap-utf8/apache2-provider/src/java/main/org/apache/asn1new/ldap/TwixTransformer.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-utf8/apache2-provider/src/java/main/org/apache/asn1new/ldap/TwixTransformer.java?rev=327988&r1=327987&r2=327988&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/apache2-provider/src/java/main/org/apache/asn1new/ldap/TwixTransformer.java (original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/apache2-provider/src/java/main/org/apache/asn1new/ldap/TwixTransformer.java Mon Oct 24 00:51:33 2005
@@ -178,10 +178,10 @@
     	AddRequest addRequest = twixMessage.getAddRequest();
 
     	// Twix : LdapDN entry -> Snickers : String name
-    	snickersMessage.setName( addRequest.getEntry() );
+    	snickersMessage.setEntry( addRequest.getEntry() );
     	
     	// Twix : Attributes attributes -> Snickers : Attributes entry
-    	snickersMessage.setEntry( addRequest.getAttributes() );
+    	snickersMessage.setAttributes( addRequest.getAttributes() );
     	
     	return snickersMessage;
     }

Modified: directory/shared/ldap/branches/shared-ldap-utf8/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/AddRequest.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-utf8/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/AddRequest.java?rev=327988&r1=327987&r2=327988&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/AddRequest.java (original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/AddRequest.java Mon Oct 24 00:51:33 2005
@@ -25,6 +25,7 @@
 import org.apache.asn1new.ldap.codec.LdapConstants;
 import org.apache.asn1new.ldap.codec.primitives.LdapDN;
 import org.apache.asn1new.ldap.codec.primitives.LdapString;
+import org.apache.ldap.common.util.AttributeUtils;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -235,22 +236,22 @@
                 // The values
                 try
                 {
-	                NamingEnumeration values = attribute.getAll();
-	                
-	                if ( values.hasMoreElements() )
-	                {
+                    NamingEnumeration values = attribute.getAll();
+                    
+                    if ( values.hasMoreElements() )
+                    {
                         localValuesLength = 0;
-	                    
-		                while ( values.hasMoreElements() )
-		                {
-		                    OctetString value = (OctetString)values.next();
-		                    
+                        
+                        while ( values.hasMoreElements() )
+                        {
+                            OctetString value = (OctetString)values.next();
+                            
                             localValuesLength += 1 + Length.getNbBytes( value.getNbBytes() ) + value.getNbBytes();
-		                }
+                        }
 
                         localAttributeLength += 1 + Length.getNbBytes( localValuesLength ) + localValuesLength; 
-	                }
-	                
+                    }
+                    
                 }
                 catch (NamingException ne)
                 {
@@ -272,7 +273,7 @@
         
         if ( log.isDebugEnabled() )
         {
-        	log.debug( "AddRequest PDU length = " + result );
+            log.debug( "AddRequest PDU length = " + result );
         }
         
         return result;
@@ -379,8 +380,8 @@
 
         if ( log.isDebugEnabled() )
         {
-        	log.debug( "AddRequest encoding : " + StringUtils.dumpBytes( buffer.array() ) );
-        	log.debug( "AddRequest initial value : " + toString() );
+            log.debug( "AddRequest encoding : " + StringUtils.dumpBytes( buffer.array() ) );
+            log.debug( "AddRequest initial value : " + toString() );
         }
         
         return buffer;
@@ -390,7 +391,7 @@
      * Return a String representing an AddRequest
      * 
      * @return A String representing the AddRequest
-    */
+     */
     public String toString()
     {
 
@@ -398,37 +399,15 @@
 
         sb.append( "    Add Request\n" );
         sb.append( "        Entry : '" ).append( entry.toString() ).append( "'\n" );
+        sb.append( "        Attributes\n" );
 
-        if ( attributes != null )
+        if ( ( attributes == null ) || ( attributes.size() == 0 ) )
         {
-            sb.append( "        Attributes\n" );
-
-            NamingEnumeration attributesIterator = attributes.getAll();
-            
-            while (attributesIterator.hasMoreElements())
-            {
-                Attribute attribute = ( Attribute ) attributesIterator.nextElement();
-
-                sb.append( "           Type : '" ).append( attribute.getID() ).append( "'\n" );
-
-                for ( int j = 0; j < attribute.size(); j++ )
-                {
-
-                    try
-                    {
-
-                        OctetString attributeValue = ( OctetString ) attribute.get( j );
-                        sb.append( "               Val[" ).append( j ).append( "] : " )
-                          .append( attributeValue.toString() ).append( " \n" );
-                    }
-                    catch ( NamingException ne )
-                    {
-                        log.error( "Naming exception will printing the '" + attribute.getID() +
-                            "'" );
-                    }
-
-                }
-            }
+            sb.append( "            No attributes\n" );
+        }
+        else
+        {
+            AttributeUtils.toString( "            ", attributes );
         }
 
         return sb.toString();

Modified: directory/shared/ldap/branches/shared-ldap-utf8/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/SearchResultEntry.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-utf8/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/SearchResultEntry.java?rev=327988&r1=327987&r2=327988&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/SearchResultEntry.java (original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/apache2-provider/src/java/main/org/apache/asn1new/ldap/pojo/SearchResultEntry.java Mon Oct 24 00:51:33 2005
@@ -25,6 +25,7 @@
 import org.apache.asn1new.ldap.codec.LdapConstants;
 import org.apache.asn1new.ldap.codec.primitives.LdapDN;
 import org.apache.asn1new.ldap.codec.primitives.LdapString;
+import org.apache.ldap.common.util.AttributeUtils;
 
 import java.io.UnsupportedEncodingException;
 import java.nio.BufferOverflowException;
@@ -447,56 +448,7 @@
         }
         else
         {
-
-            NamingEnumeration attributes = partialAttributeList.getAll();
-
-            while ( attributes.hasMoreElements() )
-            {
-
-                Attribute attribute = ( Attribute ) attributes.nextElement();
-
-                sb.append( "            Name : '" ).append( attribute.getID() ).append( "'\n" );
-
-                try
-                {
-
-                    NamingEnumeration values = attribute.getAll();
-
-                    if ( values.hasMoreElements() )
-                    {
-                        sb.append( "            Values\n" );
-
-                        while ( values.hasMore() )
-                        {
-                        	Object value = values.nextElement();
-                        	sb.append( "                '" );
-                        	
-                            if (value instanceof String)
-                            {
-                                sb.append( (String)value );
-                            }
-                            else if (value instanceof OctetString)
-                            {
-                                sb.append( StringUtils.dumpBytes( ( (OctetString)value ).getValue() ) );
-                            }
-                            else
-                            {
-                                sb.append( StringUtils.dumpBytes( (byte[])value ) );
-                            }
-
-                            sb.append("'\n" );
-                        }
-                    }
-                    else
-                    {
-                        sb.append( "            No Values\n" );
-                    }
-                }
-                catch ( NamingException ne )
-                {
-                    sb.append( "            Error while reading attribute.\n " );
-                }
-            }
+            AttributeUtils.toString( "            ", partialAttributeList );
         }
 
         return sb.toString();

Modified: directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/message/AddRequest.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/message/AddRequest.java?rev=327988&r1=327987&r2=327988&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/message/AddRequest.java (original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/message/AddRequest.java Mon Oct 24 00:51:33 2005
@@ -1,19 +1,19 @@
-/*
- *   Copyright 2004 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.
- *
- */
+/*
+ *   Copyright 2004 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.
+ *
+ */
 
 /*
  * $Id: AddRequest.java,v 1.7 2003/07/31 21:44:48 akarasulu Exp $
@@ -42,6 +42,7 @@
 {
     /** LDAPv3 add request type enum code */
     MessageTypeEnum TYPE = MessageTypeEnum.ADDREQUEST ;
+    
     /** LDAPv3 add response type enum code */
     MessageTypeEnum RESP_TYPE = AddResponse.TYPE ;
 
@@ -50,27 +51,27 @@
      *
      * @return the Dn of the added entry.
      */
-    String getName() ;
+    String getEntry() ;
 
     /**
      * Sets the distinguished name of the entry to add.
      *
-     * @param a_dn the Dn of the added entry.
+     * @param entry the Dn of the added entry.
      */
-    void setName( String a_dn ) ;
+    void setEntry( String entry ) ;
 
     /**
      * Gets the attributes of the entry to add.
      *
      * @return the Attributes containing attribute value pairs.
      */
-    Attributes getEntry() ;
+    Attributes getAttributes() ;
 
     /**
      * Sets the attribute value pairs of the entry to add.
      *
-     * @param a_entry the Attributes with attribute value pairs for the added 
+     * @param attributes the Attributes with attribute value pairs for the added 
      * entry.
      */
-    void setEntry( Attributes a_entry ) ;
+    void setAttributes( Attributes attributes ) ;
 }

Modified: directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/message/AddRequestImpl.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/message/AddRequestImpl.java?rev=327988&r1=327987&r2=327988&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/message/AddRequestImpl.java (original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/message/AddRequestImpl.java Mon Oct 24 00:51:33 2005
@@ -1,189 +1,211 @@
-/*
- *   Copyright 2004 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.ldap.common.message;
-
-
-import javax.naming.directory.Attributes;
-
-
-/**
- * Lockable add request implemenation.
- *
- * @author <a href="mailto:dev@directory.apache.org">
- * Apache Directory Project</a>
- * @version $Rev$
- */
-public class AddRequestImpl
-    extends AbstractRequest implements AddRequest
-{
-    static final long serialVersionUID = 7534132448349520346L;
-    /** Distinguished name of the new entry. */
-    private String name;
-    /** A MultiMap of the new entry's attributes and their values */
-    private Attributes entry;
-
-
-    // ------------------------------------------------------------------------
-    // Constructors
-    // ------------------------------------------------------------------------
-
-
-    /**
-     * Creates an AddRequest implementation to create a new entry.
-     *
-     * @param id the sequence identifier of the AddRequest message.
-     */
-    public AddRequestImpl( final int id )
-    {
-        super( id, TYPE, true );
-    }
-
-
-    // ------------------------------------------------------------------------
-    // AddRequest Interface Method Implementations
-    // ------------------------------------------------------------------------
-
-
-    /**
-     * Gets the distinguished name of the entry to add.
-     *
-     * @return the Dn of the added entry.
-     */
-    public String getName()
-    {
-        return name;
-    }
-
-
-    /**
-     * Sets the distinguished name of the entry to add.
-     *
-     * @param name the Dn of the added entry.
-     */
-    public void setName( String name )
-    {
-        lockCheck( "Attempt to alter new entry name of locked AddRequest!" );
-        this.name = name;
-    }
-
-
-    /**
-     * Gets the attribute value pairs of the entry to add as a MultiMap.
-     *
-     * @return the Attribute with attribute value pairs.
-     */
-    public Attributes getEntry()
-    {
-        return entry;
-    }
-
-
-    /**
-     * Sets the attribute value pairs of the entry to add as a MultiMap.
-     *
-     * @param entry the Attributes with attribute value pairs for the added
-     * entry.
-     */
-    public void setEntry( Attributes entry )
-    {
-        lockCheck( "Attempt to alter entry of locked AddRequest!" );
-        this.entry = entry;
-    }
-
-
-    // ------------------------------------------------------------------------
-    // SingleReplyRequest Interface Method Implementations
-    // ------------------------------------------------------------------------
-
-
-    /**
-     * Gets the protocol response message type for this request which produces
-     * at least one response.
-     *
-     * @return the message type of the response.
-     */
-    public MessageTypeEnum getResponseType()
-    {
-        return RESP_TYPE;
-    }
-
-
-    /**
-     * Checks to see if an object is equivalent to this AddRequest.  First
-     * there's a quick test to see if the obj is the same object as this
-     * one - if so true is returned. Next if the super method fails false is
-     * returned.  Then the name of the entry is compared - if not the same false
-     * is returned.  Lastly the attributes of the entry are compared.  If they
-     * are not the same false is returned otherwise the method exists returning
-     * true.
-     *
-     * @param obj the object to test for equality to this
-     * @return true if the obj is equal to this AddRequest, false otherwise
-     */
-    public boolean equals( Object obj )
-    {
-        if ( this == obj )
-        {
-            return true;
-        }
-
-        if ( ! super.equals( obj ) )
-        {
-            return false;
-        }
-
-        AddRequest req = ( AddRequest ) obj;
-
-        if ( name != null && req.getName() == null )
-        {
-            return false;
-        }
-
-        if ( name == null && req.getName() != null )
-        {
-            return false;
-        }
-
-        if ( name != null && req.getName() != null )
-        {
-            if ( ! name.equals( req.getName() ) )
-            {
-                return false;
-            }
-        }
-
-        if ( entry != null && req.getEntry() == null )
-        {
-            return false;
-        }
-
-        if ( entry == null && req.getEntry() != null )
-        {
-            return false;
-        }
-
-        if ( entry != null && req.getEntry() != null )
-        {
-            if ( ! entry.equals( req.getEntry() ) )
-            {
-                return false;
-            }
-        }
-
-        return true;
-    }
-}
+/*
+ *   Copyright 2004 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.ldap.common.message;
+
+
+import javax.naming.directory.Attributes;
+
+import org.apache.ldap.common.util.AttributeUtils;
+
+
+/**
+ * Lockable add request implemenation.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class AddRequestImpl
+    extends AbstractRequest implements AddRequest
+{
+    static final long serialVersionUID = 7534132448349520346L;
+    /** Distinguished name of the new entry. */
+    private String entry;
+    
+    /** A MultiMap of the new entry's attributes and their values */
+    private Attributes attributes;
+
+
+    // ------------------------------------------------------------------------
+    // Constructors
+    // ------------------------------------------------------------------------
+
+
+    /**
+     * Creates an AddRequest implementation to create a new entry.
+     *
+     * @param id the sequence identifier of the AddRequest message.
+     */
+    public AddRequestImpl( final int id )
+    {
+        super( id, TYPE, true );
+    }
+
+
+    // ------------------------------------------------------------------------
+    // AddRequest Interface Method Implementations
+    // ------------------------------------------------------------------------
+
+
+    /**
+     * Gets the distinguished name of the entry to add.
+     *
+     * @return the Dn of the added entry.
+     */
+    public String getEntry()
+    {
+        return entry;
+    }
+
+
+    /**
+     * Sets the distinguished name of the entry to add.
+     *
+     * @param entry the Dn of the added entry.
+     */
+    public void setEntry( String entry )
+    {
+        lockCheck( "Attempt to alter new entry name of locked AddRequest!" );
+        this.entry = entry;
+    }
+
+
+    /**
+     * Gets the attribute value pairs of the entry to add as a MultiMap.
+     *
+     * @return the Attribute with attribute value pairs.
+     */
+    public Attributes getAttributes()
+    {
+        return attributes;
+    }
+
+
+    /**
+     * Sets the attribute value pairs of the entry to add as a MultiMap.
+     *
+     * @param entry the Attributes with attribute value pairs for the added
+     * entry.
+     */
+    public void setAttributes( Attributes attributes )
+    {
+        lockCheck( "Attempt to alter entry of locked AddRequest!" );
+        this.attributes = attributes;
+    }
+
+
+    // ------------------------------------------------------------------------
+    // SingleReplyRequest Interface Method Implementations
+    // ------------------------------------------------------------------------
+
+
+    /**
+     * Gets the protocol response message type for this request which produces
+     * at least one response.
+     *
+     * @return the message type of the response.
+     */
+    public MessageTypeEnum getResponseType()
+    {
+        return RESP_TYPE;
+    }
+
+
+    /**
+     * Checks to see if an object is equivalent to this AddRequest.  First
+     * there's a quick test to see if the obj is the same object as this
+     * one - if so true is returned. Next if the super method fails false is
+     * returned.  Then the name of the entry is compared - if not the same false
+     * is returned.  Lastly the attributes of the entry are compared.  If they
+     * are not the same false is returned otherwise the method exists returning
+     * true.
+     *
+     * @param obj the object to test for equality to this
+     * @return true if the obj is equal to this AddRequest, false otherwise
+     */
+    public boolean equals( Object obj )
+    {
+        if ( this == obj )
+        {
+            return true;
+        }
+
+        if ( ! super.equals( obj ) )
+        {
+            return false;
+        }
+
+        AddRequest req = ( AddRequest ) obj;
+
+        if ( entry != null && req.getEntry() == null )
+        {
+            return false;
+        }
+
+        if ( entry == null && req.getEntry() != null )
+        {
+            return false;
+        }
+
+        if ( entry != null && req.getEntry() != null )
+        {
+            if ( ! entry.equals( req.getEntry() ) )
+            {
+                return false;
+            }
+        }
+
+        if ( attributes != null && req.getAttributes() == null )
+        {
+            return false;
+        }
+
+        if ( attributes == null && req.getAttributes() != null )
+        {
+            return false;
+        }
+
+        if ( attributes != null && req.getAttributes() != null )
+        {
+            if ( ! attributes.equals( req.getAttributes() ) )
+            {
+                return false;
+            }
+        }
+
+        return true;
+    }
+    
+    public String toString()
+    {
+        StringBuffer sb = new StringBuffer();
+        
+        sb.append( "    Add Request\n" );
+        sb.append( "        Entry : '" ).append( entry.toString() ).append( "'\n" );
+
+        if ( ( attributes == null ) || ( attributes.size() == 0 ) )
+        {
+            sb.append( "            No attributes\n" );
+        }
+        else
+        {
+            AttributeUtils.toString( "            ", attributes );
+        }
+        
+        return sb.toString();
+    }
+}

Modified: directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/message/CompareRequest.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/message/CompareRequest.java?rev=327988&r1=327987&r2=327988&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/message/CompareRequest.java (original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/message/CompareRequest.java Mon Oct 24 00:51:33 2005
@@ -75,6 +75,13 @@
     void setAssertionValue( String a_value ) ;
 
     /**
+     * Sets the attribute value to use in the comparison.
+     *
+     * @param a_value the attribute value used in comparison.
+     */
+    void setAssertionValue( byte[] value ) ;
+
+    /**
      * Gets the attribute id use in making the comparison.
      *
      * @return the attribute id used in comparison.

Modified: directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/message/SearchResponseEntryImpl.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/message/SearchResponseEntryImpl.java?rev=327988&r1=327987&r2=327988&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/message/SearchResponseEntryImpl.java (original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/message/SearchResponseEntryImpl.java Mon Oct 24 00:51:33 2005
@@ -19,6 +19,8 @@
 
 import javax.naming.directory.Attributes;
 
+import org.apache.ldap.common.util.AttributeUtils;
+
 
 /**
  * Lockable SearchResponseEntry implementation
@@ -32,7 +34,7 @@
 {
     static final long serialVersionUID = -8357316233060886637L;
     /** Distinguished name of the search result entry returned */
-    private String dn = "";
+    private String objectName = "";
     /** Partial set of attributes returned in response to search */
     private Attributes attributes;
 
@@ -90,7 +92,7 @@
      */
     public String getObjectName()
     {
-        return dn;
+        return objectName;
     }
 
 
@@ -99,10 +101,10 @@
      *
      * @param dn the Dn of the entry returned.
      */
-    public void setObjectName( String dn )
+    public void setObjectName( String objectName )
     {
         lockCheck( "Attempt to alter Dn of a locked SearchResponseEntry!" );
-        this.dn = dn;
+        this.objectName = objectName;
     }
 
 
@@ -128,7 +130,7 @@
 
         SearchResponseEntry resp = ( SearchResponseEntry ) obj;
 
-        if ( ! dn.equals( resp.getObjectName() ) )
+        if ( ! objectName.equals( resp.getObjectName() ) )
         {
             return false;
         }
@@ -149,5 +151,29 @@
         }
         
         return true;
+    }
+    
+
+    /**
+     * Return a string representation of a SearchResultEntry request
+     */
+    public String toString()
+    {
+        StringBuffer sb = new StringBuffer();
+        
+        sb.append( "    Search Result Entry\n" );
+        sb.append( "        Object Name : '" ).append( objectName.toString() ).append( "'\n" );
+        sb.append( "        Attributes\n" );
+
+        if ( attributes != null )
+        {
+            sb.append( AttributeUtils.toString( attributes ) );
+        }
+        else
+        {
+            sb.append( "            No attributes\n" );
+        }
+        
+        return sb.toString();
     }
 }

Modified: directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/util/AttributeUtils.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/util/AttributeUtils.java?rev=327988&r1=327987&r2=327988&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/util/AttributeUtils.java (original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/common/src/java/org/apache/ldap/common/util/AttributeUtils.java Mon Oct 24 00:51:33 2005
@@ -17,9 +17,13 @@
 package org.apache.ldap.common.util;
 
 
+import org.apache.asn1new.primitives.OctetString;
+import org.apache.asn1new.util.StringUtils;
 import org.apache.ldap.common.message.LockableAttributeImpl;
 
 import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 
 
@@ -144,5 +148,81 @@
         }
 
         return attr;
+    }
+
+    /**
+     * Return a string representing the attributes with tabs in front of the string
+     * @param tabs Spaces to be added before the string
+     * @param attributes The attributes to print
+     * @return A string
+     */
+    public static String toString( String tabs, Attributes attributes )
+    {
+        StringBuffer sb = new StringBuffer();
+        
+        sb.append( tabs ).append( "Attributes\n" );
+
+        NamingEnumeration attributesIterator = attributes.getAll();
+        
+        while (attributesIterator.hasMoreElements())
+        {
+            Attribute attribute = ( Attribute ) attributesIterator.nextElement();
+
+            sb.append( tabs ).append( "    Type : '" ).append( attribute.getID() ).append( "'\n" );
+
+            for ( int j = 0; j < attribute.size(); j++ )
+            {
+
+                try
+                {
+                    Object attr = attribute.get( j );
+                    
+                    if ( attr instanceof String )
+                    {
+                        sb.append( tabs ).append( "        Val[" ).append( j ).append( "] : " )
+                        .append( attr ).append( " \n" );
+                    }
+                    else if (attr instanceof byte[] )
+                    {
+                        String string = StringUtils.toUtf8( (byte[])attr );
+                        
+                        sb.append( tabs ).append( "        Val[" ).append( j ).append( "] : " );
+                        sb.append( string ).append( '/');
+                        sb.append( StringUtils.dumpBytes( (byte[]) attr ) );
+                        sb.append( " \n" );
+                    }
+                    else if (attr instanceof OctetString )
+                    {
+                        String string = StringUtils.toUtf8( ((OctetString)attr).getValue() );
+                        
+                        sb.append( tabs ).append( "        Val[" ).append( j ).append( "] : " );
+                        sb.append( string ).append( '/');
+                        sb.append( StringUtils.dumpBytes( ((OctetString)attr).getValue() ) );
+                        sb.append( " \n" );
+                    }
+                    else
+                    {
+                        sb.append( tabs ).append( "        Val[" ).append( j ).append( "] : " )
+                        .append( attr ).append( " \n" );
+                    }
+                }
+                catch ( NamingException ne )
+                {
+                    sb.append( "Bad attribute : ").append( ne.getMessage() );
+                }
+            }
+        }
+        
+        return sb.toString();
+    }
+
+    /**
+     * Return a string representing the attributes
+     * @param attributes The attributes to print
+     * @return A string
+     */
+    public static String toString( Attributes attributes )
+    {
+        return toString( "", attributes );
     }
 }

Modified: directory/shared/ldap/branches/shared-ldap-utf8/common/src/test/org/apache/ldap/common/message/AddRequestImplTest.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-utf8/common/src/test/org/apache/ldap/common/message/AddRequestImplTest.java?rev=327988&r1=327987&r2=327988&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/common/src/test/org/apache/ldap/common/message/AddRequestImplTest.java (original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/common/src/test/org/apache/ldap/common/message/AddRequestImplTest.java Mon Oct 24 00:51:33 2005
@@ -84,12 +84,12 @@
     public void testEqualsExactCopy()
     {
         AddRequestImpl req0 = new AddRequestImpl( 5 );
-        req0.setName( "cn=admin,dc=example,dc=com" );
-        req0.setEntry( getAttributes() );
+        req0.setEntry( "cn=admin,dc=example,dc=com" );
+        req0.setAttributes( getAttributes() );
 
         AddRequestImpl req1 = new AddRequestImpl( 5 );
-        req1.setName( "cn=admin,dc=example,dc=com" );
-        req1.setEntry( getAttributes() );
+        req1.setEntry( "cn=admin,dc=example,dc=com" );
+        req1.setAttributes( getAttributes() );
 
         assertTrue( req0.equals( req1 ) );
     }
@@ -101,12 +101,12 @@
     public void testNotEqualDiffId()
     {
         AddRequestImpl req0 = new AddRequestImpl( 7 );
-        req0.setName( "cn=admin,dc=example,dc=com" );
-        req0.setEntry( getAttributes() );
+        req0.setEntry( "cn=admin,dc=example,dc=com" );
+        req0.setAttributes( getAttributes() );
 
         AddRequestImpl req1 = new AddRequestImpl( 5 );
-        req1.setName( "cn=admin,dc=example,dc=com" );
-        req1.setEntry( getAttributes() );
+        req1.setEntry( "cn=admin,dc=example,dc=com" );
+        req1.setAttributes( getAttributes() );
 
         assertFalse( req0.equals( req1 ) );
     }
@@ -118,12 +118,12 @@
     public void testNotEqualDiffName()
     {
         AddRequestImpl req0 = new AddRequestImpl( 5 );
-        req0.setName( "cn=admin,dc=example,dc=com" );
-        req0.setEntry( getAttributes() );
+        req0.setEntry( "cn=admin,dc=example,dc=com" );
+        req0.setAttributes( getAttributes() );
 
         AddRequestImpl req1 = new AddRequestImpl( 5 );
-        req1.setName( "cn=admin,dc=apache,dc=org" );
-        req1.setEntry( getAttributes() );
+        req1.setEntry( "cn=admin,dc=apache,dc=org" );
+        req1.setAttributes( getAttributes() );
 
 
         assertFalse( req0.equals( req1 ) );
@@ -136,21 +136,21 @@
     public void testNotEqualDiffAttributes()
     {
         AddRequestImpl req0 = new AddRequestImpl( 5 );
-        req0.setName( "cn=admin,dc=apache,dc=org" );
-        req0.setEntry( getAttributes() );
+        req0.setEntry( "cn=admin,dc=apache,dc=org" );
+        req0.setAttributes( getAttributes() );
 
         AddRequestImpl req1 = new AddRequestImpl( 5 );
-        req1.setName( "cn=admin,dc=apache,dc=org" );
+        req1.setEntry( "cn=admin,dc=apache,dc=org" );
 
         assertFalse( req0.equals( req1 ) );
         assertFalse( req1.equals( req0 ) );
 
-        req1.setEntry( getAttributes() );
+        req1.setAttributes( getAttributes() );
 
         assertTrue( req0.equals( req1 ) );
         assertTrue( req1.equals( req0 ) );
 
-        req1.getEntry().put( "asdf", "asdf" );
+        req1.getAttributes().put( "asdf", "asdf" );
 
         assertFalse( req0.equals( req1 ) );
         assertFalse( req1.equals( req0 ) );
@@ -164,21 +164,21 @@
     {
         AddRequest req0 = new AddRequest()
         {
-            public Attributes getEntry()
+            public Attributes getAttributes()
             {
                 return AddRequestImplTest.this.getAttributes();
             }
 
-            public void setEntry( Attributes a_entry )
+            public void setAttributes( Attributes entry )
             {
             }
 
-            public String getName()
+            public String getEntry()
             {
                 return null;
             }
 
-            public void setName( String a_name )
+            public void setEntry( String entry )
             {
             }
 
@@ -202,11 +202,11 @@
                 return Collections.EMPTY_LIST;
             }
 
-            public void add( Control a_control ) throws MessageException
+            public void add( Control control ) throws MessageException
             {
             }
 
-            public void remove( Control a_control ) throws MessageException
+            public void remove( Control control ) throws MessageException
             {
             }
 
@@ -215,12 +215,12 @@
                 return 5;
             }
 
-            public Object get( Object a_key )
+            public Object get( Object key )
             {
                 return null;
             }
 
-            public Object put( Object a_key, Object a_value )
+            public Object put( Object key, Object value )
             {
                 return null;
             }
@@ -240,7 +240,7 @@
                 return false;
             }
 
-            public void setLocked( boolean a_isLocked ) throws LockException
+            public void setLocked( boolean isLocked ) throws LockException
             {
             }
 
@@ -251,7 +251,7 @@
         };
 
         AddRequestImpl req1 = new AddRequestImpl( 5 );
-        req1.setEntry( getAttributes() );
+        req1.setAttributes( getAttributes() );
         assertTrue( req1.equals( req0 ) );
     }
 }

Modified: directory/shared/ldap/branches/shared-ldap-utf8/common/src/test/org/apache/ldap/common/message/CompareRequestImplTest.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-utf8/common/src/test/org/apache/ldap/common/message/CompareRequestImplTest.java?rev=327988&r1=327987&r2=327988&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/common/src/test/org/apache/ldap/common/message/CompareRequestImplTest.java (original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/common/src/test/org/apache/ldap/common/message/CompareRequestImplTest.java Mon Oct 24 00:51:33 2005
@@ -132,7 +132,12 @@
                 return null;
             }
 
-            public void setAssertionValue( String a_value )
+            public void setAssertionValue( String value )
+            {
+
+            }
+
+            public void setAssertionValue( byte[] value )
             {
 
             }
@@ -142,7 +147,7 @@
                 return null;
             }
 
-            public void setAttributeId( String a_attrId )
+            public void setAttributeId( String attrId )
             {
 
             }

Modified: directory/shared/ldap/branches/shared-ldap-utf8/snacc-provider/src/java/org/apache/ldap/common/berlib/snacc/AddRequestTransform.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-utf8/snacc-provider/src/java/org/apache/ldap/common/berlib/snacc/AddRequestTransform.java?rev=327988&r1=327987&r2=327988&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-utf8/snacc-provider/src/java/org/apache/ldap/common/berlib/snacc/AddRequestTransform.java (original)
+++ directory/shared/ldap/branches/shared-ldap-utf8/snacc-provider/src/java/org/apache/ldap/common/berlib/snacc/AddRequestTransform.java Mon Oct 24 00:51:33 2005
@@ -61,7 +61,7 @@
         // Set the distinguished name of the entry added by the request
         LDAPMessageChoice l_protocolOp = a_snaccMessage.protocolOp ;
         AddRequest l_snaccRequest = l_protocolOp.addRequest ;
-        l_request.setName( new String( l_snaccRequest.entry ) ) ;
+        l_request.setEntry( new String( l_snaccRequest.entry ) ) ;
 
         // --------------------------------------------------------------------
         // Start building the Attributes
@@ -79,7 +79,7 @@
         // Get the attribute or AttributeList from the snacc request PDU
         LockableAttributesImpl l_attrs =
             new LockableAttributesImpl( l_request ) ;
-        l_request.setEntry( l_attrs ) ;  // Add the attributes to the entry.
+        l_request.setAttributes( l_attrs ) ;  // Add the attributes to the entry.
         LockableAttributeImpl l_attr = null ;
         AttributeList l_snaccAttrList = l_snaccRequest.attributes ;
         AttributeListSeq l_snaccAttrSeq = null ;
@@ -123,14 +123,13 @@
         l_protocolOp.addRequest = l_snaccRequest ;
 
         // Set the DN of the entry to add
-        l_snaccRequest.entry = a_request.getName().getBytes() ;
+        l_snaccRequest.entry = a_request.getEntry().getBytes() ;
 
         // Start building the AttributeList object
         Attribute l_attr = null ;
         AttributeList l_snaccAttrList = new AttributeList() ;
         AttributeListSeq l_snaccAttrListSeq = new AttributeListSeq ()  ;
-        NamingEnumeration l_attrList = a_request.getEntry().getAll() ;
-		String testString ;
+        NamingEnumeration l_attrList = a_request.getAttributes().getAll() ;
 
         while( l_attrList.hasMoreElements() )
         {



Mime
View raw message