directory-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel L├ęcharny <>
Subject AttriuteType/ObjectClass mutable/immutable status
Date Sat, 04 Mar 2017 07:02:03 GMT
Hi !

last week, while looking at the AttributeType class, I realized that it
comes with two flavors : immutable (AttributeType) and mutable
(MutableAttribuetType). The problem being that the immutable class
cannot be initialized at all, except if you just want to set its OID.

This is problematic, especially since we don't have a factory to
generate an immutable instance (remember that such object is very
unlikely to be changed).

I think there is a design issue here, and this is also true for the
ObjectClass/MutableObjectClass classes. There are some solutions :

1) Create a SchemaObject factory, that creates immutable classes.
Mutable classes can still be created directly

2) Get rid of the immutable classes, that aren't used anywhere. We
currently use the MutableAttributeType/MutableObjectClass when we parse
schema elements strings anyway.

In order to limit the visibility of setters, we could also make the
mutable class an interface, and only expose getters.

IMHO, I don't think that having immutable classes is really a must, and
it makes everything a bit too complex. We could add a factory, for the
sake of simplicity. This factory can take a schema object description (a
String) as a parameter, or a set of parameters :

    SchemaObjectFactory.create( "attributetype ( NAME
'name0'\n\tEQUALITY matchingRule0\n\tSYNTAX{512}\n\tCOLLECTIVE\n\tUSAGE userApplications )" )


    SchemaObjectFactory.createAttributeType( "", "matchingRule0",
"{512}", TypeEnum.COLLECTIVE, UsageEnum.USER_APPLICATION, "name0" );

(you get the idea).

wdyt ?

Side note : that would be for 2.0

Emmanuel Lecharny

View raw message