directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lecharny <elecha...@gmail.com>
Subject API evolution
Date Wed, 11 May 2011 16:25:32 GMT
Hi guys,

those last three days, I made some modifications in the API following 
the discussions we has 2 weeks ago. Namely :
1) The 'simple' requests are not anymore returning a Response. If 
somethng went wrong, an exception will be thrown.

For instance, instead of doing :

BindResponse bindResponse = connection.bing( "jdoe", secret" );

if ( bindResponse.getResultCode() == ResultCodeEnum.SUCCESS )
{
     // do something
}

we now do :

try
{
     connection.bing( "jdoe", secret" );
}
catch ( LdapException le )
{
     // Deal with the issue
}

Note that if you do a connection.bind( BindRequest ), then you get back 
a BindResponse.


2) The search request is now returning a EntryCursor for 'simple' searches.

The code now looks like :

          EntryCursor cursor = connection.search( "ou=system", "(objectClass=*)", SearchScope.SUBTREE,
"*" );

          while ( cursor.next() )
          {
              Entry result = cursor.get();
              // do something with the Entry

          }

instead of :

          Cursor<Response>  cursor = connection.search( "ou=system", "(objectClass=*)",
SearchScope.SUBTREE, "*" );

          while ( cursor.next() )
          {
              Entry result = ( ( SearchResultEntry ) cursor.get() ).getEntry();
              // do something with the Entry
          }

Again, using a connection.search( SearchRequest ), you get back a Cursor<Response> 
as a result.



-- 
Regards,
Cordialement,
Emmanuel L├ęcharny
www.iktek.com


Mime
View raw message