This describes the addition operation of a full schema and of an AT, injected with a LDAP operation. Some parts are common, like [a--b] and [c--d].

It is to be noted that every schema modification is done first in a Registries clone, the checked, and applied only if the result is consistent.

Another point is that the errors propagation has to be improved, and the principles have to be extended to each SchemaObject.

The important parts are the XXXRegistry.register(), XXXRegistry.associateWithSchema() and
schemaObject.applyRegistries() methods.

Also note that those modification are done on a relaxed Registries, as we need to accept the modification even if they break the schema, until all the SchemaObjects have been injected.

Loading a schema :
------------------

schemaManager.loadWithDeps( "system" )
 schemaManager.loadWithDeps( ["system"] )
   clonedRegistries = cloneRegistries();
   clonedRegistries.setRelaxed();
   for ( Schema schema : schemas )
A-----schemaManager.loadDepsFirst( clonedRegistries, "system" );
|       schemaManager.load( clonedRegistries, "system" )
|         schemaManager.registerSchemaObjects( "system", clonedRegistries );
|           schemaManager.registerXXX[AT, OC, ...]( "system", clonedRegistries );
|           ...
|             for ( Entry entry : schemaLoader.loadXXX( "system" ) )
|               schemaObject = factory.getXXX( ??? )
|               registerSchemaObject( clonedRegistries, schemaObject, "system" );
|                 clonedRegistries.add( schemaObject );
|a------------------clonedRegistries.register( schemaObject );
||                    XXXRegistry.register( schemaObject );
||                      register oid in byOid
||                      register names in byName
||                  clonedRegistries.associateWithSchema( schemaObject )
||                    store schemaObject in schemaContents
|b--------------------store schemaObject in globalOidRegistry (if not loadable)
|   List<Throwable> errors = clonedRegistries.buildReferences();
|     clonedRegistries.buildXXX[AT,OC,...]References( errors )
|     ...
|       for ( XXX schemaObject : XXXRegistry )
|         clonedRegistries.buildReference( errors, schemaObject )
B-----------schemaObject.applyRegistries( errors, this );
   if ( errors.isEmpty() )
     errors = clonedRegistries.checkRefInteg();
     if ( errors.isEmpty() )
       for ( Schema schema : schemas )
         LoadDepsFirst( registries, "system"  )
           --> same as A-B
       registries.buildReferences();
   clonedRegistries.clear();


Injecting an AttributeType :
----------------------------

SchemaPartition.add( AddOperationContext opContext )
 synchronizer.add( opContext );
   RegistrySynchronizer.add( opContext )
     synchronizer.add( entry );
       AttributeTypeSynchronizer.add( entry )
       AttributeType attributeType = factory.getAttributeType( schemaManager, entry, schemaManager.getRegistries(), schemaName )
       clonedRegistries = schemaManager.getRegistries().clone();
C-------add( errors, clonedRegistries, attributeType );
|         registries.setRelaxed();
|         registries.add( schemaObject );
|c----------registries.register( schemaObject );
||            attributeTypeRegistry(DefaultSchemaObjectRegistry).register( (AttributeType)schemaObject );
||              register oid in byOid
||              register names in byName
||          registries.associateWithSchema( schemaObject );
||            store schemaObject in schemaContents
|d------------store schemaObject in globalOidRegistry (if not loadable)
|         registries.buildReference( errors, schemaObject );
D-----------schemaObject.applyRegistries( errors, this );
         errors = registries.checkRefInteg();
       clonedRegistries.clear();
       if ( errors.isEmpty() )
         add( errors, schemaManager.getRegistries(), attributeType )
           --> same as C-D
 wrapped.add( opContext );
 updateSchemaModificationAttributes( opContext );


Those two methods have already been implemented. I'm working on the other ones (for other schemaObjects).

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com