directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r818465 - in /directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers: AttributeTypeSynchronizer.java ComparatorSynchronizer.java NormalizerSynchronizer.java
Date Thu, 24 Sep 2009 12:46:58 GMT
Author: elecharny
Date: Thu Sep 24 12:46:58 2009
New Revision: 818465

URL: http://svn.apache.org/viewvc?rev=818465&view=rev
Log:
o Fixed the Normalizer rename() test
o Fixed some small issues (like the old DN was sent to the factories)

Modified:
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ComparatorSynchronizer.java
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/NormalizerSynchronizer.java

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java?rev=818465&r1=818464&r2=818465&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AttributeTypeSynchronizer.java
Thu Sep 24 12:46:58 2009
@@ -128,10 +128,18 @@
         String schemaName = getSchemaName( entry.getDn() );
         AttributeType oldAt = factory.getAttributeType( entry, registries, schemaName );
 
+        // Inject the new OID
         ServerEntry targetEntry = ( ServerEntry ) entry.clone();
         String newOid = ( String ) newRdn.getValue();
         checkOidIsUnique( newOid );
         targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
+
+        // Inject the new DN
+        LdapDN newDn = new LdapDN( targetEntry.getDn() );
+        newDn.remove( newDn.size() - 1 );
+        newDn.add( newRdn );
+        targetEntry.setDn( newDn );
+        
         AttributeType at = factory.getAttributeType( targetEntry, registries, schemaName
);
 
         Schema schema = registries.getLoadedSchema( schemaName );

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ComparatorSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ComparatorSynchronizer.java?rev=818465&r1=818464&r2=818465&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ComparatorSynchronizer.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ComparatorSynchronizer.java
Thu Sep 24 12:46:58 2009
@@ -140,10 +140,19 @@
         
         if ( ( schema != null ) && schema.isEnabled() )
         {
+            // Inject the new OID in the entry
             ServerEntry targetEntry = ( ServerEntry ) entry.clone();
             String newOid = ( String ) newRdn.getValue();
             checkOidIsUnique( newOid );
             targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
+            
+            // Inject the new DN
+            LdapDN newDn = new LdapDN( targetEntry.getDn() );
+            newDn.remove( newDn.size() - 1 );
+            newDn.add( newRdn );
+            targetEntry.setDn( newDn );
+            
+            // Register the new comparator, and unregister the old one
             LdapComparator<?> comparator = factory.getLdapComparator( targetEntry,
registries );
             comparatorRegistry.unregister( oldOid );
             comparatorRegistry.register( comparator );

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/NormalizerSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/NormalizerSynchronizer.java?rev=818465&r1=818464&r2=818465&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/NormalizerSynchronizer.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/NormalizerSynchronizer.java
Thu Sep 24 12:46:58 2009
@@ -23,6 +23,7 @@
 import javax.naming.NamingException;
 
 import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.shared.ldap.constants.MetaSchemaConstants;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.exception.LdapInvalidNameException;
 import org.apache.directory.shared.ldap.exception.LdapNamingException;
@@ -59,12 +60,12 @@
     
     protected boolean modify( LdapDN name, ServerEntry entry, ServerEntry targetEntry, boolean
cascade ) throws Exception
     {
-        String oid = getOid( entry );
+        String oldOid = getOid( entry );
         Normalizer normalizer = factory.getNormalizer( targetEntry, registries );
         
         if ( isSchemaLoaded( name ) )
         {
-            normalizerRegistry.unregister( oid );
+            normalizerRegistry.unregister( oldOid );
             normalizerRegistry.register( normalizer );
             
             return SCHEMA_MODIFIED;
@@ -133,12 +134,22 @@
                 ResultCodeEnum.UNWILLING_TO_PERFORM );
         }
 
-        String oid = ( String ) newRdn.getValue();
-        checkOidIsUniqueForNormalizer( oid );
+        String newOid = ( String ) newRdn.getValue();
+        checkOidIsUniqueForNormalizer( newOid );
         
         if ( isSchemaLoaded( entry.getDn() ) )
         {
-            Normalizer normalizer = factory.getNormalizer( entry, registries );
+            // Inject the new OID
+            ServerEntry targetEntry = ( ServerEntry ) entry.clone();
+            targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
+            
+            // Inject the new DN
+            LdapDN newDn = new LdapDN( targetEntry.getDn() );
+            newDn.remove( newDn.size() - 1 );
+            newDn.add( newRdn );
+            targetEntry.setDn( newDn );
+
+            Normalizer normalizer = factory.getNormalizer( targetEntry, registries );
             normalizerRegistry.unregister( oldOid );
             normalizerRegistry.register( normalizer );
         }



Mime
View raw message