directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r833647 [2/17] - in /directory: apacheds/branches/apacheds-schema/avl-partition/src/main/java/org/apache/directory/server/core/partition/avl/ apacheds/branches/apacheds-schema/avl-partition/src/test/java/org/apache/directory/server/core/par...
Date Sat, 07 Nov 2009 07:57:42 GMT
Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartition.java Sat Nov  7 07:57:34 2009
@@ -57,7 +57,6 @@
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.apache.directory.shared.ldap.schema.SchemaUtils;
-import org.apache.directory.shared.ldap.schema.comparators.SerializableComparator;
 import org.apache.directory.shared.ldap.schema.registries.Registries;
 import org.apache.directory.shared.ldap.util.DateUtils;
 import org.apache.directory.shared.ldap.util.ExceptionUtils;
@@ -230,18 +229,18 @@
         // Load apachemeta schema from within the ldap-schema Jar with all the
         // schema it depends on.  This is a minimal mandatory set of schemas.
         // -----------------------------------------------------------------------
-        SerializableComparator.setRegistry( registries.getComparatorRegistry() );
+        //SerializableComparator.setSchemaManager( schemaManager );
 
         wrapped.setId( ID );
         wrapped.setSuffix( SchemaConstants.OU_SCHEMA );
-        wrapped.getSuffixDn().normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
-        wrapped.setRegistries( registries );
+        wrapped.getSuffixDn().normalize( schemaManager.getNormalizerMapping() );
+        wrapped.setSchemaManager( schemaManager );
         
         try
         {
             wrapped.initialize();
             
-            PartitionSchemaLoader partitionLoader = new PartitionSchemaLoader( wrapped, registries );
+            PartitionSchemaLoader partitionLoader = new PartitionSchemaLoader( wrapped, schemaManager );
             synchronizer = new RegistrySynchronizerAdaptor( schemaManager );
             
             if ( wrapped instanceof NullPartition )
@@ -268,7 +267,7 @@
         }
         
         schemaModificationDN = new LdapDN( ServerDNConstants.SCHEMA_MODIFICATIONS_DN );
-        schemaModificationDN.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
+        schemaModificationDN.normalize( schemaManager.getNormalizerMapping() );
     }
     
     

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java Sat Nov  7 07:57:34 2009
@@ -60,8 +60,7 @@
 import org.apache.directory.shared.ldap.schema.AttributeTypeOptions;
 import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.ObjectClass;
-import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.apache.directory.shared.ldap.schema.registries.Schema;
 import org.apache.directory.shared.ldap.schema.syntaxCheckers.NumericOidSyntaxChecker;
 import org.apache.directory.shared.ldap.util.DateUtils;
@@ -99,7 +98,7 @@
 
     private final Partition partition;
     private final SchemaEntityFactory factory;
-    private final AttributeTypeRegistry atRegistry;
+    private final SchemaManager schemaManager;
 
     private final String M_NAME_OID;
     private final String CN_OID;
@@ -128,32 +127,32 @@
      * @param registries the bootstrap registries that were used to start up the schema partition
      * @throws NamingException if there are problems initializing this schema partion dao
      */
-    public SchemaPartitionDaoImpl( Partition partition, Registries registries ) throws Exception
+    public SchemaPartitionDaoImpl( Partition partition, SchemaManager schemaManager ) throws Exception
     {
         this.partition = partition;
         this.factory = new SchemaEntityFactory();
-        this.atRegistry = registries.getAttributeTypeRegistry();
+        this.schemaManager = schemaManager;
 
-        this.M_NAME_OID = atRegistry.getOidByName( MetaSchemaConstants.M_NAME_AT );
-        this.CN_OID = atRegistry.getOidByName( SchemaConstants.CN_AT );
-        this.disabledAttributeType = atRegistry.lookup( MetaSchemaConstants.M_DISABLED_AT );
-        this.M_OID_OID = atRegistry.getOidByName( MetaSchemaConstants.M_OID_AT );
-        this.OBJECTCLASS_OID = atRegistry.getOidByName( SchemaConstants.OBJECT_CLASS_AT );
-        this.M_SYNTAX_OID = atRegistry.getOidByName( MetaSchemaConstants.M_SYNTAX_AT );
-        this.M_ORDERING_OID = atRegistry.getOidByName( MetaSchemaConstants.M_ORDERING_AT );
-        this.M_EQUALITY_OID = atRegistry.getOidByName( MetaSchemaConstants.M_EQUALITY_AT );
-        this.M_SUBSTRING_OID = atRegistry.getOidByName( MetaSchemaConstants.M_SUBSTR_AT );
-        this.M_SUP_ATTRIBUTE_TYPE_OID = atRegistry.getOidByName( MetaSchemaConstants.M_SUP_ATTRIBUTE_TYPE_AT );
-        this.M_MUST_OID = atRegistry.getOidByName( MetaSchemaConstants.M_MUST_AT );
-        this.M_MAY_OID = atRegistry.getOidByName( MetaSchemaConstants.M_MAY_AT );
-        this.M_AUX_OID = atRegistry.getOidByName( MetaSchemaConstants.M_AUX_AT );
-        this.M_OC_OID = atRegistry.getOidByName( MetaSchemaConstants.M_OC_AT );
-        this.M_SUP_OBJECT_CLASS_OID = atRegistry.getOidByName( MetaSchemaConstants.M_SUP_OBJECT_CLASS_AT );
-        this.M_DEPENDENCIES_OID = atRegistry.getOidByName( MetaSchemaConstants.M_DEPENDENCIES_AT );
+        this.M_NAME_OID = schemaManager.getAttributeTypeRegistry().getOidByName( MetaSchemaConstants.M_NAME_AT );
+        this.CN_OID = schemaManager.getAttributeTypeRegistry().getOidByName( SchemaConstants.CN_AT );
+        this.disabledAttributeType = schemaManager.lookupAttributeTypeRegistry( MetaSchemaConstants.M_DISABLED_AT );
+        this.M_OID_OID = schemaManager.getAttributeTypeRegistry().getOidByName( MetaSchemaConstants.M_OID_AT );
+        this.OBJECTCLASS_OID = schemaManager.getAttributeTypeRegistry().getOidByName( SchemaConstants.OBJECT_CLASS_AT );
+        this.M_SYNTAX_OID = schemaManager.getAttributeTypeRegistry().getOidByName( MetaSchemaConstants.M_SYNTAX_AT );
+        this.M_ORDERING_OID = schemaManager.getAttributeTypeRegistry().getOidByName( MetaSchemaConstants.M_ORDERING_AT );
+        this.M_EQUALITY_OID = schemaManager.getAttributeTypeRegistry().getOidByName( MetaSchemaConstants.M_EQUALITY_AT );
+        this.M_SUBSTRING_OID = schemaManager.getAttributeTypeRegistry().getOidByName( MetaSchemaConstants.M_SUBSTR_AT );
+        this.M_SUP_ATTRIBUTE_TYPE_OID = schemaManager.getAttributeTypeRegistry().getOidByName( MetaSchemaConstants.M_SUP_ATTRIBUTE_TYPE_AT );
+        this.M_MUST_OID = schemaManager.getAttributeTypeRegistry().getOidByName( MetaSchemaConstants.M_MUST_AT );
+        this.M_MAY_OID = schemaManager.getAttributeTypeRegistry().getOidByName( MetaSchemaConstants.M_MAY_AT );
+        this.M_AUX_OID = schemaManager.getAttributeTypeRegistry().getOidByName( MetaSchemaConstants.M_AUX_AT );
+        this.M_OC_OID = schemaManager.getAttributeTypeRegistry().getOidByName( MetaSchemaConstants.M_OC_AT );
+        this.M_SUP_OBJECT_CLASS_OID = schemaManager.getAttributeTypeRegistry().getOidByName( MetaSchemaConstants.M_SUP_OBJECT_CLASS_AT );
+        this.M_DEPENDENCIES_OID = schemaManager.getAttributeTypeRegistry().getOidByName( MetaSchemaConstants.M_DEPENDENCIES_AT );
         
         for ( String attrId : SCHEMA_ATTRIBUTES )
         {
-            AttributeTypeOptions ato = new AttributeTypeOptions( atRegistry.lookup( attrId ) );
+            AttributeTypeOptions ato = new AttributeTypeOptions( schemaManager.lookupAttributeTypeRegistry( attrId ) );
             schemaAttributesToReturn.add( ato );
         }
     }
