directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1085339 - in /directory: apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/ apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ apacheds/trunk/core/src/main/ja...
Date Fri, 25 Mar 2011 11:57:25 GMT
Author: elecharny
Date: Fri Mar 25 11:57:24 2011
New Revision: 1085339

URL: http://svn.apache.org/viewvc?rev=1085339&view=rev
Log:
Reverted the order in which the getRdn( int ) returns the Rdn to be consistant with the getRdns()
method

Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AbstractRegistrySynchronizer.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
    directory/apacheds/trunk/ldif-partition/src/main/java/org/apache/directory/server/core/partition/ldif/LdifPartition.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
    directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/model/name/DnTest.java
    directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/shared/ldap/codec/actions/modifyDnRequest/StoreModifyDnRequestNewRdn.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java?rev=1085339&r1=1085338&r2=1085339&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java
Fri Mar 25 11:57:24 2011
@@ -490,7 +490,7 @@ public class SchemaPartitionDaoImpl impl
             return null;
         }
 
-        Rdn rdn = dn.getRdn( 1 );
+        Rdn rdn = dn.getRdn( dn.size() - 2 );
 
         if ( !rdn.getNormType().equalsIgnoreCase( SchemaConstants.CN_AT_OID ) )
         {

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AbstractRegistrySynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AbstractRegistrySynchronizer.java?rev=1085339&r1=1085338&r2=1085339&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AbstractRegistrySynchronizer.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AbstractRegistrySynchronizer.java
Fri Mar 25 11:57:24 2011
@@ -151,12 +151,14 @@ public abstract class AbstractRegistrySy
      */
     protected String getSchemaName( Dn dn ) throws LdapException
     {
-        if ( dn.size() < 2 )
+        int size = dn.size();
+        
+        if ( size < 2 )
         {
             throw new LdapInvalidDnException( I18n.err( I18n.ERR_276 ) );
         }
 
-        Rdn rdn = dn.getRdn( 1 );
+        Rdn rdn = dn.getRdn( size - 2 );
         
         return rdn.getNormValue().getString();
     }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java?rev=1085339&r1=1085338&r2=1085339&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/MaxImmSubFilter.java
Fri Mar 25 11:57:24 2011
@@ -165,7 +165,7 @@ public class MaxImmSubFilter implements 
 
         try
         {
-            Dn baseDn = new Dn( opContext.getSession().getDirectoryService().getSchemaManager(),
entryName.getRdn( 0 ) );
+            Dn baseDn = new Dn( opContext.getSession().getDirectoryService().getSchemaManager(),
entryName.getRdn( entryName.size() - 1 ) );
             SearchOperationContext searchContext = new SearchOperationContext( opContext.getSession(),
                 baseDn, childrenFilter, childrenSearchControls );
             searchContext.setByPassed( SEARCH_BYPASS );

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=1085339&r1=1085338&r2=1085339&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
Fri Mar 25 11:57:24 2011
@@ -536,10 +536,11 @@ public class OperationalAttributeInterce
     private Dn denormalizeTypes( Dn dn ) throws LdapException
     {
         Dn newDn = new Dn( schemaManager );
+        int size = dn.size();
 
-        for ( int ii = 0; ii < dn.size(); ii++ )
+        for ( int pos = 0; pos < size; pos++ )
         {
-            Rdn rdn = dn.getRdn( ii );
+            Rdn rdn = dn.getRdn( size - 1 - pos );
             
             if ( rdn.size() == 0 )
             {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=1085339&r1=1085338&r2=1085339&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
Fri Mar 25 11:57:24 2011
@@ -1540,12 +1540,14 @@ public class SchemaInterceptor extends B
 
     private String getSchemaName( Dn dn ) throws LdapException
     {
-        if ( dn.size() < 2 )
+        int size = dn.size();
+        
+        if ( size < 2 )
         {
             throw new LdapException( I18n.err( I18n.ERR_276 ) );
         }
 
-        Rdn rdn = dn.getRdn( 1 );
+        Rdn rdn = dn.getRdn( size - 2 );
         
         return rdn.getNormValue().getString();
     }

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=1085339&r1=1085338&r2=1085339&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
Fri Mar 25 11:57:24 2011
@@ -506,10 +506,11 @@ public class LdifPartition extends Abstr
         filePath.append( suffixDirectory ).append( File.separator );
 
         Dn baseDn = entryDn.getDescendantOf( suffix );
+        int size = baseDn.size();
 
-        for ( int i = 0; i < baseDn.size() - 1; i++ )
+        for ( int i = 0; i < size - 1; i++ )
         {
-            String rdnFileName = getFileName( baseDn.getRdn( i ) );
+            String rdnFileName = getFileName( baseDn.getRdn( size - 1 - i ) );
 
             filePath.append( rdnFileName ).append( File.separator );
         }

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java?rev=1085339&r1=1085338&r2=1085339&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
(original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
Fri Mar 25 11:57:24 2011
@@ -788,7 +788,7 @@ public abstract class AbstractStore<E, I
 
         for ( ; i < dnSize; i++ )
         {
-            key = new ParentIdAndRdn<ID>( curEntryId, dn.getRdn( i ) );
+            key = new ParentIdAndRdn<ID>( curEntryId, dn.getRdn( dnSize - 1 - i ) );
             curEntryId = rdnIdx.forwardLookup( key );
 
             if ( curEntryId == null )
@@ -1999,7 +1999,7 @@ public abstract class AbstractStore<E, I
          * Start droping index tuples with the first ancestor right above the
          * moved base.  This is the first ancestor effected by the move.
          */
-        Dn ancestorDn = new Dn( schemaManager, movedBase.getRdn( 0 ) );
+        Dn ancestorDn = new Dn( schemaManager, movedBase.getRdn( movedBase.size() - 1 ) );
         ID ancestorId = getEntryId( ancestorDn );
 
         /*
@@ -2023,7 +2023,7 @@ public abstract class AbstractStore<E, I
 
         while ( !ancestorDn.equals( suffixDn ) )
         {
-            ancestorDn = new Dn( schemaManager, ancestorDn.getRdn( 0 ) );
+            ancestorDn = new Dn( schemaManager, ancestorDn.getRdn( ancestorDn.size() - 1
) );
             ancestorId = getEntryId( ancestorDn );
 
             subAliasIdx.drop( ancestorId, targetId );

Modified: directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/model/name/DnTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/model/name/DnTest.java?rev=1085339&r1=1085338&r2=1085339&view=diff
==============================================================================
--- directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/model/name/DnTest.java
(original)
+++ directory/shared/trunk/integ/src/test/java/org/apache/directory/shared/ldap/model/name/DnTest.java
Fri Mar 25 11:57:24 2011
@@ -21,7 +21,6 @@ package org.apache.directory.shared.ldap
 
 
 import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertNull;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotSame;
@@ -1540,10 +1539,10 @@ public class DnTest
     public void testGetRdn() throws Exception
     {
         Dn name = new Dn( "cn=HomeDir,cn=John,ou=Marketing,ou=East" );
-        assertEquals( "cn=HomeDir", name.getRdn( 3 ).getName() );
-        assertEquals( "cn=John", name.getRdn( 2 ).getName() );
-        assertEquals( "ou=Marketing", name.getRdn( 1 ).getName() );
-        assertEquals( "ou=East", name.getRdn( 0 ).getName() );
+        assertEquals( "cn=HomeDir", name.getRdn( 0 ).getName() );
+        assertEquals( "cn=John", name.getRdn( 1 ).getName() );
+        assertEquals( "ou=Marketing", name.getRdn( 2 ).getName() );
+        assertEquals( "ou=East", name.getRdn( 3 ).getName() );
     }
 
 
@@ -1834,7 +1833,7 @@ public class DnTest
     public void testGetParent() throws Exception
     {
         Dn empty = new Dn();
-        assertNull( empty.getParent() );
+        assertEquals( Dn.EMPTY_DN, empty.getParent() );
 
         Dn one = new Dn( "cn=test" );
         assertNotNull( one.getParent() );

Modified: directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/shared/ldap/codec/actions/modifyDnRequest/StoreModifyDnRequestNewRdn.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/shared/ldap/codec/actions/modifyDnRequest/StoreModifyDnRequestNewRdn.java?rev=1085339&r1=1085338&r2=1085339&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/shared/ldap/codec/actions/modifyDnRequest/StoreModifyDnRequestNewRdn.java
(original)
+++ directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/shared/ldap/codec/actions/modifyDnRequest/StoreModifyDnRequestNewRdn.java
Fri Mar 25 11:57:24 2011
@@ -98,7 +98,7 @@ public class StoreModifyDnRequestNewRdn 
             try
             {
                 Dn dn = new Dn( dnStr );
-                newRdn = dn.getRdn( 0 );
+                newRdn = dn.getRdn( dn.size() - 1 );
             }
             catch ( LdapInvalidDnException ine )
             {

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java?rev=1085339&r1=1085338&r2=1085339&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java
Fri Mar 25 11:57:24 2011
@@ -685,12 +685,15 @@ public class Dn implements Iterable<Rdn>
         {
             return null;
         }
-        else
+        
+        if ( ( posn < 0 ) || ( posn >= rdns.size() ) )
         {
-            Rdn rdn = rdns.get( rdns.size() - posn - 1 );
-
-            return rdn.clone();
+            throw new IllegalArgumentException( "Invalid position : " + posn );
         }
+
+        Rdn rdn = rdns.get( posn );
+
+        return rdn.clone();
     }
 
 



Mime
View raw message