Return-Path: Delivered-To: apmail-directory-dev-archive@www.apache.org Received: (qmail 88162 invoked from network); 30 Nov 2009 23:46:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 30 Nov 2009 23:46:12 -0000 Received: (qmail 37706 invoked by uid 500); 30 Nov 2009 23:46:12 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 37609 invoked by uid 500); 30 Nov 2009 23:46:12 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 37601 invoked by uid 99); 30 Nov 2009 23:46:12 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Nov 2009 23:46:12 +0000 X-ASF-Spam-Status: No, hits=-8.2 required=5.0 tests=AWL,BAYES_00,HTML_MESSAGE,RCVD_IN_DNSWL_HI X-Spam-Check-By: apache.org Received: from [140.211.11.9] (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 30 Nov 2009 23:46:06 +0000 Received: (qmail 88118 invoked by uid 99); 30 Nov 2009 23:45:46 -0000 Received: from localhost.apache.org (HELO mail-bw0-f222.google.com) (127.0.0.1) (smtp-auth username elecharny, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Nov 2009 23:45:46 +0000 Received: by bwz22 with SMTP id 22so3349687bwz.25 for ; Mon, 30 Nov 2009 15:45:44 -0800 (PST) MIME-Version: 1.0 Reply-To: elecharny@apache.org Received: by 10.204.48.212 with SMTP id s20mr5043935bkf.101.1259624744003; Mon, 30 Nov 2009 15:45:44 -0800 (PST) Date: Tue, 1 Dec 2009 00:45:43 +0100 Message-ID: Subject: [Schema refactoring] Current state : algorithms From: Emmanuel Lecharny To: Apache Directory Developers List Content-Type: multipart/alternative; boundary=00032555691e6aaac604799f3de7 --00032555691e6aaac604799f3de7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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 th= e SchemaObjects have been injected. Loading a schema : ------------------ schemaManager.loadWithDeps( "system" ) schemaManager.loadWithDeps( ["system"] ) clonedRegistries =3D 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 =3D 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 errors =3D 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 =3D 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 =3D factory.getAttributeType( schemaManager, entry, schemaManager.getRegistries(), schemaName ) clonedRegistries =3D 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 =3D 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). --=20 Regards, Cordialement, Emmanuel L=E9charny www.iktek.com --00032555691e6aaac604799f3de7 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable This describes the addi= tion operation of a full schema and of an AT, injected with a LDAP operatio= n. 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 SchemaObjec= t.

The important parts are the XXXRegistry.register(), XXXRegistry.associa= teWithSchema() and
schemaObject.applyRegistries() methods.

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

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

schemaManager.loadWithDeps( "system" )=
=A0schemaManager.loadWithDeps( ["sy= stem"] )
=A0 =A0clonedRegistrie= s =3D cloneRegistries();
=A0 =A0clonedReg= istries.setRelaxed();
=A0 =A0for ( Schema sc= hema : schemas )
A-----schemaManager.loadD= epsFirst( clonedRegistries, "system" );
| =A0 =A0 =A0 schemaMan= ager.load( clonedRegistries, "system" )
| =A0 =A0 =A0 =A0 schemaManager.registerSchemaObjects( "system= ", clonedRegistries );
| =A0 =A0 =A0 =A0 =A0 s= chemaManager.registerXXX[AT, OC, ...]( "system", clonedRegistries= );
| =A0 =A0 =A0 =A0 =A0 ...
| =A0 =A0 =A0 =A0 =A0 = =A0 for ( Entry entry : schemaLoader.loadXXX( "system" ) )=
| =A0 =A0 =A0 =A0 =A0 =A0 =A0 schemaObject =3D f= actory.getXXX( ??? )
| =A0 =A0 =A0 =A0 =A0 = =A0 =A0 registerSchemaObject( clonedRegistries, schemaObject, "system&= quot; );
| =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= clonedRegistries.add( schemaObject );
|a------------------clo= nedRegistries.register( schemaObject );
||= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0XXXRegistry.register( schemaObject = );
|| =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0register oid in byOid
|| =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0register names in byName
|| =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0clonedRegistries.associateWithSchema( schemaObject )<= br style=3D"font-family: courier new,monospace;">|| =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0store s= chemaObject in schemaContents
|b--------------------s= tore schemaObject in globalOidRegistry (if not loadable)
| =A0 List<Throwable> errors =3D clonedRegistries.buil= dReferences();
| =A0 =A0 clonedRegistr= ies.buildXXX[AT,OC,...]References( errors )
| =A0 =A0 =A0 for ( XXX= schemaObject : XXXRegistry )
| =A0 =A0 = =A0 =A0 clonedRegistries.buildReference( errors, schemaObject )
B-----------schemaObjec= t.applyRegistries( errors, this );
=A0 = =A0if ( errors.isEmpty() )
=A0 =A0 =A0errors =3D = clonedRegistries.checkRefInteg();
=A0 =A0= =A0if ( errors.isEmpty() )
=A0 =A0 =A0 =A0for ( S= chema schema : schemas )
=A0 =A0 =A0 =A0 = =A0LoadDepsFirst( registries, "system" =A0)
=A0 =A0 =A0 =A0 =A0 = =A0--> same as A-B
=A0 =A0 =A0 =A0regi= stries.buildReferences();
=A0 =A0clonedRegistrie= s.clear();


Injecting an AttributeT= ype :
----------------------------

SchemaPartition.add( AddOperationContext opConte= xt )
=A0synchronizer.add( opContext );

=A0 =A0RegistrySynchro= nizer.add( opContext )
=A0 =A0 =A0synchro= nizer.add( entry );
=A0 =A0 =A0 =A0Attribu= teTypeSynchronizer.add( entry )
=A0 =A0 = =A0 =A0AttributeType attributeType =3D factory.getAttributeType( schemaMana= ger, entry, schemaManager.getRegistries(), schemaName )
=A0 =A0 =A0 =A0clonedR= egistries =3D schemaManager.getRegistries().clone();
C-------add( errors, clonedRegistries, attributeType ); | =A0 =A0 =A0 =A0 regis= tries.setRelaxed();
| =A0 =A0 =A0 =A0 regi= stries.add( schemaObject );
|c----------registries.= register( schemaObject );
|| =A0 =A0 =A0 = =A0 =A0 =A0attributeTypeRegistry(DefaultSchemaObjectRegistry).register( (At= tributeType)schemaObject );
|| =A0 =A0 =A0 =A0 =A0 = =A0 =A0register oid in byOid
|| =A0 =A0 = =A0 =A0 =A0 =A0 =A0register names in byName
|| =A0 =A0 =A0 =A0 =A0r= egistries.associateWithSchema( schemaObject );
|| =A0 =A0 =A0 =A0 =A0 =A0store schemaObject in schemaContents<= br style=3D"font-family: courier new,monospace;"> |d------------store sch= emaObject in globalOidRegistry (if not loadable)
| =A0 =A0 =A0 =A0 registries.buildReference( errors, schemaObject );=
D-----------schemaObjec= t.applyRegistries( errors, this );
=A0 = =A0 =A0 =A0 =A0errors =3D registries.checkRefInteg();
=A0 =A0 =A0 =A0clonedR= egistries.clear();
= =A0 =A0 =A0 =A0if ( er= rors.isEmpty() )
=A0 =A0 =A0 =A0 =A0add= ( errors, schemaManager.getRegistries(), attributeType )
=A0 =A0 =A0 =A0 =A0 =A0--> same as C-D
=A0wrapped.add( opCont= ext );
=A0updateSchemaModificationAttrib= utes( opContext );


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

<= span style=3D"font-family: courier new,monospace;">--
Regards,
Cordialement,
Emmanuel L=E9charny
www.iktek.co= m

--00032555691e6aaac604799f3de7--