@@ -199,8 +198,8 @@
     private EntryFilteringCursor listSchemas() throws Exception
     {
         LdapDN base = new LdapDN( SchemaConstants.OU_SCHEMA );
-        base.normalize( atRegistry.getNormalizerMapping() );
-        ExprNode filter = new EqualityNode<String>( atRegistry.getOidByName( SchemaConstants.OBJECT_CLASS_AT ),
+        base.normalize( schemaManager.getNormalizerMapping() );
+        ExprNode filter = new EqualityNode<String>( schemaManager.getAttributeTypeRegistry().getOidByName( SchemaConstants.OBJECT_CLASS_AT ),
             new ClientStringValue( MetaSchemaConstants.META_SCHEMA_OC ) );
 
         SearchOperationContext searchContext = new SearchOperationContext( null );
@@ -218,7 +217,7 @@
     public Schema getSchema( String schemaName ) throws Exception
     {
         LdapDN dn = new LdapDN( "cn=" + schemaName + ",ou=schema" );
-        dn.normalize( atRegistry.getNormalizerMapping() );
+        dn.normalize( schemaManager.getNormalizerMapping() );
         return factory.getSchema( partition.lookup( new LookupOperationContext( null, dn ) ) );
     }
 
@@ -497,7 +496,7 @@
     {
         ServerEntry sr = find( entityName );
         LdapDN dn = sr.getDn();
-        dn.normalize( atRegistry.getNormalizerMapping() );
+        dn.normalize( schemaManager.getNormalizerMapping() );
         return dn;
     }
 
@@ -553,7 +552,7 @@
     public void enableSchema( String schemaName ) throws Exception
     {
         LdapDN dn = new LdapDN( "cn=" + schemaName + ",ou=schema" );
-        dn.normalize( atRegistry.getNormalizerMapping() );
+        dn.normalize( schemaManager.getNormalizerMapping() );
         ServerEntry entry = partition.lookup( new LookupOperationContext( null, dn ) );
         EntryAttribute disabledAttr = entry.get( disabledAttributeType );
         List<Modification> mods = new ArrayList<Modification>( 3 );
@@ -573,14 +572,14 @@
         }
 
         mods.add( new ServerModification( ModificationOperation.REMOVE_ATTRIBUTE, new DefaultServerAttribute(
-            MetaSchemaConstants.M_DISABLED_AT, atRegistry.lookup( MetaSchemaConstants.M_DISABLED_AT ) ) ) );
+            MetaSchemaConstants.M_DISABLED_AT, schemaManager.lookupAttributeTypeRegistry( MetaSchemaConstants.M_DISABLED_AT ) ) ) );
 
         mods.add( new ServerModification( ModificationOperation.ADD_ATTRIBUTE, new DefaultServerAttribute(
-            SchemaConstants.MODIFIERS_NAME_AT, atRegistry.lookup( SchemaConstants.MODIFIERS_NAME_AT ),
+            SchemaConstants.MODIFIERS_NAME_AT, schemaManager.lookupAttributeTypeRegistry( SchemaConstants.MODIFIERS_NAME_AT ),
             ServerDNConstants.ADMIN_SYSTEM_DN ) ) );
 
         mods.add( new ServerModification( ModificationOperation.ADD_ATTRIBUTE, new DefaultServerAttribute(
-            SchemaConstants.MODIFY_TIMESTAMP_AT, atRegistry.lookup( SchemaConstants.MODIFY_TIMESTAMP_AT ), DateUtils
+            SchemaConstants.MODIFY_TIMESTAMP_AT, schemaManager.lookupAttributeTypeRegistry( SchemaConstants.MODIFY_TIMESTAMP_AT ), DateUtils
                 .getGeneralizedTime() ) ) );
 
         partition.modify( new ModifyOperationContext( null, dn, mods ) );

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaService.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaService.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaService.java Sat Nov  7 07:57:34 2009
@@ -4,7 +4,7 @@
 import javax.naming.NamingException;
 
 import org.apache.directory.server.core.entry.ServerEntry;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
 
 
 public interface SchemaService
@@ -21,9 +21,9 @@
 
 
     /**
-     * @return the registries loaded from schemaPartition
+     * @return the schemaManager loaded from schemaPartition
      */
-    abstract Registries getRegistries();
+    abstract SchemaManager getSchemaManager();
 
 
     abstract SchemaPartition getSchemaPartition();

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AbstractRegistrySynchronizer.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/AbstractRegistrySynchronizer.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AbstractRegistrySynchronizer.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/AbstractRegistrySynchronizer.java Sat Nov  7 07:57:34 2009
@@ -39,12 +39,10 @@
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.apache.directory.shared.ldap.schema.SchemaObject;
 import org.apache.directory.shared.ldap.schema.SchemaWrapper;
-import org.apache.directory.shared.ldap.schema.registries.OidRegistry;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
 import org.apache.directory.shared.ldap.schema.registries.Schema;
-import org.apache.directory.shared.ldap.schema.registries.SchemaObjectRegistry;
 import org.apache.directory.shared.schema.loader.ldif.SchemaEntityFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -61,11 +59,8 @@
     /** A logger for this class */
     private static final Logger LOG = LoggerFactory.getLogger( AbstractRegistrySynchronizer.class );
 
-    /** The global registries */
-    protected final Registries registries;
-    
-    /** The OID registry */
-    protected final OidRegistry oidRegistry;
+    /** The global SchemaManager */
+    protected final SchemaManager schemaManager;
     
     /** The m-oid AttributeType */
     protected final AttributeType m_oidAT;
@@ -93,13 +88,11 @@
     }
     
     
-    protected AbstractRegistrySynchronizer( Registries targetRegistries ) throws Exception
+    protected AbstractRegistrySynchronizer( SchemaManager schemaManager ) throws Exception
     {
-        registries = targetRegistries;
-        m_oidAT = targetRegistries.getAttributeTypeRegistry().lookup( MetaSchemaConstants.M_OID_AT );
+        this.schemaManager = schemaManager;
+        m_oidAT = schemaManager.lookupAttributeTypeRegistry( MetaSchemaConstants.M_OID_AT );
         factory = new SchemaEntityFactory();
-        oidRegistry = registries.getOidRegistry();
-        
     }
     
     
@@ -112,7 +105,7 @@
      */
     protected boolean isSchemaLoaded( LdapDN dn ) throws Exception
     {
-        return registries.isSchemaLoaded( getSchemaName( dn ) );
+        return schemaManager.isSchemaLoaded( getSchemaName( dn ) );
     }
     
     
@@ -124,7 +117,7 @@
      */
     protected boolean isSchemaLoaded( String schemaName )
     {
-        return registries.isSchemaLoaded( schemaName );
+        return schemaManager.isSchemaLoaded( schemaName );
     }
     
     
@@ -136,7 +129,7 @@
      */
     protected boolean isSchemaEnabled( String schemaName )
     {
-        Schema schema = registries.getLoadedSchema( schemaName );
+        Schema schema = schemaManager.getLoadedSchema( schemaName );
         
         return ( ( schema != null ) && schema.isEnabled() );
     }
