directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1070512 - in /directory: apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/ apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ apacheds/branches/m1/core-...
Date Mon, 14 Feb 2011 14:56:06 GMT
Author: elecharny
Date: Mon Feb 14 14:56:05 2011
New Revision: 1070512

URL: http://svn.apache.org/viewvc?rev=1070512&view=rev
Log:
o Removed the Dn( Dn ) and Dn( SchemaManager, Dn ) constructors
o Transformed the Dn( Rdn ) constructor to Dn( Rdn... )
o Added a Dn( SchemaManager, Rdn... ) constructor
o Fixed the ADS/Shared code accordingly

Modified:
    directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java
    directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java
    directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ComparatorSynchronizer.java
    directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/NormalizerSynchronizer.java
    directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ObjectClassSynchronizer.java
    directory/apacheds/branches/m1/core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java
    directory/apacheds/branches/m1/core/src/test/java/org/apache/directory/server/core/changelog/MemoryChangeLogStoreTest.java
    directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/SimpleMechanismHandler.java
    directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java
    directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/schema/normalizers/DnNormalizer.java

Modified: directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java?rev=1070512&r1=1070511&r2=1070512&view=diff
==============================================================================
--- directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java
(original)
+++ directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java
Mon Feb 14 14:56:05 2011
@@ -1174,7 +1174,7 @@ public class LdapCoreSessionConnection i
 
         BindOperationContext bindContext = new BindOperationContext( null );
         bindContext.setCredentials( bindRequest.getCredentials() );
-        bindContext.setDn( new Dn( bindRequest.getName() ) );
+        bindContext.setDn( bindRequest.getName() );
 
         OperationManager operationManager = directoryService.getOperationManager();
 

Modified: directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java?rev=1070512&r1=1070511&r2=1070512&view=diff
==============================================================================
--- directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java
(original)
+++ directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java
Mon Feb 14 14:56:05 2011
@@ -206,7 +206,7 @@ public class AttributeTypeSynchronizer e
         targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
 
         // Inject the new Dn
-        Dn newDn = new Dn( targetEntry.getDn() );
+        Dn newDn = targetEntry.getDn();
         newDn = newDn.remove( newDn.size() - 1 );
         newDn = newDn.add( newRdn );
         targetEntry.setDn( newDn );

Modified: directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ComparatorSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ComparatorSynchronizer.java?rev=1070512&r1=1070511&r2=1070512&view=diff
==============================================================================
--- directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ComparatorSynchronizer.java
(original)
+++ directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ComparatorSynchronizer.java
Mon Feb 14 14:56:05 2011
@@ -247,7 +247,7 @@ public class ComparatorSynchronizer exte
             targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
 
             // Inject the new Dn
-            Dn newDn = new Dn( targetEntry.getDn() );
+            Dn newDn = targetEntry.getDn();
             newDn = newDn.remove( newDn.size() - 1 );
             newDn = newDn.add( newRdn );
             targetEntry.setDn( newDn );

Modified: directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/NormalizerSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/NormalizerSynchronizer.java?rev=1070512&r1=1070511&r2=1070512&view=diff
==============================================================================
--- directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/NormalizerSynchronizer.java
(original)
+++ directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/NormalizerSynchronizer.java
Mon Feb 14 14:56:05 2011
@@ -219,7 +219,7 @@ public class NormalizerSynchronizer exte
             targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
 
             // Inject the new Dn
-            Dn newDn = new Dn( targetEntry.getDn() );
+            Dn newDn = targetEntry.getDn();
             newDn = newDn.remove( newDn.size() - 1 );
             newDn = newDn.add( newRdn );
             targetEntry.setDn( newDn );

Modified: directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ObjectClassSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ObjectClassSynchronizer.java?rev=1070512&r1=1070511&r2=1070512&view=diff
==============================================================================
--- directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ObjectClassSynchronizer.java
(original)
+++ directory/apacheds/branches/m1/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ObjectClassSynchronizer.java
Mon Feb 14 14:56:05 2011
@@ -213,7 +213,7 @@ public class ObjectClassSynchronizer ext
         targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
 
         // Inject the new Dn
-        Dn newDn = new Dn( targetEntry.getDn() );
+        Dn newDn = targetEntry.getDn();
         newDn = newDn.remove( newDn.size() - 1 );
         newDn = newDn.add( newRdn );
 

