directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1001692 - in /directory: apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/ apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/ shared/trunk/ldap/src/main/antlr/ shared/...
Date Mon, 27 Sep 2010 12:05:15 GMT
Author: elecharny
Date: Mon Sep 27 12:05:14 2010
New Revision: 1001692

URL: http://svn.apache.org/viewvc?rev=1001692&view=rev
Log:
o Renamed some methods
o Make AVA and RDN partially immutable (more to come)
o Slight improvement in decoding

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
    directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
    directory/shared/trunk/ldap/src/main/antlr/distinguishedName.g
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifRevertor.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/AVA.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DN.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/FastDnParser.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RDN.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnSerializer.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/FastDnParserTest.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java?rev=1001692&r1=1001691&r2=1001692&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
Mon Sep 27 12:05:14 2010
@@ -536,7 +536,7 @@ public class OperationalAttributeInterce
             else if ( rdn.size() == 1 )
             {
                 String name = schemaManager.lookupAttributeTypeRegistry( rdn.getNormType()
).getName();
-                String value = rdn.getAtav().getNormValue().getString();
+                String value = rdn.getAVA().getNormValue().getString();
                 newDn = newDn.add( new RDN( name, name, value, value ) );
                 continue;
             }

Modified: directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java?rev=1001692&r1=1001691&r2=1001692&view=diff
==============================================================================
--- directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
(original)
+++ directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
Mon Sep 27 12:05:14 2010
@@ -595,13 +595,13 @@ public class LdifPartition extends Abstr
         for ( RDN rdn : dn.getRdns() )
         {
             // First, get the AT name, or OID
-            String normAT = rdn.getAtav().getNormType();
+            String normAT = rdn.getAVA().getNormType();
             AttributeType at = schemaManager.lookupAttributeTypeRegistry( normAT );
 
             String atName = at.getName();
 
             // Now, get the normalized value
-            String normValue = rdn.getAtav().getNormValue().getString();
+            String normValue = rdn.getAVA().getNormValue().getString();
 
             if ( isFirst )
             {

Modified: directory/shared/trunk/ldap/src/main/antlr/distinguishedName.g
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/antlr/distinguishedName.g?rev=1001692&r1=1001691&r2=1001692&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/antlr/distinguishedName.g (original)
+++ directory/shared/trunk/ldap/src/main/antlr/distinguishedName.g Mon Sep 27 12:05:14 2010
@@ -319,7 +319,7 @@ attributeTypeAndValue [RDN rdn] returns 
                     );
                 }
            
-                rdn.addAttributeTypeAndValue( ava );
+                rdn.addAVA( ava );
             }
             catch ( LdapInvalidDnException e )
             {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java?rev=1001692&r1=1001691&r2=1001692&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
Mon Sep 27 12:05:14 2010
@@ -3630,7 +3630,7 @@ public class LdapMessageGrammar extends 
                     TLV tlv = ldapMessageContainer.getCurrentTLV();
 
                     // We have to check that this is a correct DN
-                    DN baseObject = DN.EMPTY_DN;
+                    DN baseObject = null;
 
                     // We have to handle the special case of a 0 length base
                     // object,
@@ -3656,6 +3656,10 @@ public class LdapMessageGrammar extends 
                                 DN.EMPTY_DN, ine );
                         }
                     }
