From api-return-293-apmail-directory-api-archive=directory.apache.org@directory.apache.org Thu Jun 30 13:37:50 2011 Return-Path: X-Original-To: apmail-directory-api-archive@minotaur.apache.org Delivered-To: apmail-directory-api-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 76CDA65E7 for ; Thu, 30 Jun 2011 13:37:50 +0000 (UTC) Received: (qmail 84099 invoked by uid 500); 30 Jun 2011 13:37:50 -0000 Delivered-To: apmail-directory-api-archive@directory.apache.org Received: (qmail 84047 invoked by uid 500); 30 Jun 2011 13:37:49 -0000 Mailing-List: contact api-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: api@directory.apache.org Delivered-To: mailing list api@directory.apache.org Received: (qmail 84036 invoked by uid 99); 30 Jun 2011 13:37:49 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Jun 2011 13:37:49 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of dfisher@vt.edu designates 198.82.162.213 as permitted sender) Received: from [198.82.162.213] (HELO lennier.cc.vt.edu) (198.82.162.213) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Jun 2011 13:37:41 +0000 Received: from vivi.cc.vt.edu (vivi.cc.vt.edu [198.82.163.43]) by lennier.cc.vt.edu (8.13.8/8.13.8) with ESMTP id p5UDbK0A026625 for ; Thu, 30 Jun 2011 09:37:20 -0400 Received: from mail-pv0-f180.google.com (EHLO mail-pv0-f180.google.com) ([74.125.83.180]) by vivi.cc.vt.edu (MOS 4.2.2-FCS FastPath queued) with ESMTP id RVS62815; Thu, 30 Jun 2011 09:37:18 -0400 (EDT) Received: by pvc21 with SMTP id 21so4365265pvc.25 for ; Thu, 30 Jun 2011 06:37:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.17.164 with SMTP id p4mr2492105pbd.328.1309441037751; Thu, 30 Jun 2011 06:37:17 -0700 (PDT) Received: by 10.68.63.202 with HTTP; Thu, 30 Jun 2011 06:37:17 -0700 (PDT) In-Reply-To: References: <0F23E381-B3CE-49E2-BC25-28500B90F431@marcelot.net> Date: Thu, 30 Jun 2011 09:37:17 -0400 Message-ID: Subject: Re: Paged Results Control From: Daniel Fisher To: api@directory.apache.org Content-Type: multipart/alternative; boundary=bcaec51f8fd9e8d71804a6edff24 X-Mirapoint-Received-SPF: 74.125.83.180 mail-pv0-f180.google.com dfisher@vt.edu 4 softfail X-Junkmail-Info: (0) HTML_MESSAGE X-Junkmail-Status: score=10/50, host=vivi.cc.vt.edu X-Junkmail-Signature-Raw: score=unknown, refid=str=0001.0A020207.4E0C7C0F.0132,ss=1,fgs=0, ip=0.0.0.0, so=2010-07-22 22:03:31, dmn=2009-09-10 00:05:08, mode=multiengine X-Junkmail-IWF: false X-Virus-Checked: Checked by ClamAV on apache.org --bcaec51f8fd9e8d71804a6edff24 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable It's likely that I'm just coding it wrong since there aren't any docs or samples that I can find. This code successfully sends the control to the LDAP: PagedResultsImpl pri =3D new PagedResultsImpl(); pri.setCritical(true); pri.setSize(1); PagedResultsDecorator prd =3D new PagedResultsDecorator(LdapApiServiceFactory.getSingleton(), pri); SearchRequest request =3D new SearchRequestImpl(); request.setScope(SearchScope.SUBTREE); request.setBase(new Dn("dc=3Dvt,dc=3Dedu")); request.setFilter("(uid=3D*)"); request.addAllControls(new Control[] {prd, }); However, I can't get the cookie out of the response. The returned control i= s of type OpaqueControl, which seems to indicate that the codec service doesn't support this control. --Daniel Fisher On Wed, Jun 29, 2011 at 9:15 AM, Pierre-Arnaud Marcelot wr= ote: > Actually this is a little more complex... > > Initially Studio was only based on JNDI and some of its APIs have been > spread all over the place. > When, we decided to include the LDAP API and offer the choice to select t= he > type of network provider (either JNDI or Apache Directory LDAP API), we > evaluated the impact on the existing code. > It was huge... And we decided to wrap/convert a few elements of the LDAP > API to the JNDI API, as a first step at least... > > This is especially true for the controls interface which is present in a > significant number of classes in Studio. > > This is why you're not finding a direct reference to the PagedResultsImpl > class in Studio's code. Controls are converted from and to JNDI controls = as > OpaqueControl instances in the convertControls() methods of the > org.apache.directory.studio.connection.core.io.api.DirectoryApiConnection= Wrapper > class. > > We use the JNDI PagedResultsControl in the > org.apache.directory.studio.connection.core.StudioPagedResultsControl cla= ss > where it's wrapped. > > I'm going to test your code on my OpenLDAP server to see if I get the sam= e > results. > > Regards, > Pierre-Arnaud > > On 29 juin 2011, at 14:28, Daniel Fisher wrote: > > > I'm testing OpenLDAP 2.4.23 with bdb. Paged results work fine with JNDI > and > > JLDAP, so I'm confident the server is configured correctly. I glanced a= t > the > > studio code, but I didn't see anything that wasn't using or delegating = to > a > > JNDI PagedResultsControl. Can you point me to some source that uses > > org.apache.directory.shared.ldap.model.message.controls.PagedResultsImp= l > > ? Thanks. > > > > --Daniel Fisher > > > > On Wed, Jun 29, 2011 at 3:02 AM, Pierre-Arnaud Marcelot >wrote: > > > >> Hi Daniel, > >> > >> Studio's current trunk embeds the LDAP API as a replacement for JNDI > (you > >> can select the one you want on a connection basis). > >> I've tested a Paged Search using it on an OpenLDAP 2.4.24 server and i= t > >> worked fine. > >> It showed me the required number of results and I was able to move > through > >> pages. > >> > >> Although, it didn't work on all database backends, like the "cn=3Dconf= ig" > >> database for instance. > >> It appears only "bdb" and "hdb" database backends support this control= . > [1] > >> > >> Which database backend are you using for your "dc=3Dvt,dc=3Dedu" datab= ase ? > >> > >> Regards, > >> Pierre-Arnaud > >> > >> [1] =97 > http://www.openldap.org/lists/openldap-software/200402/msg00508.html > >> > >> > >> On 28 juin 2011, at 18:58, Daniel Fisher wrote: > >> > >>> Can anyone provide some sample code for using the paged results > control? > >>> This is basically what I'm doing now: > >>> > >>> PagedResultsImpl prc =3D new PagedResultsImpl(); > >>> prc.setCritical(true); > >>> prc.setSize(5); > >>> > >>> SearchRequest request =3D new SearchRequestImpl(); > >>> request.setScope(SearchScope.SUBTREE); > >>> request.setBase(new Dn("dc=3Dvt,dc=3Dedu")); > >>> request.setFilter("(uid=3D*)"); > >>> request.addAllControls(new Control[] {prc, }); > >>> > >>> OpenLDAP is reporting: > >>> > >>> conn=3D1014 op=3D1 SEARCH RESULT tag=3D101 err=3D2 nentries=3D0 text= =3Dpaged > results > >>> control value is absent > >>> > >>> Thanks. > >>> > >>> --Daniel Fisher > >> > >> > > --bcaec51f8fd9e8d71804a6edff24--