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 31650FCD9 for ; Wed, 21 Aug 2013 18:53:49 +0000 (UTC) Received: (qmail 26701 invoked by uid 500); 21 Aug 2013 18:53:48 -0000 Delivered-To: apmail-directory-users-archive@directory.apache.org Received: (qmail 26426 invoked by uid 500); 21 Aug 2013 18:53:48 -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 26409 invoked by uid 99); 21 Aug 2013 18:53:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Aug 2013 18:53:47 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ayyagarikiran@gmail.com designates 209.85.212.176 as permitted sender) Received: from [209.85.212.176] (HELO mail-wi0-f176.google.com) (209.85.212.176) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Aug 2013 18:53:41 +0000 Received: by mail-wi0-f176.google.com with SMTP id l12so1114535wiv.3 for ; Wed, 21 Aug 2013 11:53:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=8DaDxfdF1ZXaAKKMrvNSsLskdrRhHzDpfeA9Zr02nFo=; b=TYqsur59pDxSZSUdkN96ylWy/B2/0m5Pt/0MRgvQWsiLTBAyTwgA4etzaz0AHVJVFd y60N7v6Fz0MhRafyaaeJx95+Unn5M0enC8+sRKa+Mpodn7C2+MZajqxvAfwlo74w/+1J fGw293yeM5uNjfl/GNOZugO2PML/8q66R3DlFHQlJxs8R6ixa0eGDGguLZsfhtej1a8t OvGhjppOdoyKne6T9zFOXS8YnGQ8NN83tk9rO64yaM2TGa3kmzB1YaHyc7XbeUtuddsz teUxg8MwGdhzR7sAcF+VbjJsoAPPckoDrERfbPOqITDI5Fnz2SWguTQ4N2CVxPivBwTI kXhw== MIME-Version: 1.0 X-Received: by 10.194.205.164 with SMTP id lh4mr2952560wjc.46.1377111201254; Wed, 21 Aug 2013 11:53:21 -0700 (PDT) Sender: ayyagarikiran@gmail.com Received: by 10.216.245.199 with HTTP; Wed, 21 Aug 2013 11:53:21 -0700 (PDT) In-Reply-To: <87ioyyhov1.fsf@zoth-ommog.unzane.com> References: <51F1B074.1030709@gmail.com> <87y57vhpo3.fsf@zoth-ommog.unzane.com> <87ioyyhov1.fsf@zoth-ommog.unzane.com> Date: Thu, 22 Aug 2013 00:23:21 +0530 X-Google-Sender-Auth: MTZa_st8BGUYZRauiRdGHBW73pg Message-ID: Subject: Re: API behavior questions From: Kiran Ayyagari To: api@directory.apache.org Cc: users@directory.apache.org Content-Type: multipart/alternative; boundary=047d7bae4738f7932004e479afcb X-Virus-Checked: Checked by ClamAV on apache.org --047d7bae4738f7932004e479afcb Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On Thu, Aug 22, 2013 at 12:07 AM, Gerald Turner wrote: > Kiran Ayyagari writes: > > On Wed, Aug 21, 2013 at 5:37 AM, Gerald Turner > wrote: > >> Emmanuel L=E9charny writes: > >> > Le 7/26/13 12:01 AM, Richard Sand a =E9crit : > >> >> 5) What needs to happen to have the results of calls to > >> >> LdapConnection.search(..) return entries for which isSchemaAware > >> >> is true? > >> > The LdapConnection must be schema aware itself. > >> > > >> > For that to happen, you just have to call the loadSchema() method : > >> > > >> > LdapConnection connection =3D new LdapNetworkConnection( "localhost"= , > 389); > >> > connection.loadSchema(); > >> > > >> > Here, we will load the default schemas. > >> > > >> > You can use some specific schema by using : > >> > > >> > connection.loadSchema(); > >> > connection.addSchema( "MySchema.schema" ); > >> > > >> > where the "MySchema.schema" is a schema in OpenLDAP format. > >> > > >> > You can also use a SchemaLoader, but this get a bit too complex atm > >> > (and sadly, the associated method is not yet in the LdapConnection > >> > interface) > >> > >> I've tried: > >> > >> con.loadSchema() > >> ((LdapNetworkConnection) con).loadSchema(new DefaultSchemaLoader(=85= )) > >> ((LdapNetworkConnection) con).loadSchema(new > SingleLdifSchemaLoader(=85)) > >> ((LdapNetworkConnection) con).loadSchema(new JarLdifSchemaLoader(=85= )) > >> > >> without much success until finally trying: > > > > what was the error encountered while using above schema loaders? (are > > using a then inside a web application?) > > The errors were really just learning exercises ;-) > > Mostly from JUnit in Eclipse, but eventually in a web application on > JBoss 7. It is odd that JarLdifSchemaLoader couldn't find the schema > directory in api-ldap-schema-data-1.0.0-M20.jar, I'll investigate this > further. > > this is most likely due to an issue with classloaders > >> ((LdapNetworkConnection) con).loadSchema(new LdifSchemaLoader(=85)) > >> > >> with a File pointing at a modified local copy of the ApacheDS schema > >> directory. > >> > >> It takes about 2 seconds load and is only associated with that one > >> connection. > >> > >> =B7 Are there other interfaces that can be used to only load the > >> SchemaManager _once_ and have it shared across connections? > > > > no, not at the moment, can you file a request for this in JIRA[1] > > DIRAPI-153 > > >> =B7 Can I safely use the SchemaManager after a connection has been > >> returned to the pool. (e.g. instantiating Dn and other objects that > >> take SchemaManager in their constructors - at a point in the > >> application where communication with the LDAP server is no longer > >> necessary - doing comparisons on data structures that have been > >> cached in a session). > > > > yes, SchemaManager can be safely reused > > Great! > > >> =B7 I see a comment in DefaultSchemaLoader constructor: =93TODO Handle > >> schema loading on other LDAP servers=94 =97 how difficult would it be = to > >> implement parsing of OpenLDAP cn=3Dschema,cn=3Dconfig? If it's just a > >> matter of banging strings around because core parsing already exists, > >> maybe I could have a go at it. > > > > Studio already has the capability to parse this type of schema, > > perhaps we just need to move it to a utility class, another request > > please > > DIRAPI-154 > > >> =B7 Various times while parsing schemas (particularly while playing > >> with SchemaToLdif), I got rather ambiguous ParserExceptions. In a > >> debugger I could trace the exception to a rather detailed ANTLR > >> exception, unfortunately these root causes are being discarded. > >> Suggestion: Please chain exceptions! > > > > it would be helpful if you can attach the stacktrace to a new bug > > report > > DIRAPI-155 > > >> =B7 I feel like I'm going down a rabbit hole - all I really needed was > >> to get case-insensitive equality on Dn comparison. Our server > >> arbitrarily returns =93o=3DPeople=94 and sometimes =93o=3Dpeople=94. = Making the > >> LDAP Client API schema aware solves this, but so would hacking in > >> toLowerCase in a bazillion places. Maybe implementing a dumbed down > >> SchemaManager that returned some very na=EFve and static set of > >> assumptions for common attributes like =91o=92, =91ou=92, =91cn=92, an= d =91dc=92 > >> would work. > > > > personally I use the JarLdifSchemaLoader in cases like these > > Let us know if you have any issues with this schema loader in > > your application environment > > I'll give this a try, thanks! > > thanks for the bug reports > -- > Gerald Turner Email: gturner@unzane.com JID: gturner@unzane.com > GPG: 0xFA8CD6D5 21D9 B2E8 7FE7 F19E 5F7D 4D0C 3FA0 810F FA8C D6D5 > --=20 Kiran Ayyagari http://keydap.com --047d7bae4738f7932004e479afcb--