Martin Alderson wrote:
I like this BindOption class, it's much better than LDAPConstraints. But I
think it should be associated with the BindRequest object, to keep the
bind() method as simplest as possible. Using your sample, that would gives
:

  BindOptions bindOptions = new BindOptions();
  bindOptions.setTimeLimit(10000);
  bindOptions.setControls(controls);
  BindRequest bindRequest = connection.createBindRequest();
  bindRequest.setOptions( bindOptions );
  bindRequest.setName( userDN );
  bindRequest.setPassword( password );

  connection.bind( bindRequest );

For a simple bind, it would be much simpler :

  connection.bind( userDN, password );

But this is getting a bit heavyweight.  If you start off using the simple:

  connection.bind( userDN, password )

then later on you decide you want to specify a time limit for this bind 
operation you then have to change it to:

  BindOptions bindOptions = new BindOptions();
  bindOptions.setTimeLimit(10000);
  BindRequest bindRequest = connection.createBindRequest();
  bindRequest.setOptions( bindOptions );
  bindRequest.setName( userDN );
  bindRequest.setPassword( password );

  connection.bind( bindRequest );

... all that just to specify a time limit.  Its suddenly gone from being very 
simple and clear to a big chunk of code.
Yes, this is heavy, but when it comes to defining specific parameters, like TimeLimit for a BindRequest, I don't think it's really used often. So I'm keen to sacrifice it...
I would at least like to see the BindRequest and BindOptions objects merged.
This is an option. We may not need this BindOption class anyway...
I suspect that we're looking at this from two different perspectives - you from 
the design (making sure everything is in its logical place) and me from the 
code (ease of reading, writing and modifying).  I think both are important but 
they seem to be conflicting a bit here.
Well, my perspective is _really_ the user's one. I want the user to find the API easy to use for 90% of the case, and for the bind() operation, I think that bind() and bind(name, password) will be the used operations (probably more tha 90% of the time).

But I may be wrong, or the perception might be slightly off base, thus those mails :)

--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org


Reply via email to