directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Alderson <Martin.Alder...@salfordsoftware.co.uk>
Subject RE: [Client API] Bind Operation
Date Tue, 31 Mar 2009 16:46:01 GMT
> 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.

I would at least like to see the BindRequest and BindOptions objects merged.

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.

Martin


Mime
View raw message