+                    else
+                    {
+                        baseObject = DN.EMPTY_DN;
+                    }
 
                     searchRequest.setBase( baseObject );
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifRevertor.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifRevertor.java?rev=1001692&r1=1001691&r2=1001692&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifRevertor.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/ldif/LdifRevertor.java
Mon Sep 27 12:05:14 2010
@@ -492,7 +492,7 @@ public final class LdifRevertor
                 // Is the new RDN AVAs contained into the entry?
                 for ( AVA atav : newRdn )
                 {
-                    if ( atav.equals( oldRdn.getAtav() ) )
+                    if ( atav.equals( oldRdn.getAVA() ) )
                     {
                         // They overlap
                         overlapping = true;

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/AVA.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/AVA.java?rev=1001692&r1=1001691&r2=1001692&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/AVA.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/AVA.java
Mon Sep 27 12:05:14 2010
@@ -352,11 +352,15 @@ public class AVA implements Cloneable, C
      *
      * @return a clone of this object
      */
-    public Object clone()
+    public AVA clone()
     {
         try
         {
-            return super.clone();
+            AVA clone = ( AVA ) super.clone();
+            clone.upValue = upValue.clone();
+            clone.normValue = normValue.clone();
+            
+            return clone;
         }
         catch ( CloneNotSupportedException cnse )
         {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DN.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DN.java?rev=1001692&r1=1001691&r2=1001692&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DN.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/DN.java
Mon Sep 27 12:05:14 2010
@@ -1489,15 +1489,15 @@ public class DN implements Cloneable, Se
             for ( AVA val:rdnCopy )
             {
                 AVA newAtav = atavOidToName( val, oidsMap );
-                rdn.addAttributeTypeAndValue( newAtav );
+                rdn.addAVA( newAtav );
             }
         }
         else
         {
-            AVA val = rdn.getAtav();
+            AVA val = rdn.getAVA();
             rdn.clear();
             AVA newAtav = atavOidToName( val, oidsMap );
-            rdn.addAttributeTypeAndValue( newAtav );
+            rdn.addAVA( newAtav );
         }
     }
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/FastDnParser.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/FastDnParser.java?rev=1001692&r1=1001691&r2=1001692&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/FastDnParser.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/FastDnParser.java
Mon Sep 27 12:05:14 2010
@@ -179,7 +179,7 @@ public enum FastDnParser
 
         AVA ava = new AVA( type, type, new StringValue( upValue ),
             new StringValue( value ), upName );
-        rdn.addAttributeTypeAndValue( ava );
+        rdn.addAVA( ava );
 
         rdn.setUpName( upName );
         rdn.normalize();

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RDN.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RDN.java?rev=1001692&r1=1001691&r2=1001692&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RDN.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RDN.java
Mon Sep 27 12:05:14 2010
@@ -293,7 +293,7 @@ public class RDN implements Cloneable, C
     {
         this.schemaManager = schemaManager;
 
-        addAttributeTypeAndValue( upType, normType, new StringValue( upValue ), new StringValue(
normValue ) );
+        addAVA( upType, normType, new StringValue( upValue ), new StringValue( normValue
) );
 
         upName = upType + '=' + upValue;
         start = 0;
@@ -336,7 +336,7 @@ public class RDN implements Cloneable, C
      */
     public RDN( String upType, String upValue, SchemaManager schemaManager ) throws LdapInvalidDnException
     {
-        addAttributeTypeAndValue( upType, upType, new StringValue( upValue ), new StringValue(
upValue ) );
+        addAVA( upType, upType, new StringValue( upValue ), new StringValue( upValue ) );
 
         upName = upType + '=' + upValue;
         start = 0;
@@ -390,8 +390,7 @@ public class RDN implements Cloneable, C
      * Constructs an Rdn from the given rdn. The contents of the rdn are simply
      * copied into the newly created
      *
-     * @param rdn
-     *            The non-null Rdn to be copied.
+     * @param rdn The non-null Rdn to be copied.
      */
     public RDN( RDN rdn )
     {
@@ -536,7 +535,7 @@ public class RDN implements Cloneable, C
     // WARNING : The protection level is left unspecified intentionally.
     // We need this method to be visible from the DnParser class, but not
     // from outside this package.
-    /* Unspecified protection */void addAttributeTypeAndValue( String upType, String type,
Value<?> upValue,
+    /* Unspecified protection */void addAVA( String upType, String type, Value<?> upValue,
         Value<?> value ) throws LdapInvalidDnException
     {
         // First, let's normalize the type
@@ -600,10 +599,10 @@ public class RDN implements Cloneable, C
      *
      * @param value The added AttributeTypeAndValue
      */
-    // WARNING : The protection level is left unspecified intentionnaly.
+    // WARNING : The protection level is left unspecified intentionally.
     // We need this method to be visible from the DnParser class, but not
     // from outside this package.
-    /* Unspecified protection */void addAttributeTypeAndValue( AVA value )
+    /* Unspecified protection */void addAVA( AVA value )
     {
         String normalizedType = value.getNormType();
 
@@ -647,7 +646,10 @@ public class RDN implements Cloneable, C
     /**
      * Clear the RDN, removing all the AttributeTypeAndValues.
      */
-    public void clear()
+    // WARNING : The protection level is left unspecified intentionally.
+    // We need this method to be visible from the DnParser class, but not
+    // from outside this package.
+    /* No protection */void clear()
     {
         atav = null;
         atavs = null;
@@ -983,7 +985,7 @@ public class RDN implements Cloneable, C
      *
      * @return The first AttributeTypeAndValue of this RDN
      */
-    public AVA getAtav()
+    public AVA getAVA()
     {
         switch ( nbAtavs )
         {
@@ -994,7 +996,7 @@ public class RDN implements Cloneable, C
                 return atav;
 
             default:
-                return ( ( TreeSet<AVA> ) atavs ).first();
+                return ( ( TreeSet<AVA> ) atavs ).first().clone();
         }
     }
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnSerializer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnSerializer.java?rev=1001692&r1=1001691&r2=1001692&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnSerializer.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnSerializer.java
Mon Sep 27 12:05:14 2010
@@ -74,7 +74,7 @@ public class RdnSerializer
                 break;
 
             case 1 :
-                AVASerializer.serialize( rdn.getAtav(), out );
+                AVASerializer.serialize( rdn.getAVA(), out );
                 break;
                 
             default :
@@ -131,7 +131,7 @@ public class RdnSerializer
             case 1 :
                 AVA atav = AVASerializer.deserialize( in );
                 
-                rdn.addAttributeTypeAndValue( atav );
+                rdn.addAVA( atav );
 
                 return rdn;
                 
@@ -139,7 +139,7 @@ public class RdnSerializer
                 for ( int i = 0; i < nbAtavs; i++  )
                 {
                     atav = AVASerializer.deserialize( in );
-                    rdn.addAttributeTypeAndValue( atav );
+                    rdn.addAVA( atav );
                 }
             
                 return rdn;

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java?rev=1001692&r1=1001691&r2=1001692&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/DNTest.java
Mon Sep 27 12:05:14 2010
@@ -3309,14 +3309,14 @@ public class DNTest
         // antlr parser: string value with trailing spaces
         DN dn1 = new DN( " cn = Amos\\,Tori , ou=system " );
         assertEquals( " cn = Amos\\,Tori ", dn1.getRdn().getName() );
-        AVA atav1 = dn1.getRdn().getAtav();
+        AVA atav1 = dn1.getRdn().getAVA();
         assertEquals( "cn", atav1.getUpType() );
         assertEquals( "Amos,Tori", atav1.getUpValue().getString() );
 
         // antlr parser: hexstring with trailing spaces
         DN dn3 = new DN( " cn = #414243 , ou=system " );
         assertEquals( " cn = #414243 ", dn3.getRdn().getName() );
-        AVA atav3 = dn3.getRdn().getAtav();
+        AVA atav3 = dn3.getRdn().getAVA();
         assertEquals( "cn", atav3.getUpType() );
         assertEquals( "ABC", atav3.getUpValue().getString() );
         assertTrue( Arrays.equals( StringTools.getBytesUtf8( "ABC" ), atav3.getNormValue().getBytes()
) );
@@ -3324,7 +3324,7 @@ public class DNTest
         // antlr parser:
         DN dn4 = new DN( " cn = \\41\\42\\43 , ou=system " );
         assertEquals( " cn = \\41\\42\\43 ", dn4.getRdn().getName() );
-        AVA atav4 = dn4.getRdn().getAtav();
+        AVA atav4 = dn4.getRdn().getAVA();
         assertEquals( "cn", atav4.getUpType() );
         assertEquals( "ABC", atav4.getUpValue().getString() );
         assertEquals( "ABC", atav4.getNormValue().getString() );
@@ -3332,7 +3332,7 @@ public class DNTest
         // antlr parser: quotestring with trailing spaces
         DN dn5 = new DN( " cn = \"ABC\" , ou=system " );
         assertEquals( " cn = \"ABC\" ", dn5.getRdn().getName() );
-        AVA atav5 = dn5.getRdn().getAtav();
+        AVA atav5 = dn5.getRdn().getAVA();
         assertEquals( "cn", atav5.getUpType() );
         assertEquals( "ABC", atav5.getUpValue().getString() );
         assertEquals( "ABC", atav5.getNormValue().getString() );
@@ -3340,7 +3340,7 @@ public class DNTest
         // fast parser: string value with trailing spaces
         DN dn2 = new DN( " cn = Amos Tori , ou=system " );
         assertEquals( " cn = Amos Tori ", dn2.getRdn().getName() );
-        AVA atav2 = dn2.getRdn().getAtav();
+        AVA atav2 = dn2.getRdn().getAVA();
         assertEquals( "cn", atav2.getUpType() );
         assertEquals( "Amos Tori", atav2.getUpValue().getString() );
     }
@@ -3438,7 +3438,7 @@ public class DNTest
         assertEquals( "Example", rdn.getUpValue().getString() );
         assertEquals( "  ou  =  Example ", rdn.getName() );
 
-        AVA atav = rdn.getAtav();
+        AVA atav = rdn.getAVA();
 
         assertEquals( "2.5.4.11=example", atav.getNormName() );
         assertEquals( "2.5.4.11", atav.getNormType() );
@@ -3469,7 +3469,7 @@ public class DNTest
         assertEquals( "  ou  =  Example + ou = TEST ", rdn.getName() );
 
         // The first ATAV
-        AVA atav = rdn.getAtav();
+        AVA atav = rdn.getAVA();
 
         assertEquals( "2.5.4.11=example", atav.getNormName() );
         assertEquals( "2.5.4.11", atav.getNormType() );
@@ -3519,7 +3519,7 @@ public class DNTest
         assertEquals( "Ex+mple", rdn.getUpValue().getString() );
         assertEquals( "  ou  =  Ex\\+mple ", rdn.getName() );
 
-        AVA atav = rdn.getAtav();
+        AVA atav = rdn.getAVA();
 
         assertEquals( "2.5.4.11=ex\\+mple", atav.getNormName() );
         assertEquals( "2.5.4.11", atav.getNormType() );
@@ -3554,7 +3554,7 @@ public class DNTest
         assertEquals( "Ex+mple", rdn.getNormValue().getString() );
 
         // The first ATAV
-        AVA atav = rdn.getAtav();
+        AVA atav = rdn.getAVA();
 
         assertEquals( "  OU  =  Ex\\+mple ", atav.getUpName() );
         assertEquals( "ou=Ex\\+mple", atav.getNormName() );
@@ -3605,7 +3605,7 @@ public class DNTest
         assertEquals( "ex+mple", rdn.getNormValue().getString() );
 
         // The first ATAV
-        atav = rdn.getAtav();
+        atav = rdn.getAVA();
 
         assertEquals( "  OU  =  Ex\\+mple ", atav.getUpName() );
         assertEquals( "2.5.4.11=ex\\+mple", atav.getNormName() );

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/FastDnParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/FastDnParserTest.java?rev=1001692&r1=1001691&r2=1001692&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/FastDnParserTest.java
(original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/name/FastDnParserTest.java
Mon Sep 27 12:05:14 2010
@@ -169,13 +169,13 @@ public class FastDnParserTest
         assertEquals( "a = b", dn.getRdn().getName() );
         assertEquals( "a=b", dn.getRdn().getNormName() );
 
-        assertEquals( "a = b", dn.getRdn().getAtav().getUpName() );
-        assertEquals( "a=b", dn.getRdn().getAtav().getNormName() );
+        assertEquals( "a = b", dn.getRdn().getAVA().getUpName() );
+        assertEquals( "a=b", dn.getRdn().getAVA().getNormName() );
 
-        assertEquals( "a", dn.getRdn().getAtav().getUpType() );
-        assertEquals( "a", dn.getRdn().getAtav().getNormType() );
-        assertEquals( "b", dn.getRdn().getAtav().getUpValue().get() );
-        assertEquals( "b", dn.getRdn().getAtav().getNormValue().get() );
+        assertEquals( "a", dn.getRdn().getAVA().getUpType() );
+        assertEquals( "a", dn.getRdn().getAVA().getNormType() );
+        assertEquals( "b", dn.getRdn().getAVA().getUpValue().get() );
+        assertEquals( "b", dn.getRdn().getAVA().getNormValue().get() );
     }
 
 



Mime
View raw message