directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Karasulu <akaras...@apache.org>
Subject [Shared] [LDAP] Codec control modifications from last night
Date Wed, 26 Jan 2011 13:25:29 GMT
He's a summary of what I did last night with the Controls in the
shared codec area soon to be turned into shared-ldap-codec module
after removing the model API classes.

(1) I first prepared to create non-codec dependent representations of
control objects to be used in the model. These objects simple
implement the Control interface in the model. There's a temporary
Control base class I used called SimpleControlImpl. Before doing this
though I renamed the existing control objects, like ManageDsaITControl
to ManageDsaITDecorator. The reason for this is because these were
being used for multiple purposes.

   (a) as control objects for API manipulation, having the OID
constant in them for reference and other control specific property
getters and setters,
   (b) as Asn1Objects that can be manipulated by the codec,
   (c) as CodecControl interface implementers for consistent
manipulation also by the codec but specifically in control handling
code

Basically what was the model object, was serving multiple purposes,
and in the configuration we're moving towards with the decorator
pattern, it really is the decorator wrapping the model object, just to
inject codec specific functionality. So I renamed, FooControl, to
FooControlDecorator and made it extend the ControlDecorator base
class.

(2) Next I copied the FooControlDecorator, naming it FooControl. I
then stripped out the decorator logic, and left only the model
specific code:

   (a) getters and setters for control properties: i.e. changesOnly
for entry change control
   (b) constants like the OID value for the control

(3) Then I made the FooControlDecorator, wrap the FooControl and
exposed the OID for the control as a constant only on the FooControl.
Now FooControl is free of all codec dependencies. It's just a simple
model object and is ready to be moved into the model under
oadlm.message.controls.

(4) I modified the FooControlDecoder, FooControlGrammer, and
FooControlContainer to use these objects properly. Since we separated
the control's properties into FooControl, and left the encoding and
decoding transient variables and functions inside FooControlDecorator,
now we had to make the decoders, grammars, and containers used the
appropriate object. This was easy enough since we have the decorator
available, and can just get the control model object from it via
decorator.getDecorated().

I stopped here but now after getting shared working we can move these
standard controls we support, i.e. FooControl, into the model leaving
the codec specific classes FooControlDecoder, FooControlGrammar, and
FooControlContainer, encapsulated away inside the codec. Next we can
remove all references to the FooControlDecoder in apacheds, and in
studio replacing them with FooControl without affecting the codec's
operation.

-- 
Alex Karasulu
My Blog :: http://www.jroller.com/akarasulu/
Apache Directory Server :: http://directory.apache.org
Apache MINA :: http://mina.apache.org
To set up a meeting with me: http://tungle.me/AlexKarasulu

Mime
View raw message