@@ -170,7 +163,7 @@
     {
         String oid = getOid( entry );
 
-        if ( oidRegistry.hasOid( oid ) )
+        if ( schemaManager.getOidRegistry().hasOid( oid ) )
         {
             throw new LdapNamingException( "Oid " + oid + " for new schema entity is not unique.",
                 ResultCodeEnum.OTHER );
@@ -181,7 +174,7 @@
     /**
      * Checks that the parent DN is a valid DN
      */
-    protected void checkParent( LdapDN newParent, SchemaObjectRegistry<?> registry, String objectType ) throws NamingException
+    protected void checkParent( LdapDN newParent, SchemaManager schemaManager, String objectType ) throws NamingException
     {
         if ( newParent.size() != 3 )
         {
@@ -192,7 +185,7 @@
         
         Rdn rdn = newParent.getRdn();
         
-        if ( ! registries.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) )
+        if ( ! schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) )
         {
             throw new LdapInvalidNameException( "The parent entry of a " + objectType + " should be an organizationalUnit.", 
                 ResultCodeEnum.NAMING_VIOLATION );
@@ -211,7 +204,7 @@
     {
         String oid = schemaObject.getOid();
 
-        if ( oidRegistry.hasOid( oid ) )
+        if ( schemaManager.getOidRegistry().hasOid( oid ) )
         {
             throw new LdapNamingException( "Oid " + oid + " for new schema entity is not unique.",
                 ResultCodeEnum.OTHER );
@@ -221,7 +214,7 @@
 
     protected void checkOidIsUnique( String oid ) throws Exception
     {
-        if ( oidRegistry.hasOid( oid ) )
+        if ( schemaManager.getOidRegistry().hasOid( oid ) )
         {
             throw new LdapNamingException( "Oid " + oid + " for new schema entity is not unique.",
                 ResultCodeEnum.OTHER );
@@ -238,12 +231,12 @@
         if ( isSchemaLoaded( schemaName ) )
         {
             // Get the set of all the SchemaObjects associated with this schema
-            Set<SchemaWrapper> schemaObjects = registries.getObjectBySchemaName().get( schemaName );
+            Set<SchemaWrapper> schemaObjects = schemaManager.getRegistries().getObjectBySchemaName().get( schemaName );
             
             if ( schemaObjects == null )
             {
                 // TODO : this should never happen...
-                schemaObjects = registries.addSchema( schemaName );
+                schemaObjects = schemaManager.getRegistries().addSchema( schemaName );
             }
             
             SchemaWrapper schemaWrapper = new SchemaWrapper( schemaObject );
@@ -281,7 +274,7 @@
     {
         if ( isSchemaLoaded( schemaName ) )
         {
-            Set<SchemaWrapper> schemaObjects = registries.getObjectBySchemaName().get( schemaName );
+            Set<SchemaWrapper> schemaObjects = schemaManager.getRegistries().getObjectBySchemaName().get( schemaName );
 
             SchemaWrapper schemaWrapper = new SchemaWrapper( schemaObject );
             
@@ -337,7 +330,7 @@
         for ( ServerEntry result : results )
         {
             LdapDN dn = result.getDn();
-            dn.normalize( this.registries.getAttributeTypeRegistry().getNormalizerMapping() );
+            dn.normalize( schemaManager.getNormalizerMapping() );
             oids.add( ( String ) dn.getRdn().getValue() );
         }
         
@@ -366,7 +359,7 @@
      */
     protected void unregisterOids( SchemaObject obj ) throws Exception
     {
-        oidRegistry.unregister( obj.getOid() );
+        schemaManager.getOidRegistry().unregister( obj.getOid() );
     }
     
     
@@ -378,7 +371,7 @@
      */
     protected void registerOids( SchemaObject obj ) throws Exception
     {
-        oidRegistry.register( obj );
+        schemaManager.getOidRegistry().register( obj );
     }
     
     
@@ -393,7 +386,7 @@
     {
         StringBuilder sb = new StringBuilder();
         
-        Set<SchemaWrapper> useds = registries.getUsedBy( schemaObject );
+        Set<SchemaWrapper> useds = schemaManager.getRegistries().getUsedBy( schemaObject );
         
         for ( SchemaWrapper used:useds )
         {

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=833647&r1=833646&r2=833647&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 Sat Nov  7 07:57:34 2009
@@ -20,6 +20,8 @@
 package org.apache.directory.server.core.schema.registries.synchronizers;
 
 
+import java.util.List;
+
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.shared.ldap.constants.MetaSchemaConstants;
@@ -29,7 +31,7 @@
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.apache.directory.shared.ldap.schema.registries.Registries;
 import org.apache.directory.shared.ldap.schema.registries.Schema;
 import org.slf4j.Logger;
@@ -48,19 +50,15 @@
     /** A logger for this class */
     private static final Logger LOG = LoggerFactory.getLogger( AttributeTypeSynchronizer.class );
 
-    /** A reference to the AttributeType registry */
-    private final AttributeTypeRegistry atRegistry;
-
     /**
      * Creates a new instance of AttributeTypeSynchronizer.
      *
-     * @param registries The global registries
+     * @param schemaManager The global schemaManager
      * @throws Exception If the initialization failed
      */
-    public AttributeTypeSynchronizer( Registries registries ) throws Exception
+    public AttributeTypeSynchronizer( SchemaManager schemaManager ) throws Exception
     {
-        super( registries );
-        this.atRegistry = registries.getAttributeTypeRegistry();
+        super( schemaManager );
     }
 
     
@@ -74,23 +72,49 @@
         parentDn.remove( parentDn.size() - 1 );
         
         // The parent DN must be ou=attributetypes,cn=<schemaName>,ou=schema
-        checkParent( parentDn, atRegistry, SchemaConstants.ATTRIBUTE_TYPE );
+        checkParent( parentDn, schemaManager, SchemaConstants.ATTRIBUTE_TYPE );
         
         // The new schemaObject's OID must not already exist
         checkOidIsUnique( entry );
         
         // Build the new AttributeType from the given entry
         String schemaName = getSchemaName( dn );
-        AttributeType at = factory.getAttributeType( entry, registries, schemaName );
+        
+        // At this point, as we may break the regisytries, work on a cloned registries
+        Registries clonedRegistries = schemaManager.getRegistries().clone();
+        
+        // Relax the cloned registries
+        clonedRegistries.setRelaxed();
+        
+        AttributeType at = factory.getAttributeType( entry, clonedRegistries, schemaName );
+        
+        if ( at == null )
+        {
+            // We couldn't create the AT : this is an error
+            return;
+        }
+        
+        List<Throwable> errors = clonedRegistries.checkRefInteg();
+        
+        if ( errors.size() == 0 )
+        {
+            clonedRegistries.setStrict();
+            schemaManager.setRegistries( clonedRegistries  );
+        }
+        else
+        {
+            // We have some error : reject the addition and get out
+            return;
+        }
         
         // At this point, the constructed AttributeType has not been checked against the 
         // existing Registries. It may be broken (missing SUP, or such), it will be checked
         // there, if the schema and the AttributeType are both enabled.
-        Schema schema = registries.getLoadedSchema( schemaName );
+        Schema schema = schemaManager.getLoadedSchema( schemaName );
         
         if ( schema.isEnabled() && at.isEnabled() )
         {
-            at.applyRegistries( registries );
+            at.applyRegistries( schemaManager.getRegistries() );
         }
         
         // Associates this AttributeType with the schema
@@ -99,7 +123,7 @@
         // Don't inject the modified element if the schema is disabled
         if ( isSchemaEnabled( schemaName ) )
         {
-            registries.register( at );
+            schemaManager.register( at );
 
             LOG.debug( "Added {} into the enabled schema {}", dn.getUpName(), schemaName );
         }
@@ -121,16 +145,16 @@
         ServerEntry entry = opContext.getEntry();
         String schemaName = getSchemaName( name );
         String oid = getOid( entry );
-        AttributeType at = factory.getAttributeType( targetEntry, registries, schemaName );
+        AttributeType at = factory.getAttributeType( targetEntry, schemaManager.getRegistries(), schemaName );
         
         if ( isSchemaEnabled( schemaName ) )
         {
-            if ( atRegistry.contains( oid ) )
+            if ( schemaManager.getAttributeTypeRegistry().contains( oid ) )
             {
-                atRegistry.unregister( oid );
+                schemaManager.unregisterAttributeType( oid );
             }
             
-            atRegistry.register( at );
+            schemaManager.register( at );
             
             return SCHEMA_MODIFIED;
         }
@@ -149,18 +173,18 @@
         parentDn.remove( parentDn.size() - 1 );
         
         // The parent DN must be ou=attributetypes,cn=<schemaName>,ou=schema
-        checkParent( parentDn, atRegistry, SchemaConstants.ATTRIBUTE_TYPE );
+        checkParent( parentDn, schemaManager, SchemaConstants.ATTRIBUTE_TYPE );
         
         // Get the AttributeType from the given entry ( it has been grabbed from the server earlier)
         String schemaName = getSchemaName( entry.getDn() );
-        AttributeType attributeType = factory.getAttributeType( entry, registries, schemaName );
+        AttributeType attributeType = factory.getAttributeType( entry, schemaManager.getRegistries(), schemaName );
         
         // Applies the Registries to this AttributeType 
-        Schema schema = registries.getLoadedSchema( schemaName );
+        Schema schema = schemaManager.getLoadedSchema( schemaName );
         
         if ( schema.isEnabled() && attributeType.isEnabled() )
         {
-            attributeType.applyRegistries( registries );
+            attributeType.applyRegistries( schemaManager.getRegistries() );
         }
         
         String oid = attributeType.getOid();
@@ -175,7 +199,7 @@
         // We will also have to remove an index that has been set on this AttributeType.
         if ( isSchemaEnabled( schemaName ) )
         {
-            if ( registries.isReferenced( attributeType ) )
+            if ( schemaManager.getRegistries().isReferenced( attributeType ) )
             {
                 String msg = "Cannot delete " + entry.getDn().getUpName() + ", as there are some " +
                     " dependant SchemaObjects :\n" + getReferenced( attributeType );
@@ -188,22 +212,22 @@
         deleteFromSchema( attributeType, schemaName );
 
         // Update the Registries now
-        if ( atRegistry.contains( oid ) )
+        if ( schemaManager.getAttributeTypeRegistry().contains( oid ) )
         {
             // Update the references.
             // The Syntax
-            registries.delReference( attributeType, attributeType.getSyntax() );
+            schemaManager.getRegistries().delReference( attributeType, attributeType.getSyntax() );
             
             // The Superior
-            registries.delReference( attributeType, attributeType.getSuperior() );
+            schemaManager.getRegistries().delReference( attributeType, attributeType.getSuperior() );
             
             // The MatchingRules
-            registries.delReference( attributeType, attributeType.getEquality() );
-            registries.delReference( attributeType, attributeType.getOrdering() );
-            registries.delReference( attributeType, attributeType.getSubstring() );
+            schemaManager.getRegistries().delReference( attributeType, attributeType.getEquality() );
+            schemaManager.getRegistries().delReference( attributeType, attributeType.getOrdering() );
+            schemaManager.getRegistries().delReference( attributeType, attributeType.getSubstring() );
             
             // Update the Registry
-            atRegistry.unregister( attributeType.getOid() );
+            schemaManager.unregister( attributeType );
             
             LOG.debug( "Removed {} from the enabled schema {}", attributeType, schemaName );
         }
@@ -221,7 +245,7 @@
     public void rename( ServerEntry entry, Rdn newRdn, boolean cascade ) throws Exception
     {
         String schemaName = getSchemaName( entry.getDn() );
-        AttributeType oldAt = factory.getAttributeType( entry, registries, schemaName );
+        AttributeType oldAt = factory.getAttributeType( entry, schemaManager.getRegistries(), schemaName );
 
         // Inject the new OID
         ServerEntry targetEntry = ( ServerEntry ) entry.clone();
@@ -235,12 +259,12 @@
         newDn.add( newRdn );
         targetEntry.setDn( newDn );
         
-        AttributeType at = factory.getAttributeType( targetEntry, registries, schemaName );
+        AttributeType at = factory.getAttributeType( targetEntry, schemaManager.getRegistries(), schemaName );
 
         if ( isSchemaEnabled( schemaName ) )
         {
             // Check that the entry has no descendant
-            if ( atRegistry.hasDescendants( oldAt.getOid() ) )
+            if ( schemaManager.getAttributeTypeRegistry().hasDescendants( oldAt.getOid() ) )
             {
                 String msg = "Cannot rename " + entry.getDn().getUpName() + " to " + newDn + 
                     " as the later has descendants' AttributeTypes";
@@ -248,8 +272,8 @@
                 throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM );
             }
             
-            atRegistry.unregister( oldAt.getOid() );
-            atRegistry.register( at );
+            schemaManager.unregisterAttributeType( oldAt.getOid() );
+            schemaManager.register( at );
         }
         else
         {
@@ -262,15 +286,15 @@
     public void moveAndRename( LdapDN oriChildName, LdapDN newParentName, Rdn newRn, boolean deleteOldRn,
         ServerEntry entry, boolean cascade ) throws Exception
     {
-        checkParent( newParentName, atRegistry, SchemaConstants.ATTRIBUTE_TYPE );
+        checkParent( newParentName, schemaManager, SchemaConstants.ATTRIBUTE_TYPE );
         String oldSchemaName = getSchemaName( oriChildName );
         String newSchemaName = getSchemaName( newParentName );
-        AttributeType oldAt = factory.getAttributeType( entry, registries, oldSchemaName );
+        AttributeType oldAt = factory.getAttributeType( entry, schemaManager.getRegistries(), oldSchemaName );
         ServerEntry targetEntry = ( ServerEntry ) entry.clone();
         String newOid = ( String ) newRn.getValue();
         targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
         checkOidIsUnique( newOid );
-        AttributeType newAt = factory.getAttributeType( targetEntry, registries, newSchemaName );
+        AttributeType newAt = factory.getAttributeType( targetEntry, schemaManager.getRegistries(), newSchemaName );
 
         
         if ( !isSchemaLoaded( oldSchemaName ) )
@@ -292,7 +316,7 @@
 
         if ( isSchemaEnabled( oldSchemaName ) )
         {
-            atRegistry.unregister( oldAt.getOid() );
+            schemaManager.unregisterAttributeType( oldAt.getOid() );
         }
         else
         {
@@ -301,7 +325,7 @@
 
         if ( isSchemaEnabled( newSchemaName ) )
         {
-            atRegistry.register( newAt );
+            schemaManager.register( newAt );
         }
         else
         {
@@ -313,11 +337,11 @@
     public void move( LdapDN oriChildName, LdapDN newParentName, ServerEntry entry, boolean cascade ) 
         throws Exception
     {
-        checkParent( newParentName, atRegistry, SchemaConstants.ATTRIBUTE_TYPE );
+        checkParent( newParentName, schemaManager, SchemaConstants.ATTRIBUTE_TYPE );
         String oldSchemaName = getSchemaName( oriChildName );
         String newSchemaName = getSchemaName( newParentName );
-        AttributeType oldAt = factory.getAttributeType( entry, registries, oldSchemaName );
-        AttributeType newAt = factory.getAttributeType( entry, registries, newSchemaName );
+        AttributeType oldAt = factory.getAttributeType( entry, schemaManager.getRegistries(), oldSchemaName );
+        AttributeType newAt = factory.getAttributeType( entry, schemaManager.getRegistries(), newSchemaName );
         
         if ( !isSchemaLoaded( oldSchemaName ) )
         {
@@ -338,7 +362,7 @@
         
         if ( isSchemaEnabled( oldSchemaName ) )
         {
-            atRegistry.unregister( oldAt.getOid() );
+            schemaManager.unregisterAttributeType( oldAt.getOid() );
         }
         else
         {
@@ -347,7 +371,7 @@
         
         if ( isSchemaEnabled( newSchemaName ) )
         {
-            atRegistry.register( newAt );
+            schemaManager.register( newAt );
         }
         else
         {

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=833647&r1=833646&r2=833647&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 Sat Nov  7 07:57:34 2009
@@ -33,9 +33,7 @@
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.shared.ldap.schema.LdapComparator;
-import org.apache.directory.shared.ldap.schema.registries.ComparatorRegistry;
-import org.apache.directory.shared.ldap.schema.registries.MatchingRuleRegistry;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -52,24 +50,16 @@
     /** A logger for this class */
     private static final Logger LOG = LoggerFactory.getLogger( ComparatorSynchronizer.class );
 
-    /** The Comparator registry */
-    private final ComparatorRegistry comparatorRegistry;
-    
-    /** The MatchingRule registry */
-    private final MatchingRuleRegistry matchingRuleRegistry;
-
     
     /**
      * Creates a new instance of ComparatorSynchronizer.
      *
-     * @param registries The global registries
+     * @param schemaManager The global schemaManager
      * @throws Exception If the initialization failed
      */
-    public ComparatorSynchronizer( Registries registries ) throws Exception
+    public ComparatorSynchronizer( SchemaManager schemaManager ) throws Exception
     {
-        super( registries );
-        this.comparatorRegistry = registries.getComparatorRegistry();
-        this.matchingRuleRegistry = registries.getMatchingRuleRegistry();
+        super( schemaManager );
     }
 
     
@@ -82,14 +72,14 @@
         ServerEntry entry = opContext.getEntry();
         String schemaName = getSchemaName( name );
         String oid = getOid( entry );
-        LdapComparator<?> comparator = factory.getLdapComparator( targetEntry, registries, schemaName );
+        LdapComparator<?> comparator = factory.getLdapComparator( schemaManager, targetEntry, schemaManager.getRegistries(), schemaName );
         
         if ( isSchemaEnabled( schemaName ) )
         {
             comparator.setSchemaName( schemaName );
 
-            comparatorRegistry.unregister( oid );
-            comparatorRegistry.register( comparator );
+            schemaManager.unregisterComparator( oid );
+            schemaManager.register( comparator );
             
             return SCHEMA_MODIFIED;
         }
@@ -108,7 +98,7 @@
         parentDn.remove( parentDn.size() - 1 );
         
         // The parent DN must be ou=comparators,cn=<schemaName>,ou=schema
-        checkParent( parentDn, comparatorRegistry, SchemaConstants.COMPARATOR );
+        checkParent( parentDn, schemaManager, SchemaConstants.COMPARATOR );
         
         // The new schemaObject's OID must not already exist
         checkOidIsUniqueForComparator( entry );
@@ -116,13 +106,13 @@
         // Build the new Comparator from the given entry
         String schemaName = getSchemaName( dn );
         
-        LdapComparator<?> comparator = factory.getLdapComparator( entry, registries, schemaName );
+        LdapComparator<?> comparator = factory.getLdapComparator( schemaManager, entry, schemaManager.getRegistries(), schemaName );
         
         addToSchema( comparator, schemaName );
 
         if ( isSchemaEnabled( schemaName ) && comparator.isEnabled() )
         {
-            comparatorRegistry.register( comparator );
+            schemaManager.register( comparator );
             LOG.debug( "Added {} into the enabled schema {}", dn.getUpName(), schemaName );
         }
     }
@@ -138,30 +128,30 @@
         parentDn.remove( parentDn.size() - 1 );
         
         // The parent DN must be ou=comparators,cn=<schemaName>,ou=schema
-        checkParent( parentDn, comparatorRegistry, SchemaConstants.COMPARATOR );
+        checkParent( parentDn, schemaManager, SchemaConstants.COMPARATOR );
         
         // Get the Comparator from the given entry ( it has been grabbed from the server earlier)
         String schemaName = getSchemaName( entry.getDn() ); 
-        LdapComparator<?> comparator = factory.getLdapComparator( entry, registries, schemaName );
+        LdapComparator<?> comparator = factory.getLdapComparator( schemaManager, entry, schemaManager.getRegistries(), schemaName );
         
         String oid = comparator.getOid();
         
         if ( isSchemaEnabled( schemaName ) )
         {
-            if ( registries.isReferenced( comparator ) )
+            if ( schemaManager.getRegistries().isReferenced( comparator ) )
             {
                 String msg = "Cannot delete " + entry.getDn().getUpName() + ", as there are some " +
                 " dependant SchemaObjects :\n" + getReferenced( comparator );
-            LOG.warn( msg );
-            throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM );
+                LOG.warn( msg );
+                throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM );
             }
         }
         
         deleteFromSchema( comparator, schemaName );
 
-        if ( comparatorRegistry.contains( oid ) )
+        if ( schemaManager.getComparatorRegistry().contains( oid ) )
         {
-            comparatorRegistry.unregister( oid );
+            schemaManager.unregisterComparator( oid );
             LOG.debug( "Removed {} from the enabled schema {}", comparator, schemaName );
         }
         else
@@ -178,7 +168,7 @@
     {
         String oldOid = getOid( entry );
 
-        if ( matchingRuleRegistry.contains( oldOid ) )
+        if ( schemaManager.getMatchingRuleRegistry().contains( oldOid ) )
         {
             throw new LdapOperationNotSupportedException( "The comparator with OID " + oldOid 
                 + " cannot have it's OID changed until all " 
@@ -206,9 +196,9 @@
             targetEntry.setDn( newDn );
             
             // Register the new comparator, and unregister the old one
-            LdapComparator<?> comparator = factory.getLdapComparator( targetEntry, registries, schemaName );
-            comparatorRegistry.unregister( oldOid );
-            comparatorRegistry.register( comparator );
+            LdapComparator<?> comparator = factory.getLdapComparator( schemaManager, targetEntry, schemaManager.getRegistries(), schemaName );
+            schemaManager.unregisterComparator( oldOid );
+            schemaManager.register( comparator );
         }
     }
 
@@ -219,7 +209,7 @@
         checkNewParent( newParentName );
         String oldOid = getOid( entry );
 
-        if ( matchingRuleRegistry.contains( oldOid ) )
+        if ( schemaManager.getMatchingRuleRegistry().contains( oldOid ) )
         {
             throw new LdapOperationNotSupportedException( "The comparator with OID " + oldOid 
                 + " cannot have it's OID changed until all " 
@@ -232,18 +222,18 @@
         
         String newSchemaName = getSchemaName( newParentName );
         
-        LdapComparator<?> comparator = factory.getLdapComparator( entry, registries, newSchemaName );
+        LdapComparator<?> comparator = factory.getLdapComparator( schemaManager, entry, schemaManager.getRegistries(), newSchemaName );
 
         String oldSchemaName = getSchemaName( oriChildName );
         
         if ( isSchemaEnabled( oldSchemaName ) )
         {
-            comparatorRegistry.unregister( oldOid );
+            schemaManager.unregisterComparator( oldOid );
         }
 
         if ( isSchemaEnabled( newSchemaName ) )
         {
-            comparatorRegistry.register( comparator );
+            schemaManager.register( comparator );
         }
     }
 
@@ -254,7 +244,7 @@
         checkNewParent( newParentName );
         String oid = getOid( entry );
 
-        if ( matchingRuleRegistry.contains( oid ) )
+        if ( schemaManager.getMatchingRuleRegistry().contains( oid ) )
         {
             throw new LdapOperationNotSupportedException( "The comparator with OID " + oid 
                 + " cannot be moved to another schema until all " 
@@ -264,25 +254,25 @@
 
         String newSchemaName = getSchemaName( newParentName );
 
-        LdapComparator<?> comparator = factory.getLdapComparator( entry, registries, newSchemaName );
+        LdapComparator<?> comparator = factory.getLdapComparator( schemaManager, entry, schemaManager.getRegistries(), newSchemaName );
         
         String oldSchemaName = getSchemaName( oriChildName );
         
         if ( isSchemaEnabled( oldSchemaName ) )
         {
-            comparatorRegistry.unregister( oid );
+            schemaManager.unregisterComparator( oid );
         }
         
         if ( isSchemaEnabled( newSchemaName ) )
         {
-            comparatorRegistry.register( comparator );
+            schemaManager.register( comparator );
         }
     }
     
     
     private void checkOidIsUniqueForComparator( String oid ) throws NamingException
     {
-        if ( registries.getComparatorRegistry().contains( oid ) )
+        if ( schemaManager.getComparatorRegistry().contains( oid ) )
         {
             throw new LdapNamingException( "Oid " + oid + " for new schema comparator is not unique.", 
                 ResultCodeEnum.OTHER );
@@ -294,7 +284,7 @@
     {
         String oid = getOid( entry );
         
-        if ( registries.getComparatorRegistry().contains( oid ) )
+        if ( schemaManager.getComparatorRegistry().contains( oid ) )
         {
             throw new LdapNamingException( "Oid " + oid + " for new schema comparator is not unique.", 
                 ResultCodeEnum.OTHER );
@@ -312,7 +302,8 @@
         }
         
         Rdn rdn = newParent.getRdn();
-        if ( ! registries.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) )
+        
+        if ( ! schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) )
         {
             throw new LdapInvalidNameException( "The parent entry of a comparator should be an organizationalUnit.", 
                 ResultCodeEnum.NAMING_VIOLATION );

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/DitContentRuleSynchronizer.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/DitContentRuleSynchronizer.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/DitContentRuleSynchronizer.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/DitContentRuleSynchronizer.java Sat Nov  7 07:57:34 2009
@@ -27,7 +27,7 @@
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.shared.ldap.schema.DITContentRule;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
 
 
 /**
@@ -42,12 +42,12 @@
     /**
      * Creates a new instance of DitContentRuleSynchronizer.
      *
-     * @param registries The global registries
+     * @param schemaManager The global schemaManager
      * @throws Exception If the initialization failed
      */
-    protected DitContentRuleSynchronizer( Registries registries ) throws Exception
+    protected DitContentRuleSynchronizer( SchemaManager schemaManager ) throws Exception
     {
-        super( registries );
+        super( schemaManager );
         // TODO Auto-generated constructor stub
     }
 

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/DitStructureRuleSynchronizer.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/DitStructureRuleSynchronizer.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/DitStructureRuleSynchronizer.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/DitStructureRuleSynchronizer.java Sat Nov  7 07:57:34 2009
@@ -27,7 +27,7 @@
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.shared.ldap.schema.DITStructureRule;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
 
 
 /**
@@ -41,12 +41,12 @@
     /**
      * Creates a new instance of DitStructureSynchronizer.
      *
-     * @param registries The global registries
+     * @param schemaManager The global schemaManager
      * @throws Exception If the initialization failed
      */
-    protected DitStructureRuleSynchronizer( Registries registries ) throws Exception
+    protected DitStructureRuleSynchronizer( SchemaManager schemaManager ) throws Exception
     {
-        super( registries );
+        super( schemaManager );
         // TODO Auto-generated constructor stub
     }
 

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/MatchingRuleSynchronizer.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/MatchingRuleSynchronizer.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/MatchingRuleSynchronizer.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/MatchingRuleSynchronizer.java Sat Nov  7 07:57:34 2009
@@ -31,8 +31,7 @@
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.shared.ldap.schema.MatchingRule;
-import org.apache.directory.shared.ldap.schema.registries.MatchingRuleRegistry;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.apache.directory.shared.ldap.schema.registries.Schema;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -50,21 +49,16 @@
     /** A logger for this class */
     private static final Logger LOG = LoggerFactory.getLogger( MatchingRuleSynchronizer.class );
 
-    /** The matchingRule registry */
-    private final MatchingRuleRegistry matchingRuleRegistry;
-
-    
     /**
      * Creates a new instance of MatchingRuleSynchronizer.
      *
-     * @param registries The global registries
+     * @param schemaManager The global schemaManager
      * @throws Exception If the initialization failed
      */
-    public MatchingRuleSynchronizer( Registries registries ) 
+    public MatchingRuleSynchronizer( SchemaManager schemaManager ) 
         throws Exception
     {
-        super( registries );
-        this.matchingRuleRegistry = registries.getMatchingRuleRegistry();
+        super( schemaManager );
     }
 
 
@@ -77,14 +71,14 @@
         LdapDN name = opContext.getDn();
         ServerEntry entry = opContext.getEntry();
         String schemaName = getSchemaName( name );
-        MatchingRule mr = factory.getMatchingRule( targetEntry, registries, schemaName );
+        MatchingRule mr = factory.getMatchingRule( targetEntry, schemaManager.getRegistries(), schemaName );
         
         String oldOid = getOid( entry );
         
         if ( isSchemaEnabled( schemaName ) )
         {
-            matchingRuleRegistry.unregister( oldOid );
-            matchingRuleRegistry.register( mr );
+            schemaManager.unregisterMatchingRule( oldOid );
+            schemaManager.register( mr );
             
             return SCHEMA_MODIFIED;
         }
@@ -105,23 +99,23 @@
         parentDn.remove( parentDn.size() - 1 );
 
         // The parent DN must be ou=matchingrules,cn=<schemaName>,ou=schema
-        checkParent( parentDn, matchingRuleRegistry, SchemaConstants.MATCHING_RULE );
+        checkParent( parentDn, schemaManager, SchemaConstants.MATCHING_RULE );
 
         // The new schemaObject's OID must not already exist
         checkOidIsUnique( entry );
         
         // Build the new MatchingRule from the given entry
         String schemaName = getSchemaName( dn );
-        MatchingRule matchingRule = factory.getMatchingRule( entry, registries, schemaName );
+        MatchingRule matchingRule = factory.getMatchingRule( entry, schemaManager.getRegistries(), schemaName );
         
         // At this point, the constructed MatchingRule has not been checked against the 
         // existing Registries. It may be broken (missing SYNTAX), it will be checked
         // there, if the schema and the MatchingRule are both enabled.
-        Schema schema = registries.getLoadedSchema( schemaName );
+        Schema schema = schemaManager.getLoadedSchema( schemaName );
 
         if ( schema.isEnabled() && matchingRule.isEnabled() )
         {
-            matchingRule.applyRegistries( registries );
+            matchingRule.applyRegistries( schemaManager.getRegistries() );
         }
         
         // Associates this MatchingRule with the schema
@@ -132,15 +126,15 @@
         {
             // Update the referenced and referencing objects
             // The Syntax
-            registries.addReference( matchingRule, matchingRule.getSyntax() );
+            schemaManager.getRegistries().addReference( matchingRule, matchingRule.getSyntax() );
             
             // The Normalizer
-            registries.addReference( matchingRule, matchingRule.getNormalizer() );
+            schemaManager.getRegistries().addReference( matchingRule, matchingRule.getNormalizer() );
             
             // The Comparator
-            registries.addReference( matchingRule, matchingRule.getLdapComparator() );
+            schemaManager.getRegistries().addReference( matchingRule, matchingRule.getLdapComparator() );
             
-            matchingRuleRegistry.register( matchingRule );
+            schemaManager.register( matchingRule );
             LOG.debug( "Added {} into the enabled schema {}", dn.getUpName(), schemaName );
         }
         else
@@ -161,37 +155,37 @@
         parentDn.remove( parentDn.size() - 1 );
         
         // The parent DN must be ou=matchingrules,cn=<schemaName>,ou=schema
-        checkParent( parentDn, matchingRuleRegistry, SchemaConstants.MATCHING_RULE );
+        checkParent( parentDn, schemaManager, SchemaConstants.MATCHING_RULE );
 
         // Get the MatchingRule from the given entry ( it has been grabbed from the server earlier)
         String schemaName = getSchemaName( entry.getDn() );
-        MatchingRule matchingRule = factory.getMatchingRule( entry, registries, schemaName );
+        MatchingRule matchingRule = factory.getMatchingRule( entry, schemaManager.getRegistries(), schemaName );
         String oid = matchingRule.getOid();
         
         // Applies the Registries to this MatchingRule 
-        Schema schema = registries.getLoadedSchema( schemaName );
+        Schema schema = schemaManager.getLoadedSchema( schemaName );
 
         if ( schema.isEnabled() && matchingRule.isEnabled() )
         {
-            matchingRule.applyRegistries( registries );
+            matchingRule.applyRegistries( schemaManager.getRegistries() );
         }
         
         deleteFromSchema( matchingRule, schemaName );
         
-        if ( matchingRuleRegistry.contains( oid ) )
+        if ( schemaManager.getMatchingRuleRegistry().contains( oid ) )
         {
             // Update the referenced and referencing objects
             // The Syntax
-            registries.delReference( matchingRule, matchingRule.getSyntax() );
+            schemaManager.getRegistries().delReference( matchingRule, matchingRule.getSyntax() );
             
             // The Normalizer
-            registries.delReference( matchingRule, matchingRule.getNormalizer() );
+            schemaManager.getRegistries().delReference( matchingRule, matchingRule.getNormalizer() );
             
             // The Comparator
-            registries.delReference( matchingRule, matchingRule.getLdapComparator() );
+            schemaManager.getRegistries().delReference( matchingRule, matchingRule.getLdapComparator() );
 
             // Update the registry
-            matchingRuleRegistry.unregister( matchingRule.getOid() );
+            schemaManager.unregisterMatchingRule( matchingRule.getOid() );
             
             LOG.debug( "Removed {} from the enabled schema {}", matchingRule, schemaName );
         }
@@ -209,18 +203,18 @@
     public void rename( ServerEntry entry, Rdn newRdn, boolean cascade ) throws Exception
     {
         String schemaName = getSchemaName( entry.getDn() );
-        MatchingRule oldMr = factory.getMatchingRule( entry, registries, schemaName );
+        MatchingRule oldMr = factory.getMatchingRule( entry, schemaManager.getRegistries(), schemaName );
         ServerEntry targetEntry = ( ServerEntry ) entry.clone();
         String newOid = ( String ) newRdn.getValue();
         checkOidIsUnique( newOid );
         
         targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
-        MatchingRule mr = factory.getMatchingRule( targetEntry, registries, schemaName );
+        MatchingRule mr = factory.getMatchingRule( targetEntry, schemaManager.getRegistries(), schemaName );
 
         if ( isSchemaEnabled( schemaName ) )
         {
-            matchingRuleRegistry.unregister( oldMr.getOid() );
-            matchingRuleRegistry.register( mr );
+            schemaManager.unregisterMatchingRule( oldMr.getOid() );
+            schemaManager.register( mr );
         }
         else
         {
@@ -236,17 +230,17 @@
         checkNewParent( newParentName );
         String oldSchemaName = getSchemaName( oriChildName );
         String newSchemaName = getSchemaName( newParentName );
-        MatchingRule oldMr = factory.getMatchingRule( entry, registries, oldSchemaName );
+        MatchingRule oldMr = factory.getMatchingRule( entry, schemaManager.getRegistries(), oldSchemaName );
         ServerEntry targetEntry = ( ServerEntry ) entry.clone();
         String newOid = ( String ) newRdn.getValue();
         checkOidIsUnique( newOid );
         
         targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
-        MatchingRule mr = factory.getMatchingRule( targetEntry, registries, newSchemaName );
+        MatchingRule mr = factory.getMatchingRule( targetEntry, schemaManager.getRegistries(), newSchemaName );
         
         if ( isSchemaEnabled( oldSchemaName ) )
         {
-            matchingRuleRegistry.unregister( oldMr.getOid() );
+            schemaManager.unregisterMatchingRule( oldMr.getOid() );
         }
         else
         {
@@ -255,7 +249,7 @@
 
         if ( isSchemaEnabled( newSchemaName ) )
         {
-            matchingRuleRegistry.register( mr );
+            schemaManager.register( mr );
         }
         else
         {
@@ -270,12 +264,12 @@
         checkNewParent( newParentName );
         String oldSchemaName = getSchemaName( oriChildName );
         String newSchemaName = getSchemaName( newParentName );
-        MatchingRule oldMr = factory.getMatchingRule( entry, registries, oldSchemaName );
-        MatchingRule newMr = factory.getMatchingRule( entry, registries, newSchemaName );
+        MatchingRule oldMr = factory.getMatchingRule( entry, schemaManager.getRegistries(), oldSchemaName );
+        MatchingRule newMr = factory.getMatchingRule( entry, schemaManager.getRegistries(), newSchemaName );
 
         if ( isSchemaEnabled( oldSchemaName ) )
         {
-            matchingRuleRegistry.unregister( oldMr.getOid() );
+            schemaManager.unregisterMatchingRule( oldMr.getOid() );
         }
         else
         {
@@ -284,7 +278,7 @@
         
         if ( isSchemaEnabled( newSchemaName ) )
         {
-            matchingRuleRegistry.register( newMr );
+            schemaManager.register( newMr );
         }
         else
         {
@@ -303,7 +297,7 @@
         }
         
         Rdn rdn = newParent.getRdn();
-        if ( ! registries.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) )
+        if ( ! schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) )
         {
             throw new LdapInvalidNameException( "The parent entry of a matchingRule should be an organizationalUnit.", 
                 ResultCodeEnum.NAMING_VIOLATION );

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/MatchingRuleUseSynchronizer.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/MatchingRuleUseSynchronizer.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/MatchingRuleUseSynchronizer.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/MatchingRuleUseSynchronizer.java Sat Nov  7 07:57:34 2009
@@ -27,7 +27,7 @@
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.shared.ldap.schema.MatchingRuleUse;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
 
 
 /**
@@ -41,12 +41,12 @@
     /**
      * Creates a new instance of MatchingRuleUseSynchronizer.
      *
-     * @param registries The global registries
+     * @param schemaManager The global schemaManager
      * @throws Exception If the initialization failed
      */
-    protected MatchingRuleUseSynchronizer( Registries registries ) throws Exception
+    protected MatchingRuleUseSynchronizer( SchemaManager schemaManager ) throws Exception
     {
-        super( registries );
+        super( schemaManager );
         // TODO Auto-generated constructor stub
     }
 

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/NameFormSynchronizer.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/NameFormSynchronizer.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/NameFormSynchronizer.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/NameFormSynchronizer.java Sat Nov  7 07:57:34 2009
@@ -27,7 +27,7 @@
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.shared.ldap.schema.NameForm;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
 
 
 /**
@@ -41,12 +41,12 @@
     /**
      * Creates a new instance of NameFormSynchronizer.
      *
-     * @param registries The global registries
+     * @param schemaManager The global schemaManager
      * @throws Exception If the initialization failed
      */
-    protected NameFormSynchronizer( Registries registries ) throws Exception
+    protected NameFormSynchronizer( SchemaManager schemaManager ) throws Exception
     {
-        super( registries );
+        super( schemaManager );
     }
 
 

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=833647&r1=833646&r2=833647&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 Sat Nov  7 07:57:34 2009
@@ -33,9 +33,7 @@
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.shared.ldap.schema.Normalizer;
-import org.apache.directory.shared.ldap.schema.registries.MatchingRuleRegistry;
-import org.apache.directory.shared.ldap.schema.registries.NormalizerRegistry;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -51,24 +49,15 @@
     /** A logger for this class */
     private static final Logger LOG = LoggerFactory.getLogger( NormalizerSynchronizer.class );
 
-    /** The normalizer registry */
-    private final NormalizerRegistry normalizerRegistry;
-    
-    /** The matchingRule registry */
-    private final MatchingRuleRegistry matchingRuleRegistry;
-    
-
     /**
      * Creates a new instance of NormalizerSynchronizer.
      *
      * @param registries The global registries
      * @throws Exception If the initialization failed
      */
-    public NormalizerSynchronizer( Registries registries ) throws Exception
+    public NormalizerSynchronizer( SchemaManager schemaManager ) throws Exception
     {
-        super( registries );
-        this.normalizerRegistry = registries.getNormalizerRegistry();
-        this.matchingRuleRegistry = registries.getMatchingRuleRegistry();
+        super( schemaManager );
     }
     
     
@@ -81,14 +70,14 @@
         ServerEntry entry = opContext.getEntry();
         String schemaName = getSchemaName( name );
         String oldOid = getOid( entry );
-        Normalizer normalizer = factory.getNormalizer( targetEntry, registries, schemaName );
+        Normalizer normalizer = factory.getNormalizer( schemaManager, targetEntry, schemaManager.getRegistries(), schemaName );
         
         if ( isSchemaEnabled( schemaName ) )
         {
             normalizer.setSchemaName( schemaName );
 
-            normalizerRegistry.unregister( oldOid );
-            normalizerRegistry.register( normalizer );
+            schemaManager.unregisterNormalizer( oldOid );
+            schemaManager.register( normalizer );
             
             return SCHEMA_MODIFIED;
         }
@@ -107,7 +96,7 @@
         parentDn.remove( parentDn.size() - 1 );
 
         // The parent DN must be ou=normalizers,cn=<schemaName>,ou=schema
-        checkParent( parentDn, normalizerRegistry, SchemaConstants.NORMALIZER );
+        checkParent( parentDn, schemaManager, SchemaConstants.NORMALIZER );
 
         // The new schemaObject's OID must not already exist
         checkOidIsUniqueForNormalizer( entry );
@@ -115,13 +104,13 @@
         // Build the new Normalizer from the given entry
         String schemaName = getSchemaName( dn );
         
-        Normalizer normalizer = factory.getNormalizer( entry, registries, schemaName );
+        Normalizer normalizer = factory.getNormalizer( schemaManager, entry, schemaManager.getRegistries(), schemaName );
         
         addToSchema( normalizer, schemaName );
 
         if ( isSchemaEnabled( schemaName ) )
         {
-            normalizerRegistry.register( normalizer );
+            schemaManager.register( normalizer );
             LOG.debug( "Added {} into the enabled schema {}", dn.getUpName(), schemaName );
         }
     }
@@ -137,17 +126,17 @@
         parentDn.remove( parentDn.size() - 1 );
         
         // The parent DN must be ou=normalizers,cn=<schemaName>,ou=schema
-        checkParent( parentDn, normalizerRegistry, SchemaConstants.NORMALIZER );
+        checkParent( parentDn, schemaManager, SchemaConstants.NORMALIZER );
         
         // Get the Normalizer from the given entry ( it has been grabbed from the server earlier)
         String schemaName = getSchemaName( entry.getDn() );
-        Normalizer normalizer = factory.getNormalizer( entry, registries, schemaName );
+        Normalizer normalizer = factory.getNormalizer( schemaManager, entry, schemaManager.getRegistries(), schemaName );
         
         String oid = normalizer.getOid();
         
         if ( isSchemaEnabled( schemaName ) )
         {
-            if ( registries.isReferenced( normalizer ) )
+            if ( schemaManager.getRegistries().isReferenced( normalizer ) )
             {
                 String msg = "Cannot delete " + entry.getDn().getUpName() + ", as there are some " +
                 " dependant SchemaObjects :\n" + getReferenced( normalizer );
@@ -158,9 +147,9 @@
         
         deleteFromSchema( normalizer, schemaName );
 
-        if ( normalizerRegistry.contains( oid ) )
+        if ( schemaManager.getNormalizerRegistry().contains( oid ) )
         {
-            normalizerRegistry.unregister( oid );
+            schemaManager.unregisterNormalizer( oid );
             LOG.debug( "Removed {} from the enabled schema {}", normalizer, schemaName );
         }
         else
@@ -178,7 +167,7 @@
         String oldOid = getOid( entry );
         String schemaName = getSchemaName( entry.getDn() );
 
-        if ( matchingRuleRegistry.contains( oldOid ) )
+        if ( schemaManager.getMatchingRuleRegistry().contains( oldOid ) )
         {
             throw new LdapOperationNotSupportedException( "The normalizer with OID " + oldOid 
                 + " cannot have it's OID changed until all " 
@@ -201,9 +190,9 @@
             newDn.add( newRdn );
             targetEntry.setDn( newDn );
 
-            Normalizer normalizer = factory.getNormalizer( targetEntry, registries, schemaName );
-            normalizerRegistry.unregister( oldOid );
-            normalizerRegistry.register( normalizer );
+            Normalizer normalizer = factory.getNormalizer( schemaManager, targetEntry, schemaManager.getRegistries(), schemaName );
+            schemaManager.unregisterNormalizer( oldOid );
+            schemaManager.register( normalizer );
         }
     }
 
@@ -216,7 +205,7 @@
         String oldSchemaName = getSchemaName( oriChildName );
         String newSchemaName = getSchemaName( newParentName );
 
-        if ( matchingRuleRegistry.contains( oldOid ) )
+        if ( schemaManager.getMatchingRuleRegistry().contains( oldOid ) )
         {
             throw new LdapOperationNotSupportedException( "The normalizer with OID " + oldOid 
                 + " cannot have it's OID changed until all " 
@@ -226,16 +215,16 @@
 
         String oid = ( String ) newRdn.getValue();
         checkOidIsUniqueForNormalizer( oid );
-        Normalizer normalizer = factory.getNormalizer( entry, registries, newSchemaName );
+        Normalizer normalizer = factory.getNormalizer( schemaManager, entry, schemaManager.getRegistries(), newSchemaName );
 
         if ( isSchemaEnabled( oldSchemaName ) )
         {
-            normalizerRegistry.unregister( oldOid );
+            schemaManager.unregisterNormalizer( oldOid );
         }
 
         if ( isSchemaEnabled( newSchemaName ) )
         {
-            normalizerRegistry.register( normalizer );
+            schemaManager.register( normalizer );
         }
     }
 
@@ -248,7 +237,7 @@
         String oldSchemaName = getSchemaName( oriChildName );
         String newSchemaName = getSchemaName( newParentName );
 
-        if ( matchingRuleRegistry.contains( oid ) )
+        if ( schemaManager.getMatchingRuleRegistry().contains( oid ) )
         {
             throw new LdapOperationNotSupportedException( "The normalizer with OID " + oid 
                 + " cannot be moved to another schema until all " 
@@ -256,24 +245,24 @@
                 ResultCodeEnum.UNWILLING_TO_PERFORM );
         }
 
-        Normalizer normalizer = factory.getNormalizer( entry, registries, newSchemaName );
+        Normalizer normalizer = factory.getNormalizer( schemaManager, entry, schemaManager.getRegistries(), newSchemaName );
         
         if ( isSchemaEnabled( oldSchemaName ) )
         {
-            normalizerRegistry.unregister( oid );
+            schemaManager.unregisterNormalizer( oid );
         }
         
         
         if ( isSchemaEnabled( newSchemaName ) )
         {
-            normalizerRegistry.register( normalizer );
+            schemaManager.register( normalizer );
         }
     }
 
     
     private void checkOidIsUniqueForNormalizer( String oid ) throws NamingException
     {
-        if ( registries.getNormalizerRegistry().contains( oid ) )
+        if ( schemaManager.getNormalizerRegistry().contains( oid ) )
         {
             throw new LdapNamingException( "Oid " + oid + " for new schema normalizer is not unique.", 
                 ResultCodeEnum.OTHER );
@@ -285,7 +274,7 @@
     {
         String oid = getOid( entry );
         
-        if ( registries.getNormalizerRegistry().contains( oid ) )
+        if ( schemaManager.getNormalizerRegistry().contains( oid ) )
         {
             throw new LdapNamingException( "Oid " + oid + " for new schema normalizer is not unique.", 
                 ResultCodeEnum.OTHER );
@@ -304,7 +293,7 @@
         
         Rdn rdn = newParent.getRdn();
 
-        if ( ! registries.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) )
+        if ( ! schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) )
         {
             throw new LdapInvalidNameException( "The parent entry of a normalizer should be an organizationalUnit.", 
                 ResultCodeEnum.NAMING_VIOLATION );

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ObjectClassSynchronizer.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/ObjectClassSynchronizer.java?rev=833647&r1=833646&r2=833647&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ObjectClassSynchronizer.java (original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/ObjectClassSynchronizer.java Sat Nov  7 07:57:34 2009
@@ -33,8 +33,7 @@
 import org.apache.directory.shared.ldap.name.Rdn;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.ObjectClass;
-import org.apache.directory.shared.ldap.schema.registries.ObjectClassRegistry;
-import org.apache.directory.shared.ldap.schema.registries.Registries;
+import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.apache.directory.shared.ldap.schema.registries.Schema;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -51,20 +50,16 @@
     /** A logger for this class */
     private static final Logger LOG = LoggerFactory.getLogger( ObjectClassSynchronizer.class );
 
-    /** The ObjectClass registry */
-    private final ObjectClassRegistry objectClassRegistry;
-
 
     /**
      * Creates a new instance of ObjectClassSynchronizer.
      *
-     * @param registries The global registries
+     * @param schemaManager The global schemaManager
      * @throws Exception If the initialization failed
      */
-    public ObjectClassSynchronizer( Registries registries ) throws Exception
+    public ObjectClassSynchronizer( SchemaManager schemaManager ) throws Exception
     {
-        super( registries );
-        this.objectClassRegistry = registries.getObjectClassRegistry();
+        super( schemaManager );
     }
 
 
@@ -76,13 +71,13 @@
         LdapDN name = opContext.getDn();
         ServerEntry entry = opContext.getEntry();
         String oid = getOid( entry );
-        ObjectClass oc = factory.getObjectClass( targetEntry, registries, getSchemaName( name ) );
+        ObjectClass oc = factory.getObjectClass( targetEntry, schemaManager.getRegistries(), getSchemaName( name ) );
         String schemaName = getSchemaName( entry.getDn() );
 
         if ( isSchemaEnabled( schemaName ) )
         {
-            objectClassRegistry.unregister( oid );
-            objectClassRegistry.register( oc );
+            schemaManager.unregisterObjectClass( oid );
+            schemaManager.register( oc );
             
             return SCHEMA_MODIFIED;
         }
@@ -101,23 +96,23 @@
         parentDn.remove( parentDn.size() - 1 );
         
         // The parent DN must be ou=objectclasses,cn=<schemaName>,ou=schema
-        checkParent( parentDn, objectClassRegistry, SchemaConstants.OBJECT_CLASS );
+        checkParent( parentDn, schemaManager, SchemaConstants.OBJECT_CLASS );
         
         // The new schemaObject's OID must not already exist
         checkOidIsUnique( entry );
         
         // Build the new ObjectClass from the given entry
         String schemaName = getSchemaName( dn );
-        ObjectClass objectClass = factory.getObjectClass( entry, registries, schemaName );
+        ObjectClass objectClass = factory.getObjectClass( entry, schemaManager.getRegistries(), schemaName );
 
         // At this point, the constructed ObjectClass has not been checked against the 
         // existing Registries. It may be broken (missing SUPs), it will be checked
         // there, if the schema and the ObjectClass are both enabled.
-        Schema schema = registries.getLoadedSchema( schemaName );
+        Schema schema = schemaManager.getLoadedSchema( schemaName );
 
         if ( schema.isEnabled() && objectClass.isEnabled() )
         {
-            objectClass.applyRegistries( registries );
+            objectClass.applyRegistries( schemaManager.getRegistries() );
         }
         
         // Associates this ObjectClass with the schema
@@ -129,22 +124,22 @@
             // The MAY AttributeTypes
             for ( AttributeType may : objectClass.getMayAttributeTypes() )
             {
-                registries.addReference( objectClass, may );
+                schemaManager.getRegistries().addReference( objectClass, may );
             }
             
             // The MUST AttributeTypes
             for ( AttributeType must : objectClass.getMayAttributeTypes() )
             {
-                registries.addReference( objectClass, must );
+                schemaManager.getRegistries().addReference( objectClass, must );
             }
             
             // The superiors
             for ( ObjectClass superior : objectClass.getSuperiors() )
             {
-                registries.addReference( objectClass, superior );
+                schemaManager.getRegistries().addReference( objectClass, superior );
             }
             
-            objectClassRegistry.register( objectClass );
+            schemaManager.register( objectClass );
             LOG.debug( "Added {} into the enabled schema {}", dn.getUpName(), schemaName );
         }
         else
@@ -165,25 +160,25 @@
         parentDn.remove( parentDn.size() - 1 );
         
         // The parent DN must be ou=objectclasses,cn=<schemaName>,ou=schema
-        checkParent( parentDn, objectClassRegistry, SchemaConstants.OBJECT_CLASS );
+        checkParent( parentDn, schemaManager, SchemaConstants.OBJECT_CLASS );
         
         // Get the ObjectClass from the given entry ( it has been grabbed from the server earlier)
         String schemaName = getSchemaName( entry.getDn() );
-        ObjectClass objectClass = factory.getObjectClass( entry, registries, schemaName );
+        ObjectClass objectClass = factory.getObjectClass( entry, schemaManager.getRegistries(), schemaName );
 
         // Applies the Registries to this ObjectClass 
-        Schema schema = registries.getLoadedSchema( schemaName );
+        Schema schema = schemaManager.getLoadedSchema( schemaName );
 
         if ( schema.isEnabled() && objectClass.isEnabled() )
         {
-            objectClass.applyRegistries( registries );
+            objectClass.applyRegistries( schemaManager.getRegistries() );
         }
         
         String oid = objectClass.getOid();
 
         if ( isSchemaEnabled( schemaName ) )
         {
-            if ( registries.isReferenced( objectClass ) )
+            if ( schemaManager.getRegistries().isReferenced( objectClass ) )
             {
                 String msg = "Cannot delete " + entry.getDn().getUpName() + ", as there are some " +
                     " dependant SchemaObjects :\n" + getReferenced( objectClass );
@@ -195,29 +190,29 @@
         // Remove the ObjectClass from the schema content
         deleteFromSchema( objectClass, schemaName );
 
-        if ( objectClassRegistry.contains( oid ) )
+        if ( schemaManager.getObjectClassRegistry().contains( oid ) )
         {
             // Update the referenced and referencing objects
             // The MAY AttributeTypes
             for ( AttributeType may : objectClass.getMayAttributeTypes() )
             {
-                registries.delReference( objectClass, may );
+                schemaManager.getRegistries().delReference( objectClass, may );
             }
             
             // The MUST AttributeTypes
             for ( AttributeType must : objectClass.getMayAttributeTypes() )
             {
-                registries.delReference( objectClass, must );
+                schemaManager.getRegistries().delReference( objectClass, must );
             }
             
             // The superiors
             for ( ObjectClass superior : objectClass.getSuperiors() )
             {
-                registries.delReference( objectClass, superior );
+                schemaManager.getRegistries().delReference( objectClass, superior );
             }
             
             // Update the Registry
-            objectClassRegistry.unregister( objectClass.getOid() );
+            schemaManager.unregisterObjectClass( objectClass.getOid() );
             
             LOG.debug( "Removed {} from the enabled schema {}", objectClass, schemaName );
         }
@@ -235,7 +230,7 @@
     public void rename( ServerEntry entry, Rdn newRdn, boolean cascade ) throws Exception
     {
         String schemaName = getSchemaName( entry.getDn() );
-        ObjectClass oldOc = factory.getObjectClass( entry, registries, schemaName );
+        ObjectClass oldOc = factory.getObjectClass( entry, schemaManager.getRegistries(), schemaName );
 
         // Dependency constraints are not managed by this class
 //        Set<ServerEntry> dependees = dao.listObjectClassDependents( oldOc );
@@ -259,12 +254,12 @@
         newDn.add( newRdn );
         
         checkOidIsUnique( newOid );
-        ObjectClass oc = factory.getObjectClass( targetEntry, registries, schemaName );
+        ObjectClass oc = factory.getObjectClass( targetEntry, schemaManager.getRegistries(), schemaName );
 
         if ( isSchemaEnabled( schemaName ) )
         {
             // Check that the entry has no descendant
-            if ( objectClassRegistry.hasDescendants( oldOc.getOid() ) )
+            if ( schemaManager.getObjectClassRegistry().hasDescendants( oldOc.getOid() ) )
             {
                 String msg = "Cannot rename " + entry.getDn().getUpName() + " to " + newDn + 
                     " as the later has descendants' ObjectClasses";
@@ -272,8 +267,8 @@
                 throw new LdapOperationNotSupportedException( msg, ResultCodeEnum.UNWILLING_TO_PERFORM );
             }
             
-            objectClassRegistry.unregister( oldOc.getOid() );
-            objectClassRegistry.register( oc );
+            schemaManager.unregisterObjectClass( oldOc.getOid() );
+            schemaManager.register( oc );
         }
         else
         {
@@ -288,7 +283,7 @@
     {
         checkNewParent( newParentName );
         String oldSchemaName = getSchemaName( oriChildName );
-        ObjectClass oldOc = factory.getObjectClass( entry, registries, oldSchemaName );
+        ObjectClass oldOc = factory.getObjectClass( entry, schemaManager.getRegistries(), oldSchemaName );
 
         // this class does not handle dependencies
 //        Set<ServerEntry> dependees = dao.listObjectClassDependents( oldOc );
@@ -306,11 +301,11 @@
         String newOid = ( String ) newRdn.getValue();
         checkOidIsUnique( newOid );
         targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid );
-        ObjectClass oc = factory.getObjectClass( targetEntry, registries, newSchemaName );
+        ObjectClass oc = factory.getObjectClass( targetEntry, schemaManager.getRegistries(), newSchemaName );
 
         if ( isSchemaEnabled( oldSchemaName ) )
         {
-            objectClassRegistry.unregister( oldOc.getOid() );
+            schemaManager.unregisterObjectClass( oldOc.getOid() );
         }
         else
         {
@@ -319,7 +314,7 @@
         
         if ( isSchemaEnabled( newSchemaName ) )
         {
-            objectClassRegistry.register( oc );
+            schemaManager.register( oc );
         }
         else
         {
@@ -334,12 +329,12 @@
         checkNewParent( newParentName );
         String oldSchemaName = getSchemaName( oriChildName );
         String newSchemaName = getSchemaName( newParentName );
-        ObjectClass oldAt = factory.getObjectClass( entry, registries, oldSchemaName );
+        ObjectClass oldAt = factory.getObjectClass( entry, schemaManager.getRegistries(), oldSchemaName );
 
         // dependencies are not managed by this class
 //        Set<ServerEntry> dependees = dao.listObjectClassDependents( oldAt );
 //        if ( dependees != null && dependees.size() > 0 )
-//        {
+//        {s
 //            throw new LdapOperationNotSupportedException( "The objectClass with OID " + oldAt.getOid() 
 //                + " cannot be deleted until all entities" 
 //                + " using this objectClass have also been deleted.  The following dependees exist: " 
@@ -347,11 +342,11 @@
 //                ResultCodeEnum.UNWILLING_TO_PERFORM );
 //        }
 
-        ObjectClass oc = factory.getObjectClass( entry, registries, newSchemaName );
+        ObjectClass oc = factory.getObjectClass( entry, schemaManager.getRegistries(), newSchemaName );
         
         if ( isSchemaEnabled( oldSchemaName ) )
         {
-            objectClassRegistry.unregister( oldAt.getOid() );
+            schemaManager.unregisterObjectClass( oldAt.getOid() );
         }
         else
         {
@@ -360,7 +355,7 @@
         
         if ( isSchemaEnabled( newSchemaName ) )
         {
-            objectClassRegistry.register( oc );
+            schemaManager.register( oc );
         }
         else
         {
@@ -380,7 +375,7 @@
         
         Rdn rdn = newParent.getRdn();
         
-        if ( ! registries.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) )
+        if ( ! schemaManager.getAttributeTypeRegistry().getOidByName( rdn.getNormType() ).equals( SchemaConstants.OU_AT_OID ) )
         {
             throw new LdapInvalidNameException( "The parent entry of a objectClass should be an organizationalUnit.", 
                 ResultCodeEnum.NAMING_VIOLATION );



Mime
View raw message