directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pierre-Arnaud Marcelot>
Subject Re: SchemaLoaders : another approach.
Date Mon, 06 Feb 2012 09:20:41 GMT
I really like the idea too, but I think we can combine both approaches.

I see the SchemaManager more of an internal class and not something that someone (except experts)
would instantiate.

To ease the loading of the Schema and make the API schema aware, avoiding issues with binary
attributes (for example), I would recommend to let the SchemaManager.load(SchemaLoader) or
SchemaManager.setSchemaLoader(SchemaLoader) method, without any other easy to use method.
I don't see users of the API having to manually create an instance of SchemaManager.

On the other hand I would add new methods to the LdapNetworkConnection which is the base of
the API and is used by 100% of our users (novice or experts).
I would add two methods:
- loadSchema(), targeted to casual users, which would load the Schema over the wire using
the DefaultNetworkSchemaLoader (the one searching schema elements via the subSchemaSubEntry)
- loadSchema(SchemaLoader), target to more experienced users, which is meant  allow any kind
of Schema loading, be it over the wire or reading ldif or plain files on disk.

I think we should always think about not overloading the API with two many methods and always
focus on having one simple method for casual user and one more complex for more experienced
users (usually by providing a specific class instance of their choice).


On 6 févr. 2012, at 09:57, Emmanuel Lecharny wrote:

> May be we are looking at the problem from the wrong side.
> All in all, is the user interested into the class used to load the schema ? What about
telling the SchemaManager to load the schema, and telling it to use a schemaLoader of our
choice if needed ?
> As of today, we do :
>        SchemaLoader loader = new NetworkSchemaLoader( connection );
>        // Load the schemas
>        SchemaManager schemaManager = new DefaultSchemaManager( loader );
> What if we do :
>        SchemaManager schemaManager = new DefaultSchemaManager( loader );
>        schemaManager.loadFromSubentry();
> ?
> We would have :
>        schemaManager.loadFromLdif();
>        schemaManager.loadFromJar();
>        schemaManager.loadFromSingleLdif();
>        schemaManager.loadFromSubentry();
>        schemaManager.loadFromAds();
> And for those who would like to use another schemaLoader, we could also have :
>        schemaManager.load( schemaLoader );
> We then could 'hide' the existing SchemaLoader, ie not expose them to the public.
> From the user POV, that would probably be easier, no ?
> -- 
> Regards,
> Cordialement,
> Emmanuel Lécharny

View raw message