Return-Path: X-Original-To: apmail-directory-users-archive@www.apache.org Delivered-To: apmail-directory-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3D8B910A52 for ; Mon, 22 Jul 2013 11:27:53 +0000 (UTC) Received: (qmail 18329 invoked by uid 500); 22 Jul 2013 11:27:53 -0000 Delivered-To: apmail-directory-users-archive@directory.apache.org Received: (qmail 18222 invoked by uid 500); 22 Jul 2013 11:27:53 -0000 Mailing-List: contact users-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@directory.apache.org Delivered-To: mailing list users@directory.apache.org Received: (qmail 18214 invoked by uid 99); 22 Jul 2013 11:27:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Jul 2013 11:27:51 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of elecharny@gmail.com designates 209.85.212.171 as permitted sender) Received: from [209.85.212.171] (HELO mail-wi0-f171.google.com) (209.85.212.171) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Jul 2013 11:27:45 +0000 Received: by mail-wi0-f171.google.com with SMTP id hj3so1744175wib.16 for ; Mon, 22 Jul 2013 04:27:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=+cEgmmbWCA9V4yPGyF4S+JAdiKg/3EmOWjGOSD4KroE=; b=0WcncIO7mi/90MiIDvdIWJUaVNfgRu38PEn+0mnfVcSiPxgBV8pnp3/VtAgeMd+ZqD 8sUb551mMl2fgy0ioIoysLXRbbpN7ssgmNR2s/bPI6FuKKjTzDZSHwTkNutoD3rppCy8 axg95rgZ8hrmE0iqgw264EA5X7wQ9V9jR3tQzmMaDD86BgH5vBhBPOI3kb1xCeuoVLoF iSqvV9PsbTSQezPVnyWZrn0ouiSbn4kAXfMDetJOB/FQ8XtoGayBauJXH84sSBzFNoMj zU/2KSqULy8i4mrYhV+gzmxN2PoHF8irrvmqWvzNm9wEgIpVIpILZCkVrhINf+jUeeHz u+rg== X-Received: by 10.180.20.228 with SMTP id q4mr5143878wie.60.1374492445039; Mon, 22 Jul 2013 04:27:25 -0700 (PDT) Received: from Emmanuels-MacBook-Pro.local (ran75-1-78-192-106-184.fbxo.proxad.net. [78.192.106.184]) by mx.google.com with ESMTPSA id b20sm39985686wiw.4.2013.07.22.04.27.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 22 Jul 2013 04:27:23 -0700 (PDT) Message-ID: <51ED171D.5000809@gmail.com> Date: Mon, 22 Jul 2013 13:27:25 +0200 From: =?UTF-8?B?RW1tYW51ZWwgTMOpY2hhcm55?= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: users@directory.apache.org Subject: Re: Persistent Search References: In-Reply-To: X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org Le 7/22/13 1:09 PM, Kiran Ayyagari a écrit : > On Mon, Jul 22, 2013 at 4:15 PM, Alexander Broekhuis > wrote: > >> Hi all, >> >> I am looking into ApacheDS and the Api to work with the server. I am trying >> to implement some of the examples used in the documentation, but there are >> several small things differently with the latest release? Eg a >> connection.search(String, String,....) returns a EntryCursor, and not a >> SearchCursor, whereas a connection.search(SearchRequest) does return a >> SearchCursor. >> So a first question, why this difference? And what way is the >> best/preferred way to do a search etc? >> > EntryCursor is used when you expect only entries (not referrals) in the > results > SearchCursor gives you all entries and referrals (if present) as well At this point, I'm wondering if it makes sense to not use a SearchCursor in any case ? > >> My next question is about PersistentSearch, how do I do this? For example, >> I have the following code: >> SearchRequest searchRequest = new SearchRequestImpl().setBase( new Dn( >> "ou=system" ) ).setFilter( "objectclass=*)").setScope( >> SearchScope.ONELEVEL).addControl( new PersistentSearchImpl() ); >> SearchCursor cursor = con.search(searchRequest); >> >> while (cursor.next()) { >> Response response = cursor.get(); >> System.out.println(((SearchResultEntry)response).getEntry()); >> } >> cursor.close(); >> >> When I run this code without the Control it returns the entries I expect, >> but with the Control, it somehow blocks at cursor.next(). I am not even >> sure this is the correct way to do a persistent search, I can't find any >> documentation on this at all. Also, when I have a persistent search, how >> can I get a call that the result has been changed? Eg entry added/removed >> etc. >> >> you get the results asynchronously, i.e, you leave the loop running and it > will wait for > the incoming results, just make sure you increase the timeout either at the > connection (setTimeOut) > level or in the SearchRequest (setTimeLimit()) It would be cnvenient to have a persistentSearch() method hich returns a future, and you should have a non-blocking method to get a result when called, beside a blockig method. Wdyt ? -- Regards, Cordialement, Emmanuel Lécharny www.iktek.com