Modified: directory/apacheds/branches/m1/core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java?rev=1070512&r1=1070511&r2=1070512&view=diff
==============================================================================
--- directory/apacheds/branches/m1/core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java
(original)
+++ directory/apacheds/branches/m1/core-integ/src/main/java/org/apache/directory/server/core/integ/IntegrationUtils.java
Mon Feb 14 14:56:05 2011
@@ -205,7 +205,7 @@ public class IntegrationUtils
 
     public static void apply( DirectoryService service, LdifEntry entry ) throws Exception
     {
-        Dn dn = new Dn( entry.getDn() );
+        Dn dn = entry.getDn();
         CoreSession session = service.getAdminSession();
 
         switch( entry.getChangeType().getChangeType() )

Modified: directory/apacheds/branches/m1/core/src/test/java/org/apache/directory/server/core/changelog/MemoryChangeLogStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/core/src/test/java/org/apache/directory/server/core/changelog/MemoryChangeLogStoreTest.java?rev=1070512&r1=1070511&r2=1070512&view=diff
==============================================================================
--- directory/apacheds/branches/m1/core/src/test/java/org/apache/directory/server/core/changelog/MemoryChangeLogStoreTest.java
(original)
+++ directory/apacheds/branches/m1/core/src/test/java/org/apache/directory/server/core/changelog/MemoryChangeLogStoreTest.java
Mon Feb 14 14:56:05 2011
@@ -32,8 +32,6 @@ import java.io.ObjectOutputStream;
 import java.util.HashMap;
 import java.util.Map;
 
-import com.mycila.junit.concurrent.Concurrency;
-import com.mycila.junit.concurrent.ConcurrentJunitRunner;
 import org.apache.directory.server.core.LdapPrincipal;
 import org.apache.directory.shared.ldap.model.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
@@ -51,6 +49,9 @@ import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import com.mycila.junit.concurrent.Concurrency;
+import com.mycila.junit.concurrent.ConcurrentJunitRunner;
+
 
 /**
  * Tests the MemoryChangeLogStore.
@@ -107,7 +108,7 @@ public class MemoryChangeLogStoreTest
         forward.putAttribute( "objectClass", "organizationalUnit" );
         forward.putAttribute( "ou", "system" );
 
-        LdifEntry reverse = LdifRevertor.reverseAdd( new Dn( forward.getDn() ) );
+        LdifEntry reverse = LdifRevertor.reverseAdd( forward.getDn() );
         assertEquals( 1, store.log( new LdapPrincipal(), forward, reverse ).getRevision()
);
         assertEquals( 1, store.getCurrentRevision() );
     }
@@ -128,10 +129,10 @@ public class MemoryChangeLogStoreTest
         forward.putAttribute( "objectClass", "organizationalUnit" );
         forward.putAttribute( "ou", "system" );
         
-        Dn reverseDn = new Dn( forward.getDn() );
+        Dn reverseDn = forward.getDn();
         reverseDn.normalize( oidsMap );
 
-        LdifEntry reverse = LdifRevertor.reverseAdd(reverseDn);
+        LdifEntry reverse = LdifRevertor.reverseAdd( reverseDn );
 
         String zuluTime = DateUtils.getGeneralizedTime();
         long revision = 1L;

Modified: directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/SimpleMechanismHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/SimpleMechanismHandler.java?rev=1070512&r1=1070511&r2=1070512&view=diff
==============================================================================
--- directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/SimpleMechanismHandler.java
(original)
+++ directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/bind/SimpleMechanismHandler.java
Mon Feb 14 14:56:05 2011
@@ -27,13 +27,13 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.interceptor.context.BindOperationContext;
 import org.apache.directory.server.ldap.LdapProtocolUtils;
 import org.apache.directory.server.ldap.LdapSession;
+import org.apache.directory.shared.ldap.model.exception.LdapAuthenticationException;
+import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.exception.LdapOperationException;
 import org.apache.directory.shared.ldap.model.message.BindRequest;
 import org.apache.directory.shared.ldap.model.message.BindResponse;
 import org.apache.directory.shared.ldap.model.message.LdapResult;
 import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
-import org.apache.directory.shared.ldap.model.exception.LdapAuthenticationException;
-import org.apache.directory.shared.ldap.model.exception.LdapException;
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -119,7 +119,7 @@ public class SimpleMechanismHandler impl
                 && ( ( code == ResultCodeEnum.NO_SUCH_OBJECT ) || ( code == ResultCodeEnum.ALIAS_PROBLEM
)
                     || ( code == ResultCodeEnum.INVALID_DN_SYNTAX ) || ( code == ResultCodeEnum.ALIAS_DEREFERENCING_PROBLEM
) ) )
             {
-                result.setMatchedDn( new Dn( name ) );
+                result.setMatchedDn( name );
             }
 
             result.setErrorMessage( msg );

Modified: directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java?rev=1070512&r1=1070511&r2=1070512&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java
(original)
+++ directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java
Mon Feb 14 14:56:05 2011
@@ -180,50 +180,6 @@ public class Dn implements Cloneable, Se
 
 
     /**
-     * @see #Dn(Dn, SchemaManager)
-     */
-    public Dn(Dn dn) throws LdapInvalidDnException
-    {
-        this( dn, null );
-    }
-
-
-    /**
-     * Copies a Dn to an Dn.
-     *
-     * @param dn composed of String name components.
-     * @param schemaManager the schema manager
-     * @throws LdapInvalidDnException If the Name is invalid.
-     */
-    public Dn(Dn dn, SchemaManager schemaManager) throws LdapInvalidDnException
-    {
-        this.schemaManager = schemaManager;
-
-        if ( ( dn != null ) && ( dn.size() != 0 ) )
-        {
-            for ( Rdn rdn : dn )
-            {
-                rdns.add( 0, rdn.clone() );
-            }
-        }
-
-        toUpName();
-
-        normalized = new AtomicBoolean();
-
-        if ( schemaManager != null )
-        {
-            normalize( schemaManager.getNormalizerMapping() );
-        }
-        else
-        {
-            normalizeInternal();
-            normalized.set( false );
-        }
-    }
-
-
-    /**
      * @see #Dn(String, SchemaManager)
      */
     public Dn(String upName) throws LdapInvalidDnException
@@ -384,23 +340,52 @@ public class Dn implements Cloneable, Se
      *
      * @param rdn the Rdn to be used in the Dn
      */
-    public Dn( Rdn rdn )
+    public Dn( Rdn... rdns )
     {
-        rdns.add( rdn.clone() );
+        if ( rdns == null )
+        {
+            return;
+        }
+        
+        for ( Rdn rdn : rdns)
+        {
+            this.rdns.add( rdn.clone() );
+        }
 
-        if ( rdn.isNormalized() )
+        normalizeInternal();
+        toUpName();
+        normalized = new AtomicBoolean( false );
+    }
+
+
+    /**
+     *
+     * Creates a Dn by based on the given Rdn.
+     *
+     * @param rdn the Rdn to be used in the Dn
+     */
+    public Dn( SchemaManager schemaManager, Rdn... rdns )
+    {
+        if ( rdns == null )
         {
-            this.normName = rdn.getNormName();
-            this.upName = rdn.getName();
-            this.bytes = Strings.getBytesUtf8(normName);
-            normalized = new AtomicBoolean( true );
+            return;
         }
-        else
+        
+        for ( Rdn rdn : rdns)
         {
-            normalizeInternal();
+            this.rdns.add( rdn.clone() );
+        }
+
+        try
+        {
+            normalize( schemaManager );
             toUpName();
             normalized = new AtomicBoolean( false );
         }
+        catch( LdapInvalidDnException lide )
+        {
+            throw new IllegalArgumentException( lide.getMessage() );
+        }
     }
 
 

Modified: directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/schema/normalizers/DnNormalizer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/schema/normalizers/DnNormalizer.java?rev=1070512&r1=1070511&r2=1070512&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/schema/normalizers/DnNormalizer.java
(original)
+++ directory/shared/branches/m1/ldap-model/src/main/java/org/apache/directory/shared/ldap/model/schema/normalizers/DnNormalizer.java
Mon Feb 14 14:56:05 2011
@@ -89,7 +89,7 @@ public class DnNormalizer extends Normal
     {
         Dn dn = null;
         
-        dn = new Dn( value, schemaManager );
+        dn = value.normalize( schemaManager );
         
         return dn.getNormName();
     }



Mime
View raw message