From dev-return-38021-apmail-directory-dev-archive=directory.apache.org@directory.apache.org Wed May 11 17:06:24 2011 Return-Path: X-Original-To: apmail-directory-dev-archive@www.apache.org Delivered-To: apmail-directory-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 46AC54D6D for ; Wed, 11 May 2011 17:06:24 +0000 (UTC) Received: (qmail 81533 invoked by uid 500); 11 May 2011 17:06:24 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 81333 invoked by uid 500); 11 May 2011 17:06:24 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 81326 invoked by uid 99); 11 May 2011 17:06:24 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 May 2011 17:06:24 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of pajbam@gmail.com designates 74.125.82.178 as permitted sender) Received: from [74.125.82.178] (HELO mail-wy0-f178.google.com) (74.125.82.178) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 May 2011 17:06:16 +0000 Received: by wyb33 with SMTP id 33so658595wyb.37 for ; Wed, 11 May 2011 10:05:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:from:mime-version:content-type:subject :date:in-reply-to:to:references:message-id:x-mailer; bh=udFqznsc2YTlP/QOx2L6eXFA26TOHy2BN8BVPLEJUhU=; b=POdfHv6C5FBWRcFPTlJbSO/F8NbwM02nWgtkF/3PjPKl2vOisw/ARvkx1kjeRYlQvE RR45YH6NYrZNTlBBVQ+lBWH9ZSpKHpncKZ8NK1/EvyAO5VH8AgV+cAYtzu4sAZiEYg2h 3ZrMMn/SVOEZad6L4vBPJ16BgqFRQgr2ONZ7c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:mime-version:content-type:subject:date:in-reply-to:to :references:message-id:x-mailer; b=BP2BYwDbHMyLyfTyFsWDsr+ha66v/6dZ7I5Tk07wvuDBc6m1Tw+4QOVbhr7LCXZ666 y4DC5CK/0smAgVFbX9h8Qv11Y9aexPvfwaATPh87B0ad70/+scREXcneQGKxOe6mV1Nq mMSxELTpmwTdDUVqkxbTWgv5BM0dvPhxXt1U4= Received: by 10.227.165.10 with SMTP id g10mr10276661wby.91.1305133554935; Wed, 11 May 2011 10:05:54 -0700 (PDT) Received: from [192.168.0.52] (lon92-10-78-226-4-211.fbx.proxad.net [78.226.4.211]) by mx.google.com with ESMTPS id o6sm228730wbo.20.2011.05.11.10.05.53 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 11 May 2011 10:05:53 -0700 (PDT) Sender: Pierre-Arnaud Marcelot From: Pierre-Arnaud Marcelot Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: multipart/alternative; boundary=Apple-Mail-1-408837761 Subject: Re: API evolution Date: Wed, 11 May 2011 19:05:52 +0200 In-Reply-To: To: "Apache Directory Developers List" References: <4DCAB87C.9030202@gmail.com> Message-Id: X-Mailer: Apple Mail (2.1084) --Apple-Mail-1-408837761 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Definitely a good step towards a very easy to use and eye-pleasing API = (which is also full featured for experienced developers). Thanks Emmanuel! Regards, Pierre-Arnaud On 11 mai 2011, at 18:40, Alex Karasulu wrote: >=20 > On Wed, May 11, 2011 at 7:25 PM, Emmanuel Lecharny = wrote: > Hi guys, >=20 > 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. >=20 > For instance, instead of doing : >=20 > BindResponse bindResponse =3D connection.bing( "jdoe", secret" ); >=20 > if ( bindResponse.getResultCode() =3D=3D ResultCodeEnum.SUCCESS ) > { > // do something > } >=20 > we now do : >=20 > try > { > connection.bing( "jdoe", secret" ); > } > catch ( LdapException le ) > { > // Deal with the issue > } >=20 > Note that if you do a connection.bind( BindRequest ), then you get = back a BindResponse. >=20 >=20 > 2) The search request is now returning a EntryCursor for 'simple' = searches. >=20 > The code now looks like : >=20 > EntryCursor cursor =3D connection.search( "ou=3Dsystem", = "(objectClass=3D*)", SearchScope.SUBTREE, "*" ); >=20 > while ( cursor.next() ) > { > Entry result =3D cursor.get(); > // do something with the Entry >=20 > } >=20 > instead of : >=20 > Cursor cursor =3D connection.search( "ou=3Dsystem", = "(objectClass=3D*)", SearchScope.SUBTREE, "*" ); >=20 > while ( cursor.next() ) > { > Entry result =3D ( ( SearchResultEntry ) cursor.get() = ).getEntry(); > // do something with the Entry > } >=20 > Again, using a connection.search( SearchRequest ), you get back a = Cursor as a result. >=20 > This looks a lot cleaner. Great job Emmanuel.=20 >=20 > Thanks, > Alex=20 --Apple-Mail-1-408837761 Content-Transfer-Encoding: 7bit Content-Type: text/html; charset=us-ascii Definitely a good step towards a very easy to use and eye-pleasing API (which is also full featured for experienced developers).

Thanks Emmanuel!

Regards,
Pierre-Arnaud

On 11 mai 2011, at 18:40, Alex Karasulu wrote:


On Wed, May 11, 2011 at 7:25 PM, Emmanuel Lecharny <elecharny@gmail.com> wrote:
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.

This looks a lot cleaner. Great job Emmanuel. 

Thanks,
Alex 

--Apple-Mail-1-408837761--